Skip to content

feat: map-and-preserve strategy for frontmatter conversion#60

Merged
marcusrbrown merged 6 commits into
mainfrom
feat/frontmatter-conversion-improvements
Feb 10, 2026
Merged

feat: map-and-preserve strategy for frontmatter conversion#60
marcusrbrown merged 6 commits into
mainfrom
feat/frontmatter-conversion-improvements

Conversation

@marcusrbrown
Copy link
Copy Markdown
Owner

Summary

  • Converter rewrite: Replace destructive field-stripping (removeFields/CC_ONLY_* constants) with non-destructive map-and-preserve strategy. CEP fields are now mapped to OpenCode equivalents (tools[] → tool permissions map, maxStepssteps, permissionModePermissionConfig), and unknown fields pass through untouched.
  • Manifest system: Add sync-manifest.json provenance tracking with JSON Schema, src/lib/manifest.ts module (read/write/validate/stale detection), and 16 unit tests. Empty manifest ships as starting point.
  • Bootstrap fix: Correct TodoWritetodowrite mapping (was incorrectly update_plan).

Changes

Phase 1: Converter Changes

File Change
src/lib/converter.ts Core rewrite: 6 new mapping functions, 2 lookup tables (TOOL_NAME_MAP, PERMISSION_MODE_MAP), CONVERTER_VERSION=2 cache key
src/lib/validation.ts Extended PermissionConfig with task and skill fields
src/lib/agents.ts maxStepssteps, added hidden to AgentFrontmatter
src/lib/config-handler.ts Updated loadAgentAsConfig() for steps/hidden
src/lib/bootstrap.ts Fixed TodoWrite tool name mapping

Phase 2: Manifest System

File Change
src/lib/manifest.ts New module: types, read/write/validate/stale detection
sync-manifest.json Empty manifest with $schema reference
sync-manifest.schema.json JSON Schema (draft 2020-12) for validation

Tests

  • 57 new tests (41 converter unit, 7 idempotency, 16 manifest, integration updates)
  • 323 total tests pass, 0 regressions
  • Typecheck, lint, and build all clean

Documentation

  • Brainstorm document capturing design exploration
  • Compound solution doc for institutional knowledge
  • Plan document with acceptance criteria checked off

Deferred (Phase 3)

  • sync-definitions project skill for automated manifest population
  • Manifest entries for existing bundled definitions (requires manual upstream research)
  • Docs site conversion guide updates

Replace destructive field stripping with non-destructive map-and-preserve:
- Agent transform copies all fields, then maps known CC→OC equivalents
- CC tools arrays → OC tools maps with canonical name mapping
- CC permissionMode → OC permission via explicit mapping table
- CC maxTurns/maxSteps → OC steps (min strategy, positive integer validation)
- CC disable-model-invocation → OC hidden
- Skills/commands preserve all fields (CC_ONLY constants removed)
- Model normalization applied to skills (not just agents/commands)
- context: fork → subtask: true mapping for skills
- Parse errors now still transform body content
- Converter cache versioned for invalidation on logic changes
- PermissionConfig extended with task/skill keys
- maxSteps renamed to steps across AgentFrontmatter and config-handler
Add provenance manifest for tracking upstream definition sources:
- SyncManifest types with ManifestSource and ManifestDefinition interfaces
- Read/write/validate functions with type guard validation
- findStaleEntries for detecting orphaned manifest entries
- JSON Schema for editor autocomplete and CI validation
- Empty manifest at repo root with schema reference
- 16 unit tests covering read, write, validate, stale detection
… sync

- bootstrap.ts: TodoWrite → todowrite (was incorrectly update_plan)
- converter.ts: clarify TOOL_NAME_MAP must stay in sync with TOOL_MAPPINGS
- Add brainstorm doc capturing the design exploration for map-and-preserve strategy
- Add compound solution doc for destructive-to-nondestructive converter transformation
- Create docs/solutions/best-practices/ directory for compound-docs workflow
Revise CEP-to-OpenCode conversion guide to document the new non-destructive
frontmatter handling. CC fields are now mapped to OC equivalents or passed
through rather than stripped.

- Add permission mode and tools array mapping tables
- Document maxSteps→steps, disable-model-invocation→hidden mappings
- Update field action language (Map/Pass through vs REMOVE)
- Clarify unknown fields pass through untouched
@marcusrbrown marcusrbrown enabled auto-merge (squash) February 10, 2026 04:10
@marcusrbrown marcusrbrown merged commit 520fc6d into main Feb 10, 2026
9 checks passed
@marcusrbrown marcusrbrown deleted the feat/frontmatter-conversion-improvements branch February 10, 2026 04:11
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