reasonweave 0.0.0-stage → 1.3.2
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.
- package/AGENTS.md +101 -0
- package/INSTALL.md +258 -0
- package/README.md +280 -2
- package/bin/lab.mjs +888 -0
- package/constitution.md +55 -0
- package/docs/CONSUMER-PROMPTS.md +474 -0
- package/docs/backlogs/01-forward-wait-self-detach.md +18 -0
- package/docs/backlogs/02-decouple-wait-and-daemon-for-agent-hosts.md +35 -0
- package/docs/backlogs/03-baton-wait-multi-id-lightweight-pubsub.md +34 -0
- package/docs/backlogs/04-adr-cross-repo-automated-dispatch-boundary.md +19 -0
- package/docs/backlogs/05-feat-units-worktree-isolation-engine.md +23 -0
- package/docs/backlogs/06-feat-blind-audit-automated-clean-runner.md +22 -0
- package/docs/backlogs/07-feat-attention-throttle-silent-pipe.md +23 -0
- package/docs/backlogs/08-future-units-shadow-ledger.md +22 -0
- package/docs/backlogs/09-feat-agent-baton-core-convergence-and-resilience.md +42 -0
- package/docs/backlogs/10-feat-anti-orphan-deterministic-wiring-governance.md +35 -0
- package/docs/backlogs/11-perf-orphan-index-fs-read.md +16 -0
- package/docs/backlogs/12-feat-vibe-security-anti-suppression-and-orphan-deps.md +43 -0
- package/docs/backlogs/13-feat-sdd-reppit-tiered-guardrails.md +40 -0
- package/docs/backlogs/14-feat-universal-cli-contract-and-hermetic-test-fixtures.md +48 -0
- package/docs/backlogs/15-feat-reasonweave-rebranding-and-doc-code-synchronization-invariant.md +44 -0
- package/docs/backlogs/16-feat-micro-engineering-skills-and-sdd-baton-fusion.md +52 -0
- package/docs/codegraph-readiness-check.md +49 -0
- package/group/architecture/adr/0001-handoff-async-wait-and-reactive-wakeup.md +87 -0
- package/group/architecture/adr/0002-de-ritualize-handoff-prompt-for-intra-repo.md +53 -0
- package/group/architecture/adr/0003-attention-throttle-and-workspace-driver.md +65 -0
- package/group/architecture/adr/0004-spec-guard-and-drift-prevention.md +90 -0
- package/group/architecture/adr/0005-global-orphan-scavenger-and-read-only-invariants.md +94 -0
- package/group/architecture/adr/0006-triad-engineering-defense-and-mutation-sensitivity.md +68 -0
- package/group/architecture/adr/0007-agent-baton-state-machine-defense-and-workspace-jail-spec.md +86 -0
- package/group/architecture/adr/0008-agent-baton-core-convergence-and-heterogeneous-session-resilience.md +133 -0
- package/group/architecture/adr/0009-anti-orphan-deterministic-wiring-governance-and-federated-guardrails.md +108 -0
- package/group/architecture/adr/0010-agent-baton-identity-security-cryptographic-credentials-and-prompt-anti-confusion.md +119 -0
- package/group/architecture/adr/0011-vibe-security-anti-suppression-and-dependency-reachability.md +161 -0
- package/group/architecture/adr/0012-spec-driven-development-reppit-and-tiered-guardrails.md +130 -0
- package/group/architecture/adr/0013-universal-cli-contract-hermetic-testing-and-defensive-probes.md +110 -0
- package/group/architecture/adr/0014-reasonweave-rebranding-and-doc-code-synchronization-invariant.md +108 -0
- package/group/architecture/adr/0015-micro-engineering-skills-and-dual-core-gate-invariant.md +127 -0
- package/group/architecture/adr/INDEX.md +29 -0
- package/group/architecture/adr/templates/adr-template.md +33 -0
- package/group/architecture/dependency-graph.md +60 -0
- package/group/contracts/npm-packaging.md +69 -0
- package/group/product/intent.md +24 -0
- package/package.json +93 -4
- package/scripts/sync-all-consumers.mjs +174 -0
- package/specs/RFC-20261110-SPEC-GUARD-UNIT.md +353 -0
- package/specs/templates/01-research.md.template +23 -0
- package/specs/templates/02-proposals.md.template +22 -0
- package/specs/templates/03-spec.md.template +33 -0
- package/specs/templates/04-tasks.md.template +29 -0
- package/specs/templates/05-evidence.md.template +29 -0
- package/specs/templates/README.md +26 -0
- package/units/adr/AGENTS.md +85 -0
- package/units/adr/CHANGELOG.md +20 -0
- package/units/adr/README.md +88 -0
- package/units/adr/VERSION.md +10 -0
- package/units/adr/docs/existing-project-prompt.md +24 -0
- package/units/adr/docs/new-project-prompt.md +36 -0
- package/units/adr/scripts/adr-init.sh +101 -0
- package/units/adr/templates/INDEX.md +19 -0
- package/units/adr/templates/adr-frozen.md +33 -0
- package/units/adr/templates/adr-light.md +56 -0
- package/units/adr/templates/adr-standard.md +61 -0
- package/units/backlog/AGENTS.md +53 -0
- package/units/backlog/AUTONOMOUS-GOVERNANCE.md +98 -0
- package/units/backlog/CHANGELOG.md +37 -0
- package/units/backlog/README.md +124 -0
- package/units/backlog/VERSION.md +11 -0
- package/units/backlog/docs/existing-project-ironrules-prompt.md +31 -0
- package/units/backlog/docs/existing-project-prompt.md +24 -0
- package/units/backlog/docs/new-project-prompt.md +19 -0
- package/units/backlog/templates/entry.md +39 -0
- package/units/backlog/templates/project-ironrules.md +36 -0
- package/units/handoffs/AGENT-GUIDE.md +118 -0
- package/units/handoffs/AGENTS.md +28 -0
- package/units/handoffs/CHANGELOG.md +498 -0
- package/units/handoffs/CLAUDE.md +28 -0
- package/units/handoffs/COMMANDS.md +187 -0
- package/units/handoffs/DESIGN.md +74 -0
- package/units/handoffs/README.md +456 -0
- package/units/handoffs/RESPONSE-TEMPLATE.md +138 -0
- package/units/handoffs/VERSION.md +1 -0
- package/units/handoffs/handoff-status.mjs +1017 -0
- package/units/handoffs/handoff.mjs +5675 -0
- package/units/orphan/CHANGELOG.md +118 -0
- package/units/orphan/DESIGN.md +484 -0
- package/units/orphan/README.md +143 -0
- package/units/orphan/VERSION.md +1 -0
- package/units/orphan/adapters/android/index.mjs +140 -0
- package/units/orphan/adapters/python/index.mjs +232 -0
- package/units/orphan/adapters/web/index.mjs +280 -0
- package/units/orphan/bin/lab-orphan.mjs +298 -0
- package/units/orphan/core/blob-reader.mjs +142 -0
- package/units/orphan/core/classifier.mjs +261 -0
- package/units/orphan/core/cleaner.mjs +166 -0
- package/units/orphan/core/diff-checker.mjs +341 -0
- package/units/orphan/core/inverted-index.mjs +124 -0
- package/units/orphan/core/orphan-deps.mjs +192 -0
- package/units/orphan/core/protocol-s1-s3.mjs +194 -0
- package/units/orphan/core/solver.mjs +217 -0
- package/units/orphan/index.mjs +105 -0
- package/units/orphan/templates/ci/orphan-guard.yml +36 -0
- package/units/orphan/templates/pre-commit.d/30-orphan-guard +34 -0
- package/units/orphan/templates/wiring/README.md +51 -0
- package/units/orphan/templates/wiring/miniprogram-route-guard.js.template +80 -0
- package/units/orphan/templates/wiring/pre-commit-node.sh.template +73 -0
- package/units/orphan/templates/wiring/project-agents-gemini-templates.md +60 -0
- package/units/orphan/templates/wiring/python-parity-test.py.template +100 -0
- package/units/orphan/templates/wiring/rust-exhaustive-match.md +65 -0
- package/units/orphan/templates/wiring/swift-periphery.md +56 -0
- package/units/orphan/tests/adapters.test.mjs +243 -0
- package/units/orphan/tests/orphan-deps.test.mjs +131 -0
- package/units/orphan/tests/phase3-gates.test.mjs +135 -0
- package/units/playbook/README.md +106 -0
- package/units/playbook/ZSPEC-AGENT-GUIDE.md +99 -0
- package/units/playbook/docs/01-architecture.md +99 -0
- package/units/playbook/docs/02-bootstrap.md +126 -0
- package/units/playbook/docs/03-units.md +91 -0
- package/units/playbook/docs/04-constitution.md +113 -0
- package/units/playbook/docs/05-adr.md +33 -0
- package/units/playbook/docs/06-spec-kit.md +76 -0
- package/units/playbook/docs/07-backlog.md +30 -0
- package/units/playbook/docs/08-codegraph.md +79 -0
- package/units/playbook/docs/09-skills.md +101 -0
- package/units/playbook/docs/10-handoff.md +72 -0
- package/units/playbook/docs/11-evidence.md +163 -0
- package/units/playbook/docs/12-gates.md +124 -0
- package/units/playbook/docs/13-parallel.md +115 -0
- package/units/playbook/docs/14-dependency-graph.md +86 -0
- package/units/playbook/docs/15-memory.md +153 -0
- package/units/playbook/docs/16-change-control.md +121 -0
- package/units/playbook/docs/17-prompts.md +121 -0
- package/units/playbook/docs/18-shift-left.md +97 -0
- package/units/playbook/docs/19-anti-orphan-vertical-slicing.md +102 -0
- package/units/playbook/docs/20-vibe-security-and-anti-suppression.md +88 -0
- package/units/playbook/docs/21-spec-driven-reppit-closed-loop.md +88 -0
- package/units/playbook/examples/owisel.md +80 -0
- package/units/playbook/references/Agent-Engineering-Framework-AEF-v1.0.md +2033 -0
- package/units/playbook/references/links.md +103 -0
- package/units/playbook/templates/AGENTS.root.md +44 -0
- package/units/playbook/templates/AGENTS.unit.md +52 -0
- package/units/playbook/templates/adr/INDEX.md +17 -0
- package/units/playbook/templates/adr/NNNN-template.md +56 -0
- package/units/playbook/templates/backlogs/entry.md +30 -0
- package/units/playbook/templates/constitution.md +93 -0
- package/units/playbook/templates/evidence/README.md +36 -0
- package/units/playbook/templates/group/architecture/dependency-graph.md +48 -0
- package/units/playbook/templates/group/architecture/system.md +59 -0
- package/units/playbook/templates/group/contracts/api.md +67 -0
- package/units/playbook/templates/group/product/intent.md +30 -0
- package/units/playbook/templates/group/product/requirements.md +48 -0
- package/units/playbook/templates/unit-skeleton/README.md +35 -0
- package/units/preflight/AGENTS.md +45 -0
- package/units/preflight/CHANGELOG.md +55 -0
- package/units/preflight/INSTALL.md +65 -0
- package/units/preflight/README.md +104 -0
- package/units/preflight/VERSION.md +3 -0
- package/units/preflight/docs/audit-requirements.md +114 -0
- package/units/preflight/docs/existing-project-prompt.md +25 -0
- package/units/preflight/docs/new-project-prompt.md +25 -0
- package/units/preflight/docs/transfers/CONSUMER-INSTALL.md +40 -0
- package/units/preflight/docs/transfers/CONSUMER-SELFCHECK.md +51 -0
- package/units/preflight/docs/transfers/README.md +39 -0
- package/units/preflight/docs/transfers/prospero.md +26 -0
- package/units/preflight/templates/check.sh +43 -0
- package/units/preflight/templates/pre-commit +55 -0
- package/units/preflight/templates/pre-commit.d/20-preflight +15 -0
- package/units/preflight/templates/preflight.conf.example +21 -0
- package/units/preflight/templates/preflight.sh +189 -0
- package/units/preflight/templates/wrap-up.md +9 -0
- package/units/review-gate/AGENTS.md +42 -0
- package/units/review-gate/CHANGELOG.md +58 -0
- package/units/review-gate/README.md +118 -0
- package/units/review-gate/VERSION.md +3 -0
- package/units/review-gate/clean-runner.mjs +350 -0
- package/units/review-gate/docs/existing-project-prompt.md +28 -0
- package/units/review-gate/docs/new-project-prompt.md +38 -0
- package/units/review-gate/docs/transfers/iggle.md +34 -0
- package/units/review-gate/docs/transfers/prospero.md +35 -0
- package/units/review-gate/docs/transfers/swoop.md +36 -0
- package/units/review-gate/docs/transfers/yiqiyihuihua.md +35 -0
- package/units/review-gate/templates/.semgrepignore +37 -0
- package/units/review-gate/templates/pre-commit +130 -0
- package/units/review-gate/templates/scan.sh +158 -0
- package/units/skills/AGENTS.md +17 -0
- package/units/skills/CHANGELOG.md +18 -0
- package/units/skills/README.md +63 -0
- package/units/skills/VERSION.md +1 -0
- package/units/skills/bin/review-package.mjs +99 -0
- package/units/skills/bin/task-brief.mjs +102 -0
- package/units/skills/catalog/brainstorming/SKILL.md +75 -0
- package/units/skills/catalog/brainstorming/references/design-doc-template.md +28 -0
- package/units/skills/catalog/systematic-debugging/SKILL.md +101 -0
- package/units/skills/catalog/systematic-debugging/references/root-cause-tracing.md +23 -0
- package/units/skills/catalog/test-driven-development/SKILL.md +88 -0
- package/units/skills/catalog/test-driven-development/references/writing-good-tests.md +13 -0
- package/units/skills/catalog/verification-before-completion/SKILL.md +73 -0
- package/units/skills/skills.mjs +181 -0
- package/units/skills/tests/pipeline.test.mjs +131 -0
- package/units/skills/tests/skill-contract.test.mjs +67 -0
- package/units/skills/tests/skills-cli.test.mjs +107 -0
- package/units/spec-guard/AGENTS.md +43 -0
- package/units/spec-guard/CHANGELOG.md +88 -0
- package/units/spec-guard/README.md +148 -0
- package/units/spec-guard/VERSION.md +1 -0
- package/units/spec-guard/bin/spec-guard.mjs +431 -0
- package/units/spec-guard/core/adr-parser.mjs +540 -0
- package/units/spec-guard/core/matrix-checker.mjs +587 -0
- package/units/spec-guard/core/mutation-runner.mjs +267 -0
- package/units/spec-guard/core/scanner.mjs +333 -0
- package/units/spec-guard/core/telemetry_authenticator.mjs +484 -0
- package/units/spec-guard/core/wiring_tracer.mjs +306 -0
- package/units/spec-guard/templates/annotations/ContractOnly.kt +19 -0
- package/units/spec-guard/templates/annotations/Invariant.kt +16 -0
- package/units/spec-guard/templates/annotations/invariant.go +19 -0
- package/units/spec-guard/templates/annotations/invariant.py +38 -0
- package/units/spec-guard/templates/annotations/invariant.ts +39 -0
- package/units/spec-guard/templates/ci/spec-guard-audit.yml +23 -0
- package/units/spec-guard/templates/pre-commit.d/15-spec-guard +72 -0
- package/units/spec-guard/templates/spec-matrix.overlay.yml +70 -0
- package/units/spec-guard/tests/spec-guard.test.mjs +716 -0
- package/units/spec-guard/tests/telemetry_authenticator.test.mjs +633 -0
- package/units/worktree/AGENTS.md +22 -0
- package/units/worktree/CHANGELOG.md +14 -0
- package/units/worktree/README.md +65 -0
- package/units/worktree/VERSION.md +1 -0
- package/units/worktree/worktree.mjs +352 -0
- package//344/275/277/347/224/250/350/257/264/346/230/216.md +322 -0
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web / TypeScript Stack Adapter for units/orphan
|
|
3
|
+
*
|
|
4
|
+
* 核心特性:
|
|
5
|
+
* 1. package.json entrypoints 自动保护 (main, module, exports, bin);
|
|
6
|
+
* 2. ESM / CJS export 符号提取 (named exports, default export, types);
|
|
7
|
+
* 3. 框架专属入口保护 (Next.js pages/app, Astro, Vite index.html);
|
|
8
|
+
* 4. 内部未引用 export 精准判死 (CONFIRMED_ORPHAN);
|
|
9
|
+
* 5. 动态 import() / require() 表达式 Fail-Closed 降级。
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
|
|
14
|
+
export class WebAdapter {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.id = 'web';
|
|
17
|
+
this.name = 'Web / TypeScript Stack Adapter';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 探测是否为 Web / TS / JS 工程
|
|
22
|
+
* @param {import('../../core/blob-reader.mjs').BlobReader} reader
|
|
23
|
+
* @returns {boolean}
|
|
24
|
+
*/
|
|
25
|
+
detect(reader) {
|
|
26
|
+
const blobs = reader.listBlobs();
|
|
27
|
+
return blobs.some(b =>
|
|
28
|
+
b.path === 'package.json' ||
|
|
29
|
+
b.path === 'tsconfig.json' ||
|
|
30
|
+
b.path.endsWith('.ts') ||
|
|
31
|
+
b.path.endsWith('.tsx') ||
|
|
32
|
+
b.path.endsWith('.jsx')
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 提取 Web/TS 根入口文件集合 (从 package.json 与常见框架中解析)
|
|
38
|
+
* @param {import('../../core/blob-reader.mjs').BlobReader} reader
|
|
39
|
+
* @returns {Array<{ name: string, path: string, type: string }>}
|
|
40
|
+
*/
|
|
41
|
+
extractEntrypoints(reader) {
|
|
42
|
+
const entrypoints = [];
|
|
43
|
+
const pkgBlob = reader.listBlobs(p => {
|
|
44
|
+
const pathStr = typeof p === 'string' ? p : (p && p.path ? p.path : '');
|
|
45
|
+
return pathStr === 'package.json' || pathStr.endsWith('/package.json');
|
|
46
|
+
})[0];
|
|
47
|
+
|
|
48
|
+
if (pkgBlob) {
|
|
49
|
+
try {
|
|
50
|
+
const pkg = JSON.parse(reader.readBlobText(pkgBlob.path));
|
|
51
|
+
// 1. main / module
|
|
52
|
+
if (pkg.main) entrypoints.push({ name: 'pkg.main', path: this._normalizeEntryPath(pkg.main), type: 'PackageMain' });
|
|
53
|
+
if (pkg.module) entrypoints.push({ name: 'pkg.module', path: this._normalizeEntryPath(pkg.module), type: 'PackageModule' });
|
|
54
|
+
|
|
55
|
+
// 2. bin
|
|
56
|
+
if (pkg.bin) {
|
|
57
|
+
if (typeof pkg.bin === 'string') {
|
|
58
|
+
entrypoints.push({ name: 'pkg.bin', path: this._normalizeEntryPath(pkg.bin), type: 'PackageBin' });
|
|
59
|
+
} else if (typeof pkg.bin === 'object') {
|
|
60
|
+
for (const [k, v] of Object.entries(pkg.bin)) {
|
|
61
|
+
entrypoints.push({ name: `pkg.bin.${k}`, path: this._normalizeEntryPath(v), type: 'PackageBin' });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// 3. exports
|
|
67
|
+
if (pkg.exports) {
|
|
68
|
+
this._extractExportEntries(pkg.exports, entrypoints);
|
|
69
|
+
}
|
|
70
|
+
} catch {}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// 4. 框架路由入口
|
|
74
|
+
const routeBlobs = reader.listBlobs(p =>
|
|
75
|
+
p.startsWith('pages/') ||
|
|
76
|
+
p.startsWith('src/pages/') ||
|
|
77
|
+
p.startsWith('app/') ||
|
|
78
|
+
p.startsWith('src/app/') ||
|
|
79
|
+
p === 'index.html'
|
|
80
|
+
);
|
|
81
|
+
for (const b of routeBlobs) {
|
|
82
|
+
entrypoints.push({ name: b.path, path: b.path, type: 'FrameworkRouteEntry' });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return entrypoints;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
_normalizeEntryPath(p) {
|
|
89
|
+
if (!p) return '';
|
|
90
|
+
return p.startsWith('./') ? p.slice(2) : p;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
_extractExportEntries(exp, list) {
|
|
94
|
+
if (typeof exp === 'string') {
|
|
95
|
+
list.push({ name: 'pkg.exports', path: this._normalizeEntryPath(exp), type: 'PackageExport' });
|
|
96
|
+
} else if (typeof exp === 'object' && exp !== null) {
|
|
97
|
+
for (const [k, v] of Object.entries(exp)) {
|
|
98
|
+
if (typeof v === 'string') {
|
|
99
|
+
list.push({ name: `pkg.exports.${k}`, path: this._normalizeEntryPath(v), type: 'PackageExport' });
|
|
100
|
+
} else if (typeof v === 'object' && v !== null) {
|
|
101
|
+
// import / require / default 映射
|
|
102
|
+
for (const target of Object.values(v)) {
|
|
103
|
+
if (typeof target === 'string') {
|
|
104
|
+
list.push({ name: `pkg.exports.${k}`, path: this._normalizeEntryPath(target), type: 'PackageExport' });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* 提取 Web/TS 符号与 export 清单
|
|
114
|
+
* @param {import('../../core/blob-reader.mjs').BlobReader} reader
|
|
115
|
+
* @returns {Array<{
|
|
116
|
+
* id: string,
|
|
117
|
+
* name: string,
|
|
118
|
+
* symbol: string,
|
|
119
|
+
* primaryPath: string,
|
|
120
|
+
* lineNo: number,
|
|
121
|
+
* kind: string,
|
|
122
|
+
* isProtected?: boolean,
|
|
123
|
+
* protectionReason?: string
|
|
124
|
+
* }>}
|
|
125
|
+
*/
|
|
126
|
+
extractCandidates(reader) {
|
|
127
|
+
const entryList = this.extractEntrypoints(reader);
|
|
128
|
+
const entryPaths = new Set(entryList.map(e => e.path));
|
|
129
|
+
|
|
130
|
+
const sourceBlobs = reader.listBlobs(p =>
|
|
131
|
+
(p.endsWith('.ts') || p.endsWith('.tsx') || p.endsWith('.js') || p.endsWith('.jsx') || p.endsWith('.mjs')) &&
|
|
132
|
+
!p.includes('/node_modules/') &&
|
|
133
|
+
!p.includes('/dist/') &&
|
|
134
|
+
!p.includes('/build/') &&
|
|
135
|
+
!p.includes('/.next/')
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
const candidates = [];
|
|
139
|
+
|
|
140
|
+
for (const b of sourceBlobs) {
|
|
141
|
+
const text = reader.readBlobText(b.path);
|
|
142
|
+
if (!text) continue;
|
|
143
|
+
|
|
144
|
+
const lines = text.split(/\r?\n/);
|
|
145
|
+
const isEntryFile = entryPaths.has(b.path);
|
|
146
|
+
|
|
147
|
+
for (let i = 0; i < lines.length; i++) {
|
|
148
|
+
const line = lines[i];
|
|
149
|
+
const lineNo = i + 1;
|
|
150
|
+
const trimmed = line.trim();
|
|
151
|
+
|
|
152
|
+
if (!trimmed.startsWith('export ') && !trimmed.startsWith('module.exports') && !trimmed.startsWith('exports.')) {
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// 1. export function / class
|
|
157
|
+
const funcOrClassMatch = trimmed.match(/^export\s+(?:async\s+)?(function|class)\s+([a-zA-Z0-9_$]+)/);
|
|
158
|
+
if (funcOrClassMatch) {
|
|
159
|
+
const kind = funcOrClassMatch[1];
|
|
160
|
+
const name = funcOrClassMatch[2];
|
|
161
|
+
candidates.push({
|
|
162
|
+
id: `orphan-web-${kind}-${path.basename(b.path).replace(/\.[^.]+$/, '')}-${name}`,
|
|
163
|
+
name,
|
|
164
|
+
symbol: name,
|
|
165
|
+
primaryPath: b.path,
|
|
166
|
+
qualifierPaths: [b.path],
|
|
167
|
+
lineNo,
|
|
168
|
+
kind: `export_${kind}`,
|
|
169
|
+
isProtected: isEntryFile,
|
|
170
|
+
protectionReason: isEntryFile ? 'Protected: Exported from package.json/framework entrypoint' : undefined,
|
|
171
|
+
});
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// 2. export const / let / var
|
|
176
|
+
const varMatch = trimmed.match(/^export\s+(?:const|let|var)\s+([a-zA-Z0-9_$]+)\s*[:=]/);
|
|
177
|
+
if (varMatch) {
|
|
178
|
+
const name = varMatch[1];
|
|
179
|
+
candidates.push({
|
|
180
|
+
id: `orphan-web-var-${path.basename(b.path).replace(/\.[^.]+$/, '')}-${name}`,
|
|
181
|
+
name,
|
|
182
|
+
symbol: name,
|
|
183
|
+
primaryPath: b.path,
|
|
184
|
+
qualifierPaths: [b.path],
|
|
185
|
+
lineNo,
|
|
186
|
+
kind: 'export_variable',
|
|
187
|
+
isProtected: isEntryFile,
|
|
188
|
+
protectionReason: isEntryFile ? 'Protected: Exported from package.json/framework entrypoint' : undefined,
|
|
189
|
+
});
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// 3. export type / interface / enum
|
|
194
|
+
const typeMatch = trimmed.match(/^export\s+(type|interface|enum)\s+([a-zA-Z0-9_$]+)/);
|
|
195
|
+
if (typeMatch) {
|
|
196
|
+
const kind = typeMatch[1];
|
|
197
|
+
const name = typeMatch[2];
|
|
198
|
+
candidates.push({
|
|
199
|
+
id: `orphan-web-${kind}-${path.basename(b.path).replace(/\.[^.]+$/, '')}-${name}`,
|
|
200
|
+
name,
|
|
201
|
+
symbol: name,
|
|
202
|
+
primaryPath: b.path,
|
|
203
|
+
qualifierPaths: [b.path],
|
|
204
|
+
lineNo,
|
|
205
|
+
kind: `export_${kind}`,
|
|
206
|
+
isProtected: isEntryFile,
|
|
207
|
+
protectionReason: isEntryFile ? 'Protected: Exported from package.json/framework entrypoint' : undefined,
|
|
208
|
+
});
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// 4. export { a, b, c }
|
|
213
|
+
const multiExportMatch = trimmed.match(/^export\s*\{([\s\S]*?)\}/);
|
|
214
|
+
if (multiExportMatch) {
|
|
215
|
+
const items = multiExportMatch[1].split(',');
|
|
216
|
+
for (const item of items) {
|
|
217
|
+
const clean = item.trim().split(/\s+as\s+/)[0].trim();
|
|
218
|
+
if (clean && /^[a-zA-Z0-9_$]+$/.test(clean)) {
|
|
219
|
+
candidates.push({
|
|
220
|
+
id: `orphan-web-named-${path.basename(b.path).replace(/\.[^.]+$/, '')}-${clean}`,
|
|
221
|
+
name: clean,
|
|
222
|
+
symbol: clean,
|
|
223
|
+
primaryPath: b.path,
|
|
224
|
+
qualifierPaths: [b.path],
|
|
225
|
+
lineNo,
|
|
226
|
+
kind: 'export_named',
|
|
227
|
+
isProtected: isEntryFile,
|
|
228
|
+
protectionReason: isEntryFile ? 'Protected: Exported from package.json/framework entrypoint' : undefined,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// 5. exports.foo = ...
|
|
236
|
+
const cjsMatch = trimmed.match(/^exports\.([a-zA-Z0-9_$]+)\s*=/);
|
|
237
|
+
if (cjsMatch) {
|
|
238
|
+
const name = cjsMatch[1];
|
|
239
|
+
candidates.push({
|
|
240
|
+
id: `orphan-web-cjs-${path.basename(b.path).replace(/\.[^.]+$/, '')}-${name}`,
|
|
241
|
+
name,
|
|
242
|
+
symbol: name,
|
|
243
|
+
primaryPath: b.path,
|
|
244
|
+
qualifierPaths: [b.path],
|
|
245
|
+
lineNo,
|
|
246
|
+
kind: 'export_cjs',
|
|
247
|
+
isProtected: isEntryFile,
|
|
248
|
+
protectionReason: isEntryFile ? 'Protected: Exported from package.json/framework entrypoint' : undefined,
|
|
249
|
+
});
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return candidates;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* 检查是否包含动态 import() 或 require(variable) 等反射模式 (Fail-Closed)
|
|
260
|
+
* @param {import('../../core/blob-reader.mjs').BlobReader} reader
|
|
261
|
+
* @returns {boolean}
|
|
262
|
+
*/
|
|
263
|
+
detectReflectionUsage(reader) {
|
|
264
|
+
const blobs = reader.listBlobs(p =>
|
|
265
|
+
p.endsWith('.js') || p.endsWith('.ts') || p.endsWith('.tsx') || p.endsWith('.mjs')
|
|
266
|
+
);
|
|
267
|
+
for (const b of blobs) {
|
|
268
|
+
const text = reader.readBlobText(b.path);
|
|
269
|
+
// 匹配非字面量的动态 import(...),如 import(pathVariable) 或 import(`./plugins/${name}`)
|
|
270
|
+
if (/import\s*\(\s*`[^`]*\$\{/.test(text) || /import\s*\(\s*[a-zA-Z_$][a-zA-Z0-9_$]*\s*\)/.test(text)) {
|
|
271
|
+
return true;
|
|
272
|
+
}
|
|
273
|
+
// 匹配动态 require(variable)
|
|
274
|
+
if (/require\s*\(\s*[a-zA-Z_$][a-zA-Z0-9_$]*\s*\)/.test(text)) {
|
|
275
|
+
return true;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* lab-orphan CLI — 全局死代码与孤儿资产清道夫 (units/orphan)
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import fs from 'node:fs';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { Solver } from '../core/solver.mjs';
|
|
11
|
+
import { SolverProtocol } from '../core/protocol-s1-s3.mjs';
|
|
12
|
+
import { DiffChecker } from '../core/diff-checker.mjs';
|
|
13
|
+
import { Cleaner } from '../core/cleaner.mjs';
|
|
14
|
+
import { AndroidAdapter } from '../adapters/android/index.mjs';
|
|
15
|
+
import { PythonAdapter } from '../adapters/python/index.mjs';
|
|
16
|
+
import { WebAdapter } from '../adapters/web/index.mjs';
|
|
17
|
+
import { OrphanDepsSolver } from '../core/orphan-deps.mjs';
|
|
18
|
+
|
|
19
|
+
const SCRIPT_ROOT = path.dirname(fileURLToPath(import.meta.url));
|
|
20
|
+
const ORPHAN_VERSION = (() => {
|
|
21
|
+
try {
|
|
22
|
+
const vFile = path.resolve(SCRIPT_ROOT, '..', 'VERSION.md');
|
|
23
|
+
if (fs.existsSync(vFile)) {
|
|
24
|
+
const line = fs.readFileSync(vFile, 'utf8').trim().split('\n')[0];
|
|
25
|
+
const match = line.match(/v?(\d+\.\d+\.\d+)/);
|
|
26
|
+
if (match) return match[1];
|
|
27
|
+
}
|
|
28
|
+
} catch {}
|
|
29
|
+
return '1.4.1';
|
|
30
|
+
})();
|
|
31
|
+
|
|
32
|
+
const args = process.argv.slice(2);
|
|
33
|
+
const command = args[0] || 'help';
|
|
34
|
+
|
|
35
|
+
function showHelp() {
|
|
36
|
+
console.log(`
|
|
37
|
+
lab-orphan CLI — 全局死代码与孤儿资产清道夫 (units/orphan v${ORPHAN_VERSION})
|
|
38
|
+
|
|
39
|
+
用法:
|
|
40
|
+
lab orphan test-solver 运行 S1-S3 求解器自检协议 (注入假死检出/在用保护/逐字节一致)
|
|
41
|
+
lab orphan scan [选项] 全量扫描当前 HEAD,探测死代码与孤儿资产
|
|
42
|
+
lab orphan check-diff [选项] 增量提交门禁校验 (检测本次改动是否引入新孤儿)
|
|
43
|
+
lab orphan check-deps [--strict] 扫描依赖清单 (requirements.txt / package.json) 探测未导入孤儿包
|
|
44
|
+
lab orphan scan-secrets [--strict] 扫描零调用假凭证与硬编码高熵 Token (支持 --strict 阻断退出)
|
|
45
|
+
lab orphan clean [选项] 受控安全清理 (支持 dry-run 演练)
|
|
46
|
+
lab orphan help 显示本帮助信息
|
|
47
|
+
|
|
48
|
+
check-deps / scan-secrets 选项:
|
|
49
|
+
--strict 门禁阻断模式:检出孤儿依赖或可疑凭证时以 exit 1 非零状态码退出
|
|
50
|
+
|
|
51
|
+
scan 选项:
|
|
52
|
+
--out <file> 指定候选结果写入路径 (默认: stdout 打印概要)
|
|
53
|
+
--json 以标准 JSON 格式输出 candidates.json 结构
|
|
54
|
+
--stack <android|python|web|auto> 显式指定技术栈适配器 (默认: auto 自动探测)
|
|
55
|
+
--include-alive 在输出中同时包含仍在使用的活跃符号
|
|
56
|
+
|
|
57
|
+
check-diff 选项:
|
|
58
|
+
--staged 仅检查暂存区改动
|
|
59
|
+
--base <commit/branch> 指定比对基准 (默认: HEAD~1 或 origin/main)
|
|
60
|
+
|
|
61
|
+
clean 选项:
|
|
62
|
+
--candidates <file> 指定 candidates.json 候选清单文件
|
|
63
|
+
--dry-run 仅模拟演练,不实际删除物理文件 (默认开启)
|
|
64
|
+
`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async function runTestSolver() {
|
|
68
|
+
const result = await SolverProtocol.runSelfTest({
|
|
69
|
+
repoDir: process.cwd(),
|
|
70
|
+
verbose: true,
|
|
71
|
+
});
|
|
72
|
+
if (!result.passed) {
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async function runScan() {
|
|
78
|
+
const isJson = args.includes('--json');
|
|
79
|
+
const includeAlive = args.includes('--include-alive');
|
|
80
|
+
const outIdx = args.indexOf('--out');
|
|
81
|
+
const outFile = outIdx !== -1 && args[outIdx + 1] ? args[outIdx + 1] : null;
|
|
82
|
+
const stackIdx = args.indexOf('--stack');
|
|
83
|
+
const stack = stackIdx !== -1 && args[stackIdx + 1] ? args[stackIdx + 1] : 'auto';
|
|
84
|
+
|
|
85
|
+
const solver = new Solver({
|
|
86
|
+
repoDir: process.cwd(),
|
|
87
|
+
ref: 'HEAD',
|
|
88
|
+
adapters: [new AndroidAdapter(), new PythonAdapter(), new WebAdapter()],
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const result = solver.solve({ includeAlive, stack });
|
|
92
|
+
|
|
93
|
+
if (outFile) {
|
|
94
|
+
const absPath = path.resolve(process.cwd(), outFile);
|
|
95
|
+
fs.mkdirSync(path.dirname(absPath), { recursive: true });
|
|
96
|
+
fs.writeFileSync(absPath, JSON.stringify(result, null, 2), 'utf8');
|
|
97
|
+
console.log(`\n📄 扫描产物已保存至: ${outFile}`);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (isJson) {
|
|
101
|
+
console.log(JSON.stringify(result, null, 2));
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
console.log(`\n🔍 Orphan Scan 扫描结果摘要:`);
|
|
106
|
+
console.log(` - 扫描 Git Commit: ${result.commit_sha}`);
|
|
107
|
+
console.log(` - 索引有效文件: ${result.summary.total_scanned_files} 个`);
|
|
108
|
+
console.log(` - 检出孤儿候选: ${result.summary.total_candidates} 个`);
|
|
109
|
+
console.log(` - 确认可删孤儿: ${result.summary.confirmed_orphans} 个`);
|
|
110
|
+
console.log(` - 待证疑似项目: ${result.summary.pending_verification} 个`);
|
|
111
|
+
|
|
112
|
+
if (result.candidates.length > 0) {
|
|
113
|
+
console.log(`\n📋 候选清单示例 (前 5 条):`);
|
|
114
|
+
for (const c of result.candidates.slice(0, 5)) {
|
|
115
|
+
console.log(` [${c.status}] \x1b[33m${c.name}\x1b[0m (${c.path}) - confidence: ${c.confidence}`);
|
|
116
|
+
for (const r of c.reasons) console.log(` ↳ ${r}`);
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
console.log(`\n✨ 未在当前仓库中检测到任何未引用孤儿资产!`);
|
|
120
|
+
}
|
|
121
|
+
console.log();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function runCheckDiff() {
|
|
125
|
+
const isStaged = args.includes('--staged');
|
|
126
|
+
const isJson = args.includes('--json');
|
|
127
|
+
const baseIdx = args.indexOf('--base');
|
|
128
|
+
const base = baseIdx !== -1 && args[baseIdx + 1] ? args[baseIdx + 1] : 'HEAD~1';
|
|
129
|
+
|
|
130
|
+
const checker = new DiffChecker({
|
|
131
|
+
repoDir: process.cwd(),
|
|
132
|
+
adapters: [new AndroidAdapter(), new PythonAdapter(), new WebAdapter()],
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const result = await checker.checkDiff({ staged: isStaged, base });
|
|
136
|
+
|
|
137
|
+
if (isJson) {
|
|
138
|
+
console.log(JSON.stringify(result, null, 2));
|
|
139
|
+
process.exit(result.passed ? 0 : 1);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
console.log(`\n🛡️ Orphan Check-Diff 增量防腐门禁检查:`);
|
|
143
|
+
console.log(` - 检查模式: ${isStaged ? 'Staged 暂存区' : `Base 对比 (${base})`}`);
|
|
144
|
+
console.log(` - 发现新增符号: ${result.totalAddedCandidates} 个`);
|
|
145
|
+
console.log(` - 拦截新增孤儿: ${result.orphans.length} 个`);
|
|
146
|
+
|
|
147
|
+
if (result.orphans.length > 0) {
|
|
148
|
+
console.error(`\n❌ [提交阻断] 本次改动引入了零引用的孤儿代码或资产:`);
|
|
149
|
+
for (const o of result.orphans) {
|
|
150
|
+
console.error(` - \x1b[31m${o.name}\x1b[0m (${o.path}:${o.line_no}) [${o.kind}]`);
|
|
151
|
+
for (const r of o.reasons) console.error(` ↳ ${r}`);
|
|
152
|
+
}
|
|
153
|
+
console.error(`\n💡 提示: 请在提交前删除该死代码,或在引用方接入调用,或显式标注保护规则。\n`);
|
|
154
|
+
process.exit(1);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
console.log(` ✅ 增量检查通过:本次提交未引入任何未引用的孤儿资产。\n`);
|
|
158
|
+
process.exit(0);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async function runClean() {
|
|
162
|
+
const isDryRun = args.includes('--dry-run') || !args.includes('--force');
|
|
163
|
+
const candIdx = args.indexOf('--candidates');
|
|
164
|
+
const candFile = candIdx !== -1 && args[candIdx + 1] ? args[candIdx + 1] : null;
|
|
165
|
+
|
|
166
|
+
console.log(`\n🧹 Orphan Clean 安全修剪清理器 ${isDryRun ? '(模拟演练 Dry-Run)' : ''}:`);
|
|
167
|
+
|
|
168
|
+
let candidates = [];
|
|
169
|
+
if (candFile && fs.existsSync(candFile)) {
|
|
170
|
+
const raw = JSON.parse(fs.readFileSync(candFile, 'utf8'));
|
|
171
|
+
candidates = raw.candidates || [];
|
|
172
|
+
} else {
|
|
173
|
+
// 自动扫描当前 HEAD 生成候选
|
|
174
|
+
console.log(` 未指定 --candidates 文件,自动执行全量扫描寻找 CONFIRMED_ORPHAN...`);
|
|
175
|
+
const solver = new Solver({
|
|
176
|
+
repoDir: process.cwd(),
|
|
177
|
+
ref: 'HEAD',
|
|
178
|
+
adapters: [new AndroidAdapter(), new PythonAdapter(), new WebAdapter()],
|
|
179
|
+
});
|
|
180
|
+
const scanResult = solver.solve({ includeAlive: false });
|
|
181
|
+
candidates = scanResult.candidates || [];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const cleaner = new Cleaner({
|
|
185
|
+
repoDir: process.cwd(),
|
|
186
|
+
dryRun: isDryRun,
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
const result = cleaner.clean(candidates);
|
|
190
|
+
console.log(` - 可清理孤儿项: ${result.totalCandidates} 项`);
|
|
191
|
+
console.log(` - 生成修剪补丁: ${result.cleanedCount} 处`);
|
|
192
|
+
|
|
193
|
+
if (result.patches.length > 0) {
|
|
194
|
+
console.log(`\n📋 补丁预览 (前 2 个 Patch):`);
|
|
195
|
+
for (const p of result.patches.slice(0, 2)) {
|
|
196
|
+
console.log(`\n--- Patch for ${p.path} [${p.type}] ---`);
|
|
197
|
+
console.log(p.diff);
|
|
198
|
+
}
|
|
199
|
+
if (result.patches.length > 2) {
|
|
200
|
+
console.log(`\n... 其余 ${result.patches.length - 2} 处补丁已省略。`);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (isDryRun) {
|
|
205
|
+
console.log(`\n✨ [Dry-Run 演练完成] 磁盘文件保持零修改。若确认应用清理,请带上 --force 参数。\n`);
|
|
206
|
+
} else {
|
|
207
|
+
console.log(`\n✅ 清理已写入磁盘并落地。\n`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
async function runCheckDeps() {
|
|
212
|
+
const isStrict = args.includes('--strict') || args.includes('--fail-on-orphans');
|
|
213
|
+
const solver = new OrphanDepsSolver({ repoDir: process.cwd() });
|
|
214
|
+
const results = await solver.scan();
|
|
215
|
+
if (results.length === 0) {
|
|
216
|
+
console.log('✅ 未发现受支持的依赖清单文件 (requirements.txt / package.json)。');
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
let totalOrphans = 0;
|
|
221
|
+
for (const r of results) {
|
|
222
|
+
console.log(`\n📦 [依赖清单] ${r.manifest} (${r.type})`);
|
|
223
|
+
console.log(` - 声明总数: ${r.total_declared},在用导入: ${r.active_imported},孤儿依赖: ${r.orphans.length}`);
|
|
224
|
+
if (r.orphans.length > 0) {
|
|
225
|
+
totalOrphans += r.orphans.length;
|
|
226
|
+
console.log(` ⚠️ 未导入的孤儿第三方包 (0 import 引用):`);
|
|
227
|
+
for (const p of r.orphans) {
|
|
228
|
+
console.log(` - ${p}`);
|
|
229
|
+
}
|
|
230
|
+
} else {
|
|
231
|
+
console.log(` ✅ 无孤儿依赖,全部声明均被源码 import。`);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (totalOrphans > 0) {
|
|
236
|
+
console.log(`\n💡 提示: 请先清理上述未导入的 ${totalOrphans} 个孤儿依赖,可物理消除虚假 CVE 报警风暴 (ADR-0011)。`);
|
|
237
|
+
if (isStrict) {
|
|
238
|
+
console.error(`\n❌ [Gate Block] --strict 门禁生效:存在 ${totalOrphans} 个未导入孤儿依赖,阻断退出。`);
|
|
239
|
+
process.exit(1);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
async function runScanSecrets() {
|
|
245
|
+
const isStrict = args.includes('--strict') || args.includes('--fail-on-findings');
|
|
246
|
+
const solver = new OrphanDepsSolver({ repoDir: process.cwd() });
|
|
247
|
+
const findings = solver.scanSecrets();
|
|
248
|
+
if (findings.length === 0) {
|
|
249
|
+
console.log('✅ 未发现硬编码可疑凭证或高熵 Token。');
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
console.log(`\n🔍 发现 ${findings.length} 处可疑硬编码凭证:`);
|
|
254
|
+
for (const f of findings) {
|
|
255
|
+
console.log(` - ${f.file}:${f.line} -> ${f.match.slice(0, 40)}...`);
|
|
256
|
+
}
|
|
257
|
+
if (isStrict) {
|
|
258
|
+
console.error(`\n❌ [Gate Block] --strict 门禁生效:检出 ${findings.length} 处硬编码凭证/高熵 Token,阻断退出。`);
|
|
259
|
+
process.exit(1);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// ── 路由执行 ──────────────────────────────────────────────────────────
|
|
264
|
+
switch (command) {
|
|
265
|
+
case '--version':
|
|
266
|
+
case '-v':
|
|
267
|
+
case 'version':
|
|
268
|
+
console.log(`lab-orphan CLI · v${ORPHAN_VERSION} (units/orphan)`);
|
|
269
|
+
process.exit(0);
|
|
270
|
+
break;
|
|
271
|
+
case 'test-solver':
|
|
272
|
+
case 'test':
|
|
273
|
+
await runTestSolver();
|
|
274
|
+
break;
|
|
275
|
+
case 'scan':
|
|
276
|
+
await runScan();
|
|
277
|
+
break;
|
|
278
|
+
case 'check-diff':
|
|
279
|
+
await runCheckDiff();
|
|
280
|
+
break;
|
|
281
|
+
case 'check-deps':
|
|
282
|
+
case 'orphan-deps':
|
|
283
|
+
await runCheckDeps();
|
|
284
|
+
break;
|
|
285
|
+
case 'scan-secrets':
|
|
286
|
+
case 'secrets':
|
|
287
|
+
await runScanSecrets();
|
|
288
|
+
break;
|
|
289
|
+
case 'clean':
|
|
290
|
+
await runClean();
|
|
291
|
+
break;
|
|
292
|
+
case 'help':
|
|
293
|
+
case '--help':
|
|
294
|
+
case '-h':
|
|
295
|
+
default:
|
|
296
|
+
showHelp();
|
|
297
|
+
break;
|
|
298
|
+
}
|