@sofatutor/agent-bridge 0.13.1 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,231 +1,123 @@
1
1
  # Agent Bridge
2
2
 
3
- A CLI tool that syncs AI agent configurations (skills, agents, prompts, ...etc.) from shared sources into your project's tool directories (`.github/`, `.cursor/`, `.claude/`, ..etc.).
3
+ Sync AI agent skills, agents, prompts and instructions from a shared repo into your project's tool folders (`.github/`, `.cursor/`, `.claude/`, ).
4
4
 
5
- ### Why Agent Bridge?
5
+ One source of truth. Every project. Every tool.
6
6
 
7
- As teams adopt AI coding tools, agent instructions quickly scatter across projects with no shared structure. Agent Bridge solves this by letting you **centralize and distribute** AI agent features across any number of projects, teams, and repositories — using **conventions over configuration**, with no manifests or mapping files required.
8
-
9
- - **Convention over configuration** — features are discovered from the filesystem automatically. No manifests, no mapping files — just organize by domain and feature type.
10
- - **Tool-agnostic, tool-aware** — syncs to all configured tools by default, while the `<tool>--` prefix convention lets you target features to specific tools (VS Code, Cursor, Claude Code, or custom tools) when needed.
11
- - **Extensible** — not limited to skills, agents, prompts, or instructions. Any new feature type that tools introduce is automatically supported — just add a folder to your source.
12
- - **Multiple sources** — pull from any combination of Git repositories (HTTPS/SSH) and local paths. Mix company-wide standards with team-specific or project-specific sources.
13
- - **Multi-domain organization** — structure features by domain (`backend`, `frontend`, `shared`, or your own) so each project pulls only what it needs.
14
- - **Non-destructive** — previously defined skills, agents, prompts, and other tool files are **never** touched, modified, or deleted.
15
-
16
- ## Prerequisites
17
-
18
- - Git (optional — needed only for remote sources)
19
- - Node.js ≥ 18
20
-
21
- ## Installation
7
+ ## Quick start
22
8
 
23
9
  ```bash
24
- npm install -g @sofatutor/agent-bridge
10
+ npx @sofatutor/agent-bridge init
25
11
  ```
26
12
 
27
- Or install locally as a dev dependency:
13
+ That's it. The wizard walks you through three questions:
28
14
 
29
- ```bash
30
- npm install --save-dev @sofatutor/agent-bridge
31
- ```
15
+ 1. **Tools** — VS Code, Cursor, Claude, Pi, or a custom folder.
16
+ 2. **Sources** a Git URL (or local path) that holds your shared skills, e.g. `https://github.com/sofatutor/ai-hub.git`.
17
+ 3. **Domains** — tick the folders you want from each source. Optionally pick single skills/agents/files.
18
+
19
+ It saves `.agent-bridge/config.yml`, offers to install git hooks, and syncs immediately.
32
20
 
33
- Or run directly with `npx`:
21
+ Then commit the config:
34
22
 
35
23
  ```bash
36
- npx @sofatutor/agent-bridge init
24
+ git add .agent-bridge/config.yml && git commit -m "chore: add agent-bridge config"
37
25
  ```
38
26
 
39
- ## Quick Start
40
-
41
- ### 1. Initialize
27
+ Pull the latest features any time:
42
28
 
43
29
  ```bash
44
- agent-bridge init
30
+ npx @sofatutor/agent-bridge sync
45
31
  ```
46
32
 
47
- The interactive init flow will:
48
- 1. Ask which domains to use (e.g. `backend`, `frontend`, `shared`).
49
- 2. Ask which tools to configure — choose from well-known presets (VS Code, Cursor, Claude) or add custom tools.
50
- 3. Ask for sources — Git repos (HTTPS/SSH) or local paths, with optional branch.
51
- 4. Generate `.agent-bridge/config.yml`.
52
- 5. Clone any remote sources.
53
- 6. Create `.agent-bridge/.gitignore` (ignores cloned repos, keeps config).
54
- 7. Optionally install git hooks to auto-sync on checkout/merge.
55
-
56
- #### Non-Interactive Mode
57
-
58
- Pass `--tools` and `--source` to skip all prompts:
33
+ ### Install for keeps
59
34
 
60
35
  ```bash
61
- agent-bridge init \
62
- --tools cursor,vscode,claude \
63
- --source https://github.com/org/repo.git#main
36
+ npm install -g @sofatutor/agent-bridge # global
37
+ npm install --save-dev @sofatutor/agent-bridge # per project
64
38
  ```
65
39
 
66
- Multiple sources and custom tools are supported:
40
+ ### Scripted setup (CI, postinstall)
67
41
 
68
42
  ```bash
69
43
  agent-bridge init \
70
- --domains shared,backend \
71
- --tools cursor,windsurf:.windsurf \
72
- --source https://github.com/org/repo.git#main \
73
- --source /local/path \
44
+ --tools cursor,vscode,claude \
45
+ --source https://github.com/sofatutor/ai-hub.git#main \
46
+ --domains sofatutor-shared,sofatutor-main \
74
47
  --hooks
75
- ```
76
-
77
- | Option | Description |
78
- | ------------------- | ---------------------------------------------------------------------------------------- |
79
- | `--tools <list>` | Comma-separated tool names (`cursor`, `vscode`, `claude`) or `name:folder` pairs |
80
- | `-s, --source <url>`| Source URL or path (repeatable). Append `#branch` for a specific branch |
81
- | `--domains <list>` | Comma-separated domain list (default: `backend,frontend,shared`) |
82
- | `--hooks` | Auto-install git hooks without prompting |
83
-
84
- After init, commit `.agent-bridge/config.yml` to your repo.
85
-
86
- ### 2. Sync
87
-
88
- ```bash
89
48
  agent-bridge sync
90
49
  ```
91
50
 
92
- Fetches remote sources, discovers features, and copies them into your tool folders.
93
-
94
- Run this whenever:
95
- - A source repository has new or changed features.
96
- - You add, rename, or remove sources in `config.yml`.
97
- - You change tool or domain configuration.
51
+ Omit `--domains` to take every domain in the source.
98
52
 
99
- ### 3. Update
53
+ ## What you get
100
54
 
101
- ```bash
102
- agent-bridge update
103
55
  ```
104
-
105
- Pulls the latest changes from all remote sources. Local sources require no update.
106
-
107
- After updating, run `agent-bridge sync` to reconcile features.
108
-
109
- ### 4. Opt Out
110
-
111
- ```bash
112
- agent-bridge opt-out
56
+ my-project/
57
+ ├── .agent-bridge/config.yml ← the only file you commit
58
+ ├── .github/skills/code-review/ ← synced (VS Code)
59
+ ├── .cursor/skills/code-review/ ← synced (Cursor)
60
+ └── .claude/skills/code-review/ ← synced (Claude)
113
61
  ```
114
62
 
115
- `opt-out` is non-interactive and removes Agent Bridge from the current repository by:
116
- - Removing synced feature and tool-root entries tracked in `.agentbridge` manifests
117
- - Removing Agent Bridge-managed git hooks (`post-checkout`, `post-merge`)
118
- - Removing `config.yml` and cloned sources from `.agent-bridge/`
119
- - Leaving a `.agent-bridge/optout` tombstone behind so a `postinstall` guard won't silently reinstall
120
-
121
- Notes:
122
- - Root files like `AGENTS.md`, `CLAUDE.md`, and `SYSTEM.md` are not removed by `opt-out`.
123
- - Existing non-Agent-Bridge hooks are preserved.
124
- - The tombstone lives at `.agent-bridge/optout` and is **gitignored by default**, so opt-out is local to your machine. Force-add it (`git add -f .agent-bridge/optout`) to commit a repo-wide opt-out.
125
- - While the tombstone exists, `agent-bridge init` and `agent-bridge sync` are no-ops.
126
- - To re-enable, run `agent-bridge init --force` (which clears the tombstone) or delete `.agent-bridge/optout`.
127
-
128
- #### Opting out with a `postinstall` hook
129
-
130
- If a project auto-installs Agent Bridge via `postinstall`, guard it on `.agent-bridge`:
131
-
132
- ```json
133
- "postinstall": "test -d .agent-bridge || (npx agent-bridge init --domains … --tools … --source … --hooks && npx agent-bridge sync) || true"
134
- ```
135
-
136
- Because `opt-out` keeps the `.agent-bridge/` directory (holding only the tombstone), `test -d .agent-bridge` stays true after opting out and the guard short-circuits — nothing is reinstalled. If your guard invokes `init`/`sync` directly instead, they still no-op on the tombstone.
137
-
138
- ## Git Hooks (Auto-Sync)
139
-
140
- When running `agent-bridge init` inside a Git repository, you'll be prompted to install git hooks that automatically keep your AI agent configurations up to date. If enabled, Agent Bridge installs:
141
-
142
- - **post-checkout** — runs after `git checkout` (switching branches)
143
- - **post-merge** — runs after `git merge` or `git pull`
144
-
145
- These hooks run `agent-bridge update && agent-bridge sync` in the background, so your workflow isn't blocked.
146
-
147
- ### How It Works
148
-
149
- The hooks execute asynchronously with a short delay to let Git complete its operations. They:
150
- 1. Check if `agent-bridge` is available globally
151
- 2. Fall back to `npx @sofatutor/agent-bridge` if not
152
- 3. Run update and sync silently in the background
153
-
154
- ### Skipping Existing Hooks
155
-
156
- If you already have custom `post-checkout` or `post-merge` hooks, Agent Bridge will skip them to avoid conflicts. You can manually integrate Agent Bridge into your existing hooks by adding:
157
-
158
- ```sh
159
- # At the end of your existing hook
160
- (
161
- sleep 1
162
- agent-bridge update && agent-bridge sync
163
- ) >/dev/null 2>&1 &
164
- ```
165
-
166
- ### Removing Hooks
167
-
168
- Agent Bridge marks its hooks with a special comment.
169
-
170
- Recommended: run `agent-bridge opt-out` to remove Agent Bridge-managed hooks and state.
171
-
172
- Manual alternative: delete the hook files:
173
-
174
- ```bash
175
- rm .git/hooks/post-checkout .git/hooks/post-merge
63
+ - **Convention over configuration** a source is just folders: `<domain>/<feature-type>/<feature>/`. No manifests.
64
+ - **Pick what you need** whole domains, or individual skills, agents and files per domain.
65
+ - **Tool-aware** `cursor--rules/` goes to Cursor only; everything else goes to every tool.
66
+ - **Non-destructive** — Agent Bridge only ever touches files it created. Your own skills are safe.
67
+ - **Stays fresh** `sync` fetches sources and reconciles; git hooks can do it for you after checkout/merge.
68
+
69
+ ## Commands
70
+
71
+ | Command | What it does |
72
+ | ----------------------- | -------------------------------------------------------------- |
73
+ | `agent-bridge init` | Interactive setup (or scripted with `--tools`/`--source`) |
74
+ | `agent-bridge sync` | Fetch sources and sync features into your tool folders |
75
+ | `agent-bridge opt-out` | Remove everything Agent Bridge created from this repo |
76
+
77
+ All commands accept `--cwd <path>`.
78
+
79
+ > `agent-bridge update` was merged into `sync` in 0.14. The old command still works and simply runs `sync`.
80
+
81
+ ## Config at a glance
82
+
83
+ ```yaml
84
+ tools:
85
+ - name: claude
86
+ folder: .claude
87
+ sources:
88
+ - name: ai-hub
89
+ source: https://github.com/sofatutor/ai-hub.git
90
+ branch: main
91
+ domains:
92
+ - name: sofatutor-shared # everything in this domain
93
+ - name: sofatutor-main # only these bits
94
+ include:
95
+ - skills/preview
96
+ - vscode--agents
97
+ - AGENTS.md
176
98
  ```
177
99
 
178
- Or re-run `agent-bridge init` — Agent Bridge hooks are automatically updated on re-init.
100
+ Full reference: [Configuration](docs/Configuration.md).
179
101
 
180
- ## CLI Commands
102
+ ## Docs
181
103
 
182
- | Command | Description |
183
- | --------------------- | ------------------------------------------------------ |
184
- | `agent-bridge init` | Interactive setup creates `.agent-bridge/config.yml` (supports [non-interactive mode](#non-interactive-mode)) |
185
- | `agent-bridge sync` | Fetch sources, discover features, reconcile files |
186
- | `agent-bridge update` | Fetch latest changes for all remote sources |
187
- | `agent-bridge opt-out`| Non-interactive cleanup of Agent Bridge-managed state |
104
+ | Page | Read it when… |
105
+ | ------------------------------------------- | ---------------------------------------------------- |
106
+ | [Configuration](docs/Configuration.md) | you want to edit `config.yml` by hand |
107
+ | [Conventions](docs/Conventions.md) | you're authoring a source repo (like `ai-hub`) |
108
+ | [CLI Reference](docs/CLI-Reference.md) | you need every flag, plus git hooks and opt-out |
109
+ | [Sync Strategy](docs/Sync-Strategy.md) | you wonder what sync touches and what it never does |
110
+ | [Upgrading](docs/Upgrading.md) | you're coming from 0.13 or earlier |
111
+ | [Troubleshooting](docs/Troubleshooting.md) | something's off |
188
112
 
189
- ### Global Options
190
-
191
- | Option | Description |
192
- | -------------- | ---------------------------------------------------------------------------------------- |
193
- | `--cwd <path>` | Override the working directory. Defaults to the Git root, or `cwd` if not in a Git repo. |
194
-
195
- Examples:
196
-
197
- ```bash
198
- # Run sync for a specific project in a monorepo
199
- agent-bridge sync --cwd ./packages/api
200
-
201
- # Point at a project outside the current directory
202
- agent-bridge sync --cwd /path/to/my-project
203
- ```
204
-
205
- ## Documentation
206
-
207
- - [Configuration](docs/configuration.md) — config file reference, fields, source types
208
- - [Conventions](docs/conventions.md) — source directory structure, tool-prefix routing, authoring features
209
- - [Sync Strategy](docs/sync-strategy.md) — marker files, project structure after sync, cleanup behavior
210
-
211
- ## Troubleshooting
212
-
213
- | Symptom | Fix |
214
- | ---------------------------- | -------------------------------------------------------------------- |
215
- | `config.yml not found` | Run `agent-bridge init` from the repo root |
216
- | Source clone failed | Check the Git URL and your SSH/HTTPS credentials |
217
- | Duplicate feature name error | Rename one of the conflicting features across sources |
218
- | Local source path not found | Verify the path in `config.yml` is correct relative to the repo root |
219
- | Path conflict error | A non-managed folder exists at the destination — rename or remove it |
220
- | Git hooks not installed | Run `agent-bridge init` from inside a Git repository |
221
- | Hooks skipped (existing) | Existing non-Agent-Bridge hooks are preserved; integrate manually |
222
- | Remove Agent Bridge from repo| Run `agent-bridge opt-out` |
113
+ The same pages are published to the [GitHub wiki](https://github.com/sofatutor/agent-bridge/wiki).
223
114
 
224
115
  ## Development
225
116
 
226
117
  ```bash
227
118
  npm install
228
- npm run build # Package the CLI with Vite+
229
- npm test # Run all tests
230
- npm run test:watch # Watch mode
119
+ npm run check # typecheck + tests
120
+ npm run build # bundle the CLI into dist/
231
121
  ```
122
+
123
+ Requires Node ≥ 18 and Git (for remote sources).