Skip to content

Define Pack Schema v1 for execution briefs - #302

Merged
mohanagy merged 2 commits into
nextfrom
issue-294-pack-schema-v1
May 25, 2026
Merged

mohanagy merged 2 commits into
nextfrom
issue-294-pack-schema-v1

Conversation

@mohanagy

@mohanagy mohanagy commented May 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add a typed Pack Schema v1 envelope for madar pack with stable execution-brief sections
  • add --format json|text so the same pack can be consumed as machine-readable JSON or rendered text
  • document the new schema surface and lock it with parser and command tests

Closes #294

Summary by CodeRabbit

  • New Features

    • Added --format option to madar pack command, supporting json and text output modes (default: json).
    • Introduced Pack Schema v1, a versioned envelope providing structured context-pack output with enhanced metadata and guidance.
  • Documentation

    • Updated README with examples of the new --format option and Pack Schema v1 details.

Review Change Stack

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented May 25, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@mohanagy, we couldn't start this review because you've used your available PR reviews for now.

Your plan includes 10 reviews of capacity. Refill in 10 minutes and 57 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8df8ebe9-68e7-4f32-8134-2e0ea9b2c6ab

📥 Commits

Reviewing files that changed from the base of the PR and between 67f0722 and 1dcadb1.

📒 Files selected for processing (8)
  • .coderabbit.yaml
  • README.md
  • src/cli/main.ts
  • src/cli/parser.ts
  • src/contracts/context-pack.ts
  • src/infrastructure/context-pack-command.ts
  • tests/unit/cli.test.ts
  • tests/unit/context-pack-command.test.ts
📝 Walkthrough

Walkthrough

This PR introduces Pack Schema v1, a formal versioned contract for context-pack output. It adds a CLI --format option to emit JSON or text, wraps all task outputs in a typed schema envelope containing metadata like workflow centers, recommended first reads, public contracts, confidence scores, and "why" explanations, and updates documentation.

Changes

Pack Schema v1 Type System and Output

Layer / File(s) Summary
Schema Contracts and Format Types
src/contracts/context-pack.ts
Introduces ContextPackFormat union type ('json' | 'text') and four new exported interfaces: ContextPackWorkflowCenter, ContextPackRecommendedFirstRead, ContextPackPublicContract, and ContextPackSchemaV1<TPack> defining the versioned pack envelope with task metadata, file hints, public contracts, risk boundaries, validation commands, confidence, and "why" explanation fields.
CLI --format Option Parsing and Help
src/cli/main.ts, src/cli/parser.ts, tests/unit/cli.test.ts
Adds --format MODE help text and parser support for json|text with default json; extends PackCliOptions interface with optional format field; implements validation via new parseContextPackFormat helper; covered by CLI unit tests verifying space-separated and equals-form invocations and rejecting invalid formats.
Schema v1 Generation and Rendering Pipeline
src/infrastructure/context-pack-command.ts, tests/unit/context-pack-command.test.ts
Expands imports and introduces type aliases for pack payloads; adds schema v1 generation pipeline deriving workflow centers, recommended first reads, public contracts, negative guidance, confidence scores, and "why" explanations; updates all three task branches (explain/review/impact) to wrap responses in versioned envelope via renderContextPackOutput(options.format, buildPackSchemaV1(...)); covered by JSON and text output mode unit tests asserting determinism and expected schema fields/sections.
Documentation and Examples
README.md
Updates examples to show madar pack --format text and madar pack --format json usage; adds "Pack Schema v1" section describing the JSON envelope structure and text rendering; adjusts "Common commands" section to reflect new invocation surface.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • mohanagy/madar#279: Adds implementation guidance payload for task: 'implement', which this PR wraps and serializes under the new Pack Schema v1 and text-rendering path.
  • mohanagy/madar#271: Extends context-pack contracts around execution-phase taxonomy; this PR's schema envelope directly encompasses and types that updated phase coverage.
  • mohanagy/madar#272: Introduces routing-debug contracts and generation; this PR adds optional routing-debug payload to Pack Schema v1 output using those same contracts.

Poem

🐰 A schema springs to life, all formal and spry,
With workflow centers and reasons the "why"—
JSON and text in a versioned embrace,
Each pack now a brief, each task finds its place! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: introducing a versioned Pack Schema v1 for execution briefs, which is the primary objective of this PR.
Description check ✅ Passed The PR description covers the key changes (Schema v1, --format option, testing), includes a reference to the closed issue (#294), and follows the template structure with Summary section.
Linked Issues check ✅ Passed The PR meets all required acceptance criteria from issue #294: introduces typed Pack Schema v1, emits required sections (schema_version, task, workflow_centers, etc.), supports both JSON and text formats, includes parser/command tests, and documents the schema.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing Pack Schema v1 and the --format option. The .coderabbit.yaml addition is a configuration change consistent with the repository setup and is not out of scope.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-294-pack-schema-v1

Comment @coderabbitai help to get the list of available commands and usage tips.

@mohanagy

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit 9ad6812)
@mohanagy

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown
✅ Actions performed

Full review triggered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant