aiwcli 0.12.7 → 0.12.8

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 (79) hide show
  1. package/dist/templates/CLAUDE.md +27 -0
  2. package/dist/templates/_shared/.claude/{commands/handoff.md → skills/handoff/SKILL.md} +3 -2
  3. package/dist/templates/_shared/.claude/{commands/handoff-resume.md → skills/handoff-resume/SKILL.md} +2 -1
  4. package/dist/templates/_shared/handoff-system/CLAUDE.md +433 -421
  5. package/dist/templates/_shared/lib-ts/CLAUDE.md +3 -3
  6. package/dist/templates/_shared/lib-ts/base/constants.ts +324 -306
  7. package/dist/templates/_shared/lib-ts/base/inference.ts +3 -3
  8. package/dist/templates/_shared/lib-ts/context/CLAUDE.md +134 -0
  9. package/dist/templates/_shared/scripts/status_line.ts +26 -29
  10. package/dist/templates/cc-native/.claude/commands/cc-native/specdev.md +1 -1
  11. package/dist/templates/cc-native/.claude/settings.json +3 -2
  12. package/dist/templates/cc-native/_cc-native/artifacts/CLAUDE.md +64 -0
  13. package/dist/templates/cc-native/_cc-native/{lib-ts/artifacts → artifacts/lib}/format.ts +597 -597
  14. package/dist/templates/cc-native/_cc-native/{lib-ts/artifacts → artifacts/lib}/index.ts +26 -26
  15. package/dist/templates/cc-native/_cc-native/{lib-ts/artifacts → artifacts/lib}/tracker.ts +107 -107
  16. package/dist/templates/cc-native/_cc-native/{lib-ts/artifacts → artifacts/lib}/write.ts +119 -119
  17. package/dist/templates/cc-native/_cc-native/hooks/CLAUDE.md +237 -247
  18. package/dist/templates/cc-native/_cc-native/hooks/cc-native-plan-review.ts +76 -76
  19. package/dist/templates/cc-native/_cc-native/hooks/validate_task_prompt.ts +76 -0
  20. package/dist/templates/cc-native/_cc-native/lib-ts/aggregate-agents.ts +163 -156
  21. package/dist/templates/cc-native/_cc-native/lib-ts/index.ts +116 -116
  22. package/dist/templates/cc-native/_cc-native/lib-ts/settings.ts +1 -1
  23. package/dist/templates/cc-native/_cc-native/lib-ts/types.ts +329 -329
  24. package/dist/templates/cc-native/_cc-native/plan-review/CLAUDE.md +149 -0
  25. package/dist/templates/cc-native/_cc-native/plan-review/agents/CLAUDE.md +143 -0
  26. package/dist/templates/cc-native/_cc-native/plan-review/agents/PLAN-ORCHESTRATOR.md +213 -0
  27. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-questions/PLAN-QUESTIONER.md +70 -0
  28. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-EVOLUTION.md +62 -0
  29. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-PATTERNS.md +61 -0
  30. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-STRUCTURE.md +62 -0
  31. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ASSUMPTION-TRACER.md +56 -0
  32. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/CLARITY-AUDITOR.md +53 -0
  33. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-FEASIBILITY.md +66 -0
  34. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-GAPS.md +70 -0
  35. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-ORDERING.md +62 -0
  36. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/CONSTRAINT-VALIDATOR.md +72 -0
  37. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DESIGN-ADR-VALIDATOR.md +61 -0
  38. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DESIGN-SCALE-MATCHER.md +64 -0
  39. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DEVILS-ADVOCATE.md +56 -0
  40. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DOCUMENTATION-PHILOSOPHY.md +86 -0
  41. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/HANDOFF-READINESS.md +59 -0
  42. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/HIDDEN-COMPLEXITY.md +58 -0
  43. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/INCREMENTAL-DELIVERY.md +66 -0
  44. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-DEPENDENCY.md +62 -0
  45. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-FMEA.md +66 -0
  46. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-PREMORTEM.md +71 -0
  47. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-REVERSIBILITY.md +74 -0
  48. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SCOPE-BOUNDARY.md +77 -0
  49. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SIMPLICITY-GUARDIAN.md +62 -0
  50. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SKEPTIC.md +68 -0
  51. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-BEHAVIOR-AUDITOR.md +61 -0
  52. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-CHARACTERIZATION.md +71 -0
  53. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-FIRST-VALIDATOR.md +61 -0
  54. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-PYRAMID-ANALYZER.md +61 -0
  55. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TRADEOFF-COSTS.md +67 -0
  56. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TRADEOFF-STAKEHOLDERS.md +65 -0
  57. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/VERIFY-COVERAGE.md +74 -0
  58. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/VERIFY-STRENGTH.md +69 -0
  59. package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/agent-selection.ts +163 -163
  60. package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/corroboration.ts +119 -119
  61. package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/graduation.ts +132 -132
  62. package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/orchestrator.ts +70 -70
  63. package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/output-builder.ts +130 -130
  64. package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/plan-questions.ts +102 -102
  65. package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/review-pipeline.ts +511 -511
  66. package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/reviewers/agent.ts +74 -74
  67. package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/reviewers/base/base-agent.ts +217 -217
  68. package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/reviewers/index.ts +12 -12
  69. package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/reviewers/providers/claude-agent.ts +66 -66
  70. package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/reviewers/providers/codex-agent.ts +185 -185
  71. package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/reviewers/providers/gemini-agent.ts +39 -39
  72. package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/reviewers/providers/orchestrator-claude-agent.ts +196 -196
  73. package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/reviewers/schemas.ts +201 -201
  74. package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/reviewers/types.ts +23 -23
  75. package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/verdict.ts +72 -72
  76. package/dist/templates/cc-native/_cc-native/{workflows → plan-review/workflows}/specdev.md +9 -9
  77. package/oclif.manifest.json +1 -1
  78. package/package.json +1 -1
  79. package/dist/templates/cc-native/_cc-native/lib-ts/artifacts.ts +0 -21
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * PreToolUse:Task Hook: Prompt Validation Gate
4
+ *
5
+ * Validates that Task tool calls have self-contained, goal-oriented prompts.
6
+ * Short-circuits immediately for resume calls (no prompt to validate).
7
+ *
8
+ * Design:
9
+ * - Resume calls (tool_input.resume present) → allow through, no inference
10
+ * - Missing/empty prompt → allow through (fail open)
11
+ * - Non-empty prompt → run AI validation via inference(), block if ok:false
12
+ */
13
+
14
+ import {
15
+ loadHookInput,
16
+ runHook,
17
+ logInfo,
18
+ logDebug,
19
+ logWarn,
20
+ emitContextAndBlock,
21
+ getToolInput,
22
+ } from "../../_shared/lib-ts/base/hook-utils.js";
23
+ import { isInternalCall } from "../../_shared/lib-ts/base/subprocess-utils.js";
24
+ import { inference } from "../../_shared/lib-ts/base/inference.js";
25
+
26
+ const VALIDATION_SYSTEM_PROMPT = `The sub-agent receives ONLY the prompt text — no conversation history, no prior context.
27
+
28
+ Check 1 — Dangling References: Does the prompt use pronouns or demonstratives that ONLY make sense with prior conversation? Violations: 'the file we looked at', 'as discussed above', 'that approach we chose', 'the error from earlier', 'fix the issue mentioned above'. NOT violations: relative paths ('_output/', 'src/lib/'), search terms ('context-manager', 'auth module'), directory exploration ('find files matching X'), tool names, or any concrete noun — even if imprecise. Only flag references that are truly UNRESOLVABLE without conversation history.
29
+
30
+ Check 2 — Implicit Contract: Does the prompt have ANY discernible goal? 'Explore the _output directory and find context files' IS a clear goal. 'Search for hooks that handle Task events' IS a clear goal. 'Read and summarize all files in X' IS a clear goal. Only flag if the prompt is truly goalless — e.g., a sentence fragment with no verb, or pure context with no request.
31
+
32
+ If both checks pass, return ok:true. When in doubt, pass — false negatives (letting a vague prompt through) are far less costly than false positives (blocking legitimate work).
33
+
34
+ When returning ok:false, end your response with: 'Retry: Re-invoke the Task tool with a revised prompt that resolves the issues above.'`;
35
+
36
+ function main(): void {
37
+ if (isInternalCall()) return;
38
+
39
+ const payload = loadHookInput();
40
+ if (!payload) return;
41
+
42
+ const toolInput = getToolInput(payload);
43
+
44
+ // Resume calls: tool_input contains `resume: "<agent-id>"` (may also have prompt/description).
45
+ // The resume field being present is the authoritative discriminator — skip all validation.
46
+ if (toolInput?.resume) {
47
+ logInfo("validate_task_prompt", `Resume call detected (agent: ${toolInput.resume}) — skipping validation`);
48
+ return;
49
+ }
50
+
51
+ const prompt: string = toolInput?.prompt ?? "";
52
+ if (!prompt.trim()) {
53
+ logDebug("validate_task_prompt", "No prompt field — allowing through (fail open)");
54
+ return;
55
+ }
56
+
57
+ logInfo("validate_task_prompt", `Validating Task prompt (${prompt.length} chars)`);
58
+ const result = inference(VALIDATION_SYSTEM_PROMPT, prompt, "fast");
59
+
60
+ if (!result.success) {
61
+ logWarn("validate_task_prompt", `inference() failed (${result.error}) — failing open`);
62
+ return;
63
+ }
64
+
65
+ const output = result.output;
66
+ if (output.includes("ok:false")) {
67
+ // Extract the Retry line if present; fall back to full output
68
+ const retryMatch = output.match(/Retry:.*$/m);
69
+ const retryMessage = retryMatch ? retryMatch[0] : "Retry: Re-invoke the Task tool with a revised, self-contained prompt.";
70
+ logInfo("validate_task_prompt", "Blocking Task — prompt failed validation");
71
+ emitContextAndBlock(output, retryMessage);
72
+ }
73
+ // ok:true or anything else → allow through (no output = no block)
74
+ }
75
+
76
+ runHook(main, "validate_task_prompt");
@@ -1,156 +1,163 @@
1
- /**
2
- * Agent frontmatter parser — discovers and loads agent configs from markdown files.
3
- * See cc-native-plan-review-spec.md §4.14
4
- */
5
-
6
- import * as fs from "node:fs";
7
- import * as path from "node:path";
8
-
9
- import type { AgentConfig } from "./types.js";
10
- import { logDebug, logInfo, logWarn } from "../../_shared/lib-ts/base/logger.js";
11
-
12
- /**
13
- * Extract simple YAML frontmatter from markdown content.
14
- * Only handles flat key: value pairs (no nested YAML).
15
- */
16
- export function extractFrontmatter(
17
- content: string,
18
- ): Record<string, unknown> | null {
19
- const lines = content.split(/\r?\n/);
20
- if (lines[0]?.trim() !== "---") return null;
21
-
22
- const frontmatterLines: string[] = [];
23
- let endIndex = -1;
24
-
25
- for (let i = 1; i < lines.length; i++) {
26
- if (lines[i]?.trim() === "---") {
27
- endIndex = i;
28
- break;
29
- }
30
- const line = lines[i];
31
- if (line !== undefined) {
32
- frontmatterLines.push(line);
33
- }
34
- }
35
-
36
- if (endIndex === -1) return null;
37
-
38
- const result: Record<string, unknown> = {};
39
- for (const line of frontmatterLines) {
40
- const colonIdx = line.indexOf(":");
41
- if (colonIdx === -1) continue;
42
-
43
- const key = line.slice(0, colonIdx).trim();
44
- let value: unknown = line.slice(colonIdx + 1).trim();
45
-
46
- // Handle arrays: [item1, item2]
47
- if (typeof value === "string" && value.startsWith("[") && value.endsWith("]")) {
48
- value = value
49
- .slice(1, -1)
50
- .split(",")
51
- .map((s) => s.trim().replaceAll(/^["']|["']$/g, ""))
52
- .filter(Boolean);
53
- }
54
- // Handle booleans
55
- else if (value === "true") value = true;
56
- else if (value === "false") value = false;
57
- // Handle quoted strings
58
- else if (
59
- typeof value === "string" &&
60
- ((value.startsWith('"') && value.endsWith('"')) ||
61
- (value.startsWith("'") && value.endsWith("'")))
62
- ) {
63
- value = value.slice(1, -1);
64
- }
65
-
66
- if (key) result[key] = value;
67
- }
68
-
69
- return result;
70
- }
71
-
72
- /**
73
- * Extract markdown body after frontmatter.
74
- */
75
- export function extractBody(content: string): string {
76
- const lines = content.split(/\r?\n/);
77
- if (lines[0]?.trim() !== "---") return content;
78
-
79
- for (let i = 1; i < lines.length; i++) {
80
- if (lines[i]?.trim() === "---") {
81
- return lines
82
- .slice(i + 1)
83
- .join("\n")
84
- .trim();
85
- }
86
- }
87
-
88
- return content;
89
- }
90
-
91
- /**
92
- * Discover and load all agent configs from a directory of markdown files.
93
- * Skips the plan-orchestrator agent. Defaults categories to ["code"].
94
- *
95
- * @param agentsDir - Path to agents directory (default: _cc-native/agents/)
96
- * @returns Array of AgentConfig objects
97
- */
98
- export function aggregateAgents(agentsDir?: string): AgentConfig[] {
99
- const dir = agentsDir ?? path.join("_cc-native", "agents");
100
-
101
- if (!fs.existsSync(dir)) {
102
- logWarn("aggregate", `Agents directory not found: ${dir}`);
103
- return [];
104
- }
105
-
106
- const files = fs
107
- .readdirSync(dir)
108
- .filter((f) => f.endsWith(".md"))
109
- .sort();
110
-
111
- const agents: AgentConfig[] = [];
112
-
113
- for (const file of files) {
114
- const filePath = path.join(dir, file);
115
- let content: string;
116
- try {
117
- content = fs.readFileSync(filePath, "utf-8");
118
- } catch (error: unknown) {
119
- logWarn("aggregate", `Failed to read ${file}: ${error}`);
120
- continue;
121
- }
122
-
123
- const fm = extractFrontmatter(content);
124
- if (!fm) {
125
- logDebug("aggregate", `No frontmatter in ${file}, skipping`);
126
- continue;
127
- }
128
-
129
- const name = (fm.name as string) ?? path.basename(file, ".md");
130
-
131
- // Skip the plan orchestrator — it's not a reviewer
132
- if (name === "plan-orchestrator") {
133
- logDebug("aggregate", `Skipping plan-orchestrator agent`);
134
- continue;
135
- }
136
-
137
- const agent: AgentConfig = {
138
- name,
139
- model: (fm.model as string) ?? "sonnet",
140
- provider: "claude", // Default; overwritten by assignModelsToAgents() at runtime
141
- focus: (fm.focus as string) ?? "",
142
- categories: Array.isArray(fm.categories)
143
- ? (fm.categories as string[])
144
- : ["code"],
145
- description: (fm.description as string) ?? "",
146
- system_prompt: extractBody(content),
147
- };
148
-
149
- agents.push(agent);
150
- logDebug("aggregate", `Loaded agent: ${agent.name} [${agent.categories.join(", ")}]`);
151
- }
152
-
153
- logInfo("aggregate", `Loaded ${agents.length} agents from ${dir}`);
154
- return agents;
155
- }
156
-
1
+ /**
2
+ * Agent frontmatter parser — discovers and loads agent configs from markdown files.
3
+ * See cc-native-plan-review-spec.md §4.14
4
+ *
5
+ * NOTE: This file intentionally stays in lib-ts/ rather than plan-review/lib/.
6
+ * Both settings.ts (shared cc-native infra) and plan-questions.ts (plan-review) import it.
7
+ * Moving it to plan-review/ would create a forbidden backward dependency: lib-ts → plan-review.
8
+ * Do not move this file without first moving settings.ts out of lib-ts/.
9
+ */
10
+
11
+ import * as fs from "node:fs";
12
+ import * as path from "node:path";
13
+
14
+ import type { AgentConfig } from "./types.js";
15
+ import { logDebug, logInfo, logWarn } from "../../_shared/lib-ts/base/logger.js";
16
+
17
+ /**
18
+ * Extract simple YAML frontmatter from markdown content.
19
+ * Only handles flat key: value pairs (no nested YAML).
20
+ */
21
+ export function extractFrontmatter(
22
+ content: string,
23
+ ): Record<string, unknown> | null {
24
+ const lines = content.split(/\r?\n/);
25
+ if (lines[0]?.trim() !== "---") return null;
26
+
27
+ const frontmatterLines: string[] = [];
28
+ let endIndex = -1;
29
+
30
+ for (let i = 1; i < lines.length; i++) {
31
+ if (lines[i]?.trim() === "---") {
32
+ endIndex = i;
33
+ break;
34
+ }
35
+ const line = lines[i];
36
+ if (line !== undefined) {
37
+ frontmatterLines.push(line);
38
+ }
39
+ }
40
+
41
+ if (endIndex === -1) return null;
42
+
43
+ const result: Record<string, unknown> = {};
44
+ for (const line of frontmatterLines) {
45
+ const colonIdx = line.indexOf(":");
46
+ if (colonIdx === -1) continue;
47
+
48
+ const key = line.slice(0, colonIdx).trim();
49
+ let value: unknown = line.slice(colonIdx + 1).trim();
50
+
51
+ // Handle arrays: [item1, item2]
52
+ if (typeof value === "string" && value.startsWith("[") && value.endsWith("]")) {
53
+ value = value
54
+ .slice(1, -1)
55
+ .split(",")
56
+ .map((s) => s.trim().replaceAll(/^["']|["']$/g, ""))
57
+ .filter(Boolean);
58
+ }
59
+ // Handle booleans
60
+ else if (value === "true") value = true;
61
+ else if (value === "false") value = false;
62
+ // Handle quoted strings
63
+ else if (
64
+ typeof value === "string" &&
65
+ ((value.startsWith('"') && value.endsWith('"')) ||
66
+ (value.startsWith("'") && value.endsWith("'")))
67
+ ) {
68
+ value = value.slice(1, -1);
69
+ }
70
+
71
+ if (key) result[key] = value;
72
+ }
73
+
74
+ return result;
75
+ }
76
+
77
+ /**
78
+ * Extract markdown body after frontmatter.
79
+ */
80
+ export function extractBody(content: string): string {
81
+ const lines = content.split(/\r?\n/);
82
+ if (lines[0]?.trim() !== "---") return content;
83
+
84
+ for (let i = 1; i < lines.length; i++) {
85
+ if (lines[i]?.trim() === "---") {
86
+ return lines
87
+ .slice(i + 1)
88
+ .join("\n")
89
+ .trim();
90
+ }
91
+ }
92
+
93
+ return content;
94
+ }
95
+
96
+ /**
97
+ * Discover and load all agent configs from a directory of markdown files.
98
+ * Skips the plan-orchestrator agent. Defaults categories to ["code"].
99
+ *
100
+ * @param agentsDir - Path to agents directory. Callers must pass an explicit path.
101
+ * Known call sites: settings.ts → plan-review/agents/plan-review,
102
+ * plan-questions.ts plan-review/agents/plan-questions
103
+ * @returns Array of AgentConfig objects
104
+ */
105
+ export function aggregateAgents(agentsDir?: string): AgentConfig[] {
106
+ const dir = agentsDir ?? path.join("_cc-native", "plan-review", "agents");
107
+
108
+ if (!fs.existsSync(dir)) {
109
+ logWarn("aggregate", `Agents directory not found: ${dir}`);
110
+ return [];
111
+ }
112
+
113
+ const files = fs
114
+ .readdirSync(dir)
115
+ .filter((f) => f.endsWith(".md"))
116
+ .sort();
117
+
118
+ const agents: AgentConfig[] = [];
119
+
120
+ for (const file of files) {
121
+ const filePath = path.join(dir, file);
122
+ let content: string;
123
+ try {
124
+ content = fs.readFileSync(filePath, "utf-8");
125
+ } catch (error: unknown) {
126
+ logWarn("aggregate", `Failed to read ${file}: ${error}`);
127
+ continue;
128
+ }
129
+
130
+ const fm = extractFrontmatter(content);
131
+ if (!fm) {
132
+ logDebug("aggregate", `No frontmatter in ${file}, skipping`);
133
+ continue;
134
+ }
135
+
136
+ const name = (fm.name as string) ?? path.basename(file, ".md");
137
+
138
+ // Skip the plan orchestrator — it's not a reviewer
139
+ if (name === "plan-orchestrator") {
140
+ logDebug("aggregate", `Skipping plan-orchestrator agent`);
141
+ continue;
142
+ }
143
+
144
+ const agent: AgentConfig = {
145
+ name,
146
+ model: (fm.model as string) ?? "sonnet",
147
+ provider: "claude", // Default; overwritten by assignModelsToAgents() at runtime
148
+ focus: (fm.focus as string) ?? "",
149
+ categories: Array.isArray(fm.categories)
150
+ ? (fm.categories as string[])
151
+ : ["code"],
152
+ description: (fm.description as string) ?? "",
153
+ system_prompt: extractBody(content),
154
+ };
155
+
156
+ agents.push(agent);
157
+ logDebug("aggregate", `Loaded agent: ${agent.name} [${agent.categories.join(", ")}]`);
158
+ }
159
+
160
+ logInfo("aggregate", `Loaded ${agents.length} agents from ${dir}`);
161
+ return agents;
162
+ }
163
+
@@ -1,116 +1,116 @@
1
- /**
2
- * CC-Native plan review library — package entry point.
3
- * Re-exports the public API from all modules.
4
- */
5
-
6
- // Agent aggregation
7
- export {
8
- aggregateAgents,
9
- extractBody,
10
- extractFrontmatter,
11
- } from "./aggregate-agents.js";
12
-
13
- // Artifacts
14
- export {
15
- buildCombinedJson,
16
- buildHighIssuesDocument,
17
- buildInlineReviewSummary,
18
- extractTopIssuesText,
19
- formatCombinedMarkdown,
20
- formatReviewMarkdown,
21
- generateReviewIndex,
22
- writeCombinedArtifacts,
23
- } from "./artifacts.js";
24
-
25
- // CC-native state
26
- export {
27
- getCcNativeState,
28
- isPlanAlreadyReviewed,
29
- markPlanReviewed,
30
- markQuestionsAsked,
31
- saveCcNativeState,
32
- wasPlanPreviouslyDenied,
33
- wasQuestionsAsked,
34
- } from "./cc-native-state.js";
35
-
36
- // CLI output parsing
37
- export { parseCliOutput } from "./cli-output-parser.js";
38
-
39
- // Configuration
40
- export { getDisplaySettings, loadConfig } from "./config.js";
41
-
42
- // Constants & security
43
- export {
44
- ENABLE_PLAN_NOTIFICATIONS,
45
- ENABLE_ROBUST_PLAN_WRITES,
46
- MAX_ERROR_FILE_SIZE,
47
- MAX_PLAN_PATH_LENGTH,
48
- MAX_RETRY_ATTEMPTS,
49
- MAX_TOTAL_RETRY_TIME_MS,
50
- PLANS_DIR,
51
- RETRY_BACKOFF_MS,
52
- validatePlanPath,
53
- } from "./constants.js";
54
-
55
- // Debug logging
56
- export { cleanupDebugFolder, debugLog, debugRaw, getDebugDir } from "./debug.js";
57
-
58
- // JSON parsing
59
- export { coerceToReview, parseJsonMaybe } from "./json-parser.js";
60
-
61
- // Orchestrator
62
- export { buildOrchestratorSchema, runOrchestrator } from "./orchestrator.js";
63
-
64
- // Reviewers
65
- export {
66
- AgentReviewer,
67
- runAgentReview,
68
- } from "./reviewers/index.js";
69
-
70
- // Iteration state
71
- export {
72
- DEFAULT_REVIEW_ITERATIONS,
73
- deleteState,
74
- getIterationState,
75
- getStateFilePath,
76
- loadState,
77
- saveStateToPlan,
78
- shouldContinueIterating,
79
- updateIterationState,
80
- } from "./state.js";
81
-
82
- // Types & schemas
83
- export type {
84
- AgentConfig,
85
- CcNativeState,
86
- CombinedReviewResult,
87
- ComplexityCategory,
88
- DisplaySettings,
89
- IterationEntry,
90
- IterationState,
91
- OrchestratorConfig,
92
- OrchestratorResult,
93
- PlanReviewConfig,
94
- PlanReviewState,
95
- QuestionsAskedState,
96
- ReviewData,
97
- ReviewDecision,
98
- ReviewDecisionResult,
99
- Reviewer,
100
- ReviewerResult,
101
- ReviewIssue,
102
- ReviewOptions,
103
- Verdict,
104
- } from "./types.js";
105
-
106
- export {
107
- AGENT_REVIEW_PROMPT_PREFIX,
108
- DEFAULT_DISPLAY,
109
- DEFAULT_SANITIZATION,
110
- ORCHESTRATOR_SCHEMA,
111
- REVIEW_PROMPT_PREFIX,
112
- REVIEW_SCHEMA,
113
- } from "./types.js";
114
-
115
- // Verdict aggregation
116
- export { computeReviewDecision, worstVerdict } from "./verdict.js";
1
+ /**
2
+ * CC-Native plan review library — package entry point.
3
+ * Re-exports the public API from all modules.
4
+ */
5
+
6
+ // Agent aggregation
7
+ export {
8
+ aggregateAgents,
9
+ extractBody,
10
+ extractFrontmatter,
11
+ } from "./aggregate-agents.js";
12
+
13
+ // Artifacts
14
+ export {
15
+ buildCombinedJson,
16
+ buildHighIssuesDocument,
17
+ buildInlineReviewSummary,
18
+ extractTopIssuesText,
19
+ formatCombinedMarkdown,
20
+ formatReviewMarkdown,
21
+ generateReviewIndex,
22
+ writeCombinedArtifacts,
23
+ } from "../artifacts/lib/index.js";
24
+
25
+ // CC-native state
26
+ export {
27
+ getCcNativeState,
28
+ isPlanAlreadyReviewed,
29
+ markPlanReviewed,
30
+ markQuestionsAsked,
31
+ saveCcNativeState,
32
+ wasPlanPreviouslyDenied,
33
+ wasQuestionsAsked,
34
+ } from "./cc-native-state.js";
35
+
36
+ // CLI output parsing
37
+ export { parseCliOutput } from "./cli-output-parser.js";
38
+
39
+ // Configuration
40
+ export { getDisplaySettings, loadConfig } from "./config.js";
41
+
42
+ // Constants & security
43
+ export {
44
+ ENABLE_PLAN_NOTIFICATIONS,
45
+ ENABLE_ROBUST_PLAN_WRITES,
46
+ MAX_ERROR_FILE_SIZE,
47
+ MAX_PLAN_PATH_LENGTH,
48
+ MAX_RETRY_ATTEMPTS,
49
+ MAX_TOTAL_RETRY_TIME_MS,
50
+ PLANS_DIR,
51
+ RETRY_BACKOFF_MS,
52
+ validatePlanPath,
53
+ } from "./constants.js";
54
+
55
+ // Debug logging
56
+ export { cleanupDebugFolder, debugLog, debugRaw, getDebugDir } from "./debug.js";
57
+
58
+ // JSON parsing
59
+ export { coerceToReview, parseJsonMaybe } from "./json-parser.js";
60
+
61
+ // Orchestrator
62
+ export { buildOrchestratorSchema, runOrchestrator } from "../plan-review/lib/orchestrator.js";
63
+
64
+ // Reviewers
65
+ export {
66
+ AgentReviewer,
67
+ runAgentReview,
68
+ } from "../plan-review/lib/reviewers/index.js";
69
+
70
+ // Iteration state
71
+ export {
72
+ DEFAULT_REVIEW_ITERATIONS,
73
+ deleteState,
74
+ getIterationState,
75
+ getStateFilePath,
76
+ loadState,
77
+ saveStateToPlan,
78
+ shouldContinueIterating,
79
+ updateIterationState,
80
+ } from "./state.js";
81
+
82
+ // Types & schemas
83
+ export type {
84
+ AgentConfig,
85
+ CcNativeState,
86
+ CombinedReviewResult,
87
+ ComplexityCategory,
88
+ DisplaySettings,
89
+ IterationEntry,
90
+ IterationState,
91
+ OrchestratorConfig,
92
+ OrchestratorResult,
93
+ PlanReviewConfig,
94
+ PlanReviewState,
95
+ QuestionsAskedState,
96
+ ReviewData,
97
+ ReviewDecision,
98
+ ReviewDecisionResult,
99
+ Reviewer,
100
+ ReviewerResult,
101
+ ReviewIssue,
102
+ ReviewOptions,
103
+ Verdict,
104
+ } from "./types.js";
105
+
106
+ export {
107
+ AGENT_REVIEW_PROMPT_PREFIX,
108
+ DEFAULT_DISPLAY,
109
+ DEFAULT_SANITIZATION,
110
+ ORCHESTRATOR_SCHEMA,
111
+ REVIEW_PROMPT_PREFIX,
112
+ REVIEW_SCHEMA,
113
+ } from "./types.js";
114
+
115
+ // Verdict aggregation
116
+ export { computeReviewDecision, worstVerdict } from "../plan-review/lib/verdict.js";
@@ -163,7 +163,7 @@ export function loadAgentLibrary(
163
163
  projDir: string,
164
164
  settings?: Record<string, unknown>,
165
165
  ): AgentConfig[] {
166
- const agentsData = aggregateAgents(path.join(projDir, "_cc-native", "agents", "plan-review"));
166
+ const agentsData = aggregateAgents(path.join(projDir, "_cc-native", "plan-review", "agents", "plan-review"));
167
167
  const defaultModel = settings?.agentDefaults?.model ?? DEFAULT_AGENT_MODEL;
168
168
 
169
169
  if (!agentsData || agentsData.length === 0) {