Skip to content

Commit 8a346a4

Browse files
authored
Add shorthand syntax for techpack.yaml components (#115)
* Add shorthand syntax for techpack.yaml component definitions - Add 9 shorthand keys (brew, mcp, plugin, shell, hook, command, skill, settingsFile, gitignore) that infer type + installAction from a single key - Make displayName optional (defaults to component id) in both forms - Add MCPShorthand with optional name override for mixed-case server names - Add 18 tests covering all shorthand keys, normalization, and mixed manifests - Rewrite creating-tech-packs.md with shorthand as primary recommended style * Rewrite docs for v2.1.0 external pack engine - Rewrite README to reflect pure engine architecture (zero bundled content) - Rewrite creating-tech-packs.md as a beginner-friendly tutorial - Add techpack-schema.md as complete field-by-field reference - Mention planned auto-export feature in the guide * Update all docs to reflect mcs sync as primary command Replace all references to deprecated `mcs install` and `mcs configure` with the unified `mcs sync` command across README, CLAUDE.md, architecture, creating-tech-packs, techpack-schema, and troubleshooting docs. Also document previously undocumented flags (--global, --lock, --update, --customize, --ref, --preview, --force) and remove stale OllamaService references from the architecture section.
1 parent b06ad9e commit 8a346a4

8 files changed

Lines changed: 2089 additions & 491 deletions

File tree

‎CLAUDE.md‎

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,24 @@ swift test # Run tests
1515
swift build -c release --arch arm64 --arch x86_64 # Universal binary
1616

1717
# CLI usage (after install)
18-
mcs install # Interactive global component install (brew, MCP, plugins)
19-
mcs install --all # Install everything from all registered packs
20-
mcs install --dry-run # Preview what would be installed
21-
mcs configure [path] # Per-project setup: multi-select packs, compose artifacts
22-
mcs configure --pack ios # Non-interactive: apply specific packs (repeatable)
18+
mcs sync [path] # Sync project: multi-select packs, compose artifacts (default command)
19+
mcs sync --pack ios # Non-interactive: apply specific packs (repeatable)
20+
mcs sync --all # Apply all registered packs without prompts
21+
mcs sync --dry-run # Preview what would change
22+
mcs sync --customize # Per-pack component selection
23+
mcs sync --global # Sync global scope (MCP servers, brew, plugins to ~/.claude/)
24+
mcs sync --lock # Checkout locked versions from mcs.lock.yaml
25+
mcs sync --update # Fetch latest versions and update mcs.lock.yaml
2326
mcs doctor # Diagnose installation health
2427
mcs doctor --fix # Diagnose and auto-fix issues
2528
mcs doctor --pack ios # Only check a specific pack
2629
mcs pack add <url> # Add an external tech pack from a Git URL
30+
mcs pack add <url> --ref <tag> # Add at a specific tag, branch, or commit
31+
mcs pack add <url> --preview # Preview pack contents without installing
2732
mcs pack remove <name> # Remove an external tech pack
33+
mcs pack remove <name> --force # Remove without confirmation
2834
mcs pack list # List registered external packs
35+
mcs pack update [name] # Update pack(s) to latest version
2936
mcs cleanup # Find and delete backup files
3037
mcs cleanup --force # Delete backups without confirmation
3138
```
@@ -38,10 +45,10 @@ mcs cleanup --force # Delete backups without confirmation
3845
- **Tests/MCSTests/** — test target
3946

4047
### Entry Point
41-
- `CLI.swift``@main` struct, `MCSVersion.current`, subcommand registration
48+
- `CLI.swift``@main` struct, `MCSVersion.current`, subcommand registration (`SyncCommand` is the default subcommand)
4249

4350
### Core (`Sources/mcs/Core/`)
44-
- `Constants.swift` — centralized string constants (file names, CLI paths, Ollama config, hooks, Serena, JSON keys, plugins)
51+
- `Constants.swift` — centralized string constants (file names, CLI paths, hooks, Serena, JSON keys, external packs, plugins)
4552
- `Environment.swift` — paths, arch detection, brew path, shell RC
4653
- `CLIOutput.swift` — ANSI colors, logging, prompts, multi-select, doctor summary
4754
- `ShellRunner.swift` — Process execution wrapper
@@ -50,7 +57,7 @@ mcs cleanup --force # Delete backups without confirmation
5057
- `GitignoreManager.swift` — global gitignore management, core entry list
5158
- `ClaudeIntegration.swift``claude mcp add/remove` (with scope support), `claude plugin install/remove`
5259
- `Homebrew.swift` — brew detection, package install
53-
- `OllamaService.swift`Ollama daemon management, model pull, health check
60+
- `Lockfile.swift``mcs.lock.yaml` model for pinning pack versions
5461
- `ProjectDetector.swift` — walk-up project root detection (`.git/` or `CLAUDE.local.md`)
5562
- `ProjectState.swift` — per-project `.claude/.mcs-project` JSON state (configured packs, per-pack `PackArtifactRecord`, version)
5663
- `MCSError.swift` — error types for the CLI
@@ -62,13 +69,13 @@ mcs cleanup --force # Delete backups without confirmation
6269
- `DependencyResolver.swift` — topological sort of component dependencies with cycle detection
6370

6471
### External Pack System (`Sources/mcs/ExternalPack/`)
65-
- `ExternalPackManifest.swift` — YAML `techpack.yaml` schema (Codable models for components, templates, hooks, doctor checks, prompts, configure scripts)
72+
- `ExternalPackManifest.swift` — YAML `techpack.yaml` schema (Codable models for components, templates, hooks, doctor checks, prompts, configure scripts). Supports **shorthand syntax** (`brew:`, `mcp:`, `plugin:`, `hook:`, `command:`, `skill:`, `settingsFile:`, `gitignore:`, `shell:`) that infers `type` + `installAction` from a single key
6673
- `ExternalPackAdapter.swift` — bridges `ExternalPackManifest` to the `TechPack` protocol
6774
- `ExternalPackLoader.swift` — discovers and loads packs from `~/.mcs/packs/`
6875
- `PackFetcher.swift` — Git clone/pull for pack repositories
6976
- `PackRegistryFile.swift` — YAML registry of installed external packs (`~/.mcs/registry.yaml`)
7077
- `PackTrustManager.swift` — pack trust verification
71-
- `PromptExecutor.swift` — executes pack prompts (interactive value resolution during configure)
78+
- `PromptExecutor.swift` — executes pack prompts (interactive value resolution during sync)
7279
- `ScriptRunner.swift` — sandboxed script execution for pack scripts
7380
- `ExternalDoctorCheck.swift` — factory for converting YAML doctor check definitions to `DoctorCheck` instances
7481

@@ -80,19 +87,21 @@ mcs cleanup --force # Delete backups without confirmation
8087
- `SectionValidator.swift` — validation of CLAUDE.local.md section markers
8188

8289
### Commands (`Sources/mcs/Commands/`)
83-
- `InstallCommand.swift`global component install flow with interactive selection
90+
- `SyncCommand.swift`primary command (`mcs sync`), handles both project-scoped and global-scoped sync with `--pack`, `--all`, `--dry-run`, `--customize`, `--global`, `--lock`, `--update` flags
8491
- `DoctorCommand.swift` — health checks with optional --fix and --pack filter
85-
- `ConfigureCommand.swift` — per-project configuration: multi-select packs or `--pack` flag for CI
8692
- `CleanupCommand.swift` — backup file management with --force flag
8793
- `PackCommand.swift``mcs pack add/remove/list/update` subcommands
94+
- `InstallCommand.swift` — deprecated shim, warns to use `mcs sync`
95+
- `ConfigureCommand.swift` — deprecated shim, warns to use `mcs sync`
8896

8997
### Install (`Sources/mcs/Install/`)
90-
- `Installer.swift` — 5-phase global install orchestrator (welcome, selection, summary, install, post-summary)
98+
- `ProjectConfigurator.swift` — per-project multi-pack convergence engine (artifact tracking, settings composition, CLAUDE.local.md writing, gitignore)
99+
- `GlobalConfigurator.swift` — global-scope sync engine (brew packages, plugins, MCP servers to ~/.claude/)
91100
- `ComponentExecutor.swift` — dispatches install actions (brew, MCP servers, plugins, gitignore, project-scoped file copy/removal)
92101
- `SelectionState.swift` — tracks selected component IDs during install
93102
- `PackInstaller.swift` — auto-installs missing pack components
94103
- `PackUninstaller.swift` — removes pack components (MCP servers, plugins, settings keys)
95-
- `ProjectConfigurator.swift`per-project multi-pack convergence engine (artifact tracking, settings composition, CLAUDE.local.md writing, gitignore)
104+
- `LockfileOperations.swift`reads/writes `mcs.lock.yaml`, checks out locked versions, updates lockfile
96105

97106
### Templates (`Sources/mcs/Templates/`)
98107
- `TemplateEngine.swift``__PLACEHOLDER__` substitution
@@ -107,14 +116,15 @@ mcs cleanup --force # Delete backups without confirmation
107116
## Key Design Decisions
108117

109118
- **Pure engine, zero bundled content**: `mcs` ships no templates, hooks, settings, or skills — all features come from external packs users add via `mcs pack add`
110-
- **`mcs configure` is the primary command**: per-project multi-select of registered packs, fully idempotent convergence (add/remove/update), per-project artifact placement
119+
- **`mcs sync` is the primary command**: per-project multi-select of registered packs, fully idempotent convergence (add/remove/update), per-project artifact placement. `--global` flag handles global-scope install
111120
- **Per-project artifacts**: skills, hooks, commands, and `settings.local.json` go to `<project>/.claude/`; only brew packages and plugins are global
112121
- **MCP scope defaults to `local`**: per-user, per-project isolation via `claude mcp add -s local` (stored in `~/.claude.json` keyed by project path)
113-
- **Convergent configure**: `ProjectState` records per-pack `PackArtifactRecord` (MCP servers, files, template sections); re-running converges to desired state by diffing previous vs. selected packs
114-
- **External pack protocol**: `TechPack` protocol with `ExternalPackAdapter` bridging YAML manifests (`techpack.yaml`) to the same install/doctor/configure flows
122+
- **Convergent sync**: `ProjectState` records per-pack `PackArtifactRecord` (MCP servers, files, template sections); re-running converges to desired state by diffing previous vs. selected packs
123+
- **External pack protocol**: `TechPack` protocol with `ExternalPackAdapter` bridging YAML manifests (`techpack.yaml`) to the same install/doctor/sync flows
115124
- **Section markers**: composed files use `<!-- mcs:begin/end -->` HTML comments to separate tool-managed content from user content
116125
- **File-based memory**: memories stored in `<project>/.claude/memories/*.md`, indexed by docs-mcp-server for semantic search
117126
- **Settings composition**: each pack's hook entries compose into `<project>/.claude/settings.local.json` as individual `HookGroup` entries
118127
- **Backup for mixed-ownership files**: timestamped backup before modifying files with user content (CLAUDE.local.md); tool-managed files are not backed up since they can be regenerated
119128
- **Component-derived doctor checks**: `ComponentDefinition` is the single source of truth — `deriveDoctorCheck()` auto-generates verification from `installAction`, supplementary checks handle extras
120129
- **Project awareness**: doctor detects project root (walk-up for `.git/`), resolves packs from `.claude/.mcs-project` before falling back to section marker inference, then to global manifest
130+
- **Lockfile support**: `mcs.lock.yaml` pins pack versions for reproducible builds; `--lock` checks out pinned versions, `--update` fetches latest

0 commit comments

Comments
 (0)