@gonzih/cc-agent 0.1.11 → 0.2.1
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 +101 -38
- package/dist/index.js +152 -0
- package/dist/index.js.map +1 -1
- package/dist/profiles.d.ts +16 -0
- package/dist/profiles.d.ts.map +1 -0
- package/dist/profiles.js +44 -0
- package/dist/profiles.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,60 +1,109 @@
|
|
|
1
1
|
# cc-agent
|
|
2
2
|
|
|
3
|
-
MCP server for spawning Claude Code agents in
|
|
3
|
+
MCP server for spawning Claude Code agents in GitHub repos. Give Claude Code the ability to **branch itself** — clone a repo and kick off a sub-agent to work on it autonomously, with persistent state across MCP restarts.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Exposes 5 MCP tools:
|
|
8
|
-
|
|
9
|
-
| Tool | Description |
|
|
10
|
-
|------|-------------|
|
|
11
|
-
| `spawn_agent` | Clone a git repo and run Claude Code on a task inside it |
|
|
12
|
-
| `get_job_status` | Check status of a spawned job |
|
|
13
|
-
| `get_job_output` | Stream output lines from a job |
|
|
14
|
-
| `list_jobs` | List all jobs |
|
|
15
|
-
| `cancel_job` | Cancel a running job |
|
|
16
|
-
|
|
17
|
-
Claude submits a job → cc-agent clones the repo → starts Claude Code in it with the task → returns immediately with a job ID → caller polls for output.
|
|
5
|
+
Built by [@Gonzih](https://github.com/Gonzih).
|
|
18
6
|
|
|
19
7
|
## Quickstart
|
|
20
8
|
|
|
21
9
|
```bash
|
|
22
|
-
# Add to Claude Code MCP config
|
|
23
10
|
claude mcp add cc-agent -- npx @gonzih/cc-agent
|
|
24
11
|
```
|
|
25
12
|
|
|
26
13
|
Set one of:
|
|
27
14
|
```bash
|
|
28
|
-
|
|
29
|
-
ANTHROPIC_API_KEY=sk-ant-api03-...
|
|
15
|
+
CLAUDE_CODE_OAUTH_TOKEN=sk-ant-oat01-... # OAuth token (recommended)
|
|
16
|
+
ANTHROPIC_API_KEY=sk-ant-api03-... # API key
|
|
30
17
|
```
|
|
31
18
|
|
|
32
|
-
|
|
19
|
+
Restart Claude Code. You now have 7 new MCP tools.
|
|
33
20
|
|
|
34
|
-
##
|
|
21
|
+
## MCP Tools
|
|
22
|
+
|
|
23
|
+
| Tool | Description |
|
|
24
|
+
|------|-------------|
|
|
25
|
+
| `spawn_agent` | Clone a repo, optionally create a branch, run Claude Code on a task |
|
|
26
|
+
| `list_jobs` | List all jobs with status, recent tool calls, and exit info |
|
|
27
|
+
| `get_job_status` | Check status of a specific job |
|
|
28
|
+
| `get_job_output` | Stream output lines from a job (supports offset for tailing) |
|
|
29
|
+
| `cancel_job` | Kill a running job |
|
|
30
|
+
| `send_message` | Write a message to a running agent's stdin mid-task |
|
|
31
|
+
| `get_version` | Return the running cc-agent version |
|
|
32
|
+
|
|
33
|
+
## spawn_agent parameters
|
|
34
|
+
|
|
35
|
+
| Parameter | Type | Required | Description |
|
|
36
|
+
|-----------|------|----------|-------------|
|
|
37
|
+
| `repo_url` | string | yes | Git repo to clone (HTTPS) |
|
|
38
|
+
| `task` | string | yes | Task prompt for Claude Code |
|
|
39
|
+
| `branch` | string | no | Existing branch to check out after clone |
|
|
40
|
+
| `create_branch` | string | no | New branch to create (e.g. `feat/my-feature`) |
|
|
41
|
+
| `claude_token` | string | no | Per-job token override |
|
|
42
|
+
| `continue_session` | boolean | no | Pass `--continue` to resume last Claude session in workdir |
|
|
43
|
+
| `max_budget_usd` | number | no | Spend cap in USD (default: 20). Prevents runaway costs |
|
|
44
|
+
|
|
45
|
+
## Usage example
|
|
35
46
|
|
|
36
47
|
```
|
|
37
48
|
spawn_agent({
|
|
38
49
|
repo_url: "https://github.com/yourorg/yourrepo",
|
|
39
|
-
task: "
|
|
40
|
-
create_branch: "
|
|
50
|
+
task: "Add error handling to all API endpoints. Open a PR when done.",
|
|
51
|
+
create_branch: "feat/error-handling",
|
|
52
|
+
max_budget_usd: 5
|
|
41
53
|
})
|
|
42
54
|
// → { job_id: "abc-123", status: "started" }
|
|
43
55
|
|
|
44
|
-
|
|
45
|
-
// → {
|
|
56
|
+
list_jobs()
|
|
57
|
+
// → [{ id: "abc-123", status: "running", recentTools: ["Read", "Edit", "Bash", ...] }]
|
|
58
|
+
|
|
59
|
+
get_job_output({ job_id: "abc-123", offset: 0 })
|
|
60
|
+
// → { lines: ["[cc-agent] Cloning...", "Reading src/api.ts...", ...], done: false }
|
|
61
|
+
|
|
62
|
+
send_message({ job_id: "abc-123", message: "Also update the tests." })
|
|
63
|
+
// → { ok: true }
|
|
46
64
|
```
|
|
47
65
|
|
|
48
|
-
##
|
|
66
|
+
## Persistent job storage
|
|
49
67
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
68
|
+
Job state is persisted to `<cwd>/.cc-agent/` across MCP server restarts:
|
|
69
|
+
|
|
70
|
+
- `.cc-agent/jobs.json` — full job metadata (status, exit code, PID, params)
|
|
71
|
+
- `.cc-agent/jobs/<id>.log` — per-job output log
|
|
72
|
+
|
|
73
|
+
On restart, jobs whose processes are still alive are recovered as `running`. Dead PIDs are marked `failed` automatically. This means **you don't lose job history if the MCP server restarts**.
|
|
74
|
+
|
|
75
|
+
`.cc-agent/` is gitignored automatically.
|
|
76
|
+
|
|
77
|
+
## Tool call visibility
|
|
78
|
+
|
|
79
|
+
`list_jobs` returns `recentTools` — the last 10 tool names Claude called per job (e.g. `["Read", "Edit", "Bash", "Glob"]`). `get_job_output` returns the full `tool_calls` array. This gives insight into what agents are actually doing during silent periods.
|
|
54
80
|
|
|
55
|
-
|
|
81
|
+
## Budget control
|
|
56
82
|
|
|
57
|
-
|
|
83
|
+
Set `max_budget_usd` per job to cap spend. Default is $20. Claude Code is killed with SIGTERM when the budget is exhausted (exit code 143).
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
spawn_agent({ ..., max_budget_usd: 10 }) // up to $10 for this task
|
|
87
|
+
spawn_agent({ ..., max_budget_usd: 2 }) // quick/cheap task
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Agent delegation pattern
|
|
91
|
+
|
|
92
|
+
The recommended mental model: **you are the tech lead, agents are your team**.
|
|
93
|
+
|
|
94
|
+
- Spawn agents for any task touching a codebase (multiple files, running tests, opening PRs)
|
|
95
|
+
- Do research, quick edits, and orchestration yourself
|
|
96
|
+
- Always end agent prompts with the terminal steps: `gh pr create → gh pr merge → npm publish` (or whatever ships the work)
|
|
97
|
+
- Monitor with `list_jobs` + `get_job_output`, respawn if budget runs out
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
# Standard agent task prompt ending:
|
|
101
|
+
gh pr create --title "feat: ..." --body "..." --base main
|
|
102
|
+
gh pr merge --squash --auto
|
|
103
|
+
npm version patch && npm publish # if it's a library
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## MCP config (claude.json)
|
|
58
107
|
|
|
59
108
|
```json
|
|
60
109
|
{
|
|
@@ -62,7 +111,7 @@ Per-job token override available via `claude_token` argument on `spawn_agent`.
|
|
|
62
111
|
"command": "npx",
|
|
63
112
|
"args": ["@gonzih/cc-agent"],
|
|
64
113
|
"env": {
|
|
65
|
-
"
|
|
114
|
+
"CLAUDE_CODE_OAUTH_TOKEN": "sk-ant-oat01-..."
|
|
66
115
|
}
|
|
67
116
|
}
|
|
68
117
|
}
|
|
@@ -70,14 +119,28 @@ Per-job token override available via `claude_token` argument on `spawn_agent`.
|
|
|
70
119
|
|
|
71
120
|
## How it works
|
|
72
121
|
|
|
73
|
-
1. `spawn_agent` creates a job and returns immediately
|
|
122
|
+
1. `spawn_agent` creates a job record (persisted to disk) and returns immediately with a job ID
|
|
74
123
|
2. In background: `git clone --depth 1 <repo>` into a temp dir
|
|
75
|
-
3. Optionally checks out
|
|
76
|
-
4. Runs `claude --print --output-format stream-json --dangerously-skip-permissions
|
|
77
|
-
5. Streams
|
|
78
|
-
6.
|
|
79
|
-
7.
|
|
124
|
+
3. Optionally checks out an existing branch or creates a new one
|
|
125
|
+
4. Runs `claude --print --output-format stream-json --verbose --dangerously-skip-permissions --max-budget-usd <N> <task>`
|
|
126
|
+
5. Streams stdout/stderr into the job's output log (in memory + disk)
|
|
127
|
+
6. Tool calls are captured from the stream-JSON and stored in `tool_calls[]`
|
|
128
|
+
7. On exit: job marked done/failed, workdir cleaned up after 10 minutes
|
|
129
|
+
8. Jobs expire from memory after 1 hour (log file remains on disk)
|
|
130
|
+
|
|
131
|
+
## Environment variables
|
|
132
|
+
|
|
133
|
+
| Variable | Description |
|
|
134
|
+
|----------|-------------|
|
|
135
|
+
| `CLAUDE_CODE_OAUTH_TOKEN` | Claude OAuth token (recommended) |
|
|
136
|
+
| `ANTHROPIC_API_KEY` | Anthropic API key (alternative) |
|
|
137
|
+
|
|
138
|
+
## Requirements
|
|
139
|
+
|
|
140
|
+
- Node.js 18+
|
|
141
|
+
- `claude` CLI: `npm install -g @anthropic-ai/claude-code`
|
|
142
|
+
- Git
|
|
80
143
|
|
|
81
144
|
## Related
|
|
82
145
|
|
|
83
|
-
- [cc-tg](https://github.com/Gonzih/cc-tg) — Claude Code Telegram bot (
|
|
146
|
+
- [cc-tg](https://github.com/Gonzih/cc-tg) — Claude Code Telegram bot by [@Gonzih](https://github.com/Gonzih)
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
|
20
20
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
21
21
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
22
22
|
import { JobManager } from "./agent.js";
|
|
23
|
+
import { loadProfiles, upsertProfile, deleteProfile, getProfile, interpolate } from "./profiles.js";
|
|
23
24
|
import { createRequire } from "module";
|
|
24
25
|
const require = createRequire(import.meta.url);
|
|
25
26
|
const { version: PKG_VERSION } = require("../package.json");
|
|
@@ -133,6 +134,87 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
133
134
|
description: "Returns the running cc-agent MCP server version.",
|
|
134
135
|
inputSchema: { type: "object", properties: {} },
|
|
135
136
|
},
|
|
137
|
+
{
|
|
138
|
+
name: "create_profile",
|
|
139
|
+
description: "Save a named spawn config (profile) for repeated use. Task templates support {{variable}} substitution.\n\n// Create once:\n// create_profile('fix-bugs', 'https://github.com/me/app', 'Fix {{issue}}: {{title}}', 5)\n// Use many times:\n// spawn_from_profile('fix-bugs', { issue: '42', title: 'Login broken' })",
|
|
140
|
+
inputSchema: {
|
|
141
|
+
type: "object",
|
|
142
|
+
properties: {
|
|
143
|
+
name: {
|
|
144
|
+
type: "string",
|
|
145
|
+
description: "Profile name (alphanumeric, dash, underscore only)",
|
|
146
|
+
},
|
|
147
|
+
repo_url: {
|
|
148
|
+
type: "string",
|
|
149
|
+
description: "Git repository URL to clone",
|
|
150
|
+
},
|
|
151
|
+
task_template: {
|
|
152
|
+
type: "string",
|
|
153
|
+
description: "Task description template; use {{varName}} for substitution",
|
|
154
|
+
},
|
|
155
|
+
default_budget_usd: {
|
|
156
|
+
type: "number",
|
|
157
|
+
description: "Default USD budget for jobs spawned from this profile (optional)",
|
|
158
|
+
},
|
|
159
|
+
branch: {
|
|
160
|
+
type: "string",
|
|
161
|
+
description: "Branch to checkout after cloning (optional)",
|
|
162
|
+
},
|
|
163
|
+
description: {
|
|
164
|
+
type: "string",
|
|
165
|
+
description: "Human-readable description of this profile (optional)",
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
required: ["name", "repo_url", "task_template"],
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: "list_profiles",
|
|
173
|
+
description: "List all saved named job profiles.",
|
|
174
|
+
inputSchema: { type: "object", properties: {} },
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: "delete_profile",
|
|
178
|
+
description: "Delete a named job profile.",
|
|
179
|
+
inputSchema: {
|
|
180
|
+
type: "object",
|
|
181
|
+
properties: {
|
|
182
|
+
name: { type: "string", description: "Profile name to delete" },
|
|
183
|
+
},
|
|
184
|
+
required: ["name"],
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: "spawn_from_profile",
|
|
189
|
+
description: "Spawn an agent job from a saved profile. Supports variable interpolation and per-call overrides.",
|
|
190
|
+
inputSchema: {
|
|
191
|
+
type: "object",
|
|
192
|
+
properties: {
|
|
193
|
+
profile_name: {
|
|
194
|
+
type: "string",
|
|
195
|
+
description: "Name of the profile to use",
|
|
196
|
+
},
|
|
197
|
+
vars: {
|
|
198
|
+
type: "object",
|
|
199
|
+
description: "Variables to interpolate into the task template (e.g. { issue: '42', title: 'Login broken' })",
|
|
200
|
+
additionalProperties: { type: "string" },
|
|
201
|
+
},
|
|
202
|
+
task_override: {
|
|
203
|
+
type: "string",
|
|
204
|
+
description: "Use this task instead of the profile's template (optional)",
|
|
205
|
+
},
|
|
206
|
+
branch_override: {
|
|
207
|
+
type: "string",
|
|
208
|
+
description: "Override the profile's branch (optional)",
|
|
209
|
+
},
|
|
210
|
+
budget_override: {
|
|
211
|
+
type: "number",
|
|
212
|
+
description: "Override the profile's default budget (optional)",
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
required: ["profile_name"],
|
|
216
|
+
},
|
|
217
|
+
},
|
|
136
218
|
],
|
|
137
219
|
}));
|
|
138
220
|
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
@@ -242,6 +324,76 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
242
324
|
return {
|
|
243
325
|
content: [{ type: "text", text: JSON.stringify({ version: PKG_VERSION }) }],
|
|
244
326
|
};
|
|
327
|
+
case "create_profile": {
|
|
328
|
+
const name = a.name;
|
|
329
|
+
if (!/^[\w-]+$/.test(name)) {
|
|
330
|
+
return {
|
|
331
|
+
content: [{ type: "text", text: JSON.stringify({ error: "Profile name must be alphanumeric with dashes/underscores only" }) }],
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
upsertProfile({
|
|
335
|
+
name,
|
|
336
|
+
repoUrl: a.repo_url,
|
|
337
|
+
taskTemplate: a.task_template,
|
|
338
|
+
defaultBudgetUsd: a.default_budget_usd,
|
|
339
|
+
branch: a.branch,
|
|
340
|
+
description: a.description,
|
|
341
|
+
createdAt: new Date().toISOString(),
|
|
342
|
+
});
|
|
343
|
+
return {
|
|
344
|
+
content: [{ type: "text", text: JSON.stringify({ ok: true, message: `Profile '${name}' saved.` }) }],
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
case "list_profiles": {
|
|
348
|
+
const profiles = loadProfiles().map(({ name, repoUrl, description, defaultBudgetUsd }) => ({
|
|
349
|
+
name,
|
|
350
|
+
repoUrl,
|
|
351
|
+
description,
|
|
352
|
+
defaultBudgetUsd,
|
|
353
|
+
}));
|
|
354
|
+
return {
|
|
355
|
+
content: [{ type: "text", text: JSON.stringify({ profiles, total: profiles.length }) }],
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
case "delete_profile": {
|
|
359
|
+
const deleted = deleteProfile(a.name);
|
|
360
|
+
return {
|
|
361
|
+
content: [
|
|
362
|
+
{
|
|
363
|
+
type: "text",
|
|
364
|
+
text: JSON.stringify(deleted
|
|
365
|
+
? { ok: true, message: `Profile '${a.name}' deleted.` }
|
|
366
|
+
: { error: `Profile '${a.name}' not found.` }),
|
|
367
|
+
},
|
|
368
|
+
],
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
case "spawn_from_profile": {
|
|
372
|
+
const profile = getProfile(a.profile_name);
|
|
373
|
+
if (!profile) {
|
|
374
|
+
return {
|
|
375
|
+
content: [{ type: "text", text: JSON.stringify({ error: `Profile '${a.profile_name}' not found.` }) }],
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
const vars = (a.vars ?? {});
|
|
379
|
+
const task = a.task_override
|
|
380
|
+
? a.task_override
|
|
381
|
+
: interpolate(profile.taskTemplate, vars);
|
|
382
|
+
const jobId = await manager.spawn({
|
|
383
|
+
repoUrl: profile.repoUrl,
|
|
384
|
+
task,
|
|
385
|
+
branch: a.branch_override ?? profile.branch,
|
|
386
|
+
maxBudgetUsd: a.budget_override ?? profile.defaultBudgetUsd,
|
|
387
|
+
});
|
|
388
|
+
return {
|
|
389
|
+
content: [
|
|
390
|
+
{
|
|
391
|
+
type: "text",
|
|
392
|
+
text: JSON.stringify({ job_id: jobId, status: "started", profile: a.profile_name, message: "Agent spawned. Use get_job_output to follow progress." }),
|
|
393
|
+
},
|
|
394
|
+
],
|
|
395
|
+
};
|
|
396
|
+
}
|
|
245
397
|
default:
|
|
246
398
|
throw new Error(`Unknown tool: ${name}`);
|
|
247
399
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;AAEnF,MAAM,KAAK,GACT,OAAO,CAAC,GAAG,CAAC,iBAAiB;IAC7B,OAAO,CAAC,GAAG,CAAC,uBAAuB;IACnC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;AAEhC,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;AAEt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AAG,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAA2B,CAAC;YACtD,MAAM,IAAI,GAAG,CAAC,CAAC,aAAa;gBAC1B,CAAC,CAAE,CAAC,CAAC,aAAwB;gBAC7B,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;YAC5C,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC;gBAChC,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,IAAI;gBACJ,MAAM,EAAG,CAAC,CAAC,eAAsC,IAAI,OAAO,CAAC,MAAM;gBACnE,YAAY,EAAG,CAAC,CAAC,eAAsC,IAAI,OAAO,CAAC,gBAAgB;aACpF,CAAC,CAAC;YACH,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC,YAAY,EAAE,OAAO,EAAE,uDAAuD,EAAE,CAAC;qBACtJ;iBACF;aACF,CAAC;QACJ,CAAC;QAED;YACE,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface Profile {
|
|
2
|
+
name: string;
|
|
3
|
+
repoUrl: string;
|
|
4
|
+
taskTemplate: string;
|
|
5
|
+
defaultBudgetUsd?: number;
|
|
6
|
+
branch?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
createdAt: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function loadProfiles(): Profile[];
|
|
11
|
+
export declare function saveProfiles(profiles: Profile[]): void;
|
|
12
|
+
export declare function getProfile(name: string): Profile | undefined;
|
|
13
|
+
export declare function upsertProfile(profile: Profile): void;
|
|
14
|
+
export declare function deleteProfile(name: string): boolean;
|
|
15
|
+
export declare function interpolate(template: string, vars: Record<string, string>): string;
|
|
16
|
+
//# sourceMappingURL=profiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,YAAY,IAAI,OAAO,EAAE,CAOxC;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,CAGtD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAE5D;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAMpD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOnD;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAElF"}
|
package/dist/profiles.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
import { homedir } from "os";
|
|
4
|
+
const STATE_DIR = join(homedir(), ".cc-agent");
|
|
5
|
+
const PROFILES_FILE = join(STATE_DIR, "profiles.json");
|
|
6
|
+
export function loadProfiles() {
|
|
7
|
+
if (!existsSync(PROFILES_FILE))
|
|
8
|
+
return [];
|
|
9
|
+
try {
|
|
10
|
+
return JSON.parse(readFileSync(PROFILES_FILE, "utf-8"));
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function saveProfiles(profiles) {
|
|
17
|
+
mkdirSync(STATE_DIR, { recursive: true });
|
|
18
|
+
writeFileSync(PROFILES_FILE, JSON.stringify(profiles, null, 2), "utf-8");
|
|
19
|
+
}
|
|
20
|
+
export function getProfile(name) {
|
|
21
|
+
return loadProfiles().find((p) => p.name === name);
|
|
22
|
+
}
|
|
23
|
+
export function upsertProfile(profile) {
|
|
24
|
+
const profiles = loadProfiles();
|
|
25
|
+
const idx = profiles.findIndex((p) => p.name === profile.name);
|
|
26
|
+
if (idx >= 0)
|
|
27
|
+
profiles[idx] = profile;
|
|
28
|
+
else
|
|
29
|
+
profiles.push(profile);
|
|
30
|
+
saveProfiles(profiles);
|
|
31
|
+
}
|
|
32
|
+
export function deleteProfile(name) {
|
|
33
|
+
const profiles = loadProfiles();
|
|
34
|
+
const idx = profiles.findIndex((p) => p.name === name);
|
|
35
|
+
if (idx < 0)
|
|
36
|
+
return false;
|
|
37
|
+
profiles.splice(idx, 1);
|
|
38
|
+
saveProfiles(profiles);
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
export function interpolate(template, vars) {
|
|
42
|
+
return template.replace(/\{\{(\w+)\}\}/g, (_, key) => vars[key] ?? `{{${key}}}`);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=profiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IA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