@wise/wds-codemods 1.0.0-experimental-a21270b → 1.0.0-experimental-cdf94ec

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/README.md CHANGED
@@ -12,9 +12,12 @@
12
12
  - [The Repository](#-the-repository)
13
13
  - [Getting Started](#-getting-started)
14
14
  - [CLI Options](#cli-options)
15
+ - [Transform Engines](#-transform-engines)
16
+ - [jscodeshift Transforms](#jscodeshift-transforms)
17
+ - [AI Transforms](#ai-transforms)
15
18
  - [Available Transforms](#-available-transforms)
16
- - [Button Transform](./readme-button.md)
17
- - [ListItem Transform](./readme-list-item.md)
19
+ - [Button Transform](./src/transforms/button/README.md)
20
+ - [ListItem Transform](./src/transforms/list-item/README.md)
18
21
  - [Key Features](#-key-features)
19
22
  - [Working with the Project Locally](#-working-with-the-project-locally)
20
23
  - [Writing Codemod Transforms](#-writing-codemod-transforms)
@@ -74,10 +77,10 @@ You'll be prompted to:
74
77
 
75
78
  1. Select a transform (`button` or `list-item`)
76
79
  2. Enter target directory or file path
77
- 3. Choose dry-run mode (preview without writing) (🔘 `button` only)
80
+ 3. Choose dry-run mode (preview without writing) (jscodeshift engine only)
78
81
  4. Choose whether to print transformed output
79
82
  5. Configure monorepo detection (auto-detected in most cases)
80
- 6. Answer transform-specific configuration questions (🔘 `button` only)
83
+ 6. Answer transform-specific configuration questions (jscodeshift engine only)
81
84
 
82
85
  #### Direct CLI Mode
83
86
 
@@ -103,7 +106,7 @@ All codemods support these command-line options:
103
106
  | `--ignore-pattern=GLOB` | Ignore files matching [glob pattern(s)](https://code.visualstudio.com/docs/editor/glob-patterns) (comma-separated) |
104
107
  | `--monorepo` | Enable monorepo package checking across workspace folders |
105
108
 
106
- Only button transform supports the following options:
109
+ Only jscodeshift engine supports the following options (.gitignore is always respected with AI Engine):
107
110
 
108
111
  | Option | Description |
109
112
  | --------------------- | ---------------------------------------- |
@@ -133,43 +136,59 @@ wds-codemods button ./packages --monorepo
133
136
  wds-codemods button ./src --print --dry
134
137
  ```
135
138
 
136
- ## 💻 Available Transforms
139
+ ## 🔧 Transform Engines
137
140
 
138
- We currently provide two codemods for migrating Wise Design System components:
141
+ This project supports two types of transform engines, each suited for different transformation needs:
139
142
 
140
- ### 🔘 [Button Transform (`button`)](./README-BUTTON.md)
143
+ ### jscodeshift Engine
141
144
 
142
- Migrates `Button` and `ActionButton` components from `@transferwise/components` to the new v2 API.
145
+ **Best for:** Predictable, rule-based transformations with clear input/output mappings.
143
146
 
144
- - **Engine**: jscodeshift (AST-based transformations)
145
- - **Prerequisites**: `@transferwise/components >=46.5.0`
147
+ **How it works:**
146
148
 
147
- **What it does:**
149
+ - Parses code into an Abstract Syntax Tree (AST)
150
+ - Applies deterministic transformations based on pattern matching
151
+ - Guarantees consistent results across runs
148
152
 
149
- - Converts `ActionButton` + `Button` → `Button` with v2 prop
150
- - Migrates legacy props (`priority`, `size`, `type`, `sentiment`)
151
- - Processes icon children into addon props
152
- - Handles link buttons and enum conversions
153
+ **Features:**
153
154
 
154
- **[→ Full Button Transform Documentation](./README-BUTTON.md)**
155
+ - Dry-run mode to preview changes without writing files
156
+ - Manual review reports for edge cases
157
+ - Fast execution on large codebases
155
158
 
156
- ---
159
+ **Prerequisites:**
160
+
161
+ - Package version requirements (validated automatically)
162
+
163
+ **Example transforms:** Button migration
157
164
 
158
- ### 📋 [ListItem Transform (`list-item`)](./README-LIST-ITEM.md)
165
+ ### AI Engine
159
166
 
160
- Migrates legacy `Option` and `Summary` components to `ListItem` component and subcomponents.
167
+ **Best for:** Complex, context-aware transformations that require understanding intent.
161
168
 
162
- - **Engine**: Claude AI (context-aware transformations)
163
- - **Prerequisites**: `@transferwise/components >=46.104.0` + LLM Gateway access
169
+ **How it works:**
164
170
 
165
- **What it does:**
171
+ - Uses Claude AI to migrate code based on pregenrated instructions
166
172
 
167
- - Converts `ActionOption`, `NavigationOption`, `Summary`, `SwitchOption`, `CheckboxOption`, `RadioOption`, `NavigationOptionList`
168
- - Maps to `ListItem` + subcomponents (`ListItem.Button`, `ListItem.Checkbox`, etc.)
169
- - Handles complex state requirements (modals, popovers)
170
- - Preserves HTML attributes and removes legacy props
173
+ **Features:**
171
174
 
172
- **[→ Full ListItem Transform Documentation](./README-LIST-ITEM.md)**
175
+ - Handles ambiguous cases that would require manual review in jscodeshift
176
+
177
+ **Prerequisites:**
178
+
179
+ - Access to Wise LLM Gateway
180
+ - Claude configured locally
181
+ - VPN connection
182
+ - Package version requirements (validated automatically)
183
+
184
+ **Example transforms:** ListItem migration
185
+
186
+ ---
187
+
188
+ ## 💻 Available Transforms
189
+
190
+ - **[Button](./src/transforms/button/README.md)** - Migrates `Button` and `ActionButton` to the new v2 API using jscodeshift
191
+ - **[ListItem](./src/transforms/list-item/README.md)** - Migrates legacy `Option` and `Summary` components to `ListItem` using Claude AI
173
192
 
174
193
  ---
175
194
 
@@ -193,17 +212,17 @@ Before running any transform, the codemod automatically:
193
212
 
194
213
  ### Manual Review Reporting
195
214
 
196
- **🔘 Button transform only:**
215
+ **jscodeshift engine:**
197
216
 
198
217
  - Generates `codemod-report.txt` for cases needing manual attention
199
218
  - Includes file paths, line numbers, and specific issue descriptions
200
219
  - Reports spread props, dynamic expressions, and unsupported values
201
220
  - Auto-removes old reports and provides fresh summaries
202
221
 
203
- **📋 ListItem transform:**
222
+ **AI engine:**
204
223
 
205
224
  - No report file generated
206
- - Claude handles complex cases inline
225
+ - Handles complex cases inline during transformation
207
226
 
208
227
  ### Smart Processing
209
228
 
@@ -370,7 +389,13 @@ For comprehensive development details, including transform architecture, helper
370
389
 
371
390
  [jscodeshift](https://github.com/facebook/jscodeshift) is a toolkit for running codemods over multiple JavaScript or TypeScript files. It provides an API to parse source code into an Abstract Syntax Tree (AST), manipulate it, and print the transformed code back.
372
391
 
373
- This project uses jscodeshift as the core engine to perform code transformations.
392
+ jscodeshift is one of two engines to perform code transformations.
393
+
394
+ ### @anthropic-ai/claude-agent-sdk
395
+
396
+ [@anthropic-ai/claude-agent-sdk](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk) is Anthropic's SDK for building AI-powered agents with Claude. It provides tools for creating context-aware transformations that can understand code semantics and intent.
397
+
398
+ Claude Agent SDK is one of two engines to perform code transformations
374
399
 
375
400
  ### @inquirer/prompts
376
401
 
@@ -386,4 +411,4 @@ This project uses @inquirer/prompts to provide a user-friendly interactive exper
386
411
 
387
412
  ## ✍️ Feedback
388
413
 
389
- Please ask any questions on this project, you can do so by reaching out on Slack. Or contributing to any [active issues](https://transferwise.atlassian.net/jira/software/projects/DS/boards/277/backlog).
414
+ Please ask any questions on this project, you can do so by reaching out on [Slack](https://wise.enterprise.slack.com/archives/CJNBX9CP6) or contributing to any [active issues](https://transferwise.atlassian.net/jira/software/projects/DS/boards/277/backlog).
@@ -2042,4 +2042,4 @@ Object.defineProperty(exports, 'validateClaudeConfig', {
2042
2042
  return validateClaudeConfig;
2043
2043
  }
2044
2044
  });
2045
- //# sourceMappingURL=helpers-DJ-DdOjE.js.map
2045
+ //# sourceMappingURL=helpers-Z1jZGLmt.js.map