@catchdrift/cli 0.1.19 → 0.1.20
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 +55 -50
package/package.json
CHANGED
package/src/commands/init.mjs
CHANGED
|
@@ -397,67 +397,72 @@ export async function init(argv) {
|
|
|
397
397
|
console.log('')
|
|
398
398
|
p.outro(pc.green('Drift is set up ✓'))
|
|
399
399
|
|
|
400
|
-
//
|
|
401
|
-
const
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
}
|
|
400
|
+
// ── What was set up (human-readable) ────────────────────────────────────────
|
|
401
|
+
const patchedShort = patched ? patched.replace(cwd + '/', '').replace(cwd, '') : null
|
|
402
|
+
console.log(`
|
|
403
|
+
${pc.bold('What was set up:')}
|
|
404
|
+
${pc.green('✓')} Overlay added to your app ${patchedShort ? pc.dim('(' + patchedShort + ')') : pc.yellow('— see manual step below')}
|
|
405
|
+
${pc.green('✓')} AI rules written ${pc.dim('— your AI tools will use DS components by default')}
|
|
406
|
+
${pc.green('✓')} Claude skills added ${pc.dim('— /drift-sync, /drift-scaffold, /drift-context, ...')}
|
|
407
|
+
${addCI ? pc.green('✓') + ' GitHub check added ' + pc.dim('— every PR will show a coverage score') : pc.dim('○ GitHub check skipped')}`)
|
|
408
408
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
nextSteps.push(` ${pc.cyan('git push')} First PR will show a drift delta comment`)
|
|
409
|
+
// ── Immediate next step — specific to what was configured ───────────────────
|
|
410
|
+
console.log(`\n${pc.bold('Do this now:')}`)
|
|
412
411
|
|
|
413
|
-
if (
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
}
|
|
412
|
+
if (figmaFiles.length > 0 && skillFiles.length > 0) {
|
|
413
|
+
console.log(`
|
|
414
|
+
Your components are in Figma. Pull them into the registry now:
|
|
417
415
|
|
|
418
|
-
|
|
419
|
-
${pc.
|
|
420
|
-
|
|
421
|
-
${
|
|
422
|
-
${skillFiles.length ? `.claude/commands/ ${pc.dim('Claude Code skills (/drift-sync, /drift-scaffold, etc.)')}` : ''}
|
|
423
|
-
${addCI ? '.github/workflows/drift-check.yml ' + pc.dim('CI drift check on every PR') : ''}
|
|
424
|
-
${patched ? patched.padEnd(34) + pc.dim('DriftOverlay added (dev-only)') : ''}
|
|
425
|
-
|
|
426
|
-
${pc.bold('Next steps:')}
|
|
427
|
-
${nextSteps.join('\n')}
|
|
428
|
-
|
|
429
|
-
${pc.bold('Your team\'s daily commands (Claude Code):')}
|
|
430
|
-
${pc.blue('/drift-context')} ${pc.dim('See DS state at a glance — run this first')}
|
|
431
|
-
${pc.blue('/drift-prd')} ${pc.dim('Generate a component inventory for a PRD')}
|
|
432
|
-
${pc.blue('/drift-scaffold')} ${pc.dim('Scaffold a new screen using only DS components')}
|
|
433
|
-
${pc.blue('/drift check')} ${pc.dim('Verify coverage before submitting a PR')}
|
|
434
|
-
${pc.blue('/drift-sync')} ${pc.dim('Re-sync registry after adding DS components')}
|
|
435
|
-
${pc.blue('/drift fix <X>')} ${pc.dim('Migrate a custom component to its DS equivalent')}
|
|
436
|
-
|
|
437
|
-
${pc.dim('Docs: https://catchdrift.ai · Issues: https://github.com/dyoon92/design-drift/issues')}
|
|
416
|
+
${pc.cyan('1.')} Open ${pc.bold('Claude Code')} in this project folder
|
|
417
|
+
${pc.cyan('2.')} Run: ${pc.blue('/drift-sync figma')}
|
|
418
|
+
This reads your Figma file and registers all your DS components.
|
|
419
|
+
${pc.cyan('3.')} Run: ${pc.bold('npm run dev')} → press ${pc.bold('D')} → see live coverage
|
|
438
420
|
`)
|
|
421
|
+
} else if (sources.includes('storybook') && Object.keys(components).length > 0) {
|
|
422
|
+
console.log(`
|
|
423
|
+
Your components were imported from Storybook ✓
|
|
439
424
|
|
|
440
|
-
|
|
441
|
-
|
|
425
|
+
${pc.cyan('1.')} Run: ${pc.bold('npm run dev')}
|
|
426
|
+
${pc.cyan('2.')} Press ${pc.bold('D')} to open the Drift overlay — you should see real coverage.
|
|
427
|
+
`)
|
|
428
|
+
} else if (dsPackages?.length) {
|
|
429
|
+
console.log(`
|
|
430
|
+
${pc.cyan('1.')} Run: ${pc.bold('npx catchdrift sync')}
|
|
431
|
+
Scans your codebase for imports from ${dsPackages.join(', ')} and registers them.
|
|
432
|
+
${pc.cyan('2.')} Run: ${pc.bold('npm run dev')} → press ${pc.bold('D')} → see live coverage
|
|
433
|
+
`)
|
|
434
|
+
} else {
|
|
435
|
+
console.log(`
|
|
436
|
+
${pc.cyan('1.')} Run: ${pc.bold('npm run dev')} → press ${pc.bold('D')} → the overlay opens
|
|
437
|
+
Coverage will show 0% until you register your DS components.
|
|
438
|
+
${pc.cyan('2.')} Add your components to ${pc.bold('drift.config.ts')} or connect a source:
|
|
439
|
+
• Figma: re-run ${pc.bold('npx catchdrift init')} and select Figma
|
|
440
|
+
• npm: add ${pc.bold('dsPackages')} to drift.config.ts, then run ${pc.bold('npx catchdrift sync')}
|
|
442
441
|
`)
|
|
443
|
-
console.log(` ${pc.dim('// src/main.tsx')}`)
|
|
444
|
-
console.log(` import { DriftOverlay } from '@catchdrift/overlay'`)
|
|
445
|
-
console.log(` import driftConfig from '../drift.config'`)
|
|
446
|
-
console.log('')
|
|
447
|
-
console.log(` ${pc.dim('// Last child in your root render:')}`)
|
|
448
|
-
console.log(` {import.meta.env.DEV && <DriftOverlay config={driftConfig} />}`)
|
|
449
|
-
console.log('')
|
|
450
442
|
}
|
|
451
443
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
444
|
+
// ── Ongoing daily commands ───────────────────────────────────────────────────
|
|
445
|
+
console.log(`${pc.bold('Daily workflow (Claude Code):')}
|
|
446
|
+
${pc.blue('/drift-context')} Check DS health — run this before starting work
|
|
447
|
+
${pc.blue('/drift-scaffold')} Build a new screen using only DS components
|
|
448
|
+
${pc.blue('/drift-sync')} Update registry after Figma or Storybook changes
|
|
449
|
+
${pc.blue('npx catchdrift check')} Check coverage before submitting a PR
|
|
450
|
+
`)
|
|
451
|
+
|
|
452
|
+
if (!sources.includes('storybook') && !storybook.found) {
|
|
453
|
+
console.log(`${pc.yellow('Note:')} Storybook isn't set up yet. Run ${pc.bold('npx storybook@latest init')} when ready,`)
|
|
454
|
+
console.log(` then re-run ${pc.bold('npx catchdrift init')} to complete the coverage loop.\n`)
|
|
455
455
|
}
|
|
456
456
|
|
|
457
|
-
if (
|
|
458
|
-
console.log(`${pc.
|
|
459
|
-
console.log('')
|
|
457
|
+
if (!patchedShort) {
|
|
458
|
+
console.log(`${pc.yellow('Manual step needed')} — add the overlay to your app entry point:`)
|
|
459
|
+
console.log(` import { DriftOverlay } from '@catchdrift/overlay'`)
|
|
460
|
+
console.log(` import driftConfig from './drift.config'`)
|
|
461
|
+
console.log(` // inside your root render, as the last child:`)
|
|
462
|
+
console.log(` {import.meta.env.DEV && <DriftOverlay config={driftConfig} />}\n`)
|
|
460
463
|
}
|
|
464
|
+
|
|
465
|
+
console.log(pc.dim('Docs: https://catchdrift.ai · Issues: https://github.com/dyoon92/design-drift/issues'))
|
|
461
466
|
}
|
|
462
467
|
|
|
463
468
|
// ── Helpers ───────────────────────────────────────────────────────────────────
|