Skip to content

Commit a5f1694

Browse files
FelixIsaacclaude
andcommitted
feat: auto-generate README.md in sync repo on push
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 58b607b commit a5f1694

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

internal/cmd/push.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ func runPush(cmd *cobra.Command, args []string) error {
124124
return nil
125125
}
126126

127+
// Generate README.md for the sync repo
128+
if err := writeRepoReadme(paths.RepoDir); err != nil {
129+
logWarn(fmt.Sprintf("Failed to write README.md: %v", err))
130+
}
131+
127132
// Normalize paths in plugin config files for cross-platform compatibility
128133
if err := normalizePluginPaths(paths.RepoDir, paths.ClaudeDir); err != nil {
129134
logWarn(fmt.Sprintf("Failed to normalize plugin paths: %v", err))
@@ -197,6 +202,40 @@ func runPush(cmd *cobra.Command, args []string) error {
197202
return nil
198203
}
199204

205+
// writeRepoReadme generates a README.md explaining the sync repo contents
206+
func writeRepoReadme(repoDir string) error {
207+
readme := `# Claude Code Config Sync
208+
209+
This repo is managed by [claude-code-sync](https://github.com/FelixIsaac/claude-code-sync). Do not edit files here directly — changes will be overwritten on the next push.
210+
211+
## What's in here
212+
213+
| Path | Description |
214+
|------|-------------|
215+
| ` + "`CLAUDE.md`" + ` | Global instructions loaded into every Claude Code session |
216+
| ` + "`commands/`" + ` | Custom slash commands (` + "`/command-name`" + `) |
217+
| ` + "`agents/`" + ` | Custom subagent definitions |
218+
| ` + "`skills/`" + ` | Agent skills (auto-invoked by Claude) |
219+
| ` + "`hooks/`" + ` | Hook scripts |
220+
| ` + "`plugins/`" + ` | Installed plugins |
221+
| ` + "`*.age`" + ` | Encrypted files (settings, credentials, OAuth tokens) |
222+
| ` + "`.sync-manifest`" + ` | SHA256 checksums for integrity verification |
223+
224+
## Usage
225+
226+
` + "```bash" + `
227+
# Push local configs to this repo
228+
claude-code-sync push
229+
230+
# Pull configs from this repo to local
231+
claude-code-sync pull
232+
` + "```" + `
233+
234+
Encrypted files require the age private key (` + "`~/.claude-sync/identity.key`" + `) to decrypt.
235+
`
236+
return os.WriteFile(filepath.Join(repoDir, "README.md"), []byte(readme), 0644)
237+
}
238+
200239
// normalizePluginPaths converts platform-specific paths to cross-platform placeholders
201240
// in plugin configuration files for seamless syncing across Windows/macOS/Linux.
202241
func normalizePluginPaths(repoDir, claudeDir string) error {

0 commit comments

Comments
 (0)