@agents-dev/cli 0.7.7
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/AGENTS.md +400 -0
- package/CHANGELOG.md +297 -0
- package/CONTRIBUTING.md +164 -0
- package/LICENSE +21 -0
- package/README.md +117 -0
- package/bin/agents +24 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +282 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/connect.d.ts +7 -0
- package/dist/commands/connect.js +48 -0
- package/dist/commands/connect.js.map +1 -0
- package/dist/commands/disconnect.d.ts +7 -0
- package/dist/commands/disconnect.js +47 -0
- package/dist/commands/disconnect.js.map +1 -0
- package/dist/commands/doctor.d.ts +6 -0
- package/dist/commands/doctor.js +430 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.d.ts +5 -0
- package/dist/commands/init.js +24 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/mcp-add.d.ts +20 -0
- package/dist/commands/mcp-add.js +250 -0
- package/dist/commands/mcp-add.js.map +1 -0
- package/dist/commands/mcp-import.d.ts +13 -0
- package/dist/commands/mcp-import.js +207 -0
- package/dist/commands/mcp-import.js.map +1 -0
- package/dist/commands/mcp-list.d.ts +5 -0
- package/dist/commands/mcp-list.js +34 -0
- package/dist/commands/mcp-list.js.map +1 -0
- package/dist/commands/mcp-remove.d.ts +7 -0
- package/dist/commands/mcp-remove.js +34 -0
- package/dist/commands/mcp-remove.js.map +1 -0
- package/dist/commands/mcp-test.d.ts +8 -0
- package/dist/commands/mcp-test.js +402 -0
- package/dist/commands/mcp-test.js.map +1 -0
- package/dist/commands/reset.d.ts +6 -0
- package/dist/commands/reset.js +76 -0
- package/dist/commands/reset.js.map +1 -0
- package/dist/commands/start.d.ts +6 -0
- package/dist/commands/start.js +292 -0
- package/dist/commands/start.js.map +1 -0
- package/dist/commands/status.d.ts +7 -0
- package/dist/commands/status.js +278 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/sync.d.ts +6 -0
- package/dist/commands/sync.js +22 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/watch.d.ts +7 -0
- package/dist/commands/watch.js +117 -0
- package/dist/commands/watch.js.map +1 -0
- package/dist/core/claudeCli.d.ts +7 -0
- package/dist/core/claudeCli.js +35 -0
- package/dist/core/claudeCli.js.map +1 -0
- package/dist/core/config.d.ts +17 -0
- package/dist/core/config.js +121 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/cursorCli.d.ts +9 -0
- package/dist/core/cursorCli.js +60 -0
- package/dist/core/cursorCli.js.map +1 -0
- package/dist/core/fs.d.ts +11 -0
- package/dist/core/fs.js +76 -0
- package/dist/core/fs.js.map +1 -0
- package/dist/core/gitignore.d.ts +3 -0
- package/dist/core/gitignore.js +54 -0
- package/dist/core/gitignore.js.map +1 -0
- package/dist/core/mcp.d.ts +8 -0
- package/dist/core/mcp.js +134 -0
- package/dist/core/mcp.js.map +1 -0
- package/dist/core/mcpCrud.d.ts +34 -0
- package/dist/core/mcpCrud.js +105 -0
- package/dist/core/mcpCrud.js.map +1 -0
- package/dist/core/mcpImport.d.ts +14 -0
- package/dist/core/mcpImport.js +507 -0
- package/dist/core/mcpImport.js.map +1 -0
- package/dist/core/mcpSecrets.d.ts +27 -0
- package/dist/core/mcpSecrets.js +144 -0
- package/dist/core/mcpSecrets.js.map +1 -0
- package/dist/core/mcpValidation.d.ts +19 -0
- package/dist/core/mcpValidation.js +78 -0
- package/dist/core/mcpValidation.js.map +1 -0
- package/dist/core/paths.d.ts +37 -0
- package/dist/core/paths.js +43 -0
- package/dist/core/paths.js.map +1 -0
- package/dist/core/project.d.ts +16 -0
- package/dist/core/project.js +34 -0
- package/dist/core/project.js.map +1 -0
- package/dist/core/renderers.d.ts +14 -0
- package/dist/core/renderers.js +113 -0
- package/dist/core/renderers.js.map +1 -0
- package/dist/core/shell.d.ts +8 -0
- package/dist/core/shell.js +21 -0
- package/dist/core/shell.js.map +1 -0
- package/dist/core/shellWords.d.ts +1 -0
- package/dist/core/shellWords.js +84 -0
- package/dist/core/shellWords.js.map +1 -0
- package/dist/core/skills.d.ts +8 -0
- package/dist/core/skills.js +150 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/skillsValidation.d.ts +1 -0
- package/dist/core/skillsValidation.js +68 -0
- package/dist/core/skillsValidation.js.map +1 -0
- package/dist/core/sync.d.ts +2 -0
- package/dist/core/sync.js +427 -0
- package/dist/core/sync.js.map +1 -0
- package/dist/core/syncLock.d.ts +1 -0
- package/dist/core/syncLock.js +84 -0
- package/dist/core/syncLock.js.map +1 -0
- package/dist/core/templates.d.ts +1 -0
- package/dist/core/templates.js +38 -0
- package/dist/core/templates.js.map +1 -0
- package/dist/core/trust.d.ts +7 -0
- package/dist/core/trust.js +51 -0
- package/dist/core/trust.js.map +1 -0
- package/dist/core/vscodeSettings.d.ts +17 -0
- package/dist/core/vscodeSettings.js +212 -0
- package/dist/core/vscodeSettings.js.map +1 -0
- package/dist/core/warnings.d.ts +2 -0
- package/dist/core/warnings.js +26 -0
- package/dist/core/warnings.js.map +1 -0
- package/dist/integrations/antigravity.d.ts +9 -0
- package/dist/integrations/antigravity.js +13 -0
- package/dist/integrations/antigravity.js.map +1 -0
- package/dist/integrations/claude.d.ts +1 -0
- package/dist/integrations/claude.js +4 -0
- package/dist/integrations/claude.js.map +1 -0
- package/dist/integrations/codex.d.ts +5 -0
- package/dist/integrations/codex.js +5 -0
- package/dist/integrations/codex.js.map +1 -0
- package/dist/integrations/copilotVscode.d.ts +7 -0
- package/dist/integrations/copilotVscode.js +9 -0
- package/dist/integrations/copilotVscode.js.map +1 -0
- package/dist/integrations/cursor.d.ts +7 -0
- package/dist/integrations/cursor.js +9 -0
- package/dist/integrations/cursor.js.map +1 -0
- package/dist/integrations/gemini.d.ts +12 -0
- package/dist/integrations/gemini.js +15 -0
- package/dist/integrations/gemini.js.map +1 -0
- package/dist/integrations/registry.d.ts +9 -0
- package/dist/integrations/registry.js +21 -0
- package/dist/integrations/registry.js.map +1 -0
- package/dist/types.d.ts +85 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/docs/EXAMPLES.md +211 -0
- package/docs/README.md +26 -0
- package/docs/agents-system.md +178 -0
- package/package.json +77 -0
- package/templates/agents/AGENTS.md +23 -0
- package/templates/agents/README.md +25 -0
- package/templates/agents/skills/README.md +27 -0
- package/templates/agents/skills/skill-guide/SKILL.md +29 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Instructions for AI coding agents working on the `@agents-dev/cli` project.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
**@agents-dev/cli** is a CLI tool that provides a practical standard layer for multi-LLM development. It solves the configuration fragmentation problem by syncing MCP servers, skills, and instructions across multiple AI coding tools (Codex, Claude Code, Gemini CLI, Cursor, Copilot, Antigravity) from a single source of truth.
|
|
8
|
+
|
|
9
|
+
**Key Principle:** One `.agents/` folder syncs to all tools. Add an MCP server once, it appears everywhere.
|
|
10
|
+
|
|
11
|
+
## Tech Stack
|
|
12
|
+
|
|
13
|
+
- **Language:** TypeScript (strict mode)
|
|
14
|
+
- **Runtime:** Node.js 20+
|
|
15
|
+
- **Build:** tsc (TypeScript compiler)
|
|
16
|
+
- **Tests:** Vitest
|
|
17
|
+
- **CLI Framework:** Commander.js
|
|
18
|
+
- **Prompts:** @clack/prompts
|
|
19
|
+
- **Package Manager:** npm
|
|
20
|
+
|
|
21
|
+
## Project Structure
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
agents/
|
|
25
|
+
├── src/
|
|
26
|
+
│ ├── cli.ts # CLI entry point
|
|
27
|
+
│ ├── commands/ # Command implementations
|
|
28
|
+
│ │ ├── start.ts # Setup wizard
|
|
29
|
+
│ │ ├── sync.ts # Config sync
|
|
30
|
+
│ │ ├── mcp-add.ts # Add MCP server
|
|
31
|
+
│ │ └── ...
|
|
32
|
+
│ ├── core/ # Core logic
|
|
33
|
+
│ │ ├── sync.ts # Sync orchestration
|
|
34
|
+
│ │ ├── mcp.ts # MCP management
|
|
35
|
+
│ │ ├── renderers.ts # Tool-specific config generators
|
|
36
|
+
│ │ ├── trust.ts # Codex trust management
|
|
37
|
+
│ │ └── ...
|
|
38
|
+
│ ├── integrations/ # Tool integrations
|
|
39
|
+
│ │ ├── codex.ts
|
|
40
|
+
│ │ ├── claude.ts
|
|
41
|
+
│ │ ├── cursor.ts
|
|
42
|
+
│ │ └── ...
|
|
43
|
+
│ └── types.ts # TypeScript types
|
|
44
|
+
├── tests/ # Test files
|
|
45
|
+
│ ├── *.test.ts # Unit tests
|
|
46
|
+
│ └── *.integration.test.ts # Integration tests
|
|
47
|
+
├── templates/ # Scaffold templates
|
|
48
|
+
│ └── agents/ # .agents/ directory templates
|
|
49
|
+
├── docs/ # Public documentation
|
|
50
|
+
└── bin/agents # CLI wrapper script
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Development Workflow
|
|
54
|
+
|
|
55
|
+
### Setup
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm install
|
|
59
|
+
npm run build
|
|
60
|
+
npm link
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Development Commands
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npm run dev -- <command> # Run CLI in dev mode
|
|
67
|
+
npm run build # Compile TypeScript
|
|
68
|
+
npm test # Run all tests
|
|
69
|
+
npm test tests/sync.test.ts # Run specific test
|
|
70
|
+
npm test -- --watch # Watch mode
|
|
71
|
+
npm run lint # Run ESLint
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Testing
|
|
75
|
+
|
|
76
|
+
- **Unit tests:** Test individual functions in isolation
|
|
77
|
+
- **Integration tests:** Test full command flows with temp directories
|
|
78
|
+
- Use `mkdtemp` for temporary test directories
|
|
79
|
+
- Always clean up in `afterEach` hooks
|
|
80
|
+
- Mock external CLI calls when appropriate
|
|
81
|
+
|
|
82
|
+
### Code Style
|
|
83
|
+
|
|
84
|
+
- **TypeScript strict mode** is enabled
|
|
85
|
+
- Follow existing patterns and conventions
|
|
86
|
+
- Use descriptive variable names
|
|
87
|
+
- Add JSDoc comments for exported functions
|
|
88
|
+
- Keep functions focused (single responsibility)
|
|
89
|
+
- Prefer pure functions where possible
|
|
90
|
+
|
|
91
|
+
## Key Concepts
|
|
92
|
+
|
|
93
|
+
### 1. Project Structure (`core/project.ts`)
|
|
94
|
+
|
|
95
|
+
Projects have:
|
|
96
|
+
- `.agents/agents.json` — MCP servers, shared config
|
|
97
|
+
- `.agents/local.json` — Secrets (gitignored)
|
|
98
|
+
- `.agents/skills/` — Reusable workflows
|
|
99
|
+
- `.agents/generated/` — Auto-generated files (gitignored)
|
|
100
|
+
- `AGENTS.md` — Instructions for all tools
|
|
101
|
+
|
|
102
|
+
### 2. Sync Process (`core/sync.ts`)
|
|
103
|
+
|
|
104
|
+
1. Read `.agents/agents.json` and `.agents/local.json`
|
|
105
|
+
2. Merge configs (local overrides shared)
|
|
106
|
+
3. Generate tool-specific configs via renderers
|
|
107
|
+
4. Write atomically (temp file + rename)
|
|
108
|
+
5. Acquire sync lock to prevent race conditions
|
|
109
|
+
|
|
110
|
+
### 3. Renderers (`core/renderers.ts`)
|
|
111
|
+
|
|
112
|
+
Each tool has a renderer that converts `.agents/agents.json` to tool-specific format:
|
|
113
|
+
- **Codex:** TOML (`.codex/config.toml`)
|
|
114
|
+
- **Claude:** JSON (`.claude/mcp.json`)
|
|
115
|
+
- **Gemini:** JSON (`.gemini/settings.json`)
|
|
116
|
+
- **Cursor:** JSON (`.cursor/mcp.json`)
|
|
117
|
+
- **Copilot:** JSON (`.vscode/mcp.json`)
|
|
118
|
+
- **Antigravity:** JSON (`.antigravity/mcp.json`)
|
|
119
|
+
|
|
120
|
+
### 4. MCP Server Management (`core/mcp.ts`)
|
|
121
|
+
|
|
122
|
+
MCP servers have:
|
|
123
|
+
- **Transport:** `stdio` (command-based) or `http`/`sse` (URL-based)
|
|
124
|
+
- **Config:** command, args, env, headers
|
|
125
|
+
- **Secrets:** Stored in `.agents/local.json`
|
|
126
|
+
- **Validation:** Keys must be shell-safe (env) or HTTP token format (headers)
|
|
127
|
+
|
|
128
|
+
### 5. Trust Management (`core/trust.ts`)
|
|
129
|
+
|
|
130
|
+
Codex requires explicit trust per project. We:
|
|
131
|
+
- Check trust state via `codex trust list`
|
|
132
|
+
- Set trust via `codex trust set --path <project>`
|
|
133
|
+
- Store trust in Codex global config
|
|
134
|
+
|
|
135
|
+
### 6. File Safety (`core/fs.ts`)
|
|
136
|
+
|
|
137
|
+
Critical operations use atomic writes:
|
|
138
|
+
- Write to temp file
|
|
139
|
+
- Rename to target (atomic on most filesystems)
|
|
140
|
+
- Prevents data corruption if process crashes
|
|
141
|
+
|
|
142
|
+
## Common Tasks
|
|
143
|
+
|
|
144
|
+
### Adding a New Command
|
|
145
|
+
|
|
146
|
+
1. Create `src/commands/your-command.ts`
|
|
147
|
+
2. Export async function matching command signature
|
|
148
|
+
3. Register in `src/cli.ts` with Commander
|
|
149
|
+
4. Add tests in `tests/your-command.test.ts`
|
|
150
|
+
5. Update README.md command reference
|
|
151
|
+
6. Update CHANGELOG.md
|
|
152
|
+
|
|
153
|
+
### Adding a New Tool Integration
|
|
154
|
+
|
|
155
|
+
1. Create `src/integrations/your-tool.ts`
|
|
156
|
+
2. Implement integration interface (id, name, paths)
|
|
157
|
+
3. Add renderer in `src/core/renderers.ts`
|
|
158
|
+
4. Register in `src/integrations/registry.ts`
|
|
159
|
+
5. Add sync logic in `src/core/sync.ts`
|
|
160
|
+
6. Add tests
|
|
161
|
+
7. Update README supported tools table
|
|
162
|
+
|
|
163
|
+
### Fixing a Bug
|
|
164
|
+
|
|
165
|
+
1. Write a failing test that reproduces the bug
|
|
166
|
+
2. Fix the bug
|
|
167
|
+
3. Verify test passes
|
|
168
|
+
4. Add edge case tests
|
|
169
|
+
5. Update CHANGELOG.md (## Unreleased > ### Fixed)
|
|
170
|
+
|
|
171
|
+
### Adding a Feature
|
|
172
|
+
|
|
173
|
+
1. Discuss in GitHub issue first (if major)
|
|
174
|
+
2. Write tests for new behavior
|
|
175
|
+
3. Implement feature
|
|
176
|
+
4. Update documentation
|
|
177
|
+
5. Update CHANGELOG.md (## Unreleased > ### Added)
|
|
178
|
+
|
|
179
|
+
## Important Patterns
|
|
180
|
+
|
|
181
|
+
### Error Handling
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
// Throw descriptive errors
|
|
185
|
+
throw new Error(`MCP server "${name}" not found in .agents/agents.json`)
|
|
186
|
+
|
|
187
|
+
// User-facing errors should be clear and actionable
|
|
188
|
+
console.error(`Error: Invalid env key "${key}". Use format: [A-Za-z_][A-Za-z0-9_]*`)
|
|
189
|
+
process.exitCode = 1
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### File Operations
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
// Always use atomic writes for critical files
|
|
196
|
+
import { writeJsonAtomic } from './core/fs.js'
|
|
197
|
+
|
|
198
|
+
await writeJsonAtomic(path, data)
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### External CLI Calls
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
// Use spawnSync for external commands
|
|
205
|
+
import { spawnSync } from 'node:child_process'
|
|
206
|
+
|
|
207
|
+
const result = spawnSync('codex', ['trust', 'list'], {
|
|
208
|
+
encoding: 'utf-8',
|
|
209
|
+
stdio: ['ignore', 'pipe', 'pipe']
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
if (result.status !== 0) {
|
|
213
|
+
// Handle error
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Temp Directories in Tests
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
import { mkdtemp, rm } from 'node:fs/promises'
|
|
221
|
+
import { join } from 'node:path'
|
|
222
|
+
import { tmpdir } from 'node:os'
|
|
223
|
+
|
|
224
|
+
describe('my test', () => {
|
|
225
|
+
const tempDirs: string[] = []
|
|
226
|
+
|
|
227
|
+
afterEach(async () => {
|
|
228
|
+
await Promise.all(tempDirs.map(dir => rm(dir, { recursive: true, force: true })))
|
|
229
|
+
tempDirs.length = 0
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
it('does something', async () => {
|
|
233
|
+
const dir = await mkdtemp(join(tmpdir(), 'agents-test-'))
|
|
234
|
+
tempDirs.push(dir)
|
|
235
|
+
// test logic
|
|
236
|
+
})
|
|
237
|
+
})
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## Testing Guidelines
|
|
241
|
+
|
|
242
|
+
### What to Test
|
|
243
|
+
|
|
244
|
+
- ✅ All public functions
|
|
245
|
+
- ✅ Error conditions
|
|
246
|
+
- ✅ Edge cases (empty arrays, null values, etc.)
|
|
247
|
+
- ✅ Integration flows (full command execution)
|
|
248
|
+
- ✅ File I/O (read/write operations)
|
|
249
|
+
- ❌ Don't test third-party libraries
|
|
250
|
+
|
|
251
|
+
### Test Structure
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
describe('feature', () => {
|
|
255
|
+
it('should do X when Y', () => {
|
|
256
|
+
// Arrange
|
|
257
|
+
const input = { ... }
|
|
258
|
+
|
|
259
|
+
// Act
|
|
260
|
+
const result = myFunction(input)
|
|
261
|
+
|
|
262
|
+
// Assert
|
|
263
|
+
expect(result).toBe(expected)
|
|
264
|
+
})
|
|
265
|
+
})
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Flaky Tests
|
|
269
|
+
|
|
270
|
+
If a test is flaky (timing-dependent):
|
|
271
|
+
- Increase timeout: `it('test', { timeout: 10000 }, async () => { ... })`
|
|
272
|
+
- Add retry logic if appropriate
|
|
273
|
+
- Mock external dependencies that cause flakiness
|
|
274
|
+
|
|
275
|
+
## Release Process
|
|
276
|
+
|
|
277
|
+
(For maintainers only - see `.docs-internal/PUBLISHING.md`)
|
|
278
|
+
|
|
279
|
+
1. Update CHANGELOG.md
|
|
280
|
+
2. Bump version: `npm version patch|minor|major`
|
|
281
|
+
3. Build and test: `npm run build && npm test`
|
|
282
|
+
4. Publish: `npm publish --access public`
|
|
283
|
+
5. Create GitHub release with tag
|
|
284
|
+
|
|
285
|
+
## Common Pitfalls
|
|
286
|
+
|
|
287
|
+
### 1. Forgetting Atomic Writes
|
|
288
|
+
|
|
289
|
+
**Wrong:**
|
|
290
|
+
```typescript
|
|
291
|
+
await writeFile(path, JSON.stringify(data))
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
**Right:**
|
|
295
|
+
```typescript
|
|
296
|
+
await writeJsonAtomic(path, data)
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### 2. Not Cleaning Up Temp Dirs in Tests
|
|
300
|
+
|
|
301
|
+
Always use `afterEach` to clean up, or tests will leave garbage in `/tmp`.
|
|
302
|
+
|
|
303
|
+
### 3. Hardcoding Paths
|
|
304
|
+
|
|
305
|
+
**Wrong:**
|
|
306
|
+
```typescript
|
|
307
|
+
const codexConfig = '/Users/me/.codex/config.toml'
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
**Right:**
|
|
311
|
+
```typescript
|
|
312
|
+
import { getCodexConfigPath } from './core/paths.js'
|
|
313
|
+
const codexConfig = getCodexConfigPath()
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### 4. Not Validating User Input
|
|
317
|
+
|
|
318
|
+
Always validate:
|
|
319
|
+
- MCP server names (no spaces, special chars)
|
|
320
|
+
- Env keys (shell-safe format)
|
|
321
|
+
- Header keys (HTTP token format)
|
|
322
|
+
- File paths (absolute, not relative)
|
|
323
|
+
|
|
324
|
+
### 5. Assuming External CLIs Are Available
|
|
325
|
+
|
|
326
|
+
Check if CLI is installed before calling:
|
|
327
|
+
```typescript
|
|
328
|
+
const result = spawnSync('codex', ['--version'], { encoding: 'utf-8' })
|
|
329
|
+
if (result.status !== 0) {
|
|
330
|
+
console.warn('Codex CLI not found. Skipping Codex integration.')
|
|
331
|
+
return
|
|
332
|
+
}
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
## Security Considerations
|
|
336
|
+
|
|
337
|
+
- **Secrets** are stored in `.agents/local.json` (gitignored)
|
|
338
|
+
- Never log secrets to console
|
|
339
|
+
- Use `--secret-env` and `--secret-header` flags for sensitive values
|
|
340
|
+
- Validate all user input (especially paths and shell commands)
|
|
341
|
+
- Don't execute arbitrary code from config files
|
|
342
|
+
|
|
343
|
+
## Performance Tips
|
|
344
|
+
|
|
345
|
+
- Use `sync --check` for drift detection (faster than full sync)
|
|
346
|
+
- Use `status --fast` to skip slow external CLI probes
|
|
347
|
+
- Cache external CLI results when appropriate
|
|
348
|
+
- Use `Promise.all()` for parallel operations
|
|
349
|
+
|
|
350
|
+
## Documentation Standards
|
|
351
|
+
|
|
352
|
+
When updating docs:
|
|
353
|
+
- Keep README.md concise (high-level overview)
|
|
354
|
+
- Put details in `docs/` files
|
|
355
|
+
- Use code examples for clarity
|
|
356
|
+
- Include expected output
|
|
357
|
+
- Add troubleshooting sections
|
|
358
|
+
|
|
359
|
+
## Git Workflow
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
# Create feature branch
|
|
363
|
+
git checkout -b feature/my-feature
|
|
364
|
+
|
|
365
|
+
# Make changes, commit
|
|
366
|
+
git add .
|
|
367
|
+
git commit -m "feat: add new feature"
|
|
368
|
+
|
|
369
|
+
# Push and create PR
|
|
370
|
+
git push origin feature/my-feature
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
**Commit Message Format:**
|
|
374
|
+
- `feat:` — New feature
|
|
375
|
+
- `fix:` — Bug fix
|
|
376
|
+
- `docs:` — Documentation
|
|
377
|
+
- `test:` — Tests
|
|
378
|
+
- `refactor:` — Code refactoring
|
|
379
|
+
- `chore:` — Maintenance
|
|
380
|
+
|
|
381
|
+
## Questions?
|
|
382
|
+
|
|
383
|
+
- Check existing code for patterns
|
|
384
|
+
- Read tests for examples
|
|
385
|
+
- Ask in GitHub Discussions
|
|
386
|
+
- Open an issue if stuck
|
|
387
|
+
|
|
388
|
+
## Key Files Reference
|
|
389
|
+
|
|
390
|
+
- **Entry point:** `src/cli.ts`
|
|
391
|
+
- **Sync logic:** `src/core/sync.ts`
|
|
392
|
+
- **MCP management:** `src/core/mcp.ts`, `src/core/mcpCrud.ts`
|
|
393
|
+
- **Renderers:** `src/core/renderers.ts`
|
|
394
|
+
- **Types:** `src/types.ts`
|
|
395
|
+
- **File I/O:** `src/core/fs.ts`
|
|
396
|
+
- **Paths:** `src/core/paths.ts`
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
**Remember:** The goal is to make multi-LLM development simple. Every feature should reduce friction, not add complexity.
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.7.7] - 2026-02-07
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `agents status --fast` to skip external CLI probes for quicker status checks.
|
|
15
|
+
- `agents doctor --fix-dry-run` to preview automatic fixes without mutating project files.
|
|
16
|
+
- Sync lock handling for `.agents/generated/sync.lock` to guard against concurrent sync runs.
|
|
17
|
+
- New shell-style argument tokenizer for interactive `agents mcp add` argument input.
|
|
18
|
+
- New test suites:
|
|
19
|
+
- `tests/status.command.test.ts`
|
|
20
|
+
- `tests/sync-lock.integration.test.ts`
|
|
21
|
+
- `tests/shell-words.test.ts`
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- npm package publishing is now stricter and reproducible via:
|
|
26
|
+
- `prepack` build hook
|
|
27
|
+
- explicit `files` whitelist in `package.json`
|
|
28
|
+
- CI matrix now validates Node.js `20` and `22` across Linux, macOS, and Windows.
|
|
29
|
+
- Interactive `agents mcp add` now parses quoted/escaped args reliably instead of naive whitespace splitting.
|
|
30
|
+
- README command reference updated for `status --fast` and `doctor --fix-dry-run`.
|
|
31
|
+
- CLI version bumped to `0.7.7`.
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- Reduced sync race conditions by introducing project-local sync lock acquisition before writes.
|
|
36
|
+
- URL-based MCP import now uses timeout + retry behavior, improving resilience to transient network failures.
|
|
37
|
+
|
|
38
|
+
## [0.7.6] - 2026-02-05
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
|
|
42
|
+
- `agents mcp test --runtime` and `--runtime-timeout-ms` for best-effort live MCP health checks via Claude, Gemini, and Cursor CLIs.
|
|
43
|
+
- Doctor now validates syntax for generated/materialized configs:
|
|
44
|
+
- TOML: `.agents/generated/codex.config.toml`, `.codex/config.toml`
|
|
45
|
+
- JSON: generated/materialized Gemini/Copilot/Cursor/Antigravity/Claude payloads
|
|
46
|
+
- New test suites:
|
|
47
|
+
- `tests/mcp-test-runtime.integration.test.ts`
|
|
48
|
+
- `tests/cursor-sync.integration.test.ts`
|
|
49
|
+
- `tests/doctor.integration.test.ts`
|
|
50
|
+
- `tests/sync-validation.integration.test.ts`
|
|
51
|
+
|
|
52
|
+
### Changed
|
|
53
|
+
|
|
54
|
+
- Codex renderer now includes URL-based MCP servers (`http` and legacy `sse`) instead of skipping non-stdio servers.
|
|
55
|
+
- Codex TOML output now quotes env/header keys safely and writes HTTP headers under `http_headers`.
|
|
56
|
+
- `agents mcp test` output now includes runtime details when `--runtime` is used.
|
|
57
|
+
- Cursor status parsing recognizes connection failures as an explicit `error` state.
|
|
58
|
+
- Cursor auto-approval sync no longer retries enable loops for `unknown/error` runtime statuses, improving idempotency.
|
|
59
|
+
- CLI version bumped to `0.7.6`.
|
|
60
|
+
|
|
61
|
+
### Fixed
|
|
62
|
+
|
|
63
|
+
- Prevented invalid env/header keys from producing broken Codex TOML:
|
|
64
|
+
- fail-fast validation in `mcp add` and `mcp import`
|
|
65
|
+
- fail-fast validation during `agents sync` for existing bad configs
|
|
66
|
+
- `agents doctor` now reports invalid MCP env/header keys as errors.
|
|
67
|
+
- Eliminated repeated `cursor-local-approval` drift in `agents sync --check` when Cursor reports persistent connection errors.
|
|
68
|
+
|
|
69
|
+
## [0.7.5] - 2026-02-05
|
|
70
|
+
|
|
71
|
+
### Fixed
|
|
72
|
+
|
|
73
|
+
- Resolved stale Claude MCP leftovers (`agents__*`) surviving across reset/start cycles.
|
|
74
|
+
- Sync now reconciles with actual `claude mcp list` managed entries before applying changes, so orphaned servers are removed automatically.
|
|
75
|
+
|
|
76
|
+
### Added
|
|
77
|
+
|
|
78
|
+
- New Claude CLI parser utility:
|
|
79
|
+
- `src/core/claudeCli.ts`
|
|
80
|
+
- New tests:
|
|
81
|
+
- `tests/claude-cli.test.ts`
|
|
82
|
+
|
|
83
|
+
### Changed
|
|
84
|
+
|
|
85
|
+
- Increased timeout for MCP commands integration test to stabilize environments where local CLI probes are slower.
|
|
86
|
+
- CLI version bumped to `0.7.5`.
|
|
87
|
+
|
|
88
|
+
## [0.7.4] - 2026-02-05
|
|
89
|
+
|
|
90
|
+
### Fixed
|
|
91
|
+
|
|
92
|
+
- `agents mcp add https://mcpservers.org/servers/appcontext-dev` now imports successfully.
|
|
93
|
+
- Import parser now handles MCP snippets provided as plain `<pre><code>...</code></pre>` blocks without a `language-json` class.
|
|
94
|
+
|
|
95
|
+
### Added
|
|
96
|
+
|
|
97
|
+
- Import payload support for direct name->server maps:
|
|
98
|
+
- `{ "appcontext": { "url": "http://localhost:7777/sse", "type": "sse" } }`
|
|
99
|
+
|
|
100
|
+
### Changed
|
|
101
|
+
|
|
102
|
+
- `parseImportedServers` error/help text now documents the plain map payload shape.
|
|
103
|
+
- CLI version bumped to `0.7.4`.
|
|
104
|
+
|
|
105
|
+
## [0.7.3] - 2026-02-05
|
|
106
|
+
|
|
107
|
+
### Fixed
|
|
108
|
+
|
|
109
|
+
- Resolved a regression where `agents mcp add/import` could fail during sync with:
|
|
110
|
+
- `Invalid environment variable value ... contains potentially dangerous characters`
|
|
111
|
+
- Placeholder values like `${GITHUB_TOKEN}` and real API keys containing punctuation now sync correctly to CLI integrations.
|
|
112
|
+
- Validation now blocks only control characters (the command runner uses `spawnSync` without a shell).
|
|
113
|
+
|
|
114
|
+
### Added
|
|
115
|
+
|
|
116
|
+
- New tests for MCP env/header validation behavior:
|
|
117
|
+
- `tests/mcp-validation.test.ts`
|
|
118
|
+
|
|
119
|
+
### Changed
|
|
120
|
+
|
|
121
|
+
- CLI version bumped to `0.7.3`.
|
|
122
|
+
|
|
123
|
+
## [0.7.2] - 2026-02-05
|
|
124
|
+
|
|
125
|
+
### Added
|
|
126
|
+
|
|
127
|
+
- Interactive secret prompt during MCP import for template token/key values (for example `${GITHUB_TOKEN}`, `ghp_xxxx`):
|
|
128
|
+
- asks immediately during `agents mcp import` / URL-driven `agents mcp add`
|
|
129
|
+
- accepts Enter to skip and configure later
|
|
130
|
+
- keeps placeholders in `.agents/agents.json`
|
|
131
|
+
- stores only provided values in `.agents/local.json`
|
|
132
|
+
|
|
133
|
+
### Changed
|
|
134
|
+
|
|
135
|
+
- `splitServerSecrets` now supports placeholder-only secret keys/indexes without forcing local secret values.
|
|
136
|
+
- README clarifies Antigravity CLI naming (`antigravity`) and the new import-time secret prompt flow.
|
|
137
|
+
- CLI version bumped to `0.7.2`.
|
|
138
|
+
|
|
139
|
+
## [0.7.1] - 2026-02-05
|
|
140
|
+
|
|
141
|
+
### Added
|
|
142
|
+
|
|
143
|
+
- URL import fallback for `mcpservers.org` pages without JSON snippets:
|
|
144
|
+
- detects linked GitHub repo
|
|
145
|
+
- fetches README
|
|
146
|
+
- extracts MCP JSON/JSONC code blocks automatically
|
|
147
|
+
|
|
148
|
+
### Changed
|
|
149
|
+
|
|
150
|
+
- `agents mcp import --file` now gives a clear validation error when a URL is passed (`--file` is local path only, use `--url` for websites).
|
|
151
|
+
- URL import error message now points users to the correct flows (`--url` for JSON pages, or explicit `--json` / `--file` snippets).
|
|
152
|
+
|
|
153
|
+
### Fixed
|
|
154
|
+
|
|
155
|
+
- `agents mcp add <mcpservers-url>` now works for pages like `cameroncooke/xcodebuildmcp` that previously failed extraction with “Could not extract MCP JSON payload from URL”.
|
|
156
|
+
|
|
157
|
+
## [0.7.0] - 2026-02-05
|
|
158
|
+
|
|
159
|
+
### Added
|
|
160
|
+
|
|
161
|
+
- `agents status --verbose` for full files/probes breakdown while default output is compact.
|
|
162
|
+
- `agents mcp doctor` alias for `agents mcp test`.
|
|
163
|
+
- New Cursor CLI parser helper (`src/core/cursorCli.ts`) for robust MCP status parsing.
|
|
164
|
+
|
|
165
|
+
### Changed
|
|
166
|
+
|
|
167
|
+
- CLI version bumped to `0.7.0`.
|
|
168
|
+
- `agents start` preflight now shows only actionable warnings (missing tools), reducing setup noise.
|
|
169
|
+
- Warning output across commands is now compacted and deduplicated.
|
|
170
|
+
- Cursor sync now self-heals approval drift: it checks `cursor-agent mcp list` and re-enables non-ready servers.
|
|
171
|
+
- Antigravity payload now includes both `servers` and `mcpServers` for compatibility.
|
|
172
|
+
- Status probe output is more reliable for Cursor (handles terminal control sequences correctly).
|
|
173
|
+
|
|
174
|
+
### Fixed
|
|
175
|
+
|
|
176
|
+
- Claude MCP sync no longer emits repeated "already exists in local config" warnings for already-managed servers.
|
|
177
|
+
|
|
178
|
+
## [0.6.0] - 2026-02-05
|
|
179
|
+
|
|
180
|
+
### Added
|
|
181
|
+
|
|
182
|
+
- New `agents mcp` toolkit for project-local MCP lifecycle:
|
|
183
|
+
- `agents mcp list`
|
|
184
|
+
- `agents mcp add`
|
|
185
|
+
- `agents mcp import` (strict JSON/JSONC from file/inline/stdin/URL)
|
|
186
|
+
- `agents mcp remove`
|
|
187
|
+
- `agents mcp test`
|
|
188
|
+
- New MCP core helpers:
|
|
189
|
+
- `src/core/mcpValidation.ts`
|
|
190
|
+
- `src/core/mcpCrud.ts`
|
|
191
|
+
- `src/core/mcpImport.ts`
|
|
192
|
+
- `src/core/mcpSecrets.ts`
|
|
193
|
+
- New MCP-focused test suites:
|
|
194
|
+
- `tests/mcp-import.test.ts`
|
|
195
|
+
- `tests/mcp-crud.test.ts`
|
|
196
|
+
- `tests/mcp-secrets.test.ts`
|
|
197
|
+
- `tests/mcp-commands.integration.test.ts`
|
|
198
|
+
- `tests/mcp-test.integration.test.ts`
|
|
199
|
+
|
|
200
|
+
### Changed
|
|
201
|
+
|
|
202
|
+
- CLI version bumped to `0.6.0`
|
|
203
|
+
- `agents mcp add <https://...>` now auto-detects URL input and delegates to import flow
|
|
204
|
+
- `agents status` now includes MCP totals and local override counts
|
|
205
|
+
- `agents doctor` now warns about unresolved MCP placeholders and likely secret literals in `.agents/agents.json`
|
|
206
|
+
- Sync security checks now reuse shared MCP validation helpers
|
|
207
|
+
|
|
208
|
+
## [0.5.0] - 2026-02-05
|
|
209
|
+
|
|
210
|
+
### Added
|
|
211
|
+
|
|
212
|
+
- New compact `.agents` format:
|
|
213
|
+
- `.agents/agents.json`
|
|
214
|
+
- `.agents/local.json`
|
|
215
|
+
- `.agents/skills/*/SKILL.md`
|
|
216
|
+
- `.agents/generated/*`
|
|
217
|
+
- Managed VS Code hiding for tool directories via `.vscode/settings.json` (JSONC merge)
|
|
218
|
+
- VS Code settings state tracking in `.agents/generated/vscode.settings.state.json`
|
|
219
|
+
- New test suite: `tests/vscode-settings.test.ts`
|
|
220
|
+
|
|
221
|
+
### Changed
|
|
222
|
+
|
|
223
|
+
- Root `AGENTS.md` is now canonical
|
|
224
|
+
- MCP registry is now project-local (no global catalog dependency)
|
|
225
|
+
- `agents start` simplified to project-local setup defaults
|
|
226
|
+
- Skills bridges now include Gemini (`.gemini/skills`) in addition to Claude and Cursor
|
|
227
|
+
|
|
228
|
+
### Removed
|
|
229
|
+
|
|
230
|
+
- `.agents/project.json`
|
|
231
|
+
- `.agents/mcp/selection.json`
|
|
232
|
+
- `.agents/mcp/local.json`
|
|
233
|
+
- `.agents/AGENTS.md`
|
|
234
|
+
- Global catalog/preset flow
|
|
235
|
+
|
|
236
|
+
## [0.4.1] - 2026-02-05
|
|
237
|
+
|
|
238
|
+
### Fixed
|
|
239
|
+
|
|
240
|
+
- **CRITICAL**: Fixed `namesToRemove` bug in Claude MCP sync ([src/core/sync.ts:277](src/core/sync.ts#L277))
|
|
241
|
+
- Previously used `union` of current and desired servers instead of `difference`
|
|
242
|
+
- This caused ALL servers (both current and desired) to be removed and re-added
|
|
243
|
+
- Now correctly removes only servers that exist in current but not in desired
|
|
244
|
+
|
|
245
|
+
- **CRITICAL**: Added error handling for `JSON.parse` operations
|
|
246
|
+
- [src/core/fs.ts:25](src/core/fs.ts#L25): Now provides helpful error messages when JSON parsing fails
|
|
247
|
+
- [src/core/sync.ts:194](src/core/sync.ts#L194): Added handling for empty/invalid generated configs
|
|
248
|
+
- [src/core/sync.ts:198-202](src/core/sync.ts#L198): Now warns about corrupted files instead of silently ignoring them
|
|
249
|
+
|
|
250
|
+
### Security
|
|
251
|
+
|
|
252
|
+
- Added server name validation to prevent command injection attacks
|
|
253
|
+
- Server names must only contain alphanumeric characters, hyphens, underscores, colons, and dots
|
|
254
|
+
- Prevents path traversal attempts with `..`
|
|
255
|
+
- Applied to both Claude and Cursor sync operations
|
|
256
|
+
|
|
257
|
+
- Added environment variable and header value validation
|
|
258
|
+
- Validates values in `addClaudeServer` before using them in CLI commands
|
|
259
|
+
- Rejects values containing shell metacharacters: `` ` $ \ ; | & < > ( ) { } [ ] ! ``
|
|
260
|
+
- Rejects values containing control characters
|
|
261
|
+
|
|
262
|
+
### Added
|
|
263
|
+
|
|
264
|
+
- New test suite: `tests/validation.test.ts`
|
|
265
|
+
- Tests JSON parsing error handling with invalid and empty JSON files
|
|
266
|
+
|
|
267
|
+
- New test suite: `tests/real-project-mcp.test.ts`
|
|
268
|
+
- Validates real MCP configuration (dogfooding)
|
|
269
|
+
- Checks for `.claude` directory and settings
|
|
270
|
+
- Queries `claude mcp list` to verify agents-managed servers
|
|
271
|
+
- Provides informational output about project MCP status
|
|
272
|
+
- Helps catch configuration drift and ensures tests run against real-world setups
|
|
273
|
+
|
|
274
|
+
- Added 10 new tests (total: 24 tests, up from 14)
|
|
275
|
+
|
|
276
|
+
### Changed
|
|
277
|
+
|
|
278
|
+
- Improved error messages for JSON parsing failures
|
|
279
|
+
- Now includes file path and specific parse error
|
|
280
|
+
- Distinguishes between file-not-found and corrupted file errors
|
|
281
|
+
|
|
282
|
+
## [0.4.0] - 2026-02-04
|
|
283
|
+
|
|
284
|
+
### Added
|
|
285
|
+
|
|
286
|
+
- Cursor and Antigravity support
|
|
287
|
+
- Complete onboarding with sync hub
|
|
288
|
+
- Trust flow for Codex
|
|
289
|
+
|
|
290
|
+
### Changed
|
|
291
|
+
|
|
292
|
+
- Bootstrap v1 with multi-tool MCP sync
|
|
293
|
+
- Improved integration handling
|
|
294
|
+
|
|
295
|
+
## [Earlier versions]
|
|
296
|
+
|
|
297
|
+
See git history for changes before 0.4.0.
|