smithers-orchestrator 0.1.18 → 0.2.1
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/README.md +222 -99
- package/bin/cli.ts +93 -45
- package/bunfig.toml +2 -4
- package/package.json +33 -19
- package/preload.ts +6 -66
- package/src/commands/cli-utils.test.ts +178 -0
- package/src/commands/cli-utils.ts +61 -0
- package/src/commands/db/current-view.test.ts +379 -0
- package/src/commands/db/current-view.ts +52 -0
- package/src/commands/db/executions-view.test.ts +270 -0
- package/src/commands/db/executions-view.ts +42 -0
- package/src/commands/db/help.test.ts +145 -0
- package/src/commands/db/help.ts +16 -0
- package/src/commands/db/index.test.ts +118 -0
- package/src/commands/db/index.ts +86 -0
- package/src/commands/db/memories-view.test.ts +366 -0
- package/src/commands/db/memories-view.ts +52 -0
- package/src/commands/db/recovery-view.test.ts +279 -0
- package/src/commands/db/recovery-view.ts +43 -0
- package/src/commands/db/state-view.test.ts +192 -0
- package/src/commands/db/state-view.ts +17 -0
- package/src/commands/db/stats-view.test.ts +194 -0
- package/src/commands/db/stats-view.ts +29 -0
- package/src/commands/db/transitions-view.test.ts +243 -0
- package/src/commands/db/transitions-view.ts +26 -0
- package/src/commands/db/view-utils.ts +39 -0
- package/src/commands/db.ts +11 -0
- package/src/commands/init.test.ts +263 -0
- package/src/commands/init.ts +127 -0
- package/src/commands/monitor.test.ts +230 -0
- package/src/commands/monitor.ts +167 -0
- package/src/commands/run.test.ts +240 -0
- package/src/commands/run.ts +84 -0
- package/src/commands/test-utils.ts +15 -0
- package/src/components/Claude.test.tsx +1932 -11
- package/src/components/Claude.tsx +491 -88
- package/src/components/ClaudeApi.tsx +7 -4
- package/src/components/Constraints.tsx +3 -3
- package/src/components/Each.tsx +10 -0
- package/src/components/End.test.tsx +421 -0
- package/src/components/End.tsx +127 -0
- package/src/components/ExecutionContext.tsx +24 -0
- package/src/components/ExecutionGate.tsx +20 -0
- package/src/components/ExecutionScope.tsx +32 -0
- package/src/components/Git/Commit.test.tsx +501 -15
- package/src/components/Git/Commit.tsx +63 -29
- package/src/components/Git/Notes.test.tsx +511 -16
- package/src/components/Git/Notes.tsx +59 -26
- package/src/components/Git/index.ts +2 -2
- package/src/components/Hooks/OnCIFailure.test.tsx +587 -5
- package/src/components/Hooks/OnCIFailure.tsx +89 -64
- package/src/components/Hooks/PostCommit.test.tsx +731 -5
- package/src/components/Hooks/PostCommit.tsx +77 -38
- package/src/components/Hooks/index.ts +2 -2
- package/src/components/Human.tsx +50 -3
- package/src/components/If.tsx +27 -0
- package/src/components/JJ/Commit.test.tsx +164 -5
- package/src/components/JJ/Commit.tsx +48 -51
- package/src/components/JJ/Describe.test.tsx +96 -5
- package/src/components/JJ/Describe.tsx +41 -58
- package/src/components/JJ/Rebase.test.tsx +134 -5
- package/src/components/JJ/Rebase.tsx +47 -38
- package/src/components/JJ/Snapshot.test.tsx +159 -5
- package/src/components/JJ/Snapshot.tsx +42 -29
- package/src/components/JJ/Status.test.tsx +332 -5
- package/src/components/JJ/Status.tsx +47 -35
- package/src/components/JJ/index.ts +13 -5
- package/src/components/MCP/Sqlite.test.tsx +744 -0
- package/src/components/MCP/Sqlite.tsx +3 -3
- package/src/components/MCP/index.ts +1 -1
- package/src/components/Parallel.test.tsx +743 -0
- package/src/components/Parallel.tsx +40 -0
- package/src/components/Persona.tsx +4 -4
- package/src/components/Phase.test.tsx +827 -0
- package/src/components/Phase.tsx +175 -10
- package/src/components/PhaseContext.tsx +11 -0
- package/src/components/PhaseRegistry.test.tsx +428 -0
- package/src/components/PhaseRegistry.tsx +117 -0
- package/src/components/Ralph/utils.ts +35 -0
- package/src/components/Ralph.test.tsx +732 -21
- package/src/components/Ralph.tsx +100 -140
- package/src/components/Review/Review.tsx +292 -0
- package/src/components/Review/index.ts +2 -0
- package/src/components/Review/types.ts +51 -0
- package/src/components/Review.test.tsx +388 -4
- package/src/components/Review.tsx +3 -324
- package/src/components/Smithers.test.tsx +89 -0
- package/src/components/Smithers.tsx +395 -0
- package/src/components/SmithersProvider.test.ts +422 -0
- package/src/components/SmithersProvider.tsx +819 -0
- package/src/components/Step.test.tsx +783 -0
- package/src/components/Step.tsx +366 -8
- package/src/components/StepContext.tsx +11 -0
- package/src/components/Stop.tsx +11 -3
- package/src/components/Subagent.tsx +3 -3
- package/src/components/Task.tsx +3 -3
- package/src/components/While.tsx +107 -0
- package/src/components/Worktree.test.tsx +243 -0
- package/src/components/Worktree.tsx +141 -0
- package/src/components/WorktreeProvider.tsx +24 -0
- package/src/components/agents/ClaudeCodeCLI.ts +20 -0
- package/src/components/agents/SmithersCLI.test.ts +329 -0
- package/src/{orchestrator/components → components}/agents/SmithersCLI.ts +15 -6
- package/src/components/agents/claude-cli/arg-builder.test.ts +312 -0
- package/src/components/agents/claude-cli/arg-builder.ts +101 -0
- package/src/components/agents/claude-cli/executor.test.ts +805 -0
- package/src/components/agents/claude-cli/executor.ts +369 -0
- package/src/components/agents/claude-cli/index.ts +26 -0
- package/src/components/agents/claude-cli/message-parser.test.ts +390 -0
- package/src/components/agents/claude-cli/message-parser.ts +185 -0
- package/src/components/agents/claude-cli/output-parser.test.ts +217 -0
- package/src/components/agents/claude-cli/output-parser.ts +184 -0
- package/src/components/agents/claude-cli/stop-conditions.test.ts +517 -0
- package/src/components/agents/claude-cli/stop-conditions.ts +96 -0
- package/src/components/agents/types/agents.ts +251 -0
- package/src/components/agents/types/execution.ts +176 -0
- package/src/components/agents/types/index.ts +22 -0
- package/src/components/agents/types/schema.ts +16 -0
- package/src/components/agents/types/tools.ts +19 -0
- package/src/components/agents/types.ts +19 -0
- package/src/components/components.test.tsx +663 -13
- package/src/components/index.ts +77 -16
- package/src/core/index.test.ts +123 -0
- package/src/core/index.ts +3 -4
- package/src/db/agents.test.ts +703 -0
- package/src/db/agents.ts +199 -0
- package/src/db/artifacts.test.ts +436 -0
- package/src/db/artifacts.ts +78 -0
- package/src/db/build-state.test.ts +101 -0
- package/src/db/build-state.ts +160 -0
- package/src/db/execution.test.ts +803 -0
- package/src/db/execution.ts +132 -0
- package/src/db/human.test.ts +71 -0
- package/src/db/human.ts +237 -0
- package/src/db/index.test.ts +436 -0
- package/src/db/index.ts +316 -0
- package/src/db/memories.test.ts +1016 -0
- package/src/db/memories.ts +123 -0
- package/src/db/phases.test.ts +932 -0
- package/src/db/phases.ts +71 -0
- package/src/db/query.test.ts +226 -0
- package/src/db/query.ts +18 -0
- package/src/db/render-frames.test.ts +420 -0
- package/src/db/render-frames.ts +149 -0
- package/src/{orchestrator/db → db}/schema.sql +254 -97
- package/src/db/state.test.ts +667 -0
- package/src/db/state.ts +89 -0
- package/src/db/steps.test.ts +772 -0
- package/src/db/steps.ts +81 -0
- package/src/db/tasks.test.ts +600 -0
- package/src/db/tasks.ts +151 -0
- package/src/db/tools.test.ts +442 -0
- package/src/db/tools.ts +89 -0
- package/src/{orchestrator/db → db}/types.ts +82 -39
- package/src/db/utils.test.ts +191 -0
- package/src/db/utils.ts +17 -0
- package/src/db/vcs-queue.test.ts +312 -0
- package/src/db/vcs-queue.ts +66 -0
- package/src/db/vcs.test.ts +569 -0
- package/src/db/vcs.ts +344 -0
- package/src/debug/index.test.ts +307 -0
- package/src/debug/index.ts +230 -2
- package/src/hooks/ai-sdk.ts +47 -0
- package/src/hooks/index.test.ts +85 -0
- package/src/hooks/index.ts +7 -0
- package/src/hooks/useCaptureRenderFrame.test.tsx +267 -0
- package/src/hooks/useCaptureRenderFrame.ts +29 -0
- package/src/hooks/useCommitWithRetry.test.tsx +161 -0
- package/src/hooks/useCommitWithRetry.ts +62 -0
- package/src/hooks/useHuman.test.ts +138 -0
- package/src/hooks/useHuman.test.tsx +159 -0
- package/src/hooks/useHuman.ts +115 -0
- package/src/hooks/useHumanInteractive.test.ts +446 -0
- package/src/hooks/useHumanInteractive.test.tsx +59 -0
- package/src/hooks/useHumanInteractive.ts +255 -0
- package/src/hooks/useRalphCount.test.tsx +173 -0
- package/src/hooks/useRalphCount.ts +20 -0
- package/src/index.ts +10 -21
- package/src/jsx-runtime.test.ts +43 -206
- package/src/jsx-runtime.ts +4 -97
- package/src/jsx.d.ts +355 -17
- package/src/middleware/caching.ts +96 -0
- package/src/middleware/compose.ts +134 -0
- package/src/middleware/cost-tracking.ts +34 -0
- package/src/middleware/extract-json.ts +42 -0
- package/src/middleware/extract-reasoning.ts +41 -0
- package/src/middleware/index.ts +32 -0
- package/src/middleware/logging.ts +75 -0
- package/src/middleware/middleware.test.ts +318 -0
- package/src/middleware/rate-limiting.ts +77 -0
- package/src/middleware/redact-secrets.ts +38 -0
- package/src/middleware/retry.ts +47 -0
- package/src/middleware/timeout.ts +36 -0
- package/src/middleware/types.ts +39 -0
- package/src/middleware/validation.ts +36 -0
- package/src/monitor/haiku-summarizer.test.ts +253 -0
- package/src/{orchestrator/monitor → monitor}/haiku-summarizer.ts +5 -5
- package/src/monitor/index.ts +8 -0
- package/src/monitor/log-writer.test.ts +257 -0
- package/src/monitor/log-writer.ts +212 -0
- package/src/monitor/output-parser.test.ts +424 -0
- package/src/{orchestrator/monitor → monitor}/output-parser.ts +4 -4
- package/src/monitor/stream-formatter.test.ts +471 -0
- package/src/{orchestrator/monitor → monitor}/stream-formatter.ts +11 -11
- package/src/rate-limits/index.ts +15 -0
- package/src/rate-limits/middleware.test.ts +163 -0
- package/src/rate-limits/middleware.ts +28 -0
- package/src/rate-limits/monitor.test.ts +38 -0
- package/src/rate-limits/monitor.ts +134 -0
- package/src/rate-limits/providers/anthropic.test.ts +36 -0
- package/src/rate-limits/providers/anthropic.ts +67 -0
- package/src/rate-limits/providers/base.ts +1 -0
- package/src/rate-limits/providers/openai.test.ts +81 -0
- package/src/rate-limits/providers/openai.ts +94 -0
- package/src/rate-limits/store.test.ts +139 -0
- package/src/rate-limits/store.ts +83 -0
- package/src/rate-limits/throttle.test.ts +172 -0
- package/src/rate-limits/throttle.ts +66 -0
- package/src/rate-limits/types.ts +72 -0
- package/src/reactive-sqlite/database.test.ts +787 -0
- package/src/reactive-sqlite/database.ts +340 -0
- package/src/reactive-sqlite/hooks/context.test.tsx +418 -0
- package/src/reactive-sqlite/hooks/context.tsx +79 -0
- package/src/reactive-sqlite/hooks/index.ts +12 -0
- package/src/reactive-sqlite/hooks/shared.ts +79 -0
- package/src/reactive-sqlite/hooks/useMutation.test.tsx +583 -0
- package/src/reactive-sqlite/hooks/useMutation.ts +134 -0
- package/src/reactive-sqlite/hooks/useQuery.test.tsx +609 -0
- package/src/reactive-sqlite/hooks/useQuery.ts +173 -0
- package/src/reactive-sqlite/hooks/useQueryOne.test.tsx +419 -0
- package/src/reactive-sqlite/hooks/useQueryOne.ts +98 -0
- package/src/reactive-sqlite/hooks/useQueryValue.test.tsx +539 -0
- package/src/reactive-sqlite/hooks/useQueryValue.ts +95 -0
- package/src/reactive-sqlite/hooks.ts +7 -0
- package/src/reactive-sqlite/index.ts +58 -0
- package/src/reactive-sqlite/parser.test.ts +1330 -0
- package/src/reactive-sqlite/parser.ts +263 -0
- package/src/reactive-sqlite/row-tracking.test.ts +176 -0
- package/src/reactive-sqlite/types.ts +110 -0
- package/src/reconciler/README.md +300 -0
- package/src/reconciler/hooks-integration.test.tsx +383 -0
- package/src/reconciler/hooks.test.tsx +613 -0
- package/src/reconciler/hooks.ts +225 -0
- package/src/reconciler/host-config.test.ts +568 -0
- package/src/reconciler/host-config.ts +319 -0
- package/src/reconciler/index.ts +52 -0
- package/src/reconciler/jsx-runtime.test.tsx +449 -0
- package/src/reconciler/jsx-runtime.ts +51 -0
- package/src/reconciler/methods.test.ts +657 -0
- package/src/{solid/renderer-methods.ts → reconciler/methods.ts} +32 -8
- package/src/reconciler/root.test.tsx +54 -0
- package/src/reconciler/root.ts +187 -0
- package/src/reconciler/serialize-direct.test.ts +819 -0
- package/src/reconciler/serialize.test.ts +679 -0
- package/src/{core → reconciler}/serialize.ts +93 -4
- package/src/{core → reconciler}/types.ts +9 -7
- package/src/streaming/claude-parser.test.ts +207 -0
- package/src/streaming/claude-parser.ts +230 -0
- package/src/streaming/types.ts +18 -0
- package/src/streaming/v3-compat.test.ts +348 -0
- package/src/streaming/v3-compat.ts +62 -0
- package/src/{orchestrator/tools → tools}/ReportTool.test.ts +128 -73
- package/src/{orchestrator/tools → tools}/ReportTool.ts +29 -44
- package/src/tools/createSmithersTool.test.ts +75 -0
- package/src/tools/createSmithersTool.ts +76 -0
- package/src/tools/index.ts +34 -0
- package/src/tools/registry.test.ts +556 -0
- package/src/{orchestrator/tools → tools}/registry.ts +82 -45
- package/src/tools/smithers-mcp-server.test.ts +107 -0
- package/src/tools/smithers-mcp-server.ts +23 -0
- package/src/tools/tool-to-mcp.test.ts +216 -0
- package/src/tools/tool-to-mcp.ts +42 -0
- package/src/tools/types.ts +58 -0
- package/src/transport/smithers-chat-transport.test.ts +719 -0
- package/src/transport/smithers-chat-transport.ts +537 -0
- package/src/transport/types.ts +74 -0
- package/src/tui/App.test.tsx +356 -0
- package/src/tui/App.tsx +127 -0
- package/src/tui/README.md +489 -0
- package/src/tui/components/index.ts +5 -0
- package/src/tui/components/layout/Header.test.tsx +192 -0
- package/src/tui/components/layout/Header.tsx +37 -0
- package/src/tui/components/layout/StatusBar.test.tsx +211 -0
- package/src/tui/components/layout/StatusBar.tsx +45 -0
- package/src/tui/components/layout/TabBar.test.tsx +251 -0
- package/src/tui/components/layout/TabBar.tsx +49 -0
- package/src/tui/components/layout/index.ts +5 -0
- package/src/tui/components/shared/ScrollableList.test.tsx +212 -0
- package/src/tui/components/shared/ScrollableList.tsx +70 -0
- package/src/tui/components/shared/XMLViewer.test.tsx +196 -0
- package/src/tui/components/shared/XMLViewer.tsx +50 -0
- package/src/tui/components/shared/index.ts +4 -0
- package/src/tui/components/views/ChatInterface.test.tsx +33 -0
- package/src/tui/components/views/ChatInterface.tsx +131 -0
- package/src/tui/components/views/DatabaseExplorer.test.tsx +33 -0
- package/src/tui/components/views/DatabaseExplorer.tsx +156 -0
- package/src/tui/components/views/ExecutionTimeline.tsx +117 -0
- package/src/tui/components/views/HumanInteractionHandler.tsx +204 -0
- package/src/tui/components/views/RenderFrameInspector.tsx +110 -0
- package/src/tui/components/views/ReportViewer.tsx +158 -0
- package/src/tui/components/views/index.ts +8 -0
- package/src/tui/hooks/index.ts +9 -0
- package/src/tui/hooks/useClaudeChat.test.ts +257 -0
- package/src/tui/hooks/useClaudeChat.ts +71 -0
- package/src/tui/hooks/useHumanRequests.test.ts +434 -0
- package/src/tui/hooks/useHumanRequests.ts +81 -0
- package/src/tui/hooks/usePollEvents.test.ts +400 -0
- package/src/tui/hooks/usePollEvents.ts +79 -0
- package/src/tui/hooks/usePollTableData.test.ts +280 -0
- package/src/tui/hooks/usePollTableData.ts +46 -0
- package/src/tui/hooks/useRenderFrames.test.ts +449 -0
- package/src/tui/hooks/useRenderFrames.ts +75 -0
- package/src/tui/hooks/useReportGenerator.test.ts +316 -0
- package/src/tui/hooks/useReportGenerator.ts +69 -0
- package/src/tui/hooks/useSmithersConnection.test.ts +173 -0
- package/src/tui/hooks/useSmithersConnection.ts +102 -0
- package/src/tui/index.test.ts +43 -0
- package/src/tui/index.tsx +25 -0
- package/src/tui/opentui.d.ts +192 -0
- package/src/tui/services/claude-assistant.test.ts +56 -0
- package/src/tui/services/claude-assistant.ts +95 -0
- package/src/tui/services/index.ts +4 -0
- package/src/tui/services/report-generator.test.ts +73 -0
- package/src/tui/services/report-generator.ts +192 -0
- package/src/tui/utils/colors.test.ts +49 -0
- package/src/tui/utils/colors.ts +36 -0
- package/src/tui/utils/format.test.ts +83 -0
- package/src/tui/utils/format.ts +38 -0
- package/src/tui/utils/index.ts +4 -0
- package/src/utils/capture.test.ts +547 -0
- package/src/utils/capture.ts +436 -0
- package/src/utils/extract-text.test.ts +161 -0
- package/src/utils/extract-text.ts +14 -0
- package/src/utils/mcp-config.test.ts +490 -0
- package/src/{orchestrator/utils → utils}/mcp-config.ts +11 -9
- package/src/utils/scope.test.ts +184 -0
- package/src/utils/scope.ts +22 -0
- package/src/utils/structured-output/index.ts +14 -0
- package/src/utils/structured-output/prompt-generator.test.ts +356 -0
- package/src/utils/structured-output/prompt-generator.ts +46 -0
- package/src/utils/structured-output/types.ts +20 -0
- package/src/utils/structured-output/validator.test.ts +308 -0
- package/src/utils/structured-output/validator.ts +84 -0
- package/src/utils/structured-output/zod-converter.test.ts +276 -0
- package/src/utils/structured-output/zod-converter.ts +126 -0
- package/src/{orchestrator/utils → utils}/structured-output.test.ts +1 -1
- package/src/utils/structured-output.ts +18 -0
- package/src/utils/vcs/git.test.ts +138 -0
- package/src/utils/vcs/git.ts +294 -0
- package/src/utils/vcs/git.worktree.test.ts +139 -0
- package/src/utils/vcs/index.ts +51 -0
- package/src/utils/vcs/jj.test.ts +359 -0
- package/src/utils/vcs/jj.ts +178 -0
- package/src/utils/vcs/parsers.test.ts +441 -0
- package/src/utils/vcs/parsers.ts +76 -0
- package/src/utils/vcs/types.ts +69 -0
- package/src/utils/vcs.test.ts +1 -1
- package/src/utils/vcs.ts +2 -339
- package/templates/component.tsx.template +104 -0
- package/templates/hook.tsx.template +101 -0
- package/templates/main.tsx.template +143 -217
- package/templates/simple-agent.tsx.template +48 -0
- package/bin/cli.js +0 -14269
- package/src/core/execute.test.ts +0 -84
- package/src/core/execute.ts +0 -72
- package/src/core/root.test.ts +0 -83
- package/src/core/root.ts +0 -73
- package/src/core/serialize-direct.test.ts +0 -323
- package/src/core/serialize.test.ts +0 -205
- package/src/orchestrator/commands/db.ts +0 -332
- package/src/orchestrator/commands/init.ts +0 -86
- package/src/orchestrator/commands/monitor.ts +0 -193
- package/src/orchestrator/commands/run.ts +0 -95
- package/src/orchestrator/components/Claude.tsx +0 -247
- package/src/orchestrator/components/Orchestration.tsx +0 -236
- package/src/orchestrator/components/Phase.tsx +0 -117
- package/src/orchestrator/components/Smithers.tsx +0 -256
- package/src/orchestrator/components/SmithersProvider.tsx +0 -204
- package/src/orchestrator/components/Step.tsx +0 -173
- package/src/orchestrator/components/agents/ClaudeCodeCLI.ts +0 -558
- package/src/orchestrator/components/agents/SmithersCLI.test.ts +0 -138
- package/src/orchestrator/components/agents/types.ts +0 -449
- package/src/orchestrator/components/index.ts +0 -25
- package/src/orchestrator/db/execution.ts +0 -711
- package/src/orchestrator/db/index.ts +0 -704
- package/src/orchestrator/db/live-query.ts +0 -110
- package/src/orchestrator/db/memories.ts +0 -272
- package/src/orchestrator/db/state.ts +0 -257
- package/src/orchestrator/db/vcs.ts +0 -338
- package/src/orchestrator/integration.test.ts +0 -325
- package/src/orchestrator/monitor/log-writer.ts +0 -78
- package/src/orchestrator/monitor/output-parser.test.ts +0 -165
- package/src/orchestrator/monitor/stream-formatter.test.ts +0 -224
- package/src/orchestrator/tools/index.ts +0 -25
- package/src/orchestrator/tools/registry.test.ts +0 -234
- package/src/orchestrator/utils/mcp-config.test.ts +0 -143
- package/src/orchestrator/utils/structured-output.ts +0 -278
- package/src/solid/h.test.ts +0 -163
- package/src/solid/h.ts +0 -80
- package/src/solid/index.ts +0 -36
- package/src/solid/renderer-core.test.ts +0 -195
- package/src/solid/renderer.js +0 -141
- package/src/solid/renderer.ts +0 -68
- package/src/solid/root.ts +0 -89
- package/src/solid/simple-renderer.ts +0 -81
package/README.md
CHANGED
|
@@ -18,9 +18,8 @@ I use Smithers for both long-term (weeks) agentic work, as well as one-off scrip
|
|
|
18
18
|
## Table of Contents
|
|
19
19
|
|
|
20
20
|
- [Why](#why)
|
|
21
|
-
- [
|
|
22
|
-
- [
|
|
23
|
-
- [Usage](#usage)
|
|
21
|
+
- [Getting Started](#getting-started)
|
|
22
|
+
- [AI SDK React Hooks](#ai-sdk-react-hooks)
|
|
24
23
|
- [Recipes](#recipes)
|
|
25
24
|
- [Features](#features)
|
|
26
25
|
- [Claude Component](#claude-component)
|
|
@@ -29,7 +28,11 @@ I use Smithers for both long-term (weeks) agentic work, as well as one-off scrip
|
|
|
29
28
|
- [MCP Tool Integration](#mcp-tool-integration)
|
|
30
29
|
- [Smithers Subagent](#smithers-subagent)
|
|
31
30
|
- [Git/JJ VCS Integration](#gitjj-vcs-integration)
|
|
31
|
+
- [Orchestration Lifecycle](#orchestration-lifecycle)
|
|
32
|
+
- [PhaseRegistry & Step](#phaseregistry--step)
|
|
33
|
+
- [Parallel Execution](#parallel-execution)
|
|
32
34
|
- [Database State Management](#database-state-management)
|
|
35
|
+
- [Rate Limit Monitoring](#rate-limit-monitoring)
|
|
33
36
|
- [Contributing](#contributing)
|
|
34
37
|
|
|
35
38
|
---
|
|
@@ -43,91 +46,66 @@ I wanted a tool that allows me to:
|
|
|
43
46
|
- **Persist state across sessions** - pick up where I left off, even days later
|
|
44
47
|
- **Mix short scripts with long-running workflows** - same syntax for a quick task or a week-long project
|
|
45
48
|
- **See what my agents are doing** - full observability with database logging and reports
|
|
46
|
-
- **Use reactive primitives** -
|
|
49
|
+
- **Use reactive primitives** - React state means my workflows respond to state changes automatically
|
|
47
50
|
- **Compose complex behaviors from simple components** - loops, phases, steps, and validation all snap together
|
|
48
51
|
- **Keep everything in version control** - workflows are just TypeScript files
|
|
49
52
|
|
|
50
53
|
---
|
|
51
54
|
|
|
52
|
-
##
|
|
55
|
+
## Getting Started
|
|
53
56
|
|
|
54
|
-
###
|
|
57
|
+
### Prerequisites
|
|
55
58
|
|
|
56
|
-
**
|
|
57
|
-
|
|
58
|
-
/plugin marketplace add evmts/smithers
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
**Step 2:** Install the plugin:
|
|
62
|
-
```bash
|
|
63
|
-
/plugin install smithers@smithers
|
|
64
|
-
```
|
|
59
|
+
- **[Bun](https://bun.sh/)** - JavaScript runtime (v1.0+)
|
|
60
|
+
- **[Claude Code](https://www.npmjs.com/package/@anthropic-ai/claude-code)** - `bun install -g @anthropic-ai/claude-code`
|
|
65
61
|
|
|
66
|
-
|
|
62
|
+
Optional:
|
|
63
|
+
- **[jj (Jujutsu)](https://github.com/martinvonz/jj)** - Alternative VCS with better snapshot support
|
|
64
|
+
- **[Codex CLI](https://github.com/openai/codex)** - Used for post-commit code reviews
|
|
67
65
|
|
|
68
|
-
###
|
|
66
|
+
### Install into Claude Code
|
|
69
67
|
|
|
70
|
-
|
|
68
|
+
Add to your Claude Code settings (`~/.claude/settings.json`):
|
|
71
69
|
|
|
72
|
-
```
|
|
73
|
-
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"projects": {
|
|
73
|
+
"/path/to/your/project": {
|
|
74
|
+
"mcpServers": {},
|
|
75
|
+
"allowedTools": ["smithers-orchestrator:*"]
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
74
79
|
```
|
|
75
80
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
## Dependencies
|
|
79
|
-
|
|
80
|
-
### Required
|
|
81
|
-
|
|
82
|
-
- **[Bun](https://bun.sh/)** - JavaScript runtime (v1.0+)
|
|
83
|
-
- **[Claude Code](https://www.npmjs.com/package/@anthropic-ai/claude-code)** - `npm install -g @anthropic-ai/claude-code`
|
|
84
|
-
|
|
85
|
-
### Optional
|
|
81
|
+
Then install the package as a dev dependency:
|
|
86
82
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
---
|
|
92
|
-
|
|
93
|
-
## Usage
|
|
83
|
+
```bash
|
|
84
|
+
bun add -d smithers-orchestrator
|
|
85
|
+
```
|
|
94
86
|
|
|
95
|
-
###
|
|
87
|
+
### Use It
|
|
96
88
|
|
|
97
|
-
**You don't have to write Smithers yourself.** Tell
|
|
89
|
+
**You don't have to write Smithers yourself.** Tell Claude what you want:
|
|
98
90
|
|
|
99
91
|
```
|
|
100
|
-
User: "Create a workflow that monitors my CI, fixes failures automatically,
|
|
92
|
+
User: "Create a workflow that monitors my CI, fixes failures automatically,
|
|
93
|
+
and escalates after 3 failed attempts"
|
|
101
94
|
|
|
102
95
|
Claude: *generates ci-recovery.tsx*
|
|
103
96
|
```
|
|
104
97
|
|
|
105
|
-
|
|
98
|
+
Claude understands the component model and generates correct, working orchestration scripts.
|
|
106
99
|
|
|
107
|
-
###
|
|
108
|
-
|
|
109
|
-
All Smithers state is saved in a **PGlite database** on your system that can be easily inspected:
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
# View execution history
|
|
113
|
-
smithers-orchestrator db executions
|
|
114
|
-
|
|
115
|
-
# View state for a specific execution
|
|
116
|
-
smithers-orchestrator db state --execution-id abc123
|
|
117
|
-
|
|
118
|
-
# Query the database directly
|
|
119
|
-
smithers-orchestrator db query "SELECT * FROM agents ORDER BY started_at DESC LIMIT 10"
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### Basic Example
|
|
100
|
+
### Run a Workflow
|
|
123
101
|
|
|
124
102
|
```tsx
|
|
125
103
|
#!/usr/bin/env bun
|
|
126
104
|
|
|
127
|
-
import { createSmithersRoot } from "smithers";
|
|
128
|
-
import { createSmithersDB } from "smithers
|
|
129
|
-
import { SmithersProvider } from "smithers
|
|
130
|
-
import { Claude } from "smithers
|
|
105
|
+
import { createSmithersRoot } from "smithers-orchestrator";
|
|
106
|
+
import { createSmithersDB } from "smithers-orchestrator/db";
|
|
107
|
+
import { SmithersProvider } from "smithers-orchestrator/components/SmithersProvider";
|
|
108
|
+
import { Claude } from "smithers-orchestrator/components/Claude";
|
|
131
109
|
|
|
132
110
|
const db = await createSmithersDB({ path: ".smithers/my-task" });
|
|
133
111
|
const executionId = await db.execution.start("My Task", "scripts/my-task.tsx");
|
|
@@ -151,12 +129,54 @@ await root.mount(MyWorkflow);
|
|
|
151
129
|
await db.close();
|
|
152
130
|
```
|
|
153
131
|
|
|
154
|
-
Run it:
|
|
155
|
-
|
|
156
132
|
```bash
|
|
157
133
|
bun my-workflow.tsx
|
|
158
134
|
```
|
|
159
135
|
|
|
136
|
+
### Inspect State
|
|
137
|
+
|
|
138
|
+
All state persists in SQLite:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
smithers db executions # View execution history
|
|
142
|
+
smithers db state --execution-id abc123 # View specific execution state
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## AI SDK React Hooks
|
|
148
|
+
|
|
149
|
+
Smithers re-exports the Vercel AI SDK React hooks so you can import everything
|
|
150
|
+
from a single package:
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
import { useChat, useCompletion, useSmithers } from "smithers-orchestrator";
|
|
154
|
+
|
|
155
|
+
function ChatUI() {
|
|
156
|
+
const { messages, sendMessage, status } = useChat({ api: "/api/chat" });
|
|
157
|
+
const { db } = useSmithers();
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<div>
|
|
161
|
+
<p>Status: {status}</p>
|
|
162
|
+
{messages.map((message) => (
|
|
163
|
+
<div key={message.id}>{message.content}</div>
|
|
164
|
+
))}
|
|
165
|
+
<button onClick={() => sendMessage({ role: "user", content: "Hi" })}>
|
|
166
|
+
Send
|
|
167
|
+
</button>
|
|
168
|
+
</div>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
You can also import directly from the hooks subpath:
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
import { useChat } from "smithers-orchestrator/hooks";
|
|
177
|
+
import { useChat as useAiChat } from "smithers-orchestrator/hooks/ai-sdk";
|
|
178
|
+
```
|
|
179
|
+
|
|
160
180
|
---
|
|
161
181
|
|
|
162
182
|
## Recipes
|
|
@@ -168,40 +188,38 @@ async function ReviewWorkflow() {
|
|
|
168
188
|
const phase = (await db.state.get("phase")) ?? "implement";
|
|
169
189
|
|
|
170
190
|
return (
|
|
171
|
-
<SmithersProvider db={db} executionId={executionId}>
|
|
191
|
+
<SmithersProvider db={db} executionId={executionId} maxIterations={10}>
|
|
172
192
|
<Orchestration globalTimeout={3600000}>
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
<
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
<
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
)}
|
|
204
|
-
</Ralph>
|
|
193
|
+
{phase === "implement" && (
|
|
194
|
+
<Phase name="Implementation">
|
|
195
|
+
<Claude
|
|
196
|
+
model="sonnet"
|
|
197
|
+
onFinished={() => db.state.set("phase", "review")}
|
|
198
|
+
>
|
|
199
|
+
Implement the user authentication feature.
|
|
200
|
+
</Claude>
|
|
201
|
+
</Phase>
|
|
202
|
+
)}
|
|
203
|
+
|
|
204
|
+
{phase === "review" && (
|
|
205
|
+
<Phase name="Code Review">
|
|
206
|
+
<Review
|
|
207
|
+
target={{ type: "diff", ref: "main" }}
|
|
208
|
+
criteria={[
|
|
209
|
+
"No security vulnerabilities",
|
|
210
|
+
"Tests cover edge cases",
|
|
211
|
+
"Types are properly defined",
|
|
212
|
+
]}
|
|
213
|
+
onFinished={(review) => {
|
|
214
|
+
if (review.approved) {
|
|
215
|
+
db.state.set("phase", "complete");
|
|
216
|
+
} else {
|
|
217
|
+
db.state.set("phase", "implement");
|
|
218
|
+
}
|
|
219
|
+
}}
|
|
220
|
+
/>
|
|
221
|
+
</Phase>
|
|
222
|
+
)}
|
|
205
223
|
</Orchestration>
|
|
206
224
|
</SmithersProvider>
|
|
207
225
|
);
|
|
@@ -293,10 +311,12 @@ The core agent component that executes Claude with full tool access:
|
|
|
293
311
|
|
|
294
312
|
### Ralph Loop Controller
|
|
295
313
|
|
|
314
|
+
> **Prefer SmithersProvider.** The loop functionality is built into `<SmithersProvider>` with `maxIterations`. Use `<Ralph>` only for nested loops within a workflow.
|
|
315
|
+
|
|
296
316
|
Named after Ralph Wiggum's "I'm in danger" catchphrase - controls iterative loops that could run away:
|
|
297
317
|
|
|
298
318
|
```tsx
|
|
299
|
-
<
|
|
319
|
+
<SmithersProvider db={db} executionId={executionId} maxIterations={10}>
|
|
300
320
|
{/* Children re-render on each iteration */}
|
|
301
321
|
<Claude
|
|
302
322
|
onFinished={() => {
|
|
@@ -305,7 +325,7 @@ Named after Ralph Wiggum's "I'm in danger" catchphrase - controls iterative loop
|
|
|
305
325
|
>
|
|
306
326
|
Keep improving until tests pass.
|
|
307
327
|
</Claude>
|
|
308
|
-
</
|
|
328
|
+
</SmithersProvider>
|
|
309
329
|
```
|
|
310
330
|
|
|
311
331
|
### Structured Output with Zod
|
|
@@ -337,6 +357,37 @@ Give Claude access to external tools via Model Context Protocol:
|
|
|
337
357
|
</Claude>
|
|
338
358
|
```
|
|
339
359
|
|
|
360
|
+
### AI SDK Tool Format
|
|
361
|
+
|
|
362
|
+
Define tools with Zod schemas and pass them to Claude:
|
|
363
|
+
|
|
364
|
+
```tsx
|
|
365
|
+
import { z } from "zod";
|
|
366
|
+
import { createSmithersTool } from "smithers-orchestrator/tools";
|
|
367
|
+
|
|
368
|
+
const reportTool = createSmithersTool({
|
|
369
|
+
name: "report",
|
|
370
|
+
description: "Report progress to the orchestrator",
|
|
371
|
+
inputSchema: z.object({
|
|
372
|
+
message: z.string(),
|
|
373
|
+
severity: z.enum(["info", "warning", "error"]).optional(),
|
|
374
|
+
}),
|
|
375
|
+
execute: async ({ message, severity }, { db }) => {
|
|
376
|
+
await db.vcs.addReport({
|
|
377
|
+
type: "progress",
|
|
378
|
+
title: "Agent Report",
|
|
379
|
+
content: message,
|
|
380
|
+
severity: severity ?? "info",
|
|
381
|
+
});
|
|
382
|
+
return { success: true };
|
|
383
|
+
},
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
<Claude tools={[reportTool]}>
|
|
387
|
+
Report progress as you go.
|
|
388
|
+
</Claude>
|
|
389
|
+
```
|
|
390
|
+
|
|
340
391
|
### Smithers Subagent
|
|
341
392
|
|
|
342
393
|
Spawn a new Smithers instance to plan and execute complex subtasks:
|
|
@@ -353,6 +404,16 @@ Spawn a new Smithers instance to plan and execute complex subtasks:
|
|
|
353
404
|
</Smithers>
|
|
354
405
|
```
|
|
355
406
|
|
|
407
|
+
### Worktree
|
|
408
|
+
|
|
409
|
+
Run agents in isolated git worktrees:
|
|
410
|
+
|
|
411
|
+
```tsx
|
|
412
|
+
<Worktree branch="feature-auth" cleanup>
|
|
413
|
+
<Claude>Implement user authentication</Claude>
|
|
414
|
+
</Worktree>
|
|
415
|
+
```
|
|
416
|
+
|
|
356
417
|
### Git/JJ VCS Integration
|
|
357
418
|
|
|
358
419
|
First-class version control support:
|
|
@@ -366,6 +427,52 @@ First-class version control support:
|
|
|
366
427
|
<Commit autoDescribe />
|
|
367
428
|
```
|
|
368
429
|
|
|
430
|
+
### Orchestration Lifecycle
|
|
431
|
+
|
|
432
|
+
Global timeout and completion logic for workflows:
|
|
433
|
+
|
|
434
|
+
```tsx
|
|
435
|
+
<Orchestration
|
|
436
|
+
globalTimeout={3600000} // 1 hour max
|
|
437
|
+
onComplete={() => console.log("Workflow finished")}
|
|
438
|
+
onTimeout={() => console.log("Workflow timed out")}
|
|
439
|
+
>
|
|
440
|
+
{/* Your workflow components */}
|
|
441
|
+
</Orchestration>
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
### PhaseRegistry & Step
|
|
445
|
+
|
|
446
|
+
Manage multi-phase sequential execution:
|
|
447
|
+
|
|
448
|
+
```tsx
|
|
449
|
+
<PhaseRegistry>
|
|
450
|
+
<Phase name="implement">
|
|
451
|
+
<Step name="write-code" snapshotBefore commitAfter commitMessage="feat: Implementation">
|
|
452
|
+
<Claude>Implement the feature</Claude>
|
|
453
|
+
</Step>
|
|
454
|
+
<Step name="write-tests">
|
|
455
|
+
<Claude>Write tests for the implementation</Claude>
|
|
456
|
+
</Step>
|
|
457
|
+
</Phase>
|
|
458
|
+
<Phase name="review">
|
|
459
|
+
<Review target={{ type: "diff", ref: "main" }} />
|
|
460
|
+
</Phase>
|
|
461
|
+
</PhaseRegistry>
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
### Parallel Execution
|
|
465
|
+
|
|
466
|
+
Run multiple agents concurrently within a step:
|
|
467
|
+
|
|
468
|
+
```tsx
|
|
469
|
+
<Parallel>
|
|
470
|
+
<Claude model="haiku">Quick task 1</Claude>
|
|
471
|
+
<Claude model="haiku">Quick task 2</Claude>
|
|
472
|
+
<Claude model="haiku">Quick task 3</Claude>
|
|
473
|
+
</Parallel>
|
|
474
|
+
```
|
|
475
|
+
|
|
369
476
|
### Database State Management
|
|
370
477
|
|
|
371
478
|
Persistent state that survives restarts:
|
|
@@ -384,6 +491,22 @@ const history = await db.state.getHistory("phase");
|
|
|
384
491
|
const all = await db.state.getAll();
|
|
385
492
|
```
|
|
386
493
|
|
|
494
|
+
### Rate Limit Monitoring
|
|
495
|
+
|
|
496
|
+
Track provider rate limit headroom and execution-scoped token usage:
|
|
497
|
+
|
|
498
|
+
```typescript
|
|
499
|
+
import { createRateLimitMonitor } from "smithers-orchestrator/rate-limits";
|
|
500
|
+
|
|
501
|
+
const monitor = createRateLimitMonitor({
|
|
502
|
+
anthropic: { apiKey: process.env.ANTHROPIC_API_KEY! },
|
|
503
|
+
db,
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
const status = await monitor.getStatus("anthropic", "claude-sonnet-4");
|
|
507
|
+
const usage = await monitor.getUsage(executionId);
|
|
508
|
+
```
|
|
509
|
+
|
|
387
510
|
---
|
|
388
511
|
|
|
389
512
|
## Contributing
|
|
@@ -398,4 +521,4 @@ See [CONTRIBUTING.md](./CONTRIBUTING.md) for details.
|
|
|
398
521
|
|
|
399
522
|
---
|
|
400
523
|
|
|
401
|
-
**Built with
|
|
524
|
+
**Built with React, powered by Claude.**
|
package/bin/cli.ts
CHANGED
|
@@ -1,69 +1,117 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
-
import { Command } from
|
|
4
|
-
import { init } from
|
|
5
|
-
import { run } from
|
|
6
|
-
import { monitor } from
|
|
7
|
-
import { dbCommand } from
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
import { init } from "../src/commands/init.ts";
|
|
5
|
+
import { run } from "../src/commands/run.ts";
|
|
6
|
+
import { monitor } from "../src/commands/monitor.ts";
|
|
7
|
+
import { dbCommand } from "../src/commands/db.ts";
|
|
8
|
+
import { launchTUI } from "../src/tui/index.tsx";
|
|
9
|
+
import { DEFAULT_DB_DIR, DEFAULT_MAIN_FILE, resolveDbPaths } from "../src/commands/cli-utils.ts";
|
|
8
10
|
|
|
9
|
-
const program = new Command()
|
|
11
|
+
const program = new Command();
|
|
10
12
|
|
|
11
13
|
program
|
|
12
|
-
.name(
|
|
13
|
-
.description(
|
|
14
|
-
|
|
14
|
+
.name("smithers")
|
|
15
|
+
.description(
|
|
16
|
+
"CLI tool for multi-agent AI orchestration with Smithers framework",
|
|
17
|
+
)
|
|
18
|
+
.version("0.1.0");
|
|
15
19
|
|
|
16
20
|
program
|
|
17
|
-
.command(
|
|
18
|
-
.description(
|
|
19
|
-
.option(
|
|
20
|
-
|
|
21
|
+
.command("init")
|
|
22
|
+
.description("Create a new Smithers orchestration in .smithers/")
|
|
23
|
+
.option(
|
|
24
|
+
"-d, --dir <directory>",
|
|
25
|
+
"Directory to create .smithers in",
|
|
26
|
+
process.cwd(),
|
|
27
|
+
)
|
|
28
|
+
.action(init);
|
|
21
29
|
|
|
22
30
|
program
|
|
23
|
-
.command(
|
|
24
|
-
.description(
|
|
25
|
-
.
|
|
26
|
-
.action(run)
|
|
31
|
+
.command("run [file]")
|
|
32
|
+
.description("Run a Smithers orchestration file (default: .smithers/main.tsx)")
|
|
33
|
+
.action((file?: string) => run(file));
|
|
27
34
|
|
|
28
35
|
program
|
|
29
|
-
.command(
|
|
30
|
-
.description(
|
|
31
|
-
.option(
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
.command("monitor [file]")
|
|
37
|
+
.description("Run with LLM-friendly monitoring (recommended)")
|
|
38
|
+
.option(
|
|
39
|
+
"-f, --file <file>",
|
|
40
|
+
"Orchestration file to monitor",
|
|
41
|
+
DEFAULT_MAIN_FILE,
|
|
42
|
+
)
|
|
43
|
+
.option("--no-summary", "Disable Haiku summarization")
|
|
44
|
+
.action(monitor);
|
|
34
45
|
|
|
35
46
|
program
|
|
36
|
-
.command(
|
|
37
|
-
.description(
|
|
38
|
-
.option(
|
|
39
|
-
.action(dbCommand)
|
|
47
|
+
.command("db [subcommand]")
|
|
48
|
+
.description("Inspect and manage the SQLite database")
|
|
49
|
+
.option("--path <path>", "Database path", DEFAULT_DB_DIR)
|
|
50
|
+
.action(dbCommand);
|
|
40
51
|
|
|
41
|
-
// Hook trigger command - called by git hooks to notify orchestration
|
|
42
52
|
program
|
|
43
|
-
.command(
|
|
44
|
-
.description(
|
|
45
|
-
.option(
|
|
53
|
+
.command("tui")
|
|
54
|
+
.description("Launch observability TUI dashboard")
|
|
55
|
+
.option("-p, --path <path>", "Database path", ".smithers/data")
|
|
56
|
+
.action(async (options: { path: string }) => {
|
|
57
|
+
try {
|
|
58
|
+
await launchTUI({ dbPath: options.path });
|
|
59
|
+
} catch (error) {
|
|
60
|
+
console.error('❌ Failed to launch TUI:', error instanceof Error ? error.message : error);
|
|
61
|
+
if (!process.stdout.isTTY) {
|
|
62
|
+
console.error(' TUI requires an interactive terminal');
|
|
63
|
+
}
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const VALID_HOOK_TYPES = ['pre-commit', 'post-commit', 'pre-push', 'post-merge'] as const
|
|
69
|
+
|
|
70
|
+
program
|
|
71
|
+
.command("hook-trigger <type> <data>")
|
|
72
|
+
.description("Trigger a hook event (used by git hooks). Data must be valid JSON.")
|
|
73
|
+
.option("--path <path>", "Database path", DEFAULT_DB_DIR)
|
|
46
74
|
.action(async (type: string, data: string, options: { path: string }) => {
|
|
75
|
+
if (!VALID_HOOK_TYPES.includes(type as typeof VALID_HOOK_TYPES[number])) {
|
|
76
|
+
console.error(`❌ Invalid hook type: ${type}`)
|
|
77
|
+
console.error(` Valid types: ${VALID_HOOK_TYPES.join(', ')}`)
|
|
78
|
+
process.exit(1)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
let parsedData: unknown
|
|
47
82
|
try {
|
|
48
|
-
|
|
49
|
-
|
|
83
|
+
parsedData = JSON.parse(data)
|
|
84
|
+
} catch {
|
|
85
|
+
console.error(`❌ Invalid JSON data: ${data}`)
|
|
86
|
+
console.error(' Data must be valid JSON')
|
|
87
|
+
process.exit(1)
|
|
88
|
+
}
|
|
50
89
|
|
|
51
|
-
|
|
90
|
+
try {
|
|
91
|
+
const { createSmithersDB } = await import(
|
|
92
|
+
"../src/db/index.ts"
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
const { dbFile } = resolveDbPaths(options.path);
|
|
96
|
+
const db = createSmithersDB({ path: dbFile });
|
|
52
97
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
98
|
+
db.state.set(
|
|
99
|
+
"last_hook_trigger",
|
|
100
|
+
{
|
|
101
|
+
type,
|
|
102
|
+
data: parsedData,
|
|
103
|
+
timestamp: Date.now(),
|
|
104
|
+
},
|
|
105
|
+
"hook-trigger",
|
|
106
|
+
);
|
|
59
107
|
|
|
60
|
-
|
|
108
|
+
db.close();
|
|
61
109
|
|
|
62
|
-
console.log(`[Hook] Triggered: ${type}
|
|
110
|
+
console.log(`[Hook] Triggered: ${type}`);
|
|
63
111
|
} catch (error) {
|
|
64
|
-
console.error(
|
|
65
|
-
process.exit(1)
|
|
112
|
+
console.error("[Hook] Error:", error);
|
|
113
|
+
process.exit(1);
|
|
66
114
|
}
|
|
67
|
-
})
|
|
115
|
+
});
|
|
68
116
|
|
|
69
|
-
program.parse(process.argv)
|
|
117
|
+
program.parse(process.argv);
|
package/bunfig.toml
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
# Bun configuration for Smithers
|
|
2
2
|
# https://bun.sh/docs/runtime/bunfig
|
|
3
3
|
|
|
4
|
-
# Use bun-plugin-solid for Solid JSX transform
|
|
5
|
-
preload = ["./preload.ts"]
|
|
6
|
-
|
|
7
4
|
[install]
|
|
8
5
|
auto = "fallback"
|
|
9
6
|
|
|
10
7
|
[test]
|
|
11
|
-
preload = ["./
|
|
8
|
+
preload = ["./test/preload.ts"]
|
|
9
|
+
exclude = ["**/reference/**", "**/node_modules/**"]
|