@polderlabs/bizar 6.2.4 → 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 +31 -18
- package/cli/commands/claude-cmd.mjs +348 -0
- package/cli/commands/install.mjs +12 -11
- package/cli/commands/sandbox.mjs +220 -0
- package/cli/commands/validate.mjs +252 -288
- 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 +330 -226
- package/cli/provision.test.mjs +102 -0
- package/cli/utils.mjs +72 -58
- package/config/AGENTS.md +28 -28
- package/config/agents/_shared/AGENT_BASELINE.md +104 -684
- package/config/skills/bizar/SKILL.md +197 -0
- package/config/skills/cubesandbox/SKILL.md +148 -0
- package/config/skills/harness-engineering/SKILL.md +142 -0
- 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 +157 -0
- 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 -344
- 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 -872
- 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/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 -162
- 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 -256
- 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/wait-for-feedback.test.ts +0 -390
- package/plugins/bizar/tests/update-deadlock.test.ts +0 -151
- package/plugins/bizar/tsconfig.json +0 -29
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* src/server/routes/cline-sessions.mjs
|
|
3
|
-
*
|
|
4
|
-
* /api/cline-sessions — list cline sessions
|
|
5
|
-
* POST /api/cline-sessions/new — create a new cline session
|
|
6
|
-
* PATCH /api/cline-sessions/:id — rename an cline session
|
|
7
|
-
* DELETE /api/cline-sessions/:id — delete an cline session
|
|
8
|
-
*
|
|
9
|
-
* The list endpoint reads from the cline SQLite database
|
|
10
|
-
* (~/.local/share/cline/cline.db). The mutating endpoints
|
|
11
|
-
* talk to the cline serve child via the helpers in
|
|
12
|
-
* `../serve-info.mjs` (see `createClineSession`,
|
|
13
|
-
* `updateClineSession`, `deleteClineSession`).
|
|
14
|
-
*
|
|
15
|
-
* Both surfaces share directory-resolution logic: we discover the
|
|
16
|
-
* session's directory from `listClineSessions()` and fall back to
|
|
17
|
-
* `info.worktree` so a freshly created session (not yet listed) can
|
|
18
|
-
* still be addressed using the active project's path or the plugin's
|
|
19
|
-
* recorded cwd.
|
|
20
|
-
*
|
|
21
|
-
* v4.2.5 — Added POST/PATCH/DELETE so the dashboard's "New session"
|
|
22
|
-
* button, the rail row menu (rename / delete), and the info-panel
|
|
23
|
-
* actions all work end-to-end against the cline serve child.
|
|
24
|
-
* Sessions are filtered to non-archived (time_archived IS NULL) and
|
|
25
|
-
* ordered by most recently updated.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
import { Router } from 'express';
|
|
29
|
-
import { SpanStatusCode } from '@opentelemetry/api';
|
|
30
|
-
import Database from 'better-sqlite3';
|
|
31
|
-
import { join } from 'node:path';
|
|
32
|
-
import { homedir } from 'node:os';
|
|
33
|
-
import { wrap } from './_shared.mjs';
|
|
34
|
-
import { tracer } from '../otel.mjs';
|
|
35
|
-
import {
|
|
36
|
-
readServeInfo,
|
|
37
|
-
listClineSessions,
|
|
38
|
-
createClineSession,
|
|
39
|
-
updateClineSession,
|
|
40
|
-
deleteClineSession,
|
|
41
|
-
} from '../serve-info.mjs';
|
|
42
|
-
|
|
43
|
-
const DB_PATH = join(homedir(), '.local', 'share', 'cline', 'cline.db');
|
|
44
|
-
|
|
45
|
-
const SESSION_ID_RE = /^[A-Za-z0-9_-]{1,200}$/;
|
|
46
|
-
const AGENT_NAME_RE = /^[A-Za-z0-9_-]{1,64}$/;
|
|
47
|
-
const TITLE_MAX = 200;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Resolve the cline `directory` for a known session. Used by
|
|
51
|
-
* PATCH and DELETE so a session started from any worktree is
|
|
52
|
-
* addressed through its own scope.
|
|
53
|
-
*
|
|
54
|
-
* @param {ReturnType<typeof readServeInfo>} info
|
|
55
|
-
* @param {string} sessionId
|
|
56
|
-
* @returns {Promise<string|null>}
|
|
57
|
-
*/
|
|
58
|
-
async function resolveSessionDirectory(info, sessionId) {
|
|
59
|
-
if (!info) return null;
|
|
60
|
-
try {
|
|
61
|
-
const sessions = await listClineSessions(info, 5_000);
|
|
62
|
-
if (Array.isArray(sessions)) {
|
|
63
|
-
const entry = sessions.find((s) => s && s.id === sessionId);
|
|
64
|
-
const dir = entry?.location?.directory;
|
|
65
|
-
if (typeof dir === 'string' && dir.length > 0) return dir;
|
|
66
|
-
}
|
|
67
|
-
} catch {
|
|
68
|
-
/* fall through to worktree */
|
|
69
|
-
}
|
|
70
|
-
if (typeof info.worktree === 'string' && info.worktree.length > 0) {
|
|
71
|
-
return info.worktree;
|
|
72
|
-
}
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* @returns {import('express').Router}
|
|
78
|
-
*/
|
|
79
|
-
export function createClineSessionsRouter() {
|
|
80
|
-
const router = Router();
|
|
81
|
-
|
|
82
|
-
router.get('/cline-sessions', wrap(async (_req, res) => {
|
|
83
|
-
let db;
|
|
84
|
-
try {
|
|
85
|
-
db = new Database(DB_PATH, { readonly: true, fileMustExist: true });
|
|
86
|
-
const rows = db.prepare(`
|
|
87
|
-
SELECT id, title, project_id, time_created, time_updated
|
|
88
|
-
FROM session
|
|
89
|
-
WHERE time_archived IS NULL
|
|
90
|
-
ORDER BY time_updated DESC
|
|
91
|
-
LIMIT 200
|
|
92
|
-
`).all();
|
|
93
|
-
return res.json({
|
|
94
|
-
sessions: rows.map((r) => ({
|
|
95
|
-
id: r.id,
|
|
96
|
-
title: r.title,
|
|
97
|
-
project: r.project_id,
|
|
98
|
-
created: r.time_created,
|
|
99
|
-
updated: r.time_updated,
|
|
100
|
-
mtime: r.time_updated,
|
|
101
|
-
})),
|
|
102
|
-
});
|
|
103
|
-
} catch (err) {
|
|
104
|
-
// DB might not exist yet, or permissions issue — return empty list
|
|
105
|
-
return res.json({ sessions: [], error: err.message });
|
|
106
|
-
} finally {
|
|
107
|
-
if (db) db.close();
|
|
108
|
-
}
|
|
109
|
-
}));
|
|
110
|
-
|
|
111
|
-
// ── POST /api/cline-sessions/new ───────────────────────────────────
|
|
112
|
-
//
|
|
113
|
-
// Body: { title?: string, agent: string, directory?: string }.
|
|
114
|
-
// When `directory` is omitted we use the cline plugin's recorded
|
|
115
|
-
// worktree (the active project's path on disk).
|
|
116
|
-
//
|
|
117
|
-
// Returns 201 with `{ id, title, agent, directory, createdAt }`.
|
|
118
|
-
// Returns 400 when the body is missing / invalid.
|
|
119
|
-
// Returns 502 when the upstream cline serve errors.
|
|
120
|
-
// Returns 503 when the cline plugin is offline.
|
|
121
|
-
// ────────────────────────────────────────────────────────────────────
|
|
122
|
-
router.post('/cline-sessions/new', wrap(async (req, res) => {
|
|
123
|
-
return tracer.startActiveSpan('cline.session.create', async (span) => {
|
|
124
|
-
let spanEnded = false;
|
|
125
|
-
const finishSpan = () => {
|
|
126
|
-
if (spanEnded) return;
|
|
127
|
-
spanEnded = true;
|
|
128
|
-
try {
|
|
129
|
-
const code = res.statusCode || 0;
|
|
130
|
-
if (code >= 400) {
|
|
131
|
-
span.setStatus({ code: SpanStatusCode.ERROR, message: `HTTP ${code}` });
|
|
132
|
-
} else {
|
|
133
|
-
span.setStatus({ code: SpanStatusCode.OK });
|
|
134
|
-
}
|
|
135
|
-
} finally {
|
|
136
|
-
span.end();
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
res.once('finish', finishSpan);
|
|
140
|
-
try {
|
|
141
|
-
const body = req.body && typeof req.body === 'object' ? req.body : {};
|
|
142
|
-
const title = typeof body.title === 'string' && body.title.trim().length > 0
|
|
143
|
-
? body.title.trim().slice(0, TITLE_MAX)
|
|
144
|
-
: null;
|
|
145
|
-
const agent = typeof body.agent === 'string' ? body.agent.trim() : '';
|
|
146
|
-
span.setAttribute('cline.session.agent', agent);
|
|
147
|
-
span.setAttribute('cline.session.title_length', title === null ? 0 : title.length);
|
|
148
|
-
if (!agent) {
|
|
149
|
-
res.status(400).json({ error: 'bad_request', message: '`agent` is required' });
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
if (!AGENT_NAME_RE.test(agent)) {
|
|
153
|
-
res.status(400).json({ error: 'bad_request', message: '`agent` is invalid (allowed: [A-Za-z0-9_-]{1,64})' });
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
if (title !== null && title.length > TITLE_MAX) {
|
|
157
|
-
res.status(400).json({ error: 'bad_request', message: `title too long (> ${TITLE_MAX} chars)` });
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const info = readServeInfo();
|
|
162
|
-
if (!info) {
|
|
163
|
-
res.status(503).json({
|
|
164
|
-
error: 'plugin_offline',
|
|
165
|
-
message: 'cline plugin is not running',
|
|
166
|
-
});
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const directory = typeof body.directory === 'string' && body.directory.length > 0
|
|
171
|
-
? body.directory
|
|
172
|
-
: (info.worktree || '');
|
|
173
|
-
span.setAttribute('cline.session.directory', directory);
|
|
174
|
-
|
|
175
|
-
const finalTitle = title || `Chat: ${agent}`;
|
|
176
|
-
const result = await createClineSession(
|
|
177
|
-
info,
|
|
178
|
-
{ title: finalTitle, agent },
|
|
179
|
-
directory,
|
|
180
|
-
);
|
|
181
|
-
if (!result.ok || !result.sessionId) {
|
|
182
|
-
const status = result.status === 404 ? 404 : 502;
|
|
183
|
-
res.status(status).json({
|
|
184
|
-
error: 'cline_error',
|
|
185
|
-
message: result.error || 'failed to create cline session',
|
|
186
|
-
});
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
span.setAttribute('cline.session.id', result.sessionId);
|
|
191
|
-
res.status(201).json({
|
|
192
|
-
id: result.sessionId,
|
|
193
|
-
title: finalTitle,
|
|
194
|
-
agent,
|
|
195
|
-
directory,
|
|
196
|
-
createdAt: Date.now(),
|
|
197
|
-
});
|
|
198
|
-
} catch (err) {
|
|
199
|
-
if (!spanEnded) {
|
|
200
|
-
spanEnded = true;
|
|
201
|
-
span.recordException(err);
|
|
202
|
-
span.setStatus({ code: SpanStatusCode.ERROR, message: err.message });
|
|
203
|
-
span.end();
|
|
204
|
-
}
|
|
205
|
-
throw err;
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
}));
|
|
209
|
-
|
|
210
|
-
// ── PATCH /api/cline-sessions/:id ──────────────────────────────────
|
|
211
|
-
//
|
|
212
|
-
// Body: { title: string } — required, non-empty, ≤ 200 chars.
|
|
213
|
-
// Returns 200 with `{ id, title }` on success.
|
|
214
|
-
// 400 / 404 (unknown) / 502 / 503 / 504 (timeouts).
|
|
215
|
-
// ────────────────────────────────────────────────────────────────────
|
|
216
|
-
router.patch('/cline-sessions/:id', wrap(async (req, res) => {
|
|
217
|
-
const sessionId = String(req.params?.id || '');
|
|
218
|
-
if (!SESSION_ID_RE.test(sessionId)) {
|
|
219
|
-
res.status(400).json({ error: 'bad_request', message: 'invalid session id' });
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
const body = req.body && typeof req.body === 'object' ? req.body : {};
|
|
223
|
-
const title = typeof body.title === 'string' ? body.title.trim() : '';
|
|
224
|
-
if (!title) {
|
|
225
|
-
res.status(400).json({ error: 'bad_request', message: '`title` is required (non-empty)' });
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
if (title.length > TITLE_MAX) {
|
|
229
|
-
res.status(400).json({ error: 'bad_request', message: `title too long (> ${TITLE_MAX} chars)` });
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
const info = readServeInfo();
|
|
234
|
-
if (!info) {
|
|
235
|
-
res.status(503).json({ error: 'plugin_offline', message: 'cline plugin is not running' });
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
const directory = await resolveSessionDirectory(info, sessionId);
|
|
239
|
-
if (!directory) {
|
|
240
|
-
res.status(503).json({
|
|
241
|
-
error: 'directory_unknown',
|
|
242
|
-
message: 'cannot determine the cline session directory',
|
|
243
|
-
});
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
const result = await updateClineSession(info, sessionId, { title }, directory);
|
|
248
|
-
if (!result.ok) {
|
|
249
|
-
const status = result.status === 404 ? 404 : 502;
|
|
250
|
-
res.status(status).json({ error: 'cline_error', message: result.error || 'rename failed' });
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
res.json({ id: sessionId, title });
|
|
254
|
-
}));
|
|
255
|
-
|
|
256
|
-
// ── DELETE /api/cline-sessions/:id ─────────────────────────────────
|
|
257
|
-
//
|
|
258
|
-
// No body. Returns 200 on success or if the session was already gone.
|
|
259
|
-
// 400 (invalid id) / 404 (unknown — surfaces when upstream says so) /
|
|
260
|
-
// 502 / 503.
|
|
261
|
-
// ────────────────────────────────────────────────────────────────────
|
|
262
|
-
router.delete('/cline-sessions/:id', wrap(async (req, res) => {
|
|
263
|
-
const sessionId = String(req.params?.id || '');
|
|
264
|
-
if (!SESSION_ID_RE.test(sessionId)) {
|
|
265
|
-
res.status(400).json({ error: 'bad_request', message: 'invalid session id' });
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
const info = readServeInfo();
|
|
269
|
-
if (!info) {
|
|
270
|
-
res.status(503).json({ error: 'plugin_offline', message: 'cline plugin is not running' });
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
const directory = await resolveSessionDirectory(info, sessionId);
|
|
274
|
-
if (!directory) {
|
|
275
|
-
res.status(503).json({
|
|
276
|
-
error: 'directory_unknown',
|
|
277
|
-
message: 'cannot determine the cline session directory',
|
|
278
|
-
});
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
const result = await deleteClineSession(info, sessionId, directory);
|
|
282
|
-
if (!result.ok) {
|
|
283
|
-
const status = result.status === 404 ? 404 : 502;
|
|
284
|
-
res.status(status).json({ error: 'cline_error', message: result.error || 'delete failed' });
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
res.json({ id: sessionId, deleted: true });
|
|
288
|
-
}));
|
|
289
|
-
|
|
290
|
-
return router;
|
|
291
|
-
}
|
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* cli/commands/cline-cmd.mjs
|
|
3
|
-
*
|
|
4
|
-
* v6.2.3 — Pass-through wrappers for Cline CLI commands that Bizar
|
|
5
|
-
* wants to expose as `bizar <subcommand>` for consistency.
|
|
6
|
-
*
|
|
7
|
-
* These are NOT reimaginings — they're thin pass-throughs that:
|
|
8
|
-
* 1. Set sane defaults from Bizar's installed location
|
|
9
|
-
* (e.g. CLINE_DIR=~/.cline, CLINE_PROVIDER_SETTINGS_PATH)
|
|
10
|
-
* 2. Spawn the `cline` binary with the same args
|
|
11
|
-
* 3. Stream the output through (with our chalk banner)
|
|
12
|
-
*
|
|
13
|
-
* Wrapped commands:
|
|
14
|
-
* - bizar config → `cline config`
|
|
15
|
-
* - bizar history → `cline history`
|
|
16
|
-
* - bizar plugin → `cline plugin <sub>`
|
|
17
|
-
* - bizar hub → `cline hub <sub>`
|
|
18
|
-
* - bizar hook → `cline hook` (handle hook payload from stdin)
|
|
19
|
-
* - bizar team → `cline --team-name <name> "mission"`
|
|
20
|
-
* (spawn an agent team from the CLI directly, without the plugin)
|
|
21
|
-
*
|
|
22
|
-
* Why: Bizar users already know the `bizar` CLI. Wrapping Cline
|
|
23
|
-
* commands means they don't have to remember which binary owns
|
|
24
|
-
* which feature.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
import { spawn } from 'node:child_process';
|
|
28
|
-
import { existsSync } from 'node:fs';
|
|
29
|
-
import { join } from 'node:path';
|
|
30
|
-
import chalk from 'chalk';
|
|
31
|
-
|
|
32
|
-
const HOMEDIR = process.env.HOME || process.env.USERPROFILE || '/tmp';
|
|
33
|
-
const CLINE_BIN = process.env.CLINE_BIN || 'cline';
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Resolve the cline binary. On most installs, `which cline` returns
|
|
37
|
-
* the shim; we use that. Allow override via CLINE_BIN env var.
|
|
38
|
-
*/
|
|
39
|
-
function findClineBin() {
|
|
40
|
-
if (CLINE_BIN && existsSync(CLINE_BIN)) return CLINE_BIN;
|
|
41
|
-
// Default to PATH lookup via the spawn shell.
|
|
42
|
-
return 'cline';
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Spawn `cline` with the given args, inheriting stdio.
|
|
47
|
-
* Returns a promise that resolves with the exit code.
|
|
48
|
-
*/
|
|
49
|
-
export function spawnCline(args, opts = {}) {
|
|
50
|
-
return new Promise((resolve, reject) => {
|
|
51
|
-
const bin = findClineBin();
|
|
52
|
-
const child = spawn(bin, args, {
|
|
53
|
-
stdio: opts.stdio || 'inherit',
|
|
54
|
-
env: {
|
|
55
|
-
...process.env,
|
|
56
|
-
// Always use the standard Cline state dir unless overridden.
|
|
57
|
-
...(process.env.CLINE_DIR ? {} : { CLINE_DIR: join(HOMEDIR, '.cline') }),
|
|
58
|
-
// The plugin already wires up the Cline data dir; pass it
|
|
59
|
-
// through so `bizar config` and `bizar history` see the same
|
|
60
|
-
// session/db the plugin sees.
|
|
61
|
-
...(process.env.CLINE_PROVIDER_SETTINGS_PATH ? {} : {}),
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
child.on('error', reject);
|
|
65
|
-
child.on('exit', (code, signal) => {
|
|
66
|
-
// Mirror the exit code so callers can chain commands.
|
|
67
|
-
if (typeof code === 'number') resolve(code);
|
|
68
|
-
else if (signal) resolve(128 + (typeof process.exitCode === 'number' ? process.exitCode : 0));
|
|
69
|
-
else resolve(0);
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function showClineCmdHelp() {
|
|
75
|
-
console.log(`
|
|
76
|
-
bizar <cline-cmd> — Pass-through wrappers for Cline CLI commands
|
|
77
|
-
|
|
78
|
-
These commands delegate to the \`cline\` binary on your PATH so you
|
|
79
|
-
don't have to remember which binary owns which feature.
|
|
80
|
-
|
|
81
|
-
Available wrappers:
|
|
82
|
-
bizar config Show current configuration (mirrors \`cline config\`)
|
|
83
|
-
bizar history List session history (mirrors \`cline history\`)
|
|
84
|
-
bizar hub Manage the local hub daemon (mirrors \`cline hub\`)
|
|
85
|
-
bizar hook Handle a hook payload from stdin (mirrors \`cline hook\`)
|
|
86
|
-
bizar team <name> Spawn a coordinated agent team (wraps \`cline --team-name\`)
|
|
87
|
-
bizar subagent Spawn a read-only research subagent
|
|
88
|
-
|
|
89
|
-
Note: Cline plugin management uses \`bizar plugin\` (Bizar's plugin
|
|
90
|
-
marketplace) which already overlaps with the Cline plugin manager.
|
|
91
|
-
Run \`cline plugin <sub>\` directly for the Cline one.
|
|
92
|
-
|
|
93
|
-
Examples:
|
|
94
|
-
bizar config --json
|
|
95
|
-
bizar history --limit 20 --json
|
|
96
|
-
bizar hub start
|
|
97
|
-
bizar team auth-sprint "Plan and implement user auth with tests"
|
|
98
|
-
bizar subagent mimir "Find all places where the auth token is verified"
|
|
99
|
-
|
|
100
|
-
Related:
|
|
101
|
-
/team The matching Cline slash command (works inside a session)
|
|
102
|
-
bizar validate Health check the Bizar install
|
|
103
|
-
bizar doctor Diagnose Cline-side issues
|
|
104
|
-
`);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* `bizar config` — show current Cline configuration.
|
|
109
|
-
* Thin wrapper around `cline config [options]`.
|
|
110
|
-
*/
|
|
111
|
-
export async function runClineConfig(args = []) {
|
|
112
|
-
console.log(chalk.dim(` (delegating to \`cline config\`)\n`));
|
|
113
|
-
const code = await spawnCline(['config', ...args]);
|
|
114
|
-
process.exit(code);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* `bizar history` — list session history.
|
|
119
|
-
* Thin wrapper around `cline history [options]`.
|
|
120
|
-
*/
|
|
121
|
-
export async function runClineHistory(args = []) {
|
|
122
|
-
console.log(chalk.dim(` (delegating to \`cline history\`)\n`));
|
|
123
|
-
const code = await spawnCline(['history', ...args]);
|
|
124
|
-
process.exit(code);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// NOTE: `bizar plugin` is already taken by the Bizar marketplace
|
|
128
|
-
// (cli/commands/plugin.mjs). To avoid the name collision, Cline's
|
|
129
|
-
// plugin manager is exposed as `cline plugin <sub>` directly via
|
|
130
|
-
// the cline CLI on PATH. Users who want Cline plugin management
|
|
131
|
-
// can also shell out via `bizar provider install <url>` or just
|
|
132
|
-
// run `cline plugin install <url>` themselves.
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* `bizar hub <subcommand> [...args]` — manage the local hub daemon.
|
|
136
|
-
* Thin wrapper around `cline hub <subcommand>`.
|
|
137
|
-
*/
|
|
138
|
-
export async function runClineHub(args = []) {
|
|
139
|
-
if (args.length === 0) {
|
|
140
|
-
console.log(chalk.cyan(' bizar hub — Manage the local Cline hub daemon\n'));
|
|
141
|
-
console.log(chalk.dim(' Subcommands (passed through to `cline hub`):'));
|
|
142
|
-
console.log(' start Start the hub daemon');
|
|
143
|
-
console.log(' stop Stop the hub daemon');
|
|
144
|
-
console.log(' status Show hub status');
|
|
145
|
-
console.log(' logs Show hub logs');
|
|
146
|
-
console.log('');
|
|
147
|
-
console.log(chalk.dim(' The hub daemon lets long-running tasks survive logout. '));
|
|
148
|
-
console.log(chalk.dim(' Used by `--zen` mode and by scheduled agents.'));
|
|
149
|
-
console.log('');
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
const code = await spawnCline(['hub', ...args]);
|
|
153
|
-
process.exit(code);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* `bizar hook` — handle a hook payload from stdin.
|
|
158
|
-
* Thin wrapper around `cline hook` (reads JSON from stdin and
|
|
159
|
-
* runs the configured hook handler).
|
|
160
|
-
*/
|
|
161
|
-
export async function runClineHook(args = []) {
|
|
162
|
-
// No banner — the hook payload is JSON, no room for chalk noise.
|
|
163
|
-
const code = await spawnCline(['hook', ...args], { stdio: 'inherit' });
|
|
164
|
-
process.exit(code);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* `bizar team <name> "mission" [...flags]` — spawn a coordinated agent
|
|
169
|
-
* team from the CLI directly. Wraps `cline --team-name <name>`.
|
|
170
|
-
*
|
|
171
|
-
* This is the OUT-OF-SESSION equivalent of the `/team` slash command.
|
|
172
|
-
* Useful for batch / scripting use cases where you want to fire off a
|
|
173
|
-
* team mission from a shell script (e.g. a CI job, a cron, a webhook).
|
|
174
|
-
*
|
|
175
|
-
* Example:
|
|
176
|
-
* bizar team auth-sprint "Plan and implement user auth with tests" \
|
|
177
|
-
* --provider litellm --model minimaxcustom/MiniMax-M3
|
|
178
|
-
*/
|
|
179
|
-
export async function runClineTeam(args = []) {
|
|
180
|
-
if (args.length === 0) {
|
|
181
|
-
console.log(chalk.cyan(' bizar team — Spawn a coordinated agent team from the CLI\n'));
|
|
182
|
-
console.log(chalk.dim(' Usage:'));
|
|
183
|
-
console.log(' bizar team <name> "mission" [--provider X] [--model Y] [more flags]');
|
|
184
|
-
console.log('');
|
|
185
|
-
console.log(chalk.dim(' This is the OUT-OF-SESSION equivalent of the /team slash command.'));
|
|
186
|
-
console.log(chalk.dim(' Wraps `cline --team-name <name> "<mission>"`. Use it for batch'));
|
|
187
|
-
console.log(chalk.dim(' / scripted / CI use cases where you want to fire a team mission'));
|
|
188
|
-
console.log(chalk.dim(' without entering an interactive Cline session.'));
|
|
189
|
-
console.log('');
|
|
190
|
-
console.log(chalk.dim(' Examples:'));
|
|
191
|
-
console.log(' bizar team auth-sprint "Plan and implement user auth with tests"');
|
|
192
|
-
console.log(' bizar team release-prep "Check CHANGELOG, bump version, run /test"');
|
|
193
|
-
console.log(' bizar team rca "Investigate why the build failed on PR #42"');
|
|
194
|
-
console.log('');
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
// First positional arg = team name, second = mission prompt.
|
|
198
|
-
const [name, mission, ...rest] = args;
|
|
199
|
-
if (!name) {
|
|
200
|
-
console.error(chalk.red(' ✗ Team name required'));
|
|
201
|
-
console.error(chalk.dim(' Usage: bizar team <name> "mission"'));
|
|
202
|
-
process.exit(2);
|
|
203
|
-
}
|
|
204
|
-
if (!mission) {
|
|
205
|
-
console.error(chalk.red(' ✗ Mission prompt required'));
|
|
206
|
-
console.error(chalk.dim(' Usage: bizar team <name> "mission"'));
|
|
207
|
-
process.exit(2);
|
|
208
|
-
}
|
|
209
|
-
console.log(chalk.cyan(`\n 🚀 Spawning team '${name}'\n`));
|
|
210
|
-
console.log(chalk.dim(` Mission: ${mission}\n`));
|
|
211
|
-
const code = await spawnCline(['--team-name', name, mission, ...rest]);
|
|
212
|
-
process.exit(code);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* `bizar subagent <agent> "task"` — spawn a quick read-only research
|
|
217
|
-
* subagent. This is the OUT-OF-SESSION equivalent of using
|
|
218
|
-
* `use_subagents` inside Cline.
|
|
219
|
-
*
|
|
220
|
-
* Why it's separate from `bizar team`: subagents are fast/cheap and
|
|
221
|
-
* read-only. They don't need team coordination. They're the right
|
|
222
|
-
* tool for "go investigate X and report back".
|
|
223
|
-
*
|
|
224
|
-
* Note: Cline's `use_subagents` is a built-in tool that only works
|
|
225
|
-
* INSIDE a Cline session. The `cline --yolo` / interactive flags
|
|
226
|
-
* don't expose it directly. We shell out via the `--provider` flag
|
|
227
|
-
* to force an immediate one-shot run.
|
|
228
|
-
*
|
|
229
|
-
* For programmatic subagent dispatch (from inside a Cline session),
|
|
230
|
-
* use the `task` tool that Cline provides automatically when
|
|
231
|
-
* `enableSpawnAgent: true` (the Bizar plugin sets this since v6.2.3).
|
|
232
|
-
*
|
|
233
|
-
* This function is a thin convenience: it just spawns a regular
|
|
234
|
-
* Cline run with the agent name prefixed. For real subagent
|
|
235
|
-
* orchestration, run `cline` interactively.
|
|
236
|
-
*/
|
|
237
|
-
export async function runClineSubagent(args = []) {
|
|
238
|
-
if (args.length === 0) {
|
|
239
|
-
console.log(chalk.cyan(' bizar subagent — Spawn a quick read-only research subagent\n'));
|
|
240
|
-
console.log(chalk.dim(' Subagents are read-only research agents. They run in parallel, '));
|
|
241
|
-
console.log(chalk.dim(' keep their own context window, and return a focused report.'));
|
|
242
|
-
console.log(chalk.dim(' Use them for broad codebase exploration without burning context.\n'));
|
|
243
|
-
console.log('');
|
|
244
|
-
console.log(chalk.dim(' Usage:'));
|
|
245
|
-
console.log(' bizar subagent <agent> "task"');
|
|
246
|
-
console.log('');
|
|
247
|
-
console.log(chalk.dim(' Note: for IN-SESSION subagent dispatch, just ask the model'));
|
|
248
|
-
console.log(chalk.dim(' to "use subagents" — Cline picks them up automatically when'));
|
|
249
|
-
console.log(chalk.dim(' enableSpawnAgent=true (the Bizar default since v6.2.3).'));
|
|
250
|
-
console.log('');
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
const [agent, ...rest] = args;
|
|
254
|
-
const task = rest.find((a) => typeof a === 'string' && !a.startsWith('-'));
|
|
255
|
-
if (!agent || !task) {
|
|
256
|
-
console.error(chalk.red(' ✗ Usage: bizar subagent <agent> "task"'));
|
|
257
|
-
process.exit(2);
|
|
258
|
-
}
|
|
259
|
-
console.log(chalk.cyan(`\n 🔍 Spawning subagent '${agent}'\n`));
|
|
260
|
-
console.log(chalk.dim(` Task: ${task}\n`));
|
|
261
|
-
// We pass --agent <name> so Cline uses the named agent and
|
|
262
|
-
// --auto-approve true to skip permission prompts for the
|
|
263
|
-
// read-only subagent.
|
|
264
|
-
const filteredArgs = rest.filter((a) => a !== task);
|
|
265
|
-
const code = await spawnCline([
|
|
266
|
-
'--agent', agent,
|
|
267
|
-
'--auto-approve', 'true',
|
|
268
|
-
`--system-prompt:subagent-research`,
|
|
269
|
-
task,
|
|
270
|
-
...filteredArgs,
|
|
271
|
-
]);
|
|
272
|
-
process.exit(code);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
// ── run() entry point (used by bin.mjs dispatcher) ─────────────────────────
|
|
276
|
-
|
|
277
|
-
export async function run(name, args, isHelpRequest) {
|
|
278
|
-
// Note: bin.mjs dispatcher calls run('team', [], false) etc.
|
|
279
|
-
// So `name` here is the subcommand itself.
|
|
280
|
-
if (name === 'config') { await runClineConfig(args); return true; }
|
|
281
|
-
if (name === 'history') { await runClineHistory(args); return true; }
|
|
282
|
-
if (name === 'hub') { await runClineHub(args); return true; }
|
|
283
|
-
if (name === 'hook') { await runClineHook(args); return true; }
|
|
284
|
-
if (name === 'team') { await runClineTeam(args); return true; }
|
|
285
|
-
if (name === 'subagent') { await runClineSubagent(args); return true; }
|
|
286
|
-
// Fallback: show help.
|
|
287
|
-
showClineCmdHelp();
|
|
288
|
-
return true;
|
|
289
|
-
}
|