Repository navigation
feat: import/export Squad configuration to/from GitHub repos - #1131
Merged
Merged
Conversation
Add the ability to export Squad configuration directly to a GitHub repository and import it from one, using the GitHub Contents API via the gh CLI. New flags: - squad export --repo owner/repo [--branch branch] - squad import --repo owner/repo [--branch branch] [--force] Implementation: - New SDK module: sharing/repo-sync.ts with injectable operations interface for testability - Updated CLI export/import commands to handle --repo flag - Updated cli-entry.ts to parse --repo and --branch arguments - Full test coverage with mock operations Closes #1128 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds GitHub repository-backed import/export support for Squad configuration via the gh CLI and exposes the repo-sync helpers through the SDK.
Changes:
- Adds SDK repo-sync primitives for parsing repo specs and reading/writing bundle JSON through the GitHub Contents API.
- Adds
--repo/--branchCLI wiring forsquad exportandsquad import. - Adds repo-sync unit tests and a changeset for CLI/SDK minor releases.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
packages/squad-sdk/src/sharing/repo-sync.ts |
Adds GitHub Contents API import/export operations and repo/path validation helpers. |
packages/squad-sdk/src/sharing/index.ts |
Re-exports the new repo-sync SDK module. |
packages/squad-cli/src/cli/commands/export.ts |
Adds repo export path and refactors manifest construction. |
packages/squad-cli/src/cli/commands/import.ts |
Adds repo import path and refactors manifest application. |
packages/squad-cli/src/cli-entry.ts |
Parses --repo and --branch for import/export commands. |
test/repo-sync.test.ts |
Adds unit tests for repo parsing, path validation, and repo sync operations. |
.changeset/repo-import-export.md |
Records minor release notes for CLI and SDK packages. |
…l protection 1. Export now includes team.md, decisions.md, and routing.md in the manifest to avoid blank-file issues (#1122). 2. Import manifest schema updated with team_md, decisions_md, routing_md fields. Older bundles without these fields get empty defaults. 3. Path traversal protection: agent names and skill-derived names are validated as safe slugs, and resolved paths are checked to stay under their expected parent directories before any writes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the ability to export Squad configuration directly to a GitHub repository and import it from one, using the GitHub Contents API via the
ghCLI. This enables sharing Squad configurations across teams and machines via a central repo.New Usage
Implementation
packages/squad-sdk/src/sharing/repo-sync.ts— Core logic with injectableRepoSyncOperationsinterface for testability:exportToRepo()— Serializes bundle and pushes via GitHub Contents API (handles SHA for updates)importFromRepo()— Fetches bundle from repoparseRepoString()— Parsesowner/repoformat (also handles GitHub URLs)validateRepoPath()— Prevents path traversal attacksspawnwith stdin for payload to avoid command-line length limitspackages/squad-cli/src/cli/commands/export.ts— Added--reposupport, refactored manifest building into reusablebuildManifest()functionpackages/squad-cli/src/cli/commands/import.ts— Added--reposupport, refactored apply logic into reusableapplyManifest()functionpackages/squad-cli/src/cli-entry.ts— Parses--repoand--branchflags for both commandstest/repo-sync.test.ts— 16 tests covering parsing, validation, export, and import with mock operationsRelated Issues
Notes