@wise/wds-codemods 1.0.0-experimental-a96ea6f → 1.0.0-experimental-8a5b52a
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/{helpers-TwDiPzvk.js → helpers-C9EIzTCd.js} +7 -10
- package/dist/{helpers-TwDiPzvk.js.map → helpers-C9EIzTCd.js.map} +1 -1
- package/dist/index.js +43 -27
- package/dist/index.js.map +1 -1
- package/dist/{transformer-6crVHXfQ.js → transformer-G1wsjfTA.js} +10 -12
- package/dist/{transformer-6crVHXfQ.js.map → transformer-G1wsjfTA.js.map} +1 -1
- package/dist/transforms/button/transformer.js +1 -1
- package/dist/transforms/list-item/transformer.js +1 -1
- package/package.json +1 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const require_constants = require('./constants-CcE2TmzN.js');
|
|
3
|
-
const require_transformer = require('./transformer-
|
|
4
|
-
const require_helpers = require('./helpers-
|
|
3
|
+
const require_transformer = require('./transformer-G1wsjfTA.js');
|
|
4
|
+
const require_helpers = require('./helpers-C9EIzTCd.js');
|
|
5
5
|
let node_child_process = require("node:child_process");
|
|
6
6
|
let node_fs_promises = require("node:fs/promises");
|
|
7
7
|
node_fs_promises = require_constants.__toESM(node_fs_promises);
|
|
@@ -9,8 +9,8 @@ let node_path = require("node:path");
|
|
|
9
9
|
node_path = require_constants.__toESM(node_path);
|
|
10
10
|
let node_url = require("node:url");
|
|
11
11
|
let __inquirer_prompts = require("@inquirer/prompts");
|
|
12
|
-
let
|
|
13
|
-
|
|
12
|
+
let spinnies = require("spinnies");
|
|
13
|
+
spinnies = require_constants.__toESM(spinnies);
|
|
14
14
|
|
|
15
15
|
//#region src/controller/index.ts
|
|
16
16
|
let isDebug = false;
|
|
@@ -64,11 +64,12 @@ async function runCodemod(transformsDir) {
|
|
|
64
64
|
const codemodPath = node_path.default.resolve(resolvedTransformsDir, transformFile, "transformer.js");
|
|
65
65
|
if (isDebug) console.debug(`${require_constants.CONSOLE_ICONS.info} Resolved codemod path: ${codemodPath}`);
|
|
66
66
|
if (transformFile === "list-item") require_helpers.validateClaudeConfig();
|
|
67
|
-
const
|
|
67
|
+
const spinnies$1 = new spinnies.default();
|
|
68
|
+
spinnies$1.add("loading-codemod", { text: `Loading codemod (${transformFile})...` });
|
|
68
69
|
const root = require_helpers.findProjectRoot();
|
|
69
70
|
const packages = await require_helpers.findPackages();
|
|
70
71
|
const reportPath = node_path.default.resolve(root, "codemod-report.txt");
|
|
71
|
-
|
|
72
|
+
spinnies$1.succeed("loading-codemod", { text: `Successfully loaded codemod: \x1b[2m${transformFile}\x1b[0m` });
|
|
72
73
|
await resetReportFile(reportPath);
|
|
73
74
|
const promptAnswers = await require_helpers.runTransformPrompts(codemodPath);
|
|
74
75
|
const options = await require_helpers.getOptions_default({
|
|
@@ -78,37 +79,52 @@ async function runCodemod(transformsDir) {
|
|
|
78
79
|
preselectedTransformFile: transformFile
|
|
79
80
|
});
|
|
80
81
|
if (transformFile === "list-item") {
|
|
81
|
-
|
|
82
|
+
spinnies$1.add("prerequisite-check", { text: "Checking prerequisites..." });
|
|
83
|
+
const { allPassed, packageRootToTargets, failedPackageRoots } = require_helpers.assessPrerequisitesBatch(options.targetPaths, codemodPath, spinnies$1);
|
|
82
84
|
if (!allPassed) {
|
|
83
|
-
|
|
85
|
+
spinnies$1.add("prerequisite-partial-failure", {
|
|
86
|
+
text: "One or more packages failed prerequisite checks - these targets will be skipped:",
|
|
87
|
+
status: "fail"
|
|
88
|
+
});
|
|
84
89
|
for (const failedRoot of failedPackageRoots) {
|
|
85
90
|
const targets = packageRootToTargets.get(failedRoot) ?? [];
|
|
86
91
|
options.targetPaths = options.targetPaths.filter((targetPath) => !targets.includes(targetPath));
|
|
87
|
-
|
|
92
|
+
spinnies$1.add(`prerequisite-fail-${failedRoot}`, {
|
|
93
|
+
text: `- \x1b[2m\x1b[31m${failedRoot}\x1b[0m${targets.length > 0 && targets[0] !== failedRoot ? ` (targets: ${targets.join(", ")})` : ""}\x1b[0m`,
|
|
94
|
+
indent: 2,
|
|
95
|
+
status: "non-spinnable"
|
|
96
|
+
});
|
|
88
97
|
}
|
|
89
98
|
}
|
|
90
99
|
if (!options.targetPaths.length) {
|
|
91
|
-
|
|
100
|
+
spinnies$1.add("no-valid-targets", {
|
|
101
|
+
text: `${require_constants.CONSOLE_ICONS.error} No valid target paths remaining after prerequisite checks - exiting.`,
|
|
102
|
+
status: "fail"
|
|
103
|
+
});
|
|
104
|
+
spinnies$1.stopAll("fail");
|
|
92
105
|
return;
|
|
93
106
|
}
|
|
94
107
|
await require_transformer.transformer_default(options.targetPaths, options, isDebug);
|
|
95
|
-
} else
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
} else {
|
|
109
|
+
spinnies$1.stopAll("succeed");
|
|
110
|
+
await Promise.all(options.targetPaths.map(async (targetPath) => {
|
|
111
|
+
console.info(`${require_constants.CONSOLE_ICONS.focus} \x1b[1mProcessing:\x1b[0m \x1b[32m${targetPath}\x1b[0m`);
|
|
112
|
+
if (!require_helpers.assessPrerequisites(targetPath, codemodPath)) return;
|
|
113
|
+
const answerArgs = Object.entries(promptAnswers).map(([promptName, answerValue]) => `--${promptName}=${String(answerValue)}`);
|
|
114
|
+
const command = `npx jscodeshift ${[
|
|
115
|
+
"-t",
|
|
116
|
+
codemodPath,
|
|
117
|
+
targetPath,
|
|
118
|
+
options.isDry ? "--dry" : "",
|
|
119
|
+
options.isPrint ? "--print" : "",
|
|
120
|
+
options.ignorePatterns ? options.ignorePatterns.split(",").map((pattern) => `--ignore-pattern=${pattern.trim()}`).join(" ") : "",
|
|
121
|
+
options.useGitIgnore ? "--gitignore" : "",
|
|
122
|
+
...answerArgs
|
|
123
|
+
].filter(Boolean).join(" ")}`;
|
|
124
|
+
if (isDebug) console.debug(`${require_constants.CONSOLE_ICONS.info} Running: ${command}`);
|
|
125
|
+
return (0, node_child_process.execSync)(command, { stdio: "inherit" });
|
|
126
|
+
}));
|
|
127
|
+
}
|
|
112
128
|
if (transformFile !== "list-item") await summariseReportFile(reportPath);
|
|
113
129
|
} catch (error) {
|
|
114
130
|
if (error instanceof Error) console.error(`${require_constants.CONSOLE_ICONS.error} Error running ${candidate} codemod:`, error.message);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["path","fs","CONSOLE_ICONS","logToInquirer","loadTransformModules","transformFile: string","findProjectRoot","findPackages","runTransformPrompts","getOptions","assessPrerequisitesBatch","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';\nimport ora from 'ora';\n\nimport { CONSOLE_ICONS } from '../constants';\nimport transformer from '../transforms/list-item/transformer';\nimport {\n assessPrerequisites,\n assessPrerequisitesBatch,\n findPackages,\n findProjectRoot,\n getOptions,\n loadTransformModules,\n logToInquirer,\n runTransformPrompts,\n validateClaudeConfig,\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 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 const { transformFiles: resolvedTransformNames } =\n await loadTransformModules(resolvedTransformsDir);\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: string) => ({ 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 if (transformFile === 'list-item') {\n validateClaudeConfig();\n }\n\n const loadingSpinner = ora('Loading codemod...').start();\n const root = findProjectRoot();\n const packages = await findPackages();\n const reportPath = path.resolve(root, 'codemod-report.txt');\n loadingSpinner.stop();\n\n await resetReportFile(reportPath);\n\n const promptAnswers = await runTransformPrompts(codemodPath);\n\n const options = await getOptions({\n packages,\n root,\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 // Fail-fast: check prerequisites for all target paths up-front\n const { allPassed, packageRootToTargets, failedPackageRoots } = assessPrerequisitesBatch(\n options.targetPaths,\n codemodPath,\n );\n if (!allPassed) {\n loadingSpinner.fail(\n 'One or more packages failed prerequisite checks - these targets will be skipped.',\n );\n for (const failedRoot of failedPackageRoots) {\n const targets = packageRootToTargets.get(failedRoot) ?? [];\n // Filter out targets that belong to failed package roots\n options.targetPaths = options.targetPaths.filter(\n (targetPath) => !targets.includes(targetPath),\n );\n console.error(\n ` - \\x1b[31m${failedRoot}\\x1b[0m${targets.length > 0 && targets[0] !== failedRoot ? ` (targets: ${targets.join(', ')})` : ''}`,\n );\n }\n }\n\n if (!options.targetPaths.length) {\n console.error(\n `${CONSOLE_ICONS.error} No valid target paths remaining after prerequisite checks - exiting.`,\n );\n return;\n }\n\n await transformer(options.targetPaths, options, 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 // Check prerequisites for this target before running\n const ok = assessPrerequisites(targetPath, codemodPath);\n if (!ok) {\n return;\n }\n\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 );\n }\n\n // Skip report summarisation for list item\n if (transformFile !== 'list-item') {\n await summariseReportFile(reportPath);\n }\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":";;;;;;;;;;;;;;;AAwBA,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,gCAAc,KAAK,+BAA+B,UAAU,KAAK,eAAe,MACpF;SACK;AACN,UAAQ,MACN,GAAGA,gCAAc,KAAK,oCAAoC,UAAU,KAAK,eAAe,MACzF;;;AAIL,MAAM,sBAAsB,OAAO,eAAuB;AACxD,KAAI;EAEF,MAAM,SADgB,MAAMD,yBAAG,SAAS,YAAY,OAAO,EAC/B,MAAM,KAAK,CAAC,OAAO,QAAQ;AACvD,MAAI,MAAM,OACR,SAAQ,MACN,KAAKC,gCAAc,QAAQ,IAAI,MAAM,OAAO,gBAAgB,MAAM,SAAS,IAAI,UAAU,MAAM,iBAAiB,WAAW,eAC5H;MAED,SAAQ,MACN,GAAGA,gCAAc,KAAK,kCAAkC,UAAU,KAAK,eAAe,MACvF;SAEG;AACN,UAAQ,MAAM,GAAGA,gCAAc,KAAK,sDAAsD;;;AAI9F,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,2CAAgB,SAAS,EAAE,OAAO,WAAW,CAAC;IAC9C,CACH;AAIH,MAAI,kBAAkB,YACpB,OAAM,oBAAoB,WAAW;UAEhCW,OAAgB;AACvB,MAAI,iBAAiB,MACnB,SAAQ,MAAM,GAAGX,gCAAc,MAAM,iBAAiB,UAAU,YAAY,MAAM,QAAQ;MAE1F,SAAQ,MAAM,GAAGA,gCAAc,MAAM,iBAAiB,UAAU,YAAY,MAAM;AAEpF,MAAI,QAAQ,IAAI,aAAa,OAC3B,SAAQ,KAAK,EAAE;;;;;;ACpNhB,YAAY"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["path","fs","CONSOLE_ICONS","logToInquirer","loadTransformModules","transformFile: string","spinnies","Spinnies","findProjectRoot","findPackages","runTransformPrompts","getOptions","assessPrerequisitesBatch","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';\nimport Spinnies from 'spinnies';\n\nimport { CONSOLE_ICONS } from '../constants';\nimport transformer from '../transforms/list-item/transformer';\nimport {\n assessPrerequisites,\n assessPrerequisitesBatch,\n findPackages,\n findProjectRoot,\n getOptions,\n loadTransformModules,\n logToInquirer,\n runTransformPrompts,\n validateClaudeConfig,\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 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 const { transformFiles: resolvedTransformNames } =\n await loadTransformModules(resolvedTransformsDir);\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: string) => ({ 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 if (transformFile === 'list-item') {\n validateClaudeConfig();\n }\n\n const spinnies = new Spinnies();\n spinnies.add('loading-codemod', { text: `Loading codemod (${transformFile})...` });\n const root = findProjectRoot();\n const packages = await findPackages();\n const reportPath = path.resolve(root, 'codemod-report.txt');\n spinnies.succeed('loading-codemod', {\n text: `Successfully loaded codemod: \\x1b[2m${transformFile}\\x1b[0m`,\n });\n\n await resetReportFile(reportPath);\n\n const promptAnswers = await runTransformPrompts(codemodPath);\n\n const options = await getOptions({\n packages,\n root,\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 spinnies.add('prerequisite-check', { text: 'Checking prerequisites...' });\n // Fail-fast: check prerequisites for all target paths up-front\n const { allPassed, packageRootToTargets, failedPackageRoots } = assessPrerequisitesBatch(\n options.targetPaths,\n codemodPath,\n spinnies,\n );\n if (!allPassed) {\n spinnies.add('prerequisite-partial-failure', {\n text: 'One or more packages failed prerequisite checks - these targets will be skipped:',\n status: 'fail',\n });\n\n for (const failedRoot of failedPackageRoots) {\n const targets = packageRootToTargets.get(failedRoot) ?? [];\n // Filter out targets that belong to failed package roots\n options.targetPaths = options.targetPaths.filter(\n (targetPath) => !targets.includes(targetPath),\n );\n spinnies.add(`prerequisite-fail-${failedRoot}`, {\n text: `- \\x1b[2m\\x1b[31m${failedRoot}\\x1b[0m${targets.length > 0 && targets[0] !== failedRoot ? ` (targets: ${targets.join(', ')})` : ''}\\x1b[0m`,\n indent: 2,\n status: 'non-spinnable',\n });\n }\n }\n\n if (!options.targetPaths.length) {\n spinnies.add('no-valid-targets', {\n text: `${CONSOLE_ICONS.error} No valid target paths remaining after prerequisite checks - exiting.`,\n status: 'fail',\n });\n spinnies.stopAll('fail');\n return;\n }\n\n await transformer(options.targetPaths, options, isDebug);\n } else {\n // Button codemod doesn't use spinnies\n spinnies.stopAll('succeed');\n\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 // Check prerequisites for this target before running\n const ok = assessPrerequisites(targetPath, codemodPath);\n if (!ok) {\n return;\n }\n\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 );\n }\n\n // Skip report summarisation for list item\n if (transformFile !== 'list-item') {\n await summariseReportFile(reportPath);\n }\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":";;;;;;;;;;;;;;;AAwBA,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,gCAAc,KAAK,+BAA+B,UAAU,KAAK,eAAe,MACpF;SACK;AACN,UAAQ,MACN,GAAGA,gCAAc,KAAK,oCAAoC,UAAU,KAAK,eAAe,MACzF;;;AAIL,MAAM,sBAAsB,OAAO,eAAuB;AACxD,KAAI;EAEF,MAAM,SADgB,MAAMD,yBAAG,SAAS,YAAY,OAAO,E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,SAAS,QAAQ;SACnD;AAEL,cAAS,QAAQ,UAAU;AAE3B,SAAM,QAAQ,IACZ,QAAQ,YAAY,IAAI,OAAO,eAAe;AAC5C,YAAQ,KACN,GAAGX,gCAAc,MAAM,qCAAqC,WAAW,SACxE;AAID,QAAI,CADOY,oCAAoB,YAAY,YAAY,CAErD;IAGF,MAAM,aAAa,OAAO,QAAQ,cAAc,CAAC,KAC9C,CAAC,YAAY,iBAAiB,KAAK,WAAW,GAAG,OAAO,YAAY,GACtE;IAiBD,MAAM,UAAU,mBAfC;KACf;KACA;KACA;KACA,QAAQ,QAAQ,UAAU;KAC1B,QAAQ,UAAU,YAAY;KAC9B,QAAQ,iBACJ,QAAQ,eACL,MAAM,IAAI,CACV,KAAK,YAAY,oBAAoB,QAAQ,MAAM,GAAG,CACtD,KAAK,IAAI,GACZ;KACJ,QAAQ,eAAe,gBAAgB;KACvC,GAAG;KACJ,CAAC,OAAO,QAAQ,CAC2B,KAAK,IAAI;AAErD,QAAI,QACF,SAAQ,MAAM,GAAGZ,gCAAc,KAAK,YAAY,UAAU;AAG5D,4CAAgB,SAAS,EAAE,OAAO,WAAW,CAAC;KAC9C,CACH;;AAIH,MAAI,kBAAkB,YACpB,OAAM,oBAAoB,WAAW;UAEhCa,OAAgB;AACvB,MAAI,iBAAiB,MACnB,SAAQ,MAAM,GAAGb,gCAAc,MAAM,iBAAiB,UAAU,YAAY,MAAM,QAAQ;MAE1F,SAAQ,MAAM,GAAGA,gCAAc,MAAM,iBAAiB,UAAU,YAAY,MAAM;AAEpF,MAAI,QAAQ,IAAI,aAAa,OAC3B,SAAQ,KAAK,EAAE;;;;;;AClOhB,YAAY"}
|
|
@@ -328,21 +328,19 @@ function getQueryOptions(sessionId, codemodOptions) {
|
|
|
328
328
|
} catch {}
|
|
329
329
|
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");
|
|
330
330
|
const { ANTHROPIC_CUSTOM_HEADERS, ...restEnvVars } = settings?.env ?? {};
|
|
331
|
-
const envVars = {
|
|
332
|
-
ANTHROPIC_AUTH_TOKEN: apiKey,
|
|
333
|
-
ANTHROPIC_CUSTOM_HEADERS,
|
|
334
|
-
...restEnvVars,
|
|
335
|
-
PATH: process.env.PATH
|
|
336
|
-
};
|
|
337
|
-
const promptPrefix = !codemodOptions?.useGitIgnore ? "Do not use .gitignore to exclude files from the migration. Ensure all relevant files are included." : "Respect .gitignore when determining which files to include in the migration.";
|
|
338
331
|
return {
|
|
339
332
|
resume: sessionId,
|
|
340
|
-
env:
|
|
333
|
+
env: {
|
|
334
|
+
ANTHROPIC_AUTH_TOKEN: apiKey,
|
|
335
|
+
ANTHROPIC_CUSTOM_HEADERS,
|
|
336
|
+
...restEnvVars,
|
|
337
|
+
PATH: process.env.PATH
|
|
338
|
+
},
|
|
341
339
|
permissionMode: codemodOptions?.isDry ? void 0 : "acceptEdits",
|
|
342
340
|
systemPrompt: {
|
|
343
341
|
type: "preset",
|
|
344
342
|
preset: "claude_code",
|
|
345
|
-
append:
|
|
343
|
+
append: SYSTEM_PROMPT
|
|
346
344
|
},
|
|
347
345
|
outputFormat: {
|
|
348
346
|
type: "json_schema",
|
|
@@ -374,7 +372,7 @@ function getQueryOptions(sessionId, codemodOptions) {
|
|
|
374
372
|
};
|
|
375
373
|
}
|
|
376
374
|
/** Initiate a new Claude session/conversation and return reusable options */
|
|
377
|
-
async function initiateClaudeSessionOptions(codemodOptions, spinnies$1
|
|
375
|
+
async function initiateClaudeSessionOptions(codemodOptions, spinnies$1) {
|
|
378
376
|
const options = getQueryOptions(void 0, codemodOptions);
|
|
379
377
|
await checkVPN(spinnies$1, options.env?.ANTHROPIC_BASE_URL);
|
|
380
378
|
spinnies$1.add("claudeSession", { text: "Starting and verifying Claude instance - your browser may open for Okta authentication if required." });
|
|
@@ -479,7 +477,7 @@ async function queryClaude(path, options, codemodOptions, spinnies$1, isDebug =
|
|
|
479
477
|
const transformer = async (targetPaths, codemodOptions, isDebug = false) => {
|
|
480
478
|
const startTime = Date.now();
|
|
481
479
|
const spinnies$1 = new spinnies.default();
|
|
482
|
-
const queryOptions = await initiateClaudeSessionOptions(codemodOptions, spinnies$1
|
|
480
|
+
const queryOptions = await initiateClaudeSessionOptions(codemodOptions, spinnies$1);
|
|
483
481
|
spinnies$1.remove("placeholder");
|
|
484
482
|
spinnies$1.add("analysing", { text: "Analysing targetted paths - this may take a while..." });
|
|
485
483
|
for (const directory of targetPaths) {
|
|
@@ -505,4 +503,4 @@ Object.defineProperty(exports, 'transformer_default', {
|
|
|
505
503
|
return transformer_default;
|
|
506
504
|
}
|
|
507
505
|
});
|
|
508
|
-
//# sourceMappingURL=transformer-
|
|
506
|
+
//# sourceMappingURL=transformer-G1wsjfTA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformer-6crVHXfQ.js","names":["https","spinnies","Spinnies","CONSOLE_ICONS","spinnies","Spinnies"],"sources":["../src/helpers/spinnerLogs.ts","../src/transforms/list-item/constants.ts","../src/transforms/list-item/helpers.ts","../src/transforms/list-item/claude.ts","../src/transforms/list-item/transformer.ts"],"sourcesContent":["import type Spinnies from 'spinnies';\n\ninterface LogConsoleSpinnerSettings {\n spinnies: Spinnies;\n spinnerId: string;\n options: Partial<Spinnies.SpinnerOptions>;\n}\n\nexport function logToConsole({ spinnies, spinnerId, options }: LogConsoleSpinnerSettings): void {\n spinnies.add(spinnerId, options);\n}\n\nexport function logStaticMessage(spinnies: Spinnies, message: string): void {\n // Create a unique spinner ID for the static message using timestamp, first part of the message and a random number\n const uuid = `static-message-${Date.now()}-${message.slice(0, 10).replace(/\\s+/gu, '-')}-${Math.floor(Math.random() * 10000)}`;\n logToConsole({ spinnies, spinnerId: uuid, options: { text: message, status: 'non-spinnable' } });\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. \\`title\\` → \\`title\\` (direct)\n2. \\`content\\` or \\`description\\` → \\`subtitle\\`\n3. \\`disabled\\` stays on \\`ListItem\\` (not controls)\n4. Keep HTML attributes (\\`id\\`, \\`name\\`, \\`aria-label\\`), remove: \\`as\\`, \\`complex\\`, \\`showMediaAtAllSizes\\`, \\`showMediaCircle\\`, \\`isContainerAligned\\`\n5. In strings, don't convert \\`\\`to\\`'\\`or\\`\"\\`. Preserve what is there.\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<ListItem title=\"Title\" subtitle=\"Text\" control={<ListItem.Button priority=\"secondary-neutral\" onClick={fn}>Click</ListItem.Button>} />\n\\`\\`\\`\n\n---\n\n## CheckboxOption → ListItem.Checkbox\n\n- \\`onChange\\`: \\`(checked: boolean)\\` → \\`(event: ChangeEvent)\\` use \\`event.target.checked\\`\n- \\`name\\` move to Checkbox\n- Don't move \\`id\\` to Checkbox\n\n\\`\\`\\`tsx\n<CheckboxOption id=\"x\" name=\"y\" title=\"Title\" content=\"Text\" checked={v} onChange={(c) => set(c)} />\n→\n<ListItem title=\"Title\" subtitle=\"Text\" control={<ListItem.Checkbox name=\"y\" checked={v} onChange={(e) => set(e.target.checked)} />} />\n\\`\\`\\`\n\n---\n\n## RadioOption → ListItem.Radio\n\n- \\`name\\`, \\`value\\`, \\`checked\\`, \\`onChange\\` move to Radio\n- Don't move \\`id\\` to Radio\n\n\\`\\`\\`tsx\n<RadioOption id=\"x\" name=\"y\" value=\"v\" title=\"Title\" content=\"Text\" checked={v==='v'} onChange={set} />\n→\n<ListItem title=\"Title\" subtitle=\"Text\" control={<ListItem.Radio name=\"y\" value=\"v\" checked={v==='v'} onChange={set} />} />\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<ListItem title=\"Title\" subtitle=\"Text\" control={<ListItem.Switch checked={v} aria-label=\"Toggle\" onClick={() => set(!v)} />} />\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<ListItem title=\"Title\" subtitle=\"Text\" control={<ListItem.Navigation onClick={fn} />} />\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<ListItem title=\"Title\" media={<ListItem.AvatarView><Icon /></ListItem.AvatarView>} />\n\\`\\`\\`\n\n---\n\n## Summary → ListItem\n\n**Basic:**\n\n- \\`icon\\` → wrap in \\`ListItem.AvatarView\\` with \\`size={32}\\` as \\`media\\`\n- Remove \\`size\\` from child \\`<Icon />\\`\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 (import from \\`@transferwise/icons\\`)\n\n\\`\\`\\`tsx\n// Basic\n<Summary title=\"T\" description=\"D\" icon={<Icon />} />\n→\n<ListItem title=\"T\" subtitle=\"D\" media={<ListItem.AvatarView size={32}><Icon /></ListItem.AvatarView>} />\n\n// Status\n<Summary title=\"T\" description=\"D\" icon={<Icon />} status={Status.DONE} />\n→\n<ListItem title=\"T\" subtitle=\"D\" media={<ListItem.AvatarView size={32} badge={{status:'positive'}}><Icon /></ListItem.AvatarView>} />\n\n// Action\n<Summary title=\"T\" description=\"D\" icon={<Icon />} action={{text:'Go', href:'/go'}} />\n→\n<ListItem title=\"T\" subtitle=\"D\" media={<ListItem.AvatarView size={32}><Icon /></ListItem.AvatarView>} additionalInfo={<ListItem.AdditionalInfo action={{label:'Go', href:'/go'}} />} />\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<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>} />\n\n// Popover\n<Summary title=\"T\" description=\"D\" icon={<Icon />} info={{title:'Help', content:'Text', presentation:'POPOVER', 'aria-label':'Info'}} />\n→\n<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>} />\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\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\n\\`\\`\\`\n`;\n\nexport const SYSTEM_PROMPT = `You are a code migration assistant that helps migrate TypeScript/JSX code from deprecated Wise Design System (WDS) components to the new ListItem component and ListItem subcomponents from '@transferwise/components'.\n\nProcess and migrate each file individually, before reading the next file - e.g. Read file A, migrate file A, then Read file B, migrate file B, etc.\n\nUse the following exact grep pattern when identifying files to migrate - only search for .tsx files:\n\\`import\\\\s*\\\\{[\\\\s\\\\S]*?(${DEPRECATED_COMPONENT_NAMES.join('|')})[\\\\s\\\\S]*?\\\\}\\\\s*from\\\\s*['\"]@transferwise/components['\"]\\`\n\nRules:\n1. Identify appropriate files in the directory using only the grep tool - use only the provided grep pattern only to find appropriate .tsx files.\n - Do not modify the grep pattern, always use it as provided\n - If no files are found matching the original grep pattern, do not ever attempt other patterns\n - Use the recursive flag to search all subdirectories as a single grep command\n - Use the multiline flag to capture imports spanning multiple lines\n - Use the glob property of the grep tool to only search *.tsx files - do not search by file type\n2. Only ever modify files via the Edit tool - do not use the Write tool\n3. Migrate components per provided migration rules\n4. Maintain TypeScript type safety and update types to match new API\n5. Map props: handle renamed, deprecated, new required, and changed types\n6. Update imports to new WDS components and types\n7. Preserve code style, formatting, and calculated logic\n8. Handle conditional rendering, spread props, and complex expressions\n9. Note: New components may lack feature parity with legacy versions\n10. Only modify code requiring changes per migration rules, and any impacted surrounding code for context.\n11. Final result response should just be whether the migration was successful overall, or if any errors were encountered\n12. Explain your reasoning and justification before making changes, as you edit each file. Keep it concise and succinct as only bullet points\n13. Do not summarise the changes made after modifying a file.\n14. If you do not have permission to edit a file, still attempt to edit it and then move onto the next file.\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\nDeprecated components: ${DEPRECATED_COMPONENT_NAMES.join(', ')}.\n\n${MIGRATION_RULES}`;\n","import { createPatch } from 'diff';\n\n/** Split the path to get the relative path after the directory, and wrap with ANSI color codes */\nexport function formatPathOutput(directory: string, path?: string, asDim?: boolean): string {\n const relativePath = path ? (path.split(directory.replace('.', ''))[1] ?? path) : directory;\n return asDim ? `\\x1b[2m${relativePath}\\x1b[0m` : `\\x1b[32m${relativePath}\\x1b[0m`;\n}\n\n/** Generates a formatted string representing the total elapsed time since the given start time */\nexport function generateElapsedTime(startTime: number): string {\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 return `${hours ? `${hours}h ` : ''}${minutes ? `${minutes}m ` : ''}${seconds ? `${seconds}s` : ''}`;\n}\n\n// Formats Claude response with ANSI codes (bold for **, green for `), indenting all lines except the first. Also wraps entire content in dim color\nexport function formatClaudeResponseContent(content: string): string {\n const formatted = content\n .replace(/\\*\\*(.+?)\\*\\*/gu, '\\x1b[1m$1\\x1b[0m\\x1b[2m')\n .replace(/`(.+?)`/gu, '\\x1b[32m$1\\x1b[0m\\x1b[2m')\n .split('\\n')\n .map((line, index) => (index === 0 ? line : ` ${line}`))\n .join('\\n');\n\n return `\\x1b[2m${formatted}\\x1b[0m`;\n}\n\n// Generates a unified diff between the original and modified strings, with ANSI color codes for additions and deletions and line numbers\nexport function generateDiff(original: string, modified: string): string {\n const diffResult = createPatch('', original, modified, '', '').trim();\n\n // Parse and colorize the diff output\n const lines = diffResult\n .split('\\n')\n .slice(4) // Skip the header lines\n .filter((line) => !line.startsWith('\\\')); // Remove \"No newline\" messages\n\n // Track current line numbers from hunk headers\n let oldLineNumber = 0;\n let newLineNumber = 0;\n\n const colouredDiff = lines\n .map((line: string) => {\n const trimmedLine = line.trimEnd();\n\n // Parse hunk header to get starting line numbers - format: @@ -oldStart,oldCount +newStart,newCount @@\n if (trimmedLine.startsWith('@@')) {\n const match = /@@ -(\\d+)(?:,\\d+)? \\+(\\d+)(?:,\\d+)? @@/u.exec(trimmedLine);\n if (match) {\n oldLineNumber = Number.parseInt(match[1], 10);\n newLineNumber = Number.parseInt(match[2], 10);\n }\n return `\\x1b[36m${trimmedLine}\\x1b[0m`; // Cyan for hunk headers\n }\n\n let linePrefix = '';\n // Green styling for additions\n if (trimmedLine.startsWith('+')) {\n linePrefix = `${newLineNumber.toString().padStart(4, ' ')} `;\n newLineNumber += 1;\n return `\\x1b[32m${linePrefix}${trimmedLine}\\x1b[0m`;\n }\n\n // Red styling for deletions\n if (trimmedLine.startsWith('-')) {\n linePrefix = `${oldLineNumber.toString().padStart(4, ' ')} `;\n oldLineNumber += 1;\n return `\\x1b[31m${linePrefix}${trimmedLine}\\x1b[0m`;\n }\n\n // Handle unchanged lines\n linePrefix = `${oldLineNumber.toString().padStart(4, ' ')} `;\n oldLineNumber += 1;\n newLineNumber += 1;\n return `${linePrefix}${trimmedLine}`;\n })\n .join('\\n');\n\n return colouredDiff;\n}\n","import https from 'node:https';\n\nimport { type Options, query } from '@anthropic-ai/claude-agent-sdk';\nimport { execSync } from 'child_process';\nimport { readFileSync } from 'fs';\nimport { resolve } from 'path';\nimport Spinnies from 'spinnies';\n\nimport { CONSOLE_ICONS } from '../../constants';\nimport type { CodemodOptions } from '../../controller/types';\nimport { logStaticMessage } from '../../helpers/spinnerLogs';\nimport { SYSTEM_PROMPT } from './constants';\nimport { formatClaudeResponseContent, formatPathOutput, generateDiff } from './helpers';\nimport type { ClaudeResponseToolUse, ClaudeSettings } from './types';\n\nconst CLAUDE_SETTINGS_FILE = '.claude/settings.json';\n\nasync function checkVPN(spinnies: Spinnies, baseUrl?: string): Promise<boolean> {\n if (baseUrl) {\n spinnies.add('vpnCheck', { text: 'Checking VPN connection...' });\n const checkOnce = async (): Promise<boolean> =>\n new Promise<boolean>((resolveCheck) => {\n const url = new URL('/health', baseUrl);\n const req = https.get(url, { timeout: 2000, rejectUnauthorized: false }, (res) => {\n const ok = !!(res.statusCode && res.statusCode >= 200 && res.statusCode < 400);\n res.resume();\n resolveCheck(ok);\n });\n req.on('timeout', () => {\n req.destroy(new Error('timeout'));\n });\n req.on('error', () => resolveCheck(false));\n });\n\n while (true) {\n const ok = await checkOnce();\n if (ok) {\n spinnies.succeed('vpnCheck', { text: 'Connected to VPN' });\n break;\n }\n\n // TODO: Could update this to count down from 3s and fail after a certain number of attempts\n spinnies.update('vpnCheck', { text: 'Please connect to VPN... retrying in 3s' });\n await new Promise<void>((response) => {\n setTimeout(response, 3000);\n });\n }\n }\n return true;\n}\n\nexport function getQueryOptions(sessionId?: string, codemodOptions?: CodemodOptions): 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 { ANTHROPIC_CUSTOM_HEADERS, ...restEnvVars } = settings?.env ?? {};\n\n const envVars = {\n ANTHROPIC_AUTH_TOKEN: apiKey,\n ANTHROPIC_CUSTOM_HEADERS,\n ...restEnvVars,\n PATH: process.env.PATH, // Specifying PATH, as Claude Agent SDK seems to struggle consuming the actual environment PATH\n };\n\n const promptPrefix = !codemodOptions?.useGitIgnore\n ? 'Do not use .gitignore to exclude files from the migration. Ensure all relevant files are included.'\n : 'Respect .gitignore when determining which files to include in the migration.';\n\n // NOTE: ignore patterns not working...\n // codemodOptions?.ignorePatterns?.length ? `Ignore any files with names matching the following .gitignore glob patterns, separated by commas and do not migrate them: ${codemodOptions.ignorePatterns.replaceAll(',', ', ')}` : '';\n\n return {\n resume: sessionId,\n env: envVars,\n permissionMode: codemodOptions?.isDry ? undefined : 'acceptEdits',\n systemPrompt: {\n type: 'preset',\n preset: 'claude_code',\n append: `${promptPrefix}\\n${SYSTEM_PROMPT}`,\n },\n outputFormat: {\n type: 'json_schema',\n schema: {\n type: 'object',\n properties: {\n migrationStatus: { type: 'string', enum: ['success', 'fail', 'no-files'] },\n filesChanged: { type: 'number' },\n },\n },\n },\n allowedTools: ['Grep', 'Read', ...(!codemodOptions?.isDry ? ['Edit'] : [])],\n settingSources: ['local', 'project', 'user'],\n };\n}\n\n/** Initiate a new Claude session/conversation and return reusable options */\nexport async function initiateClaudeSessionOptions(\n codemodOptions: CodemodOptions,\n spinnies: Spinnies,\n isDebug = false,\n): Promise<Options> {\n const options = getQueryOptions(undefined, codemodOptions);\n await checkVPN(spinnies, options.env?.ANTHROPIC_BASE_URL);\n\n spinnies.add('claudeSession', {\n text: 'Starting and verifying Claude instance - your browser may open for Okta authentication if required.',\n });\n\n const result = query({\n options,\n prompt: `You'll be given file paths 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 spinnies.succeed('claudeSession', { text: 'Successfully initialised Claude instance' });\n spinnies.add('placeholder', { text: ' ' });\n\n // Set the session ID to resume the conversation in future queries\n options.resume = message.session_id;\n }\n break;\n default:\n if (message.type === 'result' && message.subtype !== 'success') {\n spinnies.fail('claudeSession', {\n text: `Claude encountered an error when initialising: ${message.errors.join('\\n')}`,\n });\n spinnies.stopAll('fail');\n }\n }\n }\n\n return options;\n}\n\n// Queries Claude with the given path and handles logging of tool uses and results\nexport async function queryClaude(\n path: string,\n options: Options,\n codemodOptions: CodemodOptions,\n spinnies: Spinnies,\n isDebug = false,\n) {\n const debugSpinnies = new Spinnies();\n const result = query({\n options,\n prompt: path,\n });\n let currentMigrationPath = '';\n\n for await (const message of result) {\n switch (message.type) {\n case 'assistant':\n for (const msg of message.message.content) {\n switch (msg.type) {\n // Handles logging of tool uses to determine key stages of the migration\n case 'tool_use':\n if (msg.name === 'Grep') {\n spinnies.remove('placeholder');\n spinnies.update(`directory-${path}`, {\n text: `${formatPathOutput(path)} - Searching for files with deprecated imports...`,\n });\n spinnies.add('placeholder', { text: ' ', indent: 4 });\n } else if (msg.name === 'Read') {\n spinnies.remove('placeholder');\n spinnies.add(`file-${(msg as ClaudeResponseToolUse).input.file_path}`, {\n indent: 4,\n text: `${formatPathOutput(path, (msg as ClaudeResponseToolUse).input.file_path, true)} - Processing...`,\n });\n // Track the current file being migrated, to help with logging\n currentMigrationPath = '';\n } else if (msg.name === 'Edit') {\n const editedFilePath = (msg as ClaudeResponseToolUse).input.file_path;\n\n // Generate and print out a pretty diff of changes made by Claude\n if (codemodOptions.isPrint || codemodOptions.isDry) {\n // Print new file header if migrating a new file\n if (currentMigrationPath !== editedFilePath) {\n currentMigrationPath = editedFilePath;\n\n logStaticMessage(\n spinnies,\n `${CONSOLE_ICONS.info} ${codemodOptions.isDry ? 'Proposed changes' : 'Changes'} for ${formatPathOutput(path, editedFilePath)}`,\n );\n }\n\n logStaticMessage(\n spinnies,\n generateDiff(\n (msg as ClaudeResponseToolUse).input.old_string as string,\n (msg as ClaudeResponseToolUse).input.new_string as string,\n ),\n );\n } else {\n spinnies.succeed(`file-${editedFilePath}`, {\n text: `${formatPathOutput(path, editedFilePath, true)} - Migrated`,\n });\n }\n spinnies.add('placeholder', { text: ' ', indent: 4 });\n }\n\n break;\n case 'text':\n if (isDebug) {\n logStaticMessage(\n debugSpinnies,\n `${CONSOLE_ICONS.claude} ${formatClaudeResponseContent(msg.text)}`,\n );\n }\n break;\n default:\n }\n }\n break;\n case 'result':\n if (message.subtype === 'success') {\n if (message.structured_output) {\n const output = message.structured_output as {\n migrationStatus: 'success' | 'fail' | 'no-files';\n filesChanged: number;\n };\n\n spinnies.remove('placeholder');\n\n if (output.migrationStatus === 'no-files' || output.filesChanged === 0) {\n spinnies.succeed(`directory-${path}`, {\n text: `${formatPathOutput(path)} - No files need migration`,\n });\n } else if (output.migrationStatus === 'success') {\n spinnies.succeed(`directory-${path}`, {\n text: `${formatPathOutput(path)} - Migrated \\x1b[32m${output.filesChanged}\\x1b[0m file(s) successfully`,\n });\n } else {\n spinnies.fail(`directory-${path}`, {\n text: `${formatPathOutput(path)} - Migration failed due to an error`,\n status: 'fail',\n });\n }\n }\n } else if (message.is_error) {\n // Silence non-error errors (false positives)\n logStaticMessage(debugSpinnies, `${CONSOLE_ICONS.error} Claude encountered an error:`);\n console.log(message);\n spinnies.stopAll('fail');\n debugSpinnies.stopAll('fail');\n }\n break;\n case 'user':\n for (const msg of message.message.content) {\n if (\n typeof msg !== 'string' &&\n msg.type === 'tool_result' &&\n typeof msg.content === 'string'\n ) {\n if (msg.content.startsWith('Found ')) {\n const foundFileCount = msg.content.match(/\\.tsx/gu)?.length ?? 0;\n\n // Wrap `.tsx` files in dim color code\n spinnies.update(`directory-${path}`, {\n text: `${formatPathOutput(path)} - Found \\x1b[32m${foundFileCount}\\x1b[0m \\x1b[2m*.tsx\\x1b[0m file(s) needing migration`,\n });\n }\n }\n }\n break;\n default:\n }\n }\n}\n","import Spinnies from 'spinnies';\n\nimport type { CodemodOptions } from '../../controller/types';\nimport { initiateClaudeSessionOptions, queryClaude } from './claude';\nimport { formatPathOutput, generateElapsedTime } from './helpers';\n\nconst transformer = async (\n targetPaths: string[],\n codemodOptions: CodemodOptions,\n isDebug = false,\n) => {\n const startTime = Date.now();\n const spinnies = new Spinnies();\n const queryOptions = await initiateClaudeSessionOptions(codemodOptions, spinnies, isDebug);\n\n spinnies.remove('placeholder');\n spinnies.add('analysing', {\n text: 'Analysing targetted paths - this may take a while...',\n });\n\n for (const directory of targetPaths) {\n spinnies.add(`directory-${directory}`, {\n indent: 2,\n text: `${formatPathOutput(directory)} - Processing directory`,\n });\n await queryClaude(directory, queryOptions, codemodOptions, spinnies, isDebug);\n }\n\n spinnies.succeed('analysing', {\n text: 'Successfully analysed all targetted paths',\n });\n\n spinnies.stopAll('succeed');\n\n spinnies.add('done', {\n text: `Finished migrating - elapsed time: \\x1b[1m${generateElapsedTime(startTime)}\\x1b[0m`,\n status: 'succeed',\n });\n};\n\nexport default transformer;\n"],"mappings":";;;;;;;;;;;;AAQA,SAAgB,aAAa,EAAE,sBAAU,WAAW,WAA4C;AAC9F,YAAS,IAAI,WAAW,QAAQ;;AAGlC,SAAgB,iBAAiB,YAAoB,SAAuB;AAG1E,cAAa;EAAE;EAAU,WADZ,kBAAkB,KAAK,KAAK,CAAC,GAAG,QAAQ,MAAM,GAAG,GAAG,CAAC,QAAQ,SAAS,IAAI,CAAC,GAAG,KAAK,MAAM,KAAK,QAAQ,GAAG,IAAM;EAClF,SAAS;GAAE,MAAM;GAAS,QAAQ;GAAiB;EAAE,CAAC;;;;;ACflG,MAAM,6BAA6B;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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M,OAAO,QAAQ,QAAQ,QAChC,KACE,OAAO,QAAQ,YACf,IAAI,SAAS,iBACb,OAAO,IAAI,YAAY,UAEvB;QAAI,IAAI,QAAQ,WAAW,SAAS,EAAE;KACpC,MAAM,iBAAiB,IAAI,QAAQ,MAAM,UAAU,EAAE,UAAU;AAG/D,gBAAS,OAAO,aAAa,QAAQ,EACnC,MAAM,GAAG,iBAAiB,KAAK,CAAC,mBAAmB,eAAe,wDACnE,CAAC;;;AAIR;EACF;;;;;;ACpRN,MAAM,cAAc,OAClB,aACA,gBACA,UAAU,UACP;CACH,MAAM,YAAY,KAAK,KAAK;CAC5B,MAAMC,aAAW,IAAIC,kBAAU;CAC/B,MAAM,eAAe,MAAM,6BAA6B,gBAAgBD,YAAU,QAAQ;AAE1F,YAAS,OAAO,cAAc;AAC9B,YAAS,IAAI,aAAa,EACxB,MAAM,wDACP,CAAC;AAEF,MAAK,MAAM,aAAa,aAAa;AACnC,aAAS,IAAI,aAAa,aAAa;GACrC,QAAQ;GACR,MAAM,GAAG,iBAAiB,UAAU,CAAC;GACtC,CAAC;AACF,QAAM,YAAY,WAAW,cAAc,gBAAgBA,YAAU,QAAQ;;AAG/E,YAAS,QAAQ,aAAa,EAC5B,MAAM,6CACP,CAAC;AAEF,YAAS,QAAQ,UAAU;AAE3B,YAAS,IAAI,QAAQ;EACnB,MAAM,6CAA6C,oBAAoB,UAAU,CAAC;EAClF,QAAQ;EACT,CAAC;;AAGJ,0BAAe"}
|
|
1
|
+
{"version":3,"file":"transformer-G1wsjfTA.js","names":["https","spinnies","Spinnies","CONSOLE_ICONS","spinnies","Spinnies"],"sources":["../src/helpers/spinnerLogs.ts","../src/transforms/list-item/constants.ts","../src/transforms/list-item/helpers.ts","../src/transforms/list-item/claude.ts","../src/transforms/list-item/transformer.ts"],"sourcesContent":["import type Spinnies from 'spinnies';\n\ninterface LogConsoleSpinnerSettings {\n spinnies: Spinnies;\n spinnerId: string;\n options: Partial<Spinnies.SpinnerOptions>;\n}\n\nexport function logToConsole({ spinnies, spinnerId, options }: LogConsoleSpinnerSettings): void {\n spinnies.add(spinnerId, options);\n}\n\nexport function logStaticMessage(spinnies: Spinnies, message: string): void {\n // Create a unique spinner ID for the static message using timestamp, first part of the message and a random number\n const uuid = `static-message-${Date.now()}-${message.slice(0, 10).replace(/\\s+/gu, '-')}-${Math.floor(Math.random() * 10000)}`;\n logToConsole({ spinnies, spinnerId: uuid, options: { text: message, status: 'non-spinnable' } });\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. \\`title\\` → \\`title\\` (direct)\n2. \\`content\\` or \\`description\\` → \\`subtitle\\`\n3. \\`disabled\\` stays on \\`ListItem\\` (not controls)\n4. Keep HTML attributes (\\`id\\`, \\`name\\`, \\`aria-label\\`), remove: \\`as\\`, \\`complex\\`, \\`showMediaAtAllSizes\\`, \\`showMediaCircle\\`, \\`isContainerAligned\\`\n5. In strings, don't convert \\`\\`to\\`'\\`or\\`\"\\`. Preserve what is there.\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<ListItem title=\"Title\" subtitle=\"Text\" control={<ListItem.Button priority=\"secondary-neutral\" onClick={fn}>Click</ListItem.Button>} />\n\\`\\`\\`\n\n---\n\n## CheckboxOption → ListItem.Checkbox\n\n- \\`onChange\\`: \\`(checked: boolean)\\` → \\`(event: ChangeEvent)\\` use \\`event.target.checked\\`\n- \\`name\\` move to Checkbox\n- Don't move \\`id\\` to Checkbox\n\n\\`\\`\\`tsx\n<CheckboxOption id=\"x\" name=\"y\" title=\"Title\" content=\"Text\" checked={v} onChange={(c) => set(c)} />\n→\n<ListItem title=\"Title\" subtitle=\"Text\" control={<ListItem.Checkbox name=\"y\" checked={v} onChange={(e) => set(e.target.checked)} />} />\n\\`\\`\\`\n\n---\n\n## RadioOption → ListItem.Radio\n\n- \\`name\\`, \\`value\\`, \\`checked\\`, \\`onChange\\` move to Radio\n- Don't move \\`id\\` to Radio\n\n\\`\\`\\`tsx\n<RadioOption id=\"x\" name=\"y\" value=\"v\" title=\"Title\" content=\"Text\" checked={v==='v'} onChange={set} />\n→\n<ListItem title=\"Title\" subtitle=\"Text\" control={<ListItem.Radio name=\"y\" value=\"v\" checked={v==='v'} onChange={set} />} />\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<ListItem title=\"Title\" subtitle=\"Text\" control={<ListItem.Switch checked={v} aria-label=\"Toggle\" onClick={() => set(!v)} />} />\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<ListItem title=\"Title\" subtitle=\"Text\" control={<ListItem.Navigation onClick={fn} />} />\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<ListItem title=\"Title\" media={<ListItem.AvatarView><Icon /></ListItem.AvatarView>} />\n\\`\\`\\`\n\n---\n\n## Summary → ListItem\n\n**Basic:**\n\n- \\`icon\\` → wrap in \\`ListItem.AvatarView\\` with \\`size={32}\\` as \\`media\\`\n- Remove \\`size\\` from child \\`<Icon />\\`\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 (import from \\`@transferwise/icons\\`)\n\n\\`\\`\\`tsx\n// Basic\n<Summary title=\"T\" description=\"D\" icon={<Icon />} />\n→\n<ListItem title=\"T\" subtitle=\"D\" media={<ListItem.AvatarView size={32}><Icon /></ListItem.AvatarView>} />\n\n// Status\n<Summary title=\"T\" description=\"D\" icon={<Icon />} status={Status.DONE} />\n→\n<ListItem title=\"T\" subtitle=\"D\" media={<ListItem.AvatarView size={32} badge={{status:'positive'}}><Icon /></ListItem.AvatarView>} />\n\n// Action\n<Summary title=\"T\" description=\"D\" icon={<Icon />} action={{text:'Go', href:'/go'}} />\n→\n<ListItem title=\"T\" subtitle=\"D\" media={<ListItem.AvatarView size={32}><Icon /></ListItem.AvatarView>} additionalInfo={<ListItem.AdditionalInfo action={{label:'Go', href:'/go'}} />} />\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<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>} />\n\n// Popover\n<Summary title=\"T\" description=\"D\" icon={<Icon />} info={{title:'Help', content:'Text', presentation:'POPOVER', 'aria-label':'Info'}} />\n→\n<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>} />\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\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\n\\`\\`\\`\n`;\n\nexport const SYSTEM_PROMPT = `You are a code migration assistant that helps migrate TypeScript/JSX code from deprecated Wise Design System (WDS) components to the new ListItem component and ListItem subcomponents from '@transferwise/components'.\n\nProcess and migrate each file individually, before reading the next file - e.g. Read file A, migrate file A, then Read file B, migrate file B, etc.\n\nUse the following exact grep pattern when identifying files to migrate - only search for .tsx files:\n\\`import\\\\s*\\\\{[\\\\s\\\\S]*?(${DEPRECATED_COMPONENT_NAMES.join('|')})[\\\\s\\\\S]*?\\\\}\\\\s*from\\\\s*['\"]@transferwise/components['\"]\\`\n\nRules:\n1. Identify appropriate files in the directory using only the grep tool - use only the provided grep pattern only to find appropriate .tsx files.\n - Do not modify the grep pattern, always use it as provided\n - If no files are found matching the original grep pattern, do not ever attempt other patterns\n - Use the recursive flag to search all subdirectories as a single grep command\n - Use the multiline flag to capture imports spanning multiple lines\n - Use the glob property of the grep tool to only search *.tsx files - do not search by file type\n2. Only ever modify files via the Edit tool - do not use the Write tool\n3. Migrate components per provided migration rules\n4. Maintain TypeScript type safety and update types to match new API\n5. Map props: handle renamed, deprecated, new required, and changed types\n6. Update imports to new WDS components and types\n7. Preserve code style, formatting, and calculated logic\n8. Handle conditional rendering, spread props, and complex expressions\n9. Note: New components may lack feature parity with legacy versions\n10. Only modify code requiring changes per migration rules, and any impacted surrounding code for context.\n11. Final result response should just be whether the migration was successful overall, or if any errors were encountered\n12. Explain your reasoning and justification before making changes, as you edit each file. Keep it concise and succinct as only bullet points\n13. Do not summarise the changes made after modifying a file.\n14. If you do not have permission to edit a file, still attempt to edit it and then move onto the next file.\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\nDeprecated components: ${DEPRECATED_COMPONENT_NAMES.join(', ')}.\n\n${MIGRATION_RULES}`;\n","import { createPatch } from 'diff';\n\n/** Split the path to get the relative path after the directory, and wrap with ANSI color codes */\nexport function formatPathOutput(directory: string, path?: string, asDim?: boolean): string {\n const relativePath = path ? (path.split(directory.replace('.', ''))[1] ?? path) : directory;\n return asDim ? `\\x1b[2m${relativePath}\\x1b[0m` : `\\x1b[32m${relativePath}\\x1b[0m`;\n}\n\n/** Generates a formatted string representing the total elapsed time since the given start time */\nexport function generateElapsedTime(startTime: number): string {\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 return `${hours ? `${hours}h ` : ''}${minutes ? `${minutes}m ` : ''}${seconds ? `${seconds}s` : ''}`;\n}\n\n// Formats Claude response with ANSI codes (bold for **, green for `), indenting all lines except the first. Also wraps entire content in dim color\nexport function formatClaudeResponseContent(content: string): string {\n const formatted = content\n .replace(/\\*\\*(.+?)\\*\\*/gu, '\\x1b[1m$1\\x1b[0m\\x1b[2m')\n .replace(/`(.+?)`/gu, '\\x1b[32m$1\\x1b[0m\\x1b[2m')\n .split('\\n')\n .map((line, index) => (index === 0 ? line : ` ${line}`))\n .join('\\n');\n\n return `\\x1b[2m${formatted}\\x1b[0m`;\n}\n\n// Generates a unified diff between the original and modified strings, with ANSI color codes for additions and deletions and line numbers\nexport function generateDiff(original: string, modified: string): string {\n const diffResult = createPatch('', original, modified, '', '').trim();\n\n // Parse and colorize the diff output\n const lines = diffResult\n .split('\\n')\n .slice(4) // Skip the header lines\n .filter((line) => !line.startsWith('\\\')); // Remove \"No newline\" messages\n\n // Track current line numbers from hunk headers\n let oldLineNumber = 0;\n let newLineNumber = 0;\n\n const colouredDiff = lines\n .map((line: string) => {\n const trimmedLine = line.trimEnd();\n\n // Parse hunk header to get starting line numbers - format: @@ -oldStart,oldCount +newStart,newCount @@\n if (trimmedLine.startsWith('@@')) {\n const match = /@@ -(\\d+)(?:,\\d+)? \\+(\\d+)(?:,\\d+)? @@/u.exec(trimmedLine);\n if (match) {\n oldLineNumber = Number.parseInt(match[1], 10);\n newLineNumber = Number.parseInt(match[2], 10);\n }\n return `\\x1b[36m${trimmedLine}\\x1b[0m`; // Cyan for hunk headers\n }\n\n let linePrefix = '';\n // Green styling for additions\n if (trimmedLine.startsWith('+')) {\n linePrefix = `${newLineNumber.toString().padStart(4, ' ')} `;\n newLineNumber += 1;\n return `\\x1b[32m${linePrefix}${trimmedLine}\\x1b[0m`;\n }\n\n // Red styling for deletions\n if (trimmedLine.startsWith('-')) {\n linePrefix = `${oldLineNumber.toString().padStart(4, ' ')} `;\n oldLineNumber += 1;\n return `\\x1b[31m${linePrefix}${trimmedLine}\\x1b[0m`;\n }\n\n // Handle unchanged lines\n linePrefix = `${oldLineNumber.toString().padStart(4, ' ')} `;\n oldLineNumber += 1;\n newLineNumber += 1;\n return `${linePrefix}${trimmedLine}`;\n })\n .join('\\n');\n\n return colouredDiff;\n}\n","import https from 'node:https';\n\nimport { type Options, query } from '@anthropic-ai/claude-agent-sdk';\nimport { execSync } from 'child_process';\nimport { readFileSync } from 'fs';\nimport { resolve } from 'path';\nimport Spinnies from 'spinnies';\n\nimport { CONSOLE_ICONS } from '../../constants';\nimport type { CodemodOptions } from '../../controller/types';\nimport { logStaticMessage } from '../../helpers/spinnerLogs';\nimport { SYSTEM_PROMPT } from './constants';\nimport { formatClaudeResponseContent, formatPathOutput, generateDiff } from './helpers';\nimport type { ClaudeResponseToolUse, ClaudeSettings } from './types';\n\nconst CLAUDE_SETTINGS_FILE = '.claude/settings.json';\n\nasync function checkVPN(spinnies: Spinnies, baseUrl?: string): Promise<boolean> {\n if (baseUrl) {\n spinnies.add('vpnCheck', { text: 'Checking VPN connection...' });\n const checkOnce = async (): Promise<boolean> =>\n new Promise<boolean>((resolveCheck) => {\n const url = new URL('/health', baseUrl);\n const req = https.get(url, { timeout: 2000, rejectUnauthorized: false }, (res) => {\n const ok = !!(res.statusCode && res.statusCode >= 200 && res.statusCode < 400);\n res.resume();\n resolveCheck(ok);\n });\n req.on('timeout', () => {\n req.destroy(new Error('timeout'));\n });\n req.on('error', () => resolveCheck(false));\n });\n\n while (true) {\n const ok = await checkOnce();\n if (ok) {\n spinnies.succeed('vpnCheck', { text: 'Connected to VPN' });\n break;\n }\n\n // TODO: Could update this to count down from 3s and fail after a certain number of attempts\n spinnies.update('vpnCheck', { text: 'Please connect to VPN... retrying in 3s' });\n await new Promise<void>((response) => {\n setTimeout(response, 3000);\n });\n }\n }\n return true;\n}\n\nexport function getQueryOptions(sessionId?: string, codemodOptions?: CodemodOptions): 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 { ANTHROPIC_CUSTOM_HEADERS, ...restEnvVars } = settings?.env ?? {};\n\n const envVars = {\n ANTHROPIC_AUTH_TOKEN: apiKey,\n ANTHROPIC_CUSTOM_HEADERS,\n ...restEnvVars,\n PATH: process.env.PATH, // Specifying PATH, as Claude Agent SDK seems to struggle consuming the actual environment PATH\n };\n\n return {\n resume: sessionId,\n env: envVars,\n permissionMode: codemodOptions?.isDry ? undefined : 'acceptEdits',\n systemPrompt: {\n type: 'preset',\n preset: 'claude_code',\n append: SYSTEM_PROMPT,\n },\n outputFormat: {\n type: 'json_schema',\n schema: {\n type: 'object',\n properties: {\n migrationStatus: { type: 'string', enum: ['success', 'fail', 'no-files'] },\n filesChanged: { type: 'number' },\n },\n },\n },\n allowedTools: ['Grep', 'Read', ...(!codemodOptions?.isDry ? ['Edit'] : [])],\n settingSources: ['local', 'project', 'user'],\n };\n}\n\n/** Initiate a new Claude session/conversation and return reusable options */\nexport async function initiateClaudeSessionOptions(\n codemodOptions: CodemodOptions,\n spinnies: Spinnies,\n): Promise<Options> {\n const options = getQueryOptions(undefined, codemodOptions);\n await checkVPN(spinnies, options.env?.ANTHROPIC_BASE_URL);\n\n spinnies.add('claudeSession', {\n text: 'Starting and verifying Claude instance - your browser may open for Okta authentication if required.',\n });\n\n const result = query({\n options,\n prompt: `You'll be given file paths 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 spinnies.succeed('claudeSession', { text: 'Successfully initialised Claude instance' });\n spinnies.add('placeholder', { text: ' ' });\n\n // Set the session ID to resume the conversation in future queries\n options.resume = message.session_id;\n }\n break;\n default:\n if (message.type === 'result' && message.subtype !== 'success') {\n spinnies.fail('claudeSession', {\n text: `Claude encountered an error when initialising: ${message.errors.join('\\n')}`,\n });\n spinnies.stopAll('fail');\n }\n }\n }\n\n return options;\n}\n\n// Queries Claude with the given path and handles logging of tool uses and results\nexport async function queryClaude(\n path: string,\n options: Options,\n codemodOptions: CodemodOptions,\n spinnies: Spinnies,\n isDebug = false,\n) {\n const debugSpinnies = new Spinnies();\n const result = query({\n options,\n prompt: path,\n });\n let currentMigrationPath = '';\n\n for await (const message of result) {\n switch (message.type) {\n case 'assistant':\n for (const msg of message.message.content) {\n switch (msg.type) {\n // Handles logging of tool uses to determine key stages of the migration\n case 'tool_use':\n if (msg.name === 'Grep') {\n spinnies.remove('placeholder');\n spinnies.update(`directory-${path}`, {\n text: `${formatPathOutput(path)} - Searching for files with deprecated imports...`,\n });\n spinnies.add('placeholder', { text: ' ', indent: 4 });\n } else if (msg.name === 'Read') {\n spinnies.remove('placeholder');\n spinnies.add(`file-${(msg as ClaudeResponseToolUse).input.file_path}`, {\n indent: 4,\n text: `${formatPathOutput(path, (msg as ClaudeResponseToolUse).input.file_path, true)} - Processing...`,\n });\n // Track the current file being migrated, to help with logging\n currentMigrationPath = '';\n } else if (msg.name === 'Edit') {\n const editedFilePath = (msg as ClaudeResponseToolUse).input.file_path;\n // Generate and print out a pretty diff of changes made by Claude\n if (codemodOptions.isPrint || codemodOptions.isDry) {\n // Print new file header if migrating a new file\n if (currentMigrationPath !== editedFilePath) {\n currentMigrationPath = editedFilePath;\n\n logStaticMessage(\n spinnies,\n `${CONSOLE_ICONS.info} ${codemodOptions.isDry ? 'Proposed changes' : 'Changes'} for ${formatPathOutput(path, editedFilePath)}`,\n );\n }\n\n logStaticMessage(\n spinnies,\n generateDiff(\n (msg as ClaudeResponseToolUse).input.old_string as string,\n (msg as ClaudeResponseToolUse).input.new_string as string,\n ),\n );\n } else {\n spinnies.succeed(`file-${editedFilePath}`, {\n text: `${formatPathOutput(path, editedFilePath, true)} - Migrated`,\n });\n }\n spinnies.add('placeholder', { text: ' ', indent: 4 });\n }\n\n break;\n case 'text':\n if (isDebug) {\n logStaticMessage(\n debugSpinnies,\n `${CONSOLE_ICONS.claude} ${formatClaudeResponseContent(msg.text)}`,\n );\n }\n break;\n default:\n }\n }\n break;\n case 'result':\n if (message.subtype === 'success') {\n if (message.structured_output) {\n const output = message.structured_output as {\n migrationStatus: 'success' | 'fail' | 'no-files';\n filesChanged: number;\n };\n\n spinnies.remove('placeholder');\n\n if (output.migrationStatus === 'no-files' || output.filesChanged === 0) {\n spinnies.succeed(`directory-${path}`, {\n text: `${formatPathOutput(path)} - No files need migration`,\n });\n } else if (output.migrationStatus === 'success') {\n spinnies.succeed(`directory-${path}`, {\n text: `${formatPathOutput(path)} - Migrated \\x1b[32m${output.filesChanged}\\x1b[0m file(s) successfully`,\n });\n } else {\n spinnies.fail(`directory-${path}`, {\n text: `${formatPathOutput(path)} - Migration failed due to an error`,\n status: 'fail',\n });\n }\n }\n } else if (message.is_error) {\n // Silence non-error errors (false positives)\n logStaticMessage(debugSpinnies, `${CONSOLE_ICONS.error} Claude encountered an error:`);\n console.log(message);\n spinnies.stopAll('fail');\n debugSpinnies.stopAll('fail');\n }\n break;\n case 'user':\n for (const msg of message.message.content) {\n if (\n typeof msg !== 'string' &&\n msg.type === 'tool_result' &&\n typeof msg.content === 'string'\n ) {\n if (msg.content.startsWith('Found ')) {\n const foundFileCount = msg.content.match(/\\.tsx/gu)?.length ?? 0;\n\n spinnies.update(`directory-${path}`, {\n text: `${formatPathOutput(path)} - Found \\x1b[32m${foundFileCount}\\x1b[0m \\x1b[2m*.tsx\\x1b[0m file(s) needing migration`,\n });\n }\n }\n }\n break;\n default:\n }\n }\n}\n","import Spinnies from 'spinnies';\n\nimport type { CodemodOptions } from '../../controller/types';\nimport { initiateClaudeSessionOptions, queryClaude } from './claude';\nimport { formatPathOutput, generateElapsedTime } from './helpers';\n\nconst transformer = async (\n targetPaths: string[],\n codemodOptions: CodemodOptions,\n isDebug = false,\n) => {\n const startTime = Date.now();\n const spinnies = new Spinnies();\n const queryOptions = await initiateClaudeSessionOptions(codemodOptions, spinnies);\n\n spinnies.remove('placeholder');\n spinnies.add('analysing', {\n text: 'Analysing targetted paths - this may take a while...',\n });\n\n for (const directory of targetPaths) {\n spinnies.add(`directory-${directory}`, {\n indent: 2,\n text: `${formatPathOutput(directory)} - Processing directory`,\n });\n\n await queryClaude(directory, queryOptions, codemodOptions, spinnies, isDebug);\n }\n\n spinnies.succeed('analysing', {\n text: 'Successfully analysed all targetted paths',\n });\n spinnies.stopAll('succeed');\n spinnies.add('done', {\n text: `Finished migrating - elapsed time: \\x1b[1m${generateElapsedTime(startTime)}\\x1b[0m`,\n status: 'succeed',\n });\n};\n\nexport default transformer;\n"],"mappings":";;;;;;;;;;;;AAQA,SAAgB,aAAa,EAAE,sBAAU,WAAW,WAA4C;AAC9F,YAAS,IAAI,WAAW,QAAQ;;AAGlC,SAAgB,iBAAiB,YAAoB,SAAuB;AAG1E,cAAa;EAAE;EAAU,WADZ,kBAAkB,KAAK,KAAK,CAAC,GAAG,QAAQ,MAAM,GAAG,GAAG,CAAC,QAAQ,SAAS,IAAI,CAAC,GAAG,KAAK,MAAM,KAAK,QAAQ,GAAG,IAAM;EAClF,SAAS;GAAE,MAAM;GAAS,QAAQ;GAAiB;EAAE,CAAC;;;;;ACflG,MAAM,6BAA6B;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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QAAQ,QAChC,KACE,OAAO,QAAQ,YACf,IAAI,SAAS,iBACb,OAAO,IAAI,YAAY,UAEvB;QAAI,IAAI,QAAQ,WAAW,SAAS,EAAE;KACpC,MAAM,iBAAiB,IAAI,QAAQ,MAAM,UAAU,EAAE,UAAU;AAE/D,gBAAS,OAAO,aAAa,QAAQ,EACnC,MAAM,GAAG,iBAAiB,KAAK,CAAC,mBAAmB,eAAe,wDACnE,CAAC;;;AAIR;EACF;;;;;;AC1QN,MAAM,cAAc,OAClB,aACA,gBACA,UAAU,UACP;CACH,MAAM,YAAY,KAAK,KAAK;CAC5B,MAAMC,aAAW,IAAIC,kBAAU;CAC/B,MAAM,eAAe,MAAM,6BAA6B,gBAAgBD,WAAS;AAEjF,YAAS,OAAO,cAAc;AAC9B,YAAS,IAAI,aAAa,EACxB,MAAM,wDACP,CAAC;AAEF,MAAK,MAAM,aAAa,aAAa;AACnC,aAAS,IAAI,aAAa,aAAa;GACrC,QAAQ;GACR,MAAM,GAAG,iBAAiB,UAAU,CAAC;GACtC,CAAC;AAEF,QAAM,YAAY,WAAW,cAAc,gBAAgBA,YAAU,QAAQ;;AAG/E,YAAS,QAAQ,aAAa,EAC5B,MAAM,6CACP,CAAC;AACF,YAAS,QAAQ,UAAU;AAC3B,YAAS,IAAI,QAAQ;EACnB,MAAM,6CAA6C,oBAAoB,UAAU,CAAC;EAClF,QAAQ;EACT,CAAC;;AAGJ,0BAAe"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
require('../../constants-CcE2TmzN.js');
|
|
3
|
-
const require_helpers = require('../../helpers-
|
|
3
|
+
const require_helpers = require('../../helpers-C9EIzTCd.js');
|
|
4
4
|
|
|
5
5
|
//#region src/helpers/addImport.ts
|
|
6
6
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/wds-codemods",
|
|
3
|
-
"version": "1.0.0-experimental-
|
|
3
|
+
"version": "1.0.0-experimental-8a5b52a",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "Wise Payments Ltd.",
|
|
6
6
|
"repository": {
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
"@types/spinnies": "^0.5.3",
|
|
40
40
|
"diff": "^8.0.2",
|
|
41
41
|
"jscodeshift": "^17.3",
|
|
42
|
-
"ora": "^9.0.0",
|
|
43
42
|
"spinnies": "^0.5.1"
|
|
44
43
|
},
|
|
45
44
|
"devDependencies": {
|