agentweaver 0.1.0 → 0.1.2

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.
Files changed (50) hide show
  1. package/README.md +24 -0
  2. package/dist/executors/claude-executor.js +36 -0
  3. package/dist/executors/claude-summary-executor.js +31 -0
  4. package/dist/executors/codex-docker-executor.js +27 -0
  5. package/dist/executors/codex-local-executor.js +25 -0
  6. package/dist/executors/command-check-executor.js +14 -0
  7. package/dist/executors/configs/claude-config.js +11 -0
  8. package/dist/executors/configs/claude-summary-config.js +8 -0
  9. package/dist/executors/configs/codex-docker-config.js +10 -0
  10. package/dist/executors/configs/codex-local-config.js +8 -0
  11. package/dist/executors/configs/jira-fetch-config.js +4 -0
  12. package/dist/executors/configs/process-config.js +3 -0
  13. package/dist/executors/configs/verify-build-config.js +7 -0
  14. package/dist/executors/jira-fetch-executor.js +11 -0
  15. package/dist/executors/process-executor.js +21 -0
  16. package/dist/executors/types.js +1 -0
  17. package/dist/executors/verify-build-executor.js +22 -0
  18. package/dist/index.js +270 -450
  19. package/dist/interactive-ui.js +109 -12
  20. package/dist/pipeline/build-failure-summary.js +6 -0
  21. package/dist/pipeline/checks.js +15 -0
  22. package/dist/pipeline/context.js +17 -0
  23. package/dist/pipeline/flow-runner.js +13 -0
  24. package/dist/pipeline/flow-types.js +1 -0
  25. package/dist/pipeline/flows/implement-flow.js +48 -0
  26. package/dist/pipeline/flows/plan-flow.js +42 -0
  27. package/dist/pipeline/flows/preflight-flow.js +59 -0
  28. package/dist/pipeline/flows/review-fix-flow.js +63 -0
  29. package/dist/pipeline/flows/review-flow.js +120 -0
  30. package/dist/pipeline/flows/test-fix-flow.js +13 -0
  31. package/dist/pipeline/flows/test-flow.js +32 -0
  32. package/dist/pipeline/node-runner.js +14 -0
  33. package/dist/pipeline/nodes/build-failure-summary-node.js +71 -0
  34. package/dist/pipeline/nodes/claude-summary-node.js +32 -0
  35. package/dist/pipeline/nodes/codex-docker-prompt-node.js +31 -0
  36. package/dist/pipeline/nodes/command-check-node.js +10 -0
  37. package/dist/pipeline/nodes/implement-codex-node.js +16 -0
  38. package/dist/pipeline/nodes/jira-fetch-node.js +25 -0
  39. package/dist/pipeline/nodes/plan-codex-node.js +32 -0
  40. package/dist/pipeline/nodes/review-claude-node.js +38 -0
  41. package/dist/pipeline/nodes/review-reply-codex-node.js +40 -0
  42. package/dist/pipeline/nodes/task-summary-node.js +36 -0
  43. package/dist/pipeline/nodes/verify-build-node.js +14 -0
  44. package/dist/pipeline/registry.js +25 -0
  45. package/dist/pipeline/types.js +10 -0
  46. package/dist/runtime/command-resolution.js +139 -0
  47. package/dist/runtime/docker-runtime.js +51 -0
  48. package/dist/runtime/process-runner.js +111 -0
  49. package/dist/tui.js +34 -0
  50. package/package.json +2 -1
package/README.md CHANGED
@@ -16,12 +16,26 @@ The package is designed to run as an npm CLI and includes an interactive termina
16
16
  - Persists `auto` pipeline state on disk so runs can resume
17
17
  - Uses Docker runtime services for isolated Codex execution and build verification
18
18
 
19
+ ## Architecture
20
+
21
+ The CLI now uses an executor-based architecture.
22
+
23
+ - `src/index.ts` remains the orchestration layer for CLI commands and `auto` state transitions
24
+ - `src/executors/` contains first-class executors for external actions such as Jira fetch, local Codex, Docker Codex, Claude, Claude summaries, process execution, and build verification
25
+ - `src/executors/configs/` contains data-only default configs for executors with JSON-compatible structure
26
+ - `src/runtime/` contains shared runtime services such as command resolution, Docker runtime environment setup, and subprocess execution
27
+
28
+ This keeps command handlers focused on workflow composition instead of inline subprocess wiring.
29
+
19
30
  ## Repository Layout
20
31
 
21
32
  - `src/` — main TypeScript sources
22
33
  - `src/index.ts` — CLI entrypoint and workflow orchestration
23
34
  - `src/interactive-ui.ts` — interactive TUI built with `neo-blessed`
24
35
  - `src/markdown.ts` — markdown-to-terminal renderer for the TUI
36
+ - `src/executors/` — executor modules for concrete execution families
37
+ - `src/executors/configs/` — default executor configs kept as plain data
38
+ - `src/runtime/` — shared runtime services used by executors
25
39
  - `docker-compose.yml` — runtime services for Codex and build verification
26
40
  - `Dockerfile.codex` — container image for Codex runtime
27
41
  - `verify_build.sh` — project-specific verification entrypoint used by `verify-build`
@@ -217,6 +231,16 @@ Run from source in dev mode:
217
231
  npm run dev -- --help
218
232
  ```
219
233
 
234
+ Representative smoke checks during development:
235
+
236
+ ```bash
237
+ node dist/index.js --help
238
+ node dist/index.js auto --help-phases
239
+ node dist/index.js plan --dry DEMO-123
240
+ node dist/index.js implement --dry DEMO-123
241
+ node dist/index.js review --dry DEMO-123
242
+ ```
243
+
220
244
  ## Publishing
221
245
 
222
246
  The package is prepared for npm publication and currently includes:
@@ -0,0 +1,36 @@
1
+ import { claudeExecutorDefaultConfig } from "./configs/claude-config.js";
2
+ import { processExecutor } from "./process-executor.js";
3
+ function resolveModel(config, env) {
4
+ return env[config.modelEnvVar]?.trim() || config.defaultModel;
5
+ }
6
+ export const claudeExecutor = {
7
+ kind: "claude",
8
+ version: 1,
9
+ defaultConfig: claudeExecutorDefaultConfig,
10
+ async execute(context, input, config) {
11
+ const env = input.env ?? context.env;
12
+ const command = input.command ?? context.runtime.resolveCmd(config.defaultCommand, config.commandEnvVar);
13
+ const model = resolveModel(config, env);
14
+ const argv = [command, "--model", model, config.promptFlag, `--allowedTools=${config.allowedTools}`];
15
+ if (config.outputFormat) {
16
+ argv.push("--output-format", config.outputFormat);
17
+ }
18
+ if (config.verboseMode) {
19
+ argv.push("--verbose");
20
+ }
21
+ if (config.includePartialMessages) {
22
+ argv.push("--include-partial-messages");
23
+ }
24
+ argv.push(input.prompt);
25
+ const result = await processExecutor.execute(context, {
26
+ argv,
27
+ env,
28
+ label: `claude:${model}`,
29
+ }, processExecutor.defaultConfig);
30
+ return {
31
+ output: result.output,
32
+ command,
33
+ model,
34
+ };
35
+ },
36
+ };
@@ -0,0 +1,31 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { requireArtifacts } from "../artifacts.js";
3
+ import { claudeSummaryExecutorDefaultConfig } from "./configs/claude-summary-config.js";
4
+ import { processExecutor } from "./process-executor.js";
5
+ function resolveModel(config, env) {
6
+ return env[config.modelEnvVar]?.trim() || config.defaultModel;
7
+ }
8
+ export const claudeSummaryExecutor = {
9
+ kind: "claude-summary",
10
+ version: 1,
11
+ defaultConfig: claudeSummaryExecutorDefaultConfig,
12
+ async execute(context, input, config) {
13
+ const env = input.env ?? context.env;
14
+ const command = input.command ?? context.runtime.resolveCmd(config.defaultCommand, config.commandEnvVar);
15
+ const model = resolveModel(config, env);
16
+ const argv = [command, "--model", model, config.promptFlag, `--allowedTools=${config.allowedTools}`, input.prompt];
17
+ const processInput = {
18
+ argv,
19
+ env,
20
+ label: `claude:${model}`,
21
+ };
22
+ const result = await processExecutor.execute(context, input.verbose === undefined ? processInput : { ...processInput, verbose: input.verbose }, processExecutor.defaultConfig);
23
+ requireArtifacts([input.outputFile], `Claude summary did not produce ${input.outputFile}.`);
24
+ return {
25
+ output: result.output,
26
+ artifactText: readFileSync(input.outputFile, "utf8").trim(),
27
+ command,
28
+ model,
29
+ };
30
+ },
31
+ };
@@ -0,0 +1,27 @@
1
+ import { codexDockerExecutorDefaultConfig } from "./configs/codex-docker-config.js";
2
+ import { processExecutor } from "./process-executor.js";
3
+ function resolveModel(config, env) {
4
+ return env[config.modelEnvVar]?.trim() || config.defaultModel;
5
+ }
6
+ export const codexDockerExecutor = {
7
+ kind: "codex-docker",
8
+ version: 1,
9
+ defaultConfig: codexDockerExecutorDefaultConfig,
10
+ async execute(context, input, config) {
11
+ const composeCommand = context.runtime.resolveDockerComposeCmd();
12
+ const env = context.runtime.dockerRuntimeEnv();
13
+ const model = resolveModel(config, env);
14
+ env[config.promptEnvVar] = input.prompt;
15
+ env[config.flagsEnvVar] = config.execFlagsTemplate.replace("{model}", model);
16
+ const result = await processExecutor.execute(context, {
17
+ argv: [...composeCommand, config.composeFileFlag, input.dockerComposeFile, ...config.runArgs, config.service],
18
+ env,
19
+ label: `codex:${model}`,
20
+ }, processExecutor.defaultConfig);
21
+ return {
22
+ output: result.output,
23
+ composeCommand,
24
+ model,
25
+ };
26
+ },
27
+ };
@@ -0,0 +1,25 @@
1
+ import { codexLocalExecutorDefaultConfig } from "./configs/codex-local-config.js";
2
+ import { processExecutor } from "./process-executor.js";
3
+ function resolveModel(config, env) {
4
+ return env[config.modelEnvVar]?.trim() || config.defaultModel;
5
+ }
6
+ export const codexLocalExecutor = {
7
+ kind: "codex-local",
8
+ version: 1,
9
+ defaultConfig: codexLocalExecutorDefaultConfig,
10
+ async execute(context, input, config) {
11
+ const env = input.env ?? context.env;
12
+ const command = input.command ?? context.runtime.resolveCmd(config.defaultCommand, config.commandEnvVar);
13
+ const model = resolveModel(config, env);
14
+ const result = await processExecutor.execute(context, {
15
+ argv: [command, config.subcommand, "--model", model, config.fullAutoFlag, input.prompt],
16
+ env,
17
+ label: `codex:${model}`,
18
+ }, processExecutor.defaultConfig);
19
+ return {
20
+ output: result.output,
21
+ command,
22
+ model,
23
+ };
24
+ },
25
+ };
@@ -0,0 +1,14 @@
1
+ export const commandCheckExecutor = {
2
+ kind: "command-check",
3
+ version: 1,
4
+ defaultConfig: {},
5
+ async execute(context, input) {
6
+ return {
7
+ resolved: input.commands.map((candidate) => ({
8
+ commandName: candidate.commandName,
9
+ envVarName: candidate.envVarName,
10
+ path: context.runtime.resolveCmd(candidate.commandName, candidate.envVarName),
11
+ })),
12
+ };
13
+ },
14
+ };
@@ -0,0 +1,11 @@
1
+ export const claudeExecutorDefaultConfig = {
2
+ commandEnvVar: "CLAUDE_BIN",
3
+ defaultCommand: "claude",
4
+ modelEnvVar: "CLAUDE_REVIEW_MODEL",
5
+ defaultModel: "opus",
6
+ promptFlag: "-p",
7
+ allowedTools: "Read,Write,Edit",
8
+ outputFormat: "stream-json",
9
+ includePartialMessages: true,
10
+ verboseMode: true,
11
+ };
@@ -0,0 +1,8 @@
1
+ export const claudeSummaryExecutorDefaultConfig = {
2
+ commandEnvVar: "CLAUDE_BIN",
3
+ defaultCommand: "claude",
4
+ modelEnvVar: "CLAUDE_SUMMARY_MODEL",
5
+ defaultModel: "haiku",
6
+ promptFlag: "-p",
7
+ allowedTools: "Read,Write,Edit",
8
+ };
@@ -0,0 +1,10 @@
1
+ export const codexDockerExecutorDefaultConfig = {
2
+ service: "codex-exec",
3
+ composeFileFlag: "-f",
4
+ runArgs: ["run", "--rm"],
5
+ modelEnvVar: "CODEX_MODEL",
6
+ defaultModel: "gpt-5.4",
7
+ promptEnvVar: "CODEX_PROMPT",
8
+ flagsEnvVar: "CODEX_EXEC_FLAGS",
9
+ execFlagsTemplate: "--model {model} --dangerously-bypass-approvals-and-sandbox",
10
+ };
@@ -0,0 +1,8 @@
1
+ export const codexLocalExecutorDefaultConfig = {
2
+ commandEnvVar: "CODEX_BIN",
3
+ defaultCommand: "codex",
4
+ modelEnvVar: "CODEX_MODEL",
5
+ defaultModel: "gpt-5.4",
6
+ subcommand: "exec",
7
+ fullAutoFlag: "--full-auto",
8
+ };
@@ -0,0 +1,4 @@
1
+ export const jiraFetchExecutorDefaultConfig = {
2
+ authEnvVar: "JIRA_API_KEY",
3
+ acceptHeader: "application/json",
4
+ };
@@ -0,0 +1,3 @@
1
+ export const processExecutorDefaultConfig = {
2
+ printFailureOutput: true,
3
+ };
@@ -0,0 +1,7 @@
1
+ export const verifyBuildExecutorDefaultConfig = {
2
+ service: "verify-build",
3
+ composeFileFlag: "-f",
4
+ runArgs: ["run", "--rm"],
5
+ printFailureOutput: false,
6
+ verbose: false,
7
+ };
@@ -0,0 +1,11 @@
1
+ import { jiraFetchExecutorDefaultConfig } from "./configs/jira-fetch-config.js";
2
+ import { fetchJiraIssue } from "../jira.js";
3
+ export const jiraFetchExecutor = {
4
+ kind: "jira-fetch",
5
+ version: 1,
6
+ defaultConfig: jiraFetchExecutorDefaultConfig,
7
+ async execute(_context, input) {
8
+ await fetchJiraIssue(input.jiraApiUrl, input.outputFile);
9
+ return { outputFile: input.outputFile };
10
+ },
11
+ };
@@ -0,0 +1,21 @@
1
+ import { processExecutorDefaultConfig } from "./configs/process-config.js";
2
+ export const processExecutor = {
3
+ kind: "process",
4
+ version: 1,
5
+ defaultConfig: processExecutorDefaultConfig,
6
+ async execute(context, input, config) {
7
+ const options = {
8
+ dryRun: input.dryRun ?? context.dryRun,
9
+ verbose: input.verbose ?? context.verbose,
10
+ printFailureOutput: config.printFailureOutput,
11
+ };
12
+ if (input.env) {
13
+ options.env = input.env;
14
+ }
15
+ if (input.label) {
16
+ options.label = input.label;
17
+ }
18
+ const output = await context.runtime.runCommand(input.argv, options);
19
+ return { output };
20
+ },
21
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,22 @@
1
+ import { verifyBuildExecutorDefaultConfig } from "./configs/verify-build-config.js";
2
+ import { processExecutor } from "./process-executor.js";
3
+ export const verifyBuildExecutor = {
4
+ kind: "verify-build",
5
+ version: 1,
6
+ defaultConfig: verifyBuildExecutorDefaultConfig,
7
+ async execute(context, input, config) {
8
+ const composeCommand = context.runtime.resolveDockerComposeCmd();
9
+ const result = await processExecutor.execute(context, {
10
+ argv: [...composeCommand, config.composeFileFlag, input.dockerComposeFile, ...config.runArgs, config.service],
11
+ env: context.runtime.dockerRuntimeEnv(),
12
+ verbose: config.verbose,
13
+ label: config.service,
14
+ }, {
15
+ printFailureOutput: config.printFailureOutput,
16
+ });
17
+ return {
18
+ output: result.output,
19
+ composeCommand,
20
+ };
21
+ },
22
+ };