@iambarryking/ag 3.0.0 → 3.1.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 +99 -30
- package/dist/cli/parser.d.ts.map +1 -1
- package/dist/cli/parser.js +11 -21
- package/dist/cli/parser.js.map +1 -1
- package/dist/cli/repl.d.ts.map +1 -1
- package/dist/cli/repl.js +221 -133
- package/dist/cli/repl.js.map +1 -1
- package/dist/core/agent.d.ts +9 -1
- package/dist/core/agent.d.ts.map +1 -1
- package/dist/core/agent.js +58 -15
- package/dist/core/agent.js.map +1 -1
- package/dist/core/config.d.ts +1 -0
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +2 -1
- package/dist/core/config.js.map +1 -1
- package/dist/core/registry.d.ts +11 -0
- package/dist/core/registry.d.ts.map +1 -0
- package/dist/core/registry.js +62 -0
- package/dist/core/registry.js.map +1 -0
- package/dist/core/skills.d.ts +14 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +92 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/version.d.ts +2 -0
- package/dist/core/version.d.ts.map +1 -0
- package/dist/core/version.js +7 -0
- package/dist/core/version.js.map +1 -0
- package/dist/memory/memory.d.ts.map +1 -1
- package/dist/memory/memory.js +9 -2
- package/dist/memory/memory.js.map +1 -1
- package/dist/tools/bash.js +1 -1
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/git.d.ts +3 -0
- package/dist/tools/git.d.ts.map +1 -0
- package/dist/tools/git.js +217 -0
- package/dist/tools/git.js.map +1 -0
- package/dist/tools/memory.d.ts.map +1 -1
- package/dist/tools/memory.js +17 -11
- package/dist/tools/memory.js.map +1 -1
- package/dist/tools/plan.d.ts +0 -1
- package/dist/tools/plan.d.ts.map +1 -1
- package/dist/tools/plan.js +28 -33
- package/dist/tools/plan.js.map +1 -1
- package/dist/tools/skill.d.ts +6 -0
- package/dist/tools/skill.d.ts.map +1 -0
- package/dist/tools/skill.js +20 -0
- package/dist/tools/skill.js.map +1 -0
- package/dist/tools/web.d.ts +3 -0
- package/dist/tools/web.d.ts.map +1 -0
- package/dist/tools/web.js +158 -0
- package/dist/tools/web.js.map +1 -0
- package/package.json +14 -5
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
function run(args, cwd) {
|
|
5
|
+
return execFileSync('git', args, { cwd, encoding: 'utf-8', timeout: 30_000 }).trim();
|
|
6
|
+
}
|
|
7
|
+
function tryRun(args, cwd) {
|
|
8
|
+
try {
|
|
9
|
+
return { ok: true, out: run(args, cwd) };
|
|
10
|
+
}
|
|
11
|
+
catch (e) {
|
|
12
|
+
return { ok: false, out: ((e.stdout ?? '') + (e.stderr ?? '')).trim() };
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function isRepo(cwd) {
|
|
16
|
+
return existsSync(join(cwd, '.git'));
|
|
17
|
+
}
|
|
18
|
+
function defaultBranch(cwd) {
|
|
19
|
+
const ref = tryRun(['symbolic-ref', 'refs/remotes/origin/HEAD'], cwd);
|
|
20
|
+
if (ref.ok)
|
|
21
|
+
return ref.out.replace('refs/remotes/origin/', '');
|
|
22
|
+
const branches = tryRun(['branch', '-r'], cwd);
|
|
23
|
+
if (branches.ok) {
|
|
24
|
+
if (branches.out.includes('origin/main'))
|
|
25
|
+
return 'main';
|
|
26
|
+
if (branches.out.includes('origin/master'))
|
|
27
|
+
return 'master';
|
|
28
|
+
}
|
|
29
|
+
return 'main';
|
|
30
|
+
}
|
|
31
|
+
function currentBranch(cwd) {
|
|
32
|
+
const result = tryRun(['rev-parse', '--abbrev-ref', 'HEAD'], cwd);
|
|
33
|
+
if (result.ok)
|
|
34
|
+
return result.out;
|
|
35
|
+
// No commits yet — check symbolic ref for initial branch name
|
|
36
|
+
const sym = tryRun(['symbolic-ref', '--short', 'HEAD'], cwd);
|
|
37
|
+
return sym.ok ? `${sym.out} (no commits yet)` : '(no commits yet)';
|
|
38
|
+
}
|
|
39
|
+
function remoteUrl(cwd) {
|
|
40
|
+
const r = tryRun(['remote', 'get-url', 'origin'], cwd);
|
|
41
|
+
return r.ok ? r.out : '';
|
|
42
|
+
}
|
|
43
|
+
function compareUrl(cwd, branch) {
|
|
44
|
+
const remote = remoteUrl(cwd);
|
|
45
|
+
if (!remote)
|
|
46
|
+
return '';
|
|
47
|
+
const base = defaultBranch(cwd);
|
|
48
|
+
const url = remote
|
|
49
|
+
.replace(/^git@([^:]+):/, 'https://$1/')
|
|
50
|
+
.replace(/\.git$/, '');
|
|
51
|
+
return `${url}/compare/${base}...${branch}`;
|
|
52
|
+
}
|
|
53
|
+
// ── Action handlers ────────────────────────────────────────────────────────
|
|
54
|
+
function doStatus(cwd) {
|
|
55
|
+
if (!isRepo(cwd))
|
|
56
|
+
return 'Not a git repository. Use action=init first.';
|
|
57
|
+
const lines = [];
|
|
58
|
+
lines.push(`Branch: ${currentBranch(cwd)}`);
|
|
59
|
+
const remote = remoteUrl(cwd);
|
|
60
|
+
if (remote)
|
|
61
|
+
lines.push(`Remote: ${remote}`);
|
|
62
|
+
const status = run(['status', '--porcelain'], cwd);
|
|
63
|
+
if (status) {
|
|
64
|
+
const files = status.split('\n');
|
|
65
|
+
const staged = files.filter(f => /^[MADRC]/.test(f)).length;
|
|
66
|
+
const unstaged = files.filter(f => /^.[MADRC]/.test(f)).length;
|
|
67
|
+
const untracked = files.filter(f => f.startsWith('??')).length;
|
|
68
|
+
lines.push(`Changes: ${staged} staged, ${unstaged} unstaged, ${untracked} untracked`);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
lines.push('Working tree clean.');
|
|
72
|
+
}
|
|
73
|
+
const ahead = tryRun(['rev-list', '@{u}..HEAD', '--count'], cwd);
|
|
74
|
+
const behind = tryRun(['rev-list', 'HEAD..@{u}', '--count'], cwd);
|
|
75
|
+
if (ahead.ok && behind.ok) {
|
|
76
|
+
lines.push(`Ahead: ${ahead.out}, Behind: ${behind.out}`);
|
|
77
|
+
}
|
|
78
|
+
const log = tryRun(['log', '--oneline', '-5'], cwd);
|
|
79
|
+
if (log.ok && log.out)
|
|
80
|
+
lines.push(`\nRecent commits:\n${log.out}`);
|
|
81
|
+
return lines.join('\n');
|
|
82
|
+
}
|
|
83
|
+
function doInit(cwd, remote) {
|
|
84
|
+
if (isRepo(cwd)) {
|
|
85
|
+
const branch = currentBranch(cwd);
|
|
86
|
+
const existing = remoteUrl(cwd);
|
|
87
|
+
let msg = `Already a git repo. Branch: ${branch}`;
|
|
88
|
+
if (existing)
|
|
89
|
+
msg += `, Remote: ${existing}`;
|
|
90
|
+
if (remote && remote !== existing) {
|
|
91
|
+
tryRun(['remote', 'remove', 'origin'], cwd);
|
|
92
|
+
run(['remote', 'add', 'origin', remote], cwd);
|
|
93
|
+
msg += `\nRemote updated to: ${remote}`;
|
|
94
|
+
}
|
|
95
|
+
return msg;
|
|
96
|
+
}
|
|
97
|
+
run(['init'], cwd);
|
|
98
|
+
let msg = 'Initialized git repository.';
|
|
99
|
+
if (remote) {
|
|
100
|
+
run(['remote', 'add', 'origin', remote], cwd);
|
|
101
|
+
msg += ` Remote set to: ${remote}`;
|
|
102
|
+
}
|
|
103
|
+
return msg;
|
|
104
|
+
}
|
|
105
|
+
function doBranch(cwd, name) {
|
|
106
|
+
if (!isRepo(cwd))
|
|
107
|
+
return 'Not a git repository. Use action=init first.';
|
|
108
|
+
const lines = [];
|
|
109
|
+
const status = run(['status', '--porcelain'], cwd);
|
|
110
|
+
if (status) {
|
|
111
|
+
lines.push(`Warning: ${status.split('\n').length} uncommitted change(s). Consider committing or stashing first.`);
|
|
112
|
+
}
|
|
113
|
+
const fetch = tryRun(['fetch', 'origin'], cwd);
|
|
114
|
+
if (fetch.ok) {
|
|
115
|
+
lines.push('Fetched latest from origin.');
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
lines.push('Warning: Could not fetch from origin (no remote or offline). Branching from local state.');
|
|
119
|
+
}
|
|
120
|
+
const base = defaultBranch(cwd);
|
|
121
|
+
if (fetch.ok) {
|
|
122
|
+
tryRun(['checkout', base], cwd);
|
|
123
|
+
tryRun(['reset', '--hard', `origin/${base}`], cwd);
|
|
124
|
+
lines.push(`Updated local ${base} to origin/${base}.`);
|
|
125
|
+
}
|
|
126
|
+
const result = tryRun(['checkout', '-b', name], cwd);
|
|
127
|
+
if (result.ok) {
|
|
128
|
+
lines.push(`Created and switched to branch: ${name}`);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
const sw = tryRun(['checkout', name], cwd);
|
|
132
|
+
lines.push(sw.ok
|
|
133
|
+
? `Branch ${name} already exists. Switched to it.`
|
|
134
|
+
: `Error creating branch: ${result.out}`);
|
|
135
|
+
}
|
|
136
|
+
return lines.join('\n');
|
|
137
|
+
}
|
|
138
|
+
function doCommit(cwd, message, files) {
|
|
139
|
+
if (!isRepo(cwd))
|
|
140
|
+
return 'Not a git repository. Use action=init first.';
|
|
141
|
+
if (files && files.length > 0) {
|
|
142
|
+
run(['add', ...files], cwd);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
run(['add', '-A'], cwd);
|
|
146
|
+
}
|
|
147
|
+
const staged = tryRun(['diff', '--cached', '--stat'], cwd);
|
|
148
|
+
if (!staged.out)
|
|
149
|
+
return 'Nothing to commit. Working tree clean.';
|
|
150
|
+
const result = tryRun(['commit', '-m', message], cwd);
|
|
151
|
+
return result.ok ? `Committed: ${message}\n${result.out}` : `Commit failed: ${result.out}`;
|
|
152
|
+
}
|
|
153
|
+
function doPush(cwd, force) {
|
|
154
|
+
if (!isRepo(cwd))
|
|
155
|
+
return 'Not a git repository. Use action=init first.';
|
|
156
|
+
const branch = currentBranch(cwd);
|
|
157
|
+
const base = defaultBranch(cwd);
|
|
158
|
+
if (branch === base) {
|
|
159
|
+
return `You're on ${base}. Create a feature branch first with action=branch.`;
|
|
160
|
+
}
|
|
161
|
+
const args = ['push', '-u', 'origin', branch];
|
|
162
|
+
if (force)
|
|
163
|
+
args.splice(1, 0, '--force-with-lease');
|
|
164
|
+
const result = tryRun(args, cwd);
|
|
165
|
+
const lines = [];
|
|
166
|
+
if (result.ok || result.out.includes('->')) {
|
|
167
|
+
lines.push(`Pushed ${branch} to origin.`);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
return `Push failed: ${result.out}`;
|
|
171
|
+
}
|
|
172
|
+
const url = compareUrl(cwd, branch);
|
|
173
|
+
if (url)
|
|
174
|
+
lines.push(`\nCreate PR: ${url}`);
|
|
175
|
+
return lines.join('\n');
|
|
176
|
+
}
|
|
177
|
+
// ── Exported tool ──────────────────────────────────────────────────────────
|
|
178
|
+
export function gitTool(cwd) {
|
|
179
|
+
return {
|
|
180
|
+
type: 'function',
|
|
181
|
+
function: {
|
|
182
|
+
name: 'git',
|
|
183
|
+
description: 'Git operations. Actions: status (branch, changes, recent commits), init (initialize repo), branch (create from latest main), commit (stage + commit), push (push + PR compare URL).',
|
|
184
|
+
parameters: {
|
|
185
|
+
type: 'object',
|
|
186
|
+
properties: {
|
|
187
|
+
action: { type: 'string', enum: ['status', 'init', 'branch', 'commit', 'push'], description: 'The git operation to perform.' },
|
|
188
|
+
name: { type: 'string', description: 'Branch name (for action=branch, e.g. "feature/add-auth").' },
|
|
189
|
+
message: { type: 'string', description: 'Commit message (for action=commit).' },
|
|
190
|
+
files: { type: 'array', items: { type: 'string' }, description: 'Specific files to stage (for action=commit). Omit to stage all.' },
|
|
191
|
+
remote: { type: 'string', description: 'Remote URL (for action=init, e.g. "git@github.com:user/repo.git").' },
|
|
192
|
+
force: { type: 'boolean', description: 'Force push with lease (for action=push). Default: false.' }
|
|
193
|
+
},
|
|
194
|
+
required: ['action']
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
execute: ({ action, name, message, files, remote, force }) => {
|
|
198
|
+
switch (action) {
|
|
199
|
+
case 'status': return doStatus(cwd);
|
|
200
|
+
case 'init': return doInit(cwd, remote);
|
|
201
|
+
case 'branch': {
|
|
202
|
+
if (!name)
|
|
203
|
+
return 'Error: name is required for action=branch.';
|
|
204
|
+
return doBranch(cwd, name);
|
|
205
|
+
}
|
|
206
|
+
case 'commit': {
|
|
207
|
+
if (!message)
|
|
208
|
+
return 'Error: message is required for action=commit.';
|
|
209
|
+
return doCommit(cwd, message, files);
|
|
210
|
+
}
|
|
211
|
+
case 'push': return doPush(cwd, force);
|
|
212
|
+
default: return `Unknown action "${action}". Use: status, init, branch, commit, push.`;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=git.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/tools/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,SAAS,GAAG,CAAC,IAAc,EAAE,GAAW;IACtC,OAAO,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AACvF,CAAC;AAED,SAAS,MAAM,CAAC,IAAc,EAAE,GAAW;IACzC,IAAI,CAAC;QACH,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;IAC3C,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,IAAI,EAA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AAM,kBAAkB,CAAC;AAGxC,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/tools/memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGxC,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CA8B5C"}
|
package/dist/tools/memory.js
CHANGED
|
@@ -3,24 +3,30 @@ export function memoryTool(cwd) {
|
|
|
3
3
|
return {
|
|
4
4
|
type: 'function',
|
|
5
5
|
function: {
|
|
6
|
-
name: '
|
|
7
|
-
description: '
|
|
6
|
+
name: 'memory',
|
|
7
|
+
description: 'Memory operations. Actions: save (persist a fact, decision, or pattern for future sessions).',
|
|
8
8
|
parameters: {
|
|
9
9
|
type: 'object',
|
|
10
10
|
properties: {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
action: { type: 'string', enum: ['save'], description: 'The memory operation to perform.' },
|
|
12
|
+
tier: { type: 'string', enum: ['global', 'project'], description: '"global" for preferences, coding style, patterns that apply everywhere. "project" for architecture decisions, current ticket, PR templates, gotchas specific to this codebase.' },
|
|
13
|
+
content: { type: 'string', description: 'The fact, decision, or pattern to remember.' }
|
|
13
14
|
},
|
|
14
|
-
required: ['tier', 'content']
|
|
15
|
+
required: ['action', 'tier', 'content']
|
|
15
16
|
}
|
|
16
17
|
},
|
|
17
|
-
execute: ({ tier, content }) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
execute: ({ action, tier, content }) => {
|
|
19
|
+
switch (action) {
|
|
20
|
+
case 'save': {
|
|
21
|
+
if (tier === 'global') {
|
|
22
|
+
appendGlobalMemory(content, cwd);
|
|
23
|
+
return 'Saved to global memory.';
|
|
24
|
+
}
|
|
25
|
+
appendProjectMemory(content, cwd);
|
|
26
|
+
return 'Saved to project memory.';
|
|
27
|
+
}
|
|
28
|
+
default: return `Unknown action "${action}". Use: save.`;
|
|
21
29
|
}
|
|
22
|
-
appendProjectMemory(content, cwd);
|
|
23
|
-
return `Saved to project memory.`;
|
|
24
30
|
}
|
|
25
31
|
};
|
|
26
32
|
}
|
package/dist/tools/memory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../src/tools/memory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE9E,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE;YACR,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../src/tools/memory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE9E,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE;YACR,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,8FAA8F;YAC3G,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,kCAAkC,EAAE;oBAC3F,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,WAAW,EAAE,gLAAgL,EAAE;oBACpP,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6CAA6C,EAAE;iBACxF;gBACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC;aACxC;SACF;QACD,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAqD,EAAU,EAAE;YAChG,QAAQ,MAAM,EAAE,CAAC;gBACf,KAAK,MAAM,CAAC,CAAC,CAAC;oBACZ,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;wBACtB,kBAAkB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;wBACjC,OAAO,yBAAyB,CAAC;oBACnC,CAAC;oBACD,mBAAmB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;oBAClC,OAAO,0BAA0B,CAAC;gBACpC,CAAC;gBACD,OAAO,CAAC,CAAC,OAAO,mBAAmB,MAAM,eAAe,CAAC;YAC3D,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/plan.d.ts
CHANGED
package/dist/tools/plan.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/tools/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGxC,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/tools/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGxC,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAsC1C"}
|
package/dist/tools/plan.js
CHANGED
|
@@ -3,46 +3,41 @@ export function planTool(cwd) {
|
|
|
3
3
|
return {
|
|
4
4
|
type: 'function',
|
|
5
5
|
function: {
|
|
6
|
-
name: '
|
|
7
|
-
description: 'Save a new plan
|
|
6
|
+
name: 'plan',
|
|
7
|
+
description: 'Manage task plans. Save a new plan, list all plans, or read a specific plan by name. Plans are timestamped and the latest is automatically loaded as context.',
|
|
8
8
|
parameters: {
|
|
9
9
|
type: 'object',
|
|
10
10
|
properties: {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
action: { type: 'string', enum: ['save', 'list', 'read'], description: '"save" to create a new plan, "list" to see all plans, "read" to view a specific plan.' },
|
|
12
|
+
content: { type: 'string', description: 'Plan content (required for action=save).' },
|
|
13
|
+
name: { type: 'string', description: 'Plan name for save (e.g. "refactor-cli") or read (e.g. "2026-04-13T12-31-22-refactor-cli").' }
|
|
13
14
|
},
|
|
14
|
-
required: ['
|
|
15
|
+
required: ['action']
|
|
15
16
|
}
|
|
16
17
|
},
|
|
17
|
-
execute: ({ content, name }) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const content = loadPlanByName(name, cwd);
|
|
40
|
-
return content || `No plan found with name "${name}".`;
|
|
18
|
+
execute: ({ action, content, name }) => {
|
|
19
|
+
switch (action) {
|
|
20
|
+
case 'save': {
|
|
21
|
+
if (!content)
|
|
22
|
+
return 'Error: content is required for action=save.';
|
|
23
|
+
savePlan(content, name, cwd);
|
|
24
|
+
return `Plan saved.${name ? ` (${name})` : ''}`;
|
|
25
|
+
}
|
|
26
|
+
case 'list': {
|
|
27
|
+
const plans = listPlans(cwd);
|
|
28
|
+
if (plans.length === 0)
|
|
29
|
+
return 'No plans saved yet.';
|
|
30
|
+
return plans.map(p => p.name).join('\n');
|
|
31
|
+
}
|
|
32
|
+
case 'read': {
|
|
33
|
+
if (!name)
|
|
34
|
+
return 'Error: name is required for action=read. Use action=list to see available plans.';
|
|
35
|
+
const result = loadPlanByName(name, cwd);
|
|
36
|
+
return result || `No plan found with name "${name}".`;
|
|
37
|
+
}
|
|
38
|
+
default:
|
|
39
|
+
return `Unknown action "${action}". Use "save", "list", or "read".`;
|
|
41
40
|
}
|
|
42
|
-
const plans = listPlans(cwd);
|
|
43
|
-
if (plans.length === 0)
|
|
44
|
-
return 'No plans saved yet.';
|
|
45
|
-
return plans.map(p => p.name).join('\n');
|
|
46
41
|
}
|
|
47
42
|
};
|
|
48
43
|
}
|
package/dist/tools/plan.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/tools/plan.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1E,MAAM,UAAU,QAAQ,CAAC,GAAW;IAClC,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE;YACR,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/tools/plan.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1E,MAAM,UAAU,QAAQ,CAAC,GAAW;IAClC,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE;YACR,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,+JAA+J;YAC5K,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,EAAE,uFAAuF,EAAE;oBAChK,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,0CAA0C,EAAE;oBACpF,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6FAA6F,EAAE;iBACrI;gBACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;aACrB;SACF;QACD,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE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IAAI,EAAE,SAAS,GAAG,IAAI,CAkB/C"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function skillTool(host) {
|
|
2
|
+
return {
|
|
3
|
+
type: 'function',
|
|
4
|
+
function: {
|
|
5
|
+
name: 'skill',
|
|
6
|
+
description: 'Activate a skill by name to load its full instructions into context. Check <available-skills> in your system prompt for what is available.',
|
|
7
|
+
parameters: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
name: { type: 'string', description: 'Skill name to activate (from the available-skills catalog).' }
|
|
11
|
+
},
|
|
12
|
+
required: ['name']
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
execute: async ({ name }) => {
|
|
16
|
+
return host.activateSkill(name);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=skill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.js","sourceRoot":"","sources":["../../src/tools/skill.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,SAAS,CAAC,IAAe;IACvC,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE;YACR,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,4IAA4I;YACzJ,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6DAA6D,EAAE;iBACrG;gBACD,QAAQ,EAAE,CAAC,MAAM,CAAC;aACnB;SACF;QACD,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAoB,EAAmB,EAAE;YAC7D,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../src/tools/web.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAuJxC,wBAAgB,OAAO,IAAI,IAAI,CAiC9B"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { createInterface } from 'node:readline';
|
|
2
|
+
import { loadConfig, saveConfig } from '../core/config.js';
|
|
3
|
+
// ── HTML stripping (native fallback when Jina is unavailable) ─────────────
|
|
4
|
+
function stripHtml(html) {
|
|
5
|
+
let text = html;
|
|
6
|
+
// Remove script, style, nav, header, footer, aside blocks
|
|
7
|
+
text = text.replace(/<(script|style|nav|header|footer|aside)\b[^>]*>[\s\S]*?<\/\1>/gi, '');
|
|
8
|
+
// Try to extract article or main content
|
|
9
|
+
const article = text.match(/<(article|main)\b[^>]*>([\s\S]*?)<\/\1>/i);
|
|
10
|
+
if (article)
|
|
11
|
+
text = article[2];
|
|
12
|
+
// Convert headings to markdown-style
|
|
13
|
+
text = text.replace(/<h([1-6])\b[^>]*>([\s\S]*?)<\/h\1>/gi, (_m, _l, content) => `\n## ${content.trim()}\n`);
|
|
14
|
+
// Convert links to text (url) format
|
|
15
|
+
text = text.replace(/<a\b[^>]*href="([^"]*)"[^>]*>([\s\S]*?)<\/a>/gi, (_m, href, content) => {
|
|
16
|
+
const label = content.replace(/<[^>]+>/g, '').trim();
|
|
17
|
+
return href && !href.startsWith('#') ? `${label} (${href})` : label;
|
|
18
|
+
});
|
|
19
|
+
// Convert block elements to newlines
|
|
20
|
+
text = text.replace(/<\/?(p|div|li|tr|br)\b[^>]*\/?>/gi, '\n');
|
|
21
|
+
// Strip all remaining tags
|
|
22
|
+
text = text.replace(/<[^>]+>/g, '');
|
|
23
|
+
// Decode common HTML entities
|
|
24
|
+
text = text
|
|
25
|
+
.replace(/&/g, '&')
|
|
26
|
+
.replace(/</g, '<')
|
|
27
|
+
.replace(/>/g, '>')
|
|
28
|
+
.replace(/"/g, '"')
|
|
29
|
+
.replace(/'/g, "'")
|
|
30
|
+
.replace(/ /g, ' ');
|
|
31
|
+
// Collapse whitespace
|
|
32
|
+
text = text.replace(/[ \t]+/g, ' ');
|
|
33
|
+
text = text.replace(/\n{3,}/g, '\n\n');
|
|
34
|
+
return text.trim();
|
|
35
|
+
}
|
|
36
|
+
// ── Action handlers ───────────────────────────────────────────────────────
|
|
37
|
+
async function doFetch(url, raw) {
|
|
38
|
+
if (!/^https?:\/\//i.test(url)) {
|
|
39
|
+
return 'Error: URL must start with http:// or https://';
|
|
40
|
+
}
|
|
41
|
+
const fetchOpts = { signal: AbortSignal.timeout(15_000) };
|
|
42
|
+
// Try Jina Reader first (returns clean markdown, handles JS-rendered pages)
|
|
43
|
+
if (!raw) {
|
|
44
|
+
try {
|
|
45
|
+
const res = await fetch(`https://r.jina.ai/${url}`, {
|
|
46
|
+
...fetchOpts,
|
|
47
|
+
headers: { 'Accept': 'text/markdown' }
|
|
48
|
+
});
|
|
49
|
+
if (res.ok) {
|
|
50
|
+
const text = await res.text();
|
|
51
|
+
if (text.trim())
|
|
52
|
+
return text;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// Fall through to native fetch
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// Native fetch fallback
|
|
60
|
+
try {
|
|
61
|
+
const res = await fetch(url, fetchOpts);
|
|
62
|
+
if (!res.ok)
|
|
63
|
+
return `Fetch error: HTTP ${res.status}`;
|
|
64
|
+
const contentType = res.headers.get('content-type') || '';
|
|
65
|
+
if (contentType.includes('application/json')) {
|
|
66
|
+
const json = await res.json();
|
|
67
|
+
return JSON.stringify(json, null, 2);
|
|
68
|
+
}
|
|
69
|
+
const text = await res.text();
|
|
70
|
+
if (contentType.includes('text/html')) {
|
|
71
|
+
return stripHtml(text);
|
|
72
|
+
}
|
|
73
|
+
return text;
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
return `Fetch failed: ${error.message}`;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
async function ensureTavilyKey() {
|
|
80
|
+
const existing = process.env.TAVILY_API_KEY || loadConfig().tavilyApiKey;
|
|
81
|
+
if (existing)
|
|
82
|
+
return existing;
|
|
83
|
+
// Interactive prompt if TTY
|
|
84
|
+
if (process.stdin.isTTY) {
|
|
85
|
+
const C = await import('../core/colors.js').then(m => m.C);
|
|
86
|
+
console.error(`\n${C.bold}Web search requires a Tavily API key${C.reset}`);
|
|
87
|
+
console.error(`Sign up free (no credit card): ${C.cyan}https://app.tavily.com${C.reset}\n`);
|
|
88
|
+
const rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
89
|
+
const key = await new Promise(resolve => rl.question(`${C.yellow}Enter your Tavily API key:${C.reset} `, resolve));
|
|
90
|
+
rl.close();
|
|
91
|
+
const trimmed = key.trim();
|
|
92
|
+
if (!trimmed)
|
|
93
|
+
return null;
|
|
94
|
+
saveConfig({ tavilyApiKey: trimmed });
|
|
95
|
+
console.error(`${C.green}Key saved to config.${C.reset}\n`);
|
|
96
|
+
return trimmed;
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
async function doSearch(query) {
|
|
101
|
+
const key = await ensureTavilyKey();
|
|
102
|
+
if (!key) {
|
|
103
|
+
return 'Error: Tavily API key not configured. Sign up free at https://tavily.com (no credit card needed), then set TAVILY_API_KEY env var or run /config set tavilyApiKey <key>';
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
const res = await fetch('https://api.tavily.com/search', {
|
|
107
|
+
method: 'POST',
|
|
108
|
+
headers: { 'Content-Type': 'application/json' },
|
|
109
|
+
signal: AbortSignal.timeout(15_000),
|
|
110
|
+
body: JSON.stringify({ api_key: key, query, max_results: 5 })
|
|
111
|
+
});
|
|
112
|
+
if (!res.ok)
|
|
113
|
+
return `Search error: HTTP ${res.status}`;
|
|
114
|
+
const data = await res.json();
|
|
115
|
+
if (!data.results?.length)
|
|
116
|
+
return 'No results found.';
|
|
117
|
+
return data.results.map((r, i) => `${i + 1}. ${r.title || '(untitled)'}\n ${r.url || ''}\n ${r.content || ''}`).join('\n\n');
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
return `Search failed: ${error.message}`;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// ── Exported tool ─────────────────────────────────────────────────────────
|
|
124
|
+
export function webTool() {
|
|
125
|
+
return {
|
|
126
|
+
type: 'function',
|
|
127
|
+
function: {
|
|
128
|
+
name: 'web',
|
|
129
|
+
description: 'Web operations. Actions: fetch (retrieve readable content from a URL), search (search the web for current information via Tavily).',
|
|
130
|
+
parameters: {
|
|
131
|
+
type: 'object',
|
|
132
|
+
properties: {
|
|
133
|
+
action: { type: 'string', enum: ['fetch', 'search'], description: 'The web operation to perform.' },
|
|
134
|
+
url: { type: 'string', description: 'URL to fetch (for action=fetch).' },
|
|
135
|
+
query: { type: 'string', description: 'Search query (for action=search).' },
|
|
136
|
+
raw: { type: 'boolean', description: 'If true, use native fetch + HTML stripping instead of Jina Reader (for action=fetch). Default: false.' }
|
|
137
|
+
},
|
|
138
|
+
required: ['action']
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
execute: async ({ action, url, query, raw }) => {
|
|
142
|
+
switch (action) {
|
|
143
|
+
case 'fetch': {
|
|
144
|
+
if (!url)
|
|
145
|
+
return 'Error: url is required for action=fetch.';
|
|
146
|
+
return doFetch(url, raw);
|
|
147
|
+
}
|
|
148
|
+
case 'search': {
|
|
149
|
+
if (!query)
|
|
150
|
+
return 'Error: query is required for action=search.';
|
|
151
|
+
return doSearch(query);
|
|
152
|
+
}
|
|
153
|
+
default: return `Unknown action "${action}". Use: fetch, search.`;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/tools/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAA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