From efdaaad9d2a4ca353912b8d29520944a948aed2f Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 27 Oct 2026 18:14:29 +0000 Subject: [PATCH 1/2] refactor(cli): update std.xxx.yyy() calls to module.yyy() format in tsc migrate - Always apply post_process transforms in migrate_source even when deprecation_warnings is empty. - Expand stdlib_rewrites in post_process to include all stdlib module prefixes. - Add unit tests for std.xxx.yyy() migration. Co-authored-by: Tcode-Motion <188012755+Tcode-Motion@users.noreply.github.com> --- cli/src/commands/migrate.rs | 88 ++++++++++++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 1 deletion(-) diff --git a/cli/src/commands/migrate.rs b/cli/src/commands/migrate.rs index 903411ee..7eafefb5 100644 --- a/cli/src/commands/migrate.rs +++ b/cli/src/commands/migrate.rs @@ -182,7 +182,7 @@ pub fn migrate_source(source: &str) -> String { .collect(); if deprecation_warnings.is_empty() { - return source.to_string(); + return post_process(source); } // Sort by span start in reverse order @@ -281,7 +281,9 @@ fn post_process(source: &str) -> String { let stdlib_rewrites: &[(&str, &str)] = &[ ("std.math.", "math."), ("std.strings.", "string."), + ("std.string.", "string."), ("std.fs.", "file."), + ("std.file.", "file."), ("std.path.", "path."), ("std.env.", "env."), ("std.os.", "os."), @@ -298,6 +300,71 @@ fn post_process(source: &str) -> String { ("std.uuid.", "uuid."), ("std.database.", "database."), ("std.sqlite.", "sqlite."), + ("std.collections.", "collections."), + ("std.datetime.", "datetime."), + ("std.hash.", "hash."), + ("std.random.", "random."), + ("std.thread.", "thread."), + ("std.sync.", "sync."), + ("std.async.", "async."), + ("std.future.", "future."), + ("std.channel.", "channel."), + ("std.testing.", "testing."), + ("std.logging.", "logging."), + ("std.compress.", "compress."), + ("std.encoding.", "encoding."), + ("std.base64.", "base64."), + ("std.hex.", "hex."), + ("std.url.", "url."), + ("std.system.", "system."), + ("std.sys.", "sys."), + ("std.graphics.", "graphics."), + ("std.ai.", "ai."), + ("std.process.", "process."), + ("std.terminal.", "terminal."), + ("std.socket.", "socket."), + ("std.websocket.", "websocket."), + ("std.dns.", "dns."), + ("std.email.", "email."), + ("std.ftp.", "ftp."), + ("std.mysql.", "mysql."), + ("std.postgres.", "postgres."), + ("std.mongodb.", "mongodb."), + ("std.redis.", "redis."), + ("std.jwt.", "jwt."), + ("std.oauth.", "oauth."), + ("std.image.", "image."), + ("std.gui.", "gui."), + ("std.web.", "web."), + ("std.audio.", "audio."), + ("std.video.", "video."), + ("std.scheduler.", "scheduler."), + ("std.cache.", "cache."), + ("std.binary.", "binary."), + ("std.ini.", "ini."), + ("std.docs.", "docs."), + ("std.task.", "task."), + ("std.config.", "config."), + ("std.parallel.", "parallel."), + ("std.benchmark.", "benchmark."), + ("std.profiler.", "profiler."), + ("std.svg.", "svg."), + ("std.pdf.", "pdf."), + ("std.barcode.", "barcode."), + ("std.qrcode.", "qrcode."), + ("std.notification.", "notification."), + ("std.security.", "security."), + ("std.settings.", "settings."), + ("std.localization.", "localization."), + ("std.theme.", "theme."), + ("std.charts.", "charts."), + ("std.report.", "report."), + ("std.excel.", "excel."), + ("std.word.", "word."), + ("std.powerpoint.", "powerpoint."), + ("std.canvas.", "canvas."), + ("std.debug.", "debug."), + ("std.mock.", "mock."), ]; for (old, new) in stdlib_rewrites { out = out.replace(old, new); @@ -464,6 +531,25 @@ mod tests { assert_eq!(result, "x = math.abs(-42)"); } + #[test] + fn test_post_process_std_module_calls() { + let input = "x = std.collections.new()\nt = std.datetime.now()\nparsed = std.json.parse(s)\nlen = std.string.length(str)\nf = std.file.open(path)\nh = std.hash.sha256(data)"; + let result = post_process(input); + assert!(result.contains("x = collections.new()")); + assert!(result.contains("t = datetime.now()")); + assert!(result.contains("parsed = json.parse(s)")); + assert!(result.contains("len = string.length(str)")); + assert!(result.contains("f = file.open(path)")); + assert!(result.contains("h = hash.sha256(data)")); + } + + #[test] + fn test_migrate_source_std_calls() { + let input = "data = std.json.parse(s)"; + let result = migrate_source(input); + assert_eq!(result, "data = json.parse(s)"); + } + #[test] fn test_post_process_import_to_use() { let input = "import math\nfrom json import parse"; From bd5b1c8cd5acc4a6116fbb9750589622da06a870 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 27 Oct 2026 19:36:07 +0000 Subject: [PATCH 2/2] refactor(cli): update std.xxx.yyy() calls to module.yyy() format in tsc migrate - Always apply post_process transforms in migrate_source even when deprecation_warnings is empty. - Expand stdlib_rewrites in post_process to include all stdlib module prefixes. - Add unit tests for std.xxx.yyy() migration. Co-authored-by: Tcode-Motion <188012755+Tcode-Motion@users.noreply.github.com>