wize-dev-kit 0.14.0 → 0.16.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 (226) hide show
  1. package/ARCH.md +24 -77
  2. package/CHANGELOG.md +24 -0
  3. package/DECISIONS.md +1 -27
  4. package/README.md +7 -2
  5. package/ROSTER.md +3 -11
  6. package/adapters/README.md +7 -7
  7. package/adapters/antigravity/README.md +5 -5
  8. package/adapters/claude-code/README.md +1 -1
  9. package/adapters/codex/README.md +5 -5
  10. package/adapters/codex/adapter.yaml +1 -1
  11. package/adapters/codex/render.js +1 -1
  12. package/adapters/continue/README.md +5 -5
  13. package/adapters/cursor/README.md +2 -2
  14. package/adapters/generic/README.md +1 -1
  15. package/adapters/kimi-code/README.md +5 -5
  16. package/adapters/kimi-code/render.js +2 -2
  17. package/adapters/opencode/README.md +3 -3
  18. package/adapters/opencode/render.js +1 -27
  19. package/adapters/windsurf/README.md +3 -3
  20. package/package.json +1 -1
  21. package/schemas/agent.schema.json +2 -2
  22. package/schemas/workflow.schema.json +1 -1
  23. package/src/app-overlay/wize-app-release-channels/workflow.md +0 -2
  24. package/src/app-overlay/wize-app-scaffold/workflow.md +0 -2
  25. package/src/app-overlay/wize-app-store-listing/workflow.md +0 -2
  26. package/src/builder-skills/wize-create-agent/workflow.md +0 -2
  27. package/src/builder-skills/wize-create-skill/workflow.md +0 -2
  28. package/src/builder-skills/wize-create-workflow/workflow.md +0 -2
  29. package/src/core-skills/module.yaml +3 -0
  30. package/src/core-skills/wize-advanced-elicitation/skill.md +0 -2
  31. package/src/core-skills/wize-brainstorming/skill.md +0 -2
  32. package/src/core-skills/wize-eli5/skill.md +72 -0
  33. package/src/core-skills/wize-review-adversarial/skill.md +0 -3
  34. package/src/core-skills/wize-shard-doc/skill.md +0 -2
  35. package/src/method-skills/1-analysis/wize-agent-analyst/agent.yaml +0 -3
  36. package/src/method-skills/1-analysis/wize-document-project/workflow.md +20 -213
  37. package/src/method-skills/1-analysis/wize-prfaq/workflow.md +11 -152
  38. package/src/method-skills/1-analysis/wize-product-brief/workflow.md +19 -92
  39. package/src/method-skills/1-analysis/wize-research/workflow.md +12 -39
  40. package/src/method-skills/1-analysis/wize-trigger-map/workflow.md +16 -82
  41. package/src/method-skills/2-plan-workflows/wize-create-prd/workflow.md +23 -135
  42. package/src/method-skills/2-plan-workflows/wize-ux-design/workflow.md +28 -134
  43. package/src/method-skills/2-plan-workflows/wize-ux-scenarios/workflow.md +15 -93
  44. package/src/method-skills/2-plan-workflows/wize-validate-prd/workflow.md +12 -108
  45. package/src/method-skills/3-solutioning/wize-check-implementation-readiness/workflow.md +11 -103
  46. package/src/method-skills/3-solutioning/wize-create-architecture/workflow.md +48 -55
  47. package/src/method-skills/3-solutioning/wize-create-epics-and-stories/workflow.md +15 -154
  48. package/src/method-skills/3-solutioning/wize-design-system/workflow.md +22 -184
  49. package/src/method-skills/3-solutioning/wize-nfr-principles/workflow.md +17 -145
  50. package/src/method-skills/3-solutioning/wize-tech-vision/workflow.md +22 -130
  51. package/src/method-skills/4-implementation/wize-agent-dev/persona.md +0 -12
  52. package/src/method-skills/4-implementation/wize-code-review/workflow.md +12 -54
  53. package/src/method-skills/4-implementation/wize-create-story/workflow.md +10 -154
  54. package/src/method-skills/4-implementation/wize-dev-story/workflow.md +17 -185
  55. package/src/method-skills/4-implementation/wize-quick-dev/workflow.md +18 -136
  56. package/src/method-skills/4-implementation/wize-retrospective/workflow.md +10 -114
  57. package/src/method-skills/4-implementation/wize-sprint-planning/workflow.md +11 -78
  58. package/src/method-skills/4-implementation/wize-sprint-status/workflow.md +11 -45
  59. package/src/method-skills/module.yaml +0 -28
  60. package/src/orchestrator-skills/module.yaml +1 -7
  61. package/src/orchestrator-skills/wize-help/skill.md +67 -227
  62. package/src/orchestrator-skills/wize-onboarding/workflow.md +14 -78
  63. package/src/orchestrator-skills/wize-orchestrator/agent.yaml +0 -2
  64. package/src/orchestrator-skills/wize-orchestrator/persona.md +3 -44
  65. package/src/orchestrator-skills/wize-party-mode/workflow.md +0 -2
  66. package/src/tea-skills/wize-tea-design/workflow.md +13 -107
  67. package/src/tea-skills/wize-tea-gate/workflow.md +25 -118
  68. package/src/tea-skills/wize-tea-nfr/workflow.md +14 -107
  69. package/src/tea-skills/wize-tea-review/workflow.md +13 -123
  70. package/src/tea-skills/wize-tea-risk/workflow.md +10 -113
  71. package/src/tea-skills/wize-tea-trace/workflow.md +12 -86
  72. package/src/web-overlay/wize-web-deploy/workflow.md +0 -2
  73. package/src/web-overlay/wize-web-scaffold/workflow.md +0 -2
  74. package/src/web-overlay/wize-web-seo-audit/workflow.md +0 -2
  75. package/tools/check-eli5-all-adapters.js +50 -0
  76. package/tools/installer/onboarding.js +20 -14
  77. package/tools/installer/render-shared.js +14 -158
  78. package/tools/installer/validators/run-all.js +2 -3
  79. package/tools/installer/wize-cli.js +70 -499
  80. package/AGENTS.md +0 -37
  81. package/README.es.md +0 -294
  82. package/README.pt-BR.md +0 -292
  83. package/docs/harnesses/antigravity.md +0 -20
  84. package/docs/harnesses/antigravity.pt-BR.md +0 -20
  85. package/docs/harnesses/claude-code.md +0 -23
  86. package/docs/harnesses/claude-code.pt-BR.md +0 -23
  87. package/docs/harnesses/codex.md +0 -21
  88. package/docs/harnesses/codex.pt-BR.md +0 -21
  89. package/docs/harnesses/continue.md +0 -21
  90. package/docs/harnesses/continue.pt-BR.md +0 -21
  91. package/docs/harnesses/cursor.md +0 -22
  92. package/docs/harnesses/cursor.pt-BR.md +0 -22
  93. package/docs/harnesses/generic.md +0 -20
  94. package/docs/harnesses/generic.pt-BR.md +0 -20
  95. package/docs/harnesses/kimi-code.md +0 -19
  96. package/docs/harnesses/kimi-code.pt-BR.md +0 -19
  97. package/docs/harnesses/opencode.md +0 -31
  98. package/docs/harnesses/opencode.pt-BR.md +0 -31
  99. package/docs/harnesses/windsurf.md +0 -22
  100. package/docs/harnesses/windsurf.pt-BR.md +0 -22
  101. package/src/core-skills/wize-customize/skill.md +0 -116
  102. package/src/core-skills/wize-editorial-review-prose/skill.md +0 -94
  103. package/src/core-skills/wize-editorial-review-structure/skill.md +0 -99
  104. package/src/core-skills/wize-grill/skill.md +0 -77
  105. package/src/core-skills/wize-index-docs/skill.md +0 -119
  106. package/src/core-skills/wize-pre-pr-check/skill.md +0 -134
  107. package/src/core-skills/wize-review-edge-case-hunter/skill.md +0 -115
  108. package/src/core-skills/wize-spec/assets/headless-schemas.md +0 -39
  109. package/src/core-skills/wize-spec/assets/spec-template.md +0 -40
  110. package/src/core-skills/wize-spec/customize.toml +0 -20
  111. package/src/core-skills/wize-spec/skill.md +0 -112
  112. package/src/method-skills/1-analysis/wize-document-project/documentation-requirements.csv +0 -12
  113. package/src/method-skills/1-analysis/wize-document-project/templates/api-contracts-template.md +0 -38
  114. package/src/method-skills/1-analysis/wize-document-project/templates/architecture-template.md +0 -54
  115. package/src/method-skills/1-analysis/wize-document-project/templates/component-inventory-template.md +0 -40
  116. package/src/method-skills/1-analysis/wize-document-project/templates/contribution-guide-template.md +0 -34
  117. package/src/method-skills/1-analysis/wize-document-project/templates/data-models-template.md +0 -36
  118. package/src/method-skills/1-analysis/wize-document-project/templates/deep-dive-template.md +0 -312
  119. package/src/method-skills/1-analysis/wize-document-project/templates/deployment-guide-template.md +0 -42
  120. package/src/method-skills/1-analysis/wize-document-project/templates/development-guide-template.md +0 -61
  121. package/src/method-skills/1-analysis/wize-document-project/templates/index-template.md +0 -185
  122. package/src/method-skills/1-analysis/wize-document-project/templates/project-overview-template.md +0 -110
  123. package/src/method-skills/1-analysis/wize-document-project/templates/project-scan-report-schema.json +0 -159
  124. package/src/method-skills/1-analysis/wize-document-project/templates/source-tree-template.md +0 -142
  125. package/src/method-skills/1-analysis/wize-domain-research/customize.toml +0 -14
  126. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-01-init.md +0 -49
  127. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-02-domain-analysis.md +0 -39
  128. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-03-competitive-landscape.md +0 -39
  129. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-04-regulatory-focus.md +0 -39
  130. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-05-technical-trends.md +0 -39
  131. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-06-research-synthesis.md +0 -43
  132. package/src/method-skills/1-analysis/wize-domain-research/research.template.md +0 -31
  133. package/src/method-skills/1-analysis/wize-domain-research/workflow.md +0 -58
  134. package/src/method-skills/1-analysis/wize-market-research/customize.toml +0 -14
  135. package/src/method-skills/1-analysis/wize-market-research/research.template.md +0 -31
  136. package/src/method-skills/1-analysis/wize-market-research/steps/step-01-init.md +0 -57
  137. package/src/method-skills/1-analysis/wize-market-research/steps/step-02-customer-behavior.md +0 -39
  138. package/src/method-skills/1-analysis/wize-market-research/steps/step-03-customer-pain-points.md +0 -37
  139. package/src/method-skills/1-analysis/wize-market-research/steps/step-04-customer-decisions.md +0 -39
  140. package/src/method-skills/1-analysis/wize-market-research/steps/step-05-competitive-analysis.md +0 -37
  141. package/src/method-skills/1-analysis/wize-market-research/steps/step-06-research-completion.md +0 -47
  142. package/src/method-skills/1-analysis/wize-market-research/workflow.md +0 -66
  143. package/src/method-skills/1-analysis/wize-refresh-knowledge/workflow.md +0 -129
  144. package/src/method-skills/1-analysis/wize-technical-research/customize.toml +0 -14
  145. package/src/method-skills/1-analysis/wize-technical-research/research.template.md +0 -31
  146. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-01-init.md +0 -49
  147. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-02-technical-overview.md +0 -45
  148. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-03-integration-patterns.md +0 -39
  149. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-04-architectural-patterns.md +0 -39
  150. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-05-implementation-research.md +0 -42
  151. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-06-research-synthesis.md +0 -46
  152. package/src/method-skills/1-analysis/wize-technical-research/workflow.md +0 -60
  153. package/src/method-skills/2-plan-workflows/wize-edit-prd/workflow.md +0 -110
  154. package/src/method-skills/3-solutioning/wize-create-architecture/architecture-decision-template.md +0 -41
  155. package/src/method-skills/3-solutioning/wize-create-architecture/customize.toml +0 -20
  156. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-01-init.md +0 -95
  157. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-01b-continue.md +0 -32
  158. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-02-context.md +0 -126
  159. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-03-starter.md +0 -110
  160. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-04-decisions.md +0 -129
  161. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-05-patterns.md +0 -109
  162. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-06-structure.md +0 -97
  163. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-07-validation.md +0 -124
  164. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-08-complete.md +0 -59
  165. package/src/method-skills/3-solutioning/wize-project-context/workflow.md +0 -120
  166. package/src/method-skills/4-implementation/wize-changelog/workflow.md +0 -184
  167. package/src/method-skills/4-implementation/wize-checkpoint-preview/workflow.md +0 -117
  168. package/src/method-skills/4-implementation/wize-code-review/customize.toml +0 -21
  169. package/src/method-skills/4-implementation/wize-code-review/steps/step-01-gather-context.md +0 -64
  170. package/src/method-skills/4-implementation/wize-code-review/steps/step-02-review.md +0 -40
  171. package/src/method-skills/4-implementation/wize-code-review/steps/step-03-triage.md +0 -43
  172. package/src/method-skills/4-implementation/wize-code-review/steps/step-04-present.md +0 -100
  173. package/src/method-skills/4-implementation/wize-correct-course/workflow.md +0 -93
  174. package/src/method-skills/4-implementation/wize-investigate/workflow.md +0 -123
  175. package/src/method-skills/4-implementation/wize-release/workflow.md +0 -162
  176. package/src/orchestrator-skills/wize/skill.md +0 -164
  177. package/src/orchestrator-skills/wize-check/skill.md +0 -98
  178. package/src/security-overlay/_shared/allowlist.js +0 -154
  179. package/src/security-overlay/_shared/backlog.js +0 -169
  180. package/src/security-overlay/_shared/cli-runner.js +0 -87
  181. package/src/security-overlay/_shared/cvss.js +0 -108
  182. package/src/security-overlay/_shared/detect.js +0 -125
  183. package/src/security-overlay/_shared/install-script.js +0 -205
  184. package/src/security-overlay/_shared/invoke-phase.js +0 -86
  185. package/src/security-overlay/_shared/owasp.js +0 -56
  186. package/src/security-overlay/_shared/partial.js +0 -225
  187. package/src/security-overlay/_shared/preflight.js +0 -175
  188. package/src/security-overlay/_shared/scope-gate.js +0 -172
  189. package/src/security-overlay/_shared/scope-parser.js +0 -147
  190. package/src/security-overlay/agents/red-teamer/agent.yaml +0 -54
  191. package/src/security-overlay/agents/red-teamer/persona.md +0 -49
  192. package/src/security-overlay/data/common.txt +0 -115
  193. package/src/security-overlay/data/owasp-top10.json +0 -15
  194. package/src/security-overlay/data/tool-allowlist.json +0 -31
  195. package/src/security-overlay/skills/wize-sec-enumerate/scripts/run-enumerate.js +0 -180
  196. package/src/security-overlay/skills/wize-sec-enumerate/skill.md +0 -34
  197. package/src/security-overlay/skills/wize-sec-exploit/data/common.txt +0 -117
  198. package/src/security-overlay/skills/wize-sec-exploit/scripts/run-ffuf.js +0 -147
  199. package/src/security-overlay/skills/wize-sec-exploit/scripts/run-nikto.js +0 -145
  200. package/src/security-overlay/skills/wize-sec-exploit/scripts/run-nuclei.js +0 -176
  201. package/src/security-overlay/skills/wize-sec-exploit/scripts/run-sqlmap.js +0 -139
  202. package/src/security-overlay/skills/wize-sec-pentest/scripts/run-pipeline.js +0 -184
  203. package/src/security-overlay/skills/wize-sec-pentest/skill.md +0 -54
  204. package/src/security-overlay/skills/wize-sec-recon/scripts/run-gitleaks.js +0 -139
  205. package/src/security-overlay/skills/wize-sec-recon/scripts/run-osv.js +0 -227
  206. package/src/security-overlay/skills/wize-sec-recon/scripts/run-recon.js +0 -162
  207. package/src/security-overlay/skills/wize-sec-recon/skill.md +0 -37
  208. package/src/security-overlay/skills/wize-sec-report/scripts/render-report.js +0 -1033
  209. package/src/security-overlay/skills/wize-sec-scope/scripts/generate-scope.js +0 -106
  210. package/src/security-overlay/skills/wize-sec-scope/skill.md +0 -52
  211. package/src/tea-skills/wize-qa-generate-e2e-tests/workflow.md +0 -121
  212. package/tools/installer/baseline.js +0 -128
  213. package/tools/installer/commands/agent.js +0 -197
  214. package/tools/installer/commands/doctor.js +0 -319
  215. package/tools/installer/commands/document-project.js +0 -93
  216. package/tools/installer/commands/sync.js +0 -45
  217. package/tools/installer/commands/update.js +0 -172
  218. package/tools/installer/document-project/batch-scanner.js +0 -93
  219. package/tools/installer/document-project/classify.js +0 -170
  220. package/tools/installer/document-project/modes/deep-dive.js +0 -196
  221. package/tools/installer/document-project/modes/full-rescan.js +0 -15
  222. package/tools/installer/document-project/modes/initial-scan.js +0 -100
  223. package/tools/installer/document-project/modes/quick.js +0 -211
  224. package/tools/installer/document-project/render-index.js +0 -101
  225. package/tools/installer/document-project/state.js +0 -110
  226. package/tools/installer/version-check.js +0 -117
@@ -1,93 +0,0 @@
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 };
@@ -1,170 +0,0 @@
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 };
@@ -1,196 +0,0 @@
1
- // Deep-dive mode for `wize-dev-kit document-project`.
2
- //
3
- // Exhaustive documentation of a specific folder/file/feature.
4
-
5
- 'use strict';
6
-
7
- const fs = require('node:fs');
8
- const path = require('node:path');
9
- const { batchScanner, scanFolder } = require('../batch-scanner.js');
10
- const { updateState } = require('../state.js');
11
- const { renderIndex } = require('../render-index.js');
12
-
13
- function sanitize(name) {
14
- return name.replace(/[^a-z0-9_-]/gi, '-').toLowerCase();
15
- }
16
-
17
- function walkAllFiles(rootDir, ignore = ['node_modules', '.git', 'dist', 'build', 'coverage']) {
18
- const files = [];
19
- const stack = [rootDir];
20
- while (stack.length) {
21
- const dir = stack.pop();
22
- let entries;
23
- try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { continue; }
24
- for (const e of entries) {
25
- const full = path.join(dir, e.name);
26
- if (e.isDirectory()) {
27
- if (!ignore.includes(e.name)) stack.push(full);
28
- continue;
29
- }
30
- if (e.isFile() && /\.(js|ts|jsx|tsx|mjs|cjs)$/.test(e.name)) files.push(full);
31
- }
32
- }
33
- return files;
34
- }
35
-
36
- function matchesTarget(filePath, projectRoot, targetType, targetName) {
37
- const rel = path.relative(projectRoot, filePath).toLowerCase();
38
- const name = targetName.toLowerCase();
39
- if (targetType === 'feature') {
40
- return rel.includes(name);
41
- }
42
- if (targetType === 'api_group') {
43
- const inApiFolder = /\/(routes|api|controllers|endpoints)\//.test(rel);
44
- return inApiFolder && rel.includes(name);
45
- }
46
- if (targetType === 'component_group') {
47
- const inComponentFolder = /\/(components|ui|widgets)\//.test(rel);
48
- return inComponentFolder && rel.includes(name);
49
- }
50
- return false;
51
- }
52
-
53
- function resolveTarget(projectRoot, target) {
54
- if (!target) return { targetType: null, targetName: null, targetPath: null, files: [] };
55
-
56
- // Explicit typed target: "feature:auth", "api:users", "component:Button"
57
- const typedMatch = target.match(/^([a-z_]+):(.+)$/i);
58
- if (typedMatch) {
59
- const targetType = typedMatch[1].toLowerCase();
60
- const targetName = typedMatch[2];
61
- if (['feature', 'api_group', 'component_group'].includes(targetType)) {
62
- const all = walkAllFiles(projectRoot);
63
- const files = all.filter(f => matchesTarget(f, projectRoot, targetType, targetName));
64
- return { targetType, targetName, targetPath: target, files };
65
- }
66
- return { targetType, targetName, targetPath: target, files: [], error: `unknown target type: ${targetType}` };
67
- }
68
-
69
- // Path-based target (folder or file)
70
- const targetPath = path.resolve(projectRoot, target);
71
- if (fs.existsSync(targetPath)) {
72
- const stats = fs.statSync(targetPath);
73
- const targetType = stats.isFile() ? 'file' : 'folder';
74
- const files = stats.isFile() ? [targetPath] : scanFolder(targetPath, { ignore: ['node_modules', '.git', 'dist', 'build', 'coverage'] }).files.map(f => f.path);
75
- return { targetType, targetName: path.basename(targetPath), targetPath, files };
76
- }
77
-
78
- // Bare name treated as feature search
79
- const all = walkAllFiles(projectRoot);
80
- const files = all.filter(f => matchesTarget(f, projectRoot, 'feature', target));
81
- return { targetType: 'feature', targetName: target, targetPath: target, files };
82
- }
83
-
84
- function listFilesInScope(rootDir, targetPath) {
85
- const stats = fs.statSync(targetPath);
86
- if (stats.isFile()) return [targetPath];
87
- const scan = scanFolder(targetPath, { ignore: ['node_modules', '.git', 'dist', 'build', 'coverage'] });
88
- return scan.files.map(f => f.path);
89
- }
90
-
91
- function readFileSummary(filePath) {
92
- try {
93
- const content = fs.readFileSync(filePath, 'utf-8');
94
- const lines = content.split('\n');
95
- const exports = [];
96
- const todos = [];
97
- for (let i = 0; i < lines.length; i++) {
98
- const line = lines[i];
99
- if (/\b(module\.exports|exports\.|export\s+(default\s+)?|function\s+|class\s+)/.test(line)) {
100
- exports.push(line.trim().slice(0, 80));
101
- }
102
- if (/\b(TODO|FIXME|HACK|XXX)\b/i.test(line)) {
103
- todos.push(`${i + 1}: ${line.trim().slice(0, 80)}`);
104
- }
105
- }
106
- return {
107
- path: filePath,
108
- loc: lines.length,
109
- exports: exports.slice(0, 10),
110
- todos: todos.slice(0, 10)
111
- };
112
- } catch {
113
- return { path: filePath, loc: 0, exports: [], todos: [] };
114
- }
115
- }
116
-
117
- function runDeepDive(projectRoot, { target, log = console.log } = {}) {
118
- if (!target) {
119
- return { ok: false, error: 'missing --target for deep_dive', exitCode: 1 };
120
- }
121
-
122
- const resolved = resolveTarget(projectRoot, target);
123
- if (resolved.error) {
124
- return { ok: false, error: resolved.error, exitCode: 1 };
125
- }
126
- if (resolved.targetType === 'file' || resolved.targetType === 'folder') {
127
- if (!fs.existsSync(resolved.targetPath)) {
128
- return { ok: false, error: `target not found: ${target}`, exitCode: 1 };
129
- }
130
- }
131
- if (resolved.files.length === 0) {
132
- return { ok: false, error: `target not found or no files matched: ${target}`, exitCode: 1 };
133
- }
134
-
135
- const files = resolved.files;
136
- const summaries = files.map(readFileSummary);
137
- const targetName = resolved.targetName;
138
- const outputName = `deep-dive-${sanitize(targetName)}.md`;
139
- const outputPath = path.join(projectRoot, '.wize', 'knowledge', 'document-project', outputName);
140
-
141
- const lines = [
142
- '---',
143
- 'status: baseline',
144
- 'owner: Pepper Potts + Tony Stark',
145
- `created: ${new Date().toISOString().slice(0, 10)}`,
146
- `last_refreshed: ${new Date().toISOString().slice(0, 10)}`,
147
- '---',
148
- '',
149
- `# Deep Dive — ${targetName}`,
150
- '',
151
- `**Type:** ${resolved.targetType}`,
152
- `**Scope:** ${target}`,
153
- `**Files analyzed:** ${files.length}`,
154
- '',
155
- '## File Inventory',
156
- ''
157
- ];
158
-
159
- for (const s of summaries) {
160
- lines.push(`### ${path.relative(projectRoot, s.path)}`);
161
- lines.push(`- **LOC:** ${s.loc}`);
162
- if (s.exports.length) {
163
- lines.push('- **Exports/signatures:**');
164
- for (const e of s.exports) lines.push(` - \`${e}\``);
165
- }
166
- if (s.todos.length) {
167
- lines.push('- **TODOs/FIXMEs:**');
168
- for (const t of s.todos) lines.push(` - ${t}`);
169
- }
170
- lines.push('');
171
- }
172
-
173
- lines.push('## Modification Guidance', '', '- Verify tests before changing exported signatures.', '');
174
-
175
- fs.mkdirSync(path.dirname(outputPath), { recursive: true });
176
- fs.writeFileSync(outputPath, lines.join('\n'), 'utf-8');
177
-
178
- updateState(projectRoot, {
179
- deep_dive_targets: [{
180
- target_name: targetName,
181
- target_path: resolved.targetPath,
182
- files_analyzed: files.length,
183
- output_file: outputName,
184
- timestamp: new Date().toISOString()
185
- }],
186
- outputs_generated: [outputName]
187
- });
188
-
189
- // Update master index with a link to this deep-dive doc.
190
- renderIndex(projectRoot, { deepDiveFiles: [outputName] });
191
-
192
- log(`Deep-dive written to ${outputPath}`);
193
- return { ok: true, mode: 'deep_dive', changed: true, written: [outputName] };
194
- }
195
-
196
- module.exports = { runDeepDive, listFilesInScope, readFileSummary, resolveTarget };
@@ -1,15 +0,0 @@
1
- // Full rescan mode for `wize-dev-kit document-project`.
2
- //
3
- // Archives the previous state and re-runs an initial scan from scratch.
4
-
5
- 'use strict';
6
-
7
- const { archiveOldState } = require('../state.js');
8
- const { runInitialScan } = require('./initial-scan.js');
9
-
10
- function runFullRescan(projectRoot, options = {}) {
11
- archiveOldState(projectRoot);
12
- return runInitialScan(projectRoot, { ...options, mode: 'full_rescan' });
13
- }
14
-
15
- module.exports = { runFullRescan };
@@ -1,100 +0,0 @@
1
- // Initial scan mode for `wize-dev-kit document-project`.
2
- //
3
- // Runs project-type classification, conditional scans, and generates index + docs.
4
-
5
- 'use strict';
6
-
7
- const fs = require('node:fs');
8
- const path = require('node:path');
9
- const { classifyProject } = require('../classify.js');
10
- const { batchScanner } = require('../batch-scanner.js');
11
- const { renderIndex } = require('../render-index.js');
12
- const { initState, updateState } = require('../state.js');
13
- const { runQuick } = require('./quick.js');
14
-
15
- function now() {
16
- return new Date().toISOString().slice(0, 10);
17
- }
18
-
19
- function readRequirements(row) {
20
- return {
21
- api: row.requires_api_scan,
22
- data: row.requires_data_models,
23
- state: row.requires_state_management,
24
- ui: row.requires_ui_components,
25
- deploy: row.requires_deployment_config,
26
- hardware: row.requires_hardware_docs,
27
- assets: row.requires_asset_inventory
28
- };
29
- }
30
-
31
- function existingDocs(root) {
32
- const candidates = [
33
- 'README.md',
34
- 'CONTRIBUTING.md',
35
- 'ARCHITECTURE.md',
36
- 'DEPLOYMENT.md',
37
- 'API.md'
38
- ];
39
- return candidates.filter(f => fs.existsSync(path.join(root, f))).map(f => path.join(root, f));
40
- }
41
-
42
- function runInitialScan(projectRoot, { scanLevel = 'quick', log = console.log, csvPath } = {}) {
43
- const classification = classifyProject(projectRoot, csvPath ? { csvPath } : {});
44
- const state = initState(projectRoot, 'initial_scan', scanLevel);
45
-
46
- updateState(projectRoot, {
47
- completed_steps: [{ step: 'classify', status: 'completed', timestamp: new Date().toISOString(), summary: `Classified as ${classification.projectTypes.join(', ')}` }],
48
- current_step: 'scan',
49
- findings: {
50
- project_classification: {
51
- repository_type: classification.parts.length >= 2 ? 'multi-part' : 'monolith',
52
- parts_count: classification.parts.length,
53
- primary_language: 'unknown',
54
- architecture_type: classification.projectTypes[0] || 'unknown'
55
- }
56
- }
57
- });
58
-
59
- let generated = [];
60
- if (scanLevel === 'deep' || scanLevel === 'exhaustive') {
61
- const batches = batchScanner(projectRoot, { ignore: ['.wize', '.git', 'node_modules'] });
62
- updateState(projectRoot, {
63
- completed_steps: [{ step: 'scan', status: 'completed', timestamp: new Date().toISOString(), summary: `${batches.length} batches scanned` }],
64
- current_step: 'generate',
65
- findings: {
66
- batches_completed: batches.map(b => ({ path: b.folder, files_scanned: b.fileCount, summary: `${b.totalLoc} LOC` }))
67
- }
68
- });
69
- }
70
-
71
- // Always write baseline + index.
72
- const quick = runQuick(projectRoot, { log });
73
- generated.push(...quick.written.map(f => path.join(projectRoot, '.wize', 'knowledge', 'document-project', f)));
74
-
75
- const indexResult = renderIndex(projectRoot, {
76
- projectTypes: classification.projectTypes,
77
- parts: classification.parts,
78
- generated,
79
- existing: existingDocs(projectRoot)
80
- });
81
- generated.push(path.join(projectRoot, '.wize', 'knowledge', 'document-project', 'index.md'));
82
-
83
- updateState(projectRoot, {
84
- completed_steps: [{ step: 'generate', status: 'completed', timestamp: new Date().toISOString(), summary: `Generated ${generated.length} files` }],
85
- current_step: 'completed',
86
- outputs_generated: generated.map(g => path.basename(g)),
87
- resume_instructions: 'Scan complete'
88
- });
89
-
90
- return {
91
- changed: true,
92
- mode: 'initial_scan',
93
- scanLevel,
94
- projectTypes: classification.projectTypes,
95
- parts: classification.parts,
96
- generated: generated.map(g => path.basename(g))
97
- };
98
- }
99
-
100
- module.exports = { runInitialScan };