wize-dev-kit 0.16.0 → 0.17.0

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 (235) hide show
  1. package/AGENTS.md +37 -0
  2. package/ARCH.md +77 -24
  3. package/CHANGELOG.md +14 -0
  4. package/DECISIONS.md +27 -1
  5. package/README.es.md +296 -0
  6. package/README.md +3 -2
  7. package/README.pt-BR.md +294 -0
  8. package/ROSTER.md +11 -3
  9. package/adapters/README.md +9 -7
  10. package/adapters/antigravity/README.md +5 -5
  11. package/adapters/claude-code/README.md +1 -1
  12. package/adapters/codex/README.md +5 -5
  13. package/adapters/codex/adapter.yaml +1 -1
  14. package/adapters/codex/render.js +1 -1
  15. package/adapters/continue/README.md +5 -5
  16. package/adapters/cursor/README.md +2 -2
  17. package/adapters/generic/README.md +1 -1
  18. package/adapters/hermes/README.md +23 -0
  19. package/adapters/hermes/adapter.yaml +8 -0
  20. package/adapters/hermes/render.js +17 -0
  21. package/adapters/kimi-code/README.md +5 -5
  22. package/adapters/kimi-code/render.js +2 -2
  23. package/adapters/kiro/README.md +30 -0
  24. package/adapters/kiro/adapter.yaml +8 -0
  25. package/adapters/kiro/render.js +21 -0
  26. package/adapters/opencode/README.md +3 -3
  27. package/adapters/opencode/render.js +27 -1
  28. package/adapters/windsurf/README.md +3 -3
  29. package/docs/harnesses/antigravity.md +20 -0
  30. package/docs/harnesses/antigravity.pt-BR.md +20 -0
  31. package/docs/harnesses/claude-code.md +23 -0
  32. package/docs/harnesses/claude-code.pt-BR.md +23 -0
  33. package/docs/harnesses/codex.md +21 -0
  34. package/docs/harnesses/codex.pt-BR.md +21 -0
  35. package/docs/harnesses/continue.md +21 -0
  36. package/docs/harnesses/continue.pt-BR.md +21 -0
  37. package/docs/harnesses/cursor.md +22 -0
  38. package/docs/harnesses/cursor.pt-BR.md +22 -0
  39. package/docs/harnesses/generic.md +20 -0
  40. package/docs/harnesses/generic.pt-BR.md +20 -0
  41. package/docs/harnesses/hermes.md +26 -0
  42. package/docs/harnesses/hermes.pt-BR.md +26 -0
  43. package/docs/harnesses/kimi-code.md +19 -0
  44. package/docs/harnesses/kimi-code.pt-BR.md +19 -0
  45. package/docs/harnesses/kiro.md +26 -0
  46. package/docs/harnesses/kiro.pt-BR.md +26 -0
  47. package/docs/harnesses/opencode.md +31 -0
  48. package/docs/harnesses/opencode.pt-BR.md +31 -0
  49. package/docs/harnesses/windsurf.md +22 -0
  50. package/docs/harnesses/windsurf.pt-BR.md +22 -0
  51. package/package.json +1 -1
  52. package/schemas/agent.schema.json +2 -2
  53. package/schemas/workflow.schema.json +1 -1
  54. package/src/app-overlay/wize-app-release-channels/workflow.md +2 -0
  55. package/src/app-overlay/wize-app-scaffold/workflow.md +2 -0
  56. package/src/app-overlay/wize-app-store-listing/workflow.md +2 -0
  57. package/src/builder-skills/wize-create-agent/workflow.md +2 -0
  58. package/src/builder-skills/wize-create-skill/workflow.md +2 -0
  59. package/src/builder-skills/wize-create-workflow/workflow.md +2 -0
  60. package/src/core-skills/wize-advanced-elicitation/skill.md +2 -0
  61. package/src/core-skills/wize-brainstorming/skill.md +2 -0
  62. package/src/core-skills/wize-customize/skill.md +116 -0
  63. package/src/core-skills/wize-editorial-review-prose/skill.md +94 -0
  64. package/src/core-skills/wize-editorial-review-structure/skill.md +99 -0
  65. package/src/core-skills/wize-grill/skill.md +77 -0
  66. package/src/core-skills/wize-index-docs/skill.md +119 -0
  67. package/src/core-skills/wize-pre-pr-check/skill.md +134 -0
  68. package/src/core-skills/wize-review-adversarial/skill.md +3 -0
  69. package/src/core-skills/wize-review-edge-case-hunter/skill.md +115 -0
  70. package/src/core-skills/wize-shard-doc/skill.md +2 -0
  71. package/src/core-skills/wize-spec/assets/headless-schemas.md +39 -0
  72. package/src/core-skills/wize-spec/assets/spec-template.md +40 -0
  73. package/src/core-skills/wize-spec/customize.toml +20 -0
  74. package/src/core-skills/wize-spec/skill.md +112 -0
  75. package/src/method-skills/1-analysis/wize-agent-analyst/agent.yaml +3 -0
  76. package/src/method-skills/1-analysis/wize-document-project/documentation-requirements.csv +12 -0
  77. package/src/method-skills/1-analysis/wize-document-project/templates/api-contracts-template.md +38 -0
  78. package/src/method-skills/1-analysis/wize-document-project/templates/architecture-template.md +54 -0
  79. package/src/method-skills/1-analysis/wize-document-project/templates/component-inventory-template.md +40 -0
  80. package/src/method-skills/1-analysis/wize-document-project/templates/contribution-guide-template.md +34 -0
  81. package/src/method-skills/1-analysis/wize-document-project/templates/data-models-template.md +36 -0
  82. package/src/method-skills/1-analysis/wize-document-project/templates/deep-dive-template.md +312 -0
  83. package/src/method-skills/1-analysis/wize-document-project/templates/deployment-guide-template.md +42 -0
  84. package/src/method-skills/1-analysis/wize-document-project/templates/development-guide-template.md +61 -0
  85. package/src/method-skills/1-analysis/wize-document-project/templates/index-template.md +185 -0
  86. package/src/method-skills/1-analysis/wize-document-project/templates/project-overview-template.md +110 -0
  87. package/src/method-skills/1-analysis/wize-document-project/templates/project-scan-report-schema.json +159 -0
  88. package/src/method-skills/1-analysis/wize-document-project/templates/source-tree-template.md +142 -0
  89. package/src/method-skills/1-analysis/wize-document-project/workflow.md +213 -20
  90. package/src/method-skills/1-analysis/wize-domain-research/customize.toml +14 -0
  91. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-01-init.md +49 -0
  92. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-02-domain-analysis.md +39 -0
  93. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-03-competitive-landscape.md +39 -0
  94. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-04-regulatory-focus.md +39 -0
  95. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-05-technical-trends.md +39 -0
  96. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-06-research-synthesis.md +43 -0
  97. package/src/method-skills/1-analysis/wize-domain-research/research.template.md +31 -0
  98. package/src/method-skills/1-analysis/wize-domain-research/workflow.md +58 -0
  99. package/src/method-skills/1-analysis/wize-market-research/customize.toml +14 -0
  100. package/src/method-skills/1-analysis/wize-market-research/research.template.md +31 -0
  101. package/src/method-skills/1-analysis/wize-market-research/steps/step-01-init.md +57 -0
  102. package/src/method-skills/1-analysis/wize-market-research/steps/step-02-customer-behavior.md +39 -0
  103. package/src/method-skills/1-analysis/wize-market-research/steps/step-03-customer-pain-points.md +37 -0
  104. package/src/method-skills/1-analysis/wize-market-research/steps/step-04-customer-decisions.md +39 -0
  105. package/src/method-skills/1-analysis/wize-market-research/steps/step-05-competitive-analysis.md +37 -0
  106. package/src/method-skills/1-analysis/wize-market-research/steps/step-06-research-completion.md +47 -0
  107. package/src/method-skills/1-analysis/wize-market-research/workflow.md +66 -0
  108. package/src/method-skills/1-analysis/wize-prfaq/workflow.md +152 -11
  109. package/src/method-skills/1-analysis/wize-product-brief/workflow.md +92 -19
  110. package/src/method-skills/1-analysis/wize-refresh-knowledge/workflow.md +129 -0
  111. package/src/method-skills/1-analysis/wize-research/workflow.md +39 -12
  112. package/src/method-skills/1-analysis/wize-technical-research/customize.toml +14 -0
  113. package/src/method-skills/1-analysis/wize-technical-research/research.template.md +31 -0
  114. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-01-init.md +49 -0
  115. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-02-technical-overview.md +45 -0
  116. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-03-integration-patterns.md +39 -0
  117. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-04-architectural-patterns.md +39 -0
  118. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-05-implementation-research.md +42 -0
  119. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-06-research-synthesis.md +46 -0
  120. package/src/method-skills/1-analysis/wize-technical-research/workflow.md +60 -0
  121. package/src/method-skills/1-analysis/wize-trigger-map/workflow.md +82 -16
  122. package/src/method-skills/2-plan-workflows/wize-create-prd/workflow.md +135 -23
  123. package/src/method-skills/2-plan-workflows/wize-edit-prd/workflow.md +110 -0
  124. package/src/method-skills/2-plan-workflows/wize-ux-design/workflow.md +134 -28
  125. package/src/method-skills/2-plan-workflows/wize-ux-scenarios/workflow.md +93 -15
  126. package/src/method-skills/2-plan-workflows/wize-validate-prd/workflow.md +108 -12
  127. package/src/method-skills/3-solutioning/wize-check-implementation-readiness/workflow.md +103 -11
  128. package/src/method-skills/3-solutioning/wize-create-architecture/architecture-decision-template.md +41 -0
  129. package/src/method-skills/3-solutioning/wize-create-architecture/customize.toml +20 -0
  130. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-01-init.md +95 -0
  131. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-01b-continue.md +32 -0
  132. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-02-context.md +126 -0
  133. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-03-starter.md +110 -0
  134. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-04-decisions.md +129 -0
  135. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-05-patterns.md +109 -0
  136. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-06-structure.md +97 -0
  137. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-07-validation.md +124 -0
  138. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-08-complete.md +59 -0
  139. package/src/method-skills/3-solutioning/wize-create-architecture/workflow.md +55 -48
  140. package/src/method-skills/3-solutioning/wize-create-epics-and-stories/workflow.md +154 -15
  141. package/src/method-skills/3-solutioning/wize-design-system/workflow.md +184 -22
  142. package/src/method-skills/3-solutioning/wize-nfr-principles/workflow.md +145 -17
  143. package/src/method-skills/3-solutioning/wize-project-context/workflow.md +120 -0
  144. package/src/method-skills/3-solutioning/wize-tech-vision/workflow.md +130 -22
  145. package/src/method-skills/4-implementation/wize-agent-dev/persona.md +12 -0
  146. package/src/method-skills/4-implementation/wize-changelog/workflow.md +184 -0
  147. package/src/method-skills/4-implementation/wize-checkpoint-preview/workflow.md +117 -0
  148. package/src/method-skills/4-implementation/wize-code-review/customize.toml +21 -0
  149. package/src/method-skills/4-implementation/wize-code-review/steps/step-01-gather-context.md +64 -0
  150. package/src/method-skills/4-implementation/wize-code-review/steps/step-02-review.md +40 -0
  151. package/src/method-skills/4-implementation/wize-code-review/steps/step-03-triage.md +43 -0
  152. package/src/method-skills/4-implementation/wize-code-review/steps/step-04-present.md +100 -0
  153. package/src/method-skills/4-implementation/wize-code-review/workflow.md +54 -12
  154. package/src/method-skills/4-implementation/wize-correct-course/workflow.md +93 -0
  155. package/src/method-skills/4-implementation/wize-create-story/workflow.md +154 -10
  156. package/src/method-skills/4-implementation/wize-dev-story/workflow.md +185 -17
  157. package/src/method-skills/4-implementation/wize-investigate/workflow.md +123 -0
  158. package/src/method-skills/4-implementation/wize-quick-dev/workflow.md +136 -18
  159. package/src/method-skills/4-implementation/wize-release/workflow.md +162 -0
  160. package/src/method-skills/4-implementation/wize-retrospective/workflow.md +114 -10
  161. package/src/method-skills/4-implementation/wize-sprint-planning/workflow.md +78 -11
  162. package/src/method-skills/4-implementation/wize-sprint-status/workflow.md +45 -11
  163. package/src/method-skills/module.yaml +28 -0
  164. package/src/orchestrator-skills/module.yaml +7 -1
  165. package/src/orchestrator-skills/wize/skill.md +164 -0
  166. package/src/orchestrator-skills/wize-check/skill.md +98 -0
  167. package/src/orchestrator-skills/wize-help/skill.md +227 -67
  168. package/src/orchestrator-skills/wize-onboarding/workflow.md +78 -14
  169. package/src/orchestrator-skills/wize-orchestrator/agent.yaml +2 -0
  170. package/src/orchestrator-skills/wize-orchestrator/persona.md +44 -3
  171. package/src/orchestrator-skills/wize-party-mode/workflow.md +2 -0
  172. package/src/security-overlay/_shared/allowlist.js +154 -0
  173. package/src/security-overlay/_shared/backlog.js +169 -0
  174. package/src/security-overlay/_shared/cli-runner.js +87 -0
  175. package/src/security-overlay/_shared/cvss.js +108 -0
  176. package/src/security-overlay/_shared/detect.js +125 -0
  177. package/src/security-overlay/_shared/install-script.js +205 -0
  178. package/src/security-overlay/_shared/invoke-phase.js +86 -0
  179. package/src/security-overlay/_shared/owasp.js +56 -0
  180. package/src/security-overlay/_shared/partial.js +225 -0
  181. package/src/security-overlay/_shared/preflight.js +175 -0
  182. package/src/security-overlay/_shared/scope-gate.js +172 -0
  183. package/src/security-overlay/_shared/scope-parser.js +147 -0
  184. package/src/security-overlay/agents/red-teamer/agent.yaml +54 -0
  185. package/src/security-overlay/agents/red-teamer/persona.md +49 -0
  186. package/src/security-overlay/data/common.txt +115 -0
  187. package/src/security-overlay/data/owasp-top10.json +15 -0
  188. package/src/security-overlay/data/tool-allowlist.json +31 -0
  189. package/src/security-overlay/skills/wize-sec-enumerate/scripts/run-enumerate.js +180 -0
  190. package/src/security-overlay/skills/wize-sec-enumerate/skill.md +34 -0
  191. package/src/security-overlay/skills/wize-sec-exploit/data/common.txt +117 -0
  192. package/src/security-overlay/skills/wize-sec-exploit/scripts/run-ffuf.js +147 -0
  193. package/src/security-overlay/skills/wize-sec-exploit/scripts/run-nikto.js +145 -0
  194. package/src/security-overlay/skills/wize-sec-exploit/scripts/run-nuclei.js +176 -0
  195. package/src/security-overlay/skills/wize-sec-exploit/scripts/run-sqlmap.js +139 -0
  196. package/src/security-overlay/skills/wize-sec-pentest/scripts/run-pipeline.js +184 -0
  197. package/src/security-overlay/skills/wize-sec-pentest/skill.md +54 -0
  198. package/src/security-overlay/skills/wize-sec-recon/scripts/run-gitleaks.js +139 -0
  199. package/src/security-overlay/skills/wize-sec-recon/scripts/run-osv.js +227 -0
  200. package/src/security-overlay/skills/wize-sec-recon/scripts/run-recon.js +162 -0
  201. package/src/security-overlay/skills/wize-sec-recon/skill.md +37 -0
  202. package/src/security-overlay/skills/wize-sec-report/scripts/render-report.js +1033 -0
  203. package/src/security-overlay/skills/wize-sec-scope/scripts/generate-scope.js +106 -0
  204. package/src/security-overlay/skills/wize-sec-scope/skill.md +52 -0
  205. package/src/tea-skills/wize-qa-generate-e2e-tests/workflow.md +121 -0
  206. package/src/tea-skills/wize-tea-design/workflow.md +107 -13
  207. package/src/tea-skills/wize-tea-gate/workflow.md +118 -25
  208. package/src/tea-skills/wize-tea-nfr/workflow.md +107 -14
  209. package/src/tea-skills/wize-tea-review/workflow.md +123 -13
  210. package/src/tea-skills/wize-tea-risk/workflow.md +113 -10
  211. package/src/tea-skills/wize-tea-trace/workflow.md +86 -12
  212. package/src/web-overlay/wize-web-deploy/workflow.md +2 -0
  213. package/src/web-overlay/wize-web-scaffold/workflow.md +2 -0
  214. package/src/web-overlay/wize-web-seo-audit/workflow.md +2 -0
  215. package/tools/check-eli5-all-adapters.js +3 -2
  216. package/tools/installer/baseline.js +138 -0
  217. package/tools/installer/commands/agent.js +197 -0
  218. package/tools/installer/commands/doctor.js +321 -0
  219. package/tools/installer/commands/document-project.js +93 -0
  220. package/tools/installer/commands/sync.js +45 -0
  221. package/tools/installer/commands/update.js +172 -0
  222. package/tools/installer/document-project/batch-scanner.js +93 -0
  223. package/tools/installer/document-project/classify.js +170 -0
  224. package/tools/installer/document-project/modes/deep-dive.js +196 -0
  225. package/tools/installer/document-project/modes/full-rescan.js +15 -0
  226. package/tools/installer/document-project/modes/initial-scan.js +100 -0
  227. package/tools/installer/document-project/modes/quick.js +211 -0
  228. package/tools/installer/document-project/render-index.js +101 -0
  229. package/tools/installer/document-project/state.js +110 -0
  230. package/tools/installer/onboarding.js +14 -20
  231. package/tools/installer/render-shared.js +159 -15
  232. package/tools/installer/setup-helpers.js +2 -0
  233. package/tools/installer/validators/run-all.js +3 -2
  234. package/tools/installer/version-check.js +117 -0
  235. package/tools/installer/wize-cli.js +501 -70
@@ -3,9 +3,10 @@
3
3
  * wize-dev-kit — CLI entry point
4
4
  * Subcommands: install, update, uninstall, list, sync, agent, workflow, help
5
5
  *
6
- * This is a v0.1 scaffold. The interactive prompt logic and adapter rendering
7
- * are stubs; the dispatcher and basic install/uninstall create the .wize/
8
- * folder layout so downstream agents can be activated.
6
+ * v0.15.0 — Full-lifecycle CLI with install, update, uninstall, list, sync,
7
+ * agent, workflow, validate, doctor, and document-project commands. Adapters
8
+ * render for 11 IDE targets. Security overlay ships with 8 tools.
9
+ * `install --yes` now enables all harnesses + all overlays by default.
9
10
  */
10
11
  'use strict';
11
12
 
@@ -13,8 +14,16 @@ const fs = require('node:fs');
13
14
  const os = require('node:os');
14
15
  const path = require('node:path');
15
16
  const readline = require('node:readline');
17
+ const { execSync } = require('node:child_process');
16
18
  const prompts = require('prompts');
17
19
  const { applyGitignore, generateUserToml } = require('./setup-helpers.js');
20
+ const { cmdUpdate, loadProjectConfig } = require('./commands/update.js');
21
+ const { printUpdateHintIfAny } = require('./version-check.js');
22
+ const { cmdSync: cmdSyncReal } = require('./commands/sync.js');
23
+ const { cmdAgentList, cmdAgentCreate, cmdAgentEdit } = require('./commands/agent.js');
24
+ const { cmdDoctor, adapterTargetPath } = require('./commands/doctor.js');
25
+ const { cmdDocumentProject } = require('./commands/document-project.js');
26
+ const { compose: composeOnboarding } = require('./onboarding.js');
18
27
 
19
28
  const INTERACTIVE = process.stdout.isTTY && process.stdin.isTTY;
20
29
 
@@ -28,6 +37,8 @@ const TARGETS = [
28
37
  { code: 'codex', label: 'Codex', default: false },
29
38
  { code: 'continue', label: 'Continue', default: false },
30
39
  { code: 'kimi-code', label: 'Kimi Code', default: false },
40
+ { code: 'hermes', label: 'Hermes Agent (.hermes/skills/)', default: false },
41
+ { code: 'kiro', label: 'Kiro — AWS (.kiro/skills/)', default: false },
31
42
  { code: 'opencode', label: 'OpenCode', default: false },
32
43
  { code: 'antigravity', label: 'Antigravity (CLI + IDE)', default: false },
33
44
  { code: 'generic', label: 'Generic fallback (.wize/agents/)', default: true }
@@ -36,7 +47,8 @@ const TARGETS = [
36
47
  const PROFILES = [
37
48
  { code: 'core', label: 'Wize Dev Core', required: true },
38
49
  { code: 'web-overlay', label: 'Wize Web Dev (overlay)', required: false },
39
- { code: 'app-overlay', label: 'Wize App Development (overlay)', required: false }
50
+ { code: 'app-overlay', label: 'Wize App Development (overlay)', required: false },
51
+ { code: 'security-overlay', label: 'Wize Security (AI Pentester overlay)', required: false }
40
52
  ];
41
53
 
42
54
  // Common BCP-47 short codes. Users can type any other value freely.
@@ -67,6 +79,8 @@ Commands:
67
79
  agent <create|list> Manage agents (built-in or custom).
68
80
  workflow <create|list> Manage workflows.
69
81
  validate Run schema + lint + dry-run validators.
82
+ doctor Diagnose the kit + project state, suggest fixes.
83
+ document-project Document the current repo (quick | initial_scan | full_rescan | deep_dive).
70
84
  help Show this message.
71
85
 
72
86
  Documentation:
@@ -86,18 +100,131 @@ function logo() {
86
100
  ].join('\n');
87
101
  }
88
102
 
103
+ // Pipe-safe line reader.
104
+ //
105
+ // `readline.question()` has two bugs that bite us when stdin is a pipe (e.g.
106
+ // `printf ... | wize-dev-kit install` or our CI smoke test):
107
+ // 1. Opening a new createInterface per call closes stdin on .close().
108
+ // 2. Even with a shared interface, the second `question` after a single
109
+ // empty line ("\n") never resolves — readline's question machinery
110
+ // stalls in non-TTY mode.
111
+ //
112
+ // We replace it with an event-based queue: subscribe to `line` once, push
113
+ // resolved promises in order. Empty lines are propagated as `""`. EOF is
114
+ // treated as end of the queue (remaining waiters resolve with `""`).
115
+ let _rl = null;
116
+ let _queue = [];
117
+ let _waiters = [];
118
+
119
+ function getRl() {
120
+ if (_rl) return _rl;
121
+ _rl = readline.createInterface({ input: process.stdin, terminal: false });
122
+ _rl.on('line', (line) => {
123
+ if (_waiters.length) _waiters.shift()(line);
124
+ else _queue.push(line);
125
+ });
126
+ _rl.on('close', () => {
127
+ while (_waiters.length) _waiters.shift()('');
128
+ });
129
+ process.on('exit', () => { if (_rl) { _rl.close(); _rl = null; } });
130
+ return _rl;
131
+ }
132
+
89
133
  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()); }));
134
+ process.stdout.write(question);
135
+ getRl();
136
+ // In interactive mode, discard any residual lines left by previous
137
+ // prompts (e.g. the prompts library) so this prompt always waits for
138
+ // fresh user input. In non-TTY / piped mode, those queued lines are
139
+ // intentional input and must be consumed in order.
140
+ if (INTERACTIVE) {
141
+ _queue = [];
142
+ }
143
+ if (_queue.length) return Promise.resolve(_queue.shift().trim());
144
+ return new Promise(resolve => _waiters.push((line) => resolve(line.trim())));
92
145
  }
93
146
 
94
147
  async function confirm(question, defaultYes = true) {
148
+ if (INTERACTIVE) {
149
+ const { value } = await prompts({
150
+ type: 'confirm',
151
+ name: 'value',
152
+ message: question,
153
+ initial: defaultYes
154
+ });
155
+ if (value === undefined) process.exit(130);
156
+ return value;
157
+ }
95
158
  const hint = defaultYes ? '[Y/n]' : '[y/N]';
96
159
  const ans = (await prompt(`${question} ${hint} `)).toLowerCase();
97
160
  if (!ans) return defaultYes;
98
161
  return ans.startsWith('y');
99
162
  }
100
163
 
164
+ async function promptText(question, defaultValue = '') {
165
+ if (INTERACTIVE) {
166
+ const { value } = await prompts({
167
+ type: 'text',
168
+ name: 'value',
169
+ message: question,
170
+ initial: defaultValue
171
+ });
172
+ if (value === undefined) process.exit(130);
173
+ return value.trim();
174
+ }
175
+ const ans = (await prompt(`${question} [${defaultValue}]: `)).trim();
176
+ return ans || defaultValue;
177
+ }
178
+
179
+ async function promptTextMandatory(question, defaultValue = '') {
180
+ if (INTERACTIVE) {
181
+ if (defaultValue) {
182
+ const { keep } = await prompts({
183
+ type: 'confirm',
184
+ name: 'keep',
185
+ message: `${question} (use "${defaultValue}"?)`,
186
+ initial: true
187
+ });
188
+ if (keep === undefined) process.exit(130);
189
+ if (keep) return defaultValue;
190
+ }
191
+ const { value } = await prompts({
192
+ type: 'text',
193
+ name: 'value',
194
+ message: question
195
+ });
196
+ if (value === undefined) process.exit(130);
197
+ const trimmed = value.trim();
198
+ if (trimmed) return trimmed;
199
+ if (defaultValue) return defaultValue;
200
+ return promptTextMandatory(question, defaultValue);
201
+ }
202
+ // Non-TTY: keep asking until non-empty.
203
+ for (;;) {
204
+ const ans = (await prompt(`${question}: `)).trim();
205
+ if (ans) return ans;
206
+ if (defaultValue) return defaultValue;
207
+ console.log('Please provide a value.');
208
+ }
209
+ }
210
+
211
+ async function select(label, choices, defaultValue) {
212
+ if (INTERACTIVE) {
213
+ const initial = choices.findIndex(c => c.value === defaultValue);
214
+ const { picked } = await prompts({
215
+ type: 'select',
216
+ name: 'picked',
217
+ message: label,
218
+ choices: choices.map(c => ({ title: c.title, value: c.value, description: c.description })),
219
+ initial: initial === -1 ? 0 : initial
220
+ });
221
+ if (picked === undefined) process.exit(130);
222
+ return picked;
223
+ }
224
+ // Non-TTY fallback: return default.
225
+ return defaultValue;
226
+ }
227
+
101
228
  async function selectLanguage(label, defaultCode = 'en') {
102
229
  if (INTERACTIVE) {
103
230
  const choices = LANGUAGES.map(l => ({
@@ -302,49 +429,169 @@ function renderAdapters({ kitRoot, projectRoot, targets, profiles }) {
302
429
  return results;
303
430
  }
304
431
 
432
+ // Parse --key value and --flag from an argv slice. Returns { flags, positional }.
433
+ function parseArgs(args) {
434
+ const flags = {};
435
+ const positional = [];
436
+ for (let i = 0; i < args.length; i++) {
437
+ const a = args[i];
438
+ if (a.startsWith('--')) {
439
+ const key = a.slice(2);
440
+ if (key.includes('=')) {
441
+ const [k, v] = key.split('=', 2);
442
+ flags[k] = v;
443
+ } else if (i + 1 < args.length && !args[i + 1].startsWith('--')) {
444
+ flags[key] = args[++i];
445
+ } else {
446
+ flags[key] = true;
447
+ }
448
+ } else {
449
+ positional.push(a);
450
+ }
451
+ }
452
+ return { flags, positional };
453
+ }
454
+
455
+ function resolveProfiles(flags) {
456
+ if (!flags.profiles) return null;
457
+ const codes = flags.profiles.split(',').map(s => s.trim()).filter(Boolean);
458
+ const resolved = [];
459
+ for (const c of codes) {
460
+ const p = PROFILES.find(p => p.code === c);
461
+ if (p) resolved.push(p);
462
+ else console.log(`⚠ perfil desconhecido: "${c}" — ignorado`);
463
+ }
464
+ if (resolved.length === 0) return null;
465
+ return resolved;
466
+ }
467
+
468
+ function resolveTargets(flags) {
469
+ if (!flags.targets) return null;
470
+ const codes = flags.targets.split(',').map(s => s.trim()).filter(Boolean);
471
+ const resolved = [];
472
+ for (const c of codes) {
473
+ const t = TARGETS.find(t => t.code === c);
474
+ if (t) resolved.push(t);
475
+ else console.log(`⚠ target desconhecido: "${c}" — ignorado`);
476
+ }
477
+ if (resolved.length === 0) return null;
478
+ return resolved;
479
+ }
480
+
481
+ function resolveLang(flags) {
482
+ if (!flags.lang) return null;
483
+ const code = flags.lang.trim();
484
+ if (/^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})?$/.test(code)) return code;
485
+ console.log(`⚠ código de idioma inválido: "${code}" — usando pt-BR`);
486
+ return null;
487
+ }
488
+
489
+ function resolveName(flags) {
490
+ if (flags.name) return flags.name.trim();
491
+ if (flags.yes) {
492
+ try { return execSync('git config user.name', { encoding: 'utf-8' }).trim(); } catch (_) {}
493
+ return process.env.USER || process.env.USERNAME || 'Developer';
494
+ }
495
+ return null;
496
+ }
497
+
498
+ // --yes quick install: everything on. All harnesses + all overlays, so
499
+ // `npx wize-dev-kit install --yes` is a true one-shot full install.
500
+ function defaultProfiles() {
501
+ return PROFILES.slice();
502
+ }
503
+
504
+ function defaultTargets() {
505
+ return TARGETS.slice();
506
+ }
507
+
305
508
  async function cmdInstall(args) {
306
509
  const cwd = process.cwd();
510
+ const { flags } = parseArgs(args);
511
+ const dryRun = !!flags['dry-run'];
512
+ const nonInteractive = !!flags.yes;
513
+
307
514
  console.log(logo());
308
- console.log('Installing Wize Development Kit into:', cwd);
515
+ if (dryRun) console.log('[DRY-RUN] Nenhum arquivo será modificado.\n');
516
+ console.log('Instalando Wize Development Kit em:', cwd);
517
+
309
518
  if (!isGitRepo(cwd)) {
310
- console.log('\n⚠ not a git repo. Initialize git first or proceed at your own risk.');
311
- const ok = await confirm('Continue anyway?', false);
519
+ console.log('\n⚠ não é um repositório git. Inicialize o git primeiro ou prossiga por sua conta e risco.');
520
+ if (nonInteractive) {
521
+ console.log('Modo não-interativo: abortando. Use --yes apenas em repositórios git.');
522
+ process.exit(1);
523
+ }
524
+ const ok = await confirm('Continuar mesmo assim?', false);
312
525
  if (!ok) process.exit(1);
313
526
  }
314
527
 
315
528
  const detection = detectBrownfield(cwd);
316
529
  if (detection.brownfield) {
317
- console.log(`\nBrownfield signals detected: ${detection.signals.join(', ')}`);
530
+ console.log(`\nSinais de brownfield detectados: ${detection.signals.join(', ')}`);
531
+ } else {
532
+ console.log('\nRepositório greenfield detectado.');
533
+ }
534
+
535
+ // Resolve flags or fall back to interactive prompts.
536
+ let project_name, profiles, targets, communication_language, document_output_language, user_name, wantsGitignore;
537
+
538
+ if (nonInteractive) {
539
+ project_name = flags.name ? resolveName(flags) : (path.basename(cwd));
540
+ profiles = resolveProfiles(flags) || defaultProfiles();
541
+ targets = resolveTargets(flags) || defaultTargets();
542
+ communication_language = resolveLang(flags) || 'pt-BR';
543
+ document_output_language = resolveLang(flags) || communication_language;
544
+ user_name = resolveName(flags);
545
+ wantsGitignore = true;
318
546
  } else {
319
- console.log('\nGreenfield repo detected.');
320
- }
321
-
322
- const project_name = (await prompt(`Project name [${path.basename(cwd)}]: `)) || path.basename(cwd);
323
- const profiles = await multiSelect('Select profile(s) to install', PROFILES);
324
- const targets = await multiSelect('Select IDE target(s)', TARGETS);
325
-
326
- const communication_language = await selectLanguage(
327
- 'Communication language (how agents will talk to you in chat)',
328
- 'en'
329
- );
330
- const document_output_language = await selectLanguage(
331
- `Document output language (language used in generated files; ENTER for "${communication_language}")`,
332
- communication_language
333
- );
334
-
335
- // Personal touch — the user_name lands in .wize/config/user.toml (per-developer).
336
- const defaultName = (os.userInfo().username || '').trim();
337
- const user_name = (await prompt(
338
- `How should the agents call you? [${defaultName || 'leave blank'}]: `
339
- )).trim() || defaultName;
340
-
341
- // Gitignore — opt-in, idempotent.
342
- const wantsGitignore = await confirm(
343
- 'Add the suggested entries to .gitignore (user.toml + scratch + generated adapter outputs)?',
344
- true
345
- );
346
-
347
- console.log('\nCreating .wize/ skeleton...');
547
+ project_name = (await promptText(`Nome do projeto`, path.basename(cwd))) || path.basename(cwd);
548
+ profiles = await multiSelect('Selecione o(s) perfil(is) para instalar', PROFILES);
549
+ targets = await multiSelect('Selecione o(s) IDE target(s)', TARGETS);
550
+
551
+ communication_language = await selectLanguage(
552
+ 'Idioma de comunicação (como os agentes vão falar com você no chat)',
553
+ 'pt-BR'
554
+ );
555
+ document_output_language = await selectLanguage(
556
+ `Idioma dos documentos (idioma usado nos arquivos gerados; ENTER para "${communication_language}")`,
557
+ communication_language
558
+ );
559
+
560
+ const defaultName = (os.userInfo().username || '').trim();
561
+ user_name = await promptTextMandatory(
562
+ 'Como os agentes devem te chamar?',
563
+ defaultName
564
+ );
565
+
566
+ wantsGitignore = await confirm(
567
+ 'Adicionar as entradas sugeridas ao .gitignore (user.toml + scratch + outputs de adapters)?',
568
+ true
569
+ );
570
+ }
571
+
572
+ // Show resolved config.
573
+ console.log(`\nConfiguração:`);
574
+ console.log(` Projeto: ${project_name}`);
575
+ console.log(` Perfis: ${profiles.map(p => p.code).join(', ')}`);
576
+ console.log(` IDE targets: ${targets.map(t => t.code).join(', ')}`);
577
+ console.log(` Idioma comm: ${communication_language}`);
578
+ console.log(` Idioma docs: ${document_output_language}`);
579
+ if (user_name) console.log(` Nome: ${user_name}`);
580
+ if (dryRun) console.log(` Modo: dry-run`);
581
+
582
+ if (dryRun) {
583
+ console.log('\n[DRY-RUN] Criaria estrutura .wize/:');
584
+ for (const dir of WIZE_DIRS) console.log(` - ${dir}/`);
585
+ console.log(`[DRY-RUN] Escreveria .wize/config/project.toml`);
586
+ console.log(`[DRY-RUN] Escreveria .wize/config/user.toml`);
587
+ console.log(`[DRY-RUN] Escreveria .wize/config/tea.toml`);
588
+ if (wantsGitignore) console.log(`[DRY-RUN] Atualizaria .gitignore`);
589
+ console.log(`\n[DRY-RUN] Geraria adapters para: ${targets.map(t => t.code).join(', ')}`);
590
+ console.log('\n[DRY-RUN] Concluído. Nenhum arquivo foi modificado.');
591
+ return;
592
+ }
593
+
594
+ console.log('\nCriando estrutura .wize/...');
348
595
  for (const dir of WIZE_DIRS) mkdirp(path.join(cwd, dir));
349
596
 
350
597
  writeIfMissing(path.join(cwd, '.wize/config/project.toml'), projectToml({
@@ -353,20 +600,26 @@ async function cmdInstall(args) {
353
600
  writeIfMissing(path.join(cwd, '.wize/config/user.toml'), generateUserToml({ name: user_name }));
354
601
  writeIfMissing(path.join(cwd, '.wize/config/tea.toml'), teaToml());
355
602
 
356
- console.log('✓ .wize/ created');
357
- console.log(`✓ profiles: ${profiles.map(p => p.code).join(', ')}`);
603
+ console.log('✓ .wize/ criado');
604
+ console.log(`✓ perfis: ${profiles.map(p => p.code).join(', ')}`);
358
605
  console.log(`✓ ide targets: ${targets.map(t => t.code).join(', ')}`);
359
- if (user_name) console.log(`✓ user.toml: agents will call you "${user_name}"`);
606
+ if (user_name) console.log(`✓ user.toml: agentes vão te chamar de "${user_name}"`);
607
+
608
+ if (profiles.some(p => p.code === 'security-overlay')) {
609
+ console.log('\n⚠ security-overlay selecionado — uso autorizado apenas.');
610
+ console.log(' Uso autorizado. Você é responsável por obter permissão antes de testar alvos que não são seus.');
611
+ console.log(' O kit detecta alvos fora do scope.md e recusa automaticamente; ainda assim, use com responsabilidade.');
612
+ }
360
613
 
361
614
  if (wantsGitignore) {
362
615
  const r = applyGitignore(cwd);
363
- if (r.changed) console.log(`✓ .gitignore ${r.mode} with the wize-dev-kit block`);
364
- else console.log(`= .gitignore already up to date`);
616
+ if (r.changed) console.log(`✓ .gitignore ${r.mode} com o bloco wize-dev-kit`);
617
+ else console.log(`= .gitignore já está atualizado`);
365
618
  } else {
366
- console.log('= .gitignore untouched (you opted out of suggested entries)');
619
+ console.log('= .gitignore não modificado (você optou por não adicionar as entradas sugeridas)');
367
620
  }
368
621
 
369
- console.log('\nGenerating IDE adapters...');
622
+ console.log('\nGerando adapters IDE...');
370
623
  const renderResults = renderAdapters({
371
624
  kitRoot: KIT_ROOT,
372
625
  projectRoot: cwd,
@@ -374,33 +627,191 @@ async function cmdInstall(args) {
374
627
  profiles
375
628
  });
376
629
  for (const r of renderResults) {
377
- if (r.skipped) console.log(` - ${r.code}: skipped (${r.reason})`);
378
- else if (r.written) console.log(` ✓ ${r.code}: ${r.written} skill(s) emitted`);
630
+ if (r.skipped) console.log(` - ${r.code}: pulado (${r.reason})`);
631
+ else if (r.written) console.log(` ✓ ${r.code}: ${r.written} skill(s) emitidas`);
379
632
  else if (r.error) console.log(` ✖ ${r.code}: ${r.error}`);
380
633
  }
381
634
 
382
635
  if (detection.brownfield) {
383
- const baseline = await confirm('\nRun `wize-document-project` to baseline the existing repo now?', true);
384
- if (baseline) {
385
- console.log('(stub) Pepper + Peggy would now produce the baseline docs in .wize/knowledge/document-project/.');
636
+ if (process.env.WIZE_SKIP_BASELINE === '1') {
637
+ console.log('\nWIZE_SKIP_BASELINE=1 — baseline não será executado.');
638
+ } else if (!INTERACTIVE || nonInteractive) {
639
+ console.log('\nInstalação não-interativa detectada; executando baseline rápido...');
640
+ cmdDocumentProject({ kitRoot: KIT_ROOT, projectRoot: cwd, args: ['quick'], opts: { log: console.log } });
641
+ } else {
642
+ const mode = await select(
643
+ 'Documentar o repositório existente agora?',
644
+ [
645
+ { title: 'Baseline rápido (padrão, 6 arquivos)', value: 'quick' },
646
+ { title: 'Scan inicial (documentos de padrão + condicionais)', value: 'initial_scan' },
647
+ { title: 'Rescan completo (arquiva estado anterior, re-executa)', value: 'full_rescan' },
648
+ { title: 'Pular documentação por enquanto', value: 'skip' }
649
+ ],
650
+ 'quick'
651
+ );
652
+ if (mode !== 'skip') {
653
+ cmdDocumentProject({ kitRoot: KIT_ROOT, projectRoot: cwd, args: [mode], opts: { log: console.log } });
654
+ } else {
655
+ console.log('\nDocumentação pulada. Execute `wize-dev-kit document-project` depois.');
656
+ }
386
657
  }
387
658
  }
388
659
 
389
- console.log('\nDone. Activate Wizer in your IDE and say: "Brief me on this project."');
660
+ console.log('\n──────────────────────────────────────────────────────────────');
661
+ console.log('Concluído.');
662
+ console.log('');
663
+ console.log('⚠ Reinicie seu IDE — muitos harnesses carregam skills apenas na inicialização.');
664
+ console.log(composeOnboarding(detection, profiles));
665
+ console.log('');
666
+ console.log('Mantenha o kit sincronizado:');
667
+ console.log(' • `npx wize-dev-kit update` atualizar adapters após nova versão do kit');
668
+ console.log(' • `npx wize-dev-kit sync` re-renderizar adapters após editar config');
669
+ console.log(' • `npx wize-dev-kit agent list | create | edit <code>` gerenciar agentes');
670
+ console.log('──────────────────────────────────────────────────────────────');
671
+ }
672
+
673
+ // AGENTS.md signature — used to detect whether the file was generated by the kit.
674
+ const AGENTS_SIGNATURE = '# Agents — Wize Development Kit';
675
+
676
+ function isKitAgentsMd(filePath) {
677
+ if (!fs.existsSync(filePath)) return false;
678
+ try {
679
+ const head = fs.readFileSync(filePath, 'utf-8').slice(0, 200);
680
+ return head.includes(AGENTS_SIGNATURE);
681
+ } catch { return false; }
682
+ }
683
+
684
+ // Delete wize-* entries from an adapter target directory. Returns count of
685
+ // removed items (files + dirs). Safe: only deletes entries whose name starts
686
+ // with "wize-".
687
+ function cleanAdapterTarget(targetDir) {
688
+ if (!fs.existsSync(targetDir)) return 0;
689
+ let count = 0;
690
+ let entries;
691
+ try { entries = fs.readdirSync(targetDir); } catch { return 0; }
692
+ for (const name of entries) {
693
+ if (!name.startsWith('wize-')) continue;
694
+ const full = path.join(targetDir, name);
695
+ try {
696
+ fs.rmSync(full, { recursive: true, force: true });
697
+ count++;
698
+ } catch { /* skip permission errors */ }
699
+ }
700
+ return count;
390
701
  }
391
702
 
392
- async function cmdUninstall() {
703
+ async function cmdUninstall(args) {
393
704
  const cwd = process.cwd();
394
- const dir = path.join(cwd, '.wize');
395
- if (!fs.existsSync(dir)) {
396
- console.log('No .wize/ folder found here.');
705
+ const { flags } = parseArgs(args || []);
706
+ const dryRun = !!flags['dry-run'];
707
+
708
+ if (dryRun) console.log('[DRY-RUN] Nenhum arquivo será removido.\n');
709
+
710
+ const wizeDir = path.join(cwd, '.wize');
711
+ if (!fs.existsSync(wizeDir)) {
712
+ console.log('Nenhuma pasta .wize/ encontrada aqui.');
397
713
  return;
398
714
  }
399
- const ok = await confirm(`Remove ${dir}? Your project source code is not touched.`, false);
400
- if (!ok) return;
401
- fs.rmSync(dir, { recursive: true, force: true });
402
- console.log('Removed .wize/.');
403
- console.log('(stub) IDE adapter files (.claude/skills/wize-*, .cursor/rules/wize-*) would be cleaned here.');
715
+
716
+ // Read project.toml to discover which IDE targets were configured.
717
+ let ideTargets = [];
718
+ try {
719
+ const cfg = loadProjectConfig(cwd);
720
+ ideTargets = (cfg.install && cfg.install.ide_targets) || [];
721
+ } catch { /* project.toml may be missing or corrupt */ }
722
+
723
+ // Build the list of what would be removed.
724
+ const toRemove = [];
725
+
726
+ // 1. Adapter target dirs (wize-* entries).
727
+ const adapterDirs = [];
728
+ for (const code of ideTargets) {
729
+ const dir = adapterTargetPath(code, cwd);
730
+ if (!dir) continue;
731
+ if (!fs.existsSync(dir)) continue;
732
+ let entries;
733
+ try { entries = fs.readdirSync(dir); } catch { continue; }
734
+ for (const name of entries) {
735
+ if (!name.startsWith('wize-')) continue;
736
+ adapterDirs.push({ target: code, dir, name, full: path.join(dir, name) });
737
+ }
738
+ }
739
+
740
+ // 2. .wize/ directory.
741
+ toRemove.push({ kind: 'diretório', path: wizeDir, label: '.wize/' });
742
+
743
+ // 3. AGENTS.md if kit-generated.
744
+ const agentsMd = path.join(cwd, 'AGENTS.md');
745
+ if (isKitAgentsMd(agentsMd)) {
746
+ toRemove.push({ kind: 'arquivo', path: agentsMd, label: 'AGENTS.md' });
747
+ }
748
+
749
+ // Show what will be removed.
750
+ if (adapterDirs.length > 0) {
751
+ console.log('Arquivos de adapter que serão removidos:');
752
+ const byTarget = {};
753
+ for (const a of adapterDirs) {
754
+ byTarget[a.target] = byTarget[a.target] || [];
755
+ byTarget[a.target].push(a.name);
756
+ }
757
+ for (const [code, names] of Object.entries(byTarget)) {
758
+ console.log(` ${code}: ${names.length} entrada(s) (${names.slice(0, 5).join(', ')}${names.length > 5 ? '...' : ''})`);
759
+ }
760
+ } else {
761
+ console.log('Nenhum arquivo de adapter wize-* encontrado.');
762
+ }
763
+
764
+ console.log(`\nSerá removido:`);
765
+ for (const item of toRemove) {
766
+ console.log(` - ${item.label} (${item.kind})`);
767
+ }
768
+ if (adapterDirs.length > 0) {
769
+ console.log(` - ${adapterDirs.length} entrada(s) wize-* nos diretórios de adapter`);
770
+ }
771
+
772
+ if (dryRun) {
773
+ console.log('\n[DRY-RUN] Concluído. Nenhum arquivo foi removido.');
774
+ return;
775
+ }
776
+
777
+ const totalItems = toRemove.length + adapterDirs.length;
778
+ if (totalItems === 0) {
779
+ console.log('\nNada para remover.');
780
+ return;
781
+ }
782
+
783
+ const ok = await confirm(`\nRemover ${totalItems} item(ns)? O código-fonte do seu projeto não será afetado.`, false);
784
+ if (!ok) {
785
+ console.log('Cancelado.');
786
+ return;
787
+ }
788
+
789
+ // Capture AGENTS.md status before deletion.
790
+ const hadAgentsMd = isKitAgentsMd(agentsMd);
791
+
792
+ // Delete adapter entries first.
793
+ let adapterCount = 0;
794
+ for (const a of adapterDirs) {
795
+ try {
796
+ fs.rmSync(a.full, { recursive: true, force: true });
797
+ adapterCount++;
798
+ } catch (err) {
799
+ console.log(` ✖ erro ao remover ${a.name}: ${err.message}`);
800
+ }
801
+ }
802
+
803
+ // Delete .wize/ and AGENTS.md.
804
+ for (const item of toRemove) {
805
+ try {
806
+ fs.rmSync(item.path, { recursive: true, force: true });
807
+ } catch (err) {
808
+ console.log(` ✖ erro ao remover ${item.label}: ${err.message}`);
809
+ }
810
+ }
811
+
812
+ console.log(`\n✓ Removido: .wize/ + ${adapterCount} entrada(s) de adapter`);
813
+ if (hadAgentsMd) console.log('✓ AGENTS.md removido');
814
+ console.log('\nO código-fonte do seu projeto não foi alterado.');
404
815
  }
405
816
 
406
817
  function cmdList() {
@@ -418,9 +829,10 @@ function cmdList() {
418
829
  ['wize-agent-dev', 'Shuri']
419
830
  ];
420
831
  for (const [code, name] of list) console.log(` ${code.padEnd(36)} ${name}`);
832
+ console.log(` ${'wize-sec-red-teamer'.padEnd(36)} Natasha Romanoff (security-overlay, opt-in)`);
421
833
 
422
834
  console.log('\nWorkflows directories:');
423
- const phases = ['1-analysis', '2-plan-workflows', '3-solutioning', '4-implementation'];
835
+ const phases = ['1-analysis', '2-plan', '3-solutioning', '4-implementation'];
424
836
  for (const phase of phases) {
425
837
  const dir = path.join(KIT_ROOT, 'src/method-skills', phase);
426
838
  if (!fs.existsSync(dir)) continue;
@@ -432,17 +844,18 @@ function cmdList() {
432
844
  }
433
845
 
434
846
  function cmdSync() {
435
- console.log('(stub) Sync would regenerate IDE adapter files for active targets in .wize/config/project.toml.');
847
+ return cmdSyncReal({ kitRoot: KIT_ROOT, projectRoot: process.cwd() });
436
848
  }
437
849
 
438
850
  function cmdAgent(args) {
439
851
  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
- }
852
+ const rest = args.slice(1);
853
+ const ctx = { kitRoot: KIT_ROOT, projectRoot: process.cwd() };
854
+ if (sub === 'list') return cmdAgentList(ctx);
855
+ if (sub === 'create') return cmdAgentCreate(ctx);
856
+ if (sub === 'edit') return cmdAgentEdit({ ...ctx, code: rest[0] });
445
857
  console.log(`Unknown agent subcommand: ${sub}`);
858
+ console.log('Available: list | create | edit <code>');
446
859
  }
447
860
 
448
861
  function cmdWorkflow(args) {
@@ -459,21 +872,39 @@ function cmdValidate() {
459
872
  require('./validators/run-all.js')(KIT_ROOT);
460
873
  }
461
874
 
875
+ // Commands worth nudging the user about when a newer version exists. Skipped
876
+ // for `update` (already updating), `install` (already setting up), `uninstall`
877
+ // (already leaving), `validate` (developer-tool), and `version` (the user is
878
+ // already asking about versions).
879
+ const HINT_COMMANDS = new Set(['list', 'sync', 'agent', 'workflow', 'help', 'doctor', 'document-project']);
880
+
462
881
  async function main() {
463
882
  const [cmd, ...rest] = process.argv.slice(2);
464
883
  if (!cmd || cmd === 'help' || cmd === '--help' || cmd === '-h') {
884
+ await printUpdateHintIfAny(KIT_VERSION);
465
885
  console.log(HELP);
466
886
  return;
467
887
  }
888
+ if (HINT_COMMANDS.has(cmd)) {
889
+ await printUpdateHintIfAny(KIT_VERSION);
890
+ }
468
891
  switch (cmd) {
469
892
  case 'install': return cmdInstall(rest);
470
- case 'update': console.log('(stub) Update: diff + preserve customizations. Not yet implemented.'); return;
471
- case 'uninstall': return cmdUninstall();
893
+ case 'update': return cmdUpdate({ kitRoot: KIT_ROOT, projectRoot: process.cwd() });
894
+ case 'uninstall': return cmdUninstall(rest);
472
895
  case 'list': return cmdList();
473
896
  case 'sync': return cmdSync();
474
897
  case 'agent': return cmdAgent(rest);
475
898
  case 'workflow': return cmdWorkflow(rest);
476
899
  case 'validate': return cmdValidate();
900
+ case 'doctor': return cmdDoctor({ kitRoot: KIT_ROOT, projectRoot: process.cwd() });
901
+ case 'document-project':
902
+ return cmdDocumentProject({
903
+ kitRoot: KIT_ROOT,
904
+ projectRoot: process.cwd(),
905
+ args: rest,
906
+ opts: { log: console.log }
907
+ });
477
908
  case 'version':
478
909
  case '--version':
479
910
  case '-v':