smithers-orchestrator 0.1.9 → 0.1.12
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/bin/cli.ts +5 -5
- package/bunfig.toml +12 -0
- package/package.json +30 -110
- package/src/components/Claude.tsx +116 -0
- package/src/components/ClaudeApi.tsx +33 -0
- package/src/components/Constraints.tsx +31 -0
- package/src/components/Git/Commit.tsx +167 -0
- package/src/components/Git/Notes.tsx +91 -0
- package/{dist/components/Git/index.d.ts → src/components/Git/index.ts} +3 -3
- package/src/components/Hooks/OnCIFailure.tsx +233 -0
- package/src/components/Hooks/PostCommit.tsx +155 -0
- package/src/components/Hooks/index.ts +5 -0
- package/src/components/Human.tsx +34 -0
- package/src/components/JJ/Commit.tsx +110 -0
- package/src/components/JJ/Describe.tsx +102 -0
- package/src/components/JJ/Rebase.tsx +156 -0
- package/src/components/JJ/Snapshot.tsx +69 -0
- package/src/components/JJ/Status.tsx +93 -0
- package/src/components/JJ/index.ts +8 -0
- package/src/components/MCP/Sqlite.tsx +37 -0
- package/{dist/components/MCP/index.js → src/components/MCP/index.ts} +2 -2
- package/src/components/Persona.tsx +31 -0
- package/src/components/Phase.tsx +19 -0
- package/src/components/Ralph.tsx +166 -0
- package/src/components/Review.tsx +324 -0
- package/src/components/Step.tsx +19 -0
- package/src/components/Stop.tsx +29 -0
- package/src/components/Subagent.tsx +32 -0
- package/src/components/Task.tsx +29 -0
- package/src/components/index.ts +32 -0
- package/src/core/execute.ts +72 -0
- package/src/core/index.ts +15 -0
- package/src/core/root.ts +73 -0
- package/src/core/serialize-direct.test.ts +323 -0
- package/src/core/serialize.ts +107 -0
- package/src/core/types.ts +60 -0
- package/src/debug/index.ts +19 -0
- package/src/globals.d.ts +18 -0
- package/{dist/index.js → src/index.ts} +8 -5
- package/src/jsx-runtime.ts +101 -0
- package/src/jsx.d.ts +92 -0
- package/src/orchestrator/commands/db.ts +332 -0
- package/src/orchestrator/commands/init.ts +86 -0
- package/src/orchestrator/commands/monitor.ts +173 -0
- package/src/orchestrator/commands/run.ts +75 -0
- package/src/orchestrator/components/Claude.tsx +247 -0
- package/src/orchestrator/components/Orchestration.tsx +236 -0
- package/src/orchestrator/components/Phase.tsx +117 -0
- package/src/orchestrator/components/Smithers.tsx +256 -0
- package/src/orchestrator/components/SmithersProvider.tsx +180 -0
- package/src/orchestrator/components/Step.tsx +173 -0
- package/src/orchestrator/components/agents/ClaudeCodeCLI.ts +558 -0
- package/src/orchestrator/components/agents/SmithersCLI.test.ts +138 -0
- package/src/orchestrator/components/agents/SmithersCLI.ts +390 -0
- package/src/orchestrator/components/agents/types.ts +449 -0
- package/src/orchestrator/components/index.ts +25 -0
- package/src/orchestrator/db/execution.ts +711 -0
- package/src/orchestrator/db/index.ts +704 -0
- package/src/orchestrator/db/live-query.ts +110 -0
- package/src/orchestrator/db/memories.ts +272 -0
- package/src/orchestrator/db/state.ts +257 -0
- package/src/orchestrator/db/types.ts +218 -0
- package/src/orchestrator/db/vcs.ts +338 -0
- package/src/orchestrator/integration.test.ts +362 -0
- package/src/orchestrator/monitor/haiku-summarizer.ts +81 -0
- package/src/orchestrator/monitor/log-writer.ts +78 -0
- package/src/orchestrator/monitor/output-parser.ts +131 -0
- package/src/orchestrator/monitor/stream-formatter.ts +173 -0
- package/src/orchestrator/tools/ReportTool.ts +151 -0
- package/src/orchestrator/tools/index.ts +25 -0
- package/src/orchestrator/tools/registry.ts +149 -0
- package/src/orchestrator/utils/mcp-config.test.ts +143 -0
- package/src/orchestrator/utils/mcp-config.ts +106 -0
- package/src/orchestrator/utils/structured-output.test.ts +305 -0
- package/src/orchestrator/utils/structured-output.ts +278 -0
- package/src/solid/h.ts +80 -0
- package/src/solid/index.ts +21 -0
- package/src/solid/renderer-core.test.ts +195 -0
- package/src/solid/renderer-methods.ts +85 -0
- package/src/solid/renderer.js +128 -0
- package/src/solid/renderer.ts +49 -0
- package/src/solid/root.ts +89 -0
- package/src/solid/simple-renderer.ts +81 -0
- package/src/utils/vcs.ts +341 -0
- package/dist/components/Claude.d.ts +0 -27
- package/dist/components/Claude.d.ts.map +0 -1
- package/dist/components/Claude.jsx +0 -82
- package/dist/components/Claude.jsx.map +0 -1
- package/dist/components/Git/Commit.d.ts +0 -33
- package/dist/components/Git/Commit.d.ts.map +0 -1
- package/dist/components/Git/Commit.jsx +0 -118
- package/dist/components/Git/Commit.jsx.map +0 -1
- package/dist/components/Git/Notes.d.ts +0 -25
- package/dist/components/Git/Notes.d.ts.map +0 -1
- package/dist/components/Git/Notes.jsx +0 -57
- package/dist/components/Git/Notes.jsx.map +0 -1
- package/dist/components/Git/index.d.ts.map +0 -1
- package/dist/components/Git/index.js +0 -4
- package/dist/components/Git/index.js.map +0 -1
- package/dist/components/Hooks/OnCIFailure.d.ts +0 -42
- package/dist/components/Hooks/OnCIFailure.d.ts.map +0 -1
- package/dist/components/Hooks/OnCIFailure.jsx +0 -164
- package/dist/components/Hooks/OnCIFailure.jsx.map +0 -1
- package/dist/components/Hooks/PostCommit.d.ts +0 -32
- package/dist/components/Hooks/PostCommit.d.ts.map +0 -1
- package/dist/components/Hooks/PostCommit.jsx +0 -113
- package/dist/components/Hooks/PostCommit.jsx.map +0 -1
- package/dist/components/Hooks/index.d.ts +0 -3
- package/dist/components/Hooks/index.d.ts.map +0 -1
- package/dist/components/Hooks/index.js +0 -5
- package/dist/components/Hooks/index.js.map +0 -1
- package/dist/components/JJ/Commit.d.ts +0 -15
- package/dist/components/JJ/Commit.d.ts.map +0 -1
- package/dist/components/JJ/Commit.jsx +0 -83
- package/dist/components/JJ/Commit.jsx.map +0 -1
- package/dist/components/JJ/Describe.d.ts +0 -14
- package/dist/components/JJ/Describe.d.ts.map +0 -1
- package/dist/components/JJ/Describe.jsx +0 -77
- package/dist/components/JJ/Describe.jsx.map +0 -1
- package/dist/components/JJ/Rebase.d.ts +0 -15
- package/dist/components/JJ/Rebase.d.ts.map +0 -1
- package/dist/components/JJ/Rebase.jsx +0 -128
- package/dist/components/JJ/Rebase.jsx.map +0 -1
- package/dist/components/JJ/Snapshot.d.ts +0 -13
- package/dist/components/JJ/Snapshot.d.ts.map +0 -1
- package/dist/components/JJ/Snapshot.jsx +0 -52
- package/dist/components/JJ/Snapshot.jsx.map +0 -1
- package/dist/components/JJ/Status.d.ts +0 -18
- package/dist/components/JJ/Status.d.ts.map +0 -1
- package/dist/components/JJ/Status.jsx +0 -67
- package/dist/components/JJ/Status.jsx.map +0 -1
- package/dist/components/JJ/index.d.ts +0 -6
- package/dist/components/JJ/index.d.ts.map +0 -1
- package/dist/components/JJ/index.js +0 -8
- package/dist/components/JJ/index.js.map +0 -1
- package/dist/components/MCP/Sqlite.d.ts +0 -25
- package/dist/components/MCP/Sqlite.d.ts.map +0 -1
- package/dist/components/MCP/Sqlite.jsx +0 -24
- package/dist/components/MCP/Sqlite.jsx.map +0 -1
- package/dist/components/MCP/index.d.ts +0 -2
- package/dist/components/MCP/index.d.ts.map +0 -1
- package/dist/components/MCP/index.js.map +0 -1
- package/dist/components/Phase.d.ts +0 -12
- package/dist/components/Phase.d.ts.map +0 -1
- package/dist/components/Phase.jsx +0 -10
- package/dist/components/Phase.jsx.map +0 -1
- package/dist/components/Ralph.d.ts +0 -42
- package/dist/components/Ralph.d.ts.map +0 -1
- package/dist/components/Ralph.jsx +0 -123
- package/dist/components/Ralph.jsx.map +0 -1
- package/dist/components/Review.d.ts +0 -56
- package/dist/components/Review.d.ts.map +0 -1
- package/dist/components/Review.jsx +0 -235
- package/dist/components/Review.jsx.map +0 -1
- package/dist/components/Step.d.ts +0 -12
- package/dist/components/Step.d.ts.map +0 -1
- package/dist/components/Step.jsx +0 -10
- package/dist/components/Step.jsx.map +0 -1
- package/dist/components/index.d.ts +0 -11
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/index.js +0 -16
- package/dist/components/index.js.map +0 -1
- package/dist/core/execute.d.ts +0 -15
- package/dist/core/execute.d.ts.map +0 -1
- package/dist/core/execute.js +0 -53
- package/dist/core/execute.js.map +0 -1
- package/dist/core/index.d.ts +0 -7
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -6
- package/dist/core/index.js.map +0 -1
- package/dist/core/root.d.ts +0 -28
- package/dist/core/root.d.ts.map +0 -1
- package/dist/core/root.js +0 -40
- package/dist/core/root.js.map +0 -1
- package/dist/core/serialize.d.ts +0 -15
- package/dist/core/serialize.d.ts.map +0 -1
- package/dist/core/serialize.js +0 -90
- package/dist/core/serialize.js.map +0 -1
- package/dist/core/types.d.ts +0 -55
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.js +0 -11
- package/dist/core/types.js.map +0 -1
- package/dist/debug/index.d.ts +0 -10
- package/dist/debug/index.d.ts.map +0 -1
- package/dist/debug/index.js +0 -11
- package/dist/debug/index.js.map +0 -1
- package/dist/index.d.ts +0 -14
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/orchestrator/commands/db.d.ts +0 -6
- package/dist/orchestrator/commands/db.d.ts.map +0 -1
- package/dist/orchestrator/commands/db.js +0 -272
- package/dist/orchestrator/commands/db.js.map +0 -1
- package/dist/orchestrator/commands/init.d.ts +0 -6
- package/dist/orchestrator/commands/init.d.ts.map +0 -1
- package/dist/orchestrator/commands/init.js +0 -74
- package/dist/orchestrator/commands/init.js.map +0 -1
- package/dist/orchestrator/commands/monitor.d.ts +0 -7
- package/dist/orchestrator/commands/monitor.d.ts.map +0 -1
- package/dist/orchestrator/commands/monitor.js +0 -136
- package/dist/orchestrator/commands/monitor.js.map +0 -1
- package/dist/orchestrator/commands/run.d.ts +0 -6
- package/dist/orchestrator/commands/run.d.ts.map +0 -1
- package/dist/orchestrator/commands/run.js +0 -62
- package/dist/orchestrator/commands/run.js.map +0 -1
- package/dist/orchestrator/components/Claude.d.ts +0 -31
- package/dist/orchestrator/components/Claude.d.ts.map +0 -1
- package/dist/orchestrator/components/Claude.jsx +0 -195
- package/dist/orchestrator/components/Claude.jsx.map +0 -1
- package/dist/orchestrator/components/Orchestration.d.ts +0 -76
- package/dist/orchestrator/components/Orchestration.d.ts.map +0 -1
- package/dist/orchestrator/components/Orchestration.jsx +0 -154
- package/dist/orchestrator/components/Orchestration.jsx.map +0 -1
- package/dist/orchestrator/components/Phase.d.ts +0 -35
- package/dist/orchestrator/components/Phase.d.ts.map +0 -1
- package/dist/orchestrator/components/Phase.jsx +0 -76
- package/dist/orchestrator/components/Phase.jsx.map +0 -1
- package/dist/orchestrator/components/Smithers.d.ts +0 -94
- package/dist/orchestrator/components/Smithers.d.ts.map +0 -1
- package/dist/orchestrator/components/Smithers.jsx +0 -128
- package/dist/orchestrator/components/Smithers.jsx.map +0 -1
- package/dist/orchestrator/components/SmithersProvider.d.ts +0 -95
- package/dist/orchestrator/components/SmithersProvider.d.ts.map +0 -1
- package/dist/orchestrator/components/SmithersProvider.jsx +0 -70
- package/dist/orchestrator/components/SmithersProvider.jsx.map +0 -1
- package/dist/orchestrator/components/Step.d.ts +0 -47
- package/dist/orchestrator/components/Step.d.ts.map +0 -1
- package/dist/orchestrator/components/Step.jsx +0 -120
- package/dist/orchestrator/components/Step.jsx.map +0 -1
- package/dist/orchestrator/components/agents/ClaudeCodeCLI.d.ts +0 -37
- package/dist/orchestrator/components/agents/ClaudeCodeCLI.d.ts.map +0 -1
- package/dist/orchestrator/components/agents/ClaudeCodeCLI.js +0 -440
- package/dist/orchestrator/components/agents/ClaudeCodeCLI.js.map +0 -1
- package/dist/orchestrator/components/agents/SmithersCLI.d.ts +0 -72
- package/dist/orchestrator/components/agents/SmithersCLI.d.ts.map +0 -1
- package/dist/orchestrator/components/agents/SmithersCLI.js +0 -274
- package/dist/orchestrator/components/agents/SmithersCLI.js.map +0 -1
- package/dist/orchestrator/components/agents/types.d.ts +0 -332
- package/dist/orchestrator/components/agents/types.d.ts.map +0 -1
- package/dist/orchestrator/components/agents/types.js +0 -4
- package/dist/orchestrator/components/agents/types.js.map +0 -1
- package/dist/orchestrator/components/index.d.ts +0 -14
- package/dist/orchestrator/components/index.d.ts.map +0 -1
- package/dist/orchestrator/components/index.js +0 -13
- package/dist/orchestrator/components/index.js.map +0 -1
- package/dist/orchestrator/db/execution.d.ts +0 -148
- package/dist/orchestrator/db/execution.d.ts.map +0 -1
- package/dist/orchestrator/db/execution.js +0 -497
- package/dist/orchestrator/db/execution.js.map +0 -1
- package/dist/orchestrator/db/index.d.ts +0 -381
- package/dist/orchestrator/db/index.d.ts.map +0 -1
- package/dist/orchestrator/db/index.js +0 -192
- package/dist/orchestrator/db/index.js.map +0 -1
- package/dist/orchestrator/db/live-query.d.ts +0 -39
- package/dist/orchestrator/db/live-query.d.ts.map +0 -1
- package/dist/orchestrator/db/live-query.js +0 -64
- package/dist/orchestrator/db/live-query.js.map +0 -1
- package/dist/orchestrator/db/memories.d.ts +0 -66
- package/dist/orchestrator/db/memories.d.ts.map +0 -1
- package/dist/orchestrator/db/memories.js +0 -193
- package/dist/orchestrator/db/memories.js.map +0 -1
- package/dist/orchestrator/db/state.d.ts +0 -62
- package/dist/orchestrator/db/state.d.ts.map +0 -1
- package/dist/orchestrator/db/state.js +0 -179
- package/dist/orchestrator/db/state.js.map +0 -1
- package/dist/orchestrator/db/types.d.ts +0 -198
- package/dist/orchestrator/db/types.d.ts.map +0 -1
- package/dist/orchestrator/db/types.js +0 -3
- package/dist/orchestrator/db/types.js.map +0 -1
- package/dist/orchestrator/db/vcs.d.ts +0 -96
- package/dist/orchestrator/db/vcs.d.ts.map +0 -1
- package/dist/orchestrator/db/vcs.js +0 -225
- package/dist/orchestrator/db/vcs.js.map +0 -1
- package/dist/orchestrator/monitor/haiku-summarizer.d.ts +0 -10
- package/dist/orchestrator/monitor/haiku-summarizer.d.ts.map +0 -1
- package/dist/orchestrator/monitor/haiku-summarizer.js +0 -59
- package/dist/orchestrator/monitor/haiku-summarizer.js.map +0 -1
- package/dist/orchestrator/monitor/log-writer.d.ts +0 -13
- package/dist/orchestrator/monitor/log-writer.d.ts.map +0 -1
- package/dist/orchestrator/monitor/log-writer.js +0 -64
- package/dist/orchestrator/monitor/log-writer.js.map +0 -1
- package/dist/orchestrator/monitor/output-parser.d.ts +0 -22
- package/dist/orchestrator/monitor/output-parser.d.ts.map +0 -1
- package/dist/orchestrator/monitor/output-parser.js +0 -114
- package/dist/orchestrator/monitor/output-parser.js.map +0 -1
- package/dist/orchestrator/monitor/stream-formatter.d.ts +0 -26
- package/dist/orchestrator/monitor/stream-formatter.d.ts.map +0 -1
- package/dist/orchestrator/monitor/stream-formatter.js +0 -137
- package/dist/orchestrator/monitor/stream-formatter.js.map +0 -1
- package/dist/orchestrator/tools/ReportTool.d.ts +0 -25
- package/dist/orchestrator/tools/ReportTool.d.ts.map +0 -1
- package/dist/orchestrator/tools/ReportTool.js +0 -136
- package/dist/orchestrator/tools/ReportTool.js.map +0 -1
- package/dist/orchestrator/tools/index.d.ts +0 -3
- package/dist/orchestrator/tools/index.d.ts.map +0 -1
- package/dist/orchestrator/tools/index.js +0 -8
- package/dist/orchestrator/tools/index.js.map +0 -1
- package/dist/orchestrator/tools/registry.d.ts +0 -132
- package/dist/orchestrator/tools/registry.d.ts.map +0 -1
- package/dist/orchestrator/tools/registry.js +0 -90
- package/dist/orchestrator/tools/registry.js.map +0 -1
- package/dist/orchestrator/utils/mcp-config.d.ts +0 -24
- package/dist/orchestrator/utils/mcp-config.d.ts.map +0 -1
- package/dist/orchestrator/utils/mcp-config.js +0 -82
- package/dist/orchestrator/utils/mcp-config.js.map +0 -1
- package/dist/orchestrator/utils/structured-output.d.ts +0 -41
- package/dist/orchestrator/utils/structured-output.d.ts.map +0 -1
- package/dist/orchestrator/utils/structured-output.js +0 -218
- package/dist/orchestrator/utils/structured-output.js.map +0 -1
- package/dist/solid/index.d.ts +0 -7
- package/dist/solid/index.d.ts.map +0 -1
- package/dist/solid/index.js +0 -8
- package/dist/solid/index.js.map +0 -1
- package/dist/solid/renderer-methods.d.ts +0 -20
- package/dist/solid/renderer-methods.d.ts.map +0 -1
- package/dist/solid/renderer-methods.js +0 -75
- package/dist/solid/renderer-methods.js.map +0 -1
- package/dist/solid/renderer.d.ts +0 -21
- package/dist/solid/renderer.d.ts.map +0 -1
- package/dist/solid/renderer.js +0 -42
- package/dist/solid/renderer.js.map +0 -1
- package/dist/solid/root.d.ts +0 -24
- package/dist/solid/root.d.ts.map +0 -1
- package/dist/solid/root.js +0 -55
- package/dist/solid/root.js.map +0 -1
- package/dist/utils/vcs.d.ts +0 -125
- package/dist/utils/vcs.d.ts.map +0 -1
- package/dist/utils/vcs.js +0 -271
- package/dist/utils/vcs.js.map +0 -1
- package/postinstall.cjs +0 -82
- /package/{dist → src}/orchestrator/db/schema.sql +0 -0
package/bin/cli.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
3
|
import { Command } from 'commander'
|
|
4
|
-
import { init } from '../src/orchestrator/commands/init.
|
|
5
|
-
import { run } from '../src/orchestrator/commands/run.
|
|
6
|
-
import { monitor } from '../src/orchestrator/commands/monitor.
|
|
7
|
-
import { dbCommand } from '../src/orchestrator/commands/db.
|
|
4
|
+
import { init } from '../src/orchestrator/commands/init.ts'
|
|
5
|
+
import { run } from '../src/orchestrator/commands/run.ts'
|
|
6
|
+
import { monitor } from '../src/orchestrator/commands/monitor.ts'
|
|
7
|
+
import { dbCommand } from '../src/orchestrator/commands/db.ts'
|
|
8
8
|
|
|
9
9
|
const program = new Command()
|
|
10
10
|
|
|
@@ -46,7 +46,7 @@ program
|
|
|
46
46
|
.action(async (type: string, data: string, options: { path: string }) => {
|
|
47
47
|
try {
|
|
48
48
|
// Dynamically import to avoid loading DB on every CLI call
|
|
49
|
-
const { createSmithersDB } = await import('../src/orchestrator/db/index.
|
|
49
|
+
const { createSmithersDB } = await import('../src/orchestrator/db/index.ts')
|
|
50
50
|
|
|
51
51
|
const db = await createSmithersDB({ path: options.path })
|
|
52
52
|
|
package/bunfig.toml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Bun configuration for Smithers
|
|
2
|
+
# https://bun.sh/docs/runtime/bunfig
|
|
3
|
+
# Usage: bun -c node_modules/smithers-orchestrator/bunfig.toml your-file.tsx
|
|
4
|
+
|
|
5
|
+
jsx = "react-jsx"
|
|
6
|
+
jsxImportSource = "solid-js/h"
|
|
7
|
+
|
|
8
|
+
[install]
|
|
9
|
+
auto = "fallback"
|
|
10
|
+
|
|
11
|
+
[test]
|
|
12
|
+
preload = ["./test/preload.ts"]
|
package/package.json
CHANGED
|
@@ -1,117 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smithers-orchestrator",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "Build AI agents with Solid.js - Declarative JSX for Claude orchestration",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
6
|
+
"main": "./src/index.ts",
|
|
8
7
|
"bin": {
|
|
9
|
-
"smithers": "./bin/cli.
|
|
8
|
+
"smithers": "./bin/cli.ts"
|
|
10
9
|
},
|
|
11
10
|
"exports": {
|
|
12
|
-
".":
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"./
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"./
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"./
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"./
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
"./components/Review": {
|
|
33
|
-
"types": "./dist/components/Review.d.ts",
|
|
34
|
-
"import": "./dist/components/Review.jsx"
|
|
35
|
-
},
|
|
36
|
-
"./components/Phase": {
|
|
37
|
-
"types": "./dist/components/Phase.d.ts",
|
|
38
|
-
"import": "./dist/components/Phase.jsx"
|
|
39
|
-
},
|
|
40
|
-
"./components/Step": {
|
|
41
|
-
"types": "./dist/components/Step.d.ts",
|
|
42
|
-
"import": "./dist/components/Step.jsx"
|
|
43
|
-
},
|
|
44
|
-
"./components/JJ": {
|
|
45
|
-
"types": "./dist/components/JJ/index.d.ts",
|
|
46
|
-
"import": "./dist/components/JJ/index.js"
|
|
47
|
-
},
|
|
48
|
-
"./components/Git": {
|
|
49
|
-
"types": "./dist/components/Git/index.d.ts",
|
|
50
|
-
"import": "./dist/components/Git/index.js"
|
|
51
|
-
},
|
|
52
|
-
"./components/Hooks": {
|
|
53
|
-
"types": "./dist/components/Hooks/index.d.ts",
|
|
54
|
-
"import": "./dist/components/Hooks/index.js"
|
|
55
|
-
},
|
|
56
|
-
"./components/MCP": {
|
|
57
|
-
"types": "./dist/components/MCP/index.d.ts",
|
|
58
|
-
"import": "./dist/components/MCP/index.js"
|
|
59
|
-
},
|
|
60
|
-
"./orchestrator": {
|
|
61
|
-
"types": "./dist/orchestrator/components/index.d.ts",
|
|
62
|
-
"import": "./dist/orchestrator/components/index.js"
|
|
63
|
-
},
|
|
64
|
-
"./orchestrator/SmithersProvider": {
|
|
65
|
-
"types": "./dist/orchestrator/components/SmithersProvider.d.ts",
|
|
66
|
-
"import": "./dist/orchestrator/components/SmithersProvider.jsx"
|
|
67
|
-
},
|
|
68
|
-
"./orchestrator/Orchestration": {
|
|
69
|
-
"types": "./dist/orchestrator/components/Orchestration.d.ts",
|
|
70
|
-
"import": "./dist/orchestrator/components/Orchestration.jsx"
|
|
71
|
-
},
|
|
72
|
-
"./orchestrator/Claude": {
|
|
73
|
-
"types": "./dist/orchestrator/components/Claude.d.ts",
|
|
74
|
-
"import": "./dist/orchestrator/components/Claude.jsx"
|
|
75
|
-
},
|
|
76
|
-
"./orchestrator/Phase": {
|
|
77
|
-
"types": "./dist/orchestrator/components/Phase.d.ts",
|
|
78
|
-
"import": "./dist/orchestrator/components/Phase.jsx"
|
|
79
|
-
},
|
|
80
|
-
"./orchestrator/Step": {
|
|
81
|
-
"types": "./dist/orchestrator/components/Step.d.ts",
|
|
82
|
-
"import": "./dist/orchestrator/components/Step.jsx"
|
|
83
|
-
},
|
|
84
|
-
"./db": {
|
|
85
|
-
"types": "./dist/orchestrator/db/index.d.ts",
|
|
86
|
-
"import": "./dist/orchestrator/db/index.js"
|
|
87
|
-
},
|
|
88
|
-
"./debug": {
|
|
89
|
-
"types": "./dist/debug/index.d.ts",
|
|
90
|
-
"import": "./dist/debug/index.js"
|
|
91
|
-
},
|
|
92
|
-
"./renderer": {
|
|
93
|
-
"import": "./src/solid/renderer.js"
|
|
94
|
-
}
|
|
11
|
+
".": "./src/index.ts",
|
|
12
|
+
"./core": "./src/core/index.ts",
|
|
13
|
+
"./solid": "./src/solid/index.ts",
|
|
14
|
+
"./components": "./src/components/index.ts",
|
|
15
|
+
"./components/Ralph": "./src/components/Ralph.tsx",
|
|
16
|
+
"./components/Review": "./src/components/Review.tsx",
|
|
17
|
+
"./components/Phase": "./src/components/Phase.tsx",
|
|
18
|
+
"./components/Step": "./src/components/Step.tsx",
|
|
19
|
+
"./components/JJ": "./src/components/JJ/index.ts",
|
|
20
|
+
"./components/Git": "./src/components/Git/index.ts",
|
|
21
|
+
"./components/Hooks": "./src/components/Hooks/index.ts",
|
|
22
|
+
"./components/MCP": "./src/components/MCP/index.ts",
|
|
23
|
+
"./orchestrator": "./src/orchestrator/components/index.ts",
|
|
24
|
+
"./orchestrator/SmithersProvider": "./src/orchestrator/components/SmithersProvider.tsx",
|
|
25
|
+
"./orchestrator/Orchestration": "./src/orchestrator/components/Orchestration.tsx",
|
|
26
|
+
"./orchestrator/Claude": "./src/orchestrator/components/Claude.tsx",
|
|
27
|
+
"./orchestrator/Phase": "./src/orchestrator/components/Phase.tsx",
|
|
28
|
+
"./orchestrator/Step": "./src/orchestrator/components/Step.tsx",
|
|
29
|
+
"./db": "./src/orchestrator/db/index.ts"
|
|
95
30
|
},
|
|
96
31
|
"files": [
|
|
97
|
-
"
|
|
32
|
+
"src",
|
|
98
33
|
"bin",
|
|
99
34
|
"skills",
|
|
100
35
|
"templates",
|
|
36
|
+
"bunfig.toml",
|
|
101
37
|
"plugin.json",
|
|
102
|
-
"postinstall.cjs",
|
|
103
38
|
"README.md"
|
|
104
39
|
],
|
|
105
40
|
"scripts": {
|
|
106
|
-
"build": "
|
|
107
|
-
"build:cli": "bun build bin/cli.ts --outdir bin --target node",
|
|
108
|
-
"dev": "tsc --watch",
|
|
41
|
+
"build": "echo 'No build needed - Bun runs TypeScript directly'",
|
|
109
42
|
"typecheck": "tsc --noEmit",
|
|
110
|
-
"
|
|
111
|
-
"test": "
|
|
112
|
-
"test:watch": "vitest",
|
|
113
|
-
"test:coverage": "vitest run --coverage",
|
|
114
|
-
"postinstall": "node postinstall.cjs"
|
|
43
|
+
"test": "bun test",
|
|
44
|
+
"test:watch": "bun test --watch"
|
|
115
45
|
},
|
|
116
46
|
"dependencies": {
|
|
117
47
|
"@anthropic-ai/claude-agent-sdk": "^0.1.76",
|
|
@@ -119,20 +49,14 @@
|
|
|
119
49
|
"@electric-sql/pglite": "^0.3.15",
|
|
120
50
|
"commander": "^12.0.0",
|
|
121
51
|
"solid-js": "^1.9.10",
|
|
122
|
-
"zod": "^4.3.5"
|
|
123
|
-
"zustand": "^5.0.10"
|
|
52
|
+
"zod": "^4.3.5"
|
|
124
53
|
},
|
|
125
54
|
"peerDependencies": {
|
|
126
|
-
"solid-js": "^1.9.10",
|
|
127
55
|
"bun": ">=1.0.0"
|
|
128
56
|
},
|
|
129
57
|
"devDependencies": {
|
|
130
58
|
"@types/bun": "latest",
|
|
131
|
-
"
|
|
132
|
-
"happy-dom": "^20.3.1",
|
|
133
|
-
"typescript": "^5.7.2",
|
|
134
|
-
"vite-plugin-solid": "^2.11.10",
|
|
135
|
-
"vitest": "^4.0.17"
|
|
59
|
+
"typescript": "^5.7.2"
|
|
136
60
|
},
|
|
137
61
|
"keywords": [
|
|
138
62
|
"ai",
|
|
@@ -144,16 +68,12 @@
|
|
|
144
68
|
"claude",
|
|
145
69
|
"anthropic",
|
|
146
70
|
"orchestration",
|
|
147
|
-
"
|
|
148
|
-
"workflow"
|
|
71
|
+
"bun"
|
|
149
72
|
],
|
|
150
73
|
"author": "William Cory",
|
|
151
74
|
"license": "MIT",
|
|
152
75
|
"repository": {
|
|
153
76
|
"type": "git",
|
|
154
77
|
"url": "git+https://github.com/evmts/smithers.git"
|
|
155
|
-
},
|
|
156
|
-
"engines": {
|
|
157
|
-
"node": ">=18.0.0"
|
|
158
78
|
}
|
|
159
79
|
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { createSignal, onMount, useContext, type JSX } from 'solid-js'
|
|
2
|
+
import { RalphContext } from './Ralph'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Execute a prompt using Claude Agent SDK.
|
|
6
|
+
* This is a placeholder - will integrate with @anthropic-ai/claude-agent-sdk.
|
|
7
|
+
*/
|
|
8
|
+
async function executeWithClaudeSDK(config: {
|
|
9
|
+
prompt: string
|
|
10
|
+
model: string
|
|
11
|
+
maxTurns?: number
|
|
12
|
+
tools?: string[]
|
|
13
|
+
systemPrompt?: string
|
|
14
|
+
}): Promise<unknown> {
|
|
15
|
+
// TODO: Integrate with @anthropic-ai/claude-agent-sdk
|
|
16
|
+
|
|
17
|
+
// For now, return mock response for testing
|
|
18
|
+
if (process.env.NODE_ENV === 'test' || process.env.MOCK_MODE === 'true') {
|
|
19
|
+
// Simulate some async delay
|
|
20
|
+
await new Promise(resolve => setTimeout(resolve, 10))
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
output: `Mock response for: ${config.prompt}`,
|
|
24
|
+
model: config.model,
|
|
25
|
+
turns: 1,
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
throw new Error('Claude SDK integration not yet implemented')
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ClaudeProps {
|
|
33
|
+
children?: JSX.Element
|
|
34
|
+
model?: string
|
|
35
|
+
maxTurns?: number
|
|
36
|
+
tools?: string[]
|
|
37
|
+
systemPrompt?: string
|
|
38
|
+
onFinished?: (result: unknown) => void
|
|
39
|
+
onError?: (error: Error) => void
|
|
40
|
+
validate?: (result: unknown) => Promise<boolean>
|
|
41
|
+
[key: string]: unknown
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Claude component that executes on mount.
|
|
46
|
+
*
|
|
47
|
+
* CRITICAL PATTERN: This component is BOTH declaration AND execution.
|
|
48
|
+
* When it mounts, it executes itself. No external orchestrator needed.
|
|
49
|
+
*
|
|
50
|
+
* GOTCHA: Use fire-and-forget async IIFE inside onMount:
|
|
51
|
+
* onMount(() => {
|
|
52
|
+
* (async () => { ... })() // ← Fire and forget
|
|
53
|
+
* })
|
|
54
|
+
*
|
|
55
|
+
* NOT: onMount(async () => { ... }) // ← Doesn't work!
|
|
56
|
+
*/
|
|
57
|
+
export function Claude(props: ClaudeProps): JSX.Element {
|
|
58
|
+
const ralph = useContext(RalphContext)
|
|
59
|
+
const [status, setStatus] = createSignal<'pending' | 'running' | 'complete' | 'error'>('pending')
|
|
60
|
+
const [result, setResult] = createSignal<unknown>(null)
|
|
61
|
+
const [error, setError] = createSignal<Error | null>(null)
|
|
62
|
+
|
|
63
|
+
onMount(() => {
|
|
64
|
+
// Fire-and-forget async IIFE
|
|
65
|
+
// This is the CRITICAL pattern for async execution in Solid onMount
|
|
66
|
+
(async () => {
|
|
67
|
+
// Register with Ralph (if present)
|
|
68
|
+
ralph?.registerTask()
|
|
69
|
+
|
|
70
|
+
try {
|
|
71
|
+
setStatus('running')
|
|
72
|
+
|
|
73
|
+
const response = await executeWithClaudeSDK({
|
|
74
|
+
prompt: String(props.children),
|
|
75
|
+
model: props.model || 'claude-sonnet-4',
|
|
76
|
+
maxTurns: props.maxTurns,
|
|
77
|
+
tools: props.tools,
|
|
78
|
+
systemPrompt: props.systemPrompt,
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
// Optional validation
|
|
82
|
+
if (props.validate) {
|
|
83
|
+
const isValid = await props.validate(response)
|
|
84
|
+
if (!isValid) {
|
|
85
|
+
throw new Error('Validation failed')
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
setResult(response)
|
|
90
|
+
setStatus('complete')
|
|
91
|
+
props.onFinished?.(response)
|
|
92
|
+
|
|
93
|
+
} catch (err) {
|
|
94
|
+
const errorObj = err instanceof Error ? err : new Error(String(err))
|
|
95
|
+
setError(errorObj)
|
|
96
|
+
setStatus('error')
|
|
97
|
+
props.onError?.(errorObj)
|
|
98
|
+
} finally {
|
|
99
|
+
// Always complete task with Ralph
|
|
100
|
+
ralph?.completeTask()
|
|
101
|
+
}
|
|
102
|
+
})()
|
|
103
|
+
// Note: No await, no return - just fire and forget
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<claude
|
|
108
|
+
status={status()}
|
|
109
|
+
result={result()}
|
|
110
|
+
error={error()?.message}
|
|
111
|
+
model={props.model}
|
|
112
|
+
>
|
|
113
|
+
{props.children}
|
|
114
|
+
</claude>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { JSX } from 'solid-js'
|
|
2
|
+
|
|
3
|
+
export interface ClaudeApiProps {
|
|
4
|
+
children?: JSX.Element
|
|
5
|
+
model?: string
|
|
6
|
+
maxTurns?: number
|
|
7
|
+
tools?: string[]
|
|
8
|
+
systemPrompt?: string
|
|
9
|
+
onFinished?: (result: unknown) => void
|
|
10
|
+
onError?: (error: Error) => void
|
|
11
|
+
[key: string]: unknown
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* ClaudeApi component - alternative executor using the Anthropic API directly.
|
|
16
|
+
*
|
|
17
|
+
* Unlike the standard Claude component which uses Claude Code CLI,
|
|
18
|
+
* ClaudeApi uses the Anthropic SDK directly for API calls.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <ClaudeApi model="claude-sonnet-4">
|
|
23
|
+
* Generate a haiku about programming
|
|
24
|
+
* </ClaudeApi>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export function ClaudeApi(props: ClaudeApiProps): JSX.Element {
|
|
28
|
+
return (
|
|
29
|
+
<claude-api model={props.model}>
|
|
30
|
+
{props.children}
|
|
31
|
+
</claude-api>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { JSX } from 'solid-js'
|
|
2
|
+
|
|
3
|
+
export interface ConstraintsProps {
|
|
4
|
+
children?: JSX.Element
|
|
5
|
+
[key: string]: unknown
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Constraints component - defines constraints for Claude's responses.
|
|
10
|
+
*
|
|
11
|
+
* Constraints are added to the prompt to guide Claude's behavior.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <Claude>
|
|
16
|
+
* <Constraints>
|
|
17
|
+
* - Keep responses concise
|
|
18
|
+
* - Focus on security
|
|
19
|
+
* - Cite sources
|
|
20
|
+
* </Constraints>
|
|
21
|
+
* Analyze this code
|
|
22
|
+
* </Claude>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export function Constraints(props: ConstraintsProps): JSX.Element {
|
|
26
|
+
return (
|
|
27
|
+
<constraints>
|
|
28
|
+
{props.children}
|
|
29
|
+
</constraints>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { createSignal, onMount, useContext, type JSX } from 'solid-js'
|
|
2
|
+
import { RalphContext } from '../Ralph'
|
|
3
|
+
import { useSmithers } from '../../orchestrator/components/SmithersProvider'
|
|
4
|
+
import { addGitNotes, getCommitHash, getDiffStats } from '../../utils/vcs'
|
|
5
|
+
|
|
6
|
+
export interface CommitProps {
|
|
7
|
+
/** Commit message (optional if autoGenerate is true) */
|
|
8
|
+
message?: string
|
|
9
|
+
/** Auto-generate commit message using Claude */
|
|
10
|
+
autoGenerate?: boolean
|
|
11
|
+
/** Metadata to store in git notes */
|
|
12
|
+
notes?: Record<string, any>
|
|
13
|
+
/** Specific files to stage (default: all with -A) */
|
|
14
|
+
files?: string[]
|
|
15
|
+
/** Stage all tracked files with -a flag */
|
|
16
|
+
all?: boolean
|
|
17
|
+
/** Children content (used as message if message prop not provided) */
|
|
18
|
+
children?: JSX.Element
|
|
19
|
+
/** Callback when commit is complete */
|
|
20
|
+
onFinished?: (result: CommitResult) => void
|
|
21
|
+
/** Callback on error */
|
|
22
|
+
onError?: (error: Error) => void
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface CommitResult {
|
|
26
|
+
commitHash: string
|
|
27
|
+
message: string
|
|
28
|
+
filesChanged: string[]
|
|
29
|
+
insertions: number
|
|
30
|
+
deletions: number
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Generate commit message using Claude CLI
|
|
35
|
+
*/
|
|
36
|
+
async function generateCommitMessage(): Promise<string> {
|
|
37
|
+
// Get the diff for context
|
|
38
|
+
const diffResult = await Bun.$`git diff --cached --stat`.text()
|
|
39
|
+
const diffContent = await Bun.$`git diff --cached`.text()
|
|
40
|
+
|
|
41
|
+
const prompt = `Generate a concise git commit message for these changes. Return ONLY the commit message, nothing else.
|
|
42
|
+
|
|
43
|
+
Staged files:
|
|
44
|
+
${diffResult}
|
|
45
|
+
|
|
46
|
+
Diff:
|
|
47
|
+
${diffContent.slice(0, 5000)}${diffContent.length > 5000 ? '\n...(truncated)' : ''}`
|
|
48
|
+
|
|
49
|
+
// Use claude CLI with --print to get the response
|
|
50
|
+
const result = await Bun.$`claude --print --prompt ${prompt}`.text()
|
|
51
|
+
return result.trim()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Commit component - creates a git commit with smithers metadata
|
|
56
|
+
*
|
|
57
|
+
* CRITICAL PATTERN: Uses fire-and-forget async IIFE in onMount
|
|
58
|
+
*/
|
|
59
|
+
export function Commit(props: CommitProps): JSX.Element {
|
|
60
|
+
const ralph = useContext(RalphContext)
|
|
61
|
+
const smithers = useSmithers()
|
|
62
|
+
const [status, setStatus] = createSignal<'pending' | 'running' | 'complete' | 'error'>('pending')
|
|
63
|
+
const [result, setResult] = createSignal<CommitResult | null>(null)
|
|
64
|
+
const [error, setError] = createSignal<Error | null>(null)
|
|
65
|
+
|
|
66
|
+
onMount(() => {
|
|
67
|
+
// Fire-and-forget async IIFE
|
|
68
|
+
(async () => {
|
|
69
|
+
ralph?.registerTask()
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
setStatus('running')
|
|
73
|
+
|
|
74
|
+
// Stage files
|
|
75
|
+
if (props.files && props.files.length > 0) {
|
|
76
|
+
// Stage specific files
|
|
77
|
+
for (const file of props.files) {
|
|
78
|
+
await Bun.$`git add ${file}`.quiet()
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
// Stage all files with -A
|
|
82
|
+
await Bun.$`git add -A`.quiet()
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Get or generate commit message
|
|
86
|
+
let message = props.message
|
|
87
|
+
|
|
88
|
+
if (!message && props.children) {
|
|
89
|
+
// Use children content as message
|
|
90
|
+
message = String(props.children)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (!message && props.autoGenerate) {
|
|
94
|
+
message = await generateCommitMessage()
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (!message) {
|
|
98
|
+
throw new Error('No commit message provided and autoGenerate is false')
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Create commit
|
|
102
|
+
const commitFlag = props.all ? '-a' : ''
|
|
103
|
+
if (commitFlag) {
|
|
104
|
+
await Bun.$`git commit -a -m ${message}`.quiet()
|
|
105
|
+
} else {
|
|
106
|
+
await Bun.$`git commit -m ${message}`.quiet()
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Get commit info
|
|
110
|
+
const commitHash = await getCommitHash('HEAD')
|
|
111
|
+
const diffStats = await getDiffStats('HEAD~1')
|
|
112
|
+
|
|
113
|
+
// Add git notes with smithers metadata
|
|
114
|
+
const notesData = {
|
|
115
|
+
smithers: true,
|
|
116
|
+
executionId: smithers.executionId,
|
|
117
|
+
timestamp: Date.now(),
|
|
118
|
+
...props.notes,
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
await addGitNotes(JSON.stringify(notesData, null, 2), 'HEAD', false)
|
|
122
|
+
|
|
123
|
+
// Log to database
|
|
124
|
+
await smithers.db.vcs.logCommit({
|
|
125
|
+
vcs_type: 'git',
|
|
126
|
+
commit_hash: commitHash,
|
|
127
|
+
message,
|
|
128
|
+
files_changed: diffStats.files,
|
|
129
|
+
insertions: diffStats.insertions,
|
|
130
|
+
deletions: diffStats.deletions,
|
|
131
|
+
smithers_metadata: notesData,
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
const commitResult: CommitResult = {
|
|
135
|
+
commitHash,
|
|
136
|
+
message,
|
|
137
|
+
filesChanged: diffStats.files,
|
|
138
|
+
insertions: diffStats.insertions,
|
|
139
|
+
deletions: diffStats.deletions,
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
setResult(commitResult)
|
|
143
|
+
setStatus('complete')
|
|
144
|
+
props.onFinished?.(commitResult)
|
|
145
|
+
|
|
146
|
+
} catch (err) {
|
|
147
|
+
const errorObj = err instanceof Error ? err : new Error(String(err))
|
|
148
|
+
setError(errorObj)
|
|
149
|
+
setStatus('error')
|
|
150
|
+
props.onError?.(errorObj)
|
|
151
|
+
} finally {
|
|
152
|
+
ralph?.completeTask()
|
|
153
|
+
}
|
|
154
|
+
})()
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<git-commit
|
|
159
|
+
status={status()}
|
|
160
|
+
commit-hash={result()?.commitHash}
|
|
161
|
+
message={result()?.message}
|
|
162
|
+
error={error()?.message}
|
|
163
|
+
>
|
|
164
|
+
{props.children}
|
|
165
|
+
</git-commit>
|
|
166
|
+
)
|
|
167
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { createSignal, onMount, useContext, type JSX } from 'solid-js'
|
|
2
|
+
import { RalphContext } from '../Ralph'
|
|
3
|
+
import { useSmithers } from '../../orchestrator/components/SmithersProvider'
|
|
4
|
+
import { addGitNotes, getGitNotes } from '../../utils/vcs'
|
|
5
|
+
|
|
6
|
+
export interface NotesProps {
|
|
7
|
+
/** Commit reference (default: HEAD) */
|
|
8
|
+
commitRef?: string
|
|
9
|
+
/** Data to store in notes */
|
|
10
|
+
data: Record<string, any>
|
|
11
|
+
/** Append to existing notes instead of replacing */
|
|
12
|
+
append?: boolean
|
|
13
|
+
/** Callback when notes are added */
|
|
14
|
+
onFinished?: (result: NotesResult) => void
|
|
15
|
+
/** Callback on error */
|
|
16
|
+
onError?: (error: Error) => void
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface NotesResult {
|
|
20
|
+
commitRef: string
|
|
21
|
+
data: Record<string, any>
|
|
22
|
+
previousNotes: string | null
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Notes component - adds/appends git notes with smithers tracking
|
|
27
|
+
*
|
|
28
|
+
* CRITICAL PATTERN: Uses fire-and-forget async IIFE in onMount
|
|
29
|
+
*/
|
|
30
|
+
export function Notes(props: NotesProps): JSX.Element {
|
|
31
|
+
const ralph = useContext(RalphContext)
|
|
32
|
+
const smithers = useSmithers()
|
|
33
|
+
const [status, setStatus] = createSignal<'pending' | 'running' | 'complete' | 'error'>('pending')
|
|
34
|
+
const [result, setResult] = createSignal<NotesResult | null>(null)
|
|
35
|
+
const [error, setError] = createSignal<Error | null>(null)
|
|
36
|
+
|
|
37
|
+
onMount(() => {
|
|
38
|
+
// Fire-and-forget async IIFE
|
|
39
|
+
(async () => {
|
|
40
|
+
ralph?.registerTask()
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
setStatus('running')
|
|
44
|
+
|
|
45
|
+
const commitRef = props.commitRef ?? 'HEAD'
|
|
46
|
+
|
|
47
|
+
// Get existing notes if appending
|
|
48
|
+
const previousNotes = props.append ? await getGitNotes(commitRef) : null
|
|
49
|
+
|
|
50
|
+
// Prepare notes content with smithers metadata
|
|
51
|
+
const notesData = {
|
|
52
|
+
smithers: true,
|
|
53
|
+
executionId: smithers.executionId,
|
|
54
|
+
timestamp: Date.now(),
|
|
55
|
+
...props.data,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const notesContent = JSON.stringify(notesData, null, 2)
|
|
59
|
+
|
|
60
|
+
// Add or append notes
|
|
61
|
+
await addGitNotes(notesContent, commitRef, props.append ?? false)
|
|
62
|
+
|
|
63
|
+
const notesResult: NotesResult = {
|
|
64
|
+
commitRef,
|
|
65
|
+
data: notesData,
|
|
66
|
+
previousNotes,
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
setResult(notesResult)
|
|
70
|
+
setStatus('complete')
|
|
71
|
+
props.onFinished?.(notesResult)
|
|
72
|
+
|
|
73
|
+
} catch (err) {
|
|
74
|
+
const errorObj = err instanceof Error ? err : new Error(String(err))
|
|
75
|
+
setError(errorObj)
|
|
76
|
+
setStatus('error')
|
|
77
|
+
props.onError?.(errorObj)
|
|
78
|
+
} finally {
|
|
79
|
+
ralph?.completeTask()
|
|
80
|
+
}
|
|
81
|
+
})()
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<git-notes
|
|
86
|
+
status={status()}
|
|
87
|
+
commit-ref={result()?.commitRef}
|
|
88
|
+
error={error()?.message}
|
|
89
|
+
/>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
1
|
+
// Git VCS components
|
|
2
|
+
export { Commit, type CommitProps, type CommitResult } from './Commit'
|
|
3
|
+
export { Notes, type NotesProps, type NotesResult } from './Notes'
|