Skip to content

feat(sync): ensure front matter consistency for monorepo specs#844

Open
TimJi wants to merge 3 commits intoFission-AI:mainfrom
TimJi:feat/monorepo-spec-frontmatter
Open

feat(sync): ensure front matter consistency for monorepo specs#844
TimJi wants to merge 3 commits intoFission-AI:mainfrom
TimJi:feat/monorepo-spec-frontmatter

Conversation

@TimJi
Copy link

@TimJi TimJi commented Mar 16, 2026

Problem

In monorepo projects, specs need YAML front matter (e.g., app: web-dashboard, app: api-server) to indicate which app/package they belong to. When syncing delta specs to main specs via opsx:sync or opsx:archive, newly created specs don't inherit this
convention — leading to inconsistent specs that are missing their app label.

Solution

Add a front matter consistency step (step 3e) to the sync workflow. After syncing, it checks whether existing main specs use front matter and applies the same pattern to newly synced specs.

Decision flow:

openspec/config.yaml has monorepoAppLabel: false?
→ skip (user opted out)

Existing specs have front matter?
→ yes: apply same pattern to new specs
→ no + single-app project: skip
→ no + monorepo detected: prompt user
→ "Establish convention": apply app: , future syncs auto-detect
→ "Skip and don't ask again": write monorepoAppLabel: false to config.yaml

Changes

File Change
sync-specs.ts Step 3e: full front matter consistency logic (both skill + command templates)
archive-change.ts Reference sync step 3e after sync (both skill + command templates)
bulk-archive-change.ts Reference sync step 3e after sync (both skill + command templates)

Design decisions

  • Logic lives in sync only — archive and bulk-archive reference it, avoiding duplication
  • Convention-based, not prescriptive — samples existing specs to detect the pattern rather than hardcoding a specific front matter schema
  • Opt-out is persistentmonorepoAppLabel: false in openspec/config.yaml prevents repeated prompts
  • Single-app projects are unaffected — skips entirely when no monorepo is detected

Summary by CodeRabbit

  • Improvements
    • Automatic front-matter consistency when syncing specs: newly synced specs will align with existing front-matter conventions.
    • New project setting to opt out of monorepo front-matter conventions, with adaptive behavior for monorepos vs single-app projects and an option to establish conventions when detected.

@TimJi TimJi requested a review from TabishB as a code owner March 16, 2026 03:00
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3b20d129-36fe-4731-aa3b-8f65ce7613ec

📥 Commits

Reviewing files that changed from the base of the PR and between fcd8f50 and 8582ce4.

📒 Files selected for processing (3)
  • src/core/project-config.ts
  • src/core/templates/workflows/archive-change.ts
  • src/core/templates/workflows/sync-specs.ts

📝 Walkthrough

Walkthrough

Added a new "Ensure front matter consistency" step to sync-specs workflows and referenced that step from archive-change and bulk-archive-change templates; introduced an optional monorepo field in project config to opt out of monorepo front-matter handling.

Changes

Cohort / File(s) Summary
Sync-specs workflow templates
src/core/templates/workflows/sync-specs.ts
Inserted step "e. Ensure front matter consistency" into both getSyncSpecsSkillTemplate and getOpsxSyncCommandTemplate: detects monorepo/config opt-out, inspects existing front matter patterns, applies patterns to new specs or prompts user to establish convention or opt out.
Archive workflow templates
src/core/templates/workflows/archive-change.ts, src/core/templates/workflows/bulk-archive-change.ts
Added notes after sync steps instructing to ensure front matter consistency on newly synced specs and referencing the sync-specs step for full logic.
Project config
src/core/project-config.ts
Added optional monorepo boolean to ProjectConfigSchema and parsing in readProjectConfig with safe-parse validation and warning on parse failure.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • TabishB

Poem

🐰 I hop through spec and YAML line,
I sniff monorepos, check each sign.
I ask, I label, or quietly skip,
A tidy front matter — a rabbit's nip. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(sync): ensure front matter consistency for monorepo specs' directly and clearly describes the main change—adding front matter consistency logic for monorepo specifications during sync workflows, which is the primary objective across all modified files.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Tip

CodeRabbit can enforce grammar and style rules using `languagetool`.

Configure the reviews.tools.languagetool setting to enable/disable rules and categories. Refer to the LanguageTool Community to learn more.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/core/templates/workflows/sync-specs.ts`:
- Around line 75-76: Replace hardcoded "openspec/config.yaml" writes in the
sync-specs template with logic that detects and updates the repo's existing
config file extension (.yml or .yaml) instead of creating a new file; locate the
string occurrences "openspec/config.yaml" in
src/core/templates/workflows/sync-specs.ts (both template blocks) and change the
template to determine the existing file name (check for openspec/config.yml
first, then openspec/config.yaml) and write updates to that discovered filename
(fall back to the repo's prevailing convention if neither exists). Ensure both
template blocks use the same configFileName variable so the opt-out update and
any other writes modify the existing config file in place rather than creating a
second file.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ff6741d8-bace-4e99-b089-652b9245eb45

📥 Commits

Reviewing files that changed from the base of the PR and between afdca0d and a74345f.

📒 Files selected for processing (3)
  • src/core/templates/workflows/archive-change.ts
  • src/core/templates/workflows/bulk-archive-change.ts
  • src/core/templates/workflows/sync-specs.ts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/core/templates/workflows/sync-specs.ts`:
- Around line 74-84: The template references a non-existent opt-out config field
monorepoAppLabel which is not part of ProjectConfigSchema and is ignored by
readProjectConfig(); fix by either (A) fully implementing the opt-out: add
monorepoAppLabel?: boolean to ProjectConfigSchema, update readProjectConfig() to
parse and return it via the ProjectConfig type, and then use that returned value
in the front-matter logic in sync-specs.ts (and archive-change.ts) where
monorepoAppLabel is currently checked; or (B) remove all monorepoAppLabel
references from sync-specs.ts and archive-change.ts and update the template text
to use an alternative opt-out (e.g., a flag file or CLI option) instead—choose
one approach and make consistent changes to the ProjectConfig type,
readProjectConfig(), and the front-matter prompt/logic (symbols to update:
ProjectConfigSchema, readProjectConfig, ProjectConfig type, and the
monorepoAppLabel checks in sync-specs.ts / archive-change.ts).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7c5ebdba-f1fb-49f5-8fae-86f67c192e14

📥 Commits

Reviewing files that changed from the base of the PR and between a74345f and fcd8f50.

📒 Files selected for processing (1)
  • src/core/templates/workflows/sync-specs.ts

…ectConfigSchema

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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