Skip to content

bootstrap rewrites .mcp.json formatting and overwrites a hand-edited charter-governance.yml with no backup #374

Closed

Description

@stackbilt-admin

Found in the #373 review (#369/#370). Two overwrite paths in charter bootstrap, both already on main, still write files with no backup:

  1. .mcp.json reformatting. When .mcp.json exists but has no mcpServers.charter entry, ensureProjectMcpConfig adds the entry and re-serializes the whole file with JSON.stringify(root, null, 2). The data is kept, but comments are not (JSONC isn't parsed at all, so that case fails earlier), and neither is key order, indentation or trailing formatting. No backup is written.
  2. bootstrap --ci github always overwrites .github/workflows/charter-governance.yml (applyManagedFile(..., true)), even when someone has edited it by hand. No backup, and the only output is an "Updated" line.

Suggested fix, consistent with #354/#369:

  • For .mcp.json, insert the entry without reformatting the rest of the file, or back it up to .charter/.backup/ before rewriting.
  • For the workflow, overwrite it only when it still matches a known Charter template (or carries a managed marker); otherwise keep it with a warning, and replace it under --force with a backup.

Both change what a released flag does, so they need a CHANGELOG note.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions