cc-codeconductor 0.5.0 → 1.0.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.
Files changed (174) hide show
  1. package/README.md +95 -95
  2. package/dist/cli/errors.d.ts +65 -0
  3. package/dist/core/compilation/compile-checker.d.ts +51 -0
  4. package/dist/core/config/codeconductor-config.d.ts +42 -0
  5. package/dist/core/config/config-loader.d.ts +11 -0
  6. package/dist/core/filesystem/credential-guard.d.ts +18 -0
  7. package/dist/core/goal/goal-planner.d.ts +8 -0
  8. package/dist/core/goal/goal-state.d.ts +15 -0
  9. package/dist/core/loop/git-stats.d.ts +13 -0
  10. package/dist/core/loop/loop-engine.d.ts +79 -0
  11. package/dist/core/memory/episodic-store.d.ts +6 -0
  12. package/dist/core/memory/operational-state.d.ts +6 -0
  13. package/dist/core/orchestrator/runtime-orchestrator.d.ts +25 -0
  14. package/dist/core/planner/product-planner.d.ts +18 -0
  15. package/dist/core/presets/package-paths.d.ts +4 -0
  16. package/dist/core/product-graph/graph-store.d.ts +11 -0
  17. package/dist/core/product-graph/paths.d.ts +18 -0
  18. package/dist/core/verification/verification-runner.d.ts +57 -0
  19. package/dist/domain/loop/loop-state.d.ts +74 -0
  20. package/dist/domain/product/entities.d.ts +11 -0
  21. package/dist/index.d.ts +15 -0
  22. package/dist/index.js +21820 -15579
  23. package/dist/library.js +2595 -0
  24. package/dist/utils/result.d.ts +36 -0
  25. package/dist/validation/schemas.d.ts +3660 -0
  26. package/package.json +15 -2
  27. package/policy.yml +12 -11
  28. package/presets/agy/AGENTS.md +11 -5
  29. package/presets/agy/gates/pre-commit/GATE.md +136 -0
  30. package/presets/agy/skills/cc-fix/SKILL.md +2 -2
  31. package/presets/agy/skills/cc-tdd-cycle/SKILL.md +11 -0
  32. package/presets/agy/workflows/cc-api-contract.md +12 -0
  33. package/presets/agy/workflows/cc-ask.md +55 -0
  34. package/presets/agy/workflows/cc-clarify.md +33 -0
  35. package/presets/agy/workflows/cc-council.md +31 -7
  36. package/presets/agy/workflows/cc-db-migration.md +22 -9
  37. package/presets/agy/workflows/cc-explore.md +37 -0
  38. package/presets/agy/workflows/cc-feature.md +41 -19
  39. package/presets/agy/workflows/cc-fix.md +50 -23
  40. package/presets/agy/workflows/cc-handoff.md +42 -0
  41. package/presets/agy/workflows/cc-iterative.md +128 -0
  42. package/presets/agy/workflows/cc-openspec.md +13 -0
  43. package/presets/agy/workflows/cc-pagespeed.md +12 -0
  44. package/presets/agy/workflows/cc-prototype.md +39 -0
  45. package/presets/agy/workflows/cc-refactor.md +12 -0
  46. package/presets/agy/workflows/cc-review.md +12 -0
  47. package/presets/agy/workflows/cc-scorecard.md +12 -0
  48. package/presets/agy/workflows/cc-tdd-cycle.md +24 -0
  49. package/presets/agy/workflows/cc-test-plan.md +12 -0
  50. package/presets/agy/workflows/cc-triage.md +35 -0
  51. package/presets/claude/CLAUDE.md +64 -0
  52. package/presets/claude/commands/cc/api-contract.md +12 -0
  53. package/presets/claude/commands/cc/ask.md +55 -0
  54. package/presets/claude/commands/cc/clarify.md +32 -0
  55. package/presets/claude/commands/cc/council.md +87 -0
  56. package/presets/claude/commands/cc/db-migration.md +22 -9
  57. package/presets/claude/commands/cc/explore.md +36 -0
  58. package/presets/claude/commands/cc/feature.md +49 -22
  59. package/presets/claude/commands/cc/fix.md +74 -20
  60. package/presets/claude/commands/cc/handoff.md +44 -0
  61. package/presets/claude/commands/cc/iterative.md +132 -0
  62. package/presets/claude/commands/cc/openspec.md +25 -0
  63. package/presets/claude/commands/cc/pagespeed.md +12 -0
  64. package/presets/claude/commands/cc/prototype.md +38 -0
  65. package/presets/claude/commands/cc/refactor.md +152 -1
  66. package/presets/claude/commands/cc/review.md +78 -16
  67. package/presets/claude/commands/cc/scorecard.md +12 -0
  68. package/presets/claude/commands/cc/tdd-cycle.md +53 -3
  69. package/presets/claude/commands/cc/test-plan.md +12 -0
  70. package/presets/claude/commands/cc/triage.md +34 -0
  71. package/presets/claude/gates/pre-commit/GATE.md +136 -0
  72. package/presets/claude/settings.json +8 -46
  73. package/presets/codex/AGENTS.md +6 -6
  74. package/presets/codex/commands/cc-ask.md +55 -0
  75. package/presets/codex/gates/pre-commit/GATE.md +136 -0
  76. package/presets/cursor/AGENTS.md +6 -6
  77. package/presets/cursor/agents/business-agent.md +44 -0
  78. package/presets/cursor/agents/continuous-architect.md +37 -0
  79. package/presets/cursor/agents/docs.md +1 -0
  80. package/presets/cursor/agents/goal-planner.md +1 -1
  81. package/presets/cursor/agents/impact-analyst.md +43 -0
  82. package/presets/cursor/agents/orchestrator.md +6 -6
  83. package/presets/cursor/commands/cc/api-contract.md +12 -0
  84. package/presets/cursor/commands/cc/ask.md +55 -0
  85. package/presets/cursor/commands/cc/clarify.md +32 -0
  86. package/presets/cursor/commands/cc/council.md +87 -0
  87. package/presets/cursor/commands/cc/db-migration.md +22 -9
  88. package/presets/cursor/commands/cc/explore.md +36 -0
  89. package/presets/cursor/commands/cc/feature.md +41 -19
  90. package/presets/cursor/commands/cc/fix.md +47 -20
  91. package/presets/cursor/commands/cc/handoff.md +41 -0
  92. package/presets/cursor/commands/cc/iterative.md +133 -0
  93. package/presets/cursor/commands/cc/openspec.md +22 -7
  94. package/presets/cursor/commands/cc/pagespeed.md +12 -0
  95. package/presets/cursor/commands/cc/prototype.md +38 -0
  96. package/presets/cursor/commands/cc/refactor.md +12 -0
  97. package/presets/cursor/commands/cc/review.md +12 -0
  98. package/presets/cursor/commands/cc/scorecard.md +12 -0
  99. package/presets/cursor/commands/cc/tdd-cycle.md +24 -0
  100. package/presets/cursor/commands/cc/test-plan.md +12 -0
  101. package/presets/cursor/commands/cc/triage.md +34 -0
  102. package/presets/cursor/gates/pre-commit/GATE.md +136 -0
  103. package/presets/cursor/rules/orchestration.mdc +1 -1
  104. package/presets/opencode/agents/architect.md +22 -1
  105. package/presets/opencode/agents/complexity-auditor.md +16 -1
  106. package/presets/opencode/agents/contract-builder.md +17 -1
  107. package/presets/opencode/agents/devil.md +158 -0
  108. package/presets/opencode/agents/docs.md +19 -1
  109. package/presets/opencode/agents/goal-planner.md +32 -2
  110. package/presets/opencode/agents/implementer.md +32 -2
  111. package/presets/opencode/agents/orchestrator.md +79 -12
  112. package/presets/opencode/agents/planner.md +61 -0
  113. package/presets/opencode/agents/repo-explorer.md +16 -0
  114. package/presets/opencode/agents/reviewer.md +33 -3
  115. package/presets/opencode/agents/security-reviewer.md +31 -1
  116. package/presets/opencode/agents/task-coach.md +69 -1
  117. package/presets/opencode/agents/tester.md +18 -1
  118. package/presets/opencode/commands/cc-api-contract.md +12 -0
  119. package/presets/opencode/commands/cc-ask.md +55 -0
  120. package/presets/opencode/commands/cc-clarify.md +31 -0
  121. package/presets/opencode/commands/cc-council.md +87 -0
  122. package/presets/opencode/commands/cc-db-migration.md +22 -9
  123. package/presets/opencode/commands/cc-explore.md +35 -0
  124. package/presets/opencode/commands/cc-feature.md +41 -19
  125. package/presets/opencode/commands/cc-fix.md +50 -23
  126. package/presets/opencode/commands/cc-handoff.md +40 -0
  127. package/presets/opencode/commands/cc-iterative.md +127 -0
  128. package/presets/opencode/commands/cc-openspec.md +13 -0
  129. package/presets/opencode/commands/cc-pagespeed.md +12 -0
  130. package/presets/opencode/commands/cc-prototype.md +37 -0
  131. package/presets/opencode/commands/cc-refactor.md +12 -0
  132. package/presets/opencode/commands/cc-review.md +12 -0
  133. package/presets/opencode/commands/cc-scorecard.md +12 -0
  134. package/presets/opencode/commands/cc-tdd-cycle.md +24 -0
  135. package/presets/opencode/commands/cc-test-plan.md +12 -0
  136. package/presets/opencode/commands/cc-triage.md +33 -0
  137. package/presets/opencode/gates/pre-commit/GATE.md +136 -0
  138. package/presets/opencode/prompts/v0.1.0/DEPRECATED.md +11 -0
  139. package/presets/opencode/prompts/v0.2.0/DEPRECATED.md +11 -0
  140. package/presets/opencode/prompts/v0.3.0/DEPRECATED.md +11 -0
  141. package/presets/opencode/prompts/v0.4.0/DEPRECATED.md +11 -0
  142. package/presets/opencode/prompts/v0.5.0/goal-planner.md +1 -1
  143. package/presets/opencode/prompts/v0.5.0/orchestrator.md +6 -6
  144. package/presets/opencode/prompts/v0.6.0/implementer.md +35 -0
  145. package/presets/opencode/prompts/v0.6.0/planner.md +36 -0
  146. package/presets/opencode/prompts/v0.6.0/reviewer.md +40 -0
  147. package/presets/opencode/prompts/v1.0.0/README.md +47 -0
  148. package/presets/opencode/prompts/v1.0.0/architect.md +259 -0
  149. package/presets/opencode/prompts/v1.0.0/complexity-auditor.md +116 -0
  150. package/presets/opencode/prompts/v1.0.0/contract-builder.md +120 -0
  151. package/presets/opencode/prompts/v1.0.0/devil.md +169 -0
  152. package/presets/opencode/prompts/v1.0.0/docs.md +229 -0
  153. package/presets/opencode/prompts/v1.0.0/goal-planner.md +123 -0
  154. package/presets/opencode/prompts/v1.0.0/implementer.md +228 -0
  155. package/presets/opencode/prompts/v1.0.0/orchestrator.md +474 -0
  156. package/presets/opencode/prompts/v1.0.0/planner.md +72 -0
  157. package/presets/opencode/prompts/v1.0.0/repo-explorer.md +147 -0
  158. package/presets/opencode/prompts/v1.0.0/reviewer.md +295 -0
  159. package/presets/opencode/prompts/v1.0.0/security-reviewer.md +170 -0
  160. package/presets/opencode/prompts/v1.0.0/task-coach.md +235 -0
  161. package/presets/opencode/prompts/v1.0.0/tester.md +298 -0
  162. package/presets/seo-hotel/settings.json +0 -17
  163. package/src/presets/manifests/agy.yml +2 -2
  164. package/src/presets/manifests/claude.yml +2 -2
  165. package/src/presets/manifests/codex.yml +2 -2
  166. package/src/presets/manifests/cursor.yml +2 -2
  167. package/src/presets/manifests/gemini.yml +2 -2
  168. package/src/presets/manifests/opencode.yml +2 -2
  169. package/src/presets/models/agy.yml +93 -66
  170. package/src/presets/models/claude.yml +79 -53
  171. package/src/presets/models/codex.yml +79 -54
  172. package/src/presets/models/cursor.yml +72 -58
  173. package/src/presets/models/gemini.yml +79 -53
  174. package/src/presets/models/opencode.yml +72 -46
@@ -0,0 +1,18 @@
1
+ export declare const PRODUCT_DIR = ".codeconductor";
2
+ export declare const PRODUCT_GRAPH_FILE = "product-graph.json";
3
+ export declare const PRODUCT_META_FILE = "product-meta.json";
4
+ export declare const EVENTS_FILE = "events.jsonl";
5
+ export declare const OPERATIONAL_STATE_FILE = "operational-state.json";
6
+ export declare const STRATEGIC_FILE = "strategic.json";
7
+ export declare const PRODUCT_REPORT_FILE = "product-report.md";
8
+ export declare const FEEDBACK_SOURCES_FILE = "feedback-sources.yml";
9
+ export declare const DECISIONS_DIR = "decisions";
10
+ export declare const EVIDENCE_DIR = "evidence";
11
+ export declare function productGraphPath(projectRoot: string): string;
12
+ export declare function productMetaPath(projectRoot: string): string;
13
+ export declare function eventsPath(projectRoot: string): string;
14
+ export declare function operationalStatePath(projectRoot: string): string;
15
+ export declare function strategicPath(projectRoot: string): string;
16
+ export declare function productReportPath(projectRoot: string): string;
17
+ export declare function decisionsDir(projectRoot: string): string;
18
+ export declare function evidenceDir(projectRoot: string): string;
@@ -0,0 +1,57 @@
1
+ import type { GoalGraphInput } from '../../validation/schemas';
2
+ import type { TddSuiteEvidence } from '../../domain/loop/loop-state';
3
+ import { type Result } from '../../utils/result';
4
+ export interface VerificationCheck {
5
+ name: string;
6
+ passed: boolean;
7
+ message: string;
8
+ }
9
+ /**
10
+ * Check that ids handed to a completion really name evidence of this task.
11
+ *
12
+ * Every id must resolve to a stored record that parses as `EvidenceSchema`,
13
+ * carries that exact id, is related to this task and records a passing result —
14
+ * and at least one cited id must be a passing `verification` record, so
15
+ * supporting test/review evidence alone cannot stand in for verification.
16
+ */
17
+ export declare function validateEvidenceIds(projectRoot: string, taskId: string, evidenceIds: string[]): Promise<Result<void, Error>>;
18
+ export interface RunVerificationOptions {
19
+ /**
20
+ * Explicit trust to execute the compile command configured by the analyzed
21
+ * project itself (`.codeconductor/config.yml`). Without this opt-in the
22
+ * command is executed only if it matches the compile allowlist
23
+ * (`tsc`, `bun run`, `npm test`, …). Anything else fails closed.
24
+ */
25
+ readonly allowCompileCheck?: boolean;
26
+ }
27
+ export declare function runVerification(projectRoot: string, taskId: string, goal?: GoalGraphInput, options?: RunVerificationOptions): Promise<Result<{
28
+ passed: boolean;
29
+ checks: VerificationCheck[];
30
+ evidenceIds: string[];
31
+ }, Error>>;
32
+ /**
33
+ * Decide whether a task may be completed.
34
+ *
35
+ * A requirement is only satisfied by evidence of the matching type whose
36
+ * payload proves success. Unknown requirements, missing evidence and
37
+ * unreadable evidence all block completion.
38
+ */
39
+ export declare function gateTaskCompletion(projectRoot: string, taskId: string, evidenceRequired: string[], evidenceIds?: string[]): Promise<Result<boolean, Error>>;
40
+ export interface CaptureTddSuiteOptions extends RunVerificationOptions {
41
+ /** Allowlisted test command (`bun test`, `npm test`, …). */
42
+ readonly command: string;
43
+ }
44
+ /**
45
+ * Run a test suite and store TDD evidence. Only this function writes records
46
+ * that `tddCycleStateMachine` will accept as RED/GREEN gates.
47
+ */
48
+ export declare function captureTddSuiteEvidence(projectRoot: string, taskId: string, options: CaptureTddSuiteOptions): Promise<Result<{
49
+ evidenceId: string;
50
+ suiteFailed: boolean;
51
+ suitePassed: boolean;
52
+ }, Error>>;
53
+ /**
54
+ * Load TDD suite evidence written by `captureTddSuiteEvidence`. Hand-edited
55
+ * files (wrong source/type/`capturedBy`) are rejected.
56
+ */
57
+ export declare function loadTddSuiteEvidence(projectRoot: string, taskId: string, evidenceId: string): Promise<Result<TddSuiteEvidence, Error>>;
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Loop State Machine — pure state transitions for compile-fix iteration cycles.
3
+ *
4
+ * Phases: IDLE → RUNNING → CHECKING → FEEDBACK → (back to RUNNING or DONE/FAILED/ESCALATED)
5
+ */
6
+ import type { CompileError } from '../../core/compilation/compile-checker';
7
+ export type LoopPhase = 'IDLE' | 'RUNNING' | 'CHECKING' | 'FEEDBACK' | 'DONE' | 'FAILED' | 'ESCALATED';
8
+ export interface LoopState {
9
+ readonly phase: LoopPhase;
10
+ readonly iteration: number;
11
+ readonly maxIterations: number;
12
+ readonly errors: readonly CompileError[];
13
+ readonly errorHistory: readonly (readonly CompileError[])[];
14
+ readonly tokenBudgetUsed: number;
15
+ readonly maxTokenBudget: number;
16
+ }
17
+ export type LoopAction = {
18
+ readonly type: 'START';
19
+ } | {
20
+ readonly type: 'CODE_GENERATED';
21
+ } | {
22
+ readonly type: 'COMPILE_CHECK_COMPLETED';
23
+ readonly errors: readonly CompileError[];
24
+ } | {
25
+ readonly type: 'FEEDBACK_FORMATTED';
26
+ } | {
27
+ readonly type: 'TOKEN_BUDGET_EXCEEDED';
28
+ readonly tokenUsage: number;
29
+ } | {
30
+ readonly type: 'ABORT';
31
+ };
32
+ export type LoopActionResult = 'CONTINUE' | 'TERMINATE';
33
+ /**
34
+ * Create an initial LoopState with sensible defaults.
35
+ */
36
+ export declare function createInitialState(overrides?: Partial<LoopState>): LoopState;
37
+ /**
38
+ * Pure state machine — given a state and an action, returns the new state.
39
+ * No side effects. Logs are the caller's responsibility.
40
+ */
41
+ export declare function loopStateMachine(state: LoopState, action: LoopAction): {
42
+ state: LoopState;
43
+ result: LoopActionResult;
44
+ };
45
+ /**
46
+ * Evidence payload that may advance TDD phases. Only records written by
47
+ * `captureTddSuiteEvidence` set `capturedBy: 'verification-runner'`.
48
+ */
49
+ export interface TddSuiteEvidence {
50
+ readonly capturedBy: string;
51
+ readonly suiteFailed: boolean;
52
+ readonly suitePassed: boolean;
53
+ }
54
+ export type TddPhase = 'RED' | 'GREEN' | 'REFACTOR' | 'FAILED';
55
+ export interface TddState {
56
+ readonly phase: TddPhase;
57
+ readonly evidenceIds: readonly string[];
58
+ }
59
+ export type TddAction = {
60
+ readonly type: 'SUITE_EVIDENCE';
61
+ readonly evidenceId: string;
62
+ readonly evidence: TddSuiteEvidence;
63
+ } | {
64
+ readonly type: 'ABORT';
65
+ };
66
+ export declare function createInitialTddState(): TddState;
67
+ /**
68
+ * Guarded TDD phase machine. RED→GREEN needs a failing suite captured by the
69
+ * verification runner; GREEN→REFACTOR needs a passing suite from the same source.
70
+ */
71
+ export declare function tddCycleStateMachine(state: TddState, action: TddAction): {
72
+ state: TddState;
73
+ result: LoopActionResult;
74
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Product OS entity taxonomy — pure types for the product AST.
3
+ * Persisted forms are validated via Zod schemas in validation/schemas.ts.
4
+ */
5
+ export type ConfidenceLevel = 'low' | 'medium' | 'high';
6
+ export type ProductNodeType = 'product' | 'domain' | 'capability' | 'requirement' | 'decision' | 'component' | 'flow' | 'contract' | 'metric' | 'risk' | 'task' | 'evidence';
7
+ export type GraphRelation = 'implements' | 'depends_on' | 'documents' | 'affects' | 'evidences' | 'blocks' | 'contains';
8
+ export type MemoryLayer = 'operational' | 'semantic' | 'episodic' | 'procedural' | 'strategic';
9
+ export type ProductEventType = 'task.started' | 'task.completed' | 'decision.recorded' | 'evidence.added' | 'ingest.completed' | 'goal.updated' | 'blocker.detected' | 'verification.completed' | 'feedback.processed';
10
+ export declare const PRODUCT_NODE_TYPES: readonly ProductNodeType[];
11
+ export declare const GRAPH_RELATIONS: readonly GraphRelation[];
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Public library surface for CodeConductor.
3
+ *
4
+ * CLI remains `dist/index.js` (`bin`). This module is the programmatic API.
5
+ * Do not re-export `infrastructure/` or `*-internal` modules.
6
+ */
7
+ export { getReadyTasks, goalTaskToCanonicalCard, buildTaskEnvelope, getNextTask, startTask, completeTask, rollbackTaskStatus, formatGoalStatus, } from './core/orchestrator/runtime-orchestrator';
8
+ export type { OrchestratorNextResult } from './core/orchestrator/runtime-orchestrator';
9
+ export { LoopEngine, runLoop, runLoopForProject, shouldRunAgentLoop, formatFeedback, advanceTddPhase, } from './core/loop/loop-engine';
10
+ export type { LoopConfig, LoopResult, EscalationReport, GuardrailHit, GenerateFn, CompileCheckFn, } from './core/loop/loop-engine';
11
+ export { runVerification, gateTaskCompletion, validateEvidenceIds, captureTddSuiteEvidence, loadTddSuiteEvidence, } from './core/verification/verification-runner';
12
+ export type { RunVerificationOptions, VerificationCheck, CaptureTddSuiteOptions, } from './core/verification/verification-runner';
13
+ export * from './validation/schemas';
14
+ export { createInitialState, loopStateMachine, createInitialTddState, tddCycleStateMachine, } from './domain/loop/loop-state';
15
+ export type { LoopPhase, LoopState, LoopAction, LoopActionResult, TddPhase, TddState, TddAction, TddSuiteEvidence, } from './domain/loop/loop-state';