@@ -242,33 +242,43 @@ Warnings: 1
242242### 3. Generate Amp Context
243243
244244``` bash
245+ # Write to custom directory
245246pnpm effect-migrate audit --amp-out .amp/effect-migrate
247+
248+ # Or write to default .amp/ directory
249+ pnpm effect-migrate audit --amp-out
246250```
247251
248- This creates ` .amp/effect-migrate/ context.json ` :
252+ This creates structured context files with schema versioning :
249253
254+ ** ` .amp/effect-migrate/index.json ` ** (entry point):
250255``` json
251256{
252- "version " : 1 ,
257+ "schemaVersion " : " 0.1.0 " ,
253258 "timestamp" : " 2025-01-03T10:00:00Z" ,
254- "projectPath" : " /Users/you/project" ,
255- "migrationState" : {
256- "phase" : " pattern-detection" ,
257- "completedModules" : [" src/models/user.ts" ],
258- "pendingModules" : [" src/api/fetchUser.ts" ]
259- },
260- "findings" : {
261- "summary" : {
262- "errors" : 1 ,
263- "warnings" : 3 ,
264- "totalFiles" : 24 ,
265- "migratedFiles" : 16 ,
266- "progress" : 67
259+ "resources" : {
260+ "audit" : " ./audit.json" ,
261+ "metrics" : " ./metrics.json" ,
262+ "threads" : " ./threads.json" ,
263+ "badges" : " ./badges.md"
264+ }
265+ }
266+ ```
267+
268+ ** ` .amp/effect-migrate/audit.json ` ** (detailed findings):
269+ ``` json
270+ {
271+ "schemaVersion" : " 0.1.0" ,
272+ "revision" : 1 ,
273+ "timestamp" : " 2025-01-03T10:00:00Z" ,
274+ "findings" : [
275+ {
276+ "ruleId" : " no-async-await" ,
277+ "severity" : " warning" ,
278+ "file" : " src/api/fetchUser.ts" ,
279+ "line" : 23 ,
280+ "message" : " Replace async/await with Effect.gen"
267281 }
268- },
269- "recommendations" : [
270- " Convert async/await functions to Effect.gen" ,
271- " Replace node:fs imports with @effect/platform/FileSystem"
272282 ]
273283}
274284```
@@ -359,11 +369,12 @@ I'm migrating src/api/fetchUser.ts to Effect.
359369
360370Amp will:
361371
362- - Load audit.json and metrics.json via index.json
372+ - Load the index.json (schema version 0.1.0) which references all context files
373+ - Read audit.json (with revision tracking) and metrics.json
363374- Know which files are migrated vs. legacy
364375- Suggest Effect patterns based on active rules
365- - Track progress and next steps
366- - Cross-reference prior migration threads
376+ - Track progress across audit revisions
377+ - Cross-reference prior migration threads from threads.json
367378
368379### 6. Programmatic Use (Amp TypeScript SDK)
369380
@@ -373,8 +384,8 @@ import { execute } from "@sourcegraph/amp-sdk"
373384async function proposeNextSteps(cwd : string ) {
374385 const prompt = [
375386 " Load @.amp/effect-migrate/index.json" ,
376- " Read @.amp/effect-migrate/ metrics.json and @.amp/effect-migrate/audit .json" ,
377- " Propose the 3 highest-impact modules to migrate next."
387+ " The index references audit.json (with schemaVersion and revision), metrics.json, and threads .json" ,
388+ " Propose the 3 highest-impact modules to migrate next based on the current revision ."
378389 ].join (" \n " )
379390
380391 for await (const msg of execute ({ prompt , options: { cwd , continue: false } })) {
@@ -386,6 +397,11 @@ async function proposeNextSteps(cwd: string) {
386397}
387398```
388399
400+ ** Schema versioning benefits:**
401+ - All context files include ` schemaVersion: "0.1.0" ` for compatibility tracking
402+ - ` audit.json ` includes a ` revision ` number that increments on each run
403+ - Amp can detect schema changes and handle migrations gracefully
404+
389405See [ Amp TypeScript SDK documentation] ( https://ampcode.com/docs/sdk ) for more examples and options.
390406
391407---
0 commit comments