agentweaver 0.1.2 → 0.1.3

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 +11 -10
  2. package/dist/artifacts.js +24 -2
  3. package/dist/executors/claude-executor.js +12 -2
  4. package/dist/executors/claude-summary-executor.js +1 -1
  5. package/dist/executors/codex-docker-executor.js +1 -1
  6. package/dist/executors/codex-local-executor.js +1 -1
  7. package/dist/executors/configs/claude-config.js +2 -1
  8. package/dist/index.js +388 -451
  9. package/dist/interactive-ui.js +451 -194
  10. package/dist/jira.js +3 -1
  11. package/dist/pipeline/auto-flow.js +9 -0
  12. package/dist/pipeline/context.js +2 -0
  13. package/dist/pipeline/declarative-flow-runner.js +246 -0
  14. package/dist/pipeline/declarative-flows.js +24 -0
  15. package/dist/pipeline/flow-specs/auto.json +471 -0
  16. package/dist/pipeline/flow-specs/implement.json +47 -0
  17. package/dist/pipeline/flow-specs/plan.json +88 -0
  18. package/dist/pipeline/flow-specs/preflight.json +174 -0
  19. package/dist/pipeline/flow-specs/review-fix.json +76 -0
  20. package/dist/pipeline/flow-specs/review.json +233 -0
  21. package/dist/pipeline/flow-specs/test-fix.json +24 -0
  22. package/dist/pipeline/flow-specs/test-linter-fix.json +24 -0
  23. package/dist/pipeline/flow-specs/test.json +19 -0
  24. package/dist/pipeline/flows/implement-flow.js +3 -4
  25. package/dist/pipeline/flows/preflight-flow.js +17 -57
  26. package/dist/pipeline/flows/review-fix-flow.js +3 -4
  27. package/dist/pipeline/flows/review-flow.js +8 -4
  28. package/dist/pipeline/flows/test-fix-flow.js +3 -4
  29. package/dist/pipeline/node-registry.js +71 -0
  30. package/dist/pipeline/node-runner.js +9 -3
  31. package/dist/pipeline/nodes/build-failure-summary-node.js +4 -4
  32. package/dist/pipeline/nodes/claude-prompt-node.js +54 -0
  33. package/dist/pipeline/nodes/claude-summary-node.js +12 -6
  34. package/dist/pipeline/nodes/codex-docker-prompt-node.js +1 -0
  35. package/dist/pipeline/nodes/codex-local-prompt-node.js +32 -0
  36. package/dist/pipeline/nodes/file-check-node.js +15 -0
  37. package/dist/pipeline/nodes/summary-file-load-node.js +16 -0
  38. package/dist/pipeline/nodes/task-summary-node.js +12 -6
  39. package/dist/pipeline/prompt-registry.js +22 -0
  40. package/dist/pipeline/prompt-runtime.js +18 -0
  41. package/dist/pipeline/registry.js +0 -2
  42. package/dist/pipeline/spec-compiler.js +200 -0
  43. package/dist/pipeline/spec-loader.js +14 -0
  44. package/dist/pipeline/spec-types.js +1 -0
  45. package/dist/pipeline/spec-validator.js +290 -0
  46. package/dist/pipeline/value-resolver.js +199 -0
  47. package/dist/prompts.js +1 -3
  48. package/dist/runtime/process-runner.js +24 -23
  49. package/dist/tui.js +39 -0
  50. package/package.json +2 -2
package/README.md CHANGED
@@ -18,19 +18,22 @@ The package is designed to run as an npm CLI and includes an interactive termina
18
18
 
19
19
  ## Architecture
20
20
 
21
- The CLI now uses an executor-based architecture.
21
+ The CLI now uses an executor + node + declarative flow architecture.
22
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
23
+ - `src/index.ts` remains the CLI entrypoint and high-level orchestration layer
24
+ - `src/executors/` contains first-class executors for external actions such as Jira fetch, local Codex, Docker-based build verification, Claude, Claude summaries, and process execution
25
+ - `src/pipeline/nodes/` contains reusable runtime nodes built on top of executors
26
+ - `src/pipeline/flow-specs/` contains declarative JSON flow specs for `preflight`, `plan`, `implement`, `review`, `review-fix`, `test`, `test-fix`, `test-linter-fix`, and `auto`
26
27
  - `src/runtime/` contains shared runtime services such as command resolution, Docker runtime environment setup, and subprocess execution
27
28
 
28
- This keeps command handlers focused on workflow composition instead of inline subprocess wiring.
29
+ This keeps command handlers focused on choosing a flow and providing parameters instead of assembling prompts and subprocess wiring inline.
29
30
 
30
31
  ## Repository Layout
31
32
 
32
33
  - `src/` — main TypeScript sources
33
34
  - `src/index.ts` — CLI entrypoint and workflow orchestration
35
+ - `src/pipeline/flow-specs/` — declarative JSON specs for workflow stages
36
+ - `src/pipeline/nodes/` — reusable pipeline nodes executed by the declarative runner
34
37
  - `src/interactive-ui.ts` — interactive TUI built with `neo-blessed`
35
38
  - `src/markdown.ts` — markdown-to-terminal renderer for the TUI
36
39
  - `src/executors/` — executor modules for concrete execution families
@@ -84,9 +87,8 @@ Common optional variables:
84
87
  - `DOCKER_COMPOSE_BIN` — override compose command, for example `docker compose`
85
88
  - `CODEX_BIN` — override `codex` executable path
86
89
  - `CLAUDE_BIN` — override `claude` executable path
87
- - `CODEX_MODEL` — defaults to `gpt-5.4`
88
- - `CLAUDE_REVIEW_MODEL` — defaults to `opus`
89
- - `CLAUDE_SUMMARY_MODEL` — defaults to `haiku`
90
+ - `CODEX_MODEL` — fallback model for Codex executors when the flow spec does not set `params.model`
91
+ - `CLAUDE_MODEL` — fallback Claude model when the flow spec does not set `params.model`
90
92
 
91
93
  Example `.env`:
92
94
 
@@ -97,8 +99,7 @@ AGENTWEAVER_HOME=/absolute/path/to/AgentWeaver
97
99
  CODEX_BIN=codex
98
100
  CLAUDE_BIN=claude
99
101
  CODEX_MODEL=gpt-5.4
100
- CLAUDE_REVIEW_MODEL=opus
101
- CLAUDE_SUMMARY_MODEL=haiku
102
+ CLAUDE_MODEL=opus
102
103
  GOPRIVATE=gitlab.example.org/*
103
104
  GONOSUMDB=gitlab.example.org/*
104
105
  GONOPROXY=gitlab.example.org/*
package/dist/artifacts.js CHANGED
@@ -1,10 +1,23 @@
1
- import { existsSync } from "node:fs";
1
+ import { existsSync, mkdirSync } from "node:fs";
2
+ import path from "node:path";
3
+ import process from "node:process";
2
4
  import { TaskRunnerError } from "./errors.js";
3
5
  export const REVIEW_FILE_RE = /^review-(.+)-(\d+)\.md$/;
4
6
  export const REVIEW_REPLY_FILE_RE = /^review-reply-(.+)-(\d+)\.md$/;
5
7
  export const READY_TO_MERGE_FILE = "ready-to-merge.md";
8
+ export function taskWorkspaceDir(taskKey) {
9
+ return path.join(process.cwd(), `.agentweaver-${taskKey}`);
10
+ }
11
+ export function ensureTaskWorkspaceDir(taskKey) {
12
+ const workspaceDir = taskWorkspaceDir(taskKey);
13
+ mkdirSync(workspaceDir, { recursive: true });
14
+ return workspaceDir;
15
+ }
16
+ export function taskWorkspaceFile(taskKey, fileName) {
17
+ return path.join(taskWorkspaceDir(taskKey), fileName);
18
+ }
6
19
  export function artifactFile(prefix, taskKey, iteration) {
7
- return `${prefix}-${taskKey}-${iteration}.md`;
20
+ return taskWorkspaceFile(taskKey, `${prefix}-${taskKey}-${iteration}.md`);
8
21
  }
9
22
  export function designFile(taskKey) {
10
23
  return artifactFile("design", taskKey, 1);
@@ -18,6 +31,15 @@ export function qaFile(taskKey) {
18
31
  export function taskSummaryFile(taskKey) {
19
32
  return artifactFile("task", taskKey, 1);
20
33
  }
34
+ export function readyToMergeFile(taskKey) {
35
+ return taskWorkspaceFile(taskKey, READY_TO_MERGE_FILE);
36
+ }
37
+ export function jiraTaskFile(taskKey) {
38
+ return taskWorkspaceFile(taskKey, `${taskKey}.json`);
39
+ }
40
+ export function autoStateFile(taskKey) {
41
+ return taskWorkspaceFile(taskKey, `.agentweaver-state-${taskKey}.json`);
42
+ }
21
43
  export function planArtifacts(taskKey) {
22
44
  return [designFile(taskKey), planFile(taskKey), qaFile(taskKey)];
23
45
  }
@@ -1,7 +1,17 @@
1
1
  import { claudeExecutorDefaultConfig } from "./configs/claude-config.js";
2
2
  import { processExecutor } from "./process-executor.js";
3
3
  function resolveModel(config, env) {
4
- return env[config.modelEnvVar]?.trim() || config.defaultModel;
4
+ const primaryModel = env[config.modelEnvVar]?.trim();
5
+ if (primaryModel) {
6
+ return primaryModel;
7
+ }
8
+ for (const envVarName of config.legacyModelEnvVars ?? []) {
9
+ const legacyModel = env[envVarName]?.trim();
10
+ if (legacyModel) {
11
+ return legacyModel;
12
+ }
13
+ }
14
+ return config.defaultModel;
5
15
  }
6
16
  export const claudeExecutor = {
7
17
  kind: "claude",
@@ -10,7 +20,7 @@ export const claudeExecutor = {
10
20
  async execute(context, input, config) {
11
21
  const env = input.env ?? context.env;
12
22
  const command = input.command ?? context.runtime.resolveCmd(config.defaultCommand, config.commandEnvVar);
13
- const model = resolveModel(config, env);
23
+ const model = input.model?.trim() || resolveModel(config, env);
14
24
  const argv = [command, "--model", model, config.promptFlag, `--allowedTools=${config.allowedTools}`];
15
25
  if (config.outputFormat) {
16
26
  argv.push("--output-format", config.outputFormat);
@@ -12,7 +12,7 @@ export const claudeSummaryExecutor = {
12
12
  async execute(context, input, config) {
13
13
  const env = input.env ?? context.env;
14
14
  const command = input.command ?? context.runtime.resolveCmd(config.defaultCommand, config.commandEnvVar);
15
- const model = resolveModel(config, env);
15
+ const model = input.model?.trim() || resolveModel(config, env);
16
16
  const argv = [command, "--model", model, config.promptFlag, `--allowedTools=${config.allowedTools}`, input.prompt];
17
17
  const processInput = {
18
18
  argv,
@@ -10,7 +10,7 @@ export const codexDockerExecutor = {
10
10
  async execute(context, input, config) {
11
11
  const composeCommand = context.runtime.resolveDockerComposeCmd();
12
12
  const env = context.runtime.dockerRuntimeEnv();
13
- const model = resolveModel(config, env);
13
+ const model = input.model?.trim() || resolveModel(config, env);
14
14
  env[config.promptEnvVar] = input.prompt;
15
15
  env[config.flagsEnvVar] = config.execFlagsTemplate.replace("{model}", model);
16
16
  const result = await processExecutor.execute(context, {
@@ -10,7 +10,7 @@ export const codexLocalExecutor = {
10
10
  async execute(context, input, config) {
11
11
  const env = input.env ?? context.env;
12
12
  const command = input.command ?? context.runtime.resolveCmd(config.defaultCommand, config.commandEnvVar);
13
- const model = resolveModel(config, env);
13
+ const model = input.model?.trim() || resolveModel(config, env);
14
14
  const result = await processExecutor.execute(context, {
15
15
  argv: [command, config.subcommand, "--model", model, config.fullAutoFlag, input.prompt],
16
16
  env,
@@ -1,7 +1,8 @@
1
1
  export const claudeExecutorDefaultConfig = {
2
2
  commandEnvVar: "CLAUDE_BIN",
3
3
  defaultCommand: "claude",
4
- modelEnvVar: "CLAUDE_REVIEW_MODEL",
4
+ modelEnvVar: "CLAUDE_MODEL",
5
+ legacyModelEnvVars: ["CLAUDE_REVIEW_MODEL"],
5
6
  defaultModel: "opus",
6
7
  promptFlag: "-p",
7
8
  allowedTools: "Read,Write,Edit",