wize-dev-kit 0.16.0 → 0.16.1

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 (228) hide show
  1. package/AGENTS.md +37 -0
  2. package/ARCH.md +77 -24
  3. package/CHANGELOG.md +4 -0
  4. package/DECISIONS.md +27 -1
  5. package/README.es.md +295 -0
  6. package/README.pt-BR.md +293 -0
  7. package/ROSTER.md +11 -3
  8. package/adapters/README.md +8 -7
  9. package/adapters/antigravity/README.md +5 -5
  10. package/adapters/claude-code/README.md +1 -1
  11. package/adapters/codex/README.md +5 -5
  12. package/adapters/codex/adapter.yaml +1 -1
  13. package/adapters/codex/render.js +1 -1
  14. package/adapters/continue/README.md +5 -5
  15. package/adapters/cursor/README.md +2 -2
  16. package/adapters/generic/README.md +1 -1
  17. package/adapters/hermes/README.md +23 -0
  18. package/adapters/hermes/adapter.yaml +8 -0
  19. package/adapters/hermes/render.js +17 -0
  20. package/adapters/kimi-code/README.md +5 -5
  21. package/adapters/kimi-code/render.js +2 -2
  22. package/adapters/opencode/README.md +3 -3
  23. package/adapters/opencode/render.js +27 -1
  24. package/adapters/windsurf/README.md +3 -3
  25. package/docs/harnesses/antigravity.md +20 -0
  26. package/docs/harnesses/antigravity.pt-BR.md +20 -0
  27. package/docs/harnesses/claude-code.md +23 -0
  28. package/docs/harnesses/claude-code.pt-BR.md +23 -0
  29. package/docs/harnesses/codex.md +21 -0
  30. package/docs/harnesses/codex.pt-BR.md +21 -0
  31. package/docs/harnesses/continue.md +21 -0
  32. package/docs/harnesses/continue.pt-BR.md +21 -0
  33. package/docs/harnesses/cursor.md +22 -0
  34. package/docs/harnesses/cursor.pt-BR.md +22 -0
  35. package/docs/harnesses/generic.md +20 -0
  36. package/docs/harnesses/generic.pt-BR.md +20 -0
  37. package/docs/harnesses/hermes.md +26 -0
  38. package/docs/harnesses/hermes.pt-BR.md +26 -0
  39. package/docs/harnesses/kimi-code.md +19 -0
  40. package/docs/harnesses/kimi-code.pt-BR.md +19 -0
  41. package/docs/harnesses/opencode.md +31 -0
  42. package/docs/harnesses/opencode.pt-BR.md +31 -0
  43. package/docs/harnesses/windsurf.md +22 -0
  44. package/docs/harnesses/windsurf.pt-BR.md +22 -0
  45. package/package.json +1 -1
  46. package/schemas/agent.schema.json +2 -2
  47. package/schemas/workflow.schema.json +1 -1
  48. package/src/app-overlay/wize-app-release-channels/workflow.md +2 -0
  49. package/src/app-overlay/wize-app-scaffold/workflow.md +2 -0
  50. package/src/app-overlay/wize-app-store-listing/workflow.md +2 -0
  51. package/src/builder-skills/wize-create-agent/workflow.md +2 -0
  52. package/src/builder-skills/wize-create-skill/workflow.md +2 -0
  53. package/src/builder-skills/wize-create-workflow/workflow.md +2 -0
  54. package/src/core-skills/wize-advanced-elicitation/skill.md +2 -0
  55. package/src/core-skills/wize-brainstorming/skill.md +2 -0
  56. package/src/core-skills/wize-customize/skill.md +116 -0
  57. package/src/core-skills/wize-editorial-review-prose/skill.md +94 -0
  58. package/src/core-skills/wize-editorial-review-structure/skill.md +99 -0
  59. package/src/core-skills/wize-grill/skill.md +77 -0
  60. package/src/core-skills/wize-index-docs/skill.md +119 -0
  61. package/src/core-skills/wize-pre-pr-check/skill.md +134 -0
  62. package/src/core-skills/wize-review-adversarial/skill.md +3 -0
  63. package/src/core-skills/wize-review-edge-case-hunter/skill.md +115 -0
  64. package/src/core-skills/wize-shard-doc/skill.md +2 -0
  65. package/src/core-skills/wize-spec/assets/headless-schemas.md +39 -0
  66. package/src/core-skills/wize-spec/assets/spec-template.md +40 -0
  67. package/src/core-skills/wize-spec/customize.toml +20 -0
  68. package/src/core-skills/wize-spec/skill.md +112 -0
  69. package/src/method-skills/1-analysis/wize-agent-analyst/agent.yaml +3 -0
  70. package/src/method-skills/1-analysis/wize-document-project/documentation-requirements.csv +12 -0
  71. package/src/method-skills/1-analysis/wize-document-project/templates/api-contracts-template.md +38 -0
  72. package/src/method-skills/1-analysis/wize-document-project/templates/architecture-template.md +54 -0
  73. package/src/method-skills/1-analysis/wize-document-project/templates/component-inventory-template.md +40 -0
  74. package/src/method-skills/1-analysis/wize-document-project/templates/contribution-guide-template.md +34 -0
  75. package/src/method-skills/1-analysis/wize-document-project/templates/data-models-template.md +36 -0
  76. package/src/method-skills/1-analysis/wize-document-project/templates/deep-dive-template.md +312 -0
  77. package/src/method-skills/1-analysis/wize-document-project/templates/deployment-guide-template.md +42 -0
  78. package/src/method-skills/1-analysis/wize-document-project/templates/development-guide-template.md +61 -0
  79. package/src/method-skills/1-analysis/wize-document-project/templates/index-template.md +185 -0
  80. package/src/method-skills/1-analysis/wize-document-project/templates/project-overview-template.md +110 -0
  81. package/src/method-skills/1-analysis/wize-document-project/templates/project-scan-report-schema.json +159 -0
  82. package/src/method-skills/1-analysis/wize-document-project/templates/source-tree-template.md +142 -0
  83. package/src/method-skills/1-analysis/wize-document-project/workflow.md +213 -20
  84. package/src/method-skills/1-analysis/wize-domain-research/customize.toml +14 -0
  85. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-01-init.md +49 -0
  86. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-02-domain-analysis.md +39 -0
  87. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-03-competitive-landscape.md +39 -0
  88. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-04-regulatory-focus.md +39 -0
  89. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-05-technical-trends.md +39 -0
  90. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-06-research-synthesis.md +43 -0
  91. package/src/method-skills/1-analysis/wize-domain-research/research.template.md +31 -0
  92. package/src/method-skills/1-analysis/wize-domain-research/workflow.md +58 -0
  93. package/src/method-skills/1-analysis/wize-market-research/customize.toml +14 -0
  94. package/src/method-skills/1-analysis/wize-market-research/research.template.md +31 -0
  95. package/src/method-skills/1-analysis/wize-market-research/steps/step-01-init.md +57 -0
  96. package/src/method-skills/1-analysis/wize-market-research/steps/step-02-customer-behavior.md +39 -0
  97. package/src/method-skills/1-analysis/wize-market-research/steps/step-03-customer-pain-points.md +37 -0
  98. package/src/method-skills/1-analysis/wize-market-research/steps/step-04-customer-decisions.md +39 -0
  99. package/src/method-skills/1-analysis/wize-market-research/steps/step-05-competitive-analysis.md +37 -0
  100. package/src/method-skills/1-analysis/wize-market-research/steps/step-06-research-completion.md +47 -0
  101. package/src/method-skills/1-analysis/wize-market-research/workflow.md +66 -0
  102. package/src/method-skills/1-analysis/wize-prfaq/workflow.md +152 -11
  103. package/src/method-skills/1-analysis/wize-product-brief/workflow.md +92 -19
  104. package/src/method-skills/1-analysis/wize-refresh-knowledge/workflow.md +129 -0
  105. package/src/method-skills/1-analysis/wize-research/workflow.md +39 -12
  106. package/src/method-skills/1-analysis/wize-technical-research/customize.toml +14 -0
  107. package/src/method-skills/1-analysis/wize-technical-research/research.template.md +31 -0
  108. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-01-init.md +49 -0
  109. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-02-technical-overview.md +45 -0
  110. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-03-integration-patterns.md +39 -0
  111. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-04-architectural-patterns.md +39 -0
  112. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-05-implementation-research.md +42 -0
  113. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-06-research-synthesis.md +46 -0
  114. package/src/method-skills/1-analysis/wize-technical-research/workflow.md +60 -0
  115. package/src/method-skills/1-analysis/wize-trigger-map/workflow.md +82 -16
  116. package/src/method-skills/2-plan-workflows/wize-create-prd/workflow.md +135 -23
  117. package/src/method-skills/2-plan-workflows/wize-edit-prd/workflow.md +110 -0
  118. package/src/method-skills/2-plan-workflows/wize-ux-design/workflow.md +134 -28
  119. package/src/method-skills/2-plan-workflows/wize-ux-scenarios/workflow.md +93 -15
  120. package/src/method-skills/2-plan-workflows/wize-validate-prd/workflow.md +108 -12
  121. package/src/method-skills/3-solutioning/wize-check-implementation-readiness/workflow.md +103 -11
  122. package/src/method-skills/3-solutioning/wize-create-architecture/architecture-decision-template.md +41 -0
  123. package/src/method-skills/3-solutioning/wize-create-architecture/customize.toml +20 -0
  124. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-01-init.md +95 -0
  125. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-01b-continue.md +32 -0
  126. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-02-context.md +126 -0
  127. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-03-starter.md +110 -0
  128. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-04-decisions.md +129 -0
  129. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-05-patterns.md +109 -0
  130. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-06-structure.md +97 -0
  131. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-07-validation.md +124 -0
  132. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-08-complete.md +59 -0
  133. package/src/method-skills/3-solutioning/wize-create-architecture/workflow.md +55 -48
  134. package/src/method-skills/3-solutioning/wize-create-epics-and-stories/workflow.md +154 -15
  135. package/src/method-skills/3-solutioning/wize-design-system/workflow.md +184 -22
  136. package/src/method-skills/3-solutioning/wize-nfr-principles/workflow.md +145 -17
  137. package/src/method-skills/3-solutioning/wize-project-context/workflow.md +120 -0
  138. package/src/method-skills/3-solutioning/wize-tech-vision/workflow.md +130 -22
  139. package/src/method-skills/4-implementation/wize-agent-dev/persona.md +12 -0
  140. package/src/method-skills/4-implementation/wize-changelog/workflow.md +184 -0
  141. package/src/method-skills/4-implementation/wize-checkpoint-preview/workflow.md +117 -0
  142. package/src/method-skills/4-implementation/wize-code-review/customize.toml +21 -0
  143. package/src/method-skills/4-implementation/wize-code-review/steps/step-01-gather-context.md +64 -0
  144. package/src/method-skills/4-implementation/wize-code-review/steps/step-02-review.md +40 -0
  145. package/src/method-skills/4-implementation/wize-code-review/steps/step-03-triage.md +43 -0
  146. package/src/method-skills/4-implementation/wize-code-review/steps/step-04-present.md +100 -0
  147. package/src/method-skills/4-implementation/wize-code-review/workflow.md +54 -12
  148. package/src/method-skills/4-implementation/wize-correct-course/workflow.md +93 -0
  149. package/src/method-skills/4-implementation/wize-create-story/workflow.md +154 -10
  150. package/src/method-skills/4-implementation/wize-dev-story/workflow.md +185 -17
  151. package/src/method-skills/4-implementation/wize-investigate/workflow.md +123 -0
  152. package/src/method-skills/4-implementation/wize-quick-dev/workflow.md +136 -18
  153. package/src/method-skills/4-implementation/wize-release/workflow.md +162 -0
  154. package/src/method-skills/4-implementation/wize-retrospective/workflow.md +114 -10
  155. package/src/method-skills/4-implementation/wize-sprint-planning/workflow.md +78 -11
  156. package/src/method-skills/4-implementation/wize-sprint-status/workflow.md +45 -11
  157. package/src/method-skills/module.yaml +28 -0
  158. package/src/orchestrator-skills/module.yaml +7 -1
  159. package/src/orchestrator-skills/wize/skill.md +164 -0
  160. package/src/orchestrator-skills/wize-check/skill.md +98 -0
  161. package/src/orchestrator-skills/wize-help/skill.md +227 -67
  162. package/src/orchestrator-skills/wize-onboarding/workflow.md +78 -14
  163. package/src/orchestrator-skills/wize-orchestrator/agent.yaml +2 -0
  164. package/src/orchestrator-skills/wize-orchestrator/persona.md +44 -3
  165. package/src/orchestrator-skills/wize-party-mode/workflow.md +2 -0
  166. package/src/security-overlay/_shared/allowlist.js +154 -0
  167. package/src/security-overlay/_shared/backlog.js +169 -0
  168. package/src/security-overlay/_shared/cli-runner.js +87 -0
  169. package/src/security-overlay/_shared/cvss.js +108 -0
  170. package/src/security-overlay/_shared/detect.js +125 -0
  171. package/src/security-overlay/_shared/install-script.js +205 -0
  172. package/src/security-overlay/_shared/invoke-phase.js +86 -0
  173. package/src/security-overlay/_shared/owasp.js +56 -0
  174. package/src/security-overlay/_shared/partial.js +225 -0
  175. package/src/security-overlay/_shared/preflight.js +175 -0
  176. package/src/security-overlay/_shared/scope-gate.js +172 -0
  177. package/src/security-overlay/_shared/scope-parser.js +147 -0
  178. package/src/security-overlay/agents/red-teamer/agent.yaml +54 -0
  179. package/src/security-overlay/agents/red-teamer/persona.md +49 -0
  180. package/src/security-overlay/data/common.txt +115 -0
  181. package/src/security-overlay/data/owasp-top10.json +15 -0
  182. package/src/security-overlay/data/tool-allowlist.json +31 -0
  183. package/src/security-overlay/skills/wize-sec-enumerate/scripts/run-enumerate.js +180 -0
  184. package/src/security-overlay/skills/wize-sec-enumerate/skill.md +34 -0
  185. package/src/security-overlay/skills/wize-sec-exploit/data/common.txt +117 -0
  186. package/src/security-overlay/skills/wize-sec-exploit/scripts/run-ffuf.js +147 -0
  187. package/src/security-overlay/skills/wize-sec-exploit/scripts/run-nikto.js +145 -0
  188. package/src/security-overlay/skills/wize-sec-exploit/scripts/run-nuclei.js +176 -0
  189. package/src/security-overlay/skills/wize-sec-exploit/scripts/run-sqlmap.js +139 -0
  190. package/src/security-overlay/skills/wize-sec-pentest/scripts/run-pipeline.js +184 -0
  191. package/src/security-overlay/skills/wize-sec-pentest/skill.md +54 -0
  192. package/src/security-overlay/skills/wize-sec-recon/scripts/run-gitleaks.js +139 -0
  193. package/src/security-overlay/skills/wize-sec-recon/scripts/run-osv.js +227 -0
  194. package/src/security-overlay/skills/wize-sec-recon/scripts/run-recon.js +162 -0
  195. package/src/security-overlay/skills/wize-sec-recon/skill.md +37 -0
  196. package/src/security-overlay/skills/wize-sec-report/scripts/render-report.js +1033 -0
  197. package/src/security-overlay/skills/wize-sec-scope/scripts/generate-scope.js +106 -0
  198. package/src/security-overlay/skills/wize-sec-scope/skill.md +52 -0
  199. package/src/tea-skills/wize-qa-generate-e2e-tests/workflow.md +121 -0
  200. package/src/tea-skills/wize-tea-design/workflow.md +107 -13
  201. package/src/tea-skills/wize-tea-gate/workflow.md +118 -25
  202. package/src/tea-skills/wize-tea-nfr/workflow.md +107 -14
  203. package/src/tea-skills/wize-tea-review/workflow.md +123 -13
  204. package/src/tea-skills/wize-tea-risk/workflow.md +113 -10
  205. package/src/tea-skills/wize-tea-trace/workflow.md +86 -12
  206. package/src/web-overlay/wize-web-deploy/workflow.md +2 -0
  207. package/src/web-overlay/wize-web-scaffold/workflow.md +2 -0
  208. package/src/web-overlay/wize-web-seo-audit/workflow.md +2 -0
  209. package/tools/installer/baseline.js +133 -0
  210. package/tools/installer/commands/agent.js +197 -0
  211. package/tools/installer/commands/doctor.js +320 -0
  212. package/tools/installer/commands/document-project.js +93 -0
  213. package/tools/installer/commands/sync.js +45 -0
  214. package/tools/installer/commands/update.js +172 -0
  215. package/tools/installer/document-project/batch-scanner.js +93 -0
  216. package/tools/installer/document-project/classify.js +170 -0
  217. package/tools/installer/document-project/modes/deep-dive.js +196 -0
  218. package/tools/installer/document-project/modes/full-rescan.js +15 -0
  219. package/tools/installer/document-project/modes/initial-scan.js +100 -0
  220. package/tools/installer/document-project/modes/quick.js +211 -0
  221. package/tools/installer/document-project/render-index.js +101 -0
  222. package/tools/installer/document-project/state.js +110 -0
  223. package/tools/installer/onboarding.js +14 -20
  224. package/tools/installer/render-shared.js +159 -15
  225. package/tools/installer/setup-helpers.js +1 -0
  226. package/tools/installer/validators/run-all.js +3 -2
  227. package/tools/installer/version-check.js +117 -0
  228. package/tools/installer/wize-cli.js +500 -70
@@ -0,0 +1,93 @@
1
+ // `wize-dev-kit document-project` — CLI command entry point.
2
+ //
3
+ // Parses mode + flags and delegates to the appropriate scan implementation.
4
+ // Non-quick modes are stubs here; later stories fill them in.
5
+
6
+ 'use strict';
7
+
8
+ const fs = require('node:fs');
9
+ const path = require('node:path');
10
+ const { runQuick } = require('../document-project/modes/quick.js');
11
+ const { runInitialScan } = require('../document-project/modes/initial-scan.js');
12
+ const { runFullRescan } = require('../document-project/modes/full-rescan.js');
13
+ const { runDeepDive } = require('../document-project/modes/deep-dive.js');
14
+ const { loadState, archiveOldState } = require('../document-project/state.js');
15
+
16
+ const VALID_MODES = new Set(['quick', 'initial_scan', 'full_rescan', 'deep_dive']);
17
+ const VALID_SCAN_LEVELS = new Set(['quick', 'deep', 'exhaustive']);
18
+
19
+ function parseMode(args) {
20
+ let mode = 'quick';
21
+ let resume = false;
22
+ let scanLevel = 'quick';
23
+ let target = null;
24
+
25
+ for (let i = 0; i < args.length; i++) {
26
+ const arg = args[i];
27
+ if (arg === '--resume') {
28
+ resume = true;
29
+ continue;
30
+ }
31
+ if (arg === '--target') {
32
+ target = args[i + 1];
33
+ i++;
34
+ continue;
35
+ }
36
+ if (arg.startsWith('--')) {
37
+ return { mode: null, error: `unknown option: ${arg}` };
38
+ }
39
+ if (VALID_SCAN_LEVELS.has(arg)) {
40
+ scanLevel = arg;
41
+ continue;
42
+ }
43
+ if (mode === 'quick' && VALID_MODES.has(arg)) {
44
+ mode = arg;
45
+ } else if (mode === 'quick') {
46
+ return { mode: null, error: `unknown mode: ${arg}. Valid modes: ${[...VALID_MODES].join(', ')}` };
47
+ } else {
48
+ return { mode: null, error: `unexpected extra argument: ${arg}` };
49
+ }
50
+ }
51
+
52
+ if (!VALID_MODES.has(mode)) {
53
+ return { mode: null, error: `unknown mode: ${mode}. Valid modes: ${[...VALID_MODES].join(', ')}` };
54
+ }
55
+
56
+ return { mode, resume, scanLevel, target };
57
+ }
58
+
59
+ function cmdDocumentProject({ kitRoot, projectRoot, args = [], opts = {} }) {
60
+ const log = opts.log || console.log;
61
+ const parsed = parseMode(args);
62
+
63
+ if (parsed.mode === null) {
64
+ log(parsed.error);
65
+ return { ok: false, error: parsed.error, exitCode: 1 };
66
+ }
67
+
68
+ if (parsed.mode === 'quick') {
69
+ const r = runQuick(projectRoot, { log });
70
+ return { ok: true, mode: 'quick', ...r };
71
+ }
72
+
73
+ if (parsed.mode === 'initial_scan') {
74
+ const r = runInitialScan(projectRoot, { scanLevel: parsed.scanLevel, log });
75
+ return { ok: true, mode: 'initial_scan', ...r };
76
+ }
77
+
78
+ if (parsed.mode === 'full_rescan') {
79
+ const r = runFullRescan(projectRoot, { scanLevel: parsed.scanLevel, log });
80
+ return { ok: true, mode: 'full_rescan', ...r };
81
+ }
82
+
83
+ if (parsed.mode === 'deep_dive') {
84
+ const r = runDeepDive(projectRoot, { target: parsed.target, log });
85
+ return r;
86
+ }
87
+
88
+ log(`document-project ${parsed.mode} not implemented`);
89
+ return { ok: false, error: 'not implemented', exitCode: 1 };
90
+ }
91
+
92
+ module.exports = { cmdDocumentProject, parseMode };
93
+
@@ -0,0 +1,45 @@
1
+ // `wize-dev-kit sync` — regenerate adapter outputs for the IDE targets the
2
+ // project opted into. Useful after editing .wize/config/project.toml,
3
+ // running `agent create`, or pulling kit changes that don't bump version.
4
+
5
+ 'use strict';
6
+
7
+ const fs = require('node:fs');
8
+ const path = require('node:path');
9
+ const { loadProjectConfig } = require('./update.js');
10
+
11
+ function cmdSync({ kitRoot, projectRoot, opts = {} } = {}) {
12
+ const log = opts.log || console.log;
13
+ const cfg = loadProjectConfig(projectRoot);
14
+ if (!cfg.project) {
15
+ log('No .wize/config/project.toml found here. Run `wize-dev-kit install` first.');
16
+ return { changed: false };
17
+ }
18
+ const ideTargets = (cfg.install && cfg.install.ide_targets) || ['claude-code', 'generic'];
19
+ const profiles = (cfg.install && cfg.install.profiles) || ['core'];
20
+ log(`Syncing ${ideTargets.length} adapter(s) for profile(s) ${profiles.join(' + ')}:`);
21
+
22
+ const results = [];
23
+ for (const code of ideTargets) {
24
+ const renderPath = path.join(kitRoot, 'adapters', code, 'render.js');
25
+ if (!fs.existsSync(renderPath)) {
26
+ log(` - ${code}: skipped (adapter missing in installed kit)`);
27
+ results.push({ code, skipped: true });
28
+ continue;
29
+ }
30
+ delete require.cache[require.resolve(renderPath)];
31
+ try {
32
+ const out = require(renderPath).render(kitRoot, projectRoot, { profiles });
33
+ const n = out && Array.isArray(out.written) ? out.written.length : 0;
34
+ log(` ✓ ${code}: ${n} file(s) emitted`);
35
+ results.push({ code, written: n });
36
+ } catch (err) {
37
+ log(` ✖ ${code}: ${err.message}`);
38
+ results.push({ code, error: err.message });
39
+ }
40
+ }
41
+ log('\nDone. Restart your IDE if it caches skills at startup.');
42
+ return { changed: true, adapters: results };
43
+ }
44
+
45
+ module.exports = { cmdSync };
@@ -0,0 +1,172 @@
1
+ // `wize-dev-kit update` — refresh an installed kit to the version currently
2
+ // resolved by `node_modules/wize-dev-kit`. Preserves .wize/config/user.toml,
3
+ // re-runs the active IDE adapters, and re-applies the .gitignore block when
4
+ // it was opted-in originally.
5
+
6
+ 'use strict';
7
+
8
+ const fs = require('node:fs');
9
+ const path = require('node:path');
10
+ const { applyGitignore } = require('../setup-helpers.js');
11
+
12
+ // Minimal TOML reader for the subset we write — handles `[section]` headers,
13
+ // `key = "value"` scalars, and `key = ["a", "b"]` string arrays.
14
+ function readToml(file) {
15
+ if (!fs.existsSync(file)) return {};
16
+ const content = fs.readFileSync(file, 'utf-8');
17
+ const out = {};
18
+ let section = null;
19
+ for (const raw of content.split('\n')) {
20
+ const line = raw.replace(/#.*$/, '').trim();
21
+ if (!line) continue;
22
+ const head = line.match(/^\[([^\]]+)\]$/);
23
+ if (head) { section = head[1]; out[section] = out[section] || {}; continue; }
24
+ const kv = line.match(/^([a-zA-Z_][\w-]*)\s*=\s*(.+)$/);
25
+ if (!kv) continue;
26
+ const [, key, valRaw] = kv;
27
+ const v = parseTomlValue(valRaw.trim());
28
+ if (section) out[section][key] = v;
29
+ else out[key] = v;
30
+ }
31
+ return out;
32
+ }
33
+
34
+ function parseTomlValue(raw) {
35
+ if (raw.startsWith('"') && raw.endsWith('"')) return raw.slice(1, -1);
36
+ if (raw.startsWith("'") && raw.endsWith("'")) return raw.slice(1, -1);
37
+ if (raw.startsWith('[') && raw.endsWith(']')) {
38
+ return raw.slice(1, -1).split(',').map(s => s.trim().replace(/^["']|["']$/g, '')).filter(Boolean);
39
+ }
40
+ if (raw === 'true') return true;
41
+ if (raw === 'false') return false;
42
+ if (!isNaN(Number(raw))) return Number(raw);
43
+ return raw;
44
+ }
45
+
46
+ function loadProjectConfig(projectRoot) {
47
+ return readToml(path.join(projectRoot, '.wize/config/project.toml'));
48
+ }
49
+
50
+ function loadInstalledKitVersion(kitRoot) {
51
+ try { return require(path.join(kitRoot, 'package.json')).version; }
52
+ catch { return null; }
53
+ }
54
+
55
+ // Returns a list of CHANGELOG entries (markdown blocks) for versions strictly
56
+ // between `from` and `to`. Best-effort — if CHANGELOG layout is unusual,
57
+ // returns an empty list and falls back to a generic note.
58
+ function changelogBetween(kitRoot, fromVersion, toVersion) {
59
+ const file = path.join(kitRoot, 'CHANGELOG.md');
60
+ if (!fs.existsSync(file)) return [];
61
+ const content = fs.readFileSync(file, 'utf-8');
62
+ const versionRe = /^## \[(\d+\.\d+\.\d+)\][^\n]*\n/gm;
63
+ const matches = [];
64
+ let m;
65
+ while ((m = versionRe.exec(content)) !== null) {
66
+ matches.push({ v: m[1], start: m.index, headerEnd: versionRe.lastIndex });
67
+ }
68
+ for (let i = 0; i < matches.length; i++) {
69
+ matches[i].end = i + 1 < matches.length ? matches[i + 1].start : content.length;
70
+ }
71
+ return matches
72
+ .filter(x => compare(x.v, fromVersion) > 0 && compare(x.v, toVersion) <= 0)
73
+ .map(x => content.slice(x.start, x.end).trim());
74
+ }
75
+
76
+ function compare(a, b) {
77
+ const pa = a.split('.').map(Number);
78
+ const pb = b.split('.').map(Number);
79
+ for (let i = 0; i < 3; i++) {
80
+ if ((pa[i] || 0) !== (pb[i] || 0)) return (pa[i] || 0) - (pb[i] || 0);
81
+ }
82
+ return 0;
83
+ }
84
+
85
+ // Re-runs every adapter that the project opted into at install time, using
86
+ // the current versions of the kit's renderers.
87
+ function rerunAdapters({ kitRoot, projectRoot, ideTargets, profiles, log }) {
88
+ const results = [];
89
+ for (const code of ideTargets) {
90
+ const renderPath = path.join(kitRoot, 'adapters', code, 'render.js');
91
+ if (!fs.existsSync(renderPath)) {
92
+ results.push({ code, skipped: true, reason: 'adapter missing in this kit version' });
93
+ log(` - ${code}: skipped (adapter no longer exists)`);
94
+ continue;
95
+ }
96
+ delete require.cache[require.resolve(renderPath)]; // make `update` idempotent in the same process
97
+ try {
98
+ const mod = require(renderPath);
99
+ const out = mod.render(kitRoot, projectRoot, { profiles });
100
+ const n = out && Array.isArray(out.written) ? out.written.length : 0;
101
+ results.push({ code, written: n });
102
+ log(` ✓ ${code}: ${n} file(s) refreshed`);
103
+ } catch (err) {
104
+ results.push({ code, error: err.message });
105
+ log(` ✖ ${code}: ${err.message}`);
106
+ }
107
+ }
108
+ return results;
109
+ }
110
+
111
+ function writeUpdatedProjectToml(projectRoot, currentToml, newKitVersion) {
112
+ // Surgical rewrite — only updates `kit_version = ...` under `[project]`.
113
+ // Leaves everything else as the user/team configured it.
114
+ const file = path.join(projectRoot, '.wize/config/project.toml');
115
+ if (!fs.existsSync(file)) return false;
116
+ const content = fs.readFileSync(file, 'utf-8');
117
+ const updated = content.replace(/^kit_version\s*=\s*".*"$/m, `kit_version = "${newKitVersion}"`);
118
+ if (updated === content) return false;
119
+ fs.writeFileSync(file, updated, 'utf-8');
120
+ return true;
121
+ }
122
+
123
+ async function cmdUpdate({ kitRoot, projectRoot, opts = {} } = {}) {
124
+ const log = opts.log || console.log;
125
+ const cfg = loadProjectConfig(projectRoot);
126
+ if (!cfg.project) {
127
+ log('No .wize/config/project.toml found here.');
128
+ log('Run `wize-dev-kit install` first.');
129
+ return { changed: false };
130
+ }
131
+ const fromVersion = cfg.project.kit_version || '0.0.0';
132
+ const toVersion = loadInstalledKitVersion(kitRoot) || 'unknown';
133
+ if (toVersion === 'unknown') {
134
+ log('Could not read kit version from node_modules. Aborting.');
135
+ return { changed: false };
136
+ }
137
+
138
+ log(`Wize Dev Kit update: ${fromVersion} → ${toVersion}`);
139
+ if (fromVersion === toVersion) {
140
+ log('Already on the same version. Re-rendering adapters anyway (idempotent).');
141
+ }
142
+
143
+ const ideTargets = (cfg.install && cfg.install.ide_targets) || ['claude-code', 'generic'];
144
+ const profiles = (cfg.install && cfg.install.profiles) || ['core'];
145
+
146
+ log('\nRe-rendering active IDE adapters:');
147
+ const adapterResults = rerunAdapters({ kitRoot, projectRoot, ideTargets, profiles, log });
148
+
149
+ if (opts.refreshGitignore !== false) {
150
+ const r = applyGitignore(projectRoot);
151
+ if (r.changed) log(`\n✓ .gitignore ${r.mode}`);
152
+ else log('\n= .gitignore already up to date');
153
+ }
154
+
155
+ writeUpdatedProjectToml(projectRoot, cfg, toVersion);
156
+ log(`\n✓ project.toml kit_version → ${toVersion}`);
157
+
158
+ const entries = changelogBetween(kitRoot, fromVersion, toVersion);
159
+ if (entries.length) {
160
+ log(`\nWhat changed (excerpt from CHANGELOG):`);
161
+ for (const e of entries) {
162
+ log(e.split('\n').slice(0, 4).map(l => ' ' + l).join('\n'));
163
+ log(' …');
164
+ }
165
+ log(`\nFull details: ${path.join(kitRoot, 'CHANGELOG.md')}`);
166
+ }
167
+
168
+ log('\nDone. Restart your IDE so the refreshed slash commands are picked up.');
169
+ return { changed: true, from: fromVersion, to: toVersion, adapters: adapterResults };
170
+ }
171
+
172
+ module.exports = { cmdUpdate, loadProjectConfig, loadInstalledKitVersion, changelogBetween };
@@ -0,0 +1,93 @@
1
+ // Batch scanner for `wize-dev-kit document-project`.
2
+ //
3
+ // Walks a repo in subfolder-sized batches, skipping noise directories.
4
+ // Returns summaries without loading entire trees into memory.
5
+
6
+ 'use strict';
7
+
8
+ const fs = require('node:fs');
9
+ const path = require('node:path');
10
+
11
+ const DEFAULT_IGNORE = new Set([
12
+ 'node_modules',
13
+ '.git',
14
+ 'dist',
15
+ 'build',
16
+ 'coverage',
17
+ '.cache',
18
+ '.tmp',
19
+ '.wize',
20
+ '.claude',
21
+ '.cursor',
22
+ '.kimi',
23
+ '.opencode',
24
+ '.windsurf',
25
+ '.continue',
26
+ '.codex',
27
+ '.antigravity'
28
+ ]);
29
+
30
+ const MAX_FILE_LOC = 5000;
31
+
32
+ function shouldIgnore(name, customIgnore = []) {
33
+ if (DEFAULT_IGNORE.has(name)) return true;
34
+ for (const pattern of customIgnore) {
35
+ if (name === pattern || (pattern.startsWith('*') && name.endsWith(pattern.slice(1)))) return true;
36
+ }
37
+ return false;
38
+ }
39
+
40
+ function listSubfolders(rootDir, options = {}) {
41
+ const out = [];
42
+ let entries;
43
+ try { entries = fs.readdirSync(rootDir, { withFileTypes: true }); } catch { return out; }
44
+ for (const e of entries) {
45
+ if (!e.isDirectory()) continue;
46
+ if (shouldIgnore(e.name, options.ignore)) continue;
47
+ out.push(path.join(rootDir, e.name));
48
+ }
49
+ return out;
50
+ }
51
+
52
+ function scanFolder(folderPath, options = {}) {
53
+ const files = [];
54
+ let totalLoc = 0;
55
+ const stack = [folderPath];
56
+ while (stack.length) {
57
+ const dir = stack.pop();
58
+ let entries;
59
+ try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { continue; }
60
+ for (const e of entries) {
61
+ const full = path.join(dir, e.name);
62
+ if (e.isDirectory()) {
63
+ if (!shouldIgnore(e.name, options.ignore)) stack.push(full);
64
+ continue;
65
+ }
66
+ if (!e.isFile()) continue;
67
+ if (/\.(min\.js|map)$/.test(e.name)) continue;
68
+ const stat = fs.statSync(full);
69
+ const loc = stat.size; // proxy; exact line count is optional
70
+ const info = {
71
+ path: full,
72
+ relative: path.relative(folderPath, full),
73
+ size: stat.size,
74
+ loc: loc > MAX_FILE_LOC ? MAX_FILE_LOC : loc,
75
+ skipped: loc > MAX_FILE_LOC
76
+ };
77
+ files.push(info);
78
+ totalLoc += info.loc;
79
+ }
80
+ }
81
+ return { folder: folderPath, files, totalLoc, fileCount: files.length };
82
+ }
83
+
84
+ function batchScanner(rootDir, options = {}) {
85
+ const folders = options.folders || listSubfolders(rootDir, options);
86
+ const results = [];
87
+ for (const folder of folders) {
88
+ results.push(scanFolder(folder, options));
89
+ }
90
+ return results;
91
+ }
92
+
93
+ module.exports = { batchScanner, listSubfolders, scanFolder, shouldIgnore, MAX_FILE_LOC };
@@ -0,0 +1,170 @@
1
+ // Project-type classifier for `wize-dev-kit document-project`.
2
+ //
3
+ // Detects the project type(s) of a repo from file patterns, then decides
4
+ // whether the repo is a monolith, multi-part, or monorepo.
5
+ // No source files are read — this is pattern-only detection.
6
+
7
+ 'use strict';
8
+
9
+ const fs = require('node:fs');
10
+ const path = require('node:path');
11
+
12
+ const MULTI_PART_FOLDERS = ['client', 'server', 'api', 'web', 'app', 'frontend', 'backend', 'mobile', 'desktop'];
13
+
14
+ function toBool(v) {
15
+ return String(v).toLowerCase() === 'true';
16
+ }
17
+
18
+ function splitPatterns(str) {
19
+ if (!str || str === 'N/A') return [];
20
+ return str.split(';').map(s => s.trim()).filter(Boolean);
21
+ }
22
+
23
+ function loadRequirements(csvPath) {
24
+ const content = fs.readFileSync(csvPath, 'utf-8');
25
+ const lines = content.split(/\r?\n/).filter(l => l.trim());
26
+ const header = lines[0].split(',').map(h => h.trim());
27
+ const rows = [];
28
+ for (let i = 1; i < lines.length; i++) {
29
+ const values = lines[i].split(',').map(v => v.trim());
30
+ const row = {};
31
+ for (let j = 0; j < header.length; j++) {
32
+ const key = header[j];
33
+ const raw = values[j];
34
+ if (key.startsWith('requires_')) {
35
+ row[key] = toBool(raw);
36
+ } else {
37
+ row[key] = raw || '';
38
+ }
39
+ }
40
+ rows.push(row);
41
+ }
42
+ return rows;
43
+ }
44
+
45
+ function globMatch(rootDir, pattern) {
46
+ // Very small pattern matcher: supports * wildcard and trailing / for dirs.
47
+ const isDirPattern = pattern.endsWith('/');
48
+ const base = isDirPattern ? pattern.slice(0, -1) : pattern;
49
+ const parts = base.split('/');
50
+ return walkMatch(rootDir, parts, 0, isDirPattern);
51
+ }
52
+
53
+ function walkMatch(dir, parts, depth, isDirPattern) {
54
+ if (depth >= parts.length) return true;
55
+ let entries;
56
+ try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return false; }
57
+ const part = parts[depth];
58
+ const isLast = depth === parts.length - 1;
59
+ const regex = globToRegex(part);
60
+ for (const e of entries) {
61
+ if (!regex.test(e.name)) continue;
62
+ if (isLast) {
63
+ if (isDirPattern && e.isDirectory()) return true;
64
+ if (!isDirPattern && e.isFile()) return true;
65
+ if (!isDirPattern && e.isDirectory()) {
66
+ // pattern like vite.config.* can match a directory named vite.config.ts? no.
67
+ // But pattern may be a prefix; treat directory match as false for files.
68
+ return false;
69
+ }
70
+ } else if (e.isDirectory()) {
71
+ if (walkMatch(path.join(dir, e.name), parts, depth + 1, isDirPattern)) return true;
72
+ }
73
+ }
74
+ return false;
75
+ }
76
+
77
+ function globToRegex(pattern) {
78
+ const escaped = pattern
79
+ .replace(/\./g, '\\.')
80
+ .replace(/\*/g, '.*')
81
+ .replace(/\?/g, '.');
82
+ return new RegExp(`^${escaped}$`);
83
+ }
84
+
85
+ function scorePart(rootDir, row, { prefer = [] } = {}) {
86
+ let score = 0;
87
+ const keyPatterns = splitPatterns(row.key_file_patterns);
88
+ const dirPatterns = splitPatterns(row.critical_directories);
89
+ for (const p of keyPatterns) {
90
+ if (globMatch(rootDir, p)) score += 2;
91
+ }
92
+ for (const p of dirPatterns) {
93
+ if (globMatch(rootDir, p)) score += 1;
94
+ }
95
+ if (prefer.includes(row.project_type_id)) score += 0.5;
96
+ return score;
97
+ }
98
+
99
+ function detectParts(rootDir) {
100
+ const parts = [];
101
+ const candidates = [];
102
+ let entries;
103
+ try { entries = fs.readdirSync(rootDir, { withFileTypes: true }); } catch { return parts; }
104
+
105
+ for (const e of entries) {
106
+ if (!e.isDirectory()) continue;
107
+ if (!MULTI_PART_FOLDERS.includes(e.name.toLowerCase())) continue;
108
+ candidates.push(e.name);
109
+ }
110
+
111
+ if (candidates.length < 2) return parts;
112
+
113
+ const rows = loadRequirements(requirementsPath());
114
+ for (const partId of candidates) {
115
+ const partRoot = path.join(rootDir, partId);
116
+ const prefer = partId.toLowerCase() === 'server' || partId.toLowerCase() === 'backend' ? ['backend'] : [];
117
+ const scored = rows.map(r => ({ ...r, score: scorePart(partRoot, r, { prefer }) }));
118
+ scored.sort((a, b) => b.score - a.score);
119
+ const best = scored[0];
120
+ if (best && best.score > 0) {
121
+ parts.push({ part_id: partId, project_type_id: best.project_type_id, root_path: partRoot });
122
+ }
123
+ }
124
+ return parts;
125
+ }
126
+
127
+ function isMultiPart(rootDir) {
128
+ return detectParts(rootDir).length >= 2;
129
+ }
130
+
131
+ function classifyProject(rootDir, options = {}) {
132
+ const csvPath = options.csvPath || requirementsPath();
133
+ const rows = loadRequirements(csvPath);
134
+ const parts = detectParts(rootDir);
135
+
136
+ if (parts.length >= 2) {
137
+ return { projectTypes: [...new Set(parts.map(p => p.project_type_id))], parts };
138
+ }
139
+
140
+ const scored = rows.map(r => ({ ...r, score: scorePart(rootDir, r, { prefer: options.prefer || [] }) }));
141
+ scored.sort((a, b) => b.score - a.score);
142
+ const best = scored[0];
143
+ const tied = scored.filter(s => s.score === best.score).map(s => s.project_type_id);
144
+
145
+ if (!best || best.score === 0) {
146
+ return { projectTypes: [], parts: [] };
147
+ }
148
+
149
+ // Cli + library often appear together; prefer both when tied at the top.
150
+ const projectTypes = tied.includes('cli') && tied.includes('library')
151
+ ? ['cli', 'library']
152
+ : [best.project_type_id];
153
+
154
+ return {
155
+ projectTypes,
156
+ parts: [{ part_id: 'root', project_type_id: best.project_type_id, root_path: rootDir }]
157
+ };
158
+ }
159
+
160
+ function requirementsPath() {
161
+ // When running from the installed package, the CSV is next to this file under
162
+ // node_modules/wize-dev-kit/... When running from the source repo, resolve from
163
+ // the repo root via the known relative path.
164
+ const installed = path.resolve(__dirname, '..', '..', '..', 'src', 'method-skills', '1-analysis', 'wize-document-project', 'documentation-requirements.csv');
165
+ if (fs.existsSync(installed)) return installed;
166
+ // Fallback for source repo layout.
167
+ return path.resolve(__dirname, '..', '..', '..', '..', 'src', 'method-skills', '1-analysis', 'wize-document-project', 'documentation-requirements.csv');
168
+ }
169
+
170
+ module.exports = { classifyProject, loadRequirements, isMultiPart, scorePart, requirementsPath, globMatch };