coding-agent-adapters 0.2.18 → 0.2.19

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.
Files changed (2) hide show
  1. package/README.md +72 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -161,6 +161,62 @@ aider.getRecommendedModels({ googleKey: 'AIza...' });
161
161
  // { powerful: 'gemini/gemini-3-pro', fast: 'gemini/gemini-3-flash' }
162
162
  ```
163
163
 
164
+ ## Workspace Files & Memory
165
+
166
+ Each coding agent CLI has its own convention for project-level memory files (instructions the agent reads on startup) and config files. Adapters expose this knowledge so orchestration systems can write context to the correct files before spawning an agent.
167
+
168
+ ### Discovering Workspace Files
169
+
170
+ ```typescript
171
+ import { ClaudeAdapter, AiderAdapter } from 'coding-agent-adapters';
172
+
173
+ const claude = new ClaudeAdapter();
174
+ claude.getWorkspaceFiles();
175
+ // [
176
+ // { relativePath: 'CLAUDE.md', type: 'memory', autoLoaded: true, format: 'markdown', ... },
177
+ // { relativePath: '.claude/settings.json', type: 'config', autoLoaded: true, format: 'json', ... },
178
+ // { relativePath: '.claude/commands', type: 'config', autoLoaded: false, format: 'markdown', ... },
179
+ // ]
180
+
181
+ claude.memoryFilePath; // 'CLAUDE.md'
182
+
183
+ const aider = new AiderAdapter();
184
+ aider.memoryFilePath; // '.aider.conventions.md'
185
+ ```
186
+
187
+ ### Per-Adapter File Mappings
188
+
189
+ | Adapter | Memory File | Config | Other |
190
+ |---------|------------|--------|-------|
191
+ | Claude | `CLAUDE.md` | `.claude/settings.json` | `.claude/commands` |
192
+ | Gemini | `GEMINI.md` | `.gemini/settings.json` | `.gemini/styles` |
193
+ | Codex | `AGENTS.md` | `.codex/config.json` | `codex.md` |
194
+ | Aider | `.aider.conventions.md` | `.aider.conf.yml` | `.aiderignore` |
195
+
196
+ ### Writing Memory Files
197
+
198
+ Use `writeMemoryFile()` to write instructions into a workspace before spawning an agent. Parent directories are created automatically.
199
+
200
+ ```typescript
201
+ const adapter = new ClaudeAdapter();
202
+
203
+ // Write to the adapter's default memory file (CLAUDE.md)
204
+ await adapter.writeMemoryFile('/path/to/workspace', `# Project Context
205
+ This is a TypeScript monorepo using pnpm workspaces.
206
+ Always run tests before committing.
207
+ `);
208
+
209
+ // Append to an existing memory file
210
+ await adapter.writeMemoryFile('/path/to/workspace', '\n## Additional Rules\nUse snake_case.\n', {
211
+ append: true,
212
+ });
213
+
214
+ // Write to a custom file (e.g., template-specific context for sub-agents)
215
+ await adapter.writeMemoryFile('/path/to/workspace', '# Task-Specific Context\n...', {
216
+ fileName: 'TASK_CONTEXT.md',
217
+ });
218
+ ```
219
+
164
220
  ## Preflight Check
165
221
 
166
222
  Before spawning agents, check if the required CLIs are installed:
@@ -218,12 +274,18 @@ Extend `BaseCodingAdapter` to create adapters for other coding CLIs:
218
274
 
219
275
  ```typescript
220
276
  import { BaseCodingAdapter } from 'coding-agent-adapters';
277
+ import type { AgentFileDescriptor, InstallationInfo, ModelRecommendations } from 'coding-agent-adapters';
221
278
  import type { SpawnConfig, ParsedOutput, LoginDetection, AutoResponseRule } from 'pty-manager';
222
279
 
223
280
  export class CursorAdapter extends BaseCodingAdapter {
224
281
  readonly adapterType = 'cursor';
225
282
  readonly displayName = 'Cursor';
226
283
 
284
+ readonly installation: InstallationInfo = {
285
+ command: 'npm install -g cursor-cli',
286
+ docsUrl: 'https://cursor.sh/docs',
287
+ };
288
+
227
289
  // Set to false if the CLI uses text prompts instead of TUI menus
228
290
  override readonly usesTuiMenus = false;
229
291
 
@@ -231,6 +293,16 @@ export class CursorAdapter extends BaseCodingAdapter {
231
293
  { pattern: /accept terms/i, type: 'tos', response: 'y', responseType: 'text', description: 'Accept TOS', safe: true, once: true },
232
294
  ];
233
295
 
296
+ getWorkspaceFiles(): AgentFileDescriptor[] {
297
+ return [
298
+ { relativePath: '.cursor/rules', description: 'Project rules', autoLoaded: true, type: 'memory', format: 'markdown' },
299
+ ];
300
+ }
301
+
302
+ getRecommendedModels(): ModelRecommendations {
303
+ return { powerful: 'claude-sonnet-4', fast: 'gpt-4o-mini' };
304
+ }
305
+
234
306
  getCommand(): string { return 'cursor'; }
235
307
  getArgs(config: SpawnConfig): string[] { return ['--cli']; }
236
308
  getEnv(config: SpawnConfig): Record<string, string> { return {}; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coding-agent-adapters",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
4
4
  "description": "CLI adapters for AI coding agents - Claude Code, Gemini CLI, OpenAI Codex, and Aider",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",