wize-dev-kit 0.1.5 → 0.2.5

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +130 -1
  2. package/README.md +64 -0
  3. package/package.json +1 -1
  4. package/src/method-skills/1-analysis/wize-document-project/workflow.md +188 -20
  5. package/src/method-skills/1-analysis/wize-prfaq/workflow.md +150 -11
  6. package/src/method-skills/1-analysis/wize-product-brief/workflow.md +90 -19
  7. package/src/method-skills/1-analysis/wize-refresh-knowledge/workflow.md +127 -0
  8. package/src/method-skills/1-analysis/wize-research/workflow.md +101 -9
  9. package/src/method-skills/1-analysis/wize-trigger-map/workflow.md +80 -16
  10. package/src/method-skills/2-plan-workflows/wize-create-prd/workflow.md +132 -23
  11. package/src/method-skills/2-plan-workflows/wize-ux-design/workflow.md +132 -28
  12. package/src/method-skills/2-plan-workflows/wize-ux-scenarios/workflow.md +91 -15
  13. package/src/method-skills/2-plan-workflows/wize-validate-prd/workflow.md +106 -12
  14. package/src/method-skills/3-solutioning/wize-check-implementation-readiness/workflow.md +101 -11
  15. package/src/method-skills/3-solutioning/wize-create-architecture/workflow.md +197 -29
  16. package/src/method-skills/3-solutioning/wize-create-epics-and-stories/workflow.md +127 -12
  17. package/src/method-skills/3-solutioning/wize-design-system/workflow.md +182 -22
  18. package/src/method-skills/3-solutioning/wize-nfr-principles/workflow.md +142 -16
  19. package/src/method-skills/3-solutioning/wize-tech-vision/workflow.md +127 -21
  20. package/src/method-skills/4-implementation/wize-code-review/workflow.md +105 -10
  21. package/src/method-skills/4-implementation/wize-create-story/workflow.md +131 -10
  22. package/src/method-skills/4-implementation/wize-dev-story/workflow.md +140 -17
  23. package/src/method-skills/4-implementation/wize-quick-dev/workflow.md +121 -18
  24. package/src/method-skills/4-implementation/wize-retrospective/workflow.md +112 -10
  25. package/src/method-skills/4-implementation/wize-sprint-planning/workflow.md +85 -10
  26. package/src/method-skills/4-implementation/wize-sprint-status/workflow.md +96 -11
  27. package/src/orchestrator-skills/wize-help/skill.md +25 -1
  28. package/src/tea-skills/wize-tea-design/workflow.md +104 -13
  29. package/src/tea-skills/wize-tea-gate/workflow.md +115 -25
  30. package/src/tea-skills/wize-tea-nfr/workflow.md +104 -14
  31. package/src/tea-skills/wize-tea-review/workflow.md +120 -13
  32. package/src/tea-skills/wize-tea-risk/workflow.md +99 -10
  33. package/src/tea-skills/wize-tea-trace/workflow.md +83 -12
  34. package/tools/installer/baseline.js +128 -0
  35. package/tools/installer/commands/agent.js +197 -0
  36. package/tools/installer/commands/sync.js +45 -0
  37. package/tools/installer/commands/update.js +172 -0
  38. package/tools/installer/version-check.js +117 -0
  39. package/tools/installer/wize-cli.js +98 -11
@@ -15,6 +15,11 @@ const path = require('node:path');
15
15
  const readline = require('node:readline');
16
16
  const prompts = require('prompts');
17
17
  const { applyGitignore, generateUserToml } = require('./setup-helpers.js');
18
+ const { cmdUpdate } = require('./commands/update.js');
19
+ const { detectHarnessCli, runHeadlessBaseline, manualInstructions, defaultPrompt } = require('./baseline.js');
20
+ const { printUpdateHintIfAny } = require('./version-check.js');
21
+ const { cmdSync: cmdSyncReal } = require('./commands/sync.js');
22
+ const { cmdAgentList, cmdAgentCreate, cmdAgentEdit } = require('./commands/agent.js');
18
23
 
19
24
  const INTERACTIVE = process.stdout.isTTY && process.stdin.isTTY;
20
25
 
@@ -86,9 +91,41 @@ function logo() {
86
91
  ].join('\n');
87
92
  }
88
93
 
94
+ // Pipe-safe line reader.
95
+ //
96
+ // `readline.question()` has two bugs that bite us when stdin is a pipe (e.g.
97
+ // `printf ... | wize-dev-kit install` or our CI smoke test):
98
+ // 1. Opening a new createInterface per call closes stdin on .close().
99
+ // 2. Even with a shared interface, the second `question` after a single
100
+ // empty line ("\n") never resolves — readline's question machinery
101
+ // stalls in non-TTY mode.
102
+ //
103
+ // We replace it with an event-based queue: subscribe to `line` once, push
104
+ // resolved promises in order. Empty lines are propagated as `""`. EOF is
105
+ // treated as end of the queue (remaining waiters resolve with `""`).
106
+ let _rl = null;
107
+ let _queue = [];
108
+ let _waiters = [];
109
+
110
+ function getRl() {
111
+ if (_rl) return _rl;
112
+ _rl = readline.createInterface({ input: process.stdin, terminal: false });
113
+ _rl.on('line', (line) => {
114
+ if (_waiters.length) _waiters.shift()(line);
115
+ else _queue.push(line);
116
+ });
117
+ _rl.on('close', () => {
118
+ while (_waiters.length) _waiters.shift()('');
119
+ });
120
+ process.on('exit', () => { if (_rl) { _rl.close(); _rl = null; } });
121
+ return _rl;
122
+ }
123
+
89
124
  function prompt(question) {
90
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
91
- return new Promise(resolve => rl.question(question, ans => { rl.close(); resolve(ans.trim()); }));
125
+ process.stdout.write(question);
126
+ getRl();
127
+ if (_queue.length) return Promise.resolve(_queue.shift().trim());
128
+ return new Promise(resolve => _waiters.push((line) => resolve(line.trim())));
92
129
  }
93
130
 
94
131
  async function confirm(question, defaultYes = true) {
@@ -382,11 +419,50 @@ async function cmdInstall(args) {
382
419
  if (detection.brownfield) {
383
420
  const baseline = await confirm('\nRun `wize-document-project` to baseline the existing repo now?', true);
384
421
  if (baseline) {
385
- console.log('(stub) Pepper + Peggy would now produce the baseline docs in .wize/knowledge/document-project/.');
422
+ const preferIde = targets.map(t => t.code);
423
+ const harnesses = detectHarnessCli({ preferIde });
424
+ if (process.env.WIZE_SKIP_BASELINE === '1') {
425
+ console.log('\nWIZE_SKIP_BASELINE=1 — not running the baseline.');
426
+ console.log(manualInstructions(harnesses[0]));
427
+ } else if (harnesses.length === 0) {
428
+ console.log(manualInstructions(null));
429
+ } else {
430
+ const chosen = harnesses[0];
431
+ console.log(`\nDetected harness: ${chosen.binary} (${chosen.path}).`);
432
+ const confirmRun = await confirm(
433
+ `Run /wize-document-project via ${chosen.binary} now?`,
434
+ true
435
+ );
436
+ if (confirmRun) {
437
+ const r = runHeadlessBaseline({
438
+ harness: chosen,
439
+ projectRoot: cwd,
440
+ prompt: defaultPrompt()
441
+ });
442
+ if (!r.ok && !r.skipped) {
443
+ console.log(`\n${chosen.binary} exited with code ${r.exitCode}. You can re-run later with:`);
444
+ console.log(manualInstructions(chosen));
445
+ }
446
+ } else {
447
+ console.log(manualInstructions(chosen));
448
+ }
449
+ }
386
450
  }
387
451
  }
388
452
 
389
- console.log('\nDone. Activate Wizer in your IDE and say: "Brief me on this project."');
453
+ console.log('\n──────────────────────────────────────────────────────────────');
454
+ console.log('Done.');
455
+ console.log('');
456
+ console.log('Next steps:');
457
+ console.log(' 1. ⚠ Restart your IDE — many harnesses load skills only at startup.');
458
+ console.log(' 2. Activate Wizer and say: "Brief me on this project."');
459
+ console.log(' (or use any /wize-* slash command from the auto-complete list)');
460
+ console.log('');
461
+ console.log('Keep the kit in sync over time:');
462
+ console.log(' • `npx wize-dev-kit update` refresh adapters after a new kit version');
463
+ console.log(' • `npx wize-dev-kit sync` re-render adapters after editing config');
464
+ console.log(' • `npx wize-dev-kit agent list | create | edit <code>` manage agents');
465
+ console.log('──────────────────────────────────────────────────────────────');
390
466
  }
391
467
 
392
468
  async function cmdUninstall() {
@@ -432,17 +508,18 @@ function cmdList() {
432
508
  }
433
509
 
434
510
  function cmdSync() {
435
- console.log('(stub) Sync would regenerate IDE adapter files for active targets in .wize/config/project.toml.');
511
+ return cmdSyncReal({ kitRoot: KIT_ROOT, projectRoot: process.cwd() });
436
512
  }
437
513
 
438
514
  function cmdAgent(args) {
439
515
  const sub = args[0] || 'list';
440
- if (sub === 'list') return cmdList();
441
- if (sub === 'create') {
442
- console.log('(stub) Interactive agent creation. See src/builder-skills/wize-create-agent/workflow.md.');
443
- return;
444
- }
516
+ const rest = args.slice(1);
517
+ const ctx = { kitRoot: KIT_ROOT, projectRoot: process.cwd() };
518
+ if (sub === 'list') return cmdAgentList(ctx);
519
+ if (sub === 'create') return cmdAgentCreate(ctx);
520
+ if (sub === 'edit') return cmdAgentEdit({ ...ctx, code: rest[0] });
445
521
  console.log(`Unknown agent subcommand: ${sub}`);
522
+ console.log('Available: list | create | edit <code>');
446
523
  }
447
524
 
448
525
  function cmdWorkflow(args) {
@@ -459,15 +536,25 @@ function cmdValidate() {
459
536
  require('./validators/run-all.js')(KIT_ROOT);
460
537
  }
461
538
 
539
+ // Commands worth nudging the user about when a newer version exists. Skipped
540
+ // for `update` (already updating), `install` (already setting up), `uninstall`
541
+ // (already leaving), `validate` (developer-tool), and `version` (the user is
542
+ // already asking about versions).
543
+ const HINT_COMMANDS = new Set(['list', 'sync', 'agent', 'workflow', 'help']);
544
+
462
545
  async function main() {
463
546
  const [cmd, ...rest] = process.argv.slice(2);
464
547
  if (!cmd || cmd === 'help' || cmd === '--help' || cmd === '-h') {
548
+ await printUpdateHintIfAny(KIT_VERSION);
465
549
  console.log(HELP);
466
550
  return;
467
551
  }
552
+ if (HINT_COMMANDS.has(cmd)) {
553
+ await printUpdateHintIfAny(KIT_VERSION);
554
+ }
468
555
  switch (cmd) {
469
556
  case 'install': return cmdInstall(rest);
470
- case 'update': console.log('(stub) Update: diff + preserve customizations. Not yet implemented.'); return;
557
+ case 'update': return cmdUpdate({ kitRoot: KIT_ROOT, projectRoot: process.cwd() });
471
558
  case 'uninstall': return cmdUninstall();
472
559
  case 'list': return cmdList();
473
560
  case 'sync': return cmdSync();