@skathio/somi 4.1.0 → 5.0.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.
- package/.claude-plugin/icon.png +0 -0
- package/.claude-plugin/marketplace.json +8 -3
- package/.claude-plugin/plugin.json +9 -10
- package/.copilot-extension/extension.json +32 -40
- package/.copilot-extension/marketplace.json +8 -3
- package/README.md +83 -228
- package/VERSION +1 -1
- package/agents/somi-reviewer.md +21 -40
- package/agents/somi-security-reviewer.md +16 -90
- package/agents/somi-worker-high.md +11 -0
- package/agents/somi-worker-low.md +11 -0
- package/agents/somi-worker-medium.md +11 -0
- package/agents/somi.md +8 -75
- package/commands/somi-config.md +5 -14
- package/commands/somi-deliver.md +11 -0
- package/commands/somi-quality.md +10 -0
- package/commands/somi-review.md +10 -0
- package/commands/somi-status.md +11 -0
- package/commands/somi.md +10 -0
- package/hooks/hooks.json +28 -23
- package/hooks/lib/common.mjs +45 -34
- package/hooks/pre-tool/apply-tier.mjs +31 -0
- package/hooks/pre-tool/block-dangerous-bash.mjs +15 -0
- package/hooks/pre-tool/gate-dep-install.mjs +2 -2
- package/hooks/pre-tool/guard-protected-paths.mjs +9 -16
- package/hooks/pre-tool/guard-tier-config.mjs +17 -0
- package/hooks/pre-tool/reviewers-read-only.mjs +11 -0
- package/hooks/session-start/inject-digest.mjs +51 -0
- package/hooks/stop/review-due.mjs +40 -0
- package/hooks/user-prompt/capture-prompt.mjs +17 -0
- package/library/lenses/architecture.md +1 -0
- package/library/lenses/test-strategy.md +1 -0
- package/library/roles/accessibility.md +1 -0
- package/library/roles/answer.md +1 -0
- package/library/roles/atlas.md +1 -0
- package/library/roles/build.md +1 -0
- package/library/roles/debug.md +6 -0
- package/library/roles/design.md +1 -0
- package/library/roles/discover.md +1 -0
- package/library/roles/incident.md +1 -0
- package/library/roles/migrate.md +1 -0
- package/library/roles/perf.md +1 -0
- package/library/roles/plan.md +1 -0
- package/library/roles/refactor.md +1 -0
- package/library/roles/review.md +1 -0
- package/library/roles/security-review.md +1 -0
- package/library/roles/upgrade.md +1 -0
- package/library/skills/accessibility.md +16 -0
- package/library/skills/ci-infra-gotchas.md +12 -0
- package/library/skills/perf-method.md +10 -0
- package/library/skills/secure-coding.md +18 -0
- package/library/skills/testing-checklist.md +16 -0
- package/library/skills/threat-modeling.md +10 -0
- package/package.json +12 -17
- package/profiles/claude.json +21 -0
- package/profiles/copilot.json +5 -0
- package/rules/digest.md +40 -0
- package/scripts/check-links.mjs +65 -76
- package/scripts/lib/advisor.mjs +207 -0
- package/scripts/lib/check.mjs +165 -0
- package/scripts/lib/copilot-workflow.mjs +41 -0
- package/scripts/lib/doctor.mjs +91 -0
- package/scripts/lib/gates.mjs +69 -0
- package/scripts/lib/git-tree.mjs +201 -0
- package/scripts/lib/init.mjs +23 -0
- package/scripts/lib/ledger.mjs +38 -0
- package/scripts/lib/mcp-project-root.mjs +63 -67
- package/scripts/lib/migrate.mjs +73 -0
- package/scripts/lib/path-facts.mjs +2 -2
- package/scripts/lib/path-safety.mjs +6 -134
- package/scripts/lib/plan.mjs +69 -0
- package/scripts/lib/policy.mjs +103 -0
- package/scripts/lib/pr.mjs +28 -0
- package/scripts/lib/prompt.mjs +72 -0
- package/scripts/lib/quality/clones.mjs +76 -0
- package/scripts/lib/quality/css.mjs +43 -0
- package/scripts/lib/quality/gate.mjs +230 -0
- package/scripts/lib/quality/limits.mjs +73 -0
- package/scripts/lib/quality/metrics.mjs +159 -0
- package/scripts/lib/quality/parse.mjs +73 -0
- package/scripts/lib/quality/repo.mjs +69 -0
- package/scripts/lib/quality/run.mjs +38 -0
- package/scripts/lib/reviews.mjs +132 -0
- package/scripts/lib/routes.mjs +108 -0
- package/scripts/lib/setup.mjs +34 -0
- package/scripts/lib/shards.mjs +166 -0
- package/scripts/lib/signals.mjs +110 -0
- package/scripts/lib/state.mjs +42 -0
- package/scripts/lib/tiers.mjs +42 -0
- package/scripts/lib/update-notice.mjs +48 -0
- package/scripts/lib/views.mjs +62 -0
- package/scripts/lib/workflows.mjs +56 -0
- package/scripts/somi-mcp.mjs +181 -323
- package/scripts/somi.mjs +208 -0
- package/scripts/vendor/tree-sitter/LICENSE.vscode-tree-sitter-wasm +21 -0
- package/scripts/vendor/tree-sitter/LICENSE.web-tree-sitter +21 -0
- package/scripts/vendor/tree-sitter/cgmanifest.vscode-tree-sitter-wasm.json +16 -0
- package/scripts/vendor/tree-sitter/manifest.json +59 -0
- package/scripts/vendor/tree-sitter/package.json +3 -0
- package/scripts/vendor/tree-sitter/tree-sitter-css.wasm +0 -0
- package/scripts/vendor/tree-sitter/tree-sitter-javascript.wasm +0 -0
- package/scripts/vendor/tree-sitter/tree-sitter-tsx.wasm +0 -0
- package/scripts/vendor/tree-sitter/tree-sitter-typescript.wasm +0 -0
- package/scripts/vendor/tree-sitter/web-tree-sitter.js +4081 -0
- package/scripts/vendor/tree-sitter/web-tree-sitter.wasm +0 -0
- package/skills/somi-expertise/SKILL.md +6 -0
- package/workflows/deliver-stages.js +81 -0
- package/.claude/settings.json +0 -131
- package/agents/somi-architecture-reviewer.md +0 -101
- package/agents/somi-atlas.md +0 -100
- package/agents/somi-coder.md +0 -60
- package/agents/somi-designer.md +0 -36
- package/agents/somi-discovery-analyst.md +0 -57
- package/agents/somi-flow.md +0 -47
- package/agents/somi-general.md +0 -36
- package/agents/somi-impact.md +0 -95
- package/agents/somi-incident.md +0 -94
- package/agents/somi-plan-reviewer.md +0 -68
- package/agents/somi-planner.md +0 -57
- package/agents/somi-pr.md +0 -99
- package/agents/somi-refactor-designer.md +0 -81
- package/agents/somi-refactorer.md +0 -99
- package/agents/somi-sdlc-reviewer.md +0 -67
- package/agents/somi-test-strategist.md +0 -87
- package/commands/adopt.md +0 -14
- package/commands/architecture-review.md +0 -19
- package/commands/atlas.md +0 -19
- package/commands/code-loop.md +0 -19
- package/commands/code-parallel.md +0 -19
- package/commands/code.md +0 -19
- package/commands/debug.md +0 -19
- package/commands/design.md +0 -19
- package/commands/discover.md +0 -19
- package/commands/impact.md +0 -19
- package/commands/incident.md +0 -19
- package/commands/plan-loop.md +0 -19
- package/commands/plan.md +0 -19
- package/commands/pr.md +0 -19
- package/commands/refactor-design.md +0 -19
- package/commands/refactor.md +0 -19
- package/commands/release-readiness.md +0 -19
- package/commands/review-panel.md +0 -19
- package/commands/review.md +0 -19
- package/commands/security-review.md +0 -19
- package/commands/ship-loop.md +0 -19
- package/commands/ship.md +0 -19
- package/commands/test-strategy.md +0 -19
- package/commands/upgrade.md +0 -19
- package/examples/README.md +0 -19
- package/examples/code-review-example.md +0 -88
- package/examples/discovery-example.md +0 -200
- package/examples/feature-plan-example.md +0 -377
- package/examples/full-pipeline-example.md +0 -188
- package/examples/sample-consumer/.claude/settings.json +0 -29
- package/examples/sample-consumer/CLAUDE.md +0 -78
- package/examples/sample-consumer/README.md +0 -102
- package/hooks/post-tool/lint-changed-files.mjs +0 -209
- package/hooks/pre-tool/guard-cost-lowering.mjs +0 -192
- package/hooks/session-start/detect-repo-instructions.mjs +0 -287
- package/hooks/session-start/ensure-default-config.mjs +0 -113
- package/hooks/user-prompt-submit/inject-workflow-context.mjs +0 -580
- package/rules/00-priorities.md +0 -48
- package/rules/10-solid.md +0 -87
- package/rules/20-clean-code.md +0 -62
- package/rules/30-security-owasp.md +0 -83
- package/rules/40-engineering-practices.md +0 -65
- package/rules/50-collaboration.md +0 -114
- package/rules/99-overrides.md +0 -52
- package/rules/CLAUDE.md +0 -200
- package/scripts/check-session-artefacts.mjs +0 -149
- package/scripts/check-size-budget.mjs +0 -137
- package/scripts/generate-digest.mjs +0 -176
- package/scripts/lib/agent-info.mjs +0 -85
- package/scripts/lib/agent-registry.mjs +0 -92
- package/scripts/lib/cost-ceiling.mjs +0 -328
- package/scripts/lib/cost-config-edit.mjs +0 -102
- package/scripts/lib/cost-config.mjs +0 -64
- package/scripts/lib/cost-defaults.mjs +0 -53
- package/scripts/lib/cost-lowering.mjs +0 -89
- package/scripts/lib/cost-model.mjs +0 -110
- package/scripts/lib/dispatch-resolver.mjs +0 -243
- package/scripts/lib/escalation-facts.mjs +0 -146
- package/scripts/lib/escalation.mjs +0 -129
- package/scripts/lib/findings-ledger.mjs +0 -241
- package/scripts/lib/install-text.mjs +0 -97
- package/scripts/lib/loop-caps.mjs +0 -140
- package/scripts/lib/loop-diff.mjs +0 -38
- package/scripts/lib/loop-dispatch.mjs +0 -19
- package/scripts/lib/loop-engine.mjs +0 -226
- package/scripts/lib/loop-escalate.mjs +0 -49
- package/scripts/lib/loop-exit.mjs +0 -47
- package/scripts/lib/loop-notes-compact.mjs +0 -72
- package/scripts/lib/loop-notes.mjs +0 -278
- package/scripts/lib/loop-review.mjs +0 -395
- package/scripts/lib/loop-state.mjs +0 -44
- package/scripts/lib/loop-step-close.mjs +0 -75
- package/scripts/lib/loop-step-kit.mjs +0 -179
- package/scripts/lib/loop-step-review.mjs +0 -140
- package/scripts/lib/loop-step-tool.mjs +0 -89
- package/scripts/lib/loop-step.mjs +0 -301
- package/scripts/lib/run-budget.mjs +0 -28
- package/scripts/lib/run-card.mjs +0 -73
- package/scripts/lib/size-tier.mjs +0 -184
- package/scripts/lib/tier-record.mjs +0 -82
- package/scripts/size-budget-overrides.json +0 -58
- package/scripts/somi-card.mjs +0 -39
- package/scripts/somi-check.mjs +0 -237
- package/scripts/somi-config.mjs +0 -421
- package/scripts/somi-dispatch.mjs +0 -141
- package/scripts/somi-findings.mjs +0 -100
- package/scripts/somi-loop.mjs +0 -128
- package/scripts/somi-tier.mjs +0 -393
- package/scripts/validate.sh +0 -653
- package/skills/api-design/SKILL.md +0 -147
- package/skills/clean-code/SKILL.md +0 -142
- package/skills/flow-adopt/SKILL.md +0 -92
- package/skills/flow-architecture-review/SKILL.md +0 -94
- package/skills/flow-atlas/SKILL.md +0 -34
- package/skills/flow-code/SKILL.md +0 -167
- package/skills/flow-code-loop/SKILL.md +0 -263
- package/skills/flow-code-parallel/SKILL.md +0 -160
- package/skills/flow-debug/SKILL.md +0 -141
- package/skills/flow-design/SKILL.md +0 -170
- package/skills/flow-discover/SKILL.md +0 -204
- package/skills/flow-impact/SKILL.md +0 -35
- package/skills/flow-incident/SKILL.md +0 -49
- package/skills/flow-plan/SKILL.md +0 -254
- package/skills/flow-plan-loop/SKILL.md +0 -254
- package/skills/flow-pr/SKILL.md +0 -34
- package/skills/flow-refactor/SKILL.md +0 -58
- package/skills/flow-refactor-design/SKILL.md +0 -97
- package/skills/flow-release-readiness/SKILL.md +0 -82
- package/skills/flow-review/SKILL.md +0 -193
- package/skills/flow-review-panel/SKILL.md +0 -154
- package/skills/flow-security-review/SKILL.md +0 -83
- package/skills/flow-ship/SKILL.md +0 -125
- package/skills/flow-ship-loop/SKILL.md +0 -274
- package/skills/flow-somi-config/SKILL.md +0 -142
- package/skills/flow-status/SKILL.md +0 -43
- package/skills/flow-test-strategy/SKILL.md +0 -83
- package/skills/flow-upgrade/SKILL.md +0 -82
- package/skills/market-research/SKILL.md +0 -125
- package/skills/observability/SKILL.md +0 -133
- package/skills/owasp-defense/SKILL.md +0 -141
- package/skills/plan-review/SKILL.md +0 -83
- package/skills/reasoning-craft/SKILL.md +0 -213
- package/skills/requirements-engineering/SKILL.md +0 -137
- package/skills/role-coder/SKILL.md +0 -247
- package/skills/role-designer/SKILL.md +0 -172
- package/skills/role-discovery-analyst/SKILL.md +0 -288
- package/skills/role-planner/SKILL.md +0 -353
- package/skills/role-reviewer/SKILL.md +0 -218
- package/skills/rules/SKILL.md +0 -47
- package/skills/sdlc-process/SKILL.md +0 -74
- package/skills/solid-principles/SKILL.md +0 -143
- package/skills/somi-checkpoint/SKILL.md +0 -95
- package/skills/somi-dispatch/SKILL.md +0 -259
- package/skills/somi-routing/SKILL.md +0 -158
- package/skills/testing-playbook/SKILL.md +0 -133
- package/skills/threat-modeling/SKILL.md +0 -117
- package/templates/ADR.md.tmpl +0 -73
- package/templates/ATLAS.md.tmpl +0 -75
- package/templates/BRD.md.tmpl +0 -68
- package/templates/BRIEF.md.tmpl +0 -119
- package/templates/CONTEXT.md.tmpl +0 -74
- package/templates/DECISIONS.md.tmpl +0 -105
- package/templates/DESIGN.md.tmpl +0 -83
- package/templates/DIARY.md.tmpl +0 -70
- package/templates/DOD.md.tmpl +0 -90
- package/templates/FRD.md.tmpl +0 -64
- package/templates/PHASE.md.tmpl +0 -80
- package/templates/PROGRESS.md.tmpl +0 -63
- package/templates/RCA.md.tmpl +0 -53
- package/templates/RD-README.md.tmpl +0 -70
- package/templates/RESEARCH.md.tmpl +0 -96
- package/templates/REVIEW.md.tmpl +0 -82
- package/templates/SDD.md.tmpl +0 -82
- package/templates/SOMI-README.md.tmpl +0 -83
- package/templates/SPEC.md.tmpl +0 -123
- package/templates/SRS.md.tmpl +0 -85
- package/templates/TDD.md.tmpl +0 -77
- package/tests/hooks/cases/audit-log.json +0 -21
- package/tests/hooks/cases/block-dangerous-bash.json +0 -166
- package/tests/hooks/cases/block-secret-writes.json +0 -140
- package/tests/hooks/cases/detect-repo-instructions.json +0 -105
- package/tests/hooks/cases/gate-dep-install.json +0 -42
- package/tests/hooks/cases/guard-protected-paths.json +0 -222
- package/tests/hooks/cases/inject-workflow-context.json +0 -239
- package/tests/hooks/cases/lint-changed-files.json +0 -120
- package/tests/hooks/run.sh +0 -392
- package/tests/scripts/agent-model-frontmatter.sh +0 -38
- package/tests/scripts/agent-names.sh +0 -77
- package/tests/scripts/check-frontmatter.sh +0 -37
- package/tests/scripts/check-links.sh +0 -105
- package/tests/scripts/check-session-artefacts.sh +0 -60
- package/tests/scripts/check-size-budget.sh +0 -71
- package/tests/scripts/checkpoint-gate.sh +0 -131
- package/tests/scripts/convergence-runner.sh +0 -1514
- package/tests/scripts/cost-ceiling.sh +0 -255
- package/tests/scripts/cost-defaults.sh +0 -130
- package/tests/scripts/cost-hardcap.sh +0 -338
- package/tests/scripts/cost-lowering.sh +0 -261
- package/tests/scripts/cost-model.sh +0 -196
- package/tests/scripts/dispatch-guard.sh +0 -108
- package/tests/scripts/dispatch-line-gate.sh +0 -61
- package/tests/scripts/dispatch-reference-gate.sh +0 -173
- package/tests/scripts/ensure-default-config.sh +0 -162
- package/tests/scripts/escalation.sh +0 -409
- package/tests/scripts/eval-runner.sh +0 -3692
- package/tests/scripts/evals-packaging.sh +0 -224
- package/tests/scripts/fact-sheet.sh +0 -296
- package/tests/scripts/fixtures/legacy-shard-no-schema.json +0 -50
- package/tests/scripts/fixtures/mock-stdin-read-throw.cjs +0 -18
- package/tests/scripts/fixtures/size-tier-cases.json +0 -87
- package/tests/scripts/generate-digest.sh +0 -180
- package/tests/scripts/global-config.sh +0 -167
- package/tests/scripts/goldens/loop-state-breach.json +0 -1
- package/tests/scripts/goldens/loop-state-done.json +0 -1
- package/tests/scripts/goldens/somi-findings.json +0 -336
- package/tests/scripts/goldens/somi-loop.json +0 -168
- package/tests/scripts/lib/adr-shape.mjs +0 -41
- package/tests/scripts/lib/agent-registry-tests.mjs +0 -95
- package/tests/scripts/lib/brief-only-guard.mjs +0 -27
- package/tests/scripts/lib/checkpoint-gate.mjs +0 -91
- package/tests/scripts/lib/digest-marker-coupling.mjs +0 -52
- package/tests/scripts/lib/dispatch-reference-gate.mjs +0 -121
- package/tests/scripts/lib/escalation-facts-tests.mjs +0 -140
- package/tests/scripts/lib/escalation-tests.mjs +0 -154
- package/tests/scripts/lib/findings-ledger-tests.mjs +0 -118
- package/tests/scripts/lib/loop-engine-tests.mjs +0 -287
- package/tests/scripts/lib/loop-escalate-tests.mjs +0 -356
- package/tests/scripts/lib/loop-flow-gate.mjs +0 -173
- package/tests/scripts/lib/loop-notes-tests.mjs +0 -371
- package/tests/scripts/lib/loop-step-cli-tests.mjs +0 -141
- package/tests/scripts/lib/loop-step-close-tests.mjs +0 -351
- package/tests/scripts/lib/loop-step-lenient-tests.mjs +0 -114
- package/tests/scripts/lib/loop-step-state-tests.mjs +0 -127
- package/tests/scripts/lib/loop-step-tests.mjs +0 -499
- package/tests/scripts/lib/loop-step-unwritten-tests.mjs +0 -55
- package/tests/scripts/lib/multipass-dependence.mjs +0 -192
- package/tests/scripts/lib/multipass-source-identity.mjs +0 -243
- package/tests/scripts/lib/path-facts-tests.mjs +0 -198
- package/tests/scripts/lib/path-safety-tests.mjs +0 -201
- package/tests/scripts/lib/reference-pair.mjs +0 -61
- package/tests/scripts/lib/retirement-gate.mjs +0 -172
- package/tests/scripts/lib/run-suites.mjs +0 -139
- package/tests/scripts/lib/shell-embedded-js.mjs +0 -47
- package/tests/scripts/lib/ship-loop-sizing-guard.mjs +0 -52
- package/tests/scripts/lib/site-roadmap-gate.mjs +0 -64
- package/tests/scripts/lib/size-tier-drift.mjs +0 -74
- package/tests/scripts/lib/sizing-score-tests.mjs +0 -210
- package/tests/scripts/lib/sizing-set-tests.mjs +0 -131
- package/tests/scripts/lib/somi-mcp-client.mjs +0 -102
- package/tests/scripts/lib/somi-mcp-config-tests.mjs +0 -92
- package/tests/scripts/lib/somi-mcp-loop-tests.mjs +0 -226
- package/tests/scripts/lib/somi-mcp-tests.mjs +0 -491
- package/tests/scripts/lib/somi-mcp-tier-tests.mjs +0 -64
- package/tests/scripts/lib/somi-mcp-tool-schema.mjs +0 -38
- package/tests/scripts/loop-engine.sh +0 -22
- package/tests/scripts/loop-flow-gate.sh +0 -11
- package/tests/scripts/retirement-gate.sh +0 -306
- package/tests/scripts/review-panel-seats.sh +0 -32
- package/tests/scripts/run-card.sh +0 -57
- package/tests/scripts/run-suites.sh +0 -74
- package/tests/scripts/run.sh +0 -689
- package/tests/scripts/site-roadmap-gate.sh +0 -76
- package/tests/scripts/size-tier.sh +0 -562
- package/tests/scripts/somi-agent-dispatch-contract.sh +0 -224
- package/tests/scripts/somi-config.sh +0 -286
- package/tests/scripts/somi-dispatch.sh +0 -465
- package/tests/scripts/somi-mcp.sh +0 -15
- package/tests/scripts/suite-plan.json +0 -20
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Drives the real server (scripts/somi-mcp.mjs) over stdio for the somi_loop tool in throwaway git repos: a clean pass, every gate
|
|
3
|
-
// of the matrix, the refusals, the root rules, the argument rules, interop with the CLI and the writes it may make.
|
|
4
|
-
// Invoked from tests/scripts/somi-mcp.sh. CLAUDE_PROJECT_DIR is always set explicitly (or cleared), so the host a run happens in cannot change a case.
|
|
5
|
-
|
|
6
|
-
import { execFileSync } from 'node:child_process';
|
|
7
|
-
import { createHash } from 'node:crypto';
|
|
8
|
-
import { chmodSync, existsSync, lstatSync, symlinkSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
9
|
-
import { tmpdir } from 'node:os';
|
|
10
|
-
import path from 'node:path';
|
|
11
|
-
import { fileURLToPath } from 'node:url';
|
|
12
|
-
import { isDeepStrictEqual } from 'node:util';
|
|
13
|
-
import { McpClient } from './somi-mcp-client.mjs';
|
|
14
|
-
import { KINDS, NEXTS } from '../../../scripts/lib/loop-exit.mjs';
|
|
15
|
-
import { resolveProjectRoot } from '../../../scripts/lib/mcp-project-root.mjs';
|
|
16
|
-
import { LIMITS } from '../../../scripts/lib/loop-review.mjs';
|
|
17
|
-
import { callLoopStep } from '../../../scripts/lib/loop-step-tool.mjs';
|
|
18
|
-
|
|
19
|
-
const ROOT = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', '..', '..');
|
|
20
|
-
let pass = 0; let fail = 0;
|
|
21
|
-
const check = (name, got, want) => {
|
|
22
|
-
if (isDeepStrictEqual(got, want)) { pass++; console.log(` ok ${name}`); } else { fail++; console.log(` FAIL ${name} (want ${JSON.stringify(want)}, got ${JSON.stringify(got)})`); }
|
|
23
|
-
};
|
|
24
|
-
const tmp = mkdtempSync(path.join(tmpdir(), 'somi-mcp-loop-'));
|
|
25
|
-
process.on('exit', () => rmSync(tmp, { recursive: true, force: true }));
|
|
26
|
-
const ROWS = '# Progress — p1\n\n## Iteration progress\n\n| Iteration | Title | Status | Reviewed | Last activity |\n|---|---|---|---|---|\n| 1.1 | one | not-started | — | — |\n';
|
|
27
|
-
const DIARY = '# Diary — p1\n\n> Spec: x\n\n---\n\n## 2026-10-28 10:00 — Plan\n\n**Category**: `note`\n**Phase**: 1\n\nbody\n\n---\n\n';
|
|
28
|
-
let n = 0;
|
|
29
|
-
function repo(slugs = ['p1']) {
|
|
30
|
-
const root = path.join(tmp, `r${n++}`); mkdirSync(root);
|
|
31
|
-
const git = (...a) => execFileSync('git', ['-C', root, '-c', 'user.name=t', '-c', 'user.email=t@t', ...a]);
|
|
32
|
-
git('init', '-q'); for (const f of ['a.js', 'b.js']) writeFileSync(path.join(root, f), '1\n'); git('add', '.'); git('commit', '-q', '-m', 'base');
|
|
33
|
-
for (const s of slugs) { mkdirSync(path.join(root, '.somi', 'plans', s, 'phases'), { recursive: true }); writeFileSync(path.join(root, '.somi', 'plans', s, 'diary.md'), DIARY); writeFileSync(path.join(root, '.somi', 'plans', s, 'progress.md'), ROWS); }
|
|
34
|
-
return root;
|
|
35
|
-
}
|
|
36
|
-
const file = (root, ...p) => path.join(root, ...p);
|
|
37
|
-
const diary = (root) => readFileSync(file(root, '.somi', 'plans', 'p1', 'diary.md'), 'utf8');
|
|
38
|
-
const entries = (root) => diary(root).split('\n').filter((l) => l.startsWith('## ')).length;
|
|
39
|
-
const state = (root) => JSON.parse(readFileSync(file(root, '.somi', 'somi-state', 'loop', 'p1.1.1.json'), 'utf8'));
|
|
40
|
-
// Every file under a directory with its hash: the "nothing was written" oracle.
|
|
41
|
-
const tree = (root) => Object.fromEntries(readdirSync(root, { recursive: true }).filter((f) => !f.startsWith('.git')).sort().map((f) => [f, lstatSync(path.join(root, f)).isFile() ? createHash('sha256').update(readFileSync(path.join(root, f))).digest('hex') : 'dir']));
|
|
42
|
-
const CAPS_OFF = { SOMI_CODE_LOOP_MAX_PASSES: '', SOMI_CODE_LOOP_DIFF_CAP: '', SOMI_PLAN_LOOP_MAX_PASSES: '', SOMI_GLOBAL_CONFIG: '' };
|
|
43
|
-
async function withClient(root, fn, { env = {}, roots } = {}) {
|
|
44
|
-
const client = new McpClient(path.join(ROOT, 'scripts', 'somi-mcp.mjs'), { env: { ...CAPS_OFF, CLAUDE_PROJECT_DIR: root ?? '', ...env } });
|
|
45
|
-
if (roots) client.rootsHandler = async () => roots;
|
|
46
|
-
try { await client.initialize(roots ? { roots: {} } : {}); return await fn(client); } finally { client.close(); }
|
|
47
|
-
}
|
|
48
|
-
const sizes = []; const seen = { next: new Set(), kind: new Set() };
|
|
49
|
-
async function step(c, name, args = {}) {
|
|
50
|
-
const r = await c.request('tools/call', { name: 'somi_loop', arguments: { step: name, slug: 'p1', iteration: '1.1', ...args } });
|
|
51
|
-
const text = r?.content?.[0]?.text ?? ''; sizes.push(Buffer.byteLength(text));
|
|
52
|
-
const got = JSON.parse(text); seen.next.add(got.next); for (const u of got.unwritten ?? []) seen.kind.add(u.kind);
|
|
53
|
-
return { err: r.isError === true, ...got };
|
|
54
|
-
}
|
|
55
|
-
const review = (v = 'approve', extra = {}) => ({ reviewers: ['somi-reviewer'], verdict: v, blockers: 0, majors: 0, review: 'r1.md', ...extra });
|
|
56
|
-
const MAJOR = { file: 'a.js', symbol: 'f', title: 'the same defect', severity: 'Major', confidence: 'High' };
|
|
57
|
-
const gate = (r) => [r.err, r.exit, r.stop_reason];
|
|
58
|
-
|
|
59
|
-
console.log('== somi_loop over MCP ==');
|
|
60
|
-
{
|
|
61
|
-
const root = repo();
|
|
62
|
-
await withClient(root, async (c) => {
|
|
63
|
-
const t = (await c.request('tools/list', {})).tools.find((x) => x.name === 'somi_loop');
|
|
64
|
-
check('tools/list: somi_loop requires step and slug; its description is at most 900 bytes and the whole definition at most 2850', [t.inputSchema.required, Buffer.byteLength(t.description) <= 900, Buffer.byteLength(JSON.stringify(t)) <= 2850], [['step', 'slug'], true, true]);
|
|
65
|
-
const o = await step(c, 'open', { files: ['a.js'] }); writeFileSync(file(root, 'a.js'), '1\n2\n3\n');
|
|
66
|
-
check('open starts pass 1: the run card is the brief, the caps are the defaults, the server wrote the diary and the row', [o.err, o.exit, o.pass, o.next, o.brief.startsWith('```somi-card'), o.caps, o.wrote], [false, 0, 1, 'task-coder', true, { max_passes: 3, diff_cap_lines: 400, severity_floor: 'Major' }, ['.somi/plans/p1/diary.md', '.somi/plans/p1/progress.md']]);
|
|
67
|
-
const cli = JSON.parse(execFileSync(process.execPath, [file(ROOT, 'scripts', 'somi-loop.mjs'), 'resume', '--slug', 'p1', '--iteration', '1.1'], { env: { ...process.env, ...CAPS_OFF, CLAUDE_PROJECT_DIR: root }, encoding: 'utf8' }));
|
|
68
|
-
check('init through the tool, resume through the CLI: the CLI reads the same running state', [cli.status, cli.pass, cli.iteration_files], ['running', 1, ['a.js']]);
|
|
69
|
-
const ac = await step(c, 'after-code', { agent: 'somi-coder' });
|
|
70
|
-
check('after-code records the coder and passes the diff gate', [ac.err, ac.exit, ac.next, ac.diff.cap, ac.changed], [false, 0, 'task-reviewer', 400, true]);
|
|
71
|
-
const ar = await step(c, 'after-review', review());
|
|
72
|
-
const cl = await step(c, 'close', { status: ar.close_args.status });
|
|
73
|
-
const row = readFileSync(file(root, '.somi', 'plans', 'p1', 'progress.md'), 'utf8').split('\n').find((l) => l.startsWith('| 1.1 |'));
|
|
74
|
-
check('after-review ends the loop clean, close writes it down: status done, the row is done, reviewed approve', [ar.next, cl.status, cl.next, state(root).status, / done /.test(row), / approve /.test(row)], ['close', 'done', 'summarise', 'done', true, true]);
|
|
75
|
-
const own = diary(root).split(/^(?=## )/m).slice(1, -1);
|
|
76
|
-
check('every entry the tool wrote carries the fixed provenance line and a note or blocker category', [own.length, own.every((e) => e.includes('\nWritten by the loop step engine; every field comes from stored loop state.\n') && /\*\*Category\*\*: `(note|blocker)`/.test(e))], [3, true]);
|
|
77
|
-
const before = tree(root); const again = await step(c, 'open', { files: ['a.js'] }); for (let i = 0; i < 9; i++) await step(c, 'status');
|
|
78
|
-
check('a finished loop is not restarted by the tool; ten more calls (status included) write nothing', [again.exit, again.stop_reason, again.next, tree(root)], [64, 'no-running-loop', 'ask-user', before]);
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
console.log('== the gate matrix ==');
|
|
82
|
-
{
|
|
83
|
-
const root = repo(); writeFileSync(file(root, 'a.js'), '1\n2\n3\n');
|
|
84
|
-
await withClient(root, async (c) => {
|
|
85
|
-
await step(c, 'open', { files: ['a.js'], max_passes: 1 });
|
|
86
|
-
await step(c, 'after-code', { agent: 'somi-coder' });
|
|
87
|
-
const ar = await step(c, 'after-review', review('request-changes', { majors: 1, findings: [MAJOR] }));
|
|
88
|
-
const stop = await step(c, 'open');
|
|
89
|
-
check('exit 2: past the pass cap the result carries the gate (not an error), and the CLI command that re-runs it', [ar.next, ...gate(stop), stop.next, stop.cli], [ 'open', false, 2, 'max-passes-exceeded', 'close', 'node scripts/somi-loop.mjs pass --slug p1 --iteration 1.1 --max-passes <N>']);
|
|
90
|
-
});
|
|
91
|
-
const two = repo(); writeFileSync(file(two, 'a.js'), '1\n2\n3\n');
|
|
92
|
-
await withClient(two, async (c) => {
|
|
93
|
-
await step(c, 'open', { files: ['a.js'] }); await step(c, 'after-code', { agent: 'somi-coder' });
|
|
94
|
-
await step(c, 'after-review', review('request-changes', { majors: 1, findings: [MAJOR] })); await step(c, 'open'); await step(c, 'after-code', { agent: 'somi-coder' });
|
|
95
|
-
const br = await step(c, 'after-review', review('request-changes', { majors: 1, findings: [MAJOR] }));
|
|
96
|
-
check('exit 5: the same finding on consecutive passes trips the circuit breaker, as a result with stop_reason', [br.err, br.exit, br.stop_reason, br.next, br.close_args], [false, 5, 'circuit-breaker', 'close', { status: 'stopped-circuit-breaker' }]);
|
|
97
|
-
});
|
|
98
|
-
for (const [label, touch, want] of [['exit 3 with scope-expansion: lines outside the declared files', 'b.js', [false, 3, 'scope-expansion']], ['exit 3 without: lines inside the declared files', 'a.js', [false, 3, 'diff-cap-exceeded']]]) {
|
|
99
|
-
const r = repo();
|
|
100
|
-
await withClient(r, async (c) => {
|
|
101
|
-
await step(c, 'open', { files: ['a.js'], diff_cap: 5 }); writeFileSync(file(r, touch), `${'x\n'.repeat(20)}`);
|
|
102
|
-
const s = await step(c, 'after-code', { agent: 'somi-coder' });
|
|
103
|
-
check(label, [...gate(s), s.diff.weighted_lines > 5, s.cli.includes('--diff-cap <N>')], [...want, true, true]);
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
const timed = repo(); mkdirSync(file(timed, '.somi', 'somi-state', 'run'), { recursive: true }); writeFileSync(file(timed, '.somi', 'somi-state', 'run', 'p1.json'), JSON.stringify({ started: '2020-01-01T00:00:00Z', max_minutes: 1 }));
|
|
107
|
-
await withClient(timed, async (c) => check('exit 4: a run past its time budget stops the open', gate(await step(c, 'open', { files: ['a.js'] })), [false, 4, 'time-budget']));
|
|
108
|
-
const brief = repo(['p1', 'bo']); rmSync(file(brief, '.somi', 'plans', 'bo', 'phases'), { recursive: true }); writeFileSync(file(brief, '.somi', 'plans', 'bo', 'brief.md'), '# brief\n'); writeFileSync(file(brief, '.somi', 'plans', 'bo', 'progress.md'), ROWS);
|
|
109
|
-
await withClient(brief, async (c) => {
|
|
110
|
-
const b = await step(c, 'open', { slug: 'bo', files: ['a.js'] });
|
|
111
|
-
check('exit 64: a brief-only work item without its tier record is refused', [b.err, b.exit, /brief-only/.test(b.error)], [true, 64, true]);
|
|
112
|
-
const run = await step(c, 'open', { files: ['a.js'] });
|
|
113
|
-
const sentinel = await step(c, 'after-code', { agent: 'somi-no-such-agent' });
|
|
114
|
-
check('exit 65: an agent the resolver does not know', [sentinel.err, sentinel.exit], [true, 65]);
|
|
115
|
-
const snapshot = tree(brief);
|
|
116
|
-
const bads = await Promise.all([{ step: 'nope' }, { step: 'open', now: '2020-01-01T00:00' }, { step: 'open', reviewed: 'approve' }, { step: 'open', activity: 'x' }, { step: 'open', status: 'done' }, { step: 'open', failAfter: 'pass' }, { step: 'open', max_passes: 9 }, { step: 'open', diff_cap: 999 }, { step: 'open', slug: '../x' }, { step: 'status', iteration: '1.1/../x' }].map((a) => step(c, a.step, a)));
|
|
117
|
-
check('exit 64: an unknown step, a clock, a row field or a foreign field, a cap above the stored one, a traversal slug or iteration; nothing is written', [bads.map((x) => [x.err, x.exit]), tree(brief), run.pass], [bads.map(() => [true, 64]), snapshot, 1]);
|
|
118
|
-
});
|
|
119
|
-
const quota = repo();
|
|
120
|
-
await withClient(quota, async (c) => {
|
|
121
|
-
const first = await step(c, 'open', { files: ['a.js'] }); const n1 = entries(quota);
|
|
122
|
-
for (let i = 0; i < 10; i++) await step(c, 'open', { files: ['a.js'] });
|
|
123
|
-
check('a call repeated eleven times records one pass and one diary entry (replayed from the second call)', [first.replayed, (await step(c, 'open', { files: ['a.js'] })).replayed, entries(quota) === n1, state(quota).history.length, state(quota).pass], [false, true, true, 0, 1]);
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
console.log('== the root and the environment ==');
|
|
127
|
-
{
|
|
128
|
-
const host = repo(); const other = repo(); const lone = repo();
|
|
129
|
-
await withClient(host, async (c) => {
|
|
130
|
-
const before = tree(other); const out = await step(c, 'open', { files: ['a.js'], project_dir: other });
|
|
131
|
-
check('a project_dir outside the host root is refused 64 and nothing is written there', [out.err, out.exit, /outside the host-supplied root/.test(out.error), tree(other)], [true, 64, true, before]);
|
|
132
|
-
const inside = path.join(host, 'sub'); mkdirSync(file(inside, '.somi', 'plans', 'p1', 'phases'), { recursive: true });
|
|
133
|
-
for (const [f, text] of [['diary.md', DIARY], ['progress.md', ROWS]]) writeFileSync(file(inside, '.somi', 'plans', 'p1', f), text);
|
|
134
|
-
const opened = await step(c, 'open', { files: ['a.js'], project_dir: inside }); const viaDir = await step(c, 'status', { project_dir: inside }); const viaHost = await step(c, 'status');
|
|
135
|
-
check('a project_dir inside the host root selects that project: the loop opened through it is found through it only', [opened.err, opened.pass, viaDir.pass, viaHost.exit, existsSync(file(inside, '.somi', 'somi-state', 'loop', 'p1.1.1.json')), existsSync(file(host, '.somi', 'somi-state'))], [false, 1, 1, 64, true, false]);
|
|
136
|
-
});
|
|
137
|
-
await withClient(host, async (c) => {
|
|
138
|
-
const w = await step(c, 'open', { files: ['a.js'] });
|
|
139
|
-
check('a server env cap is inert: the cap in force is the default, not SOMI_CODE_LOOP_MAX_PASSES=1', [w.err, w.caps.max_passes], [false, 3]);
|
|
140
|
-
}, { env: { SOMI_CODE_LOOP_MAX_PASSES: '1' } });
|
|
141
|
-
await withClient('', async (c) => {
|
|
142
|
-
const w = await step(c, 'open', { files: ['a.js'], project_dir: lone }); const snapshot = tree(lone);
|
|
143
|
-
const snapshot2 = tree(host); const r = await step(c, 'status', { project_dir: host });
|
|
144
|
-
check('no host root (no CLAUDE_PROJECT_DIR, no roots): a write step is refused 67 pointing at the CLI and creates nothing', [w.err, w.exit, /run the loop through the CLI/.test(w.error), tree(lone)], [true, 67, true, snapshot]);
|
|
145
|
-
check('no host root: status reads a project_dir and writes nothing', [r.err, r.pass, r.state.status, tree(host)], [false, 1, 'running', snapshot2]);
|
|
146
|
-
});
|
|
147
|
-
const a = repo(); const b = repo();
|
|
148
|
-
await withClient('', async (c) => {
|
|
149
|
-
const amb = await step(c, 'open', { files: ['a.js'] }); const sel = await step(c, 'open', { files: ['a.js'], project_dir: a });
|
|
150
|
-
check('two roots and no project_dir are refused as ambiguous (67); project_dir selects one of them', [amb.err, amb.exit, /ambiguous/.test(amb.error), sel.err, sel.pass, tree(b)['.somi/somi-state'] === undefined], [true, 67, true, false, 1, true]);
|
|
151
|
-
}, { roots: [a, b] });
|
|
152
|
-
}
|
|
153
|
-
console.log('== the files a model names, the writes that fail, the budget ==');
|
|
154
|
-
{
|
|
155
|
-
const root = repo();
|
|
156
|
-
await withClient(root, async (c) => {
|
|
157
|
-
const o = await step(c, 'open', { files: ['a.js', 'x<!--y.js', '.js'] });
|
|
158
|
-
check('a file name never reaches the diary (only a count does), so it cannot open a comment or an image there', [o.err, diary(root).includes('<!--'), diary(root).includes('![i]'), diary(root).includes('files in scope: 3')], [false, false, false, true]);
|
|
159
|
-
});
|
|
160
|
-
const ro = repo();
|
|
161
|
-
if (process.getuid?.() === 0) console.log(' skip a failed diary write is handed back as unwritten (running as root: a read-only directory is writable)');
|
|
162
|
-
else {
|
|
163
|
-
chmodSync(file(ro, '.somi', 'plans', 'p1'), 0o555);
|
|
164
|
-
await withClient(ro, async (c) => {
|
|
165
|
-
const w = await step(c, 'open', { files: ['a.js'] }); const again = await step(c, 'open', { files: ['a.js'] });
|
|
166
|
-
check('a diary write that failed is a normal result whose unwritten items name the file and the kind of record; a repeat replays it', [w.err, w.exit, w.unwritten.map((u) => [u.reason, u.file, u.kind]), again.replayed], [false, 0, [['write-failed', 'diary.md', 'diary-entry'], ['write-failed', 'progress.md', 'iteration-row']], true]);
|
|
167
|
-
});
|
|
168
|
-
chmodSync(file(ro, '.somi', 'plans', 'p1'), 0o755);
|
|
169
|
-
}
|
|
170
|
-
check(`every response in this file fit the 2.5 KB budget (largest ${Math.max(...sizes)} bytes)`, sizes.every((s) => s <= 2500), true);
|
|
171
|
-
const stub = repo(); const bare = tree(stub); const stubbed = await callLoopStep({ step: 'open', slug: 'p1', iteration: '1.1', files: ['a.js'] }, { resolveRoot: async () => ({ ok: true, root: stub }), env: {}, installRoot: ROOT });
|
|
172
|
-
check('a resolver result that does not say hosted is not taken as hosted: a write step is refused 67 and writes nothing', [stubbed.isError, JSON.parse(stubbed.text).exit, tree(stub)], [true, 67, bare]);
|
|
173
|
-
}
|
|
174
|
-
console.log('== one result shape, the root once, the environment, the state directory ==');
|
|
175
|
-
{
|
|
176
|
-
const r = repo(); const roots = repo(); const outside = repo();
|
|
177
|
-
await withClient(r, async (c) => {
|
|
178
|
-
await step(c, 'open', { files: ['a.js'] });
|
|
179
|
-
const a66 = await step(c, 'after-code', { agent: 'somi' });
|
|
180
|
-
writeFileSync(file(r, '.somi', 'config.json'), '{ not json');
|
|
181
|
-
const a67 = await step(c, 'after-code', { agent: 'somi-coder' });
|
|
182
|
-
check('exits 66 (agent somi) and 67 (a corrupt .somi/config.json) are refusals, in the one JSON shape with next and exit', [a66, a67].map((x) => [x.err, x.exit, x.ok, x.next, typeof x.error]), [[true, 66, false, null, 'string'], [true, 67, false, null, 'string']]);
|
|
183
|
-
});
|
|
184
|
-
await withClient('', async (c) => {
|
|
185
|
-
let asked = 0; c.rootsHandler = async () => (asked++ ? [] : [roots]);
|
|
186
|
-
const before = tree(outside); const out = await step(c, 'open', { files: ['a.js'], project_dir: outside });
|
|
187
|
-
check('the root is asked for once: a second roots/list that returns nothing cannot hand the root to project_dir', [out.err, out.exit, asked, tree(outside)], [true, 64, 1, before]);
|
|
188
|
-
}, { roots: true });
|
|
189
|
-
const rev = repo(); const gcfg = path.join(tmp, 'global.json'); writeFileSync(gcfg, '{"code_loop":{"max_passes":2}}');
|
|
190
|
-
await withClient(rev, async (c) => {
|
|
191
|
-
const o = await step(c, 'open', { files: ['a.js'] }); const ac = await step(c, 'after-code', { agent: 'somi-coder' });
|
|
192
|
-
check('the review mode, review scope and severity floor in the server env reach the loop, the diff-cap variable does not, and SOMI_GLOBAL_CONFIG does', [ac.review_mode, ac.next, ac.scope.scope, ac.scope.why, o.caps.severity_floor, o.caps.diff_cap_lines, o.caps.max_passes], ['security', 'task-reviewers', 'full', 'setting', 'Minor', 400, 2]);
|
|
193
|
-
}, { env: { SOMI_CODE_LOOP_REVIEW: 'security', SOMI_CODE_LOOP_REVIEW_SCOPE: 'full', SOMI_CODE_LOOP_SEVERITY_FLOOR: 'Minor', SOMI_CODE_LOOP_DIFF_CAP: '5', SOMI_GLOBAL_CONFIG: gcfg } });
|
|
194
|
-
const link = repo(); const away = path.join(tmp, 'away'); mkdirSync(away); mkdirSync(file(link, '.somi'), { recursive: true }); symlinkSync(away, file(link, '.somi', 'somi-state'));
|
|
195
|
-
await withClient(link, async (c) => {
|
|
196
|
-
const o = await step(c, 'open', { files: ['a.js'] });
|
|
197
|
-
check('a state directory that is a link is refused 64 before any write: the directory it points to stays empty', [o.err, o.exit, readdirSync(away)], [true, 64, []]);
|
|
198
|
-
});
|
|
199
|
-
const evil = repo(); const H = '<!--x-->  `c` [x](u) # > - ```';
|
|
200
|
-
await withClient(evil, async (c) => {
|
|
201
|
-
await step(c, 'open', { files: ['a.js', `${H}.js`.replace(/\s/g, '')] });
|
|
202
|
-
await step(c, 'after-code', { agent: 'somi-coder' });
|
|
203
|
-
const bad = await step(c, 'after-review', review('request-changes', { majors: 1, findings: [{ ...MAJOR, file: H, symbol: H, title: H }], reviewers: ['somi-reviewer', H] }));
|
|
204
|
-
const ar = await step(c, 'after-review', review('request-changes', { majors: 1, findings: [{ ...MAJOR, file: H, symbol: H, title: H }] }));
|
|
205
|
-
const cl = await step(c, 'close', { status: 'stopped-user-stop' });
|
|
206
|
-
const added = (diary(evil).split(DIARY.slice(DIARY.indexOf('## ')))[0] + readFileSync(file(evil, '.somi', 'plans', 'p1', 'progress.md'), 'utf8')).replace(/`(note|blocker)`/g, '');
|
|
207
|
-
check('hostile findings and a hostile reviewers entry run through open to close: refused or recorded, and diary.md and progress.md hold no markup from them', [bad.exit, ar.exit, cl.err, ['<!--', ''].filter((m) => added.includes(m))], [64, 0, false, []]);
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
console.log('== a git that does not answer, and the words the results use ==');
|
|
211
|
-
{
|
|
212
|
-
const stuck = repo(); const fake = path.join(tmp, 'fakegit'); mkdirSync(fake); writeFileSync(path.join(fake, 'git'), '#!/bin/sh\nexec sleep 3\n', { mode: 0o755 });
|
|
213
|
-
const call = async (args) => { const r = await callLoopStep({ slug: 'p1', iteration: '1.1', ...args }, { resolveRoot: async () => ({ ok: true, root: stuck, hosted: true }), env: { SOMI_GLOBAL_CONFIG: '' }, installRoot: ROOT }); return { err: r.isError, ...JSON.parse(r.text) }; };
|
|
214
|
-
await call({ step: 'open', files: ['a.js'] });
|
|
215
|
-
const [real, limit] = [process.env.PATH, LIMITS.gitTimeoutMs]; process.env.PATH = `${fake}:${real}`; LIMITS.gitTimeoutMs = 300;
|
|
216
|
-
let ac; try { ac = await call({ step: 'after-code', agent: 'somi-coder' }); } finally { process.env.PATH = real; LIMITS.gitTimeoutMs = limit; }
|
|
217
|
-
check('a git that does not answer within the limit is a refusal (64 saying so), never a diff gate pass; no review is asked for', [ac.err, ac.exit, ac.next, /git did not answer within 0\.3 seconds/.test(ac.error)], [true, 64, null, true]);
|
|
218
|
-
check('every next and every unwritten kind this file saw is one the engine owns', [[...seen.next].filter((x) => x !== null && !NEXTS.includes(x)), [...seen.kind].filter((x) => x !== undefined && !KINDS.includes(x))], [[], []]);
|
|
219
|
-
}
|
|
220
|
-
{
|
|
221
|
-
const deep = path.join(tmp, 'y'.repeat(200), 'y'.repeat(200)); mkdirSync(deep, { recursive: true });
|
|
222
|
-
const refusals = [await resolveProjectRoot({ projectDirArg: `/${'x'.repeat(500)}` }), await resolveProjectRoot({ projectDirArg: 'x'.repeat(500) }), await resolveProjectRoot({ projectDirArg: deep, listRoots: async () => [`file://${repo()}`] })];
|
|
223
|
-
check('a long project_dir is echoed cut to 60 characters in each refusal text that shows it (missing, not absolute, outside the host root)', refusals.map((r) => [r.ok, r.code, r.message.length < 220, r.message.includes('x'.repeat(60)) || r.message.includes('y'.repeat(60))]), Array(3).fill([false, 64, true, false]));
|
|
224
|
-
}
|
|
225
|
-
console.log(`somi_loop tests: ${pass} ok, ${fail} failed`);
|
|
226
|
-
process.exit(fail ? 1 : 0);
|