iskills 0.2.60 → 0.2.61
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/AGENT-CLI.md +61 -0
- package/README.md +20 -17
- package/README.zh-CN.md +20 -17
- package/bin/command-route.mjs +15 -0
- package/bin/iskills.js +14 -7
- package/dist/src/cli.js +4 -12
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/agent/arguments.d.ts +10 -0
- package/dist/src/commands/agent/arguments.js +60 -0
- package/dist/src/commands/agent/arguments.js.map +1 -0
- package/dist/src/commands/agent/index.d.ts +1 -0
- package/dist/src/commands/agent/index.js +773 -0
- package/dist/src/commands/agent/index.js.map +1 -0
- package/dist/src/commands/browser-actions.js +36 -7
- package/dist/src/commands/browser-actions.js.map +1 -1
- package/dist/src/commands/index.d.ts +0 -3
- package/dist/src/commands/index.js +0 -33
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/library.js +73 -117
- package/dist/src/commands/library.js.map +1 -1
- package/dist/src/commands/mcp.d.ts +1 -3
- package/dist/src/commands/mcp.js +7 -240
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/domain/agent-collection-write.d.ts +2 -0
- package/dist/src/domain/agent-collection-write.js +230 -0
- package/dist/src/domain/agent-collection-write.js.map +1 -0
- package/dist/src/domain/agent-mcp-write.d.ts +23 -0
- package/dist/src/domain/agent-mcp-write.js +927 -0
- package/dist/src/domain/agent-mcp-write.js.map +1 -0
- package/dist/src/domain/agent-read.d.ts +38 -0
- package/dist/src/domain/agent-read.js +524 -0
- package/dist/src/domain/agent-read.js.map +1 -0
- package/dist/src/domain/agent-skill-write.d.ts +34 -0
- package/dist/src/domain/agent-skill-write.js +859 -0
- package/dist/src/domain/agent-skill-write.js.map +1 -0
- package/dist/src/domain/agent-write.d.ts +9 -0
- package/dist/src/domain/agent-write.js +127 -0
- package/dist/src/domain/agent-write.js.map +1 -0
- package/dist/src/domain/collection-write.d.ts +3 -1
- package/dist/src/domain/collection-write.js +109 -33
- package/dist/src/domain/collection-write.js.map +1 -1
- package/dist/src/domain/core.d.ts +11 -0
- package/dist/src/domain/core.js +39 -1
- package/dist/src/domain/core.js.map +1 -1
- package/dist/src/domain/cross-agent-install.js +3 -5
- package/dist/src/domain/cross-agent-install.js.map +1 -1
- package/dist/src/domain/errors.d.ts +1 -0
- package/dist/src/domain/errors.js +3 -0
- package/dist/src/domain/errors.js.map +1 -1
- package/dist/src/domain/git.d.ts +19 -1
- package/dist/src/domain/git.js +112 -72
- package/dist/src/domain/git.js.map +1 -1
- package/dist/src/domain/install-target.js +10 -1
- package/dist/src/domain/install-target.js.map +1 -1
- package/dist/src/domain/mcp/collection.d.ts +3 -0
- package/dist/src/domain/mcp/collection.js +26 -4
- package/dist/src/domain/mcp/collection.js.map +1 -1
- package/dist/src/domain/mcp/dialects/borrow.js +1 -5
- package/dist/src/domain/mcp/dialects/borrow.js.map +1 -1
- package/dist/src/domain/mcp/index.d.ts +1 -1
- package/dist/src/domain/mcp/index.js +1 -1
- package/dist/src/domain/mcp/index.js.map +1 -1
- package/dist/src/domain/mcp/io.js +1 -1
- package/dist/src/domain/mcp/io.js.map +1 -1
- package/dist/src/domain/mcp/location-write.d.ts +3 -0
- package/dist/src/domain/mcp/location-write.js +39 -0
- package/dist/src/domain/mcp/location-write.js.map +1 -0
- package/dist/src/domain/mcp/probe.d.ts +2 -0
- package/dist/src/domain/mcp/probe.js +2 -1
- package/dist/src/domain/mcp/probe.js.map +1 -1
- package/dist/src/domain/mcp/recipe.d.ts +1 -1
- package/dist/src/domain/mcp/recipe.js +6 -5
- package/dist/src/domain/mcp/recipe.js.map +1 -1
- package/dist/src/domain/mcp/secrets.js +12 -11
- package/dist/src/domain/mcp/secrets.js.map +1 -1
- package/dist/src/domain/mcp/types.d.ts +2 -0
- package/dist/src/domain/mcp/write.js +49 -35
- package/dist/src/domain/mcp/write.js.map +1 -1
- package/dist/src/domain/operation.d.ts +30 -0
- package/dist/src/domain/operation.js +107 -0
- package/dist/src/domain/operation.js.map +1 -0
- package/dist/src/domain/process.d.ts +3 -0
- package/dist/src/domain/process.js +81 -0
- package/dist/src/domain/process.js.map +1 -0
- package/dist/src/domain/tags.d.ts +11 -0
- package/dist/src/domain/tags.js +42 -0
- package/dist/src/domain/tags.js.map +1 -0
- package/dist/src/domain/user-config.js +9 -1
- package/dist/src/domain/user-config.js.map +1 -1
- package/dist/src/i18n/en.js +49 -28
- package/dist/src/i18n/en.js.map +1 -1
- package/dist/src/i18n/zh.d.ts +50 -29
- package/dist/src/i18n/zh.js +50 -29
- package/dist/src/i18n/zh.js.map +1 -1
- package/dist/src/ui/browser/browse-capabilities.js +7 -1
- package/dist/src/ui/browser/browse-capabilities.js.map +1 -1
- package/dist/src/ui/browser/browse-session.d.ts +2 -0
- package/dist/src/ui/browser/browse-session.js +4 -0
- package/dist/src/ui/browser/browse-session.js.map +1 -1
- package/dist/src/ui/browser/browser.js +18 -1
- package/dist/src/ui/browser/browser.js.map +1 -1
- package/dist/src/ui/browser/index.js +3 -1
- package/dist/src/ui/browser/index.js.map +1 -1
- package/dist/src/ui/browser/types.d.ts +5 -0
- package/dist/src/ui/footer/resolve-footer.js +3 -0
- package/dist/src/ui/footer/resolve-footer.js.map +1 -1
- package/dist/src/ui/footer/types.d.ts +1 -0
- package/dist/src/ui/mcp/browse-capabilities.d.ts +1 -0
- package/dist/src/ui/mcp/browse-capabilities.js +1 -0
- package/dist/src/ui/mcp/browse-capabilities.js.map +1 -1
- package/dist/src/ui/mcp/browser.d.ts +2 -1
- package/dist/src/ui/mcp/browser.js +33 -5
- package/dist/src/ui/mcp/browser.js.map +1 -1
- package/dist/src/ui/mcp/index.js +29 -2
- package/dist/src/ui/mcp/index.js.map +1 -1
- package/dist/src/ui/prompts/index.d.ts +1 -1
- package/dist/src/ui/prompts/index.js +1 -1
- package/dist/src/ui/prompts/index.js.map +1 -1
- package/dist/src/ui/prompts/present.d.ts +4 -0
- package/dist/src/ui/prompts/present.js +9 -0
- package/dist/src/ui/prompts/present.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { collectionPaths, ensureCollection, exists, collectionGitAddPaths, } from './core.js';
|
|
3
|
+
import { readUserConfig, writeUserConfig, } from './user-config.js';
|
|
4
|
+
import { setMcpSecretsInGit, mcpSecretsPath } from './mcp/secrets.js';
|
|
5
|
+
import { executeWrites, conflictItem, requireAuthorization, } from './agent-write.js';
|
|
6
|
+
import { OperationFailure, operationError, } from './operation.js';
|
|
7
|
+
import { optionalGit } from './agent-read.js';
|
|
8
|
+
import { runGit } from './process.js';
|
|
9
|
+
import { syncCollection } from './git.js';
|
|
10
|
+
export async function executeCollectionWrite(command, names, options, signal) {
|
|
11
|
+
const dryRun = options['dry-run'] === true;
|
|
12
|
+
const { root } = collectionPaths();
|
|
13
|
+
if (command === 'config.set') {
|
|
14
|
+
if (names.length !== 2 ||
|
|
15
|
+
!['locale', 'mcpSecretsInGit'].includes(names[0]))
|
|
16
|
+
throw new OperationFailure('usage.invalidArguments', 'A supported configuration key and value are required.');
|
|
17
|
+
const [key, input] = names;
|
|
18
|
+
if (!(key === 'locale' ? ['system', 'zh', 'en'] : ['true', 'false']).includes(input))
|
|
19
|
+
throw new OperationFailure('usage.invalidArguments', 'Invalid configuration value.', { key });
|
|
20
|
+
const value = key === 'locale' ? input : input === 'true';
|
|
21
|
+
const config = await readUserConfig();
|
|
22
|
+
return executeWrites([
|
|
23
|
+
{
|
|
24
|
+
item: {
|
|
25
|
+
name: key,
|
|
26
|
+
value,
|
|
27
|
+
action: 'set-config',
|
|
28
|
+
status: config[key] === value
|
|
29
|
+
? 'unchanged'
|
|
30
|
+
: 'planned',
|
|
31
|
+
reason: 'same-value',
|
|
32
|
+
...(key === 'mcpSecretsInGit'
|
|
33
|
+
? { secretOverlayPath: mcpSecretsPath(), trackSecrets: value }
|
|
34
|
+
: {}),
|
|
35
|
+
},
|
|
36
|
+
execute: async () => {
|
|
37
|
+
if (key === 'mcpSecretsInGit')
|
|
38
|
+
await setMcpSecretsInGit(value === true);
|
|
39
|
+
else {
|
|
40
|
+
await writeUserConfig({
|
|
41
|
+
...config,
|
|
42
|
+
locale: value,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
], dryRun, true, command, signal);
|
|
48
|
+
}
|
|
49
|
+
if (command === 'collection.sync') {
|
|
50
|
+
if (names.length)
|
|
51
|
+
throw new OperationFailure('usage.invalidArguments', 'Sync accepts no positional arguments.');
|
|
52
|
+
if (!(await exists(join(root, '.git'))))
|
|
53
|
+
throw new OperationFailure('usage.invalidArguments', 'The collection has no Git repository.');
|
|
54
|
+
const origin = await optionalGit(root, ['remote', 'get-url', 'origin'], signal);
|
|
55
|
+
if (!origin)
|
|
56
|
+
throw new OperationFailure('usage.invalidArguments', 'The collection has no origin remote.');
|
|
57
|
+
if (dryRun)
|
|
58
|
+
return {
|
|
59
|
+
result: {
|
|
60
|
+
items: [
|
|
61
|
+
{
|
|
62
|
+
name: 'collection',
|
|
63
|
+
action: 'sync',
|
|
64
|
+
status: 'planned',
|
|
65
|
+
origin,
|
|
66
|
+
branch: await optionalGit(root, ['symbolic-ref', '--short', 'HEAD'], signal),
|
|
67
|
+
upstream: await optionalGit(root, ['rev-parse', '--abbrev-ref', '@{upstream}'], signal),
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
git: { status: 'not-needed' },
|
|
71
|
+
plannedGit: ['commit', 'fetch', 'merge', 'push'],
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
const progress = {
|
|
75
|
+
stages: {
|
|
76
|
+
commit: 'not-run',
|
|
77
|
+
fetch: 'not-run',
|
|
78
|
+
merge: 'not-run',
|
|
79
|
+
push: 'not-run',
|
|
80
|
+
},
|
|
81
|
+
conflicts: [],
|
|
82
|
+
};
|
|
83
|
+
const before = await optionalGit(root, ['rev-parse', 'HEAD'], signal);
|
|
84
|
+
try {
|
|
85
|
+
await syncCollection(false, progress);
|
|
86
|
+
return {
|
|
87
|
+
result: {
|
|
88
|
+
items: [
|
|
89
|
+
{
|
|
90
|
+
name: 'collection',
|
|
91
|
+
action: 'sync',
|
|
92
|
+
status: 'committed',
|
|
93
|
+
...progress,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
git: {
|
|
97
|
+
status: 'committed',
|
|
98
|
+
commit: await runGit(['-C', root, 'rev-parse', 'HEAD'], signal),
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
const failure = {
|
|
105
|
+
...operationError(error, 'write'),
|
|
106
|
+
code: signal.aborted ? 'execution.interrupted' : 'git.syncFailed',
|
|
107
|
+
};
|
|
108
|
+
const after = await optionalGit(root, ['rev-parse', 'HEAD']);
|
|
109
|
+
return {
|
|
110
|
+
result: {
|
|
111
|
+
items: [
|
|
112
|
+
{
|
|
113
|
+
name: 'collection',
|
|
114
|
+
action: 'sync',
|
|
115
|
+
status: 'failed',
|
|
116
|
+
error: failure,
|
|
117
|
+
restored: 'unknown',
|
|
118
|
+
...progress,
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
git: { status: 'failed', error: failure },
|
|
122
|
+
},
|
|
123
|
+
error: failure,
|
|
124
|
+
exitCode: signal.aborted ? 130 : 1,
|
|
125
|
+
partial: before !== after,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const initializing = command === 'collection.init';
|
|
130
|
+
const clearing = command === 'collection.remote.clear';
|
|
131
|
+
if (names.length !== (command === 'collection.remote.set' ? 1 : 0))
|
|
132
|
+
throw new OperationFailure('usage.invalidArguments', 'Invalid arguments for collection management.');
|
|
133
|
+
const remote = initializing
|
|
134
|
+
? options.remote
|
|
135
|
+
: names[0];
|
|
136
|
+
if (remote !== undefined && !remote.trim())
|
|
137
|
+
throw new OperationFailure('usage.invalidArguments', 'Remote cannot be empty.');
|
|
138
|
+
if (clearing)
|
|
139
|
+
requireAuthorization(options.yes === true, dryRun, ['origin']);
|
|
140
|
+
const repo = await exists(join(root, '.git'));
|
|
141
|
+
const head = repo
|
|
142
|
+
? await optionalGit(root, ['rev-parse', '--verify', 'HEAD'], signal)
|
|
143
|
+
: null;
|
|
144
|
+
const previous = repo
|
|
145
|
+
? await optionalGit(root, ['remote', 'get-url', 'origin'], signal)
|
|
146
|
+
: null;
|
|
147
|
+
let item = {
|
|
148
|
+
name: initializing ? 'collection' : 'origin',
|
|
149
|
+
action: initializing ? 'init' : clearing ? 'clear-remote' : 'set-remote',
|
|
150
|
+
status: 'planned',
|
|
151
|
+
origin: clearing ? null : (remote ?? previous),
|
|
152
|
+
};
|
|
153
|
+
if (clearing
|
|
154
|
+
? !previous
|
|
155
|
+
: initializing
|
|
156
|
+
? Boolean(head) && (!remote || remote === previous)
|
|
157
|
+
: remote === previous)
|
|
158
|
+
item = { ...item, status: 'unchanged', reason: 'same-value' };
|
|
159
|
+
else if (remote && previous && remote !== previous && !options.replace)
|
|
160
|
+
item = conflictItem(item, 'conflict.targetExists', {
|
|
161
|
+
existing: previous,
|
|
162
|
+
incoming: remote,
|
|
163
|
+
requiredFlags: ['--replace'],
|
|
164
|
+
});
|
|
165
|
+
const response = await executeWrites([
|
|
166
|
+
{
|
|
167
|
+
item,
|
|
168
|
+
execute: async () => {
|
|
169
|
+
if (clearing) {
|
|
170
|
+
await runGit(['-C', root, 'remote', 'remove', 'origin'], signal);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (!head) {
|
|
174
|
+
await ensureCollection();
|
|
175
|
+
if (!repo)
|
|
176
|
+
await runGit(['-C', root, 'init', '--quiet', '-b', 'main'], signal);
|
|
177
|
+
for (const [key, fallback] of [
|
|
178
|
+
['user.name', 'Skill Collection'],
|
|
179
|
+
['user.email', 'iskills@localhost'],
|
|
180
|
+
]) {
|
|
181
|
+
if (!(await optionalGit(root, ['config', '--get', key], signal)))
|
|
182
|
+
await runGit(['-C', root, 'config', key, fallback], signal);
|
|
183
|
+
}
|
|
184
|
+
await runGit([
|
|
185
|
+
'-C',
|
|
186
|
+
root,
|
|
187
|
+
'add',
|
|
188
|
+
'-A',
|
|
189
|
+
'--',
|
|
190
|
+
...(await collectionGitAddPaths(root)),
|
|
191
|
+
], signal);
|
|
192
|
+
await runGit([
|
|
193
|
+
'-C',
|
|
194
|
+
root,
|
|
195
|
+
'commit',
|
|
196
|
+
'--quiet',
|
|
197
|
+
'-m',
|
|
198
|
+
'initialize skill collection',
|
|
199
|
+
], signal);
|
|
200
|
+
}
|
|
201
|
+
if (remote)
|
|
202
|
+
await runGit([
|
|
203
|
+
'-C',
|
|
204
|
+
root,
|
|
205
|
+
'remote',
|
|
206
|
+
previous ? 'set-url' : 'add',
|
|
207
|
+
'origin',
|
|
208
|
+
remote,
|
|
209
|
+
], signal);
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
], dryRun, false, command, signal);
|
|
213
|
+
if (response.error && response.exitCode !== 3) {
|
|
214
|
+
response.error.code = signal.aborted
|
|
215
|
+
? 'execution.interrupted'
|
|
216
|
+
: 'git.syncFailed';
|
|
217
|
+
response.result.git = { status: 'failed', error: response.error };
|
|
218
|
+
}
|
|
219
|
+
else if (!response.error && !dryRun && item.status === 'committed') {
|
|
220
|
+
response.result.git = {
|
|
221
|
+
status: 'committed',
|
|
222
|
+
commit: await optionalGit(root, ['rev-parse', 'HEAD']),
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
else if (!response.error && !dryRun && repo) {
|
|
226
|
+
response.result.git = { status: 'unchanged' };
|
|
227
|
+
}
|
|
228
|
+
return response;
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=agent-collection-write.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-collection-write.js","sourceRoot":"","sources":["../../../src/domain/agent-collection-write.ts"],"names":[],"mappings":"AAAA,OAAO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M,IAAI,IAAI,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;QACrE,QAAQ,CAAC,MAAM,CAAC,GAAG,GAAG;YACpB,MAAM,EAAE,WAAW;YACnB,MAAM,EAAE,MAAM,WAAW,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;SACvD,CAAC;IACJ,CAAC;SAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;QAC9C,QAAQ,CAAC,MAAM,CAAC,GAAG,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IAChD,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type PlannedWrite } from './agent-write.js';
|
|
2
|
+
import { type OperationResult } from './operation.js';
|
|
3
|
+
import type { AddMcpTarget, CollectedMcp, McpLocationEntry, McpRecipe, McpSecretValues, McpScanContext } from './mcp/types.js';
|
|
4
|
+
export interface McpWriteRequest {
|
|
5
|
+
command: string;
|
|
6
|
+
project: string;
|
|
7
|
+
names: string[];
|
|
8
|
+
options: Record<string, unknown>;
|
|
9
|
+
signal: AbortSignal;
|
|
10
|
+
}
|
|
11
|
+
export declare function validateRecipe(raw: unknown): McpRecipe;
|
|
12
|
+
export declare function fillMissing(base: McpSecretValues, incoming: McpSecretValues): McpSecretValues;
|
|
13
|
+
export declare function checkSecrets(recipe: McpRecipe, secrets: McpSecretValues, name: string): void;
|
|
14
|
+
export declare function selectMcpLocations(selectors: string[], project: string, allowAbsent?: boolean): Promise<Array<McpLocationEntry | {
|
|
15
|
+
absent: true;
|
|
16
|
+
selector: string;
|
|
17
|
+
}>>;
|
|
18
|
+
export declare function executeMcpWrite(request: McpWriteRequest): Promise<OperationResult>;
|
|
19
|
+
export declare function collectMcpRecords(incoming: Array<{
|
|
20
|
+
mcp: CollectedMcp;
|
|
21
|
+
secrets: McpSecretValues;
|
|
22
|
+
}>, options: Record<string, unknown>, command: string, signal: AbortSignal): Promise<OperationResult>;
|
|
23
|
+
export declare function planMcpAdds(names: string[], targets: AddMcpTarget[], ctx: McpScanContext, replace?: boolean): Promise<PlannedWrite[]>;
|