wize-dev-kit 0.15.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 (232) hide show
  1. package/ARCH.md +24 -77
  2. package/CHANGELOG.md +9 -0
  3. package/DECISIONS.md +1 -27
  4. package/README.md +4 -0
  5. package/ROSTER.md +3 -11
  6. package/adapters/README.md +7 -8
  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 +15 -159
  78. package/tools/installer/setup-helpers.js +0 -1
  79. package/tools/installer/validators/run-all.js +2 -3
  80. package/tools/installer/wize-cli.js +70 -500
  81. package/AGENTS.md +0 -37
  82. package/README.es.md +0 -295
  83. package/README.pt-BR.md +0 -293
  84. package/adapters/hermes/README.md +0 -23
  85. package/adapters/hermes/adapter.yaml +0 -8
  86. package/adapters/hermes/render.js +0 -17
  87. package/docs/harnesses/antigravity.md +0 -20
  88. package/docs/harnesses/antigravity.pt-BR.md +0 -20
  89. package/docs/harnesses/claude-code.md +0 -23
  90. package/docs/harnesses/claude-code.pt-BR.md +0 -23
  91. package/docs/harnesses/codex.md +0 -21
  92. package/docs/harnesses/codex.pt-BR.md +0 -21
  93. package/docs/harnesses/continue.md +0 -21
  94. package/docs/harnesses/continue.pt-BR.md +0 -21
  95. package/docs/harnesses/cursor.md +0 -22
  96. package/docs/harnesses/cursor.pt-BR.md +0 -22
  97. package/docs/harnesses/generic.md +0 -20
  98. package/docs/harnesses/generic.pt-BR.md +0 -20
  99. package/docs/harnesses/hermes.md +0 -26
  100. package/docs/harnesses/hermes.pt-BR.md +0 -26
  101. package/docs/harnesses/kimi-code.md +0 -19
  102. package/docs/harnesses/kimi-code.pt-BR.md +0 -19
  103. package/docs/harnesses/opencode.md +0 -31
  104. package/docs/harnesses/opencode.pt-BR.md +0 -31
  105. package/docs/harnesses/windsurf.md +0 -22
  106. package/docs/harnesses/windsurf.pt-BR.md +0 -22
  107. package/src/core-skills/wize-customize/skill.md +0 -116
  108. package/src/core-skills/wize-editorial-review-prose/skill.md +0 -94
  109. package/src/core-skills/wize-editorial-review-structure/skill.md +0 -99
  110. package/src/core-skills/wize-grill/skill.md +0 -77
  111. package/src/core-skills/wize-index-docs/skill.md +0 -119
  112. package/src/core-skills/wize-pre-pr-check/skill.md +0 -134
  113. package/src/core-skills/wize-review-edge-case-hunter/skill.md +0 -115
  114. package/src/core-skills/wize-spec/assets/headless-schemas.md +0 -39
  115. package/src/core-skills/wize-spec/assets/spec-template.md +0 -40
  116. package/src/core-skills/wize-spec/customize.toml +0 -20
  117. package/src/core-skills/wize-spec/skill.md +0 -112
  118. package/src/method-skills/1-analysis/wize-document-project/documentation-requirements.csv +0 -12
  119. package/src/method-skills/1-analysis/wize-document-project/templates/api-contracts-template.md +0 -38
  120. package/src/method-skills/1-analysis/wize-document-project/templates/architecture-template.md +0 -54
  121. package/src/method-skills/1-analysis/wize-document-project/templates/component-inventory-template.md +0 -40
  122. package/src/method-skills/1-analysis/wize-document-project/templates/contribution-guide-template.md +0 -34
  123. package/src/method-skills/1-analysis/wize-document-project/templates/data-models-template.md +0 -36
  124. package/src/method-skills/1-analysis/wize-document-project/templates/deep-dive-template.md +0 -312
  125. package/src/method-skills/1-analysis/wize-document-project/templates/deployment-guide-template.md +0 -42
  126. package/src/method-skills/1-analysis/wize-document-project/templates/development-guide-template.md +0 -61
  127. package/src/method-skills/1-analysis/wize-document-project/templates/index-template.md +0 -185
  128. package/src/method-skills/1-analysis/wize-document-project/templates/project-overview-template.md +0 -110
  129. package/src/method-skills/1-analysis/wize-document-project/templates/project-scan-report-schema.json +0 -159
  130. package/src/method-skills/1-analysis/wize-document-project/templates/source-tree-template.md +0 -142
  131. package/src/method-skills/1-analysis/wize-domain-research/customize.toml +0 -14
  132. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-01-init.md +0 -49
  133. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-02-domain-analysis.md +0 -39
  134. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-03-competitive-landscape.md +0 -39
  135. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-04-regulatory-focus.md +0 -39
  136. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-05-technical-trends.md +0 -39
  137. package/src/method-skills/1-analysis/wize-domain-research/domain-steps/step-06-research-synthesis.md +0 -43
  138. package/src/method-skills/1-analysis/wize-domain-research/research.template.md +0 -31
  139. package/src/method-skills/1-analysis/wize-domain-research/workflow.md +0 -58
  140. package/src/method-skills/1-analysis/wize-market-research/customize.toml +0 -14
  141. package/src/method-skills/1-analysis/wize-market-research/research.template.md +0 -31
  142. package/src/method-skills/1-analysis/wize-market-research/steps/step-01-init.md +0 -57
  143. package/src/method-skills/1-analysis/wize-market-research/steps/step-02-customer-behavior.md +0 -39
  144. package/src/method-skills/1-analysis/wize-market-research/steps/step-03-customer-pain-points.md +0 -37
  145. package/src/method-skills/1-analysis/wize-market-research/steps/step-04-customer-decisions.md +0 -39
  146. package/src/method-skills/1-analysis/wize-market-research/steps/step-05-competitive-analysis.md +0 -37
  147. package/src/method-skills/1-analysis/wize-market-research/steps/step-06-research-completion.md +0 -47
  148. package/src/method-skills/1-analysis/wize-market-research/workflow.md +0 -66
  149. package/src/method-skills/1-analysis/wize-refresh-knowledge/workflow.md +0 -129
  150. package/src/method-skills/1-analysis/wize-technical-research/customize.toml +0 -14
  151. package/src/method-skills/1-analysis/wize-technical-research/research.template.md +0 -31
  152. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-01-init.md +0 -49
  153. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-02-technical-overview.md +0 -45
  154. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-03-integration-patterns.md +0 -39
  155. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-04-architectural-patterns.md +0 -39
  156. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-05-implementation-research.md +0 -42
  157. package/src/method-skills/1-analysis/wize-technical-research/technical-steps/step-06-research-synthesis.md +0 -46
  158. package/src/method-skills/1-analysis/wize-technical-research/workflow.md +0 -60
  159. package/src/method-skills/2-plan-workflows/wize-edit-prd/workflow.md +0 -110
  160. package/src/method-skills/3-solutioning/wize-create-architecture/architecture-decision-template.md +0 -41
  161. package/src/method-skills/3-solutioning/wize-create-architecture/customize.toml +0 -20
  162. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-01-init.md +0 -95
  163. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-01b-continue.md +0 -32
  164. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-02-context.md +0 -126
  165. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-03-starter.md +0 -110
  166. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-04-decisions.md +0 -129
  167. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-05-patterns.md +0 -109
  168. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-06-structure.md +0 -97
  169. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-07-validation.md +0 -124
  170. package/src/method-skills/3-solutioning/wize-create-architecture/steps/step-08-complete.md +0 -59
  171. package/src/method-skills/3-solutioning/wize-project-context/workflow.md +0 -120
  172. package/src/method-skills/4-implementation/wize-changelog/workflow.md +0 -184
  173. package/src/method-skills/4-implementation/wize-checkpoint-preview/workflow.md +0 -117
  174. package/src/method-skills/4-implementation/wize-code-review/customize.toml +0 -21
  175. package/src/method-skills/4-implementation/wize-code-review/steps/step-01-gather-context.md +0 -64
  176. package/src/method-skills/4-implementation/wize-code-review/steps/step-02-review.md +0 -40
  177. package/src/method-skills/4-implementation/wize-code-review/steps/step-03-triage.md +0 -43
  178. package/src/method-skills/4-implementation/wize-code-review/steps/step-04-present.md +0 -100
  179. package/src/method-skills/4-implementation/wize-correct-course/workflow.md +0 -93
  180. package/src/method-skills/4-implementation/wize-investigate/workflow.md +0 -123
  181. package/src/method-skills/4-implementation/wize-release/workflow.md +0 -162
  182. package/src/orchestrator-skills/wize/skill.md +0 -164
  183. package/src/orchestrator-skills/wize-check/skill.md +0 -98
  184. package/src/security-overlay/_shared/allowlist.js +0 -154
  185. package/src/security-overlay/_shared/backlog.js +0 -169
  186. package/src/security-overlay/_shared/cli-runner.js +0 -87
  187. package/src/security-overlay/_shared/cvss.js +0 -108
  188. package/src/security-overlay/_shared/detect.js +0 -125
  189. package/src/security-overlay/_shared/install-script.js +0 -205
  190. package/src/security-overlay/_shared/invoke-phase.js +0 -86
  191. package/src/security-overlay/_shared/owasp.js +0 -56
  192. package/src/security-overlay/_shared/partial.js +0 -225
  193. package/src/security-overlay/_shared/preflight.js +0 -175
  194. package/src/security-overlay/_shared/scope-gate.js +0 -172
  195. package/src/security-overlay/_shared/scope-parser.js +0 -147
  196. package/src/security-overlay/agents/red-teamer/agent.yaml +0 -54
  197. package/src/security-overlay/agents/red-teamer/persona.md +0 -49
  198. package/src/security-overlay/data/common.txt +0 -115
  199. package/src/security-overlay/data/owasp-top10.json +0 -15
  200. package/src/security-overlay/data/tool-allowlist.json +0 -31
  201. package/src/security-overlay/skills/wize-sec-enumerate/scripts/run-enumerate.js +0 -180
  202. package/src/security-overlay/skills/wize-sec-enumerate/skill.md +0 -34
  203. package/src/security-overlay/skills/wize-sec-exploit/data/common.txt +0 -117
  204. package/src/security-overlay/skills/wize-sec-exploit/scripts/run-ffuf.js +0 -147
  205. package/src/security-overlay/skills/wize-sec-exploit/scripts/run-nikto.js +0 -145
  206. package/src/security-overlay/skills/wize-sec-exploit/scripts/run-nuclei.js +0 -176
  207. package/src/security-overlay/skills/wize-sec-exploit/scripts/run-sqlmap.js +0 -139
  208. package/src/security-overlay/skills/wize-sec-pentest/scripts/run-pipeline.js +0 -184
  209. package/src/security-overlay/skills/wize-sec-pentest/skill.md +0 -54
  210. package/src/security-overlay/skills/wize-sec-recon/scripts/run-gitleaks.js +0 -139
  211. package/src/security-overlay/skills/wize-sec-recon/scripts/run-osv.js +0 -227
  212. package/src/security-overlay/skills/wize-sec-recon/scripts/run-recon.js +0 -162
  213. package/src/security-overlay/skills/wize-sec-recon/skill.md +0 -37
  214. package/src/security-overlay/skills/wize-sec-report/scripts/render-report.js +0 -1033
  215. package/src/security-overlay/skills/wize-sec-scope/scripts/generate-scope.js +0 -106
  216. package/src/security-overlay/skills/wize-sec-scope/skill.md +0 -52
  217. package/src/tea-skills/wize-qa-generate-e2e-tests/workflow.md +0 -121
  218. package/tools/installer/baseline.js +0 -133
  219. package/tools/installer/commands/agent.js +0 -197
  220. package/tools/installer/commands/doctor.js +0 -320
  221. package/tools/installer/commands/document-project.js +0 -93
  222. package/tools/installer/commands/sync.js +0 -45
  223. package/tools/installer/commands/update.js +0 -172
  224. package/tools/installer/document-project/batch-scanner.js +0 -93
  225. package/tools/installer/document-project/classify.js +0 -170
  226. package/tools/installer/document-project/modes/deep-dive.js +0 -196
  227. package/tools/installer/document-project/modes/full-rescan.js +0 -15
  228. package/tools/installer/document-project/modes/initial-scan.js +0 -100
  229. package/tools/installer/document-project/modes/quick.js +0 -211
  230. package/tools/installer/document-project/render-index.js +0 -101
  231. package/tools/installer/document-project/state.js +0 -110
  232. package/tools/installer/version-check.js +0 -117
@@ -1,154 +0,0 @@
1
- 'use strict';
2
-
3
- // allowlist.js — gate that filters arguments for an external pentest tool
4
- // before they are passed to child_process.execFile. The list of allowed
5
- // flags per tool lives in src/security-overlay/data/tool-allowlist.json.
6
- //
7
- // Schema (per tool, array of strings):
8
- // "-foo" switch with no value
9
- // "-foo:" switch that consumes the next argv as its value
10
- // "-foo=bar" switch with a fixed value (only the literal "bar" is allowed)
11
- // "--flag=" switch that consumes a value joined by '=' (e.g. --level=1)
12
- //
13
- // Invariant: args NOT in the allowlist (or args that look like values for
14
- // flags not in the allowlist) are dropped. Positional args (targets, URLs)
15
- // pass through unchanged.
16
-
17
- const fs = require('node:fs');
18
- const path = require('node:path');
19
-
20
- class UnknownToolError extends Error {
21
- constructor(tool) {
22
- super(`Unknown tool "${tool}" — not in tool-allowlist.json. Refusing to invoke.`);
23
- this.name = 'UnknownToolError';
24
- this.tool = tool;
25
- }
26
- }
27
-
28
- const DEFAULT_ALLOWLIST_PATH = path.join(__dirname, '..', 'data', 'tool-allowlist.json');
29
-
30
- let _cache = null;
31
- function _loadDefault() {
32
- if (_cache) return _cache;
33
- const raw = fs.readFileSync(DEFAULT_ALLOWLIST_PATH, 'utf8');
34
- _cache = JSON.parse(raw);
35
- return _cache;
36
- }
37
-
38
- function loadAllowlist(filePath) {
39
- const fp = filePath || DEFAULT_ALLOWLIST_PATH;
40
- return JSON.parse(fs.readFileSync(fp, 'utf8'));
41
- }
42
-
43
- // Heuristic for "is this arg a flag?": starts with '-' and is more than 1 char
44
- // (a bare "-" is sometimes used as stdin, treat as positional).
45
- function isFlag(arg) {
46
- return typeof arg === 'string' && arg.length > 1 && arg[0] === '-';
47
- }
48
-
49
- // Classify one allowlist token into one of:
50
- // { kind: 'switch' } — no value
51
- // { kind: 'colon', prefix: '-foo' } — consumes next argv (e.g. -f path)
52
- // { kind: 'equals', prefix: '--flag=' } — consumes value joined by '=' (e.g. --level=1)
53
- // { kind: 'literal', full: '-foo=bar' } — only the exact form is allowed
54
- //
55
- // When matching an arg, we try in order: literal, then colon (exact prefix
56
- // match, e.g. arg === '-u'), then equals (arg starts with prefix, e.g.
57
- // arg === '--level=1'), then switch (exact equality).
58
- function classify(token) {
59
- if (token.endsWith(':')) {
60
- return { kind: 'colon', prefix: token.slice(0, -1) };
61
- }
62
- if (token.endsWith('=') && token.startsWith('--')) {
63
- return { kind: 'equals', prefix: token };
64
- }
65
- if (token.includes('=') && !token.endsWith('=')) {
66
- return { kind: 'literal', full: token };
67
- }
68
- return { kind: 'switch' };
69
- }
70
-
71
- // Given a flag arg, find the first allowlist token that matches it.
72
- function matchFlag(toolData, arg) {
73
- // Literal first (most specific).
74
- for (const tok of toolData) {
75
- if (classify(tok).kind === 'literal' && arg === tok) return { consumeNext: false };
76
- }
77
- // Then colon (exact prefix match) — e.g. arg === '-u'.
78
- for (const tok of toolData) {
79
- if (classify(tok).kind === 'colon' && arg === classify(tok).prefix) return { consumeNext: true };
80
- }
81
- // Then equals — e.g. arg starts with '--level='.
82
- for (const tok of toolData) {
83
- if (classify(tok).kind === 'equals' && arg.startsWith(classify(tok).prefix)) return { consumeNext: false };
84
- }
85
- // Then switch.
86
- for (const tok of toolData) {
87
- if (classify(tok).kind === 'switch' && tok === arg) return { consumeNext: false };
88
- }
89
- return null;
90
- }
91
-
92
- // filterArgs(tool, args, allowlist) — keep only args allowed by the tool's
93
- // allowlist, handling value-bearing flags correctly.
94
- function filterArgs(tool, args, allowlist) {
95
- const data = allowlist || _loadDefault();
96
- if (!Object.prototype.hasOwnProperty.call(data, tool)) {
97
- throw new UnknownToolError(tool);
98
- }
99
- const toolData = data[tool];
100
-
101
- const out = [];
102
- let i = 0;
103
- const list = args || [];
104
- while (i < list.length) {
105
- const arg = list[i];
106
- if (!isFlag(arg)) {
107
- // Positional: target, URL, output path.
108
- out.push(arg);
109
- i++;
110
- continue;
111
- }
112
- const m = matchFlag(toolData, arg);
113
- if (!m) {
114
- // Unknown flag — drop the flag. We do NOT also drop the next arg,
115
- // because a positional after a stripped flag is still a positional
116
- // (caller may have intended both to pass). However, common patterns
117
- // are value-bearing: e.g. `--script vuln` — if the flag is dropped,
118
- // "vuln" is also dropped to avoid leaking. This is the safe default.
119
- if (looksLikeValueArg(list[i + 1])) {
120
- // Consume the next arg as part of the dropped flag's expected value.
121
- i += 2;
122
- } else {
123
- i++;
124
- }
125
- continue;
126
- }
127
- out.push(arg);
128
- if (m.consumeNext) {
129
- // Value-bearing: the next argv is the value. Pass it through.
130
- if (i + 1 < list.length) {
131
- out.push(list[i + 1]);
132
- i += 2;
133
- } else {
134
- i++;
135
- }
136
- } else {
137
- i++;
138
- }
139
- }
140
- return out;
141
- }
142
-
143
- // A value arg is one that does NOT start with '-' (or is the bare "-").
144
- function looksLikeValueArg(arg) {
145
- return arg !== undefined && (typeof arg !== 'string' || arg.length === 0 || arg[0] !== '-');
146
- }
147
-
148
- module.exports = {
149
- filterArgs,
150
- loadAllowlist,
151
- UnknownToolError,
152
- classify,
153
- matchFlag
154
- };
@@ -1,169 +0,0 @@
1
- 'use strict';
2
-
3
- // backlog.js — turns classified security findings into a remediation
4
- // backlog (epics + stories) that wize-create-epics-and-stories can consume.
5
- //
6
- // Design (per brief-post-scan):
7
- // - Group findings by theme/section, NOT 1-story-per-finding (97 secrets
8
- // => 1 "rotate secrets" story, not 97).
9
- // - Priority P0/P1/P2 derived from the worst severity in the group.
10
- // - Each story keeps traceability to the source findings + scope hash.
11
- // - Seed epics from the AI action plan (ai-insights.json) when present.
12
- // - Zero-dep, file-first. The overlay never invokes a skill — it prints
13
- // a clear CTA command for the user/agent to run.
14
-
15
- const CTA_COMMAND = '/wize-create-epics-and-stories --from .wize/security/security-backlog.md';
16
-
17
- // Severity -> remediation priority.
18
- function priorityFor(severity) {
19
- switch (severity) {
20
- case 'Critical':
21
- case 'High':
22
- return 'P0';
23
- case 'Medium':
24
- return 'P1';
25
- default:
26
- return 'P2'; // Low, Info-surface, None, unknown
27
- }
28
- }
29
-
30
- // Human label + remediation intent per section.
31
- const SECTION_THEME = {
32
- secrets: { theme: 'Rotacionar e remover segredos expostos', owasp: 'A07:2021' },
33
- deps: { theme: 'Atualizar dependências vulneráveis', owasp: 'A06:2021' },
34
- nuclei: { theme: 'Corrigir vulnerabilidades detectadas (nuclei)', owasp: null },
35
- nikto: { theme: 'Hardening de servidor web (nikto)', owasp: 'A05:2021' },
36
- sqlmap: { theme: 'Corrigir injeção SQL', owasp: 'A03:2021' },
37
- ffuf: { theme: 'Revisar endpoints/arquivos descobertos', owasp: 'A05:2021' },
38
- tech: { theme: 'Hardening: ocultar fingerprinting de versões', owasp: 'A05:2021' },
39
- open_ports: { theme: 'Revisar exposição de portas/serviços', owasp: 'A05:2021' },
40
- surface: { theme: 'Revisar superfície HTTP exposta', owasp: 'A05:2021' }
41
- };
42
-
43
- // Severity rank for "worst in group".
44
- const SEV_RANK = { Critical: 5, High: 4, Medium: 3, Low: 2, 'Info-surface': 1, None: 0, unknown: 0 };
45
-
46
- // groupFindings(findings) -> [{ section, theme, owasp, count, priority,
47
- // worstSeverity, findings: [...] }] sorted by priority then count.
48
- function groupFindings(findings) {
49
- const bySection = {};
50
- for (const f of findings || []) {
51
- const s = f.section || 'unknown';
52
- if (!bySection[s]) bySection[s] = [];
53
- bySection[s].push(f);
54
- }
55
- const groups = [];
56
- for (const [section, fs] of Object.entries(bySection)) {
57
- let worst = 'unknown';
58
- for (const f of fs) {
59
- if ((SEV_RANK[f.severity] || 0) > (SEV_RANK[worst] || 0)) worst = f.severity;
60
- }
61
- const theme = (SECTION_THEME[section] && SECTION_THEME[section].theme) || `Revisar findings de ${section}`;
62
- const owasp = SECTION_THEME[section] && SECTION_THEME[section].owasp;
63
- groups.push({
64
- section,
65
- theme,
66
- owasp,
67
- count: fs.length,
68
- worstSeverity: worst,
69
- priority: priorityFor(worst),
70
- findings: fs
71
- });
72
- }
73
- // Order: P0 first, then by count desc.
74
- const pOrder = { P0: 0, P1: 1, P2: 2 };
75
- groups.sort((a, b) => (pOrder[a.priority] - pOrder[b.priority]) || (b.count - a.count));
76
- return groups;
77
- }
78
-
79
- function escapeMd(s) {
80
- return String(s == null ? '' : s);
81
- }
82
-
83
- // buildBacklog({ findings, actionPlan, scopeSha, generatedAt }) -> markdown.
84
- function buildBacklog({ findings = [], actionPlan = [], scopeSha = '', generatedAt = '' } = {}) {
85
- const groups = groupFindings(findings);
86
- const lines = [];
87
-
88
- lines.push('---');
89
- lines.push('kind: security-remediation-backlog');
90
- lines.push('owner: Natasha Romanoff (red-teamer)');
91
- lines.push(`source_scope_sha256: ${escapeMd(scopeSha)}`);
92
- lines.push(`generated_at: ${escapeMd(generatedAt)}`);
93
- lines.push('consumed_by: wize-create-epics-and-stories');
94
- lines.push('---');
95
- lines.push('');
96
- lines.push('# Security Remediation Backlog');
97
- lines.push('');
98
- lines.push('Backlog de correção derivado do scan de segurança. Cada epic agrupa findings por tema; cada story rastreia os findings de origem. Prioridade vem da severidade (P0 = Critical/High, P1 = Medium, P2 = Low/informativo).');
99
- lines.push('');
100
- lines.push(`> **Próximo passo:** rode \`${CTA_COMMAND}\` para transformar este backlog em stories formais.`);
101
- lines.push('');
102
-
103
- // Action plan summary (from AI insights) — the executive framing.
104
- if (actionPlan && actionPlan.length) {
105
- lines.push('## Plano de ação (resumo)');
106
- lines.push('');
107
- for (const a of actionPlan) {
108
- lines.push(`- **[${escapeMd(a.priority)}] ${escapeMd(a.title)}** — ${escapeMd(a.detail)}`);
109
- }
110
- lines.push('');
111
- }
112
-
113
- // Build a lookup from action plan title keywords to attach detail to epics.
114
- const planByTheme = {};
115
- for (const a of (actionPlan || [])) planByTheme[(a.title || '').toLowerCase()] = a;
116
-
117
- if (groups.length === 0) {
118
- lines.push('## (sem itens)');
119
- lines.push('');
120
- lines.push('_Nenhum finding acionável neste scan — no actionable findings._');
121
- return lines.join('\n');
122
- }
123
-
124
- // One epic per group.
125
- let epicN = 0;
126
- for (const g of groups) {
127
- epicN++;
128
- // Find a matching action-plan detail by theme keyword overlap.
129
- let planDetail = '';
130
- for (const [title, a] of Object.entries(planByTheme)) {
131
- const key = g.section;
132
- if (title.includes(key) || (key === 'secrets' && title.includes('segredo')) ||
133
- (key === 'deps' && (title.includes('depend') || title.includes('dep'))) ||
134
- (key === 'tech' && title.includes('fingerprint'))) {
135
- planDetail = a.detail; break;
136
- }
137
- }
138
- lines.push(`## Epic ${String(epicN).padStart(2, '0')}: ${g.theme} [${g.priority}]`);
139
- lines.push('');
140
- lines.push(`- **Prioridade:** ${g.priority} (pior severidade: ${g.worstSeverity})`);
141
- lines.push(`- **Findings cobertos:** ${g.count}`);
142
- if (g.owasp) lines.push(`- **OWASP:** ${g.owasp}`);
143
- if (planDetail) lines.push(`- **Como corrigir:** ${planDetail}`);
144
- lines.push('');
145
- lines.push('### Stories');
146
- lines.push('');
147
- // For large groups, a single remediation story + a verification story.
148
- lines.push(`- **${g.theme}** (${g.priority}) — corrigir os ${g.count} finding(s) de \`${g.section}\`. _Origem: ${g.section} (${g.count} findings, ${g.worstSeverity})._`);
149
- lines.push(`- **Verificar correção de ${g.section}** (${g.priority}) — re-rodar \`/wize-sec-pentest\` e confirmar que os findings de \`${g.section}\` sumiram (DoD).`);
150
- lines.push('');
151
- // Sample of source findings for traceability (cap at 5).
152
- const sample = g.findings.slice(0, 5);
153
- lines.push('<details><summary>Findings de origem (amostra)</summary>');
154
- lines.push('');
155
- for (const f of sample) {
156
- lines.push(`- ${escapeMd(f.raw)}`);
157
- }
158
- if (g.findings.length > sample.length) {
159
- lines.push(`- _… e mais ${g.findings.length - sample.length}._`);
160
- }
161
- lines.push('');
162
- lines.push('</details>');
163
- lines.push('');
164
- }
165
-
166
- return lines.join('\n');
167
- }
168
-
169
- module.exports = { buildBacklog, priorityFor, groupFindings, CTA_COMMAND };
@@ -1,87 +0,0 @@
1
- 'use strict';
2
-
3
- // cli-runner.js — small helper so each phase script can be invoked
4
- // either as a module (import + call) or as a CLI (with --securityDir /
5
- // --scope / --active argv). The invoke-phase helper spawns the script
6
- // as a Node subprocess; this module bridges that to the per-phase
7
- // `runX` function exported by each script.
8
- //
9
- // Usage from a script:
10
- // const { runX } = require('./run-x');
11
- // module.exports = { runX };
12
- // if (require.main === module) {
13
- // require('../../../_shared/cli-runner.js').runFromArgv({
14
- // fn: runX,
15
- // argMap: { securityDir: 'securityDir', scopePath: 'scopePath', active: 'active' }
16
- // });
17
- // }
18
- //
19
- // argv shape: --securityDir=PATH --scope=PATH --active [script-specific]
20
- // The function `fn` is called with the parsed object spread.
21
-
22
- function parseArgv(argv) {
23
- const out = {};
24
- for (let i = 0; i < (argv || []).length; i++) {
25
- const a = argv[i];
26
- if (a === '--active') { out.active = true; continue; }
27
- const eq = a.indexOf('=');
28
- if (eq > 0) {
29
- const key = a.slice(0, eq).replace(/^--/, '');
30
- const val = a.slice(eq + 1);
31
- out[camel(key)] = val;
32
- continue;
33
- }
34
- if (a.startsWith('--') && i + 1 < argv.length && !argv[i + 1].startsWith('--')) {
35
- out[camel(a.slice(2))] = argv[i + 1];
36
- i++;
37
- }
38
- }
39
- return out;
40
- }
41
-
42
- function camel(s) {
43
- return s.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
44
- }
45
-
46
- async function runFromArgv({ fn, argMap = {} }) {
47
- const argv = process.argv.slice(2);
48
- const parsed = parseArgv(argv);
49
- // Map --securityDir -> securityDir, --scope -> scopePath, etc.
50
- const opts = {};
51
- for (const [cliKey, optKey] of Object.entries(argMap)) {
52
- if (cliKey in parsed) opts[optKey] = parsed[cliKey];
53
- }
54
- // Also accept any unprefixed camelCase keys directly.
55
- for (const [k, v] of Object.entries(parsed)) {
56
- if (!(k in opts)) opts[k] = v;
57
- }
58
- if (!('active' in opts)) opts.active = false;
59
- // The phase script may also export its own CLI flags (--target for recon).
60
- // We forward remaining --flags as a target-agnostic extraArgs-style list.
61
- const extras = {};
62
- for (const a of argv) {
63
- if (a === '--active') continue;
64
- const m = a.match(/^--([a-z0-9-]+)/);
65
- if (m && !argMap[m[1]] && !argMap[camel(m[1])]) {
66
- // Stash any flag the script might want to read itself.
67
- extras[m[1]] = a.includes('=') ? a.slice(a.indexOf('=') + 1) : true;
68
- }
69
- }
70
- Object.assign(opts, extras);
71
- try {
72
- const r = await fn(opts);
73
- if (r && typeof r === 'object') {
74
- // Print a one-line summary the orchestrator can show in its summary.
75
- const summary = r.partialStatus
76
- ? `${process.argv[1].split('/').pop().replace(/\.js$/, '')}: partial_status=${r.partialStatus} mode=${r.mode || 'passive'}`
77
- : '';
78
- if (summary) process.stdout.write(summary + '\n');
79
- }
80
- process.exit(0);
81
- } catch (e) {
82
- process.stderr.write(`✖ ${process.argv[1]}: ${e && e.message ? e.message : e}\n`);
83
- process.exit(2);
84
- }
85
- }
86
-
87
- module.exports = { parseArgv, runFromArgv };
@@ -1,108 +0,0 @@
1
- 'use strict';
2
-
3
- // cvss.js — zero-dep CVSS v3.1 score calculator. Implements the official
4
- // formula from FIRST.org. Tested against the 5 canonical vectors from
5
- // the spec. Returns the base score (0.0-10.0) and the severity label.
6
-
7
- class InvalidVectorError extends Error {
8
- constructor(message) { super(message); this.name = 'InvalidVectorError'; }
9
- }
10
-
11
- // --- metric value tables (per CVSS v3.1 spec) -----------------------------
12
-
13
- const AV = { N: 0.85, A: 0.62, L: 0.55, P: 0.2 };
14
- const AC = { L: 0.77, H: 0.44 };
15
- const PR_U = { N: 0.85, L: 0.62, H: 0.27 }; // PR and UI share values when scope=U
16
- const PR_C = { N: 0.85, L: 0.68, H: 0.5 }; // PR changes when scope=C
17
- const UI_U = { N: 0.85, R: 0.62 };
18
- const UI_C = { N: 0.85, R: 0.68 };
19
- const CIA = { H: 0.56, L: 0.22, N: 0 };
20
-
21
- // --- parse --------------------------------------------------------------
22
-
23
- function parse(vector) {
24
- if (typeof vector !== 'string') throw new InvalidVectorError('vector must be a string');
25
- let v = vector.trim();
26
- if (v.startsWith('CVSS:3.1/')) v = v.slice('CVSS:3.1/'.length);
27
- if (v.startsWith('CVSS:3.0/')) throw new InvalidVectorError('CVSS v3.0 vectors are not supported');
28
-
29
- const m = {};
30
- for (const part of v.split('/')) {
31
- const idx = part.indexOf(':');
32
- if (idx < 0) throw new InvalidVectorError(`bad metric segment: ${part}`);
33
- const key = part.slice(0, idx);
34
- const val = part.slice(idx + 1);
35
- if (val.length !== 1) throw new InvalidVectorError(`bad metric value: ${val}`);
36
- m[key] = val;
37
- }
38
-
39
- // Validate required metrics.
40
- for (const k of ['AV', 'AC', 'PR', 'UI', 'S', 'C', 'I', 'A']) {
41
- if (!(k in m)) throw new InvalidVectorError(`missing metric: ${k}`);
42
- }
43
- // Validate values.
44
- if (!(m.AV in AV)) throw new InvalidVectorError(`invalid AV: ${m.AV}`);
45
- if (!(m.AC in AC)) throw new InvalidVectorError(`invalid AC: ${m.AC}`);
46
- if (!(m.PR in { N: 1, L: 1, H: 1 })) throw new InvalidVectorError(`invalid PR: ${m.PR}`);
47
- if (!(m.UI in { N: 1, R: 1 })) throw new InvalidVectorError(`invalid UI: ${m.UI}`);
48
- if (!(m.S in { U: 1, C: 1 })) throw new InvalidVectorError(`invalid S: ${m.S}`);
49
- for (const k of ['C', 'I', 'A']) {
50
- if (!(m[k] in CIA)) throw new InvalidVectorError(`invalid ${k}: ${m[k]}`);
51
- }
52
- // Scope C requires PR/UI to be in the {N,L,H}/{N,R} sets.
53
- if (m.S === 'C' && !(m.PR in { N: 1, L: 1, H: 1 })) {
54
- throw new InvalidVectorError(`invalid PR for scope C: ${m.PR}`);
55
- }
56
- return m;
57
- }
58
-
59
- // --- formula ------------------------------------------------------------
60
-
61
- function roundUpTo1Decimal(n) {
62
- // CVSS rounds UP to 1 decimal place. JS banker rounding rounds half to
63
- // even, which is wrong for CVSS — we use ceiling-to-1-decimal.
64
- return Math.ceil(n * 10) / 10;
65
- }
66
-
67
- function compute(vector) {
68
- const m = parse(vector);
69
- const scopeChanged = m.S === 'C';
70
- const PR = scopeChanged ? PR_C[m.PR] : PR_U[m.PR];
71
- const UI = scopeChanged ? UI_C[m.UI] : UI_U[m.UI];
72
-
73
- // Impact.
74
- const issBase = 1 - ((1 - CIA[m.C]) * (1 - CIA[m.I]) * (1 - CIA[m.A]));
75
- let impact = scopeChanged
76
- ? 7.52 * (issBase - 0.029) - 3.25 * Math.pow(issBase - 0.02, 15)
77
- : 6.42 * issBase;
78
- if (impact < 0) impact = 0;
79
- impact = roundUpTo1Decimal(impact);
80
-
81
- // Exploitability.
82
- const exploit = 8.22 * AV[m.AV] * AC[m.AC] * PR * UI;
83
- const explRounded = roundUpTo1Decimal(exploit);
84
-
85
- // Base score.
86
- let base;
87
- if (impact <= 0) {
88
- base = 0;
89
- } else if (scopeChanged) {
90
- base = 1.08 * (impact + explRounded);
91
- } else {
92
- base = impact + explRounded;
93
- }
94
- base = roundUpTo1Decimal(base);
95
- if (base > 10) base = 10;
96
-
97
- return { score: base, severity: severityFromScore(base) };
98
- }
99
-
100
- function severityFromScore(score) {
101
- if (score === 0) return 'None';
102
- if (score < 4.0) return 'Low';
103
- if (score < 7.0) return 'Medium';
104
- if (score < 9.0) return 'High';
105
- return 'Critical';
106
- }
107
-
108
- module.exports = { compute, severityFromScore, parse, InvalidVectorError };
@@ -1,125 +0,0 @@
1
- 'use strict';
2
-
3
- // detect.js — cache-aware detector for external pentest tools.
4
- //
5
- // detectTools(names, { cacheDir }) -> { name: { present, path?, version? } }
6
- // - present = false when the tool is not on PATH (the common case for users
7
- // who haven't installed the toolchain yet). detectTools NEVER throws on
8
- // a missing tool — the calling skill is expected to degrade gracefully.
9
- // - path = full path to the binary (when present).
10
- // - version = best-effort version string from `<bin> --version`; null if
11
- // the version probe failed (timeout, non-zero exit, no output).
12
- //
13
- // The result is cached at <cacheDir>/.tools.json so a long pipeline
14
- // (recon -> enumerate -> exploit -> report) calls `command -v` at most
15
- // once per tool per session. The overlay is single-threaded per
16
- // invocation, so we don't lock the cache file.
17
-
18
- const fs = require('node:fs');
19
- const path = require('node:path');
20
- const { execFileSync, spawnSync } = require('node:child_process');
21
-
22
- const CACHE_FILENAME = '.tools.json';
23
- const VERSION_TIMEOUT_MS = 2000;
24
-
25
- function cachePath(cacheDir) {
26
- return path.join(cacheDir || path.join(process.cwd(), '.wize', 'security'), CACHE_FILENAME);
27
- }
28
-
29
- function readCache(cacheDir) {
30
- const p = cachePath(cacheDir);
31
- if (!fs.existsSync(p)) return {};
32
- try {
33
- return JSON.parse(fs.readFileSync(p, 'utf8'));
34
- } catch (_) {
35
- return {};
36
- }
37
- }
38
-
39
- function writeCache(cacheDir, data) {
40
- const dir = cacheDir || path.join(process.cwd(), '.wize', 'security');
41
- try {
42
- fs.mkdirSync(dir, { recursive: true });
43
- fs.writeFileSync(cachePath(cacheDir), JSON.stringify(data, null, 2), 'utf8');
44
- } catch (_) {
45
- // best-effort; a write failure does not invalidate the in-memory result
46
- }
47
- }
48
-
49
- function which(name) {
50
- // Use `command -v` (POSIX) — returns 0 and prints the path if found.
51
- // Falls back to `which` for systems without `command` (Windows cmd).
52
- try {
53
- const r = spawnSync('command', ['-v', name], { encoding: 'utf8', timeout: 1000 });
54
- if (r.status === 0 && r.stdout) {
55
- return r.stdout.split('\n')[0].trim();
56
- }
57
- } catch (_) { /* fall through */ }
58
- try {
59
- const r = spawnSync('which', [name], { encoding: 'utf8', timeout: 1000 });
60
- if (r.status === 0 && r.stdout) return r.stdout.split('\n')[0].trim();
61
- } catch (_) { /* fall through */ }
62
- return null;
63
- }
64
-
65
- function probeVersion(binPath) {
66
- // Try the most common version flags in order. Each is a separate probe;
67
- // a failure is non-fatal (we return null).
68
- const flags = ['--version', '-version', '-V', 'version'];
69
- for (const f of flags) {
70
- try {
71
- const out = execFileSync(binPath, [f], {
72
- encoding: 'utf8',
73
- timeout: VERSION_TIMEOUT_MS,
74
- stdio: ['ignore', 'pipe', 'ignore']
75
- });
76
- const first = (out || '').split('\n')[0].trim();
77
- if (first) return first.slice(0, 120);
78
- } catch (_) {
79
- // try next flag
80
- }
81
- }
82
- return null;
83
- }
84
-
85
- function probeOne(name) {
86
- const p = which(name);
87
- if (!p) return { present: false };
88
- return { present: true, path: p, version: probeVersion(p) };
89
- }
90
-
91
- // detectTools(names, opts?) -> { name: {present, path?, version?} }
92
- // opts.cacheDir: where to read/write the cache file (default .wize/security).
93
- function detectTools(names, opts = {}) {
94
- const cacheDir = opts.cacheDir;
95
- const cache = readCache(cacheDir);
96
- const out = {};
97
- let mutated = false;
98
-
99
- for (const name of names || []) {
100
- if (cache[name]) {
101
- out[name] = cache[name];
102
- continue;
103
- }
104
- const entry = probeOne(name);
105
- out[name] = entry;
106
- cache[name] = entry;
107
- mutated = true;
108
- }
109
-
110
- if (mutated) writeCache(cacheDir, cache);
111
- return out;
112
- }
113
-
114
- function clearToolCache(opts = {}) {
115
- const p = cachePath(opts.cacheDir);
116
- try {
117
- if (fs.existsSync(p)) fs.unlinkSync(p);
118
- } catch (_) { /* ignore */ }
119
- }
120
-
121
- module.exports = {
122
- detectTools,
123
- clearToolCache,
124
- CACHE_FILENAME
125
- };