@polderlabs/bizar 6.2.5 → 6.3.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/CLAUDE.md +15 -0
- package/.claude/agents/_shared/AGENT_BASELINE.md +168 -0
- package/.claude/agents/_shared/CLAUDE_TOOLS.md +412 -0
- package/.claude/agents/_shared/SKILLS.md +109 -0
- package/.claude/agents/agent-browser.md +80 -0
- package/.claude/agents/baldr.md +49 -0
- package/.claude/agents/forseti.md +51 -0
- package/.claude/agents/frigg.md +42 -0
- package/.claude/agents/heimdall.md +33 -0
- package/.claude/agents/hermod.md +53 -0
- package/.claude/agents/mimir.md +49 -0
- package/.claude/agents/odin.md +287 -0
- package/.claude/agents/quick.md +34 -0
- package/.claude/agents/semble-search.md +50 -0
- package/.claude/agents/thor.md +53 -0
- package/.claude/agents/tyr.md +56 -0
- package/.claude/agents/vidarr.md +54 -0
- package/.claude/agents/vor.md +53 -0
- package/.claude/commands/audit.md +25 -0
- package/.claude/commands/bizar.md +22 -0
- package/.claude/commands/explain.md +17 -0
- package/.claude/commands/init.md +29 -0
- package/.claude/commands/learn.md +44 -0
- package/.claude/commands/plan.md +35 -0
- package/.claude/commands/plow-through.md +50 -0
- package/.claude/commands/pr-review.md +49 -0
- package/.claude/commands/setup-provider.md +96 -0
- package/.claude/commands/tailscale-serve.md +100 -0
- package/.claude/commands/team.md +132 -0
- package/.claude/commands/test.md +62 -0
- package/.claude/commands/validate.md +68 -0
- package/.claude/commands/visual-plan.md +24 -0
- package/.claude/hooks/README.md +92 -0
- package/.claude/hooks/posttooluse-editwrite.mjs +91 -0
- package/.claude/hooks/pretooluse-bash.mjs +81 -0
- package/.claude/hooks/pretooluse-editwrite.mjs +139 -0
- package/.claude/hooks/sessionend-recall.mjs +74 -0
- package/.claude/hooks/sessionstart-prime.mjs +80 -0
- package/.claude/hooks/userpromptsubmit-tag.mjs +80 -0
- package/.claude/settings.json +116 -0
- package/.claude/skills/9router/SKILL.md +80 -0
- package/.claude/skills/9router-chat/SKILL.md +73 -0
- package/.claude/skills/9router-embeddings/SKILL.md +69 -0
- package/.claude/skills/9router-image/SKILL.md +86 -0
- package/.claude/skills/9router-stt/SKILL.md +79 -0
- package/.claude/skills/9router-tts/SKILL.md +80 -0
- package/.claude/skills/9router-web-fetch/SKILL.md +99 -0
- package/.claude/skills/9router-web-search/SKILL.md +91 -0
- package/.claude/skills/bizar/README.md +9 -0
- package/.claude/skills/bizar/SKILL.md +450 -0
- package/.claude/skills/cpp-coding-standards/README.md +28 -0
- package/.claude/skills/cpp-coding-standards/SKILL.md +634 -0
- package/.claude/skills/cpp-coding-standards/references/concurrency.md +320 -0
- package/.claude/skills/cpp-coding-standards/references/error-handling.md +229 -0
- package/.claude/skills/cpp-coding-standards/references/memory-safety.md +216 -0
- package/.claude/skills/cpp-coding-standards/references/modern-idioms.md +282 -0
- package/.claude/skills/cpp-coding-standards/references/review-checklist.md +96 -0
- package/.claude/skills/cpp-testing/README.md +28 -0
- package/.claude/skills/cpp-testing/SKILL.md +304 -0
- package/.claude/skills/cpp-testing/references/coverage.md +370 -0
- package/.claude/skills/cpp-testing/references/framework-compare.md +175 -0
- package/.claude/skills/cpp-testing/references/host-test-for-embedded.md +499 -0
- package/.claude/skills/cpp-testing/references/mocking.md +364 -0
- package/.claude/skills/cpp-testing/references/tdd-workflow.md +308 -0
- package/.claude/skills/cubesandbox/SKILL.md +148 -0
- package/.claude/skills/embedded-esp-idf/README.md +41 -0
- package/.claude/skills/embedded-esp-idf/SKILL.md +439 -0
- package/.claude/skills/embedded-esp-idf/references/freertos-patterns.md +214 -0
- package/.claude/skills/embedded-esp-idf/references/host-tests.md +164 -0
- package/.claude/skills/embedded-esp-idf/references/idf-py-commands.md +157 -0
- package/.claude/skills/embedded-esp-idf/references/kconfig.md +159 -0
- package/.claude/skills/embedded-esp-idf/references/logging-discipline.md +118 -0
- package/.claude/skills/embedded-esp-idf/references/memory-and-iram.md +137 -0
- package/.claude/skills/embedded-esp-idf/references/nvs.md +121 -0
- package/.claude/skills/embedded-esp-idf/references/packed-structs.md +192 -0
- package/.claude/skills/embedded-esp-idf/scripts/idf_env.sh +47 -0
- package/.claude/skills/embedded-esp-idf/scripts/size_check.sh +77 -0
- package/.claude/skills/glyph/SKILL.md +163 -0
- package/.claude/skills/harness-engineering/SKILL.md +143 -0
- package/.claude/skills/lightrag/SKILL.md +81 -0
- package/.claude/skills/memory-protocol/SKILL.md +105 -0
- package/.claude/skills/obsidian/SKILL.md +306 -0
- package/.claude/skills/read-the-damn-docs/SKILL.md +113 -0
- package/.claude/skills/self-improvement/SKILL.md +64 -0
- package/README.md +87 -59
- package/bizar-dash/dist/assets/{EnvVarsSection-DXM8gRm_.js → EnvVarsSection-B58aiJiE.js} +1 -1
- package/bizar-dash/dist/assets/{EnvVarsSection-DXM8gRm_.js.map → EnvVarsSection-B58aiJiE.js.map} +1 -1
- package/bizar-dash/dist/assets/{MobileChat-BnKN_Ks_.js → MobileChat-BJrqwVDd.js} +1 -1
- package/bizar-dash/dist/assets/{MobileChat-BnKN_Ks_.js.map → MobileChat-BJrqwVDd.js.map} +1 -1
- package/bizar-dash/dist/assets/{MobileSettings-DjCPxC-Q.js → MobileSettings-CEQNJNLJ.js} +1 -1
- package/bizar-dash/dist/assets/{MobileSettings-DjCPxC-Q.js.map → MobileSettings-CEQNJNLJ.js.map} +1 -1
- package/bizar-dash/dist/assets/{main-DYiZqMrn.js → main-IvfQAOfy.js} +1 -1
- package/bizar-dash/dist/assets/{main-DYiZqMrn.js.map → main-IvfQAOfy.js.map} +1 -1
- package/bizar-dash/dist/assets/{markdown-C6mXtQxD.js → markdown-tOLaD6nm.js} +1 -1
- package/bizar-dash/dist/assets/{markdown-C6mXtQxD.js.map → markdown-tOLaD6nm.js.map} +1 -1
- package/bizar-dash/dist/assets/{mobile-CMHqtLV2.js → mobile-DYCHcUpq.js} +1 -1
- package/bizar-dash/dist/assets/{mobile-CMHqtLV2.js.map → mobile-DYCHcUpq.js.map} +1 -1
- package/bizar-dash/dist/assets/{mobile-layout-3jIhHX_p.js → mobile-layout-CBHjpwsb.js} +2 -2
- package/bizar-dash/dist/assets/{mobile-layout-3jIhHX_p.js.map → mobile-layout-CBHjpwsb.js.map} +1 -1
- package/bizar-dash/dist/assets/{useSlashCommands-DtITw8Xv.js → useSlashCommands-Bd7_FA6U.js} +2 -2
- package/bizar-dash/dist/assets/{useSlashCommands-DtITw8Xv.js.map → useSlashCommands-Bd7_FA6U.js.map} +1 -1
- package/bizar-dash/dist/assets/{vendor-CeHGtduv.js → vendor-C843201K.js} +12 -12
- package/bizar-dash/dist/assets/vendor-C843201K.js.map +1 -0
- package/bizar-dash/dist/index.html +6 -6
- package/bizar-dash/dist/mobile.html +2 -2
- package/bizar-dash/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/bizar-dash/src/server/api.mjs +4 -4
- package/bizar-dash/src/server/background-store.mjs +15 -16
- package/bizar-dash/src/server/bg-poller.mjs +25 -35
- package/bizar-dash/src/server/bg-retry.mjs +66 -194
- package/bizar-dash/src/server/claude-bg-spawner.mjs +390 -0
- package/bizar-dash/src/server/claude-info.mjs +412 -0
- package/bizar-dash/src/server/{cline-runner.mjs → claude-runner.mjs} +53 -48
- package/bizar-dash/src/server/claude-sdk.mjs +191 -0
- package/bizar-dash/src/server/providers-store.mjs +22 -49
- package/bizar-dash/src/server/routes/background.mjs +24 -20
- package/bizar-dash/src/server/routes/chat.mjs +223 -326
- package/bizar-dash/src/server/routes/claude-session-detail.mjs +329 -0
- package/bizar-dash/src/server/routes/claude-sessions.mjs +259 -0
- package/bizar-dash/src/server/routes/tasks.mjs +20 -28
- package/bizar-dash/src/server/task-delegator.mjs +76 -77
- package/bizar-dash/src/web/components/chat/useChat.ts +23 -27
- package/bizar-dash/src/web/views/Chat.tsx +8 -8
- package/cli/bin.mjs +17 -18
- package/cli/commands/claude-cmd.mjs +348 -0
- package/cli/commands/install.mjs +12 -11
- package/cli/commands/validate.mjs +252 -325
- package/cli/dev-link.test.mjs +11 -11
- package/cli/doctor.mjs +131 -213
- package/cli/install.mjs +33 -37
- package/cli/install.test.mjs +9 -9
- package/cli/provision-claude.mjs +893 -0
- package/cli/provision.mjs +224 -227
- package/cli/utils.mjs +72 -58
- package/config/AGENTS.md +28 -28
- package/install.sh +66 -44
- package/package.json +19 -11
- package/packages/sdk/ARCHITECTURE.md +40 -36
- package/packages/sdk/package-lock.json +32 -0
- package/packages/sdk/package.json +15 -5
- package/{plugins/bizar → packages/sdk}/src/dangerous-patterns.ts +6 -28
- package/packages/sdk/src/fingerprint.ts +0 -0
- package/packages/sdk/src/index.ts +38 -73
- package/packages/sdk/src/mcp/bin.ts +51 -0
- package/packages/sdk/src/mcp/server.ts +498 -0
- package/{plugins/bizar/src/memory-vault.ts → packages/sdk/src/memory/index.ts} +18 -21
- package/packages/sdk/tests/sdk.test.mjs +148 -0
- package/packages/sdk/vitest.config.ts +1 -1
- package/scripts/bh-full-e2e.mjs +166 -363
- package/scripts/check-deps.mjs +28 -46
- package/scripts/mirror-claude-md.sh +78 -0
- package/scripts/test-in-container.sh +31 -9
- package/templates/clean-state-checklist.md +3 -3
- package/templates/sprint-contract.md +2 -2
- package/bizar-dash/.bizar/activity.log +0 -3
- package/bizar-dash/.omx/logs/omx-2026-07-07.jsonl +0 -1
- package/bizar-dash/.omx/state/session.json +0 -10
- package/bizar-dash/bizar-design/EXPLANATION.md +0 -307
- package/bizar-dash/bizar-design/INSTRUCTIONS.md +0 -149
- package/bizar-dash/bizar-design/canvas.html +0 -281
- package/bizar-dash/bizar-design/canvas.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/components.css +0 -1665
- package/bizar-dash/bizar-design/components.html +0 -557
- package/bizar-dash/bizar-design/components.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/desktop/agents.html +0 -74
- package/bizar-dash/bizar-design/desktop/agents.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/desktop/memory.html +0 -75
- package/bizar-dash/bizar-design/desktop/memory.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/desktop/metrics.html +0 -63
- package/bizar-dash/bizar-design/desktop/metrics.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/desktop/overview.html +0 -95
- package/bizar-dash/bizar-design/desktop/overview.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/desktop/settings.html +0 -70
- package/bizar-dash/bizar-design/desktop/settings.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/icons.svg +0 -44
- package/bizar-dash/bizar-design/index.html +0 -192
- package/bizar-dash/bizar-design/index.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/mobile/agents.html +0 -29
- package/bizar-dash/bizar-design/mobile/agents.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/mobile/memory.html +0 -28
- package/bizar-dash/bizar-design/mobile/memory.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/mobile/metrics.html +0 -29
- package/bizar-dash/bizar-design/mobile/metrics.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/mobile/overview.html +0 -33
- package/bizar-dash/bizar-design/mobile/overview.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/mobile/settings.html +0 -28
- package/bizar-dash/bizar-design/mobile/settings.html.artifact.json +0 -19
- package/bizar-dash/bizar-design/prototype.js +0 -114
- package/bizar-dash/bizar-design/tokens.css +0 -106
- package/bizar-dash/dist/assets/vendor-CeHGtduv.js.map +0 -1
- package/bizar-dash/node_modules/.package-lock.json +0 -6
- package/bizar-dash/package-lock.json +0 -6
- package/bizar-dash/src/server/cline-sdk.mjs +0 -132
- package/bizar-dash/src/server/routes/cline-session-detail.mjs +0 -559
- package/bizar-dash/src/server/routes/cline-sessions.mjs +0 -291
- package/cli/commands/cline-cmd.mjs +0 -289
- package/cli/commands/validate.test.mjs +0 -379
- package/cli/doctor.test.mjs +0 -350
- package/config/cline.json.template +0 -342
- package/packages/sdk/src/client.ts +0 -188
- package/packages/sdk/src/cline-events.ts +0 -134
- package/packages/sdk/src/cline-types.ts +0 -66
- package/packages/sdk/src/cline.ts +0 -339
- package/packages/sdk/src/errors.ts +0 -129
- package/packages/sdk/src/events.ts +0 -153
- package/packages/sdk/src/types.ts +0 -176
- package/packages/sdk/tests/client.test.ts +0 -217
- package/packages/sdk/tests/errors.test.ts +0 -108
- package/packages/sdk/tests/events.test.ts +0 -139
- package/packages/sdk/tests/fixtures/fetch-mock.ts +0 -152
- package/packages/sdk/tests/fixtures/sse-mock.ts +0 -30
- package/plugins/bizar/ARCHITECTURE.md +0 -142
- package/plugins/bizar/CONSTRAINTS.md +0 -67
- package/plugins/bizar/LICENSE +0 -21
- package/plugins/bizar/README.md +0 -448
- package/plugins/bizar/index.ts +0 -925
- package/plugins/bizar/package.json +0 -39
- package/plugins/bizar/scripts/check-forbidden-imports.sh +0 -33
- package/plugins/bizar/src/background-state.ts +0 -641
- package/plugins/bizar/src/background.ts +0 -1806
- package/plugins/bizar/src/cline-runner.ts +0 -203
- package/plugins/bizar/src/clineruntime.ts +0 -227
- package/plugins/bizar/src/commands-impl.ts +0 -151
- package/plugins/bizar/src/commands.ts +0 -1799
- package/plugins/bizar/src/compaction.d.mts +0 -48
- package/plugins/bizar/src/compaction.mjs +0 -192
- package/plugins/bizar/src/dashboard-client.ts +0 -233
- package/plugins/bizar/src/event-stream.ts +0 -606
- package/plugins/bizar/src/fingerprint.ts +0 -120
- package/plugins/bizar/src/handoff.ts +0 -79
- package/plugins/bizar/src/hooks/memory-flush-on-compact.ts +0 -123
- package/plugins/bizar/src/hooks/memory-inject.ts +0 -247
- package/plugins/bizar/src/hooks/memory-write-on-end.ts +0 -188
- package/plugins/bizar/src/hooks/skill-curator.ts +0 -180
- package/plugins/bizar/src/http-client.ts +0 -467
- package/plugins/bizar/src/key-rotation.ts +0 -218
- package/plugins/bizar/src/logger.ts +0 -144
- package/plugins/bizar/src/loop-engineering.ts +0 -241
- package/plugins/bizar/src/loop.ts +0 -176
- package/plugins/bizar/src/mistake-recovery.ts +0 -98
- package/plugins/bizar/src/odin.ts +0 -227
- package/plugins/bizar/src/options.ts +0 -470
- package/plugins/bizar/src/plan-fs.ts +0 -323
- package/plugins/bizar/src/reasoning-clean.ts +0 -454
- package/plugins/bizar/src/report.ts +0 -178
- package/plugins/bizar/src/research-prompt.ts +0 -35
- package/plugins/bizar/src/serve-info.ts +0 -228
- package/plugins/bizar/src/serve.ts +0 -496
- package/plugins/bizar/src/settings.ts +0 -349
- package/plugins/bizar/src/state.ts +0 -298
- package/plugins/bizar/src/tool-discipline.ts +0 -105
- package/plugins/bizar/src/tools/agent-browser.ts +0 -315
- package/plugins/bizar/src/tools/bg-collect.ts +0 -131
- package/plugins/bizar/src/tools/bg-get-comments.ts +0 -266
- package/plugins/bizar/src/tools/bg-kill.ts +0 -116
- package/plugins/bizar/src/tools/bg-pause.ts +0 -99
- package/plugins/bizar/src/tools/bg-report-progress.ts +0 -115
- package/plugins/bizar/src/tools/bg-resume.ts +0 -94
- package/plugins/bizar/src/tools/bg-send-message.ts +0 -223
- package/plugins/bizar/src/tools/bg-spawn.ts +0 -502
- package/plugins/bizar/src/tools/bg-status.ts +0 -130
- package/plugins/bizar/src/tools/graph-query.ts +0 -278
- package/plugins/bizar/src/tools/loop-engineering.ts +0 -193
- package/plugins/bizar/src/tools/memory-list.ts +0 -43
- package/plugins/bizar/src/tools/memory-read.ts +0 -69
- package/plugins/bizar/src/tools/memory-search.ts +0 -47
- package/plugins/bizar/src/tools/memory-write.ts +0 -54
- package/plugins/bizar/src/tools/open-kb.ts +0 -198
- package/plugins/bizar/src/tools/plan-action.ts +0 -785
- package/plugins/bizar/src/tools/read-glyph-feedback.ts +0 -191
- package/plugins/bizar/src/tools/sandbox.ts +0 -232
- package/plugins/bizar/src/tools/team-spawn.ts +0 -73
- package/plugins/bizar/src/tools/team-status.ts +0 -76
- package/plugins/bizar/src/tools/wait-for-feedback.ts +0 -415
- package/plugins/bizar/src/trajectory.ts +0 -104
- package/plugins/bizar/tests/README.md +0 -99
- package/plugins/bizar/tests/attach-handler-bug.test.ts +0 -169
- package/plugins/bizar/tests/background-state.test.ts +0 -277
- package/plugins/bizar/tests/background.test.ts +0 -402
- package/plugins/bizar/tests/block.test.ts +0 -195
- package/plugins/bizar/tests/canonical-key-order.test.ts +0 -75
- package/plugins/bizar/tests/clineruntime-config.test.ts +0 -283
- package/plugins/bizar/tests/commands-impl.test.ts +0 -316
- package/plugins/bizar/tests/commands.test.ts +0 -584
- package/plugins/bizar/tests/compaction.test.ts +0 -264
- package/plugins/bizar/tests/config.test.ts +0 -128
- package/plugins/bizar/tests/dashboard-client.test.ts +0 -159
- package/plugins/bizar/tests/dispose.test.ts +0 -336
- package/plugins/bizar/tests/event-stream.test.ts +0 -409
- package/plugins/bizar/tests/event.test.ts +0 -262
- package/plugins/bizar/tests/fingerprint.test.ts +0 -190
- package/plugins/bizar/tests/http-client.test.ts +0 -404
- package/plugins/bizar/tests/init-helpers.test.ts +0 -203
- package/plugins/bizar/tests/integration/slash-command.test.ts +0 -349
- package/plugins/bizar/tests/integration/tool-routing.test.ts +0 -98
- package/plugins/bizar/tests/key-rotation.test.ts +0 -396
- package/plugins/bizar/tests/loop-engineering.test.ts +0 -168
- package/plugins/bizar/tests/loop.test.ts +0 -397
- package/plugins/bizar/tests/memory-write-on-end.test.ts +0 -92
- package/plugins/bizar/tests/mistake-recovery.test.ts +0 -116
- package/plugins/bizar/tests/odin.test.ts +0 -125
- package/plugins/bizar/tests/options.test.ts +0 -329
- package/plugins/bizar/tests/reasoning-clean.test.ts +0 -422
- package/plugins/bizar/tests/safety.test.ts +0 -281
- package/plugins/bizar/tests/serve.test.ts +0 -339
- package/plugins/bizar/tests/settings.test.ts +0 -351
- package/plugins/bizar/tests/stall-think.test.ts +0 -750
- package/plugins/bizar/tests/state.test.ts +0 -276
- package/plugins/bizar/tests/tool-discipline.test.ts +0 -77
- package/plugins/bizar/tests/tools/agent-browser.test.ts +0 -98
- package/plugins/bizar/tests/tools/bg-collect.test.ts +0 -337
- package/plugins/bizar/tests/tools/bg-get-comments.test.ts +0 -485
- package/plugins/bizar/tests/tools/bg-kill.test.ts +0 -235
- package/plugins/bizar/tests/tools/bg-pause.test.ts +0 -61
- package/plugins/bizar/tests/tools/bg-report-progress.test.ts +0 -79
- package/plugins/bizar/tests/tools/bg-resume.test.ts +0 -40
- package/plugins/bizar/tests/tools/bg-send-message.test.ts +0 -116
- package/plugins/bizar/tests/tools/bg-spawn-delegation.test.ts +0 -147
- package/plugins/bizar/tests/tools/bg-spawn-http.test.ts +0 -233
- package/plugins/bizar/tests/tools/bg-spawn.test.ts +0 -311
- package/plugins/bizar/tests/tools/bg-status.test.ts +0 -217
- package/plugins/bizar/tests/tools/cline-runner.test.ts +0 -115
- package/plugins/bizar/tests/tools/plan-action.test.ts +0 -599
- package/plugins/bizar/tests/tools/read-glyph-feedback.test.ts +0 -253
- package/plugins/bizar/tests/tools/sandbox.test.ts +0 -117
- package/plugins/bizar/tests/tools/wait-for-feedback.test.ts +0 -390
- package/plugins/bizar/tests/update-deadlock.test.ts +0 -151
- package/plugins/bizar/tsconfig.json +0 -29
- package/scripts/mirror-agents-md.sh +0 -69
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* plugins/bizar/tests/odin.test.ts
|
|
3
|
-
*
|
|
4
|
-
* Unit tests for the Odin orchestrator decomposition logic.
|
|
5
|
-
*
|
|
6
|
-
* Odin takes a user prompt, decomposes it into subtasks, and assigns
|
|
7
|
-
* roles based on keyword analysis. v1 uses heuristic sentence splitting
|
|
8
|
-
* + role templates (no LLM in the loop). These tests verify that
|
|
9
|
-
* decomposition produces sensible outputs for representative inputs.
|
|
10
|
-
*/
|
|
11
|
-
import { describe, test, expect } from "bun:test";
|
|
12
|
-
|
|
13
|
-
import { decomposeTask, buildOdinPrompt, type OdinDecomposition } from "../src/odin";
|
|
14
|
-
|
|
15
|
-
describe("decomposeTask — single-sentence fallback", () => {
|
|
16
|
-
test("returns 2-step research+implement default", () => {
|
|
17
|
-
const out = decomposeTask("Build a CLI todo app");
|
|
18
|
-
expect(out.subtasks).toHaveLength(2);
|
|
19
|
-
expect(out.subtasks[0].role).toBe("mimir");
|
|
20
|
-
expect(out.subtasks[1].role).toBe("thor");
|
|
21
|
-
expect(out.subtasks[0].blocking).toBe(true);
|
|
22
|
-
expect(out.estimatedAgents).toBe(3);
|
|
23
|
-
expect(out.rationale).toContain("defaulted");
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
test("empty task → empty decomposition", () => {
|
|
27
|
-
const out = decomposeTask("");
|
|
28
|
-
expect(out.subtasks).toEqual([]);
|
|
29
|
-
expect(out.estimatedAgents).toBe(0);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
test("whitespace-only task → empty decomposition", () => {
|
|
33
|
-
const out = decomposeTask(" \n\t ");
|
|
34
|
-
expect(out.subtasks).toEqual([]);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
describe("decomposeTask — sentence splitting", () => {
|
|
39
|
-
test("splits on period + space", () => {
|
|
40
|
-
const out = decomposeTask("Research the auth library. Implement the OAuth flow. Test the integration.");
|
|
41
|
-
expect(out.subtasks.length).toBeGreaterThanOrEqual(2);
|
|
42
|
-
expect(out.subtasks[0].role).toBe("mimir"); // research
|
|
43
|
-
expect(out.subtasks[1].role).toBe("thor"); // implement
|
|
44
|
-
expect(out.subtasks[2].role).toBe("forseti"); // test
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test("splits on ' and ' when no periods", () => {
|
|
48
|
-
const out = decomposeTask("Research auth libraries and implement the OAuth flow");
|
|
49
|
-
expect(out.subtasks).toHaveLength(2);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
test("caps at maxSubtasks (default 4)", () => {
|
|
53
|
-
const out = decomposeTask(
|
|
54
|
-
"Step A. Step B. Step C. Step D. Step E. Step F. Step G.",
|
|
55
|
-
);
|
|
56
|
-
expect(out.subtasks.length).toBeLessThanOrEqual(4);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
test("merges adjacent same-role sentences when overflowing", () => {
|
|
60
|
-
// 7 sentences that all map to "thor" — should merge down to ≤4.
|
|
61
|
-
const out = decomposeTask(
|
|
62
|
-
"Build a function. Build another function. Build a class. " +
|
|
63
|
-
"Build a service. Build an API. Build a CLI. Test the result.",
|
|
64
|
-
);
|
|
65
|
-
expect(out.subtasks.length).toBeLessThanOrEqual(4);
|
|
66
|
-
// First subtask should still be thor (build keyword).
|
|
67
|
-
expect(out.subtasks[0].role).toBe("thor");
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
describe("decomposeTask — role assignment", () => {
|
|
72
|
-
test("UI-related → baldr", () => {
|
|
73
|
-
const out = decomposeTask("Design a new UI for the dashboard. Animate the buttons.");
|
|
74
|
-
const roles = out.subtasks.map((s) => s.role);
|
|
75
|
-
expect(roles.some((r) => r === "baldr")).toBe(true);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
test("testing-related → forseti", () => {
|
|
79
|
-
const out = decomposeTask("Add unit tests for the parser and verify coverage.");
|
|
80
|
-
const roles = out.subtasks.map((s) => s.role);
|
|
81
|
-
expect(roles.some((r) => r === "forseti")).toBe(true);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
test("research-related → mimir", () => {
|
|
85
|
-
const out = decomposeTask("Investigate the docs. Survey the codebase. Analyze patterns.");
|
|
86
|
-
const roles = out.subtasks.map((s) => s.role);
|
|
87
|
-
expect(roles.some((r) => r === "mimir")).toBe(true);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
test("debug-related → tyr", () => {
|
|
91
|
-
const out = decomposeTask("Debug the bug. Investigate the root cause.");
|
|
92
|
-
const roles = out.subtasks.map((s) => s.role);
|
|
93
|
-
expect(roles.some((r) => r === "tyr")).toBe(true);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
describe("buildOdinPrompt", () => {
|
|
98
|
-
test("includes mission, subtasks, and rationale", () => {
|
|
99
|
-
const decomp = decomposeTask("Build a CLI todo app");
|
|
100
|
-
const prompt = buildOdinPrompt("Build a CLI todo app", decomp);
|
|
101
|
-
expect(prompt).toContain("You are Odin");
|
|
102
|
-
expect(prompt).toContain("## Mission");
|
|
103
|
-
expect(prompt).toContain("Build a CLI todo app");
|
|
104
|
-
expect(prompt).toContain("## Subtasks");
|
|
105
|
-
expect(prompt).toContain("## Coordination");
|
|
106
|
-
expect(prompt).toContain("## Rationale");
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
test("marks blocking subtasks explicitly", () => {
|
|
110
|
-
const decomp: OdinDecomposition = {
|
|
111
|
-
subtasks: [
|
|
112
|
-
{ title: "Research", prompt: "do research", role: "mimir", blocking: true },
|
|
113
|
-
{ title: "Implement", prompt: "implement", role: "thor" },
|
|
114
|
-
],
|
|
115
|
-
estimatedAgents: 3,
|
|
116
|
-
rationale: "test",
|
|
117
|
-
};
|
|
118
|
-
const prompt = buildOdinPrompt("x", decomp);
|
|
119
|
-
expect(prompt).toContain("blocking");
|
|
120
|
-
// The non-blocking entry should not have "blocking" appended.
|
|
121
|
-
const implMatch = prompt.match(/2\.\s+\*\*Implement\*\*/);
|
|
122
|
-
expect(implMatch).toBeTruthy();
|
|
123
|
-
expect(prompt.indexOf("(thor, blocking)")).toBeLessThan(prompt.indexOf("(thor)"));
|
|
124
|
-
});
|
|
125
|
-
});
|
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import os from "node:os";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import {
|
|
5
|
-
DEFAULT_OPTIONS,
|
|
6
|
-
expandHome,
|
|
7
|
-
findOffendingPath,
|
|
8
|
-
findSecretDirMatch,
|
|
9
|
-
normalizeOptions,
|
|
10
|
-
readEnvFlags,
|
|
11
|
-
type NormalizedOptions,
|
|
12
|
-
} from "../src/options";
|
|
13
|
-
|
|
14
|
-
const D = DEFAULT_OPTIONS;
|
|
15
|
-
|
|
16
|
-
// ── expandHome ────────────────────────────────────────────────────────────────
|
|
17
|
-
|
|
18
|
-
test("expandHome converts ~ to homedir", () => {
|
|
19
|
-
const home = process.env.HOME ?? "/home/test";
|
|
20
|
-
expect(expandHome("~")).toBe(home);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
test("expandHome converts ~-prefixed paths", () => {
|
|
24
|
-
const home = process.env.HOME ?? "/home/test";
|
|
25
|
-
expect(expandHome("~/foo/bar")).toBe(`${home}/foo/bar`);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
test("expandHome leaves absolute paths alone", () => {
|
|
29
|
-
expect(expandHome("/absolute/path")).toBe("/absolute/path");
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
// ── normalizeOptions ──────────────────────────────────────────────────────────
|
|
33
|
-
|
|
34
|
-
describe("normalizeOptions", () => {
|
|
35
|
-
test("returns DEFAULT_OPTIONS when passed undefined", () => {
|
|
36
|
-
const { options, notes } = normalizeOptions(undefined);
|
|
37
|
-
expect(options.loopThresholdWarn).toBe(D.loopThresholdWarn);
|
|
38
|
-
expect(options.loopThresholdEscalate).toBe(D.loopThresholdEscalate);
|
|
39
|
-
expect(options.loopThresholdBlock).toBe(D.loopThresholdBlock);
|
|
40
|
-
expect(options.loopWindowSize).toBe(D.loopWindowSize);
|
|
41
|
-
expect(options.logDir).toBe(D.logDir);
|
|
42
|
-
expect(options.stateDir).toBe(D.stateDir);
|
|
43
|
-
expect(options.logRotationBytes).toBe(D.logRotationBytes);
|
|
44
|
-
expect(notes).toContain(`loopThresholdWarn defaulted to ${D.loopThresholdWarn}`);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test("returns DEFAULT_OPTIONS when passed empty object", () => {
|
|
48
|
-
const { options, notes } = normalizeOptions({});
|
|
49
|
-
expect(options.loopThresholdWarn).toBe(D.loopThresholdWarn);
|
|
50
|
-
expect(notes).toContain(`loopThresholdWarn defaulted to ${D.loopThresholdWarn}`);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
test("negative loopThresholdWarn is clamped to 1", () => {
|
|
54
|
-
const { options, notes } = normalizeOptions({ loopThresholdWarn: -5 });
|
|
55
|
-
expect(options.loopThresholdWarn).toBe(1);
|
|
56
|
-
expect(notes).toContain("loopThresholdWarn -5 clamped to 1");
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
test("zero loopThresholdWarn is clamped to 1", () => {
|
|
60
|
-
const { options } = normalizeOptions({ loopThresholdWarn: 0 });
|
|
61
|
-
expect(options.loopThresholdWarn).toBe(1);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
test("loopThresholdWarn of 3 is preserved", () => {
|
|
65
|
-
const { options } = normalizeOptions({ loopThresholdWarn: 3 });
|
|
66
|
-
expect(options.loopThresholdWarn).toBe(3);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test("warn >= escalate → escalate bumped above warn", () => {
|
|
70
|
-
// warn=5, escalate=5 → escalate becomes 6
|
|
71
|
-
const { options, notes } = normalizeOptions({ loopThresholdWarn: 5, loopThresholdEscalate: 5 });
|
|
72
|
-
expect(options.loopThresholdWarn).toBe(5);
|
|
73
|
-
expect(options.loopThresholdEscalate).toBe(6);
|
|
74
|
-
expect(notes.some((n) => n.includes("adjusted from 5 to 6"))).toBe(true);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
test("escalate >= block → block bumped above escalate", () => {
|
|
78
|
-
// escalate=8, block=8 → block becomes 9
|
|
79
|
-
const { options, notes } = normalizeOptions({ loopThresholdEscalate: 8, loopThresholdBlock: 8 });
|
|
80
|
-
expect(options.loopThresholdEscalate).toBe(8);
|
|
81
|
-
expect(options.loopThresholdBlock).toBe(9);
|
|
82
|
-
expect(notes.some((n) => n.includes("adjusted from 8 to 9"))).toBe(true);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
test("loopWindowSize below 3 is clamped to 3", () => {
|
|
86
|
-
const { options, notes } = normalizeOptions({ loopWindowSize: 1 });
|
|
87
|
-
expect(options.loopWindowSize).toBe(3);
|
|
88
|
-
expect(notes).toContain("loopWindowSize 1 clamped to 3 (minimum)");
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
test("loopWindowSize above 50 is clamped to 50", () => {
|
|
92
|
-
const { options, notes } = normalizeOptions({ loopWindowSize: 200 });
|
|
93
|
-
expect(options.loopWindowSize).toBe(50);
|
|
94
|
-
expect(notes).toContain("loopWindowSize 200 clamped to 50 (maximum)");
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
test("loopWindowSize within [3,50] is preserved", () => {
|
|
98
|
-
const { options } = normalizeOptions({ loopWindowSize: 25 });
|
|
99
|
-
expect(options.loopWindowSize).toBe(25);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
test("block > window + 2 → block clamped down", () => {
|
|
103
|
-
// block=50, window=10 → block must be ≤ 12
|
|
104
|
-
const { options, notes } = normalizeOptions({ loopThresholdBlock: 50, loopWindowSize: 10 });
|
|
105
|
-
expect(options.loopThresholdBlock).toBe(12);
|
|
106
|
-
expect(notes.some((n) => n.includes("adjusted to 12"))).toBe(true);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
test("NaN threshold → uses default", () => {
|
|
110
|
-
const { options } = normalizeOptions({ loopThresholdWarn: NaN });
|
|
111
|
-
expect(options.loopThresholdWarn).toBe(D.loopThresholdWarn);
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
test("string threshold value is parsed", () => {
|
|
115
|
-
const { options } = normalizeOptions({ loopThresholdWarn: "7" });
|
|
116
|
-
expect(options.loopThresholdWarn).toBe(7);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
test("non-numeric string threshold → uses default", () => {
|
|
120
|
-
const { options } = normalizeOptions({ loopThresholdWarn: "not-a-number" });
|
|
121
|
-
expect(options.loopThresholdWarn).toBe(D.loopThresholdWarn);
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
test("logRotationBytes below 1024 is clamped to 1024", () => {
|
|
125
|
-
const { options, notes } = normalizeOptions({ logRotationBytes: 500 });
|
|
126
|
-
expect(options.logRotationBytes).toBe(1024);
|
|
127
|
-
expect(notes).toContain("logRotationBytes 500 clamped to 1024 (minimum)");
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
test("custom logDir and stateDir are preserved", () => {
|
|
131
|
-
const { options } = normalizeOptions({ logDir: path.join(os.tmpdir(), "my-logs"), stateDir: path.join(os.tmpdir(), "my-state") });
|
|
132
|
-
expect(options.logDir).toBe(path.join(os.tmpdir(), "my-logs"));
|
|
133
|
-
expect(options.stateDir).toBe(path.join(os.tmpdir(), "my-state"));
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
// ── findSecretDirMatch ───────────────────────────────────────────────────────
|
|
138
|
-
|
|
139
|
-
describe("findSecretDirMatch", () => {
|
|
140
|
-
const home = process.env.HOME ?? "/home/test";
|
|
141
|
-
|
|
142
|
-
test("returns null for safe paths", () => {
|
|
143
|
-
expect(findSecretDirMatch(path.join(os.tmpdir(), "foo"))).toBeNull();
|
|
144
|
-
expect(findSecretDirMatch("/home/user/project")).toBeNull();
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
test("returns null for paths that are prefix siblings", () => {
|
|
148
|
-
// ~/.ssh-foo is NOT ~/.ssh
|
|
149
|
-
expect(findSecretDirMatch(`${home}/.ssh-foo`)).toBeNull();
|
|
150
|
-
expect(findSecretDirMatch(`${home}/.ssh-foo/bar`)).toBeNull();
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
test("returns the secret kind for exact secret dir", () => {
|
|
154
|
-
expect(findSecretDirMatch(`${home}/.ssh`)).toBe("~/.ssh");
|
|
155
|
-
expect(findSecretDirMatch(`${home}/.gnupg`)).toBe("~/.gnupg");
|
|
156
|
-
expect(findSecretDirMatch(`${home}/.aws`)).toBe("~/.aws");
|
|
157
|
-
expect(findSecretDirMatch(`${home}/.kube`)).toBe("~/.kube");
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
test("returns the secret kind for descendant paths", () => {
|
|
161
|
-
expect(findSecretDirMatch(`${home}/.ssh/keys`)).toBe("~/.ssh");
|
|
162
|
-
expect(findSecretDirMatch(`${home}/.ssh/keys/id_rsa`)).toBe("~/.ssh");
|
|
163
|
-
expect(findSecretDirMatch(`${home}/.gnupg/private`)).toBe("~/.gnupg");
|
|
164
|
-
expect(findSecretDirMatch(`${home}/.aws/credentials`)).toBe("~/.aws");
|
|
165
|
-
expect(findSecretDirMatch(`${home}/.kube/config`)).toBe("~/.kube");
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
test("tilde paths are expanded before comparison", () => {
|
|
169
|
-
expect(findSecretDirMatch("~/.ssh")).toBe("~/.ssh");
|
|
170
|
-
expect(findSecretDirMatch("~/.ssh/id_rsa")).toBe("~/.ssh");
|
|
171
|
-
expect(findSecretDirMatch("~/some-other-dir")).toBeNull();
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
test("refuses paths inside secret dir", () => {
|
|
175
|
-
expect(findSecretDirMatch(`${home}/.ssh/../ssh`)).toBeNull(); // resolves outside
|
|
176
|
-
expect(findSecretDirMatch(`${home}/.ssh/../.ssh/legit`)).toBe("~/.ssh"); // resolves to ~/.ssh
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
// ── findOffendingPath ────────────────────────────────────────────────────────
|
|
181
|
-
|
|
182
|
-
describe("findOffendingPath", () => {
|
|
183
|
-
test("returns null when both paths are safe", () => {
|
|
184
|
-
const opts: NormalizedOptions = {
|
|
185
|
-
...D,
|
|
186
|
-
logDir: path.join(os.tmpdir(), "bizar-logs"),
|
|
187
|
-
stateDir: path.join(os.tmpdir(), "bizar-state"),
|
|
188
|
-
};
|
|
189
|
-
expect(findOffendingPath(opts)).toBeNull();
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
test("returns offending logDir when it is inside a secret dir", () => {
|
|
193
|
-
const home = process.env.HOME ?? "/home/test";
|
|
194
|
-
const opts: NormalizedOptions = {
|
|
195
|
-
...D,
|
|
196
|
-
logDir: `${home}/.ssh/evil`,
|
|
197
|
-
stateDir: path.join(os.tmpdir(), "bizar-state"),
|
|
198
|
-
};
|
|
199
|
-
const result = findOffendingPath(opts);
|
|
200
|
-
expect(result).not.toBeNull();
|
|
201
|
-
expect(result!.kind).toBe("~/.ssh");
|
|
202
|
-
expect(result!.path).toContain(".ssh");
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
test("returns offending stateDir when it is inside a secret dir", () => {
|
|
206
|
-
const home = process.env.HOME ?? "/home/test";
|
|
207
|
-
const opts: NormalizedOptions = {
|
|
208
|
-
...D,
|
|
209
|
-
logDir: path.join(os.tmpdir(), "bizar-logs"),
|
|
210
|
-
stateDir: `${home}/.aws/creds`,
|
|
211
|
-
};
|
|
212
|
-
const result = findOffendingPath(opts);
|
|
213
|
-
expect(result).not.toBeNull();
|
|
214
|
-
expect(result!.kind).toBe("~/.aws");
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
test("logDir takes priority over stateDir in error message", () => {
|
|
218
|
-
const home = process.env.HOME ?? "/home/test";
|
|
219
|
-
const opts: NormalizedOptions = {
|
|
220
|
-
...D,
|
|
221
|
-
logDir: `${home}/.ssh/evil`,
|
|
222
|
-
stateDir: `${home}/.gnupg/evil`,
|
|
223
|
-
};
|
|
224
|
-
const result = findOffendingPath(opts);
|
|
225
|
-
// logDir is checked first
|
|
226
|
-
expect(result!.kind).toBe("~/.ssh");
|
|
227
|
-
});
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
// ── readEnvFlags ─────────────────────────────────────────────────────────────
|
|
231
|
-
|
|
232
|
-
describe("readEnvFlags", () => {
|
|
233
|
-
test("returns all false when env vars are not set", () => {
|
|
234
|
-
delete process.env.BIZAR_DISABLE;
|
|
235
|
-
delete process.env.BIZAR_DISABLE_LOOP;
|
|
236
|
-
delete process.env.BIZAR_DISABLE_LOG;
|
|
237
|
-
const flags = readEnvFlags();
|
|
238
|
-
expect(flags.disable).toBe(false);
|
|
239
|
-
expect(flags.disableLoop).toBe(false);
|
|
240
|
-
expect(flags.disableLog).toBe(false);
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
test("BIZAR_DISABLE=1 sets disable=true", () => {
|
|
244
|
-
process.env.BIZAR_DISABLE = "1";
|
|
245
|
-
const flags = readEnvFlags();
|
|
246
|
-
expect(flags.disable).toBe(true);
|
|
247
|
-
delete process.env.BIZAR_DISABLE;
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
test("BIZAR_DISABLE_LOOP=1 sets disableLoop=true", () => {
|
|
251
|
-
process.env.BIZAR_DISABLE_LOOP = "1";
|
|
252
|
-
const flags = readEnvFlags();
|
|
253
|
-
expect(flags.disableLoop).toBe(true);
|
|
254
|
-
delete process.env.BIZAR_DISABLE_LOOP;
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
test("BIZAR_DISABLE_LOG=1 sets disableLog=true", () => {
|
|
258
|
-
process.env.BIZAR_DISABLE_LOG = "1";
|
|
259
|
-
const flags = readEnvFlags();
|
|
260
|
-
expect(flags.disableLog).toBe(true);
|
|
261
|
-
delete process.env.BIZAR_DISABLE_LOG;
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
test("non-1 values are treated as false", () => {
|
|
265
|
-
process.env.BIZAR_DISABLE = "true";
|
|
266
|
-
process.env.BIZAR_DISABLE_LOOP = "yes";
|
|
267
|
-
process.env.BIZAR_DISABLE_LOG = "0";
|
|
268
|
-
const flags = readEnvFlags();
|
|
269
|
-
expect(flags.disable).toBe(false);
|
|
270
|
-
expect(flags.disableLoop).toBe(false);
|
|
271
|
-
expect(flags.disableLog).toBe(false);
|
|
272
|
-
delete process.env.BIZAR_DISABLE;
|
|
273
|
-
delete process.env.BIZAR_DISABLE_LOOP;
|
|
274
|
-
delete process.env.BIZAR_DISABLE_LOG;
|
|
275
|
-
});
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
// ── clineruntimeMaxConsecutiveMistakes ───────────────────────────────────────
|
|
279
|
-
|
|
280
|
-
describe("clineruntimeMaxConsecutiveMistakes (v0.3.1)", () => {
|
|
281
|
-
test("default is 10 when neither raw nor env is provided (v6.2.4)", () => {
|
|
282
|
-
delete process.env.BIZAR_MAX_CONSECUTIVE_MISTAKES;
|
|
283
|
-
const { options } = normalizeOptions({});
|
|
284
|
-
expect(options.clineruntimeMaxConsecutiveMistakes).toBe(10);
|
|
285
|
-
});
|
|
286
|
-
|
|
287
|
-
test("raw value is honored when in range", () => {
|
|
288
|
-
delete process.env.BIZAR_MAX_CONSECUTIVE_MISTAKES;
|
|
289
|
-
const { options, notes } = normalizeOptions({ clineruntimeMaxConsecutiveMistakes: 15 });
|
|
290
|
-
expect(options.clineruntimeMaxConsecutiveMistakes).toBe(15);
|
|
291
|
-
expect(notes.some((n) => n.includes("clineruntimeMaxConsecutiveMistakes"))).toBe(false);
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
test("below-range raw value is clamped to 3 (minimum)", () => {
|
|
295
|
-
delete process.env.BIZAR_MAX_CONSECUTIVE_MISTAKES;
|
|
296
|
-
const { options, notes } = normalizeOptions({ clineruntimeMaxConsecutiveMistakes: 1 });
|
|
297
|
-
expect(options.clineruntimeMaxConsecutiveMistakes).toBe(3);
|
|
298
|
-
expect(notes.some((n) => n.includes("clamped to 3"))).toBe(true);
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
test("above-range raw value is clamped to 20 (maximum)", () => {
|
|
302
|
-
delete process.env.BIZAR_MAX_CONSECUTIVE_MISTAKES;
|
|
303
|
-
const { options, notes } = normalizeOptions({ clineruntimeMaxConsecutiveMistakes: 100 });
|
|
304
|
-
expect(options.clineruntimeMaxConsecutiveMistakes).toBe(20);
|
|
305
|
-
expect(notes.some((n) => n.includes("clamped to 20"))).toBe(true);
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
test("raw option takes precedence over env (raw wins when both set)", () => {
|
|
309
|
-
process.env.BIZAR_MAX_CONSECUTIVE_MISTAKES = "8";
|
|
310
|
-
const { options, notes } = normalizeOptions({ clineruntimeMaxConsecutiveMistakes: 12 });
|
|
311
|
-
expect(options.clineruntimeMaxConsecutiveMistakes).toBe(12);
|
|
312
|
-
expect(notes.some((n) => n.includes("(env)"))).toBe(false);
|
|
313
|
-
delete process.env.BIZAR_MAX_CONSECUTIVE_MISTAKES;
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
test("env var clamps when out of range", () => {
|
|
317
|
-
process.env.BIZAR_MAX_CONSECUTIVE_MISTAKES = "999";
|
|
318
|
-
const { options, notes } = normalizeOptions({});
|
|
319
|
-
expect(options.clineruntimeMaxConsecutiveMistakes).toBe(20);
|
|
320
|
-
expect(notes.some((n) => n.includes("(env) clamped"))).toBe(true);
|
|
321
|
-
delete process.env.BIZAR_MAX_CONSECUTIVE_MISTAKES;
|
|
322
|
-
});
|
|
323
|
-
|
|
324
|
-
test("non-numeric raw falls back to default (10)", () => {
|
|
325
|
-
delete process.env.BIZAR_MAX_CONSECUTIVE_MISTAKES;
|
|
326
|
-
const { options } = normalizeOptions({ clineruntimeMaxConsecutiveMistakes: "not-a-number" });
|
|
327
|
-
expect(options.clineruntimeMaxConsecutiveMistakes).toBe(10);
|
|
328
|
-
});
|
|
329
|
-
});
|