@wise/wds-codemods 1.0.0-experimental-5d002fd → 1.0.0-experimental-601f194

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
- const require_helpers = require('./helpers-CghwwYSg.js');
2
+ const require_helpers = require('./helpers-RWhTD5Is.js');
3
+ const require_transformer = require('./transformer-B9Mt_gBf.js');
3
4
  let node_child_process = require("node:child_process");
4
5
  let node_fs_promises = require("node:fs/promises");
5
6
  node_fs_promises = require_helpers.__toESM(node_fs_promises);
@@ -12,48 +13,41 @@ let __inquirer_prompts = require("@inquirer/prompts");
12
13
  let isDebug = false;
13
14
  const currentFilePath = (0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href);
14
15
  const currentDirPath = node_path.default.dirname(currentFilePath);
15
- const ICONS = {
16
- info: "\x1B[34mℹ\x1B[0m",
17
- focus: "\x1B[34m➙\x1B[0m",
18
- success: "\x1B[32m✔\x1B[0m",
19
- warning: "\x1B[33m⚠\x1B[0m",
20
- error: "\x1B[31m✖\x1B[0m"
21
- };
22
16
  const resetReportFile = async (reportPath) => {
23
17
  try {
24
18
  await node_fs_promises.default.access(reportPath);
25
19
  await node_fs_promises.default.rm(reportPath);
26
- console.debug(`${ICONS.info} Removed existing report file${isDebug ? `: ${reportPath}` : "."}`);
20
+ console.debug(`${require_transformer.CONSOLE_ICONS.info} Removed existing report file${isDebug ? `: ${reportPath}` : "."}`);
27
21
  } catch {
28
- console.debug(`${ICONS.info} No existing report file to remove${isDebug ? `: ${reportPath}` : "."}`);
22
+ console.debug(`${require_transformer.CONSOLE_ICONS.info} No existing report file to remove${isDebug ? `: ${reportPath}` : "."}`);
29
23
  }
30
24
  };
31
25
  const summariseReportFile = async (reportPath) => {
32
26
  try {
33
27
  const lines = (await node_fs_promises.default.readFile(reportPath, "utf8")).split("\n").filter(Boolean);
34
- if (lines.length) console.debug(`\n⚠️ ${lines.length} manual review${lines.length > 1 ? "s are" : " is"} required. See ${reportPath} for details.`);
35
- else console.debug(`${ICONS.info} Report file exists but is empty${isDebug ? `: ${reportPath}` : "."}`);
28
+ if (lines.length) console.debug(`\n${require_transformer.CONSOLE_ICONS.warning} ${lines.length} manual review${lines.length > 1 ? "s are" : " is"} required. See ${reportPath} for details.`);
29
+ else console.debug(`${require_transformer.CONSOLE_ICONS.info} Report file exists but is empty${isDebug ? `: ${reportPath}` : "."}`);
36
30
  } catch {
37
- console.debug(`${ICONS.info} No report file generated - no manual reviews needed`);
31
+ console.debug(`${require_transformer.CONSOLE_ICONS.info} No report file generated - no manual reviews needed`);
38
32
  }
39
33
  };
34
+ const log = (label, value) => {
35
+ if (typeof require_helpers.logToInquirer === "function") require_helpers.logToInquirer(label, value || "");
36
+ else console.info(label, value || "");
37
+ };
40
38
  async function runCodemod(transformsDir) {
39
+ const args = process.argv.slice(2);
40
+ const candidate = args[0];
41
+ isDebug = args.includes("--debug");
41
42
  try {
42
- const args = process.argv.slice(2);
43
- const candidate = args[0];
44
- isDebug = args.includes("--debug");
45
43
  const packages = require_helpers.findPackages();
46
44
  const reportPath = node_path.default.resolve(require_helpers.findProjectRoot(), "codemod-report.txt");
47
45
  const resolvedTransformsDir = transformsDir ?? node_path.default.resolve(currentDirPath, "../dist/transforms");
48
- if (isDebug) console.debug(`${ICONS.info} Resolved transforms directory: ${resolvedTransformsDir}`);
46
+ if (isDebug) console.debug(`${require_transformer.CONSOLE_ICONS.info} Resolved transforms directory: ${resolvedTransformsDir}`);
49
47
  await resetReportFile(reportPath);
50
48
  const { transformFiles } = await require_helpers.loadTransformModules_default(resolvedTransformsDir);
51
49
  const resolvedTransformNames = await Promise.all(transformFiles);
52
- if (resolvedTransformNames.length === 0) throw new Error(`${ICONS.error} No transform scripts found${isDebug ? ` in: ${resolvedTransformsDir}` : "."}`);
53
- const log = (label, value) => {
54
- if (typeof require_helpers.logToInquirer === "function") require_helpers.logToInquirer(label, value);
55
- else console.info(label, value);
56
- };
50
+ if (resolvedTransformNames.length === 0) throw new Error(`${require_transformer.CONSOLE_ICONS.error} No transform scripts found${isDebug ? ` in: ${resolvedTransformsDir}` : "."}`);
57
51
  let transformFile;
58
52
  if (candidate && resolvedTransformNames.includes(candidate)) {
59
53
  log("Select codemod to run:", candidate);
@@ -69,7 +63,7 @@ async function runCodemod(transformsDir) {
69
63
  log("Selected codemod:", transformFile);
70
64
  }
71
65
  const codemodPath = node_path.default.resolve(resolvedTransformsDir, transformFile, "transformer.js");
72
- if (isDebug) console.debug(`${ICONS.info} Resolved codemod path: ${codemodPath}`);
66
+ if (isDebug) console.debug(`${require_transformer.CONSOLE_ICONS.info} Resolved codemod path: ${codemodPath}`);
73
67
  const promptAnswers = await require_helpers.runTransformPrompts(codemodPath);
74
68
  const options = await require_helpers.getOptions_default({
75
69
  packages,
@@ -77,8 +71,9 @@ async function runCodemod(transformsDir) {
77
71
  transformFiles: resolvedTransformNames,
78
72
  preselectedTransformFile: transformFile
79
73
  });
80
- options.targetPaths.map((targetPath) => {
81
- console.info(`${ICONS.focus} \x1b[1mProcessing:\x1b[0m \x1b[32m${targetPath}\x1b[0m`);
74
+ if (transformFile === "list-item") await require_transformer.transformer_default(options.targetPaths, codemodPath, isDebug);
75
+ else await Promise.all(options.targetPaths.map(async (targetPath) => {
76
+ console.info(`${require_transformer.CONSOLE_ICONS.focus} \x1b[1mProcessing:\x1b[0m \x1b[32m${targetPath}\x1b[0m`);
82
77
  if (require_helpers.assessPrerequisites(targetPath, codemodPath)) {
83
78
  const answerArgs = Object.entries(promptAnswers).map(([promptName, answerValue]) => `--${promptName}=${String(answerValue)}`);
84
79
  const command = `npx jscodeshift ${[
@@ -91,14 +86,14 @@ async function runCodemod(transformsDir) {
91
86
  options.useGitIgnore ? "--gitignore" : "",
92
87
  ...answerArgs
93
88
  ].filter(Boolean).join(" ")}`;
94
- if (isDebug) console.debug(`${ICONS.info} Running: ${command}`);
89
+ if (isDebug) console.debug(`${require_transformer.CONSOLE_ICONS.info} Running: ${command}`);
95
90
  return (0, node_child_process.execSync)(command, { stdio: "inherit" });
96
91
  }
97
- });
92
+ }));
98
93
  await summariseReportFile(reportPath);
99
94
  } catch (error) {
100
- if (error instanceof Error) console.error(`${ICONS.error} Error running codemod:`, error.message);
101
- else console.error(`${ICONS.error} Error running codemod:`, error);
95
+ if (error instanceof Error) console.error(`${require_transformer.CONSOLE_ICONS.error} Error running ${candidate} codemod:`, error.message);
96
+ else console.error(`${require_transformer.CONSOLE_ICONS.error} Error running ${candidate} codemod:`, error);
102
97
  if (process.env.NODE_ENV !== "test") process.exit(1);
103
98
  }
104
99
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["path","fs","findPackages","findProjectRoot","loadTransformModules","logToInquirer","transformFile: string","runTransformPrompts","getOptions","assessPrerequisites","error: unknown"],"sources":["../src/controller/index.ts","../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { execSync } from 'node:child_process';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { select as list } from '@inquirer/prompts';\n\nimport {\n assessPrerequisites,\n findPackages,\n findProjectRoot,\n getOptions,\n loadTransformModules,\n logToInquirer,\n runTransformPrompts,\n} from './helpers';\n\nlet isDebug = false;\nconst currentFilePath = fileURLToPath(import.meta.url);\nconst currentDirPath = path.dirname(currentFilePath);\nconst ICONS = {\n info: '\\x1b[34mℹ\\x1b[0m', // Blue info icon\n focus: '\\x1b[34m➙\\x1b[0m', // Blue arrow icon\n success: '\\x1b[32m✔\\x1b[0m', // Green checkmark\n warning: '\\x1b[33m⚠\\x1b[0m', // Yellow warning icon\n error: '\\x1b[31m✖\\x1b[0m', // Red cross icon\n};\n\nconst resetReportFile = async (reportPath: string) => {\n try {\n await fs.access(reportPath);\n await fs.rm(reportPath);\n console.debug(`${ICONS.info} Removed existing report file${isDebug ? `: ${reportPath}` : '.'}`);\n } catch {\n console.debug(\n `${ICONS.info} No existing report file to remove${isDebug ? `: ${reportPath}` : '.'}`,\n );\n }\n};\n\nconst summariseReportFile = async (reportPath: string) => {\n try {\n const reportContent = await fs.readFile(reportPath, 'utf8');\n const lines = reportContent.split('\\n').filter(Boolean);\n if (lines.length) {\n console.debug(\n `\\n⚠️ ${lines.length} manual review${lines.length > 1 ? 's are' : ' is'} required. See ${reportPath} for details.`,\n );\n } else {\n console.debug(\n `${ICONS.info} Report file exists but is empty${isDebug ? `: ${reportPath}` : '.'}`,\n );\n }\n } catch {\n console.debug(`${ICONS.info} No report file generated - no manual reviews needed`);\n }\n};\n\nasync function runCodemod(transformsDir?: string) {\n try {\n const args = process.argv.slice(2);\n const candidate = args[0];\n isDebug = args.includes('--debug');\n const packages = findPackages();\n const reportPath = path.resolve(findProjectRoot(), 'codemod-report.txt');\n const resolvedTransformsDir =\n transformsDir ?? path.resolve(currentDirPath, '../dist/transforms');\n\n if (isDebug) {\n console.debug(`${ICONS.info} Resolved transforms directory: ${resolvedTransformsDir}`);\n }\n\n await resetReportFile(reportPath);\n\n const { transformFiles } = await loadTransformModules(resolvedTransformsDir);\n\n const resolvedTransformNames = await Promise.all(transformFiles);\n if (resolvedTransformNames.length === 0) {\n throw new Error(\n `${ICONS.error} No transform scripts found${isDebug ? ` in: ${resolvedTransformsDir}` : '.'}`,\n );\n }\n\n const log = (label: string, value: string): void => {\n if (typeof logToInquirer === 'function') {\n logToInquirer(label, value);\n } else {\n console.info(label, value);\n }\n };\n\n let transformFile: string;\n\n if (candidate && resolvedTransformNames.includes(candidate)) {\n log('Select codemod to run:', candidate);\n transformFile = candidate;\n } else {\n transformFile = await list({\n message: 'Select codemod to run:',\n choices: resolvedTransformNames.map((name) => ({ name, value: name })),\n });\n log('Selected codemod:', transformFile);\n }\n\n const codemodPath = path.resolve(resolvedTransformsDir, transformFile, 'transformer.js');\n if (isDebug) {\n console.debug(`${ICONS.info} Resolved codemod path: ${codemodPath}`);\n }\n\n const promptAnswers = await runTransformPrompts(codemodPath);\n\n const options = await getOptions({\n packages,\n root: findProjectRoot(),\n transformFiles: resolvedTransformNames,\n preselectedTransformFile: transformFile,\n });\n\n options.targetPaths.map((targetPath) => {\n console.info(`${ICONS.focus} \\x1b[1mProcessing:\\x1b[0m \\x1b[32m${targetPath}\\x1b[0m`);\n\n const isCompliant = assessPrerequisites(targetPath, codemodPath);\n if (isCompliant) {\n const answerArgs = Object.entries(promptAnswers).map(\n ([promptName, answerValue]) => `--${promptName}=${String(answerValue)}`,\n );\n\n const argsList = [\n '-t',\n codemodPath,\n targetPath,\n options.isDry ? '--dry' : '',\n options.isPrint ? '--print' : '',\n options.ignorePatterns\n ? options.ignorePatterns\n .split(',')\n .map((pattern) => `--ignore-pattern=${pattern.trim()}`)\n .join(' ')\n : '',\n options.useGitIgnore ? '--gitignore' : '',\n ...answerArgs,\n ].filter(Boolean);\n\n const command = `npx jscodeshift ${argsList.join(' ')}`;\n if (isDebug) {\n console.debug(`${ICONS.info} Running: ${command}`);\n }\n return execSync(command, { stdio: 'inherit' });\n }\n return undefined;\n });\n\n await summariseReportFile(reportPath);\n } catch (error: unknown) {\n if (error instanceof Error) {\n console.error(`${ICONS.error} Error running codemod:`, error.message);\n } else {\n console.error(`${ICONS.error} Error running codemod:`, error);\n }\n if (process.env.NODE_ENV !== 'test') {\n process.exit(1);\n }\n }\n}\n\nexport { runCodemod };\n","#!/usr/bin/env node\nimport { runCodemod } from './controller';\n\nvoid runCodemod();\n"],"mappings":";;;;;;;;;;;AAmBA,IAAI,UAAU;AACd,MAAM,4FAAgD;AACtD,MAAM,iBAAiBA,kBAAK,QAAQ,gBAAgB;AACpD,MAAM,QAAQ;CACZ,MAAM;CACN,OAAO;CACP,SAAS;CACT,SAAS;CACT,OAAO;CACR;AAED,MAAM,kBAAkB,OAAO,eAAuB;AACpD,KAAI;AACF,QAAMC,yBAAG,OAAO,WAAW;AAC3B,QAAMA,yBAAG,GAAG,WAAW;AACvB,UAAQ,MAAM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SAAQ,MAAM,GAAG,MAAM,MAAM,0BAA0B,MAAM;AAE/D,MAAI,QAAQ,IAAI,aAAa,OAC3B,SAAQ,KAAK,EAAE;;;;;;AC/JhB,YAAY"}
1
+ {"version":3,"file":"index.js","names":["path","fs","CONSOLE_ICONS","logToInquirer","findPackages","findProjectRoot","loadTransformModules","transformFile: string","runTransformPrompts","getOptions","transformer","assessPrerequisites","error: unknown"],"sources":["../src/controller/index.ts","../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { execSync } from 'node:child_process';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { select as list } from '@inquirer/prompts';\n\nimport { CONSOLE_ICONS } from '../constants';\nimport transformer from '../transforms/list-item/transformer';\nimport {\n assessPrerequisites,\n findPackages,\n findProjectRoot,\n getOptions,\n loadTransformModules,\n logToInquirer,\n runTransformPrompts,\n} from './helpers';\n\nlet isDebug = false;\nconst currentFilePath = fileURLToPath(import.meta.url);\nconst currentDirPath = path.dirname(currentFilePath);\n\nconst resetReportFile = async (reportPath: string) => {\n try {\n await fs.access(reportPath);\n await fs.rm(reportPath);\n console.debug(\n `${CONSOLE_ICONS.info} Removed existing report file${isDebug ? `: ${reportPath}` : '.'}`,\n );\n } catch {\n console.debug(\n `${CONSOLE_ICONS.info} No existing report file to remove${isDebug ? `: ${reportPath}` : '.'}`,\n );\n }\n};\n\nconst summariseReportFile = async (reportPath: string) => {\n try {\n const reportContent = await fs.readFile(reportPath, 'utf8');\n const lines = reportContent.split('\\n').filter(Boolean);\n if (lines.length) {\n console.debug(\n `\\n${CONSOLE_ICONS.warning} ${lines.length} manual review${lines.length > 1 ? 's are' : ' is'} required. See ${reportPath} for details.`,\n );\n } else {\n console.debug(\n `${CONSOLE_ICONS.info} Report file exists but is empty${isDebug ? `: ${reportPath}` : '.'}`,\n );\n }\n } catch {\n console.debug(`${CONSOLE_ICONS.info} No report file generated - no manual reviews needed`);\n }\n};\n\nconst log = (label: string, value?: string): void => {\n if (typeof logToInquirer === 'function') {\n logToInquirer(label, value || '');\n } else {\n console.info(label, value || '');\n }\n};\n\nasync function runCodemod(transformsDir?: string) {\n const args = process.argv.slice(2);\n const candidate = args[0];\n isDebug = args.includes('--debug');\n\n try {\n const packages = findPackages();\n const reportPath = path.resolve(findProjectRoot(), 'codemod-report.txt');\n const resolvedTransformsDir =\n transformsDir ?? path.resolve(currentDirPath, '../dist/transforms');\n\n if (isDebug) {\n console.debug(\n `${CONSOLE_ICONS.info} Resolved transforms directory: ${resolvedTransformsDir}`,\n );\n }\n\n await resetReportFile(reportPath);\n\n const { transformFiles } = await loadTransformModules(resolvedTransformsDir);\n\n const resolvedTransformNames = await Promise.all(transformFiles);\n if (resolvedTransformNames.length === 0) {\n throw new Error(\n `${CONSOLE_ICONS.error} No transform scripts found${isDebug ? ` in: ${resolvedTransformsDir}` : '.'}`,\n );\n }\n\n let transformFile: string;\n\n if (candidate && resolvedTransformNames.includes(candidate)) {\n log('Select codemod to run:', candidate);\n transformFile = candidate;\n } else {\n transformFile = await list({\n message: 'Select codemod to run:',\n choices: resolvedTransformNames.map((name) => ({ name, value: name })),\n });\n log('Selected codemod:', transformFile);\n }\n\n const codemodPath = path.resolve(resolvedTransformsDir, transformFile, 'transformer.js');\n if (isDebug) {\n console.debug(`${CONSOLE_ICONS.info} Resolved codemod path: ${codemodPath}`);\n }\n\n const promptAnswers = await runTransformPrompts(codemodPath);\n\n const options = await getOptions({\n packages,\n root: findProjectRoot(),\n transformFiles: resolvedTransformNames,\n preselectedTransformFile: transformFile,\n });\n\n // Handle ListItem transform differently as it uses Claude, not jscodeshift\n if (transformFile === 'list-item') {\n // TODO: Handle ALL args and options properly - isDry, isPrint, ignorePatterns, useGitIgnore, etc\n await transformer(options.targetPaths, codemodPath, isDebug);\n } else {\n await Promise.all(\n options.targetPaths.map(async (targetPath) => {\n console.info(\n `${CONSOLE_ICONS.focus} \\x1b[1mProcessing:\\x1b[0m \\x1b[32m${targetPath}\\x1b[0m`,\n );\n\n const isCompliant = assessPrerequisites(targetPath, codemodPath);\n if (isCompliant) {\n const answerArgs = Object.entries(promptAnswers).map(\n ([promptName, answerValue]) => `--${promptName}=${String(answerValue)}`,\n );\n\n const argsList = [\n '-t',\n codemodPath,\n targetPath,\n options.isDry ? '--dry' : '',\n options.isPrint ? '--print' : '',\n options.ignorePatterns\n ? options.ignorePatterns\n .split(',')\n .map((pattern) => `--ignore-pattern=${pattern.trim()}`)\n .join(' ')\n : '',\n options.useGitIgnore ? '--gitignore' : '',\n ...answerArgs,\n ].filter(Boolean);\n const command = `npx jscodeshift ${argsList.join(' ')}`;\n\n if (isDebug) {\n console.debug(`${CONSOLE_ICONS.info} Running: ${command}`);\n }\n\n return execSync(command, { stdio: 'inherit' });\n }\n return undefined;\n }),\n );\n }\n\n await summariseReportFile(reportPath);\n } catch (error: unknown) {\n if (error instanceof Error) {\n console.error(`${CONSOLE_ICONS.error} Error running ${candidate} codemod:`, error.message);\n } else {\n console.error(`${CONSOLE_ICONS.error} Error running ${candidate} codemod:`, error);\n }\n if (process.env.NODE_ENV !== 'test') {\n process.exit(1);\n }\n }\n}\n\nexport { runCodemod };\n","#!/usr/bin/env node\nimport { runCodemod } from './controller';\n\nvoid runCodemod();\n"],"mappings":";;;;;;;;;;;;AAqBA,IAAI,UAAU;AACd,MAAM,4FAAgD;AACtD,MAAM,iBAAiBA,kBAAK,QAAQ,gBAAgB;AAEpD,MAAM,kBAAkB,OAAO,eAAuB;AACpD,KAAI;AACF,QAAMC,yBAAG,OAAO,WAAW;AAC3B,QAAMA,yBAAG,GAAG,WAAW;AACvB,UAAQ,MACN,GAAGC,kCAAc,KAAK,+BAA+B,UAAU,KAAK,eAAe,MACpF;SACK;AACN,UAAQ,MACN,GAAGA,kCAAc,KAAK,oCAAoC,UAAU,KAAK,eAAe,MACzF;;;AAIL,MAAM,sBAAsB,OAAO,eAAuB;AACxD,KAAI;EAEF,MAAM,SADgB,MAAMD,yBAAG,SAAS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AU,YAAY,MAAM;AAEpF,MAAI,QAAQ,IAAI,aAAa,OAC3B,SAAQ,KAAK,EAAE;;;;;;AC1KhB,YAAY"}
@@ -0,0 +1,345 @@
1
+ const require_helpers = require('./helpers-RWhTD5Is.js');
2
+ let node_child_process = require("node:child_process");
3
+ let node_path = require("node:path");
4
+ let node_fs = require("node:fs");
5
+ let __anthropic_ai_claude_agent_sdk = require("@anthropic-ai/claude-agent-sdk");
6
+
7
+ //#region src/constants.ts
8
+ const CONSOLE_ICONS = {
9
+ info: "\x1B[34mℹ\x1B[0m",
10
+ focus: "\x1B[34m➙\x1B[0m",
11
+ success: "\x1B[32m✔\x1B[0m",
12
+ warning: "\x1B[33m⚠\x1B[0m",
13
+ error: "\x1B[31m✖\x1B[0m"
14
+ };
15
+
16
+ //#endregion
17
+ //#region src/transforms/list-item/constants.ts
18
+ const DEPRECATED_COMPONENT_NAMES = [
19
+ "ActionOption",
20
+ "NavigationOption",
21
+ "NavigationOptionsList",
22
+ "Summary",
23
+ "SwitchOption",
24
+ "CheckboxOption",
25
+ "RadioOption"
26
+ ];
27
+ const MIGRATION_RULES = `Migration rules:
28
+ # Legacy Component → ListItem Migration Guide
29
+
30
+ ## Universal Rules
31
+
32
+ 1. Wrap all \`ListItem\` in \`<List>\`
33
+ 2. \`title\` → \`title\` (direct)
34
+ 3. \`content\` or \`description\` → \`subtitle\`
35
+ 4. \`disabled\` stays on \`ListItem\` (not controls)
36
+ 5. Keep HTML attributes (\`id\`, \`name\`, \`aria-label\`), remove: \`as\`, \`complex\`, \`showMediaAtAllSizes\`, \`showMediaCircle\`, \`isContainerAligned\`
37
+
38
+ ---
39
+
40
+ ## ActionOption → ListItem.Button
41
+
42
+ - \`action\` → Button children
43
+ - \`onClick\` → Button \`onClick\`
44
+ - Priority: default/\`"primary"\` → \`"primary"\`, \`"secondary"\` → \`"secondary-neutral"\`, \`"secondary-send"\` → \`"secondary"\`, \`"tertiary"\` → \`"tertiary"\`
45
+
46
+ \`\`\`tsx
47
+ <ActionOption title="Title" content="Text" action="Click" priority="secondary" onClick={fn} />
48
+ →
49
+ <List><ListItem title="Title" subtitle="Text" control={<ListItem.Button priority="secondary-neutral" onClick={fn}>Click</ListItem.Button>} /></List>
50
+ \`\`\`
51
+
52
+ ---
53
+
54
+ ## CheckboxOption → ListItem.Checkbox
55
+
56
+ - \`onChange\`: \`(checked: boolean)\` → \`(event: ChangeEvent)\` use \`event.target.checked\`
57
+ - \`id\`, \`name\` move to Checkbox
58
+
59
+ \`\`\`tsx
60
+ <CheckboxOption id="x" name="y" title="Title" content="Text" checked={v} onChange={(c) => set(c)} />
61
+ →
62
+ <List><ListItem title="Title" subtitle="Text" control={<ListItem.Checkbox id="x" name="y" checked={v} onChange={(e) => set(e.target.checked)} />} /></List>
63
+ \`\`\`
64
+
65
+ ---
66
+
67
+ ## RadioOption → ListItem.Radio
68
+
69
+ - \`id\`, \`name\`, \`value\`, \`checked\`, \`onChange\` move to Radio
70
+
71
+ \`\`\`tsx
72
+ <RadioOption id="x" name="y" value="v" title="Title" content="Text" checked={v==='v'} onChange={set} />
73
+ →
74
+ <List><ListItem title="Title" subtitle="Text" control={<ListItem.Radio id="x" name="y" value="v" checked={v==='v'} onChange={set} />} /></List>
75
+ \`\`\`
76
+
77
+ ---
78
+
79
+ ## SwitchOption → ListItem.Switch
80
+
81
+ - \`onChange\` → \`onClick\`, toggle manually
82
+ - \`aria-label\` moves to Switch
83
+
84
+ \`\`\`tsx
85
+ <SwitchOption title="Title" content="Text" checked={v} aria-label="Toggle" onChange={set} />
86
+ →
87
+ <List><ListItem title="Title" subtitle="Text" control={<ListItem.Switch checked={v} aria-label="Toggle" onClick={() => set(!v)} />} /></List>
88
+ \`\`\`
89
+
90
+ ---
91
+
92
+ ## NavigationOption → ListItem.Navigation
93
+
94
+ - \`onClick\` or \`href\` move to Navigation
95
+
96
+ \`\`\`tsx
97
+ <NavigationOption title="Title" content="Text" onClick={fn} />
98
+ →
99
+ <List><ListItem title="Title" subtitle="Text" control={<ListItem.Navigation onClick={fn} />} /></List>
100
+ \`\`\`
101
+
102
+ ---
103
+
104
+ ## Option → ListItem
105
+
106
+ - Wrap \`media\` in \`ListItem.AvatarView\`
107
+
108
+ \`\`\`tsx
109
+ <Option media={<Icon />} title="Title" />
110
+ →
111
+ <List><ListItem title="Title" media={<ListItem.AvatarView><Icon /></ListItem.AvatarView>} /></List>
112
+ \`\`\`
113
+
114
+ ---
115
+
116
+ ## Summary → ListItem
117
+
118
+ **Basic:**
119
+
120
+ - \`icon\` → wrap in \`ListItem.AvatarView\` with \`size={32}\` as \`media\`
121
+
122
+ **Status:**
123
+
124
+ - \`Status.DONE\` → \`badge={{ status: 'positive' }}\`
125
+ - \`Status.PENDING\` → \`badge={{ status: 'pending' }}\`
126
+ - \`Status.NOT_DONE\` → no badge
127
+
128
+ **Action:**
129
+
130
+ - \`action.text\` → \`action.label\` in \`ListItem.AdditionalInfo\` as \`additionalInfo\`
131
+
132
+ **Info (requires state):**
133
+
134
+ - \`MODAL\` → \`ListItem.IconButton partiallyInteractive\` + \`<Modal>\` in \`control\`
135
+ - \`POPOVER\` → \`<Popover>\` wrapping \`ListItem.IconButton partiallyInteractive\` in \`control\`
136
+ - Use \`QuestionMarkCircle\` icon
137
+
138
+ \`\`\`tsx
139
+ // Basic
140
+ <Summary title="T" description="D" icon={<Icon />} />
141
+ →
142
+ <List><ListItem title="T" subtitle="D" media={<ListItem.AvatarView size={32}><Icon /></ListItem.AvatarView>} /></List>
143
+
144
+ // Status
145
+ <Summary title="T" description="D" icon={<Icon />} status={Status.DONE} />
146
+ →
147
+ <List><ListItem title="T" subtitle="D" media={<ListItem.AvatarView size={32} badge={{status:'positive'}}><Icon /></ListItem.AvatarView>} /></List>
148
+
149
+ // Action
150
+ <Summary title="T" description="D" icon={<Icon />} action={{text:'Go', href:'/go'}} />
151
+ →
152
+ <List><ListItem title="T" subtitle="D" media={<ListItem.AvatarView size={32}><Icon /></ListItem.AvatarView>} additionalInfo={<ListItem.AdditionalInfo action={{label:'Go', href:'/go'}} />} /></List>
153
+
154
+ // Modal (add: const [open, setOpen] = useState(false))
155
+ <Summary title="T" description="D" icon={<Icon />} info={{title:'Help', content:'Text', presentation:'MODAL', 'aria-label':'Info'}} />
156
+ →
157
+ <List><ListItem title="T" subtitle="D" media={<ListItem.AvatarView size={32}><Icon /></ListItem.AvatarView>} control={<ListItem.IconButton partiallyInteractive aria-label="Info" onClick={()=>setOpen(!open)}><QuestionMarkCircle /><Modal open={open} title="Help" body="Text" onClose={()=>setOpen(false)} /></ListItem.IconButton>} /></List>
158
+
159
+ // Popover
160
+ <Summary title="T" description="D" icon={<Icon />} info={{title:'Help', content:'Text', presentation:'POPOVER', 'aria-label':'Info'}} />
161
+ →
162
+ <List><ListItem title="T" subtitle="D" media={<ListItem.AvatarView size={32}><Icon /></ListItem.AvatarView>} control={<Popover title="Help" content="Text" onClose={()=>setOpen(false)}><ListItem.IconButton partiallyInteractive aria-label="Info"><QuestionMarkCircle /></ListItem.IconButton></Popover>} /></List>
163
+ \`\`\`
164
+
165
+ ---
166
+
167
+ ## DefinitionList → Multiple ListItem
168
+
169
+ - Array → individual \`ListItem\`s
170
+ - \`value\` → \`subtitle\`
171
+ - \`key\` → React \`key\` prop
172
+ - Action type: "Edit"/"Update"/"View" → \`ListItem.Button priority="secondary-neutral"\`, "Change"/"Password" → \`ListItem.Navigation\`, "Copy" → \`ListItem.IconButton\`
173
+
174
+ \`\`\`tsx
175
+ <DefinitionList definitions={[
176
+ {title:'T1', value:'V1', key:'k1'},
177
+ {title:'T2', value:'V2', key:'k2', action:{label:'Edit', onClick:fn}}
178
+ ]} />
179
+ →
180
+ <List>
181
+ <ListItem key="k1" title="T1" subtitle="V1" />
182
+ <ListItem key="k2" title="T2" subtitle="V2" control={<ListItem.Button priority="secondary-neutral" onClick={fn}>Edit</ListItem.Button>} />
183
+ </List>
184
+ \`\`\`
185
+ `;
186
+ const SYSTEM_PROMPT = `Transform TypeScript/JSX code from legacy Wise Design System (WDS) components to the new ListItem component and ListItem subcomponents from '@transferwise/components'.
187
+
188
+ Read and transform each file one at a time, instead of reading them all at the start.
189
+
190
+ Rules:
191
+ 1. Ignore any files that do not contain deprecated WDS components, unless they are necessary for context.
192
+ 2. Migrate components per provided migration rules
193
+ 3. Maintain TypeScript type safety and update types to match new API
194
+ 4. Map props: handle renamed, deprecated, new required, and changed types
195
+ 5. Update imports to new WDS components and types
196
+ 6. Preserve code style, formatting, and calculated logic
197
+ 7. Handle conditional rendering, spread props, and complex expressions
198
+ 8. Note: New components may lack feature parity with legacy versions
199
+ 9. Only modify code requiring changes per migration rules, and any impacted surrounding code for context.
200
+ 10. Provide only the transformed code as output, without explanations or additional text
201
+ 11. Do not summarise the initial user request in a response, only use the response formats in JSON for all communication.
202
+
203
+ Make the necessary updates to the files and do not respond with any explanations or reasoning.
204
+
205
+ You'll receive:
206
+ - File paths/directories to search in individual queries
207
+ - Deprecated component names at the end of this prompt
208
+ - Migration context and rules for each deprecated component
209
+
210
+ Response formats (json object string, not inside a code snippet):
211
+ {
212
+ type: "processing" | "done",
213
+ path: <directory-being-processed>
214
+ }
215
+
216
+ {
217
+ type: "updated",
218
+ path: <file-path>,
219
+ additions: <number-of-lines-added>,
220
+ deletions: <number-of-lines-removed>,
221
+ changes: <number-of-lines-changed>,
222
+ }
223
+
224
+ {
225
+ type: "error",
226
+ path: <file-path>,
227
+ message: <error-message>
228
+ }
229
+
230
+ Deprecated components: ${DEPRECATED_COMPONENT_NAMES.join(", ")}.
231
+
232
+ ${MIGRATION_RULES}`;
233
+
234
+ //#endregion
235
+ //#region src/transforms/list-item/claude.ts
236
+ const CLAUDE_SETTINGS_FILE = ".claude/settings.json";
237
+ function getQueryOptions(sessionId, isDebug) {
238
+ const claudeSettingsPath = (0, node_path.resolve)(process.env.HOME || "", CLAUDE_SETTINGS_FILE);
239
+ const settings = JSON.parse((0, node_fs.readFileSync)(claudeSettingsPath, "utf-8"));
240
+ let apiKey;
241
+ try {
242
+ apiKey = (0, node_child_process.execSync)(`bash ${settings.apiKeyHelper}`, { encoding: "utf-8" }).trim();
243
+ } catch {}
244
+ if (!apiKey) throw new Error("Failed to retrieve Anthropic API key. Please check your Claude Code x LLM Gateway configuration - https://transferwise.atlassian.net/wiki/x/_YUe3Q");
245
+ return {
246
+ resume: sessionId,
247
+ env: {
248
+ ANTHROPIC_AUTH_TOKEN: apiKey,
249
+ ANTHROPIC_BASE_URL: settings?.env?.ANTHROPIC_BASE_URL,
250
+ ANTHROPIC_CUSTOM_HEADERS: settings?.env?.ANTHROPIC_CUSTOM_HEADERS,
251
+ ANTHROPIC_DEFAULT_SONNET_MODEL: settings.env?.ANTHROPIC_DEFAULT_SONNET_MODEL,
252
+ ANTHROPIC_DEFAULT_HAIKU_MODEL: settings.env?.ANTHROPIC_DEFAULT_HAIKU_MODEL,
253
+ ANTHROPIC_DEFAULT_OPUS_MODEL: settings.env?.ANTHROPIC_DEFAULT_OPUS_MODEL,
254
+ API_TIMEOUT_MS: settings.env?.API_TIMEOUT_MS,
255
+ PATH: process.env.PATH
256
+ },
257
+ permissionMode: "acceptEdits",
258
+ systemPrompt: {
259
+ type: "preset",
260
+ preset: "claude_code",
261
+ append: SYSTEM_PROMPT
262
+ },
263
+ settingSources: [
264
+ "local",
265
+ "project",
266
+ "user"
267
+ ]
268
+ };
269
+ }
270
+ async function initiateClaudeSessionOptions(isDebug = false) {
271
+ console.log(`${CONSOLE_ICONS.info} Starting Claude instance - your browser may open for Okta authentication if required.`);
272
+ const options = getQueryOptions(void 0, isDebug);
273
+ const result = (0, __anthropic_ai_claude_agent_sdk.query)({
274
+ options,
275
+ prompt: `You'll be given directories in additional individual queries to search in for files using deprecated Wise Design System (WDS) components. Migrate the code per the provided migration rules.`
276
+ });
277
+ for await (const message of result) switch (message.type) {
278
+ case "system":
279
+ if (message.subtype === "init" && !options.resume) {
280
+ console.log(`${CONSOLE_ICONS.success} Successfully initialised Claude instance`);
281
+ options.resume = message.session_id;
282
+ }
283
+ break;
284
+ default: if (message.type === "result" && message.subtype !== "success") console.log(`${CONSOLE_ICONS.error} Claude encountered an error: ${message.errors.join("\n")}`);
285
+ }
286
+ return options;
287
+ }
288
+ async function queryClaude(path, options, isDebug = false) {
289
+ const result = (0, __anthropic_ai_claude_agent_sdk.query)({
290
+ options,
291
+ prompt: path
292
+ });
293
+ for await (const message of result) switch (message.type) {
294
+ case "system": break;
295
+ case "assistant":
296
+ for (const msg of message.message.content) switch (msg.type) {
297
+ case "tool_use":
298
+ if (isDebug) {
299
+ if (msg.name === "Read") console.log(`${CONSOLE_ICONS.info} Processing: ${msg.input.file_path}`);
300
+ else if (msg.name === "Write") console.log(`${CONSOLE_ICONS.info} Updated: ${msg.input.file_path}`);
301
+ }
302
+ break;
303
+ case "text": break;
304
+ default: console.log(msg);
305
+ }
306
+ break;
307
+ case "user": break;
308
+ case "result":
309
+ if (message.subtype === "success") console.log(`${CONSOLE_ICONS.success} ${message.result.trim().split("\n").join(`\n${CONSOLE_ICONS.success} `)}`);
310
+ else console.log(`${CONSOLE_ICONS.error} Claude encountered an error: ${message.errors.join("\n").trim()}`);
311
+ break;
312
+ default: break;
313
+ }
314
+ }
315
+
316
+ //#endregion
317
+ //#region src/transforms/list-item/transformer.ts
318
+ const transformer = async (targetPaths, codemodPath, isDebug = false) => {
319
+ const startTime = Date.now();
320
+ const queryOptions = await initiateClaudeSessionOptions(isDebug);
321
+ console.log(`${CONSOLE_ICONS.info} Analysing targetted paths - this may take a while...`);
322
+ for (const directory of targetPaths) if (require_helpers.assessPrerequisites(directory, codemodPath)) await queryClaude(directory, queryOptions, isDebug);
323
+ const endTime = Date.now();
324
+ const elapsedTime = Math.floor((endTime - startTime) / 1e3);
325
+ const hours = Math.floor(elapsedTime / 3600);
326
+ const minutes = Math.floor(elapsedTime % 3600 / 60);
327
+ const seconds = elapsedTime % 60;
328
+ console.log(`${CONSOLE_ICONS.success} Finished migrating - elapsed time: \x1b[1m${hours ? `${hours}h ` : ""}${minutes ? `${minutes}m ` : ""}${seconds ? `${seconds}s` : ""}\x1b[0m`);
329
+ };
330
+ var transformer_default = transformer;
331
+
332
+ //#endregion
333
+ Object.defineProperty(exports, 'CONSOLE_ICONS', {
334
+ enumerable: true,
335
+ get: function () {
336
+ return CONSOLE_ICONS;
337
+ }
338
+ });
339
+ Object.defineProperty(exports, 'transformer_default', {
340
+ enumerable: true,
341
+ get: function () {
342
+ return transformer_default;
343
+ }
344
+ });
345
+ //# sourceMappingURL=transformer-B9Mt_gBf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformer-B9Mt_gBf.js","names":["assessPrerequisites"],"sources":["../src/constants.ts","../src/transforms/list-item/constants.ts","../src/transforms/list-item/claude.ts","../src/transforms/list-item/transformer.ts"],"sourcesContent":["export const CONSOLE_ICONS = {\n info: '\\x1b[34mℹ\\x1b[0m', // Blue info icon\n focus: '\\x1b[34m➙\\x1b[0m', // Blue arrow icon\n success: '\\x1b[32m✔\\x1b[0m', // Green checkmark\n warning: '\\x1b[33m⚠\\x1b[0m', // Yellow warning icon\n error: '\\x1b[31m✖\\x1b[0m', // Red cross icon\n};\n","const DEPRECATED_COMPONENT_NAMES = [\n 'ActionOption',\n 'NavigationOption',\n 'NavigationOptionsList',\n 'Summary',\n 'SwitchOption',\n 'CheckboxOption',\n 'RadioOption',\n];\n\nconst MIGRATION_RULES = `Migration rules:\n# Legacy Component → ListItem Migration Guide\n\n## Universal Rules\n\n1. Wrap all \\`ListItem\\` in \\`<List>\\`\n2. \\`title\\` → \\`title\\` (direct)\n3. \\`content\\` or \\`description\\` → \\`subtitle\\`\n4. \\`disabled\\` stays on \\`ListItem\\` (not controls)\n5. Keep HTML attributes (\\`id\\`, \\`name\\`, \\`aria-label\\`), remove: \\`as\\`, \\`complex\\`, \\`showMediaAtAllSizes\\`, \\`showMediaCircle\\`, \\`isContainerAligned\\`\n\n---\n\n## ActionOption → ListItem.Button\n\n- \\`action\\` → Button children\n- \\`onClick\\` → Button \\`onClick\\`\n- Priority: default/\\`\"primary\"\\` → \\`\"primary\"\\`, \\`\"secondary\"\\` → \\`\"secondary-neutral\"\\`, \\`\"secondary-send\"\\` → \\`\"secondary\"\\`, \\`\"tertiary\"\\` → \\`\"tertiary\"\\`\n\n\\`\\`\\`tsx\n<ActionOption title=\"Title\" content=\"Text\" action=\"Click\" priority=\"secondary\" onClick={fn} />\n→\n<List><ListItem title=\"Title\" subtitle=\"Text\" control={<ListItem.Button priority=\"secondary-neutral\" onClick={fn}>Click</ListItem.Button>} /></List>\n\\`\\`\\`\n\n---\n\n## CheckboxOption → ListItem.Checkbox\n\n- \\`onChange\\`: \\`(checked: boolean)\\` → \\`(event: ChangeEvent)\\` use \\`event.target.checked\\`\n- \\`id\\`, \\`name\\` move to Checkbox\n\n\\`\\`\\`tsx\n<CheckboxOption id=\"x\" name=\"y\" title=\"Title\" content=\"Text\" checked={v} onChange={(c) => set(c)} />\n→\n<List><ListItem title=\"Title\" subtitle=\"Text\" control={<ListItem.Checkbox id=\"x\" name=\"y\" checked={v} onChange={(e) => set(e.target.checked)} />} /></List>\n\\`\\`\\`\n\n---\n\n## RadioOption → ListItem.Radio\n\n- \\`id\\`, \\`name\\`, \\`value\\`, \\`checked\\`, \\`onChange\\` move to Radio\n\n\\`\\`\\`tsx\n<RadioOption id=\"x\" name=\"y\" value=\"v\" title=\"Title\" content=\"Text\" checked={v==='v'} onChange={set} />\n→\n<List><ListItem title=\"Title\" subtitle=\"Text\" control={<ListItem.Radio id=\"x\" name=\"y\" value=\"v\" checked={v==='v'} onChange={set} />} /></List>\n\\`\\`\\`\n\n---\n\n## SwitchOption → ListItem.Switch\n\n- \\`onChange\\` → \\`onClick\\`, toggle manually\n- \\`aria-label\\` moves to Switch\n\n\\`\\`\\`tsx\n<SwitchOption title=\"Title\" content=\"Text\" checked={v} aria-label=\"Toggle\" onChange={set} />\n→\n<List><ListItem title=\"Title\" subtitle=\"Text\" control={<ListItem.Switch checked={v} aria-label=\"Toggle\" onClick={() => set(!v)} />} /></List>\n\\`\\`\\`\n\n---\n\n## NavigationOption → ListItem.Navigation\n\n- \\`onClick\\` or \\`href\\` move to Navigation\n\n\\`\\`\\`tsx\n<NavigationOption title=\"Title\" content=\"Text\" onClick={fn} />\n→\n<List><ListItem title=\"Title\" subtitle=\"Text\" control={<ListItem.Navigation onClick={fn} />} /></List>\n\\`\\`\\`\n\n---\n\n## Option → ListItem\n\n- Wrap \\`media\\` in \\`ListItem.AvatarView\\`\n\n\\`\\`\\`tsx\n<Option media={<Icon />} title=\"Title\" />\n→\n<List><ListItem title=\"Title\" media={<ListItem.AvatarView><Icon /></ListItem.AvatarView>} /></List>\n\\`\\`\\`\n\n---\n\n## Summary → ListItem\n\n**Basic:**\n\n- \\`icon\\` → wrap in \\`ListItem.AvatarView\\` with \\`size={32}\\` as \\`media\\`\n\n**Status:**\n\n- \\`Status.DONE\\` → \\`badge={{ status: 'positive' }}\\`\n- \\`Status.PENDING\\` → \\`badge={{ status: 'pending' }}\\`\n- \\`Status.NOT_DONE\\` → no badge\n\n**Action:**\n\n- \\`action.text\\` → \\`action.label\\` in \\`ListItem.AdditionalInfo\\` as \\`additionalInfo\\`\n\n**Info (requires state):**\n\n- \\`MODAL\\` → \\`ListItem.IconButton partiallyInteractive\\` + \\`<Modal>\\` in \\`control\\`\n- \\`POPOVER\\` → \\`<Popover>\\` wrapping \\`ListItem.IconButton partiallyInteractive\\` in \\`control\\`\n- Use \\`QuestionMarkCircle\\` icon\n\n\\`\\`\\`tsx\n// Basic\n<Summary title=\"T\" description=\"D\" icon={<Icon />} />\n→\n<List><ListItem title=\"T\" subtitle=\"D\" media={<ListItem.AvatarView size={32}><Icon /></ListItem.AvatarView>} /></List>\n\n// Status\n<Summary title=\"T\" description=\"D\" icon={<Icon />} status={Status.DONE} />\n→\n<List><ListItem title=\"T\" subtitle=\"D\" media={<ListItem.AvatarView size={32} badge={{status:'positive'}}><Icon /></ListItem.AvatarView>} /></List>\n\n// Action\n<Summary title=\"T\" description=\"D\" icon={<Icon />} action={{text:'Go', href:'/go'}} />\n→\n<List><ListItem title=\"T\" subtitle=\"D\" media={<ListItem.AvatarView size={32}><Icon /></ListItem.AvatarView>} additionalInfo={<ListItem.AdditionalInfo action={{label:'Go', href:'/go'}} />} /></List>\n\n// Modal (add: const [open, setOpen] = useState(false))\n<Summary title=\"T\" description=\"D\" icon={<Icon />} info={{title:'Help', content:'Text', presentation:'MODAL', 'aria-label':'Info'}} />\n→\n<List><ListItem title=\"T\" subtitle=\"D\" media={<ListItem.AvatarView size={32}><Icon /></ListItem.AvatarView>} control={<ListItem.IconButton partiallyInteractive aria-label=\"Info\" onClick={()=>setOpen(!open)}><QuestionMarkCircle /><Modal open={open} title=\"Help\" body=\"Text\" onClose={()=>setOpen(false)} /></ListItem.IconButton>} /></List>\n\n// Popover\n<Summary title=\"T\" description=\"D\" icon={<Icon />} info={{title:'Help', content:'Text', presentation:'POPOVER', 'aria-label':'Info'}} />\n→\n<List><ListItem title=\"T\" subtitle=\"D\" media={<ListItem.AvatarView size={32}><Icon /></ListItem.AvatarView>} control={<Popover title=\"Help\" content=\"Text\" onClose={()=>setOpen(false)}><ListItem.IconButton partiallyInteractive aria-label=\"Info\"><QuestionMarkCircle /></ListItem.IconButton></Popover>} /></List>\n\\`\\`\\`\n\n---\n\n## DefinitionList → Multiple ListItem\n\n- Array → individual \\`ListItem\\`s\n- \\`value\\` → \\`subtitle\\`\n- \\`key\\` → React \\`key\\` prop\n- Action type: \"Edit\"/\"Update\"/\"View\" → \\`ListItem.Button priority=\"secondary-neutral\"\\`, \"Change\"/\"Password\" → \\`ListItem.Navigation\\`, \"Copy\" → \\`ListItem.IconButton\\`\n\n\\`\\`\\`tsx\n<DefinitionList definitions={[\n {title:'T1', value:'V1', key:'k1'},\n {title:'T2', value:'V2', key:'k2', action:{label:'Edit', onClick:fn}}\n]} />\n→\n<List>\n <ListItem key=\"k1\" title=\"T1\" subtitle=\"V1\" />\n <ListItem key=\"k2\" title=\"T2\" subtitle=\"V2\" control={<ListItem.Button priority=\"secondary-neutral\" onClick={fn}>Edit</ListItem.Button>} />\n</List>\n\\`\\`\\`\n`;\n\nexport const SYSTEM_PROMPT = `Transform TypeScript/JSX code from legacy Wise Design System (WDS) components to the new ListItem component and ListItem subcomponents from '@transferwise/components'.\n\nRead and transform each file one at a time, instead of reading them all at the start.\n\nRules:\n1. Ignore any files that do not contain deprecated WDS components, unless they are necessary for context.\n2. Migrate components per provided migration rules\n3. Maintain TypeScript type safety and update types to match new API\n4. Map props: handle renamed, deprecated, new required, and changed types\n5. Update imports to new WDS components and types\n6. Preserve code style, formatting, and calculated logic\n7. Handle conditional rendering, spread props, and complex expressions\n8. Note: New components may lack feature parity with legacy versions\n9. Only modify code requiring changes per migration rules, and any impacted surrounding code for context.\n10. Provide only the transformed code as output, without explanations or additional text\n11. Do not summarise the initial user request in a response, only use the response formats in JSON for all communication.\n\nMake the necessary updates to the files and do not respond with any explanations or reasoning. \n\nYou'll receive:\n- File paths/directories to search in individual queries\n- Deprecated component names at the end of this prompt\n- Migration context and rules for each deprecated component\n\nResponse formats (json object string, not inside a code snippet):\n{\n type: \"processing\" | \"done\",\n path: <directory-being-processed>\n}\n\n{\n type: \"updated\",\n path: <file-path>,\n additions: <number-of-lines-added>,\n deletions: <number-of-lines-removed>,\n changes: <number-of-lines-changed>,\n}\n\n{\n type: \"error\",\n path: <file-path>,\n message: <error-message>\n}\n\nDeprecated components: ${DEPRECATED_COMPONENT_NAMES.join(', ')}.\n\n${MIGRATION_RULES}`;\n","import { type Options, query } from '@anthropic-ai/claude-agent-sdk';\nimport { execSync } from 'child_process';\nimport { readFileSync } from 'fs';\nimport { resolve } from 'path';\n\nimport { CONSOLE_ICONS } from '../../constants';\nimport { SYSTEM_PROMPT } from './constants';\nimport type { ClaudeResponseMessage } from './types';\n\ninterface ClaudeSettings {\n apiKeyHelper?: string;\n env?: {\n ANTHROPIC_BASE_URL?: string;\n ANTHROPIC_CUSTOM_HEADERS?: string;\n ANTHROPIC_DEFAULT_SONNET_MODEL?: string;\n ANTHROPIC_DEFAULT_HAIKU_MODEL?: string;\n ANTHROPIC_DEFAULT_OPUS_MODEL?: string;\n API_TIMEOUT_MS?: string;\n [key: string]: unknown;\n };\n [key: string]: unknown;\n}\n\nconst CLAUDE_SETTINGS_FILE = '.claude/settings.json';\n\nexport function getQueryOptions(sessionId?: string, isDebug?: boolean): Options {\n // Read settings from ~/.claude/settings.json to get headers and apiKeyHelper\n const claudeSettingsPath = resolve(process.env.HOME || '', CLAUDE_SETTINGS_FILE);\n const settings = JSON.parse(readFileSync(claudeSettingsPath, 'utf-8')) as ClaudeSettings;\n\n // Get API key by executing the apiKeyHelper script, for authenticating with Okta via LLM Gateway\n let apiKey;\n try {\n apiKey = execSync(`bash ${settings.apiKeyHelper}`, {\n encoding: 'utf-8',\n }).trim();\n } catch {}\n\n if (!apiKey) {\n throw new Error(\n 'Failed to retrieve Anthropic API key. Please check your Claude Code x LLM Gateway configuration - https://transferwise.atlassian.net/wiki/x/_YUe3Q',\n );\n }\n\n const envVars = {\n ANTHROPIC_AUTH_TOKEN: apiKey,\n ANTHROPIC_BASE_URL: settings?.env?.ANTHROPIC_BASE_URL,\n ANTHROPIC_CUSTOM_HEADERS: settings?.env?.ANTHROPIC_CUSTOM_HEADERS,\n ANTHROPIC_DEFAULT_SONNET_MODEL: settings.env?.ANTHROPIC_DEFAULT_SONNET_MODEL,\n ANTHROPIC_DEFAULT_HAIKU_MODEL: settings.env?.ANTHROPIC_DEFAULT_HAIKU_MODEL,\n ANTHROPIC_DEFAULT_OPUS_MODEL: settings.env?.ANTHROPIC_DEFAULT_OPUS_MODEL,\n API_TIMEOUT_MS: settings.env?.API_TIMEOUT_MS,\n PATH: process.env.PATH, // Specifying PATH as Claude Agent SDK seems to struggle consuming the actual environment PATH\n };\n\n // if (isDebug) {\n // console.debug(`${CONSOLE_ICONS.info} Resolved Claude environment variables:`, JSON.stringify(envVars));\n // }\n\n return {\n resume: sessionId,\n env: envVars,\n permissionMode: 'acceptEdits',\n systemPrompt: {\n type: 'preset',\n preset: 'claude_code',\n append: SYSTEM_PROMPT,\n },\n settingSources: ['local', 'project', 'user'],\n };\n}\n\n// Initiate a new Claude session/conversation and return reusable session ID\nexport async function initiateClaudeSessionOptions(isDebug = false): Promise<Options> {\n console.log(\n `${CONSOLE_ICONS.info} Starting Claude instance - your browser may open for Okta authentication if required.`,\n );\n\n const options = getQueryOptions(undefined, isDebug);\n const result = query({\n options,\n prompt: `You'll be given directories in additional individual queries to search in for files using deprecated Wise Design System (WDS) components. Migrate the code per the provided migration rules.`,\n });\n\n for await (const message of result) {\n switch (message.type) {\n case 'system':\n if (message.subtype === 'init' && !options.resume) {\n console.log(`${CONSOLE_ICONS.success} Successfully initialised Claude instance`);\n options.resume = message.session_id;\n }\n break;\n default:\n if (message.type === 'result' && message.subtype !== 'success') {\n console.log(\n `${CONSOLE_ICONS.error} Claude encountered an error: ${message.errors.join('\\n')}`,\n );\n }\n }\n }\n\n return options;\n}\n\nexport async function queryClaude(path: string, options: Options, isDebug = false) {\n const result = query({\n options,\n prompt: path,\n });\n\n // TODO: Ensure we're handling all potential types of messages here.\n for await (const message of result) {\n switch (message.type) {\n case 'system':\n break;\n case 'assistant':\n for (const msg of message.message.content) {\n switch (msg.type) {\n // TODO: Handle tool usage for determining file being read/changed\n case 'tool_use':\n if (isDebug) {\n if (msg.name === 'Read') {\n // TODO:\n console.log(`${CONSOLE_ICONS.info} Processing: ${msg.input.file_path}`);\n } else if (msg.name === 'Write') {\n console.log(`${CONSOLE_ICONS.info} Updated: ${msg.input.file_path}`);\n }\n }\n break;\n case 'text':\n // TODO: Doesn't work - needs fixing\n // const parsedMessage = JSON.parse(msg.text) as ClaudeResponseMessage;\n // // if (msg.text.includes('Processing')) {\n // // const [prefix, directory] = msg.text.split(' ');\n // // console.log(`${CONSOLE_ICONS.info} ${prefix} \\x1b[32m${directory}\\x1b[0m...`);\n // // }\n // switch (parsedMessage.type) {\n // case 'processing':\n // console.log(\n // `${CONSOLE_ICONS.info} Processing \\x1b[32m${parsedMessage.path}\\x1b[0m...`,\n // );\n // break;\n // case 'done':\n // // NOTE: Don't think this is ever used tbf\n // console.log(\n // `${CONSOLE_ICONS.success} Finished processing: \\x1b[32m${parsedMessage.path}\\x1b[0m`,\n // );\n // break;\n // case 'updated':\n // console.log(\n // `${CONSOLE_ICONS.success} \\x1b[32m${parsedMessage.path}\\x1b[0m - ${parsedMessage.additions} additions, ${parsedMessage.deletions} deletions, ${parsedMessage.changes} changes`,\n // );\n // break;\n // case 'error':\n // console.log(\n // `${CONSOLE_ICONS.error} Something went wrong - \\x1b[32m${parsedMessage.path}\\x1b[0m - ${parsedMessage.message}`,\n // );\n // break;\n // default:\n // console.log(JSON.stringify(parsedMessage));\n break;\n default:\n console.log(msg);\n }\n }\n\n // TODO: Handle things that need manual review/added to report.\n\n break;\n case 'user':\n // TODO: Can use these for dry run/logging changes to console.\n // TODO: Can also identify tool usage to log which files are being changed.\n // console.log(`User: ${JSON.stringify(message)}`);\n break;\n case 'result':\n if (message.subtype === 'success') {\n console.log(\n `${CONSOLE_ICONS.success} ${message.result.trim().split('\\n').join(`\\n${CONSOLE_ICONS.success} `)}`,\n );\n } else {\n console.log(\n `${CONSOLE_ICONS.error} Claude encountered an error: ${message.errors.join('\\n').trim()}`,\n );\n }\n\n break;\n default:\n // console.log(JSON.stringify(message));\n break;\n }\n }\n}\n","import { query } from '@anthropic-ai/claude-agent-sdk';\n\nimport { CONSOLE_ICONS } from '../../constants';\nimport { assessPrerequisites } from '../../controller/helpers';\nimport { getQueryOptions, initiateClaudeSessionOptions, queryClaude } from './claude';\n\nconst transformer = async (targetPaths: string[], codemodPath: string, isDebug = false) => {\n const startTime = Date.now();\n\n // TODO: We need to confirm you're connected to the VPN\n\n const queryOptions = await initiateClaudeSessionOptions(isDebug);\n\n console.log(`${CONSOLE_ICONS.info} Analysing targetted paths - this may take a while...`);\n\n // TODO: Potential improvement could be getting all of the file paths first -\n for (const directory of targetPaths) {\n const isCompliant = assessPrerequisites(directory, codemodPath);\n\n if (isCompliant) {\n // Get all files within directory, and call queryClaude for each file\n await queryClaude(directory, queryOptions, isDebug);\n }\n\n // await queryClaude(directory, queryOptions, isDebug);\n }\n\n // TODO: Move to utility function\n const endTime = Date.now();\n const elapsedTime = Math.floor((endTime - startTime) / 1000);\n const hours = Math.floor(elapsedTime / 3600);\n const minutes = Math.floor((elapsedTime % 3600) / 60);\n const seconds = elapsedTime % 60;\n\n console.log(\n `${CONSOLE_ICONS.success} Finished migrating - elapsed time: \\x1b[1m${hours ? `${hours}h ` : ''}${minutes ? `${minutes}m ` : ''}${seconds ? `${seconds}s` : ''}\\x1b[0m`,\n );\n};\n\nexport default transformer;\n"],"mappings":";;;;;;;AAAA,MAAa,gBAAgB;CAC3B,MAAM;CACN,OAAO;CACP,SAAS;CACT,SAAS;CACT,OAAO;CACR;;;;ACND,MAAM,6BAA6B;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgKxB,MAAa,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA4CJ,2BAA2B,KAAK,KAAK,CAAC;;EAE7D;;;;ACjMF,MAAM,uBAAuB;AAE7B,SAAgB,gBAAgB,WAAoB,SAA4B;CAE9E,MAAM,4CAA6B,QAAQ,IAAI,QAAQ,IAAI,qBAAqB;CAChF,MAAM,WAAW,KAAK,gCAAmB,oBAAoB,QAAQ,CAAC;CAGtE,IAAI;AACJ,KAAI;AACF,4CAAkB,QAAQ,SAAS,gBAAgB,EACjD,UAAU,SACX,CAAC,CAAC,MAAM;SACH;AAER,KAAI,CAA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C9D,IAAI,SAAS,QACtB,SAAQ,IAAI,GAAG,cAAc,KAAK,YAAY,IAAI,MAAM,YAAY;;AAGxE;IACF,KAAK,OA+BH;IACF,QACE,SAAQ,IAAI,IAAI;;AAMtB;EACF,KAAK,OAIH;EACF,KAAK;AACH,OAAI,QAAQ,YAAY,UACtB,SAAQ,IACN,GAAG,cAAc,QAAQ,GAAG,QAAQ,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,KAAK,KAAK,cAAc,QAAQ,GAAG,GAClG;OAED,SAAQ,IACN,GAAG,cAAc,MAAM,gCAAgC,QAAQ,OAAO,KAAK,KAAK,CAAC,MAAM,GACxF;AAGH;EACF,QAEE;;;;;;ACtLR,MAAM,cAAc,OAAO,aAAuB,aAAqB,UAAU,UAAU;CACzF,MAAM,YAAY,KAAK,KAAK;CAI5B,MAAM,eAAe,MAAM,6BAA6B,QAAQ;AAEhE,SAAQ,IAAI,GAAG,cAAc,KAAK,uDAAuD;AAGzF,MAAK,MAAM,aAAa,YAGtB,KAFoBA,oCAAoB,WAAW,YAAY,CAI7D,OAAM,YAAY,WAAW,cAAc,QAAQ;CAOvD,MAAM,UAAU,KAAK,KAAK;CAC1B,MAAM,cAAc,KAAK,OAAO,UAAU,aAAa,IAAK;CAC5D,MAAM,QAAQ,KAAK,MAAM,cAAc,KAAK;CAC5C,MAAM,UAAU,KAAK,MAAO,cAAc,OAAQ,GAAG;CACrD,MAAM,UAAU,cAAc;AAE9B,SAAQ,IACN,GAAG,cAAc,QAAQ,6CAA6C,QAAQ,GAAG,MAAM,MAAM,KAAK,UAAU,GAAG,QAAQ,MAAM,KAAK,UAAU,GAAG,QAAQ,KAAK,GAAG,SAChK;;AAGH,0BAAe"}
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- const require_helpers = require('../../helpers-CghwwYSg.js');
2
+ const require_helpers = require('../../helpers-RWhTD5Is.js');
3
3
 
4
4
  //#region src/helpers/addImport.ts
5
5
  /**
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "claude",
3
+ "prerequisites": {
4
+ "@transferwise/components": ">=46.107.0"
5
+ }
6
+ }
@@ -0,0 +1,4 @@
1
+ require('../../helpers-RWhTD5Is.js');
2
+ const require_transformer = require('../../transformer-B9Mt_gBf.js');
3
+
4
+ module.exports = require_transformer.transformer_default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/wds-codemods",
3
- "version": "1.0.0-experimental-5d002fd",
3
+ "version": "1.0.0-experimental-601f194",
4
4
  "license": "UNLICENSED",
5
5
  "author": "Wise Payments Ltd.",
6
6
  "repository": {
@@ -34,10 +34,12 @@
34
34
  "test:watch": "jest --watch"
35
35
  },
36
36
  "dependencies": {
37
+ "@anthropic-ai/claude-agent-sdk": "^0.1.30",
37
38
  "@inquirer/prompts": "^7.8.6",
38
39
  "jscodeshift": "^17.3"
39
40
  },
40
41
  "devDependencies": {
42
+ "@anthropic-ai/sdk": "^0.68.0",
41
43
  "@babel/core": "^7.28.4",
42
44
  "@babel/plugin-syntax-import-meta": "^7.10.4",
43
45
  "@babel/preset-env": "^7.28.3",
@@ -53,10 +55,10 @@
53
55
  "@types/jscodeshift": "^17.3.0",
54
56
  "@types/node": "^24.4.0",
55
57
  "@types/semver": "^7.7.1",
56
- "@wise/eslint-config": "^13.2.0",
58
+ "@wise/eslint-config": "^13.1.0",
57
59
  "babel-jest": "^30.1.2",
58
60
  "babel-plugin-transform-import-meta": "^2.3.3",
59
- "eslint": "^9.39.1",
61
+ "eslint": "^9.34.0",
60
62
  "husky": "^9.1.7",
61
63
  "jest": "^30.1.3",
62
64
  "jest-file-snapshot": "^0.7.0",