cadre-ai 3.0.1 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cadre",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "A human-governed, Git-aware product delivery harness for Codex and Claude Code.",
5
5
  "author": {
6
6
  "name": "Cadre contributors"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cadre",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "A human-governed, Git-aware product delivery harness for Codex and Claude Code.",
5
5
  "author": {
6
6
  "name": "Cadre contributors"
@@ -74,7 +74,7 @@ import { dirname, extname, join as join2, relative, resolve as resolve2, sep } f
74
74
  import { fileURLToPath } from "node:url";
75
75
 
76
76
  // src/domain/version.ts
77
- var CADRE_RUNTIME_VERSION = "3.0.1";
77
+ var CADRE_RUNTIME_VERSION = "3.0.2";
78
78
  var TEMPLATE_SET_VERSION = "v1";
79
79
 
80
80
  // src/domain/templates.ts
@@ -30994,7 +30994,7 @@ import { existsSync as existsSync4, lstatSync as lstatSync2, readFileSync as rea
30994
30994
  import { join as join2, resolve as resolve3 } from "node:path";
30995
30995
 
30996
30996
  // src/domain/version.ts
30997
- var CADRE_RUNTIME_VERSION = "3.0.1";
30997
+ var CADRE_RUNTIME_VERSION = "3.0.2";
30998
30998
  var TEMPLATE_SET_VERSION = "v1";
30999
30999
 
31000
31000
  // src/domain/plan.ts
@@ -31023,16 +31023,12 @@ function graphDigest(graph) {
31023
31023
  };
31024
31024
  return createHash("sha256").update(JSON.stringify(normalized)).digest("hex");
31025
31025
  }
31026
- function parsePlan(path, errors = []) {
31027
- if (!existsSync(path)) {
31028
- errors.push(`${path}: missing plan`);
31029
- return { specRevision: null, planRevision: null, phases: [], digest: graphDigest({ specRevision: null, planRevision: null, phases: [] }) };
31030
- }
31026
+ function parsePlanContent(content, sourceLabel, errors = []) {
31031
31027
  const phases = [];
31032
31028
  let specRevision = null;
31033
31029
  let planRevision = null;
31034
31030
  let currentTask = null;
31035
- const lines = readFileSync(path, "utf8").split(/\r?\n/);
31031
+ const lines = content.split(/\r?\n/);
31036
31032
  for (const [index, line] of lines.entries()) {
31037
31033
  const lineNumber = index + 1;
31038
31034
  const spec = line.match(/^- Spec revision: (\d+)$/);
@@ -31059,8 +31055,8 @@ function parsePlan(path, errors = []) {
31059
31055
  const phaseDependencies = line.match(/^- Phase dependencies: (.+)$/);
31060
31056
  if (phaseDependencies) {
31061
31057
  const phase = phases.at(-1);
31062
- if (!phase) errors.push(`${path}:${lineNumber}: phase dependencies appear before a phase`);
31063
- else if (phase.dependencyDeclared) errors.push(`${path}:${lineNumber}: ${phase.id} has duplicate phase dependencies`);
31058
+ if (!phase) errors.push(`${sourceLabel}:${lineNumber}: phase dependencies appear before a phase`);
31059
+ else if (phase.dependencyDeclared) errors.push(`${sourceLabel}:${lineNumber}: ${phase.id} has duplicate phase dependencies`);
31064
31060
  else {
31065
31061
  phase.dependencies = dependencyList(phaseDependencies[1]);
31066
31062
  phase.dependencyDeclared = true;
@@ -31070,7 +31066,7 @@ function parsePlan(path, errors = []) {
31070
31066
  const phaseCommit = line.match(/^- Phase completion commit: (pending|`([0-9a-f]{7,40})`)$/);
31071
31067
  if (phaseCommit) {
31072
31068
  const phase = phases.at(-1);
31073
- if (!phase) errors.push(`${path}:${lineNumber}: phase completion commit appears before a phase`);
31069
+ if (!phase) errors.push(`${sourceLabel}:${lineNumber}: phase completion commit appears before a phase`);
31074
31070
  else phase.completionCommit = phaseCommit[1] === "pending" ? null : phaseCommit[2];
31075
31071
  continue;
31076
31072
  }
@@ -31078,7 +31074,7 @@ function parsePlan(path, errors = []) {
31078
31074
  if (taskMatch) {
31079
31075
  const phase = phases.at(-1);
31080
31076
  if (!phase) {
31081
- errors.push(`${path}:${lineNumber}: task appears before a phase`);
31077
+ errors.push(`${sourceLabel}:${lineNumber}: task appears before a phase`);
31082
31078
  continue;
31083
31079
  }
31084
31080
  let title = taskMatch[5].trim();
@@ -31105,8 +31101,8 @@ function parsePlan(path, errors = []) {
31105
31101
  }
31106
31102
  const taskDependencies = line.match(/^ - Task dependencies: (.+)$/);
31107
31103
  if (taskDependencies) {
31108
- if (!currentTask) errors.push(`${path}:${lineNumber}: task dependencies do not follow a task`);
31109
- else if (currentTask.dependencyDeclared) errors.push(`${path}:${lineNumber}: ${currentTask.id} has duplicate task dependencies`);
31104
+ if (!currentTask) errors.push(`${sourceLabel}:${lineNumber}: task dependencies do not follow a task`);
31105
+ else if (currentTask.dependencyDeclared) errors.push(`${sourceLabel}:${lineNumber}: ${currentTask.id} has duplicate task dependencies`);
31110
31106
  else {
31111
31107
  currentTask.dependencies = dependencyList(taskDependencies[1]);
31112
31108
  currentTask.dependencyDeclared = true;
@@ -31116,6 +31112,13 @@ function parsePlan(path, errors = []) {
31116
31112
  const graphWithoutDigest = { specRevision, planRevision, phases };
31117
31113
  return { ...graphWithoutDigest, digest: graphDigest(graphWithoutDigest) };
31118
31114
  }
31115
+ function parsePlan(path, errors = []) {
31116
+ if (!existsSync(path)) {
31117
+ errors.push(`${path}: missing plan`);
31118
+ return { specRevision: null, planRevision: null, phases: [], digest: graphDigest({ specRevision: null, planRevision: null, phases: [] }) };
31119
+ }
31120
+ return parsePlanContent(readFileSync(path, "utf8"), path, errors);
31121
+ }
31119
31122
  function findCycles(nodes, owner, errors) {
31120
31123
  const ids = new Set(nodes.map((node) => node.id));
31121
31124
  const visiting = /* @__PURE__ */ new Set();
@@ -33172,6 +33175,16 @@ function serializableValidation(validation) {
33172
33175
  warnings: validation.warnings
33173
33176
  };
33174
33177
  }
33178
+ var PLAN_VALIDATION_STATUSES = [
33179
+ "drafting-spec",
33180
+ "drafting-plan",
33181
+ "planned",
33182
+ "in_progress",
33183
+ "ready_for_review",
33184
+ "completed",
33185
+ "archived"
33186
+ ];
33187
+ var MAX_DRAFT_PLAN_CHARACTERS = 256 * 1024;
33175
33188
  function createCadreServer() {
33176
33189
  const server = new McpServer(
33177
33190
  { name: "cadre", version: CADRE_RUNTIME_VERSION },
@@ -33289,6 +33302,26 @@ function createCadreServer() {
33289
33302
  return failure(error51);
33290
33303
  }
33291
33304
  });
33305
+ server.registerTool("execution_graph_validate_draft", {
33306
+ title: "Validate a draft execution graph",
33307
+ description: "Compile and validate an unapproved plan supplied as Markdown without reading or writing project files.",
33308
+ inputSchema: {
33309
+ planMarkdown: external_exports.string().min(1).max(MAX_DRAFT_PLAN_CHARACTERS),
33310
+ targetStatus: external_exports.enum(PLAN_VALIDATION_STATUSES),
33311
+ sourceLabel: external_exports.string().min(1).max(200).regex(/^[^\r\n]+$/).optional()
33312
+ },
33313
+ annotations: { readOnlyHint: true, openWorldHint: false }
33314
+ }, async ({ planMarkdown, targetStatus, sourceLabel }) => {
33315
+ try {
33316
+ const label = sourceLabel ?? "<draft-plan>";
33317
+ const errors = [];
33318
+ const graph = parsePlanContent(planMarkdown, label, errors);
33319
+ validatePlanGraph(label, graph, targetStatus, errors);
33320
+ return result({ valid: errors.length === 0, graph, errors });
33321
+ } catch (error51) {
33322
+ return failure(error51);
33323
+ }
33324
+ });
33292
33325
  const reviewCompleteSchema = {
33293
33326
  projectRoot: external_exports.string().min(1),
33294
33327
  trackId: external_exports.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cadre-ai",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "Cross-agent, human-governed software delivery harness",
5
5
  "author": {
6
6
  "name": "Vishal Kumar",
@@ -22,7 +22,7 @@ Expected human decision count is one per review cycle when the human accepts the
22
22
  1. Determine the commit range from the plan's recorded task commits. Inspect diffs and affected callers, tests, security boundaries, error paths, compatibility, acceptance criteria, and non-functional requirements.
23
23
  2. Run relevant verification without mutating production behavior. Report findings by severity with file/line evidence, impact, reproduction, and proposed acceptance criteria. Do not write a bug file yet.
24
24
  3. Prepare one decision-ready proposal before asking for approval:
25
- - If findings exist, call `template_get_many` for `track/bug`, retain the versioned result, and draft the exact bug artifact plus the recommended dependency-aware remediation phases for all actionable findings. Every regular task declares same-phase dependencies, every added phase declares the phases it consumes and ends in the derived `User Manual Verification` barrier. Renumber the final phase/tasks as needed, reset that final manual barrier and phase completion to pending, and preserve its prior verification provenance in the review cycle/execution journal rather than leaving a second final phase. Call `execution_graph_validate` on the draft.
25
+ - If findings exist, call `template_get_many` for `track/bug`, retain the versioned result, and draft the exact bug artifact plus the recommended dependency-aware remediation phases for all actionable findings. Every regular task declares same-phase dependencies, every added phase declares the phases it consumes and ends in the derived `User Manual Verification` barrier. Renumber the final phase/tasks as needed, reset that final manual barrier and phase completion to pending, and preserve its prior verification provenance in the review cycle/execution journal rather than leaving a second final phase. Call `execution_graph_validate_draft` with the complete proposed plan Markdown and target status `in_progress`; do not validate the stale canonical plan or create a temporary project copy.
26
26
  - Present the findings, exact artifact/plan diff, consequences, and choices together. One response may approve both the finding disposition and the unchanged exact artifacts. The human may instead request a subset or different remediation, reject all findings while explicitly accepting their risks and approve clean completion, or stop without mutation.
27
27
  - If the human changes the finding subset or remediation, rebuild and validate the exact proposal and request approval once for that changed proposal. Do not reuse approval for superseded content.
28
28
  - If no findings exist, present clean-review evidence and the exact completion transition once, then ask approval to complete the track.
@@ -25,7 +25,7 @@ Call `project_status` first and use its embedded structured validation; do not r
25
25
  3. Apply the workflow clarification gate. Ask when materially different interpretations remain for the desired outcome, scope, acceptance criteria, compatibility, dependency changes, treatment of completed or partial work, or whether dependent tracks should change now. Do not infer permission to invalidate approved work.
26
26
  4. Trace transitive dependent tracks. For each, classify impact as none, reseed-only, plan change, spec change, or invalidated work, with evidence. If evidence cannot resolve a material impact, ask before choosing a classification.
27
27
  5. Call `template_get_many` once for `track/revision` and `track/revise-operation`, and retain the versioned bundle. Render `revisions/revision-<ts>.md` and draft exact diffs for every affected artifact. Record source and target status, the base commit, affected phases/tasks, completed and partial-work disposition, review impact, dependency impact, and verification work. Preserve completed tasks and commit markers; append or explicitly supersede work rather than erasing provenance.
28
- 6. Increment the track revision exactly once. Increment the specification revision only if `spec.md` changes and the plan revision only if `plan.md` changes; keep the revision values in `state.json`, `spec.md`, `plan.md`, and the marked Pattern Seed consistent. Preserve completed task provenance, update explicit regular phase/task dependencies, restore derived manual-verification barriers, and call `execution_graph_validate`. A changed plan graph uses a new execution ID; never reuse a completed or superseded execution journal.
28
+ 6. Increment the track revision exactly once. Increment the specification revision only if `spec.md` changes and the plan revision only if `plan.md` changes; keep the revision values in `state.json`, `spec.md`, `plan.md`, and the marked Pattern Seed consistent. Preserve completed task provenance, update explicit regular phase/task dependencies, and restore derived manual-verification barriers. When the plan changes, call `execution_graph_validate_draft` with the complete proposed plan Markdown and the intended post-approval target status; do not validate the stale canonical plan or create a temporary project copy. A changed plan graph uses a new execution ID; never reuse a completed or superseded execution journal.
29
29
  7. Present the target revision and all cascading dependent-track changes together. Wait for explicit approval. Partial approval narrows the change set and requires a fresh impact assessment, transition calculation, and proposal.
30
30
  8. Before changing approved artifacts, write the rendered `revise` operation into every affected track's `state.json`. Use the same expected commit, record each approved artifact and per-artifact progress, and advance the durable checkpoint after each write.
31
31
  9. Apply only the approved changes, update relevant marked Pattern Seed sections without overwriting phase learning, set the approved source-to-target states, mark the earliest affected plan nodes pending in the replacement execution graph, and append track-local history. Do not add singular active phase/task fields to track state. Preview and apply `tracks.md` through `tracks_render_preview` and `tracks_render_apply` using the unchanged approved digest.
@@ -19,7 +19,7 @@ Call `project_status` first and use its embedded structured validation; do not r
19
19
  2. Apply the workflow clarification gate before drafting. Ask targeted questions whenever repository evidence and the request do not clearly establish a material choice such as feature versus bug, in/out of scope behavior, affected users/interfaces/data, compatibility or rollout expectations, acceptance measures, dependency tracks, or whether existing behavior must be preserved. Do not silently choose an interpretation.
20
20
  3. Call `template_get_many` once for `track/spec` and `track/state`. Retain the versioned bundle across approval turns. Render the functional requirements, non-functional requirements, acceptance criteria, additional information, and dependency impact. Present both proposed artifacts and wait for approval before writing or changing state.
21
21
  4. After approval, create/update track state with the spec operation journal before writing `spec.md`. Directly writing these approved track artifacts is intentional; do not search for an undeclared track-mutation MCP tool. Advance artifact checkpoints through written, then preview/apply the derived `tracks.md` update, call `state_validate`, require both canonical validity and current derived state, and advance to `commit-pending`. Commit as `cadre(track): specify <track-id>`, then record its SHA, clear the operation, move to `drafting-plan`, and commit the state record.
22
- 5. Call `template_get_many` once for `track/plan` and `track/learning`, retain the versioned bundle, then draft an acyclic phase/task graph. Every regular phase explicitly declares phase dependencies and every regular task explicitly declares same-phase task dependencies. Do not repeat derived barriers: each phase's final `User Manual Verification` depends on every sibling task, while the final `Track-level User Manual Verification` phase contains only its manual task and depends on every preceding phase. Include tests, formatting, documentation, and Definition of Done work explicitly. Call `execution_graph_validate`; resolve every unknown reference, cycle, missing declaration, or material ambiguity before approval.
22
+ 5. Call `template_get_many` once for `track/plan` and `track/learning`, retain the versioned bundle, then draft an acyclic phase/task graph. Every regular phase explicitly declares phase dependencies and every regular task explicitly declares same-phase task dependencies. Do not repeat derived barriers: each phase's final `User Manual Verification` depends on every sibling task, while the final `Track-level User Manual Verification` phase contains only its manual task and depends on every preceding phase. Include tests, formatting, documentation, and Definition of Done work explicitly. Call `execution_graph_validate_draft` with the proposed plan Markdown and target status `planned`; resolve every unknown reference, cycle, missing declaration, or material ambiguity before approval. Do not write an unapproved plan into `.cadre/` or create a temporary project copy for validation.
23
23
  6. Build the marked `Pattern Seed` section at the top of `learning.md` from patterns relevant to this spec and plan. Root phases read the seed; other phases read learning from their declared dependency phases. Cite pattern file paths and explain relevance. Do not invent patterns. Present the plan, graph, and learning seed for approval.
24
24
  7. After approval, journal the plan operation before writing `plan.md` and `learning.md`. Advance checkpoints through written, validated, and `commit-pending`; set track-local status to `planned`, call `tracks_render_preview`, present and apply its unchanged digest with `tracks_render_apply`, call `state_validate`, and commit `cadre(track): plan <track-id>`. Then record its SHA, clear the operation, set checkpoint `ready`, and commit `cadre(track): record plan <track-id>`.
25
25