Repository navigation
fix: preserve decisions.md and team.md content during export/import - #1130
Conversation
Export now includes decisions.md and team.md content in the manifest, and import writes that content back instead of empty strings. Also fixes a duplicate 'hasForce' variable declaration in index.cjs that caused a SyntaxError at runtime. Closes #1122 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes Squad CLI export/import so .squad/decisions.md and .squad/team.md content is preserved across round-trips, addressing the regression reported in #1122.
Changes:
- Export now includes
decisions.mdandteam.mdcontent in the JSON manifest. - Import now restores
decisions.mdandteam.mdfrom the manifest (with backward-compatible fallbacks). - Fixes a duplicate
const hasForcedeclaration inindex.cjsthat could cause a runtimeSyntaxError.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/squad-cli/src/cli/commands/import.ts | Adds optional manifest fields and writes restored decisions.md / team.md during import. |
| packages/squad-cli/src/cli/commands/export.ts | Reads decisions.md / team.md and includes them in the export manifest. |
| index.cjs | Mirrors the export/import manifest updates in the legacy entrypoint and removes the duplicate hasForce. |
| .changeset/fix-export-import-blank-files.md | Adds a patch changeset for the CLI fix. |
Comments suppressed due to low confidence (3)
packages/squad-cli/src/cli/commands/export.ts:53
- Export now includes additional project-specific content (decisions.md and team.md), but the post-export warning only mentions agent histories. Consider updating the warning/output to also call out decisions/team content so users reviewing the export know what else may contain sensitive info.
// Read top-level squad files (decisions.md, team.md)
const decisionsMd = path.join(squadInfo.path, 'decisions.md');
const decisionsContent = storage.readSync(decisionsMd);
if (decisionsContent !== undefined) {
manifest.decisions = decisionsContent;
}
const teamContent = storage.readSync(teamMd);
if (teamContent !== undefined) {
manifest.team = teamContent;
}
index.cjs:1161
- Import writes manifest.decisions/team without validating their types. Since manifest is user-provided JSON, consider verifying decisions/team are strings when present (otherwise fatal with a clear error) to avoid fs.writeFileSync throwing a TypeError at runtime.
// Write project-specific files from manifest (fall back to empty if not present)
fs.writeFileSync(path.join(aiTeamDir, 'decisions.md'), manifest.decisions || '');
fs.writeFileSync(path.join(aiTeamDir, 'team.md'), manifest.team || '');
packages/squad-cli/src/cli/commands/export.ts:53
- These new reads of decisions.md/team.md aren’t wrapped in the try/catch pattern used for casting/agents/skills reads. FSStorageProvider.readSync returns undefined for ENOENT but will throw for other I/O errors (e.g., permissions), which would now abort export. Consider catching errors here and emitting a warning so export can still succeed when these files are unreadable.
// Read top-level squad files (decisions.md, team.md)
const decisionsMd = path.join(squadInfo.path, 'decisions.md');
const decisionsContent = storage.readSync(decisionsMd);
if (decisionsContent !== undefined) {
manifest.decisions = decisionsContent;
}
const teamContent = storage.readSync(teamMd);
if (teamContent !== undefined) {
manifest.team = teamContent;
}
- Add validation that manifest.decisions and manifest.team are strings - Replace hard-coded squad_version '0.6.0' with getPackageVersion() - Update export warning to mention decisions/team content - Add test coverage for decisions.md/team.md round-trip and backward compatibility with older manifests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@copilot resolve the merge conflicts in this pull request |
Co-authored-by: bradygaster <41929050+bradygaster@users.noreply.github.com>
Resolved. I merged the latest Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@bradygaster I think we need to make the decisions export optional. It might contain personal/private info in some repos (especially to HQ squads) and you might want to export only the core squad data. Also, idea, should we have the squads go over the decision file to make sure it generic enough to be exported. Some of the decision are inky relevent to the repo they were created in and sharing them might cause problem when brought to another repo |
Summary
Fixes #1122 — Squad export/import was producing blank
decisions.mdandteam.mdfiles.Root Cause
decisions.mdorteam.mdcontent in the manifest JSONstorage.writeSync(path.join(squadDir, 'decisions.md'), ''))Fix
decisions.mdandteam.mdcontent in the manifest underdecisionsandteamfieldsdecisionsandteamfields are strings (if present), emitting a clear fatal error otherwisegetPackageVersion()instead of hard-coded'0.6.0'const hasForcedeclaration inindex.cjsthat caused aSyntaxErrorat runtimeTesting
skills-export-importtests pass (5 existing + 3 new)decisions.mdandteam.mdfields present in exported manifest