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,227 +0,0 @@
1
- 'use strict';
2
-
3
- // run-osv.js — SAST dependencies via osv-scanner (primary) or grype (fallback).
4
- // Auto-detects common manifest files in the project root and emits findings
5
- // into sast.md (composing with secrets from run-gitleaks.js).
6
-
7
- const path = require('node:path');
8
- const fs = require('node:fs');
9
- const { execFileSync } = require('node:child_process');
10
-
11
- const { filterArgs } = require('../../../_shared/allowlist.js');
12
- const { writePartial, loadPartial } = require('../../../_shared/partial.js');
13
-
14
- const MANIFEST_FILES = [
15
- 'package.json', 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml',
16
- 'requirements.txt', 'Pipfile', 'Pipfile.lock', 'pyproject.toml', 'poetry.lock',
17
- 'go.mod', 'go.sum',
18
- 'Cargo.toml', 'Cargo.lock',
19
- 'composer.json', 'composer.lock',
20
- 'Gemfile', 'Gemfile.lock'
21
- ];
22
-
23
- function detectManifests(root) {
24
- const found = [];
25
- for (const m of MANIFEST_FILES) {
26
- if (fs.existsSync(path.join(root, m))) found.push(m);
27
- }
28
- return found;
29
- }
30
-
31
- function parseOsvReport(report) {
32
- // osv-scanner JSON shape (simplified): { results: [{ packages: [{ package: {name, version}, vulnerabilities: [{id, severity, cvss: {score}}] }] }] }
33
- const out = [];
34
- const results = report && report.results ? report.results : [];
35
- // Map a CVSS base score to a coarse severity label.
36
- const sevFromScore = s => {
37
- const n = parseFloat(s);
38
- if (isNaN(n)) return null;
39
- if (n === 0) return 'None';
40
- if (n < 4) return 'Low';
41
- if (n < 7) return 'Medium';
42
- if (n < 9) return 'High';
43
- return 'Critical';
44
- };
45
- for (const r of results) {
46
- for (const p of (r.packages || [])) {
47
- const name = p.package && p.package.name;
48
- const version = p.package && p.package.version;
49
- // osv-scanner v2 groups vulnerabilities and exposes a max_severity
50
- // (CVSS) + aliases (CVE ids) per group. Prefer that; fall back to
51
- // the raw vulnerabilities array for older shapes.
52
- const groups = Array.isArray(p.groups) ? p.groups : [];
53
- if (groups.length) {
54
- for (const g of groups) {
55
- const ids = g.aliases && g.aliases.length ? g.aliases : g.ids || [];
56
- const cve = ids.find(x => /^CVE-/.test(x)) || ids[0] || '?';
57
- const cvss = g.max_severity ? parseFloat(g.max_severity) : null;
58
- out.push({ package: name, version, cve, severity: sevFromScore(g.max_severity) || 'UNKNOWN', cvss });
59
- }
60
- } else {
61
- for (const v of (p.vulnerabilities || [])) {
62
- const cve = v.id || '?';
63
- const cvss = v.cvss && (typeof v.cvss === 'number' ? v.cvss : v.cvss.score);
64
- out.push({ package: name, version, cve, severity: sevFromScore(cvss) || 'UNKNOWN', cvss });
65
- }
66
- }
67
- }
68
- }
69
- return out;
70
- }
71
-
72
- function parseGrypeReport(report) {
73
- // grype JSON shape: { matches: [{ artifact: {name, version}, vulnerability: {id, severity, cvss:[{metrics:{baseScore}}]} }] }
74
- const out = [];
75
- for (const m of (report && report.matches ? report.matches : [])) {
76
- const name = m.artifact && m.artifact.name;
77
- const version = m.artifact && m.artifact.version;
78
- const v = m.vulnerability || {};
79
- const cve = v.id || '?';
80
- const severity = v.severity || 'UNKNOWN';
81
- let cvss = null;
82
- if (Array.isArray(v.cvss) && v.cvss[0] && v.cvss[0].metrics) {
83
- cvss = v.cvss[0].metrics.baseScore;
84
- } else if (typeof v.cvss === 'number') {
85
- cvss = v.cvss;
86
- }
87
- out.push({ package: name, version, cve, severity, cvss });
88
- }
89
- return out;
90
- }
91
-
92
- function renderDepsSection(findings) {
93
- if (!findings.length) return '_(nenhuma dep vulnerável encontrada)_';
94
- return findings.map(f => {
95
- const cvss = f.cvss != null ? ` cvss=${f.cvss}` : '';
96
- return `- **${f.package}@${f.version || '?'}** \`${f.cve}\` severity=${f.severity}${cvss}`;
97
- }).join('\n');
98
- }
99
-
100
- // runOsv({ securityDir, scope, active, execFn?, detectFn?, manifestRoot?, reportFilename? })
101
- async function runOsv(opts = {}) {
102
- const sec = opts.securityDir;
103
- const scope = opts.scope;
104
- const active = opts.active === true;
105
- // The project to scan is the parent of `.wize/security/`. Scripts run with
106
- // cwd = the kit, so default to the target repo, not process.cwd().
107
- const manifestRoot = opts.manifestRoot
108
- || (sec ? path.resolve(sec, '..', '..') : process.cwd());
109
- const osvReportName = 'osv-report.json';
110
- const grypeReportName = 'grype-report.json';
111
-
112
- const execFn = opts.execFn || ((bin, args) => {
113
- return execFileSync(bin, args, { encoding: 'utf8', timeout: 5 * 60 * 1000 });
114
- });
115
- const detectFn = opts.detectFn || require('../../../_shared/detect.js').detectTools;
116
-
117
- const tools = detectFn(['osv-scanner', 'grype'], { cacheDir: sec });
118
- const osvPresent = !!(tools['osv-scanner'] && tools['osv-scanner'].present);
119
- const grypePresent = !!(tools.grype && tools.grype.present);
120
-
121
- // No tools at all -> degraded.
122
- if (!osvPresent && !grypePresent) {
123
- mergeSast(sec, scope, active, tools, {
124
- degraded: '- deps: osv-scanner e grype ausentes — instale um dos dois e re-rode.'
125
- });
126
- return { ok: true, partialStatus: 'incomplete', tool: null, findings: [] };
127
- }
128
-
129
- // Manifest detection: warn if the project root has no known manifest.
130
- const manifests = detectManifests(manifestRoot);
131
- if (manifests.length === 0) {
132
- mergeSast(sec, scope, active, tools, {
133
- degraded: `- deps: nenhum manifesto encontrado em ${manifestRoot} (procurando package.json, requirements.txt, go.mod, Cargo.toml, pyproject.toml, composer.json, Gemfile).`
134
- });
135
- return { ok: true, partialStatus: 'incomplete', tool: null, findings: [] };
136
- }
137
-
138
- // Pick tool. Prefer osv-scanner; fallback to grype.
139
- let findings = [];
140
- let tool = null;
141
- if (osvPresent) {
142
- tool = 'osv-scanner';
143
- const reportPath = path.join(sec, osvReportName);
144
- // osv-scanner v2 needs explicit lockfiles (`-L <path>`); recursive
145
- // directory scan misses composer.lock/package-lock.json. We pass each
146
- // detected lockfile we found. Non-zero exit = vulns found (success).
147
- const LOCKFILES = ['composer.lock', 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml',
148
- 'requirements.txt', 'Pipfile.lock', 'poetry.lock', 'go.sum', 'Cargo.lock', 'Gemfile.lock'];
149
- const lockArgs = [];
150
- for (const lf of LOCKFILES) {
151
- if (fs.existsSync(path.join(manifestRoot, lf))) {
152
- lockArgs.push('-L', path.join(manifestRoot, lf));
153
- }
154
- }
155
- const args = lockArgs.length
156
- ? filterArgs('osv-scanner', ['scan', 'source', ...lockArgs, '--format', 'json', '--output-file', reportPath])
157
- : filterArgs('osv-scanner', ['scan', 'source', '-r', '--format', 'json', '--output-file', reportPath, manifestRoot]);
158
- try {
159
- execFn('osv-scanner', args, { timeout: 5 * 60 * 1000 });
160
- } catch (_) { /* vulns found -> non-zero exit; report still written */ }
161
- if (fs.existsSync(reportPath)) {
162
- try { findings = parseOsvReport(JSON.parse(fs.readFileSync(reportPath, 'utf8'))); }
163
- catch (_) { findings = []; }
164
- }
165
- } else if (grypePresent) {
166
- tool = 'grype';
167
- const reportPath = path.join(sec, grypeReportName);
168
- const args = filterArgs('grype', ['dir:' + manifestRoot, '-o', 'json']);
169
- execFn('grype', args, { timeout: 5 * 60 * 1000 });
170
- if (fs.existsSync(reportPath)) {
171
- try { findings = parseGrypeReport(JSON.parse(fs.readFileSync(reportPath, 'utf8'))); }
172
- catch (_) { findings = []; }
173
- }
174
- }
175
-
176
- mergeSast(sec, scope, active, tools, {
177
- deps: renderDepsSection(findings)
178
- });
179
- return { ok: true, partialStatus: 'complete', tool, findings };
180
- }
181
-
182
- function mergeSast(sec, scope, active, tools, update) {
183
- const existing = loadPartial({ securityDir: sec, phase: 'sast' });
184
- const sections = {};
185
- let mergedTools = Object.assign({}, tools);
186
- if (existing) {
187
- if (existing.body) {
188
- const re = /## ([a-z_]+)\n\n([\s\S]*?)(?=\n## |$)/g;
189
- let m;
190
- while ((m = re.exec(existing.body)) !== null) {
191
- sections[m[1]] = m[2].trim();
192
- }
193
- }
194
- if (existing.frontmatter && existing.frontmatter.tools) {
195
- mergedTools = Object.assign({}, existing.frontmatter.tools, tools);
196
- }
197
- }
198
- if (update.degraded) {
199
- sections.degraded_checks = sections.degraded_checks
200
- ? sections.degraded_checks + '\n' + update.degraded
201
- : update.degraded;
202
- }
203
- if (update.deps !== undefined) sections.deps = update.deps;
204
- const status = sections.degraded_checks ? 'incomplete' : 'complete';
205
- writePartial({
206
- securityDir: sec,
207
- phase: 'sast',
208
- mode: active ? 'active' : 'passive',
209
- scope,
210
- status,
211
- tools: mergedTools,
212
- sections
213
- });
214
- }
215
-
216
- module.exports = { runOsv, parseOsvReport, parseGrypeReport, detectManifests, MANIFEST_FILES };
217
-
218
- if (require.main === module) {
219
- require('../../../_shared/cli-runner.js').runFromArgv({
220
- fn: ({ securityDir, scopePath, active, manifestRoot, reportFilename } = {}) => {
221
- const { loadScope } = require('../../../_shared/scope-gate.js');
222
- const scope = loadScope(scopePath);
223
- return runOsv({ securityDir, scope, active, manifestRoot, reportFilename });
224
- },
225
- argMap: { 'securityDir': 'securityDir', 'scope': 'scopePath', 'active': 'active', 'manifestRoot': 'manifestRoot', 'reportFilename': 'reportFilename' }
226
- });
227
- }
@@ -1,162 +0,0 @@
1
- 'use strict';
2
-
3
- // run-recon.js — the nmap portion of the wize-sec-recon skill.
4
- // SAST (gitleaks, osv/grype) is implemented in E05 and lives in
5
- // scripts/run-sast.js (sibling). The orchestrator (wize-sec-pentest) and
6
- // any caller can invoke either script directly; this file only handles
7
- // recon.
8
-
9
- const path = require('node:path');
10
- const { execFileSync } = require('node:child_process');
11
-
12
- const { assertTargetInScope, ScopeError } = require('../../../_shared/scope-gate.js');
13
- const { filterArgs } = require('../../../_shared/allowlist.js');
14
- const { writePartial } = require('../../../_shared/partial.js');
15
-
16
- // Default argument list for nmap. filterArgs() will drop anything not in
17
- // the tool-allowlist, so this list is intentionally explicit and minimal.
18
- function defaultArgs(active) {
19
- const args = ['-Pn', '-T4'];
20
- if (active) args.push('-sV');
21
- else args.push('-sn'); // passive: ping scan only — no port scan, no service detection.
22
- return args;
23
- }
24
-
25
- // Parse a greppable nmap stdout into a markdown list. We only care about
26
- // lines that look like `PORT/PROTO SERVICE VERSION`. Ports whose service
27
- // nmap could not fingerprint (`?`, unknown, tcpwrapped, or empty version)
28
- // are flagged for manual investigation — an unidentified open port is a
29
- // medium-priority unknown, not just inventory.
30
- function parseNmapGreppable(stdout) {
31
- const lines = String(stdout || '').split('\n');
32
- const out = [];
33
- for (const line of lines) {
34
- const m = line.match(/^(\d+\/[a-z]+)\s+(\S+)\s+(.*)$/);
35
- if (!m) continue;
36
- const port = m[1];
37
- const service = m[2];
38
- const version = m[3].trim();
39
- const unidentified = /\?$/.test(service) || /^(unknown|tcpwrapped)$/i.test(service) || version === '';
40
- if (unidentified) {
41
- out.push(`- **${port}** \`${service}\` — ⚠️ serviço não identificado. **Investigar:** \`lsof -i :${port.split('/')[0]}\` · \`docker ps\` · \`ss -tulpn | grep ${port.split('/')[0]}\``);
42
- } else {
43
- out.push(`- **${port}** \`${service}\` — ${version}`);
44
- }
45
- }
46
- return out.join('\n');
47
- }
48
-
49
- // runRecon({ securityDir, scope, target, active, execFn?, detectFn? }) ->
50
- // { ok, partialStatus, mode }
51
- // dependencies are injectable for tests.
52
- async function runRecon(opts = {}) {
53
- const sec = opts.securityDir;
54
- const scope = opts.scope;
55
- const target = opts.target;
56
- const active = opts.active === true;
57
-
58
- const execFn = opts.execFn || ((bin, args, opt) => {
59
- return execFileSync(bin, args, { encoding: 'utf8', timeout: 60_000 });
60
- });
61
- const detectFn = opts.detectFn || require('../../../_shared/detect.js').detectTools;
62
-
63
- // Gate — propagates ScopeError if scope is invalid.
64
- const tools = detectFn(['nmap'], { cacheDir: sec });
65
- const nmapTool = tools.nmap || { present: false };
66
-
67
- // 1. nmap missing -> degraded partial, exit 0.
68
- if (!nmapTool.present) {
69
- writePartial({
70
- securityDir: sec,
71
- phase: 'recon',
72
- mode: active ? 'active' : 'passive',
73
- scope,
74
- status: 'incomplete',
75
- tools,
76
- sections: {
77
- degraded_checks: 'nmap ausente — instale nmap e re-rode a fase para resultados completos.'
78
- }
79
- });
80
- return { ok: true, partialStatus: 'incomplete', mode: active ? 'active' : 'passive' };
81
- }
82
-
83
- // 2. target out of scope -> degraded partial, ok=false (gate refused).
84
- const inScope = assertTargetInScope(scope, { host: target }, { refusalsDir: sec });
85
- if (!inScope) {
86
- writePartial({
87
- securityDir: sec,
88
- phase: 'recon',
89
- mode: active ? 'active' : 'passive',
90
- scope,
91
- status: 'incomplete',
92
- tools,
93
- sections: {
94
- degraded_checks: `target ${target} recusado pelo gate (host not in allowlist) — ver .wize/security/.refusals.log`
95
- }
96
- });
97
- return { ok: false, partialStatus: 'incomplete', mode: active ? 'active' : 'passive' };
98
- }
99
-
100
- // 3. happy path: filterArgs + execFile.
101
- const args = filterArgs('nmap', [...defaultArgs(active), target]);
102
- const out = execFn('nmap', args, { timeout: 60_000 });
103
- const portsText = parseNmapGreppable(out && out.stdout ? out.stdout : out);
104
- const body = portsText || '_(nmap returned no parseable ports)_';
105
-
106
- writePartial({
107
- securityDir: sec,
108
- phase: 'recon',
109
- mode: active ? 'active' : 'passive',
110
- scope,
111
- status: 'complete',
112
- tools,
113
- sections: { open_ports: body }
114
- });
115
- return { ok: true, partialStatus: 'complete', mode: active ? 'active' : 'passive' };
116
- }
117
-
118
- // --- CLI entrypoint ------------------------------------------------------
119
-
120
- function parseArgv(argv) {
121
- const out = { active: false, securityDir: null, scopePath: null, target: null };
122
- for (let i = 0; i < argv.length; i++) {
123
- const a = argv[i];
124
- if (a === '--active') out.active = true;
125
- else if (a === '--target' && argv[i + 1]) { out.target = argv[i + 1]; i++; }
126
- else if (a.startsWith('--target=')) out.target = a.slice('--target='.length);
127
- else if (a === '--scope' && argv[i + 1]) { out.scopePath = argv[i + 1]; i++; }
128
- else if (a.startsWith('--scope=')) out.scopePath = a.slice('--scope='.length);
129
- else if (a === '--securityDir' && argv[i + 1]) { out.securityDir = argv[i + 1]; i++; }
130
- else if (a.startsWith('--securityDir=')) out.securityDir = a.slice('--securityDir='.length);
131
- }
132
- if (!out.securityDir) out.securityDir = path.join(process.cwd(), '.wize', 'security');
133
- if (!out.scopePath) out.scopePath = path.join(process.cwd(), '.wize', 'security', 'scope.md');
134
- if (!out.target) {
135
- // Default to scope.md dast_target.url host if available.
136
- out.target = 'localhost';
137
- }
138
- return out;
139
- }
140
-
141
- async function main() {
142
- const args = parseArgv(process.argv.slice(2));
143
- const { loadScope } = require('../../../_shared/scope-gate.js');
144
- const scope = loadScope(args.scopePath);
145
- const r = await runRecon({
146
- securityDir: args.securityDir,
147
- scope,
148
- target: args.target,
149
- active: args.active
150
- });
151
- console.log(`recon: partial_status=${r.partialStatus} mode=${r.mode}`);
152
- process.exit(r.ok ? 0 : 1);
153
- }
154
-
155
- if (require.main === module) {
156
- main().catch(err => {
157
- console.error('✖ wize-sec-recon:', err && err.message ? err.message : err);
158
- process.exit(2);
159
- });
160
- }
161
-
162
- module.exports = { runRecon, defaultArgs, parseNmapGreppable };
@@ -1,37 +0,0 @@
1
- ---
2
-
3
- code: wize-sec-recon
4
- description: "Use quando o scope de segurança estiver autorizado e precisar executar reconhecimento passivo (nmap) nos alvos."
5
- name: wize-sec-recon
6
- overlay: security
7
- module: security-overlay
8
- owner: wize-sec-red-teamer # Natasha Romanoff
9
- status: ready
10
- ---
11
-
12
- # wize-sec-recon — Recon (nmap)
13
-
14
- Runs nmap against the targets in the `scope.md` allowlist and writes `recon.md`. **Default passive** (ping scan only); `--active` enables `-sV` service detection.
15
-
16
- ## Usage
17
-
18
- ```bash
19
- /wize-sec-recon
20
- /wize-sec-recon --active
21
- /wize-sec-recon --target=staging.example.internal
22
- ```
23
-
24
- ## Behavior
25
-
26
- - Loads `.wize/security/scope.md` first; aborts loudly on invalid scope (HASH_MISMATCH / MISSING_FIELDS).
27
- - Detects nmap via `command -v`. If absent, writes a `partial_status: incomplete` recon.md with a `degraded_checks` section and exits 0 — the pipeline continues.
28
- - Calls `assertTargetInScope` for the target. Out-of-scope targets produce an `incomplete` partial and a refusal entry in `.refusals.log`; nmap is **not** invoked.
29
- - Active vs passive flag set is recorded in the partial's `mode:` frontmatter.
30
- - The SAST portion of recon (gitleaks, osv/grype) is implemented in a sibling script `scripts/run-sast.js` and is invoked separately or by the orchestrator — see E05.
31
-
32
- ## Output
33
-
34
- - `.wize/security/recon.md` — partial with `## open_ports` (or `## degraded_checks` on missing tool / out-of-scope target).
35
- - `.wize/security/.refusals.log` — appended on out-of-scope targets.
36
-
37
- Exits 0 on success or graceful degradation; 1 when the gate refused the target; 2 on scope error.