aiwcli 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/clear.d.ts +8 -0
- package/dist/commands/clear.js +86 -0
- package/dist/lib/bmad-installer.d.ts +2 -27
- package/dist/lib/bmad-installer.js +3 -43
- package/dist/lib/claude-settings-types.d.ts +2 -1
- package/dist/lib/env-compat.d.ts +0 -8
- package/dist/lib/env-compat.js +0 -12
- package/dist/lib/git/index.d.ts +0 -1
- package/dist/lib/gitignore-manager.d.ts +0 -2
- package/dist/lib/gitignore-manager.js +1 -1
- package/dist/lib/hooks-merger.d.ts +1 -15
- package/dist/lib/hooks-merger.js +1 -1
- package/dist/lib/index.d.ts +3 -7
- package/dist/lib/index.js +3 -11
- package/dist/lib/output.d.ts +2 -1
- package/dist/lib/settings-hierarchy.d.ts +1 -13
- package/dist/lib/settings-hierarchy.js +1 -1
- package/dist/lib/template-installer.d.ts +5 -9
- package/dist/lib/template-installer.js +2 -12
- package/dist/lib/template-linter.d.ts +3 -10
- package/dist/lib/template-linter.js +2 -2
- package/dist/lib/template-resolver.d.ts +6 -0
- package/dist/lib/template-resolver.js +10 -0
- package/dist/lib/template-settings-reconstructor.d.ts +1 -1
- package/dist/lib/template-settings-reconstructor.js +17 -24
- package/dist/lib/terminal.d.ts +3 -14
- package/dist/lib/terminal.js +0 -4
- package/dist/lib/version.d.ts +2 -11
- package/dist/lib/version.js +2 -2
- package/dist/lib/windsurf-hooks-merger.d.ts +1 -15
- package/dist/lib/windsurf-hooks-merger.js +1 -1
- package/dist/templates/_shared/.codex/workflows/handoff.md +1 -1
- package/dist/templates/_shared/.windsurf/workflows/handoff.md +1 -1
- package/dist/templates/_shared/hooks-ts/session_end.ts +4 -1
- package/dist/templates/_shared/hooks-ts/session_start.ts +15 -20
- package/dist/templates/_shared/hooks-ts/user_prompt_submit.ts +12 -14
- package/dist/templates/_shared/lib-ts/CLAUDE.md +56 -7
- package/dist/templates/_shared/lib-ts/base/git-state.ts +1 -1
- package/dist/templates/_shared/lib-ts/base/hook-utils.ts +174 -43
- package/dist/templates/_shared/lib-ts/base/logger.ts +15 -18
- package/dist/templates/_shared/lib-ts/base/state-io.ts +11 -2
- package/dist/templates/_shared/lib-ts/base/subprocess-utils.ts +181 -162
- package/dist/templates/_shared/lib-ts/context/plan-manager.ts +26 -30
- package/dist/templates/_shared/lib-ts/handoff/handoff-reader.ts +12 -13
- package/dist/templates/_shared/lib-ts/package.json +1 -2
- package/dist/templates/_shared/lib-ts/templates/plan-context.ts +27 -34
- package/dist/templates/_shared/lib-ts/types.ts +17 -2
- package/dist/templates/_shared/scripts/resume_handoff.ts +62 -38
- package/dist/templates/_shared/scripts/save_handoff.ts +24 -24
- package/dist/templates/_shared/scripts/status_line.ts +102 -148
- package/dist/templates/_shared/workflows/handoff.md +1 -1
- package/dist/templates/cc-native/.claude/settings.json +183 -175
- package/dist/templates/cc-native/_cc-native/agents/CLAUDE.md +23 -1
- package/dist/templates/cc-native/_cc-native/agents/plan-questions/PLAN-QUESTIONER.md +70 -0
- package/dist/templates/cc-native/_cc-native/hooks/CLAUDE.md +6 -1
- package/dist/templates/cc-native/_cc-native/hooks/cc-native-plan-review.ts +316 -176
- package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_subagent.ts +38 -0
- package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_write.ts +51 -0
- package/dist/templates/cc-native/_cc-native/hooks/mark_questions_asked.ts +53 -0
- package/dist/templates/cc-native/_cc-native/hooks/plan_questions_early.ts +15 -15
- package/dist/templates/cc-native/_cc-native/lib-ts/aggregate-agents.ts +11 -12
- package/dist/templates/cc-native/_cc-native/lib-ts/artifacts.ts +227 -114
- package/dist/templates/cc-native/_cc-native/lib-ts/cc-native-state.ts +64 -16
- package/dist/templates/cc-native/_cc-native/lib-ts/cli-output-parser.ts +23 -3
- package/dist/templates/cc-native/_cc-native/lib-ts/corroboration.ts +119 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/index.ts +1 -4
- package/dist/templates/cc-native/_cc-native/lib-ts/json-parser.ts +7 -1
- package/dist/templates/cc-native/_cc-native/lib-ts/orchestrator.ts +40 -218
- package/dist/templates/cc-native/_cc-native/lib-ts/plan-enhancement.ts +41 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/plan-questions.ts +101 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/agent.ts +27 -111
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/base/base-agent.ts +217 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/index.ts +5 -3
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/claude-agent.ts +65 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/codex-agent.ts +184 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/gemini-agent.ts +39 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/providers/orchestrator-claude-agent.ts +195 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/schemas.ts +201 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/types.ts +3 -5
- package/dist/templates/cc-native/_cc-native/lib-ts/state.ts +30 -33
- package/dist/templates/cc-native/_cc-native/lib-ts/types.ts +104 -132
- package/dist/templates/cc-native/_cc-native/plan-review.config.json +22 -13
- package/oclif.manifest.json +1 -1
- package/package.json +2 -3
- package/dist/templates/cc-native/_cc-native/hooks/add_plan_context.ts +0 -119
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/codex.ts +0 -130
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/gemini.ts +0 -106
- /package/dist/templates/cc-native/_cc-native/agents/{ARCH-EVOLUTION.md → plan-review/ARCH-EVOLUTION.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{ARCH-PATTERNS.md → plan-review/ARCH-PATTERNS.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{ARCH-STRUCTURE.md → plan-review/ARCH-STRUCTURE.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{ASSUMPTION-TRACER.md → plan-review/ASSUMPTION-TRACER.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{CLARITY-AUDITOR.md → plan-review/CLARITY-AUDITOR.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{COMPLETENESS-FEASIBILITY.md → plan-review/COMPLETENESS-FEASIBILITY.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{COMPLETENESS-GAPS.md → plan-review/COMPLETENESS-GAPS.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{COMPLETENESS-ORDERING.md → plan-review/COMPLETENESS-ORDERING.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{CONSTRAINT-VALIDATOR.md → plan-review/CONSTRAINT-VALIDATOR.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{DESIGN-ADR-VALIDATOR.md → plan-review/DESIGN-ADR-VALIDATOR.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{DESIGN-SCALE-MATCHER.md → plan-review/DESIGN-SCALE-MATCHER.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{DEVILS-ADVOCATE.md → plan-review/DEVILS-ADVOCATE.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{DOCUMENTATION-PHILOSOPHY.md → plan-review/DOCUMENTATION-PHILOSOPHY.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{HANDOFF-READINESS.md → plan-review/HANDOFF-READINESS.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{HIDDEN-COMPLEXITY.md → plan-review/HIDDEN-COMPLEXITY.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{INCREMENTAL-DELIVERY.md → plan-review/INCREMENTAL-DELIVERY.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{RISK-DEPENDENCY.md → plan-review/RISK-DEPENDENCY.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{RISK-FMEA.md → plan-review/RISK-FMEA.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{RISK-PREMORTEM.md → plan-review/RISK-PREMORTEM.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{RISK-REVERSIBILITY.md → plan-review/RISK-REVERSIBILITY.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{SCOPE-BOUNDARY.md → plan-review/SCOPE-BOUNDARY.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{SIMPLICITY-GUARDIAN.md → plan-review/SIMPLICITY-GUARDIAN.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{SKEPTIC.md → plan-review/SKEPTIC.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{TESTDRIVEN-BEHAVIOR-AUDITOR.md → plan-review/TESTDRIVEN-BEHAVIOR-AUDITOR.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{TESTDRIVEN-CHARACTERIZATION.md → plan-review/TESTDRIVEN-CHARACTERIZATION.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{TESTDRIVEN-FIRST-VALIDATOR.md → plan-review/TESTDRIVEN-FIRST-VALIDATOR.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{TESTDRIVEN-PYRAMID-ANALYZER.md → plan-review/TESTDRIVEN-PYRAMID-ANALYZER.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{TRADEOFF-COSTS.md → plan-review/TRADEOFF-COSTS.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{TRADEOFF-STAKEHOLDERS.md → plan-review/TRADEOFF-STAKEHOLDERS.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{VERIFY-COVERAGE.md → plan-review/VERIFY-COVERAGE.md} +0 -0
- /package/dist/templates/cc-native/_cc-native/agents/{VERIFY-STRENGTH.md → plan-review/VERIFY-STRENGTH.md} +0 -0
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as fs from "node:fs";
|
|
8
|
-
import * as path from "node:path";
|
|
9
|
-
|
|
10
|
-
import { validatePlanPath } from "./constants.js";
|
|
11
|
-
import type { IterationEntry, IterationState } from "./types.js";
|
|
8
|
+
import * as path from "node:path";
|
|
12
9
|
import { atomicWrite } from "../../_shared/lib-ts/base/atomic-write.js";
|
|
13
|
-
import {
|
|
10
|
+
import { logInfo, logWarn, logError } from "../../_shared/lib-ts/base/logger.js";
|
|
14
11
|
import { nowIso } from "../../_shared/lib-ts/base/utils.js";
|
|
12
|
+
import { validatePlanPath } from "./constants.js";
|
|
13
|
+
import type { IterationState, IterationEntry } from "./types.js";
|
|
15
14
|
|
|
16
15
|
// ---------------------------------------------------------------------------
|
|
17
16
|
// Constants
|
|
@@ -19,10 +18,10 @@ import { nowIso } from "../../_shared/lib-ts/base/utils.js";
|
|
|
19
18
|
|
|
20
19
|
const STATE_SCHEMA_VERSION = "1.0.0";
|
|
21
20
|
|
|
22
|
-
const DEFAULT_REVIEW_ITERATIONS: Record<string, number> = {
|
|
21
|
+
export const DEFAULT_REVIEW_ITERATIONS: Record<string, number> = {
|
|
23
22
|
simple: 1,
|
|
24
|
-
medium:
|
|
25
|
-
high:
|
|
23
|
+
medium: 3,
|
|
24
|
+
high: 5,
|
|
26
25
|
};
|
|
27
26
|
|
|
28
27
|
// ---------------------------------------------------------------------------
|
|
@@ -44,7 +43,7 @@ export function getStateFilePath(planPath: string): string {
|
|
|
44
43
|
/**
|
|
45
44
|
* Load state file with schema validation and migration.
|
|
46
45
|
*/
|
|
47
|
-
export function loadState(planPath: string):
|
|
46
|
+
export function loadState(planPath: string): Record<string, unknown> | null {
|
|
48
47
|
try {
|
|
49
48
|
const stateFile = getStateFilePath(planPath);
|
|
50
49
|
|
|
@@ -53,7 +52,7 @@ export function loadState(planPath: string): null | Record<string, unknown> {
|
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
const state = JSON.parse(
|
|
56
|
-
fs.readFileSync(stateFile, "
|
|
55
|
+
fs.readFileSync(stateFile, "utf-8"),
|
|
57
56
|
) as Record<string, unknown>;
|
|
58
57
|
|
|
59
58
|
// Handle schema version (backward compatible)
|
|
@@ -73,13 +72,12 @@ export function loadState(planPath: string): null | Record<string, unknown> {
|
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
return state;
|
|
76
|
-
} catch (
|
|
77
|
-
if (
|
|
78
|
-
logError("state", `SECURITY: Invalid plan path: ${
|
|
75
|
+
} catch (e: unknown) {
|
|
76
|
+
if (e instanceof Error && e.message.includes("Invalid plan path")) {
|
|
77
|
+
logError("state", `SECURITY: Invalid plan path: ${e}`);
|
|
79
78
|
} else {
|
|
80
|
-
logError("state", `Failed to load state: ${
|
|
81
|
-
}
|
|
82
|
-
|
|
79
|
+
logError("state", `Failed to load state: ${e}`);
|
|
80
|
+
}
|
|
83
81
|
return null;
|
|
84
82
|
}
|
|
85
83
|
}
|
|
@@ -111,13 +109,12 @@ export function saveStateToPlan(
|
|
|
111
109
|
}
|
|
112
110
|
|
|
113
111
|
return true;
|
|
114
|
-
} catch (
|
|
115
|
-
if (
|
|
116
|
-
logError("state", `SECURITY: Invalid plan path: ${
|
|
112
|
+
} catch (e: unknown) {
|
|
113
|
+
if (e instanceof Error && e.message.includes("Invalid plan path")) {
|
|
114
|
+
logError("state", `SECURITY: Invalid plan path: ${e}`);
|
|
117
115
|
} else {
|
|
118
|
-
logError("state", String(
|
|
119
|
-
}
|
|
120
|
-
|
|
116
|
+
logError("state", String(e));
|
|
117
|
+
}
|
|
121
118
|
return false;
|
|
122
119
|
}
|
|
123
120
|
}
|
|
@@ -132,16 +129,14 @@ export function deleteState(planPath: string): boolean {
|
|
|
132
129
|
if (fs.existsSync(stateFile)) {
|
|
133
130
|
fs.unlinkSync(stateFile);
|
|
134
131
|
logInfo("state", `Deleted state file: ${stateFile}`);
|
|
135
|
-
}
|
|
136
|
-
|
|
132
|
+
}
|
|
137
133
|
return true;
|
|
138
|
-
} catch (
|
|
139
|
-
if (
|
|
140
|
-
logError("state", `SECURITY: Invalid plan path in delete: ${
|
|
134
|
+
} catch (e: unknown) {
|
|
135
|
+
if (e instanceof Error && e.message.includes("Invalid plan path")) {
|
|
136
|
+
logError("state", `SECURITY: Invalid plan path in delete: ${e}`);
|
|
141
137
|
return false;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
logWarn("state", `Failed to delete state file: ${error}`);
|
|
138
|
+
}
|
|
139
|
+
logWarn("state", `Failed to delete state file: ${e}`);
|
|
145
140
|
return false;
|
|
146
141
|
}
|
|
147
142
|
}
|
|
@@ -178,6 +173,9 @@ export function getIterationState(
|
|
|
178
173
|
max: reviewIterations[complexity] ?? 1,
|
|
179
174
|
complexity,
|
|
180
175
|
history: [],
|
|
176
|
+
graduated: [],
|
|
177
|
+
passStreaks: {},
|
|
178
|
+
lastPlanHash: "",
|
|
181
179
|
};
|
|
182
180
|
}
|
|
183
181
|
|
|
@@ -209,7 +207,7 @@ export function shouldContinueIterating(
|
|
|
209
207
|
verdict: string,
|
|
210
208
|
config?: Record<string, unknown>,
|
|
211
209
|
): boolean {
|
|
212
|
-
const
|
|
210
|
+
const current = iteration.current;
|
|
213
211
|
const maxIter = iteration.max;
|
|
214
212
|
|
|
215
213
|
// At or past max iterations
|
|
@@ -225,8 +223,7 @@ export function shouldContinueIterating(
|
|
|
225
223
|
let earlyExit = true;
|
|
226
224
|
if (config) {
|
|
227
225
|
earlyExit = (config.earlyExitOnAllPass as boolean) ?? true;
|
|
228
|
-
}
|
|
229
|
-
|
|
226
|
+
}
|
|
230
227
|
if (earlyExit && verdict === "pass") {
|
|
231
228
|
logInfo(
|
|
232
229
|
"state",
|
|
@@ -12,71 +12,106 @@ export type { ContextState, HookInput, HookOutput } from "../../_shared/lib-ts/t
|
|
|
12
12
|
// ---------------------------------------------------------------------------
|
|
13
13
|
|
|
14
14
|
/** Verdict from a single reviewer */
|
|
15
|
-
export type Verdict = "
|
|
15
|
+
export type Verdict = "pass" | "warn" | "fail" | "error" | "skip";
|
|
16
16
|
|
|
17
17
|
/** Decision after aggregating all verdicts */
|
|
18
18
|
export type ReviewDecision = "allow" | "deny";
|
|
19
19
|
|
|
20
20
|
/** Complexity level assigned by orchestrator */
|
|
21
|
-
export type ComplexityCategory = "
|
|
21
|
+
export type ComplexityCategory = "simple" | "medium" | "high";
|
|
22
22
|
|
|
23
23
|
// ---------------------------------------------------------------------------
|
|
24
24
|
// Review Data Structures
|
|
25
25
|
// ---------------------------------------------------------------------------
|
|
26
26
|
|
|
27
|
+
/** Dimension classification for corroboration-based verdict */
|
|
28
|
+
export type IssueDimension =
|
|
29
|
+
| "completeness"
|
|
30
|
+
| "simplicity"
|
|
31
|
+
| "security"
|
|
32
|
+
| "performance"
|
|
33
|
+
| "reliability"
|
|
34
|
+
| "maintainability"
|
|
35
|
+
| "testability"
|
|
36
|
+
| "scope"
|
|
37
|
+
| "feasibility"
|
|
38
|
+
| "clarity";
|
|
39
|
+
|
|
27
40
|
/** A single issue found during review */
|
|
28
41
|
export interface ReviewIssue {
|
|
42
|
+
severity: "high" | "medium" | "low";
|
|
29
43
|
category: string;
|
|
30
44
|
issue: string;
|
|
31
|
-
severity: "high" | "low" | "medium";
|
|
32
45
|
suggested_fix: string;
|
|
46
|
+
dimension?: IssueDimension;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** A group of issues in one dimension, classified as blocking or solo */
|
|
50
|
+
export interface DimensionGroup {
|
|
51
|
+
dimension: IssueDimension;
|
|
52
|
+
issues: Array<{ agent: string; issue: ReviewIssue }>;
|
|
53
|
+
agentCount: number;
|
|
54
|
+
threshold: number; // 2 × agentCount
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Corroborated (blocking) group — threshold exceeded */
|
|
58
|
+
export type CorroboratedGroup = DimensionGroup;
|
|
59
|
+
|
|
60
|
+
/** Solo finding — below threshold, informational only */
|
|
61
|
+
export type SoloFinding = DimensionGroup;
|
|
62
|
+
|
|
63
|
+
/** Result of corroboration-based verdict computation */
|
|
64
|
+
export interface CorroborationResult {
|
|
65
|
+
blocking: CorroboratedGroup[];
|
|
66
|
+
solo: SoloFinding[];
|
|
67
|
+
unclassified: Array<{ agent: string; issue: ReviewIssue }>;
|
|
68
|
+
verdict: "pass" | "warn" | "fail";
|
|
33
69
|
}
|
|
34
70
|
|
|
35
71
|
/** Normalized review data from any reviewer */
|
|
36
72
|
export interface ReviewData {
|
|
73
|
+
verdict: Verdict;
|
|
74
|
+
summary: string;
|
|
75
|
+
summary_source: "reviewer" | "default";
|
|
37
76
|
issues: ReviewIssue[];
|
|
38
77
|
missing_sections: string[];
|
|
39
78
|
questions: string[];
|
|
40
|
-
summary: string;
|
|
41
|
-
summary_source: "default" | "reviewer";
|
|
42
|
-
verdict: Verdict;
|
|
43
79
|
}
|
|
44
80
|
|
|
45
81
|
/** Result from a single plan reviewer (Codex, Gemini, or Claude agent) */
|
|
46
82
|
export interface ReviewerResult {
|
|
47
|
-
data: Record<string, unknown>;
|
|
48
|
-
err: string;
|
|
49
83
|
name: string;
|
|
50
84
|
ok: boolean;
|
|
51
|
-
raw: string;
|
|
52
85
|
verdict: Verdict;
|
|
86
|
+
data: Record<string, unknown>;
|
|
87
|
+
raw: string;
|
|
88
|
+
err: string;
|
|
53
89
|
}
|
|
54
90
|
|
|
55
91
|
/** Result from the plan orchestrator */
|
|
56
92
|
export interface OrchestratorResult {
|
|
57
|
-
category: string;
|
|
58
93
|
complexity: ComplexityCategory;
|
|
59
|
-
|
|
60
|
-
reasoning: string;
|
|
94
|
+
category: string;
|
|
61
95
|
selected_agents: string[];
|
|
96
|
+
reasoning: string;
|
|
62
97
|
skip_reason?: string;
|
|
98
|
+
error?: string;
|
|
63
99
|
}
|
|
64
100
|
|
|
65
101
|
/** Combined result from all review phases */
|
|
66
102
|
export interface CombinedReviewResult {
|
|
67
|
-
agents: Record<string, ReviewerResult>;
|
|
68
|
-
cli_reviewers: Record<string, ReviewerResult>;
|
|
69
|
-
orchestration: null | OrchestratorResult;
|
|
70
|
-
overall_verdict: Verdict;
|
|
71
103
|
plan_hash: string;
|
|
104
|
+
overall_verdict: Verdict;
|
|
105
|
+
orchestration: OrchestratorResult | null;
|
|
106
|
+
agents: Record<string, ReviewerResult>;
|
|
72
107
|
timestamp: string;
|
|
73
108
|
}
|
|
74
109
|
|
|
75
110
|
/** Result from verdict aggregation */
|
|
76
111
|
export interface ReviewDecisionResult {
|
|
112
|
+
should_deny: boolean;
|
|
77
113
|
reason: string; // "fail_veto" | "acceptable" | "no_signal"
|
|
78
114
|
score: number;
|
|
79
|
-
should_deny: boolean;
|
|
80
115
|
}
|
|
81
116
|
|
|
82
117
|
// ---------------------------------------------------------------------------
|
|
@@ -85,12 +120,13 @@ export interface ReviewDecisionResult {
|
|
|
85
120
|
|
|
86
121
|
/** Configuration for a Claude Code review agent */
|
|
87
122
|
export interface AgentConfig {
|
|
123
|
+
name: string;
|
|
124
|
+
model: string;
|
|
125
|
+
provider: string; // e.g. "claude" | "codex" — assigned at runtime by assignModelsToAgents()
|
|
126
|
+
focus: string;
|
|
127
|
+
enabled: boolean;
|
|
88
128
|
categories: string[];
|
|
89
129
|
description: string;
|
|
90
|
-
enabled: boolean;
|
|
91
|
-
focus: string;
|
|
92
|
-
model: string;
|
|
93
|
-
name: string;
|
|
94
130
|
system_prompt: string; // Markdown body content for --system-prompt
|
|
95
131
|
}
|
|
96
132
|
|
|
@@ -101,6 +137,17 @@ export interface OrchestratorConfig {
|
|
|
101
137
|
timeout: number;
|
|
102
138
|
}
|
|
103
139
|
|
|
140
|
+
/** Configuration for a model provider (Claude, Codex, etc.) */
|
|
141
|
+
export interface ProviderConfig {
|
|
142
|
+
enabled: boolean;
|
|
143
|
+
models: string[];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** Model provider pool configuration */
|
|
147
|
+
export interface ModelsConfig {
|
|
148
|
+
providers: Record<string, ProviderConfig>;
|
|
149
|
+
}
|
|
150
|
+
|
|
104
151
|
// ---------------------------------------------------------------------------
|
|
105
152
|
// State Interfaces
|
|
106
153
|
// ---------------------------------------------------------------------------
|
|
@@ -108,37 +155,40 @@ export interface OrchestratorConfig {
|
|
|
108
155
|
/** A single iteration history entry */
|
|
109
156
|
export interface IterationEntry {
|
|
110
157
|
hash: string;
|
|
111
|
-
timestamp: string;
|
|
112
158
|
verdict: string;
|
|
159
|
+
timestamp: string;
|
|
113
160
|
}
|
|
114
161
|
|
|
115
162
|
/** Iteration tracking state (stored adjacent to plan file) */
|
|
116
163
|
export interface IterationState {
|
|
117
|
-
complexity: string;
|
|
118
164
|
current: number;
|
|
119
|
-
graduated: string[];
|
|
120
|
-
history: IterationEntry[];
|
|
121
165
|
max: number;
|
|
166
|
+
complexity: string;
|
|
167
|
+
history: IterationEntry[];
|
|
168
|
+
graduated: string[];
|
|
169
|
+
passStreaks: Record<string, number>;
|
|
170
|
+
lastPlanHash: string;
|
|
122
171
|
}
|
|
123
172
|
|
|
124
173
|
/** CC-native state stored in context state.json under cc_native key */
|
|
125
174
|
export interface CcNativeState {
|
|
126
|
-
[key: string]: unknown;
|
|
127
175
|
plan_review?: PlanReviewState;
|
|
128
176
|
questions_asked?: QuestionsAskedState;
|
|
177
|
+
stuck_detection?: StuckDetectionState;
|
|
178
|
+
[key: string]: unknown;
|
|
129
179
|
}
|
|
130
180
|
|
|
131
181
|
/** Plan review state within cc_native */
|
|
132
182
|
export interface PlanReviewState {
|
|
183
|
+
plan_hash: string;
|
|
184
|
+
reviewed_at: string;
|
|
133
185
|
decision: string;
|
|
134
186
|
iteration?: {
|
|
135
|
-
complexity: string;
|
|
136
187
|
current: number;
|
|
137
|
-
latest_verdict?: string;
|
|
138
188
|
max: number;
|
|
189
|
+
complexity: string;
|
|
190
|
+
latest_verdict?: string;
|
|
139
191
|
};
|
|
140
|
-
plan_hash: string;
|
|
141
|
-
reviewed_at: string;
|
|
142
192
|
}
|
|
143
193
|
|
|
144
194
|
/** Questions-asked tracking state */
|
|
@@ -147,6 +197,15 @@ export interface QuestionsAskedState {
|
|
|
147
197
|
asked_at: string;
|
|
148
198
|
}
|
|
149
199
|
|
|
200
|
+
/** Stuck detection state — tracks repeated errors, file edits, and test failures */
|
|
201
|
+
export interface StuckDetectionState {
|
|
202
|
+
error_hashes: Record<string, number>;
|
|
203
|
+
file_edits: Record<string, number>;
|
|
204
|
+
test_failures: number;
|
|
205
|
+
tool_calls_since_suggestion: number;
|
|
206
|
+
suggestion_count: number;
|
|
207
|
+
}
|
|
208
|
+
|
|
150
209
|
// ---------------------------------------------------------------------------
|
|
151
210
|
// Configuration
|
|
152
211
|
// ---------------------------------------------------------------------------
|
|
@@ -160,25 +219,25 @@ export interface DisplaySettings {
|
|
|
160
219
|
|
|
161
220
|
/** Full plan review configuration (from plan-review.config.json) */
|
|
162
221
|
export interface PlanReviewConfig {
|
|
163
|
-
[key: string]: unknown;
|
|
164
|
-
display?: Partial<DisplaySettings>;
|
|
165
222
|
planReview?: {
|
|
223
|
+
enabled?: boolean;
|
|
224
|
+
reviewers?: {
|
|
225
|
+
codex?: { enabled?: boolean; timeout?: number; model?: string };
|
|
226
|
+
gemini?: { enabled?: boolean; timeout?: number; model?: string };
|
|
227
|
+
};
|
|
166
228
|
agentReview?: {
|
|
167
|
-
agentSelection?: Record<string, unknown>;
|
|
168
|
-
complexityCategories?: string[];
|
|
169
229
|
enabled?: boolean;
|
|
170
|
-
orchestrator?: { enabled?: boolean; model?: string; timeout?: number };
|
|
171
230
|
timeout?: number;
|
|
231
|
+
orchestrator?: { enabled?: boolean; model?: string; timeout?: number };
|
|
232
|
+
agentSelection?: Record<string, unknown>;
|
|
233
|
+
complexityCategories?: string[];
|
|
172
234
|
};
|
|
173
235
|
display?: Partial<DisplaySettings>;
|
|
174
|
-
earlyExitOnAllPass?: boolean;
|
|
175
|
-
enabled?: boolean;
|
|
176
|
-
reviewers?: {
|
|
177
|
-
codex?: { enabled?: boolean; model?: string; timeout?: number; };
|
|
178
|
-
gemini?: { enabled?: boolean; model?: string; timeout?: number; };
|
|
179
|
-
};
|
|
180
236
|
reviewIterations?: Record<string, number>;
|
|
237
|
+
earlyExitOnAllPass?: boolean;
|
|
181
238
|
};
|
|
239
|
+
display?: Partial<DisplaySettings>;
|
|
240
|
+
[key: string]: unknown;
|
|
182
241
|
}
|
|
183
242
|
|
|
184
243
|
// ---------------------------------------------------------------------------
|
|
@@ -187,9 +246,9 @@ export interface PlanReviewConfig {
|
|
|
187
246
|
|
|
188
247
|
/** Options passed to reviewer implementations */
|
|
189
248
|
export interface ReviewOptions {
|
|
249
|
+
timeout: number;
|
|
190
250
|
context_path?: string;
|
|
191
251
|
session_name?: string;
|
|
192
|
-
timeout: number;
|
|
193
252
|
}
|
|
194
253
|
|
|
195
254
|
/** Interface all reviewers must implement */
|
|
@@ -202,97 +261,10 @@ export interface Reviewer {
|
|
|
202
261
|
}
|
|
203
262
|
|
|
204
263
|
// ---------------------------------------------------------------------------
|
|
205
|
-
// JSON Schemas
|
|
264
|
+
// JSON Schemas (moved to reviewers/schemas.ts)
|
|
206
265
|
// ---------------------------------------------------------------------------
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
export const REVIEW_SCHEMA: Record<string, unknown> = {
|
|
210
|
-
type: "object",
|
|
211
|
-
properties: {
|
|
212
|
-
verdict: { type: "string", enum: ["pass", "warn", "fail"] },
|
|
213
|
-
summary: { type: "string", minLength: 20 },
|
|
214
|
-
issues: {
|
|
215
|
-
type: "array",
|
|
216
|
-
items: {
|
|
217
|
-
type: "object",
|
|
218
|
-
properties: {
|
|
219
|
-
severity: { type: "string", enum: ["high", "medium", "low"] },
|
|
220
|
-
category: { type: "string" },
|
|
221
|
-
issue: { type: "string" },
|
|
222
|
-
suggested_fix: { type: "string" },
|
|
223
|
-
},
|
|
224
|
-
required: ["severity", "category", "issue", "suggested_fix"],
|
|
225
|
-
additionalProperties: false,
|
|
226
|
-
},
|
|
227
|
-
},
|
|
228
|
-
missing_sections: { type: "array", items: { type: "string" } },
|
|
229
|
-
questions: { type: "array", items: { type: "string" } },
|
|
230
|
-
},
|
|
231
|
-
required: ["verdict", "summary", "issues", "missing_sections", "questions"],
|
|
232
|
-
additionalProperties: false,
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
/** JSON schema for orchestrator structured output */
|
|
236
|
-
export const ORCHESTRATOR_SCHEMA: Record<string, unknown> = {
|
|
237
|
-
type: "object",
|
|
238
|
-
properties: {
|
|
239
|
-
complexity: { type: "string", enum: ["simple", "medium", "high"] },
|
|
240
|
-
category: {
|
|
241
|
-
type: "string",
|
|
242
|
-
enum: [
|
|
243
|
-
"code",
|
|
244
|
-
"infrastructure",
|
|
245
|
-
"documentation",
|
|
246
|
-
"life",
|
|
247
|
-
"business",
|
|
248
|
-
"design",
|
|
249
|
-
"research",
|
|
250
|
-
],
|
|
251
|
-
},
|
|
252
|
-
selectedAgents: { type: "array", items: { type: "string" } },
|
|
253
|
-
reasoning: { type: "string" },
|
|
254
|
-
skipReason: { type: "string" },
|
|
255
|
-
},
|
|
256
|
-
required: ["complexity", "category", "selectedAgents", "reasoning"],
|
|
257
|
-
additionalProperties: false,
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
// ---------------------------------------------------------------------------
|
|
261
|
-
// Prompt Constants
|
|
262
|
-
// ---------------------------------------------------------------------------
|
|
263
|
-
|
|
264
|
-
export const REVIEW_PROMPT_PREFIX = `You are a senior staff software engineer acting as a strict plan reviewer.
|
|
265
|
-
|
|
266
|
-
Review the PLAN below. Focus on:
|
|
267
|
-
- missing steps, unclear assumptions, edge cases
|
|
268
|
-
- security/privacy concerns
|
|
269
|
-
- testing/rollout/rollback completeness
|
|
270
|
-
- operational concerns (observability, failure modes)
|
|
271
|
-
`;
|
|
272
|
-
|
|
273
|
-
export const AGENT_REVIEW_PROMPT_PREFIX = `# SINGLE-TURN PLAN REVIEW
|
|
274
|
-
|
|
275
|
-
## CRITICAL: ONE TURN ONLY
|
|
276
|
-
You have exactly ONE response to complete this review. Do NOT attempt multi-step workflows, context queries, or phased analysis. Analyze the plan and output your review immediately.
|
|
277
|
-
|
|
278
|
-
## YOUR TASK
|
|
279
|
-
Review the plan below from your area of expertise. Then call StructuredOutput with your assessment.
|
|
280
|
-
|
|
281
|
-
## REQUIRED OUTPUT (all fields must have content)
|
|
282
|
-
Call StructuredOutput with:
|
|
283
|
-
- **verdict**: "pass" (no concerns), "warn" (some concerns), or "fail" (critical issues)
|
|
284
|
-
- **summary**: 2-3 sentences with your overall assessment and key findings (REQUIRED)
|
|
285
|
-
- **issues**: Array of concerns found. Format each as:
|
|
286
|
-
{"severity": "high/medium/low", "category": "...", "issue": "...", "suggested_fix": "..."}
|
|
287
|
-
- **missing_sections**: Topics the plan should address but doesn't
|
|
288
|
-
- **questions**: Things that need clarification before implementation
|
|
289
|
-
|
|
290
|
-
## IMPORTANT RULES
|
|
291
|
-
1. A "warn" verdict MUST include at least one issue explaining why
|
|
292
|
-
2. Summary MUST explain your reasoning, not just "looks good" or empty
|
|
293
|
-
3. Focus on your expertise area (architecture, security, performance, etc.)
|
|
294
|
-
4. Output StructuredOutput NOW - no other tools, no questions, no delays
|
|
295
|
-
`;
|
|
266
|
+
// Re-export for backwards compatibility
|
|
267
|
+
export { REVIEW_SCHEMA, ORCHESTRATOR_SCHEMA, REVIEW_PROMPT_PREFIX, AGENT_REVIEW_PROMPT_PREFIX } from "./reviewers/schemas.js";
|
|
296
268
|
|
|
297
269
|
// ---------------------------------------------------------------------------
|
|
298
270
|
// Display Defaults
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
"codex": {
|
|
2
|
+
"models": {
|
|
3
|
+
"providers": {
|
|
4
|
+
"claude": {
|
|
6
5
|
"enabled": true,
|
|
7
|
-
"
|
|
8
|
-
"timeout": 120
|
|
6
|
+
"models": ["sonnet"]
|
|
9
7
|
},
|
|
10
|
-
"
|
|
11
|
-
"enabled":
|
|
12
|
-
"
|
|
13
|
-
"timeout": 120
|
|
8
|
+
"codex": {
|
|
9
|
+
"enabled": true,
|
|
10
|
+
"models": ["gpt-5.1-codex-mini"]
|
|
14
11
|
}
|
|
15
|
-
}
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"planReview": {
|
|
15
|
+
"enabled": true,
|
|
16
16
|
"display": {
|
|
17
17
|
"maxIssues": 12,
|
|
18
18
|
"maxMissingSections": 12,
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"enabled": true,
|
|
24
24
|
"timeout": 180,
|
|
25
25
|
"warnThreshold": 0.01,
|
|
26
|
+
"maxIssuesPerAgent": 3,
|
|
26
27
|
"orchestrator": {
|
|
27
28
|
"enabled": true,
|
|
28
29
|
"model": "opus",
|
|
@@ -40,8 +41,8 @@
|
|
|
40
41
|
},
|
|
41
42
|
"reviewIterations": {
|
|
42
43
|
"simple": 1,
|
|
43
|
-
"medium":
|
|
44
|
-
"high":
|
|
44
|
+
"medium": 3,
|
|
45
|
+
"high": 5
|
|
45
46
|
},
|
|
46
47
|
"highIssueThreshold": 2,
|
|
47
48
|
"earlyExitOnAllPass": true,
|
|
@@ -71,5 +72,13 @@
|
|
|
71
72
|
"planContext": {
|
|
72
73
|
"enabled": true,
|
|
73
74
|
"offerClarifyingQuestions": true
|
|
75
|
+
},
|
|
76
|
+
"stuckDetection": {
|
|
77
|
+
"enabled": true,
|
|
78
|
+
"errorThreshold": 3,
|
|
79
|
+
"fileEditThreshold": 4,
|
|
80
|
+
"testFailureThreshold": 3,
|
|
81
|
+
"cooldown": 10,
|
|
82
|
+
"maxSuggestions": 3
|
|
74
83
|
}
|
|
75
84
|
}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aiwcli",
|
|
3
3
|
"description": "AI Workflow CLI - Command-line interface for AI-powered workflows",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.12.0",
|
|
5
5
|
"author": "jofu-tofu",
|
|
6
6
|
"bin": {
|
|
7
|
-
"aiw": "
|
|
7
|
+
"aiw": "bin/run.js"
|
|
8
8
|
},
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/jofu-tofu/AI-Workflow-CLI/issues"
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@eslint/compat": "^1",
|
|
24
|
-
"@oclif/prettier-config": "^0.2.1",
|
|
25
24
|
"@oclif/test": "^4",
|
|
26
25
|
"@types/chai": "^4",
|
|
27
26
|
"@types/mocha": "^10",
|