@catchdrift/cli 0.2.2 → 0.2.3
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/package.json +1 -1
- package/src/commands/init.mjs +14 -14
- package/src/index.mjs +13 -13
- package/src/lib/writers.mjs +2 -2
package/package.json
CHANGED
package/src/commands/init.mjs
CHANGED
|
@@ -176,7 +176,7 @@ export async function init(argv) {
|
|
|
176
176
|
}
|
|
177
177
|
} else {
|
|
178
178
|
// shadcn is interactive — user must run it themselves
|
|
179
|
-
p.log.info(`shadcn/ui requires its own interactive setup:\n ${pc.bold(chosenFoundation.install)}\n Run this after catchdrift finishes, then run ${pc.bold('npx catchdrift sync')}`)
|
|
179
|
+
p.log.info(`shadcn/ui requires its own interactive setup:\n ${pc.bold(chosenFoundation.install)}\n Run this after catchdrift finishes, then run ${pc.bold('npx @catchdrift/cli sync')}`)
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
// ── Figma for fresh users ────────────────────────────────────────────────────
|
|
@@ -197,7 +197,7 @@ export async function init(argv) {
|
|
|
197
197
|
if (wantFigmaFresh) {
|
|
198
198
|
sources.push('figma')
|
|
199
199
|
} else {
|
|
200
|
-
console.log(pc.dim(' Skipping Figma. Re-run npx catchdrift init later to add it.'))
|
|
200
|
+
console.log(pc.dim(' Skipping Figma. Re-run npx @catchdrift/cli init later to add it.'))
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
|
|
@@ -223,7 +223,7 @@ export async function init(argv) {
|
|
|
223
223
|
'npm cache is owned by root — Storybook install will fail.\n' +
|
|
224
224
|
pc.bold(' Fix it first by running:\n') +
|
|
225
225
|
` sudo chown -R $(id -u):$(id -g) ~/.npm\n` +
|
|
226
|
-
` Then re-run: ${pc.bold('npx catchdrift init')}`
|
|
226
|
+
` Then re-run: ${pc.bold('npx @catchdrift/cli init')}`
|
|
227
227
|
)
|
|
228
228
|
} else {
|
|
229
229
|
console.log(pc.dim('\n Running npx storybook@latest init — follow the prompts:\n'))
|
|
@@ -238,7 +238,7 @@ export async function init(argv) {
|
|
|
238
238
|
p.log.warn(
|
|
239
239
|
'npm cache permission error.\n' +
|
|
240
240
|
` Fix: sudo chown -R $(id -u):$(id -g) ~/.npm\n` +
|
|
241
|
-
` Then re-run: npx catchdrift init`
|
|
241
|
+
` Then re-run: npx @catchdrift/cli init`
|
|
242
242
|
)
|
|
243
243
|
} else {
|
|
244
244
|
p.log.warn('Storybook install failed or was cancelled. Run `npx storybook@latest init` manually when ready.')
|
|
@@ -246,7 +246,7 @@ export async function init(argv) {
|
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
} else {
|
|
249
|
-
p.log.info('Skipping Storybook. Run `npx storybook@latest init` when ready, then re-run `npx catchdrift init`.')
|
|
249
|
+
p.log.info('Skipping Storybook. Run `npx storybook@latest init` when ready, then re-run `npx @catchdrift/cli init`.')
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
|
|
@@ -265,7 +265,7 @@ export async function init(argv) {
|
|
|
265
265
|
'npm cache is owned by root — Storybook install will fail.\n' +
|
|
266
266
|
pc.bold(' Fix it first:\n') +
|
|
267
267
|
` sudo chown -R $(id -u):$(id -g) ~/.npm\n` +
|
|
268
|
-
` Then re-run: ${pc.bold('npx catchdrift init')}`
|
|
268
|
+
` Then re-run: ${pc.bold('npx @catchdrift/cli init')}`
|
|
269
269
|
)
|
|
270
270
|
sources.splice(sources.indexOf('storybook'), 1)
|
|
271
271
|
} else {
|
|
@@ -279,7 +279,7 @@ export async function init(argv) {
|
|
|
279
279
|
p.log.warn(
|
|
280
280
|
'npm cache permission error.\n' +
|
|
281
281
|
` Fix: sudo chown -R $(id -u):$(id -g) ~/.npm\n` +
|
|
282
|
-
` Then re-run: npx catchdrift init`
|
|
282
|
+
` Then re-run: npx @catchdrift/cli init`
|
|
283
283
|
)
|
|
284
284
|
} else {
|
|
285
285
|
p.log.warn('Storybook install failed or was cancelled. Run `npx storybook@latest init` manually when ready.')
|
|
@@ -290,7 +290,7 @@ export async function init(argv) {
|
|
|
290
290
|
} else {
|
|
291
291
|
// User declined — remove from sources so the URL step is skipped
|
|
292
292
|
sources.splice(sources.indexOf('storybook'), 1)
|
|
293
|
-
p.log.info('Skipping Storybook setup. Re-run `npx catchdrift init` after installing it.')
|
|
293
|
+
p.log.info('Skipping Storybook setup. Re-run `npx @catchdrift/cli init` after installing it.')
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
|
|
@@ -590,7 +590,7 @@ ${pc.bold('What was set up:')}
|
|
|
590
590
|
${alreadyInstalled ? '' : `
|
|
591
591
|
${pc.cyan('1.')} Install it:
|
|
592
592
|
${pc.bold(chosenFoundation.install)}`}
|
|
593
|
-
${alreadyInstalled ? pc.cyan('1.') : pc.cyan('2.')} Run: ${pc.bold('npx catchdrift sync')}
|
|
593
|
+
${alreadyInstalled ? pc.cyan('1.') : pc.cyan('2.')} Run: ${pc.bold('npx @catchdrift/cli sync')}
|
|
594
594
|
Scans your codebase for imports from ${pc.bold(chosenFoundation.pkg)} and registers them.
|
|
595
595
|
${alreadyInstalled ? pc.cyan('2.') : pc.cyan('3.')} Run: ${pc.bold('npm run dev')} → press ${pc.bold('D')} → see live coverage
|
|
596
596
|
|
|
@@ -615,7 +615,7 @@ ${alreadyInstalled ? '' : `
|
|
|
615
615
|
`)
|
|
616
616
|
} else if (mergedDsPackages?.length) {
|
|
617
617
|
console.log(`
|
|
618
|
-
${pc.cyan('1.')} Run: ${pc.bold('npx catchdrift sync')}
|
|
618
|
+
${pc.cyan('1.')} Run: ${pc.bold('npx @catchdrift/cli sync')}
|
|
619
619
|
Scans your codebase for imports from ${mergedDsPackages.join(', ')} and registers them.
|
|
620
620
|
${pc.cyan('2.')} Run: ${pc.bold('npm run dev')} → press ${pc.bold('D')} → see live coverage
|
|
621
621
|
`)
|
|
@@ -624,8 +624,8 @@ ${alreadyInstalled ? '' : `
|
|
|
624
624
|
${pc.cyan('1.')} Run: ${pc.bold('npm run dev')} → press ${pc.bold('D')} → the overlay opens
|
|
625
625
|
Coverage will show 0% until you register your DS components.
|
|
626
626
|
${pc.cyan('2.')} Add your components to ${pc.bold('drift.config.ts')} or connect a source:
|
|
627
|
-
• Figma: re-run ${pc.bold('npx catchdrift init')} and select Figma
|
|
628
|
-
• npm: add ${pc.bold('dsPackages')} to drift.config.ts, then run ${pc.bold('npx catchdrift sync')}
|
|
627
|
+
• Figma: re-run ${pc.bold('npx @catchdrift/cli init')} and select Figma
|
|
628
|
+
• npm: add ${pc.bold('dsPackages')} to drift.config.ts, then run ${pc.bold('npx @catchdrift/cli sync')}
|
|
629
629
|
`)
|
|
630
630
|
}
|
|
631
631
|
|
|
@@ -639,12 +639,12 @@ ${alreadyInstalled ? '' : `
|
|
|
639
639
|
${pc.blue('/drift-context')} Check DS health — run this before starting work
|
|
640
640
|
${pc.blue('/drift-scaffold')} Build a new screen using only DS components
|
|
641
641
|
${pc.blue('/drift-sync')} Update registry after Figma or Storybook changes
|
|
642
|
-
${pc.blue('npx catchdrift check')} Check coverage before submitting a PR
|
|
642
|
+
${pc.blue('npx @catchdrift/cli check')} Check coverage before submitting a PR
|
|
643
643
|
`)
|
|
644
644
|
|
|
645
645
|
if (!sources.includes('storybook') && !storybook.found) {
|
|
646
646
|
console.log(`${pc.yellow('Note:')} Storybook isn't set up yet. Run ${pc.bold('npx storybook@latest init')} when ready,`)
|
|
647
|
-
console.log(` then re-run ${pc.bold('npx catchdrift init')} to complete the coverage loop.\n`)
|
|
647
|
+
console.log(` then re-run ${pc.bold('npx @catchdrift/cli init')} to complete the coverage loop.\n`)
|
|
648
648
|
}
|
|
649
649
|
|
|
650
650
|
if (!patchedShort) {
|
package/src/index.mjs
CHANGED
|
@@ -5,30 +5,30 @@
|
|
|
5
5
|
|
|
6
6
|
import pc from 'picocolors'
|
|
7
7
|
|
|
8
|
-
const VERSION = '0.2.
|
|
8
|
+
const VERSION = '0.2.3'
|
|
9
9
|
|
|
10
10
|
const HELP = `
|
|
11
11
|
${pc.bold(pc.blue('catchdrift'))} — Design system compliance for teams shipping with AI
|
|
12
12
|
|
|
13
13
|
${pc.bold('Usage:')}
|
|
14
|
-
npx catchdrift init Install Drift into your React project
|
|
15
|
-
npx catchdrift sync Auto-discover DS components from dsPackages
|
|
16
|
-
npx catchdrift check Run headless drift scan (requires running app)
|
|
17
|
-
npx catchdrift status Show DS coverage snapshot from config
|
|
18
|
-
npx catchdrift spec List all .drift-spec.md files
|
|
19
|
-
npx catchdrift spec validate Validate specs against implementation
|
|
20
|
-
npx catchdrift spec show <file> Show parsed spec details
|
|
14
|
+
npx @catchdrift/cli init Install Drift into your React project
|
|
15
|
+
npx @catchdrift/cli sync Auto-discover DS components from dsPackages
|
|
16
|
+
npx @catchdrift/cli check Run headless drift scan (requires running app)
|
|
17
|
+
npx @catchdrift/cli status Show DS coverage snapshot from config
|
|
18
|
+
npx @catchdrift/cli spec List all .drift-spec.md files
|
|
19
|
+
npx @catchdrift/cli spec validate Validate specs against implementation
|
|
20
|
+
npx @catchdrift/cli spec show <file> Show parsed spec details
|
|
21
21
|
|
|
22
22
|
${pc.bold('Options:')}
|
|
23
23
|
--help, -h Show this help
|
|
24
24
|
--version, -v Show version
|
|
25
25
|
|
|
26
26
|
${pc.bold('Examples:')}
|
|
27
|
-
npx catchdrift init
|
|
28
|
-
npx catchdrift sync
|
|
29
|
-
npx catchdrift check --url http://localhost:5173 --threshold 80
|
|
30
|
-
npx catchdrift status
|
|
31
|
-
npx catchdrift spec validate
|
|
27
|
+
npx @catchdrift/cli init
|
|
28
|
+
npx @catchdrift/cli sync
|
|
29
|
+
npx @catchdrift/cli check --url http://localhost:5173 --threshold 80
|
|
30
|
+
npx @catchdrift/cli status
|
|
31
|
+
npx @catchdrift/cli spec validate
|
|
32
32
|
|
|
33
33
|
${pc.dim('Docs: https://catchdrift.ai · GitHub: https://github.com/dyoon92/design-drift')}
|
|
34
34
|
`
|
package/src/lib/writers.mjs
CHANGED
|
@@ -62,7 +62,7 @@ export function writeDriftConfig(cwd, { storybookUrl, chromaticUrl, figmaFiles,
|
|
|
62
62
|
` threshold: ${threshold},`,
|
|
63
63
|
dsPackagesLine,
|
|
64
64
|
` components: {`,
|
|
65
|
-
registry || ` // Auto-populated by \`npx catchdrift sync\` — or add manually:`,
|
|
65
|
+
registry || ` // Auto-populated by \`npx @catchdrift/cli sync\` — or add manually:`,
|
|
66
66
|
` // Button: { storyPath: 'primitives-button--primary' },`,
|
|
67
67
|
` },`,
|
|
68
68
|
` // approvedGaps: {},`,
|
|
@@ -85,7 +85,7 @@ export function writeEnvLocal(cwd, { figmaToken }) {
|
|
|
85
85
|
if (existing.includes('FIGMA_TOKEN=')) return
|
|
86
86
|
writeFileSync(envPath, existing.trimEnd() + '\n' + line, 'utf8')
|
|
87
87
|
} else {
|
|
88
|
-
writeFileSync(envPath, `# Drift — Figma token (auto-generated by npx catchdrift init)\n${line}`, 'utf8')
|
|
88
|
+
writeFileSync(envPath, `# Drift — Figma token (auto-generated by npx @catchdrift/cli init)\n${line}`, 'utf8')
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
|