opencode-agent-orchestration-kit 1.0.27
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/.github/CODEOWNERS +1 -0
- package/.github/ISSUE_TEMPLATE/bug_report.yml +65 -0
- package/.github/ISSUE_TEMPLATE/config.yml +11 -0
- package/.github/ISSUE_TEMPLATE/documentation.yml +22 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +43 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +25 -0
- package/.github/workflows/check.yml +47 -0
- package/CODE_OF_CONDUCT.md +24 -0
- package/CONTRIBUTING.md +52 -0
- package/LICENSE +201 -0
- package/NOTICE.md +23 -0
- package/README.md +806 -0
- package/SECURITY.md +17 -0
- package/docker/open-design/.env.example +6 -0
- package/docker/open-design/Dockerfile +50 -0
- package/docker/open-design/docker-compose.yml +18 -0
- package/docker/open-design/opencode-od/agents/od-worker.md +22 -0
- package/docker/open-design/opencode-od/opencode.json +24 -0
- package/docs/agents.md +21 -0
- package/docs/commands.md +16 -0
- package/docs/configuration.md +30 -0
- package/docs/docker-open-design.md +42 -0
- package/docs/impeccable.md +18 -0
- package/docs/installation.md +176 -0
- package/docs/models.md +17 -0
- package/docs/open-design.md +25 -0
- package/docs/quickstart.md +74 -0
- package/docs/releases/v1.0.10.md +46 -0
- package/docs/releases/v1.0.14.md +39 -0
- package/docs/releases/v1.0.27.md +66 -0
- package/docs/security.md +8 -0
- package/docs/superpowers/plans/2026-07-20-safe-installation-lifecycle.md +779 -0
- package/docs/superpowers/plans/2026-07-20-version-identity-and-releases.md +590 -0
- package/docs/superpowers/specs/2026-07-20-safe-installation-lifecycle-design.md +1350 -0
- package/docs/superpowers/specs/2026-07-20-version-identity-and-releases-design.md +557 -0
- package/docs/superpowers.md +34 -0
- package/docs/synology.md +30 -0
- package/docs/troubleshooting.md +54 -0
- package/docs/workflows.md +44 -0
- package/doctor.sh +5 -0
- package/env.example +15 -0
- package/install.sh +5 -0
- package/opencode/AGENTS.md +104 -0
- package/opencode/agents/debugger.md +41 -0
- package/opencode/agents/designer.md +93 -0
- package/opencode/agents/developer.md +180 -0
- package/opencode/agents/evaluator.md +35 -0
- package/opencode/agents/evolver.md +31 -0
- package/opencode/agents/lead.md +251 -0
- package/opencode/agents/researcher.md +76 -0
- package/opencode/agents/review_api.md +34 -0
- package/opencode/agents/review_coordinator.md +111 -0
- package/opencode/agents/review_quality.md +35 -0
- package/opencode/agents/review_security.md +35 -0
- package/opencode/agents/review_tests.md +37 -0
- package/opencode/agents/reviewer.md +116 -0
- package/opencode/agents/scoper.md +75 -0
- package/opencode/agents/specifier.md +116 -0
- package/opencode/commands/code-simplify.md +36 -0
- package/opencode/commands/design.md +27 -0
- package/opencode/commands/evolve.md +165 -0
- package/opencode/commands/feature.md +67 -0
- package/opencode/commands/implement.md +11 -0
- package/opencode/commands/init.md +34 -0
- package/opencode/commands/loop.md +145 -0
- package/opencode/commands/mvp-spec.md +20 -0
- package/opencode/commands/plan.md +74 -0
- package/opencode/commands/research.md +12 -0
- package/opencode/commands/review-orchestrated.md +47 -0
- package/opencode/commands/review-preflight.md +26 -0
- package/opencode/commands/review.md +18 -0
- package/opencode/commands/scope.md +36 -0
- package/opencode/commands/spec.md +12 -0
- package/opencode/commands/test.md +40 -0
- package/opencode/docs/ai/evolution/README.md +135 -0
- package/opencode/docs/ai/evolution/benchmarks/manual-scenarios.md +123 -0
- package/opencode/docs/ai/evolution/benchmarks/router-scenarios.jsonl +8 -0
- package/opencode/docs/ai/evolution/evolution_history.md +83 -0
- package/opencode/docs/ai/evolution/mechanisms.jsonl +7 -0
- package/opencode/docs/ai/evolution/rejected_mechanisms.jsonl +2 -0
- package/opencode/docs/ai/evolution/runs/README.md +15 -0
- package/opencode/docs/ai/evolution/runs/iteration-001-sidecar/analysis/overview.md +12 -0
- package/opencode/docs/ai/evolution/runs/iteration-001-sidecar/change_evaluation.json +108 -0
- package/opencode/docs/ai/evolution/runs/iteration-001-sidecar/change_manifest.json +52 -0
- package/opencode/docs/ai/evolution/runs/iteration-001-sidecar/evaluation.md +19 -0
- package/opencode/docs/ai/evolution/runs/iteration-001-sidecar/post_evaluation.md +12 -0
- package/opencode/docs/ai/evolution/runs/iteration-002-feature-flow-fix/analysis/overview.md +7 -0
- package/opencode/docs/ai/evolution/runs/iteration-002-feature-flow-fix/change_evaluation.json +31 -0
- package/opencode/docs/ai/evolution/runs/iteration-002-feature-flow-fix/evaluation.md +19 -0
- package/opencode/docs/ai/evolution/runs/iteration-003-agent-readable-harness/analysis/overview.md +13 -0
- package/opencode/docs/ai/evolution/runs/iteration-003-agent-readable-harness/change_evaluation.json +66 -0
- package/opencode/docs/ai/evolution/runs/iteration-003-agent-readable-harness/change_manifest.json +82 -0
- package/opencode/docs/ai/evolution/runs/iteration-003-agent-readable-harness/evaluation.md +20 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/analysis/detail/ahe-run-lifecycle-validator.md +40 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/analysis/detail/evolve-evaluation-only-contract.md +15 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/analysis/detail/open-design-tool-contract.md +14 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/analysis/detail/slash-command-contract-coverage.md +40 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/analysis/overview.md +17 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/analysis/pre_apply_approval.md +15 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/change_evaluation.json +252 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/change_manifest.json +210 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/evaluation.md +25 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/post_apply_evaluation.md +15 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/post_manifest_evaluation.md +14 -0
- package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/pre_apply_evaluation.md +15 -0
- package/opencode/docs/ai/evolution/runs/iteration-005-harness-orchestration-audit/analysis/overview.md +13 -0
- package/opencode/docs/ai/evolution/runs/iteration-005-harness-orchestration-audit/change_evaluation.json +14 -0
- package/opencode/docs/ai/evolution/runs/iteration-005-harness-orchestration-audit/change_manifest.json +30 -0
- package/opencode/docs/ai/evolution/runs/iteration-005-harness-orchestration-audit/evaluation.md +25 -0
- package/opencode/docs/ai/evolution/runs/iteration-006-lead-delegation-audit/analysis/overview.md +13 -0
- package/opencode/docs/ai/evolution/runs/iteration-006-lead-delegation-audit/change_evaluation.json +14 -0
- package/opencode/docs/ai/evolution/runs/iteration-006-lead-delegation-audit/change_manifest.json +29 -0
- package/opencode/docs/ai/evolution/runs/iteration-006-lead-delegation-audit/evaluation.md +18 -0
- package/opencode/docs/ai/evolution/runs/iteration-007-agent-skills-integration/analysis/overview.md +13 -0
- package/opencode/docs/ai/evolution/runs/iteration-007-agent-skills-integration/change_evaluation.json +14 -0
- package/opencode/docs/ai/evolution/runs/iteration-007-agent-skills-integration/change_manifest.json +34 -0
- package/opencode/docs/ai/evolution/runs/iteration-007-agent-skills-integration/evaluation.md +17 -0
- package/opencode/docs/ai/evolution/runs/iteration-008-lead-readonly-shell-permissions/analysis/overview.md +13 -0
- package/opencode/docs/ai/evolution/runs/iteration-008-lead-readonly-shell-permissions/change_evaluation.json +12 -0
- package/opencode/docs/ai/evolution/runs/iteration-008-lead-readonly-shell-permissions/change_manifest.json +28 -0
- package/opencode/docs/ai/evolution/runs/iteration-008-lead-readonly-shell-permissions/evaluation.md +17 -0
- package/opencode/docs/ai/evolution/runs/iteration-009-lead-developer-ownership-loop/analysis/overview.md +9 -0
- package/opencode/docs/ai/evolution/runs/iteration-009-lead-developer-ownership-loop/change_evaluation.json +14 -0
- package/opencode/docs/ai/evolution/runs/iteration-009-lead-developer-ownership-loop/change_manifest.json +31 -0
- package/opencode/docs/ai/evolution/runs/iteration-009-lead-developer-ownership-loop/evaluation.md +18 -0
- package/opencode/docs/ai/evolution/runs/iteration-010-token-plugin-sidebar-content/analysis/overview.md +12 -0
- package/opencode/docs/ai/evolution/runs/iteration-010-token-plugin-sidebar-content/change_evaluation.json +14 -0
- package/opencode/docs/ai/evolution/runs/iteration-010-token-plugin-sidebar-content/change_manifest.json +31 -0
- package/opencode/docs/ai/evolution/runs/iteration-010-token-plugin-sidebar-content/evaluation.md +17 -0
- package/opencode/docs/ai/evolution/runs/iteration-011-lead-cd-which-permissions/analysis/overview.md +10 -0
- package/opencode/docs/ai/evolution/runs/iteration-011-lead-cd-which-permissions/change_evaluation.json +14 -0
- package/opencode/docs/ai/evolution/runs/iteration-011-lead-cd-which-permissions/change_manifest.json +30 -0
- package/opencode/docs/ai/evolution/runs/iteration-011-lead-cd-which-permissions/evaluation.md +17 -0
- package/opencode/docs/ai/evolution/runs/iteration-012-lead-shell-allowlist-boundaries/analysis/overview.md +25 -0
- package/opencode/docs/ai/evolution/runs/iteration-012-lead-shell-allowlist-boundaries/change_evaluation.json +28 -0
- package/opencode/docs/ai/evolution/runs/iteration-012-lead-shell-allowlist-boundaries/change_manifest.json +31 -0
- package/opencode/docs/ai/evolution/runs/iteration-012-lead-shell-allowlist-boundaries/evaluation.md +22 -0
- package/opencode/docs/ai/evolution/runs/iteration-013-doc-gardening-mechanical-checks/analysis/overview.md +27 -0
- package/opencode/docs/ai/evolution/runs/iteration-013-doc-gardening-mechanical-checks/change_evaluation.json +32 -0
- package/opencode/docs/ai/evolution/runs/iteration-013-doc-gardening-mechanical-checks/change_manifest.json +49 -0
- package/opencode/docs/ai/evolution/runs/iteration-013-doc-gardening-mechanical-checks/evaluation.md +92 -0
- package/opencode/docs/ai/evolution/runs/iteration-014-harness-baseline/analysis/detail/token-vs-semantic.md +31 -0
- package/opencode/docs/ai/evolution/runs/iteration-014-harness-baseline/analysis/overview.md +14 -0
- package/opencode/docs/ai/evolution/runs/iteration-014-harness-baseline/evaluation.md +36 -0
- package/opencode/docs/ai/evolution/runs/iteration-015-semantic-checker/analysis/overview.md +13 -0
- package/opencode/docs/ai/evolution/runs/iteration-015-semantic-checker/change_evaluation.json +31 -0
- package/opencode/docs/ai/evolution/runs/iteration-015-semantic-checker/change_manifest.json +47 -0
- package/opencode/docs/ai/evolution/runs/iteration-015-semantic-checker/evaluation.md +27 -0
- package/opencode/docs/ai/evolution/runs/iteration-016-contract-prompt-alignment/analysis/overview.md +32 -0
- package/opencode/docs/ai/evolution/runs/iteration-016-contract-prompt-alignment/change_evaluation.json +31 -0
- package/opencode/docs/ai/evolution/runs/iteration-016-contract-prompt-alignment/change_manifest.json +35 -0
- package/opencode/docs/ai/evolution/runs/iteration-016-contract-prompt-alignment/evaluation.md +31 -0
- package/opencode/docs/ai/evolution/runs/iteration-017-ahe-cycle/analysis/detail/pattern-1-feature-sidecar-false-positive.md +51 -0
- package/opencode/docs/ai/evolution/runs/iteration-017-ahe-cycle/analysis/detail/pattern-2-checker-time-budget.md +52 -0
- package/opencode/docs/ai/evolution/runs/iteration-017-ahe-cycle/analysis/overview.md +99 -0
- package/opencode/docs/ai/evolution/runs/iteration-017-ahe-cycle/change_evaluation.json +61 -0
- package/opencode/docs/ai/evolution/runs/iteration-017-ahe-cycle/change_manifest.json +61 -0
- package/opencode/docs/ai/evolution/runs/iteration-017-ahe-cycle/evaluation.md +448 -0
- package/opencode/docs/ai/evolution/runs/iteration-018-free-message-routing-audit/analysis/detail/intake-gray-zone.md +65 -0
- package/opencode/docs/ai/evolution/runs/iteration-018-free-message-routing-audit/analysis/overview.md +172 -0
- package/opencode/docs/ai/evolution/runs/iteration-018-free-message-routing-audit/evaluation.md +226 -0
- package/opencode/docs/ai/evolution/runs/iteration-019-handoff-routing-audit/analysis/detail/plan-only-gray-zone.md +62 -0
- package/opencode/docs/ai/evolution/runs/iteration-019-handoff-routing-audit/analysis/overview.md +167 -0
- package/opencode/docs/ai/evolution/runs/iteration-019-handoff-routing-audit/evaluation.md +163 -0
- package/opencode/docs/ai/evolution/runs/iteration-020-loop-engineering-command/analysis/overview.md +42 -0
- package/opencode/docs/ai/evolution/runs/iteration-020-loop-engineering-command/change_evaluation.json +46 -0
- package/opencode/docs/ai/evolution/runs/iteration-020-loop-engineering-command/change_manifest.json +57 -0
- package/opencode/docs/ai/evolution/runs/iteration-020-loop-engineering-command/evaluation.md +48 -0
- package/opencode/docs/ai/evolution/runs/iteration-021/analysis/detail/contract-vs-runtime-gap.md +163 -0
- package/opencode/docs/ai/evolution/runs/iteration-021/analysis/detail/evidence-collection-blocker.md +134 -0
- package/opencode/docs/ai/evolution/runs/iteration-021/analysis/overview.md +111 -0
- package/opencode/docs/ai/evolution/runs/iteration-021/change_evaluation.json +52 -0
- package/opencode/docs/ai/evolution/runs/iteration-021/change_manifest.json +50 -0
- package/opencode/docs/ai/evolution/runs/iteration-021/evaluation.md +46 -0
- package/opencode/docs/ai/evolution/runs/iteration-021/manifest-justification.md +48 -0
- package/opencode/docs/ai/evolution/session-sources.md +91 -0
- package/opencode/docs/ai/harness/README.md +32 -0
- package/opencode/docs/ai/harness/agents.md +148 -0
- package/opencode/docs/ai/harness/checks.md +119 -0
- package/opencode/docs/ai/harness/commands.md +391 -0
- package/opencode/docs/ai/harness/evidence.md +85 -0
- package/opencode/docs/ai/harness/init-detection-rules.md +160 -0
- package/opencode/docs/ai/harness/orchestrated-review.md +131 -0
- package/opencode/docs/ai/harness/skill-metadata-schema.md +198 -0
- package/opencode/docs/ai/harness/skill-resolution.md +202 -0
- package/opencode/docs/ai/harness/skill_registry.json +443 -0
- package/opencode/docs/ai/harness/skill_registry.md +43 -0
- package/opencode/docs/ai/project-context-template.md +53 -0
- package/opencode/opencode.json +38 -0
- package/opencode/package-lock.json +1717 -0
- package/opencode/package.json +11 -0
- package/opencode/plugins/token-tree-usage.tsx +206 -0
- package/opencode/references/performance-checklist.md +153 -0
- package/opencode/references/security-checklist.md +134 -0
- package/opencode/references/testing-patterns.md +236 -0
- package/opencode/scripts/check-harness.mjs +1572 -0
- package/opencode/scripts/check-harness.test.mjs +820 -0
- package/opencode/scripts/collect-session-evidence.mjs +612 -0
- package/opencode/scripts/collect-session-evidence.test.mjs +443 -0
- package/opencode/scripts/preflight-audit.mjs +497 -0
- package/opencode/scripts/preflight-audit.test.mjs +363 -0
- package/opencode/scripts/project-capability-snapshot.mjs +407 -0
- package/opencode/scripts/project-capability-snapshot.test.mjs +382 -0
- package/opencode/scripts/review-orchestrated-prepare.mjs +547 -0
- package/opencode/scripts/review-orchestrated-prepare.test.mjs +516 -0
- package/opencode/scripts/skill-resolver.mjs +585 -0
- package/opencode/scripts/skill-resolver.test.mjs +781 -0
- package/opencode/scripts/update-skill-registry.mjs +380 -0
- package/opencode/skills/api-and-interface-design/SKILL.md +315 -0
- package/opencode/skills/autonomous-loops/SKILL.md +312 -0
- package/opencode/skills/code-review-and-quality/SKILL.md +365 -0
- package/opencode/skills/code-simplification/SKILL.md +345 -0
- package/opencode/skills/context-engineering/SKILL.md +252 -0
- package/opencode/skills/debugging-and-error-recovery/SKILL.md +316 -0
- package/opencode/skills/documentation-and-adrs/SKILL.md +298 -0
- package/opencode/skills/doubt-driven-development/SKILL.md +168 -0
- package/opencode/skills/iterative-retrieval/SKILL.md +232 -0
- package/opencode/skills/open-design/SKILL.md +123 -0
- package/opencode/skills/performance-optimization/SKILL.md +365 -0
- package/opencode/skills/security-and-hardening/SKILL.md +369 -0
- package/opencode/skills/source-driven-development/SKILL.md +210 -0
- package/opencode/skills/test-driven-development/SKILL.md +406 -0
- package/opencode/skills/using-agent-skills/SKILL.md +194 -0
- package/opencode/skills/verification-loop/SKILL.md +162 -0
- package/opencode/tools/open_design.ts +361 -0
- package/opencode/tui.json +5 -0
- package/package.json +20 -0
- package/rollback.sh +5 -0
- package/scripts/check.sh +184 -0
- package/scripts/install-smoke.sh +111 -0
- package/scripts/manage-installation.mjs +1498 -0
- package/scripts/manage-installation.test.mjs +1936 -0
- package/scripts/version.mjs +197 -0
- package/scripts/version.test.mjs +195 -0
- package/uninstall.sh +5 -0
- package/upgrade.sh +5 -0
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { spawnSync } from "node:child_process";
|
|
6
|
+
import test from "node:test";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
|
|
9
|
+
const scriptDir = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const scriptPath = path.join(scriptDir, "project-capability-snapshot.mjs");
|
|
11
|
+
|
|
12
|
+
function runSnapshot(dir, extraArgs = []) {
|
|
13
|
+
const args = [scriptPath, "--dir", dir, ...extraArgs];
|
|
14
|
+
const result = spawnSync(process.execPath, args, {
|
|
15
|
+
encoding: "utf8",
|
|
16
|
+
timeout: 10000,
|
|
17
|
+
});
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function parseOutput(result) {
|
|
22
|
+
assert.equal(result.status, 0, `Script failed: ${result.stderr}`);
|
|
23
|
+
return JSON.parse(result.stdout);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function makeEmptyDir() {
|
|
27
|
+
return fs.mkdtempSync(path.join(os.tmpdir(), "opencode-snapshot-empty-"));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function makeRepoWith(files) {
|
|
31
|
+
const tmp = makeEmptyDir();
|
|
32
|
+
for (const [rel, content] of Object.entries(files)) {
|
|
33
|
+
const fullPath = path.join(tmp, rel);
|
|
34
|
+
fs.mkdirSync(path.dirname(fullPath), { recursive: true });
|
|
35
|
+
fs.writeFileSync(fullPath, content);
|
|
36
|
+
}
|
|
37
|
+
return tmp;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// ── Test 1: Current repo detects Node/TypeScript/harness ────────────────
|
|
41
|
+
|
|
42
|
+
test("current repo detects node stack", () => {
|
|
43
|
+
const repoRoot = path.resolve(scriptDir, "..");
|
|
44
|
+
const result = runSnapshot(repoRoot);
|
|
45
|
+
const snapshot = parseOutput(result);
|
|
46
|
+
|
|
47
|
+
const stackIds = snapshot.stacks_detected.map((s) => s.id);
|
|
48
|
+
assert.ok(stackIds.includes("node"), "should detect node stack");
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test("current repo detects orchestration and documentation domains", () => {
|
|
52
|
+
const repoRoot = path.resolve(scriptDir, "..");
|
|
53
|
+
const result = runSnapshot(repoRoot);
|
|
54
|
+
const snapshot = parseOutput(result);
|
|
55
|
+
|
|
56
|
+
const domainIds = snapshot.domains_detected.map((d) => d.id);
|
|
57
|
+
assert.ok(domainIds.includes("orchestration"), "should detect orchestration domain");
|
|
58
|
+
assert.ok(domainIds.includes("documentation"), "should detect documentation domain");
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test("current repo detects harness, skills-catalog surfaces", () => {
|
|
62
|
+
const repoRoot = path.resolve(scriptDir, "..");
|
|
63
|
+
const result = runSnapshot(repoRoot);
|
|
64
|
+
const snapshot = parseOutput(result);
|
|
65
|
+
|
|
66
|
+
const surfaceIds = snapshot.surfaces_detected.map((s) => s.id);
|
|
67
|
+
assert.ok(surfaceIds.includes("harness"), "should detect harness surface");
|
|
68
|
+
assert.ok(surfaceIds.includes("skills-catalog"), "should detect skills-catalog surface");
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// ── Test 2: Empty repo produces empty arrays with unknowns ──────────────
|
|
72
|
+
|
|
73
|
+
test("empty repo produces snapshot with empty arrays and unknowns", () => {
|
|
74
|
+
const tmp = makeEmptyDir();
|
|
75
|
+
try {
|
|
76
|
+
const result = runSnapshot(tmp);
|
|
77
|
+
const snapshot = parseOutput(result);
|
|
78
|
+
|
|
79
|
+
assert.equal(snapshot.stacks_detected.length, 0, "stacks should be empty");
|
|
80
|
+
assert.equal(snapshot.domains_detected.length, 0, "domains should be empty");
|
|
81
|
+
assert.equal(snapshot.surfaces_detected.length, 0, "surfaces should be empty");
|
|
82
|
+
assert.ok(Array.isArray(snapshot.unknowns), "unknowns should be an array");
|
|
83
|
+
assert.ok(snapshot.unknowns.length > 0, "unknowns should be populated for empty repo");
|
|
84
|
+
} finally {
|
|
85
|
+
fs.rmSync(tmp, { recursive: true, force: true });
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// ── Test 3: Determinism ────────────────────────────────────────────────
|
|
90
|
+
|
|
91
|
+
test("two consecutive runs produce identical output except generated_at", () => {
|
|
92
|
+
const repoRoot = path.resolve(scriptDir, "..");
|
|
93
|
+
const result1 = runSnapshot(repoRoot);
|
|
94
|
+
const result2 = runSnapshot(repoRoot);
|
|
95
|
+
|
|
96
|
+
const snapshot1 = parseOutput(result1);
|
|
97
|
+
const snapshot2 = parseOutput(result2);
|
|
98
|
+
|
|
99
|
+
// Compare everything except generated_at
|
|
100
|
+
const { generated_at: _, ...rest1 } = snapshot1;
|
|
101
|
+
const { generated_at: __, ...rest2 } = snapshot2;
|
|
102
|
+
|
|
103
|
+
// Sort arrays by id for stable comparison
|
|
104
|
+
const sortById = (arr) => [...arr].sort((a, b) => (a.id || "").localeCompare(b.id || ""));
|
|
105
|
+
const sortEvidence = (arr) =>
|
|
106
|
+
[...arr].map((item) => ({
|
|
107
|
+
...item,
|
|
108
|
+
evidence: [...(item.evidence || [])].sort(),
|
|
109
|
+
}));
|
|
110
|
+
|
|
111
|
+
assert.deepEqual(
|
|
112
|
+
sortById(sortEvidence(rest1.stacks_detected)),
|
|
113
|
+
sortById(sortEvidence(rest2.stacks_detected)),
|
|
114
|
+
"stacks_detected should be deterministic",
|
|
115
|
+
);
|
|
116
|
+
assert.deepEqual(
|
|
117
|
+
sortById(sortEvidence(rest1.domains_detected)),
|
|
118
|
+
sortById(sortEvidence(rest2.domains_detected)),
|
|
119
|
+
"domains_detected should be deterministic",
|
|
120
|
+
);
|
|
121
|
+
assert.deepEqual(
|
|
122
|
+
sortById(sortEvidence(rest1.surfaces_detected)),
|
|
123
|
+
sortById(sortEvidence(rest2.surfaces_detected)),
|
|
124
|
+
"surfaces_detected should be deterministic",
|
|
125
|
+
);
|
|
126
|
+
assert.deepEqual(rest1.unknowns.sort(), rest2.unknowns.sort(), "unknowns should be deterministic");
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// ── Test 4: Every detection has evidence ────────────────────────────────
|
|
130
|
+
|
|
131
|
+
test("every detection has at least one evidence file", () => {
|
|
132
|
+
const repoRoot = path.resolve(scriptDir, "..");
|
|
133
|
+
const result = runSnapshot(repoRoot);
|
|
134
|
+
const snapshot = parseOutput(result);
|
|
135
|
+
|
|
136
|
+
for (const item of snapshot.stacks_detected) {
|
|
137
|
+
assert.ok(item.evidence && item.evidence.length > 0, `stack ${item.id} missing evidence`);
|
|
138
|
+
}
|
|
139
|
+
for (const item of snapshot.domains_detected) {
|
|
140
|
+
assert.ok(item.evidence && item.evidence.length > 0, `domain ${item.id} missing evidence`);
|
|
141
|
+
}
|
|
142
|
+
for (const item of snapshot.surfaces_detected) {
|
|
143
|
+
assert.ok(item.evidence && item.evidence.length > 0, `surface ${item.id} missing evidence`);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// ── Test 5: Schema version is 1 ────────────────────────────────────────
|
|
148
|
+
|
|
149
|
+
test("snapshot has schema_version 1", () => {
|
|
150
|
+
const repoRoot = path.resolve(scriptDir, "..");
|
|
151
|
+
const result = runSnapshot(repoRoot);
|
|
152
|
+
const snapshot = parseOutput(result);
|
|
153
|
+
|
|
154
|
+
assert.equal(snapshot.schema_version, 1);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// ── Test 6: repo_root is absolute path ──────────────────────────────────
|
|
158
|
+
|
|
159
|
+
test("repo_root is an absolute path", () => {
|
|
160
|
+
const repoRoot = path.resolve(scriptDir, "..");
|
|
161
|
+
const result = runSnapshot(repoRoot);
|
|
162
|
+
const snapshot = parseOutput(result);
|
|
163
|
+
|
|
164
|
+
assert.ok(path.isAbsolute(snapshot.repo_root), "repo_root should be absolute");
|
|
165
|
+
assert.equal(snapshot.repo_root, repoRoot);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
// ── Test 7: Module export works ─────────────────────────────────────────
|
|
169
|
+
|
|
170
|
+
test("script exports generateSnapshot function", async () => {
|
|
171
|
+
const mod = await import(scriptPath);
|
|
172
|
+
assert.equal(typeof mod.generateSnapshot, "function");
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
// ── Test 8: Generated-by and generated-at ───────────────────────────────
|
|
176
|
+
|
|
177
|
+
test("snapshot has generated_by and generated_at fields", () => {
|
|
178
|
+
const repoRoot = path.resolve(scriptDir, "..");
|
|
179
|
+
const result = runSnapshot(repoRoot);
|
|
180
|
+
const snapshot = parseOutput(result);
|
|
181
|
+
|
|
182
|
+
assert.equal(typeof snapshot.generated_by, "string");
|
|
183
|
+
assert.ok(snapshot.generated_by.length > 0, "generated_by should not be empty");
|
|
184
|
+
assert.equal(typeof snapshot.generated_at, "string");
|
|
185
|
+
// Validate ISO-8601-ish format
|
|
186
|
+
assert.ok(!isNaN(Date.parse(snapshot.generated_at)), "generated_at should be a valid date");
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
// ── Test 9: Custom repo with Flutter signals ────────────────────────────
|
|
190
|
+
|
|
191
|
+
test("repo with pubspec.yaml detects flutter stack", () => {
|
|
192
|
+
const tmp = makeRepoWith({
|
|
193
|
+
"pubspec.yaml": "name: my_app\ndependencies:\n flutter:\n sdk: flutter\n",
|
|
194
|
+
});
|
|
195
|
+
try {
|
|
196
|
+
const result = runSnapshot(tmp);
|
|
197
|
+
const snapshot = parseOutput(result);
|
|
198
|
+
|
|
199
|
+
const stackIds = snapshot.stacks_detected.map((s) => s.id);
|
|
200
|
+
assert.ok(stackIds.includes("flutter"), "should detect flutter stack");
|
|
201
|
+
|
|
202
|
+
const flutter = snapshot.stacks_detected.find((s) => s.id === "flutter");
|
|
203
|
+
assert.equal(flutter.confidence, "high");
|
|
204
|
+
assert.ok(flutter.evidence.includes("pubspec.yaml"));
|
|
205
|
+
} finally {
|
|
206
|
+
fs.rmSync(tmp, { recursive: true, force: true });
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
// ── Test 10: Custom repo with Go signals ────────────────────────────────
|
|
211
|
+
|
|
212
|
+
test("repo with go.mod detects go stack", () => {
|
|
213
|
+
const tmp = makeRepoWith({
|
|
214
|
+
"go.mod": "module example.com/foo\n\ngo 1.21\n",
|
|
215
|
+
});
|
|
216
|
+
try {
|
|
217
|
+
const result = runSnapshot(tmp);
|
|
218
|
+
const snapshot = parseOutput(result);
|
|
219
|
+
|
|
220
|
+
const stackIds = snapshot.stacks_detected.map((s) => s.id);
|
|
221
|
+
assert.ok(stackIds.includes("go"), "should detect go stack");
|
|
222
|
+
} finally {
|
|
223
|
+
fs.rmSync(tmp, { recursive: true, force: true });
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
// ── Test 11: Custom repo with test files detects testing domain ─────────
|
|
228
|
+
|
|
229
|
+
test("repo with test files detects testing domain", () => {
|
|
230
|
+
const tmp = makeRepoWith({
|
|
231
|
+
"src/utils.test.js": "test('works', () => {})",
|
|
232
|
+
});
|
|
233
|
+
try {
|
|
234
|
+
const result = runSnapshot(tmp);
|
|
235
|
+
const snapshot = parseOutput(result);
|
|
236
|
+
|
|
237
|
+
const domainIds = snapshot.domains_detected.map((d) => d.id);
|
|
238
|
+
assert.ok(domainIds.includes("testing"), "should detect testing domain");
|
|
239
|
+
} finally {
|
|
240
|
+
fs.rmSync(tmp, { recursive: true, force: true });
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
test("repo with docs/ai/specs detects specification domain", () => {
|
|
245
|
+
const tmp = makeRepoWith({
|
|
246
|
+
"docs/ai/specs/example.md": "# Example spec\n",
|
|
247
|
+
});
|
|
248
|
+
try {
|
|
249
|
+
const result = runSnapshot(tmp);
|
|
250
|
+
const snapshot = parseOutput(result);
|
|
251
|
+
|
|
252
|
+
const domainIds = snapshot.domains_detected.map((d) => d.id);
|
|
253
|
+
assert.ok(domainIds.includes("specification"), "should detect specification domain");
|
|
254
|
+
} finally {
|
|
255
|
+
fs.rmSync(tmp, { recursive: true, force: true });
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
// ── Test 11b: Custom repo with tsconfig detects typescript ─────────────
|
|
260
|
+
|
|
261
|
+
test("repo with tsconfig.json detects typescript stack", () => {
|
|
262
|
+
const tmp = makeRepoWith({
|
|
263
|
+
"tsconfig.json": '{"compilerOptions": {"target": "ES2020"}}',
|
|
264
|
+
"src/index.ts": "export const x = 1;",
|
|
265
|
+
});
|
|
266
|
+
try {
|
|
267
|
+
const result = runSnapshot(tmp);
|
|
268
|
+
const snapshot = parseOutput(result);
|
|
269
|
+
|
|
270
|
+
const stackIds = snapshot.stacks_detected.map((s) => s.id);
|
|
271
|
+
assert.ok(stackIds.includes("typescript"), "should detect typescript stack");
|
|
272
|
+
|
|
273
|
+
const ts = snapshot.stacks_detected.find((s) => s.id === "typescript");
|
|
274
|
+
assert.equal(ts.confidence, "high");
|
|
275
|
+
assert.ok(ts.evidence.includes("tsconfig.json"));
|
|
276
|
+
} finally {
|
|
277
|
+
fs.rmSync(tmp, { recursive: true, force: true });
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
// ── Test 12: Output written to file with --output ──────────────────────
|
|
282
|
+
|
|
283
|
+
test("--output writes JSON to file", () => {
|
|
284
|
+
const repoRoot = path.resolve(scriptDir, "..");
|
|
285
|
+
const outFile = path.join(os.tmpdir(), `opencode-snapshot-test-${Date.now()}.json`);
|
|
286
|
+
try {
|
|
287
|
+
const result = runSnapshot(repoRoot, ["--output", outFile]);
|
|
288
|
+
assert.equal(result.status, 0, result.stderr);
|
|
289
|
+
assert.ok(fs.existsSync(outFile), "output file should exist");
|
|
290
|
+
|
|
291
|
+
const content = fs.readFileSync(outFile, "utf8");
|
|
292
|
+
const snapshot = JSON.parse(content);
|
|
293
|
+
assert.equal(snapshot.schema_version, 1);
|
|
294
|
+
} finally {
|
|
295
|
+
fs.rmSync(outFile, { force: true });
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
// ── Test 13: Security domain detects SKILL.md in directory with keyword ──
|
|
300
|
+
|
|
301
|
+
test("security domain detects skills/security-and-hardening/SKILL.md", () => {
|
|
302
|
+
const repoRoot = path.resolve(scriptDir, "..");
|
|
303
|
+
const result = runSnapshot(repoRoot);
|
|
304
|
+
const snapshot = parseOutput(result);
|
|
305
|
+
|
|
306
|
+
const sec = snapshot.domains_detected.find((d) => d.id === "security");
|
|
307
|
+
assert.ok(sec, "should detect security domain");
|
|
308
|
+
const skillFiles = sec.evidence.filter((e) => e.includes("SKILL.md"));
|
|
309
|
+
assert.ok(
|
|
310
|
+
skillFiles.some((f) => f.includes("security-and-hardening")),
|
|
311
|
+
`security domain should include SKILL.md from security-and-hardening directory, got: ${JSON.stringify(skillFiles)}`,
|
|
312
|
+
);
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
// ── Test 14: Debugging domain detects SKILL.md in directory with keyword ──
|
|
316
|
+
|
|
317
|
+
test("debugging domain detects skills/debugging-and-error-recovery/SKILL.md", () => {
|
|
318
|
+
const repoRoot = path.resolve(scriptDir, "..");
|
|
319
|
+
const result = runSnapshot(repoRoot);
|
|
320
|
+
const snapshot = parseOutput(result);
|
|
321
|
+
|
|
322
|
+
const dbg = snapshot.domains_detected.find((d) => d.id === "debugging");
|
|
323
|
+
assert.ok(dbg, "should detect debugging domain");
|
|
324
|
+
const skillFiles = dbg.evidence.filter((e) => e.includes("SKILL.md"));
|
|
325
|
+
assert.ok(
|
|
326
|
+
skillFiles.some((f) => f.includes("debugging-and-error-recovery")),
|
|
327
|
+
`debugging domain should include SKILL.md from debugging-and-error-recovery directory, got: ${JSON.stringify(skillFiles)}`,
|
|
328
|
+
);
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
// ── Test 15: Documentation domain is not duplicated ───────────────────────
|
|
332
|
+
|
|
333
|
+
test("documentation domain appears exactly once in domains_detected", () => {
|
|
334
|
+
const repoRoot = path.resolve(scriptDir, "..");
|
|
335
|
+
const result = runSnapshot(repoRoot);
|
|
336
|
+
const snapshot = parseOutput(result);
|
|
337
|
+
|
|
338
|
+
const docCount = snapshot.domains_detected.filter((d) => d.id === "documentation").length;
|
|
339
|
+
assert.equal(docCount, 1, "documentation should appear exactly once");
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
// ── Test 16: Custom repo with security dir detects security domain ────────
|
|
343
|
+
|
|
344
|
+
test("repo with security-and-hardening dir detects security domain with SKILL.md", () => {
|
|
345
|
+
const tmp = makeRepoWith({
|
|
346
|
+
"skills/security-and-hardening/SKILL.md": "# Security and Hardening",
|
|
347
|
+
});
|
|
348
|
+
try {
|
|
349
|
+
const result = runSnapshot(tmp);
|
|
350
|
+
const snapshot = parseOutput(result);
|
|
351
|
+
|
|
352
|
+
const sec = snapshot.domains_detected.find((d) => d.id === "security");
|
|
353
|
+
assert.ok(sec, "should detect security domain");
|
|
354
|
+
assert.ok(
|
|
355
|
+
sec.evidence.some((e) => e.includes("SKILL.md")),
|
|
356
|
+
`security evidence should include SKILL.md, got: ${JSON.stringify(sec.evidence)}`,
|
|
357
|
+
);
|
|
358
|
+
} finally {
|
|
359
|
+
fs.rmSync(tmp, { recursive: true, force: true });
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
// ── Test 17: Custom repo with debugging dir detects debugging domain ──────
|
|
364
|
+
|
|
365
|
+
test("repo with debugging-and-error-recovery dir detects debugging domain with SKILL.md", () => {
|
|
366
|
+
const tmp = makeRepoWith({
|
|
367
|
+
"skills/debugging-and-error-recovery/SKILL.md": "# Debugging and Error Recovery",
|
|
368
|
+
});
|
|
369
|
+
try {
|
|
370
|
+
const result = runSnapshot(tmp);
|
|
371
|
+
const snapshot = parseOutput(result);
|
|
372
|
+
|
|
373
|
+
const dbg = snapshot.domains_detected.find((d) => d.id === "debugging");
|
|
374
|
+
assert.ok(dbg, "should detect debugging domain");
|
|
375
|
+
assert.ok(
|
|
376
|
+
dbg.evidence.some((e) => e.includes("SKILL.md")),
|
|
377
|
+
`debugging evidence should include SKILL.md, got: ${JSON.stringify(dbg.evidence)}`,
|
|
378
|
+
);
|
|
379
|
+
} finally {
|
|
380
|
+
fs.rmSync(tmp, { recursive: true, force: true });
|
|
381
|
+
}
|
|
382
|
+
});
|