| --- | ||
| name: repocn | ||
| description: Use the repocn CLI to sync files, directories, commits, pull requests, and agent skills from GitHub into a codebase while preserving local edits. Read this before running repocn commands or modifying repocn-managed files. | ||
| allowed-tools: Bash(repocn:*), Bash(npx repocn:*) | ||
| --- | ||
| # repocn | ||
| `repocn` syncs files from GitHub into a codebase and records their upstream | ||
| versions in `repocn.json`. It protects local edits with a three-hash merge | ||
| workflow so an agent can reconcile upstream changes deliberately. | ||
| ## Core loop | ||
| ```bash | ||
| repocn status --json | ||
| repocn pull --dry-run --json | ||
| repocn pull --json | ||
| ``` | ||
| Read `repocn.json` before modifying a tracked file. A file listed under a | ||
| source's `files` map is managed by repocn. If you need a local override, prefer | ||
| adding a separate file outside the managed path instead of hand-editing the | ||
| tracked file. | ||
| ## Add a source | ||
| ```bash | ||
| # Raw file | ||
| repocn add https://example.com/config.txt | ||
| # GitHub file or directory | ||
| repocn add https://github.com/owner/repo/tree/main/path/to/directory | ||
| repocn add https://github.com/owner/repo/blob/main/path/to/file.ts | ||
| repocn add owner/repo/path/to/directory | ||
| repocn add owner/repo/tree/main/path/to/directory | ||
| # Gist, commit, commit range, or pull request | ||
| repocn add https://gist.github.com/user/abc123 | ||
| repocn add https://github.com/owner/repo/commit/abc1234 | ||
| repocn add https://github.com/owner/repo/compare/v1.0...v2.0 | ||
| repocn add https://github.com/owner/repo/pull/42 | ||
| ``` | ||
| Add a local destination as the last argument when the upstream path should not | ||
| be written at the repository root: | ||
| ```bash | ||
| repocn add owner/repo/path/to/skill ./.cursor/skills/my-skill | ||
| ``` | ||
| For multiple sources, use a destination ending in `/`. repocn derives one | ||
| subdirectory per source: | ||
| ```bash | ||
| repocn add \ | ||
| owner/repo/skills/frontend-design \ | ||
| owner/repo/skills/testing \ | ||
| ./.cursor/skills/ | ||
| ``` | ||
| Use `--dry-run` to preview writes, `--force` to overwrite local files | ||
| deliberately, and `--json` when another tool will consume the result. | ||
| ## Install curated GitHub registry items | ||
| If a repository defines a root shadcn `registry.json`, inspect its install | ||
| options and curated bundles with: | ||
| ```bash | ||
| repocn add owner/repo | ||
| ``` | ||
| Install and subscribe to a curated bundle with: | ||
| ```bash | ||
| repocn add owner/repo/item | ||
| repocn add owner/repo/item#v1.0.0 | ||
| ``` | ||
| Use `repocn add owner/repo .` when the complete repository should be installed. | ||
| For an unambiguous repository path, use `owner/repo/tree/ref/path` or | ||
| `owner/repo/blob/ref/path`. A short `owner/repo/path` resolves a curated | ||
| registry item first and falls back to the repository's actual default branch. | ||
| repocn consumes shadcn's GitHub registry format instead of defining a competing | ||
| catalog schema. Curated bundles are recorded in `repocn.json`, so use | ||
| `repocn status` and `repocn pull` to keep them current. | ||
| ## Pull updates | ||
| ```bash | ||
| repocn pull --dry-run --json | ||
| repocn pull --json | ||
| ``` | ||
| When upstream changed and the local file still matches the stored hash, repocn | ||
| updates it directly. When both upstream and the local file changed, repocn | ||
| prepends a `<<<<<<< repocn` marker block and reports the file in `merged`. | ||
| After a merge: | ||
| 1. Open every file listed in `merged`. | ||
| 2. Treat the marker block as the upstream diff and the content below it as the | ||
| local version. | ||
| 3. Reconcile the intended result in the file. | ||
| 4. Remove the entire marker block, including the `<<<<<<< repocn`, `=======`, | ||
| and `>>>>>>> repocn` lines. | ||
| 5. Run tests or validation for the affected code. | ||
| 6. Run `repocn status --json` and confirm there are no unresolved merges. | ||
| Do not run `repocn pull --force` unless discarding local edits is intentional. | ||
| ## Check status | ||
| ```bash | ||
| repocn status | ||
| repocn status --json | ||
| ``` | ||
| `status` exits `0` when all sources are current and managed files match their | ||
| stored hashes. It exits `1` when an upstream moved, a managed file changed | ||
| locally, or a merge marker is unresolved. In CI: | ||
| ```yaml | ||
| - run: npx repocn status | ||
| ``` | ||
| ## Remove a source | ||
| ```bash | ||
| # Stop tracking the source but leave its files on disk | ||
| repocn remove owner/repo/path | ||
| # Stop tracking the source and delete its tracked files | ||
| repocn remove owner/repo/path --hard | ||
| ``` | ||
| Use a partial URL when it uniquely identifies one source. Inspect | ||
| `repocn.json` first when using `--hard`. | ||
| ## Agent skills recipe | ||
| Agent skills are ordinary GitHub directories. Track project-specific skills | ||
| inside the repository: | ||
| ```bash | ||
| repocn add https://github.com/owner/skills/tree/main/skills ./.cursor/skills | ||
| git add repocn.json .cursor/skills | ||
| ``` | ||
| Run repocn from `$HOME` instead when you want a user-level manifest and | ||
| user-level skill directory: | ||
| ```bash | ||
| cd ~ | ||
| repocn add https://github.com/owner/skills/tree/main/skills ./.cursor/skills | ||
| ``` | ||
| Do not hand-edit repocn-managed skill files. Track a fork or place a local | ||
| override outside the managed directory when different behavior is required. | ||
| ## Post-pull hooks | ||
| Attach a shell command that should run after a source changes: | ||
| ```bash | ||
| repocn add owner/repo/icons ./icons --post-pull "npm run build:icons" | ||
| ``` | ||
| Hooks execute shell commands from `repocn.json`. Inspect unfamiliar manifests | ||
| before pulling. | ||
| ## Authentication | ||
| Set `GITHUB_TOKEN` when GitHub API requests need authentication or a higher | ||
| rate limit: | ||
| ```bash | ||
| GITHUB_TOKEN=... repocn pull | ||
| ``` | ||
| ## Load this guide again | ||
| ```bash | ||
| repocn skills get repocn | ||
| repocn skills path repocn | ||
| ``` |
+2
-2
| { | ||
| "name": "repocn", | ||
| "version": "0.5.0", | ||
| "version": "0.5.1", | ||
| "description": "CLI tool for installing composable agent modules into your codebase", | ||
@@ -8,3 +8,3 @@ "type": "module", | ||
| "bin": { | ||
| "gitcn": "dist/index.js" | ||
| "repocn": "dist/index.js" | ||
| }, | ||
@@ -11,0 +11,0 @@ "files": [ |
| --- | ||
| name: gitcn | ||
| description: Use the gitcn CLI to sync files, directories, commits, pull requests, and agent skills from GitHub into a codebase while preserving local edits. Read this before running gitcn commands or modifying gitcn-managed files. | ||
| allowed-tools: Bash(gitcn:*), Bash(npx gitcn:*) | ||
| --- | ||
| # gitcn | ||
| `gitcn` syncs files from GitHub into a codebase and records their upstream | ||
| versions in `gitcn.json`. It protects local edits with a three-hash merge | ||
| workflow so an agent can reconcile upstream changes deliberately. | ||
| ## Core loop | ||
| ```bash | ||
| gitcn status --json | ||
| gitcn pull --dry-run --json | ||
| gitcn pull --json | ||
| ``` | ||
| Read `gitcn.json` before modifying a tracked file. A file listed under a | ||
| source's `files` map is managed by gitcn. If you need a local override, prefer | ||
| adding a separate file outside the managed path instead of hand-editing the | ||
| tracked file. | ||
| ## Add a source | ||
| ```bash | ||
| # Raw file | ||
| gitcn add https://example.com/config.txt | ||
| # GitHub file or directory | ||
| gitcn add https://github.com/owner/repo/tree/main/path/to/directory | ||
| gitcn add https://github.com/owner/repo/blob/main/path/to/file.ts | ||
| gitcn add owner/repo/path/to/directory | ||
| gitcn add owner/repo/tree/main/path/to/directory | ||
| # Gist, commit, commit range, or pull request | ||
| gitcn add https://gist.github.com/user/abc123 | ||
| gitcn add https://github.com/owner/repo/commit/abc1234 | ||
| gitcn add https://github.com/owner/repo/compare/v1.0...v2.0 | ||
| gitcn add https://github.com/owner/repo/pull/42 | ||
| ``` | ||
| Add a local destination as the last argument when the upstream path should not | ||
| be written at the repository root: | ||
| ```bash | ||
| gitcn add owner/repo/path/to/skill ./.cursor/skills/my-skill | ||
| ``` | ||
| For multiple sources, use a destination ending in `/`. gitcn derives one | ||
| subdirectory per source: | ||
| ```bash | ||
| gitcn add \ | ||
| owner/repo/skills/frontend-design \ | ||
| owner/repo/skills/testing \ | ||
| ./.cursor/skills/ | ||
| ``` | ||
| Use `--dry-run` to preview writes, `--force` to overwrite local files | ||
| deliberately, and `--json` when another tool will consume the result. | ||
| ## Install curated GitHub registry items | ||
| If a repository defines a root shadcn `registry.json`, inspect its install | ||
| options and curated bundles with: | ||
| ```bash | ||
| gitcn add owner/repo | ||
| ``` | ||
| Install and subscribe to a curated bundle with: | ||
| ```bash | ||
| gitcn add owner/repo/item | ||
| gitcn add owner/repo/item#v1.0.0 | ||
| ``` | ||
| Use `gitcn add owner/repo .` when the complete repository should be installed. | ||
| For an unambiguous repository path, use `owner/repo/tree/ref/path` or | ||
| `owner/repo/blob/ref/path`. A short `owner/repo/path` resolves a curated | ||
| registry item first and falls back to the repository's actual default branch. | ||
| gitcn consumes shadcn's GitHub registry format instead of defining a competing | ||
| catalog schema. Curated bundles are recorded in `gitcn.json`, so use | ||
| `gitcn status` and `gitcn pull` to keep them current. | ||
| ## Pull updates | ||
| ```bash | ||
| gitcn pull --dry-run --json | ||
| gitcn pull --json | ||
| ``` | ||
| When upstream changed and the local file still matches the stored hash, gitcn | ||
| updates it directly. When both upstream and the local file changed, gitcn | ||
| prepends a `<<<<<<< gitcn` marker block and reports the file in `merged`. | ||
| After a merge: | ||
| 1. Open every file listed in `merged`. | ||
| 2. Treat the marker block as the upstream diff and the content below it as the | ||
| local version. | ||
| 3. Reconcile the intended result in the file. | ||
| 4. Remove the entire marker block, including the `<<<<<<< gitcn`, `=======`, | ||
| and `>>>>>>> gitcn` lines. | ||
| 5. Run tests or validation for the affected code. | ||
| 6. Run `gitcn status --json` and confirm there are no unresolved merges. | ||
| Do not run `gitcn pull --force` unless discarding local edits is intentional. | ||
| ## Check status | ||
| ```bash | ||
| gitcn status | ||
| gitcn status --json | ||
| ``` | ||
| `status` exits `0` when all sources are current and managed files match their | ||
| stored hashes. It exits `1` when an upstream moved, a managed file changed | ||
| locally, or a merge marker is unresolved. In CI: | ||
| ```yaml | ||
| - run: npx gitcn status | ||
| ``` | ||
| ## Remove a source | ||
| ```bash | ||
| # Stop tracking the source but leave its files on disk | ||
| gitcn remove owner/repo/path | ||
| # Stop tracking the source and delete its tracked files | ||
| gitcn remove owner/repo/path --hard | ||
| ``` | ||
| Use a partial URL when it uniquely identifies one source. Inspect | ||
| `gitcn.json` first when using `--hard`. | ||
| ## Agent skills recipe | ||
| Agent skills are ordinary GitHub directories. Track project-specific skills | ||
| inside the repository: | ||
| ```bash | ||
| gitcn add https://github.com/owner/skills/tree/main/skills ./.cursor/skills | ||
| git add gitcn.json .cursor/skills | ||
| ``` | ||
| Run gitcn from `$HOME` instead when you want a user-level manifest and | ||
| user-level skill directory: | ||
| ```bash | ||
| cd ~ | ||
| gitcn add https://github.com/owner/skills/tree/main/skills ./.cursor/skills | ||
| ``` | ||
| Do not hand-edit gitcn-managed skill files. Track a fork or place a local | ||
| override outside the managed directory when different behavior is required. | ||
| ## Post-pull hooks | ||
| Attach a shell command that should run after a source changes: | ||
| ```bash | ||
| gitcn add owner/repo/icons ./icons --post-pull "npm run build:icons" | ||
| ``` | ||
| Hooks execute shell commands from `gitcn.json`. Inspect unfamiliar manifests | ||
| before pulling. | ||
| ## Authentication | ||
| Set `GITHUB_TOKEN` when GitHub API requests need authentication or a higher | ||
| rate limit: | ||
| ```bash | ||
| GITHUB_TOKEN=... gitcn pull | ||
| ``` | ||
| ## Load this guide again | ||
| ```bash | ||
| gitcn skills get gitcn | ||
| gitcn skills path gitcn | ||
| ``` |
Sorry, the diff of this file is too big to display
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
99334
0.12%