@genspark/cli 1.11.2 → 1.13.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 +217 -27
- package/dist/client.d.ts +67 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +328 -3
- package/dist/client.js.map +1 -1
- package/dist/commands/chat-events.d.ts +1 -1
- package/dist/commands/chat-events.js +1 -1
- package/dist/commands/developer-preflight.d.ts +17 -0
- package/dist/commands/developer-preflight.d.ts.map +1 -0
- package/dist/commands/developer-preflight.js +131 -0
- package/dist/commands/developer-preflight.js.map +1 -0
- package/dist/commands/developer-project.d.ts +5 -0
- package/dist/commands/developer-project.d.ts.map +1 -0
- package/dist/commands/developer-project.js +140 -0
- package/dist/commands/developer-project.js.map +1 -0
- package/dist/commands/genspark-code-skills.d.ts +23 -0
- package/dist/commands/genspark-code-skills.d.ts.map +1 -0
- package/dist/commands/genspark-code-skills.js +49 -0
- package/dist/commands/genspark-code-skills.js.map +1 -0
- package/dist/commands/hosted-local.d.ts +10 -0
- package/dist/commands/hosted-local.d.ts.map +1 -0
- package/dist/commands/hosted-local.js +116 -0
- package/dist/commands/hosted-local.js.map +1 -0
- package/dist/commands/local-command-routing.d.ts +8 -0
- package/dist/commands/local-command-routing.d.ts.map +1 -0
- package/dist/commands/local-command-routing.js +33 -0
- package/dist/commands/local-command-routing.js.map +1 -0
- package/dist/commands/local-preview.d.ts +5 -0
- package/dist/commands/local-preview.d.ts.map +1 -0
- package/dist/commands/local-preview.js +35 -0
- package/dist/commands/local-preview.js.map +1 -0
- package/dist/commands/pi-config.d.ts +30 -0
- package/dist/commands/pi-config.d.ts.map +1 -0
- package/dist/commands/pi-config.js +72 -0
- package/dist/commands/pi-config.js.map +1 -0
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +12 -1
- package/dist/config.js.map +1 -1
- package/dist/confirm.d.ts +59 -3
- package/dist/confirm.d.ts.map +1 -1
- package/dist/confirm.js +91 -11
- package/dist/confirm.js.map +1 -1
- package/dist/developer-contract.d.ts +24 -0
- package/dist/developer-contract.d.ts.map +1 -0
- package/dist/developer-contract.js +64 -0
- package/dist/developer-contract.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +286 -25
- package/dist/index.js.map +1 -1
- package/dist/local-source.d.ts +22 -0
- package/dist/local-source.d.ts.map +1 -0
- package/dist/local-source.js +204 -0
- package/dist/local-source.js.map +1 -0
- package/dist/project-binding.d.ts +31 -0
- package/dist/project-binding.d.ts.map +1 -0
- package/dist/project-binding.js +141 -0
- package/dist/project-binding.js.map +1 -0
- package/dist/types.d.ts +21 -0
- package/dist/types.d.ts.map +1 -1
- package/docs/confirmation.md +113 -6
- package/docs/skills.md +3 -2
- package/package.json +4 -2
- package/skills/gsk-aidrive/SKILL.md +25 -5
- package/skills/gsk-audio-generation/SKILL.md +1 -1
- package/skills/gsk-claw-share-link/SKILL.md +1 -1
- package/skills/gsk-genteam/SKILL.md +7 -8
- package/skills/gsk-gmail/SKILL.md +7 -7
- package/skills/gsk-google-calendar/SKILL.md +4 -5
- package/skills/gsk-google-chat/SKILL.md +2 -4
- package/skills/gsk-google-drive/SKILL.md +4 -2
- package/skills/gsk-microsoft-teams/SKILL.md +3 -7
- package/skills/gsk-onedrive/SKILL.md +4 -2
- package/skills/gsk-outlook-calendar/SKILL.md +4 -5
- package/skills/gsk-outlook-email/SKILL.md +7 -7
- package/skills/gsk-sb-brain/SKILL.md +61 -0
- package/skills/gsk-second-brain/SKILL.md +158 -0
- package/skills/gsk-shared/SKILL.md +20 -0
- package/skills/gsk-slack/SKILL.md +4 -4
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as promises from 'node:fs/promises';
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import * as os from 'node:os';
|
|
5
|
+
import { createHash } from 'node:crypto';
|
|
6
|
+
import { Transform } from 'node:stream';
|
|
7
|
+
import { pipeline } from 'node:stream/promises';
|
|
8
|
+
import { ZipFile } from 'yazl';
|
|
9
|
+
import { getConfigPath } from './config.js';
|
|
10
|
+
export const SOURCE_LIMITS = {
|
|
11
|
+
entries: 20000,
|
|
12
|
+
compressed: 250 * 1024 * 1024,
|
|
13
|
+
expanded: 500 * 1024 * 1024,
|
|
14
|
+
};
|
|
15
|
+
const excludedNames = new Set([
|
|
16
|
+
'.git',
|
|
17
|
+
'node_modules',
|
|
18
|
+
'.wrangler',
|
|
19
|
+
'.gsk',
|
|
20
|
+
'.genspark-code',
|
|
21
|
+
'.genspark-tool-cli',
|
|
22
|
+
'.meta',
|
|
23
|
+
'.gsk_hosted_deploy',
|
|
24
|
+
'__pycache__',
|
|
25
|
+
'.ssh',
|
|
26
|
+
'.aws',
|
|
27
|
+
'.azure',
|
|
28
|
+
'.config',
|
|
29
|
+
'.npmrc',
|
|
30
|
+
'.netrc',
|
|
31
|
+
'.pypirc',
|
|
32
|
+
'.docker',
|
|
33
|
+
'.dev.vars',
|
|
34
|
+
'credentials',
|
|
35
|
+
'credentials.json',
|
|
36
|
+
'service-account.json',
|
|
37
|
+
'id_rsa',
|
|
38
|
+
'id_ed25519',
|
|
39
|
+
'proc',
|
|
40
|
+
'sys',
|
|
41
|
+
]);
|
|
42
|
+
/** Exclude dependencies and credential-bearing paths at every depth. */
|
|
43
|
+
export function excludedSourcePath(name) {
|
|
44
|
+
return name.split('/').some(part => {
|
|
45
|
+
const lower = part.toLowerCase();
|
|
46
|
+
return (excludedNames.has(lower) ||
|
|
47
|
+
lower.startsWith('.env') ||
|
|
48
|
+
lower.startsWith('.dev.vars.') ||
|
|
49
|
+
/\.(pem|key|p12|pfx|log|pyc)$/.test(lower));
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/** Reject traversal and ambiguous archive paths rather than silently rewriting names. */
|
|
53
|
+
export function validateSourcePath(name) {
|
|
54
|
+
if (!name ||
|
|
55
|
+
Buffer.byteLength(name) > 1024 ||
|
|
56
|
+
/[\\:\x00-\x1f\x7f]/.test(name) ||
|
|
57
|
+
name
|
|
58
|
+
.split('/')
|
|
59
|
+
.some(part => !part || part === '.' || part === '..' || /[. ]$/.test(part))) {
|
|
60
|
+
throw new Error(`Unsafe source path: ${JSON.stringify(name)}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async function collectSource(root, limits) {
|
|
64
|
+
const entries = [];
|
|
65
|
+
const paths = new Set();
|
|
66
|
+
let expanded = 0;
|
|
67
|
+
let visited = 0;
|
|
68
|
+
const configPath = path.resolve(getConfigPath());
|
|
69
|
+
async function walk(directory, prefix) {
|
|
70
|
+
if ((await promises.realpath(directory)) !== directory) {
|
|
71
|
+
throw new Error(`Source directory changed or is symlinked: ${directory}`);
|
|
72
|
+
}
|
|
73
|
+
const iterator = await promises.opendir(directory);
|
|
74
|
+
for await (const entry of iterator) {
|
|
75
|
+
const filename = path.join(directory, entry.name);
|
|
76
|
+
const name = prefix + entry.name;
|
|
77
|
+
const stat = await promises.lstat(filename);
|
|
78
|
+
if (stat.isSymbolicLink()) {
|
|
79
|
+
throw new Error(`Symlink source entry is not allowed: ${name}`);
|
|
80
|
+
}
|
|
81
|
+
if (filename === configPath)
|
|
82
|
+
continue;
|
|
83
|
+
if (excludedSourcePath(name))
|
|
84
|
+
continue;
|
|
85
|
+
validateSourcePath(name);
|
|
86
|
+
if (++visited > limits.entries) {
|
|
87
|
+
throw new Error(`Source exceeds ${limits.entries} entries`);
|
|
88
|
+
}
|
|
89
|
+
const key = name.normalize('NFC').toLowerCase();
|
|
90
|
+
if (paths.has(key))
|
|
91
|
+
throw new Error(`Source path collision: ${name}`);
|
|
92
|
+
paths.add(key);
|
|
93
|
+
if (stat.isDirectory()) {
|
|
94
|
+
await walk(filename, name + '/');
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (!stat.isFile())
|
|
98
|
+
throw new Error(`Non-regular source entry: ${name}`);
|
|
99
|
+
expanded += stat.size;
|
|
100
|
+
if (expanded > limits.expanded) {
|
|
101
|
+
throw new Error(`Source exceeds ${limits.expanded} expanded bytes`);
|
|
102
|
+
}
|
|
103
|
+
entries.push({ filename, name, stat });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
await walk(root, '');
|
|
107
|
+
if (!entries.length) {
|
|
108
|
+
throw new Error('No source files remain after exclusions');
|
|
109
|
+
}
|
|
110
|
+
return entries;
|
|
111
|
+
}
|
|
112
|
+
async function openSnapshotEntry(entry) {
|
|
113
|
+
if ((await promises.realpath(path.dirname(entry.filename))) !==
|
|
114
|
+
path.dirname(entry.filename)) {
|
|
115
|
+
throw new Error(`Source directory changed: ${entry.name}`);
|
|
116
|
+
}
|
|
117
|
+
const handle = await promises.open(entry.filename, fs.constants.O_RDONLY | fs.constants.O_NOFOLLOW);
|
|
118
|
+
try {
|
|
119
|
+
const stat = await handle.stat();
|
|
120
|
+
if (!stat.isFile() ||
|
|
121
|
+
stat.ino !== entry.stat.ino ||
|
|
122
|
+
stat.dev !== entry.stat.dev ||
|
|
123
|
+
stat.size !== entry.stat.size ||
|
|
124
|
+
stat.mtimeMs !== entry.stat.mtimeMs) {
|
|
125
|
+
throw new Error(`Source changed while packaging: ${entry.name}. Run again after edits finish.`);
|
|
126
|
+
}
|
|
127
|
+
return handle.createReadStream();
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
await handle.close();
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/** Stream source into a private bounded ZIP snapshot; never run shell archive tools. */
|
|
135
|
+
export async function packageLocalSource(source, limits = SOURCE_LIMITS) {
|
|
136
|
+
const requested = path.resolve(source);
|
|
137
|
+
const stat = await promises.lstat(requested);
|
|
138
|
+
if (stat.isSymbolicLink() || !stat.isDirectory()) {
|
|
139
|
+
throw new Error('Source must be a real directory, not a symlink');
|
|
140
|
+
}
|
|
141
|
+
const entries = await collectSource(await promises.realpath(requested), limits);
|
|
142
|
+
const temporary = await promises.mkdtemp(path.join(os.tmpdir(), 'gsk-source-'));
|
|
143
|
+
const filename = path.join(temporary, 'source.zip');
|
|
144
|
+
const cleanup = () => promises.rm(temporary, { recursive: true, force: true });
|
|
145
|
+
const zip = new ZipFile();
|
|
146
|
+
const active = new Set();
|
|
147
|
+
const hash = createHash('sha256');
|
|
148
|
+
let compressed = 0;
|
|
149
|
+
let expanded = 0;
|
|
150
|
+
let failed = false;
|
|
151
|
+
const meter = new Transform({
|
|
152
|
+
transform(chunk, _encoding, callback) {
|
|
153
|
+
compressed += chunk.length;
|
|
154
|
+
if (compressed > limits.compressed) {
|
|
155
|
+
callback(new Error(`Source ZIP exceeds ${limits.compressed} compressed bytes`));
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
hash.update(chunk);
|
|
159
|
+
callback(null, chunk);
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
zip.on('error', (error) => meter.destroy(error));
|
|
163
|
+
try {
|
|
164
|
+
for (const entry of entries) {
|
|
165
|
+
zip.addReadStreamLazy(entry.name, { size: entry.stat.size, mode: 0o100644, mtime: entry.stat.mtime }, callback => {
|
|
166
|
+
void openSnapshotEntry(entry)
|
|
167
|
+
.then(stream => {
|
|
168
|
+
if (failed) {
|
|
169
|
+
stream.destroy();
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
active.add(stream);
|
|
173
|
+
stream.once('close', () => active.delete(stream));
|
|
174
|
+
stream.on('data', (chunk) => {
|
|
175
|
+
expanded += Buffer.byteLength(chunk);
|
|
176
|
+
if (expanded > limits.expanded) {
|
|
177
|
+
stream.destroy(new Error(`Source exceeds ${limits.expanded} expanded bytes`));
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
callback(null, stream);
|
|
181
|
+
})
|
|
182
|
+
.catch((error) => meter.destroy(error instanceof Error ? error : new Error(String(error))));
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
zip.end();
|
|
186
|
+
await pipeline(zip.outputStream, meter, fs.createWriteStream(filename, { flags: 'wx', mode: 0o600 }));
|
|
187
|
+
return {
|
|
188
|
+
filename,
|
|
189
|
+
sha256: hash.digest('hex'),
|
|
190
|
+
size_bytes: compressed,
|
|
191
|
+
expanded_bytes: expanded,
|
|
192
|
+
file_count: entries.length,
|
|
193
|
+
cleanup,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
failed = true;
|
|
198
|
+
for (const stream of active)
|
|
199
|
+
stream.destroy();
|
|
200
|
+
await cleanup();
|
|
201
|
+
throw error;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=local-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-source.js","sourceRoot":"","sources":["../src/local-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAA;AAC5C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,KAAK;IACd,UAAU,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI;IAC7B,QAAQ,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI;CAC5B,CAAA;AAgBD,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IAC5B,MAAM;IACN,cAAc;IACd,WAAW;IACX,MAAM;IACN,gBAAgB;IAChB,oBAAoB;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AG,CAAC,GAAG,EAAE,CAAA;QACT,MAAM,QAAQ,CACZ,GAAG,CAAC,YAAY,EAChB,KAAK,EACL,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAC7D,CAAA;QACD,OAAO;YACL,QAAQ;YACR,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;YAC1B,UAAU,EAAE,UAAU;YACtB,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,OAAO,CAAC,MAAM;YAC1B,OAAO;SACR,CAAA;IACH,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,GAAG,IAAI,CAAA;QACb,KAAK,MAAM,MAAM,IAAI,MAAM;YAAE,MAAM,CAAC,OAAO,EAAE,CAAA;QAC7C,MAAM,OAAO,EAAE,CAAA;QACf,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface ProjectBinding {
|
|
2
|
+
version: 1;
|
|
3
|
+
project_id: string;
|
|
4
|
+
kind: string;
|
|
5
|
+
base_url: string;
|
|
6
|
+
}
|
|
7
|
+
export interface LocatedBinding {
|
|
8
|
+
root: string;
|
|
9
|
+
binding: ProjectBinding;
|
|
10
|
+
}
|
|
11
|
+
/** Canonicalize a server address without allowing embedded credentials. */
|
|
12
|
+
export declare function bindingBaseUrl(value: string): string;
|
|
13
|
+
/** Validate persisted data strictly; a binding never contains credentials. */
|
|
14
|
+
export declare function parseBinding(value: unknown): ProjectBinding;
|
|
15
|
+
/** Find the nearest binding, rejecting malformed or symlinked local state. */
|
|
16
|
+
export declare function findProjectBinding(cwd?: string): LocatedBinding | undefined;
|
|
17
|
+
/** Resolve project selection and reject a checkout bound to another server. */
|
|
18
|
+
export declare function resolveProjectSelection(options: {
|
|
19
|
+
baseUrl: string;
|
|
20
|
+
explicit?: string;
|
|
21
|
+
environment?: string;
|
|
22
|
+
legacy?: string;
|
|
23
|
+
cwd?: string;
|
|
24
|
+
}): string | undefined;
|
|
25
|
+
/** Create private local state without following a .gsk symlink. */
|
|
26
|
+
export declare function projectStateDirectory(root: string): string;
|
|
27
|
+
/** Atomically publish a new JSON file, never overwriting a concurrent writer. */
|
|
28
|
+
export declare function writeNewProjectState(root: string, name: string, value: unknown): string;
|
|
29
|
+
/** Bind the checkout once; a different existing or inherited binding needs manual resolution. */
|
|
30
|
+
export declare function writeProjectBinding(value: ProjectBinding, cwd?: string): string;
|
|
31
|
+
//# sourceMappingURL=project-binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-binding.d.ts","sourceRoot":"","sources":["../src/project-binding.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,CAAC,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,cAAc,CAAA;CACxB;AAED,2EAA2E;AAC3E,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAcpD;AAED,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,CAyB3D;AAkBD,8EAA8E;AAC9E,wBAAgB,kBAAkB,CAChC,GAAG,SAAgB,GAClB,cAAc,GAAG,SAAS,CAgC5B;AAED,+EAA+E;AAC/E,wBAAgB,uBAAuB,CAAC,OAAO,EAAE;IAC/C,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,GAAG,MAAM,GAAG,SAAS,CAcrB;AAED,mEAAmE;AACnE,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ1D;AAED,iFAAiF;AACjF,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,GACb,MAAM,CAkBR;AAED,iGAAiG;AACjG,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,cAAc,EACrB,GAAG,SAAgB,GAClB,MAAM,CAaR"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { randomUUID } from 'node:crypto';
|
|
4
|
+
/** Canonicalize a server address without allowing embedded credentials. */
|
|
5
|
+
export function bindingBaseUrl(value) {
|
|
6
|
+
const url = new URL(value);
|
|
7
|
+
if (!['http:', 'https:'].includes(url.protocol) ||
|
|
8
|
+
url.username ||
|
|
9
|
+
url.password ||
|
|
10
|
+
url.search ||
|
|
11
|
+
url.hash) {
|
|
12
|
+
throw new Error('base_url must be an HTTP(S) URL without credentials, query, or fragment');
|
|
13
|
+
}
|
|
14
|
+
return url.href.replace(/\/+$/, '');
|
|
15
|
+
}
|
|
16
|
+
/** Validate persisted data strictly; a binding never contains credentials. */
|
|
17
|
+
export function parseBinding(value) {
|
|
18
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
19
|
+
throw new Error('Invalid .gsk/project.json: expected an object');
|
|
20
|
+
}
|
|
21
|
+
const fields = value; // narrowed JSON object
|
|
22
|
+
if (Object.keys(fields).sort().join(',') !==
|
|
23
|
+
'base_url,kind,project_id,version' ||
|
|
24
|
+
fields.version !== 1 ||
|
|
25
|
+
typeof fields.project_id !== 'string' ||
|
|
26
|
+
!/^[A-Za-z0-9_-]{1,200}$/.test(fields.project_id) ||
|
|
27
|
+
typeof fields.kind !== 'string' ||
|
|
28
|
+
!/^[a-z][a-z0-9_-]{0,63}$/.test(fields.kind) ||
|
|
29
|
+
typeof fields.base_url !== 'string') {
|
|
30
|
+
throw new Error('Invalid .gsk/project.json: only version=1, project_id, kind, base_url are allowed');
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
version: 1,
|
|
34
|
+
project_id: fields.project_id,
|
|
35
|
+
kind: fields.kind,
|
|
36
|
+
base_url: bindingBaseUrl(fields.base_url),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function lstatOptional(target) {
|
|
40
|
+
try {
|
|
41
|
+
return fs.lstatSync(target);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
if (error &&
|
|
45
|
+
typeof error === 'object' &&
|
|
46
|
+
'code' in error &&
|
|
47
|
+
error.code === 'ENOENT') {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** Find the nearest binding, rejecting malformed or symlinked local state. */
|
|
54
|
+
export function findProjectBinding(cwd = process.cwd()) {
|
|
55
|
+
let root = fs.realpathSync(cwd);
|
|
56
|
+
while (true) {
|
|
57
|
+
const directory = path.join(root, '.gsk');
|
|
58
|
+
const directoryStat = lstatOptional(directory);
|
|
59
|
+
if (directoryStat &&
|
|
60
|
+
(!directoryStat.isDirectory() || directoryStat.isSymbolicLink())) {
|
|
61
|
+
throw new Error(`Unsafe project state directory: ${directory}`);
|
|
62
|
+
}
|
|
63
|
+
const filename = path.join(directory, 'project.json');
|
|
64
|
+
const stat = lstatOptional(filename);
|
|
65
|
+
if (stat) {
|
|
66
|
+
if (!stat.isFile() || stat.isSymbolicLink() || stat.size > 4096) {
|
|
67
|
+
throw new Error(`Unsafe project binding: ${filename}`);
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
return {
|
|
71
|
+
root,
|
|
72
|
+
binding: parseBinding(JSON.parse(fs.readFileSync(filename, 'utf8'))),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
throw new Error(`Cannot read ${filename}: ${error instanceof Error ? error.message : String(error)}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const parent = path.dirname(root);
|
|
80
|
+
if (parent === root)
|
|
81
|
+
return;
|
|
82
|
+
root = parent;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/** Resolve project selection and reject a checkout bound to another server. */
|
|
86
|
+
export function resolveProjectSelection(options) {
|
|
87
|
+
const located = findProjectBinding(options.cwd);
|
|
88
|
+
if (located && located.binding.base_url !== bindingBaseUrl(options.baseUrl)) {
|
|
89
|
+
throw new Error(`Project binding targets ${located.binding.base_url}, not ${options.baseUrl}. ` +
|
|
90
|
+
'Select the matching --base-url or use a different checkout before cloud operations.');
|
|
91
|
+
}
|
|
92
|
+
return (options.explicit ||
|
|
93
|
+
options.environment ||
|
|
94
|
+
located?.binding.project_id ||
|
|
95
|
+
options.legacy);
|
|
96
|
+
}
|
|
97
|
+
/** Create private local state without following a .gsk symlink. */
|
|
98
|
+
export function projectStateDirectory(root) {
|
|
99
|
+
const directory = path.join(fs.realpathSync(root), '.gsk');
|
|
100
|
+
fs.mkdirSync(directory, { recursive: true, mode: 0o700 });
|
|
101
|
+
const stat = fs.lstatSync(directory);
|
|
102
|
+
if (!stat.isDirectory() || stat.isSymbolicLink()) {
|
|
103
|
+
throw new Error(`Unsafe state directory: ${directory}`);
|
|
104
|
+
}
|
|
105
|
+
return directory;
|
|
106
|
+
}
|
|
107
|
+
/** Atomically publish a new JSON file, never overwriting a concurrent writer. */
|
|
108
|
+
export function writeNewProjectState(root, name, value) {
|
|
109
|
+
if (!/^[a-z0-9.-]+\.json$/.test(name)) {
|
|
110
|
+
throw new Error('Invalid project state filename');
|
|
111
|
+
}
|
|
112
|
+
const directory = projectStateDirectory(root);
|
|
113
|
+
const target = path.join(directory, name);
|
|
114
|
+
const temporary = path.join(directory, `.${randomUUID()}.tmp`);
|
|
115
|
+
const descriptor = fs.openSync(temporary, 'wx', 0o600);
|
|
116
|
+
try {
|
|
117
|
+
fs.writeFileSync(descriptor, JSON.stringify(value, null, 2) + '\n');
|
|
118
|
+
fs.fsyncSync(descriptor);
|
|
119
|
+
// link is atomic create-if-absent; rename would overwrite a concurrent bind.
|
|
120
|
+
fs.linkSync(temporary, target);
|
|
121
|
+
}
|
|
122
|
+
finally {
|
|
123
|
+
fs.closeSync(descriptor);
|
|
124
|
+
fs.unlinkSync(temporary);
|
|
125
|
+
}
|
|
126
|
+
return target;
|
|
127
|
+
}
|
|
128
|
+
/** Bind the checkout once; a different existing or inherited binding needs manual resolution. */
|
|
129
|
+
export function writeProjectBinding(value, cwd = process.cwd()) {
|
|
130
|
+
const binding = parseBinding(value);
|
|
131
|
+
const existing = findProjectBinding(cwd);
|
|
132
|
+
if (existing) {
|
|
133
|
+
if (JSON.stringify(existing.binding) === JSON.stringify(binding)) {
|
|
134
|
+
return path.join(existing.root, '.gsk', 'project.json');
|
|
135
|
+
}
|
|
136
|
+
throw new Error(`Checkout already bound to ${existing.binding.project_id} at ${existing.root}. ` +
|
|
137
|
+
'Use a different checkout or explicitly remove the old binding before binding another project.');
|
|
138
|
+
}
|
|
139
|
+
return writeNewProjectState(cwd, 'project.json', binding);
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=project-binding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-binding.js","sourceRoot":"","sources":["../src/project-binding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAcxC,2EAA2E;AAC3E,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAA;IAC1B,IACE,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,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O,MAAM,CAAA;AACf,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,mBAAmB,CACjC,KAAqB,EACrB,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE;IAEnB,MAAM,OAAO,GAAG,YAAY,CAAC,KAAK,CAAC,CAAA;IACnC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAA;IACxC,IAAI,QAAQ,EAAE,CAAC;QACb,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YACjE,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,CAAC,CAAA;QACzD,CAAC;QACD,MAAM,IAAI,KAAK,CACb,6BAA6B,QAAQ,CAAC,OAAO,CAAC,UAAU,OAAO,QAAQ,CAAC,IAAI,IAAI;YAC9E,+FAA+F,CAClG,CAAA;IACH,CAAC;IACD,OAAO,oBAAoB,CAAC,GAAG,EAAE,cAAc,EAAE,OAAO,CAAC,CAAA;AAC3D,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -23,6 +23,9 @@ export interface ApiResponse<T = unknown> {
|
|
|
23
23
|
data: T | null;
|
|
24
24
|
session_state?: Record<string, unknown> | null;
|
|
25
25
|
http_status?: number;
|
|
26
|
+
error_code?: string;
|
|
27
|
+
retry_after?: number;
|
|
28
|
+
instruction_for_agent?: string;
|
|
26
29
|
}
|
|
27
30
|
export interface ToolParameter {
|
|
28
31
|
type: string | string[];
|
|
@@ -33,6 +36,11 @@ export interface ToolParameter {
|
|
|
33
36
|
};
|
|
34
37
|
default?: unknown;
|
|
35
38
|
}
|
|
39
|
+
export interface ConfirmationExempt {
|
|
40
|
+
param: string;
|
|
41
|
+
values: string[];
|
|
42
|
+
default?: string;
|
|
43
|
+
}
|
|
36
44
|
export interface ToolActionInfo {
|
|
37
45
|
description: string;
|
|
38
46
|
parameters: string[];
|
|
@@ -43,6 +51,7 @@ export interface ToolActionInfo {
|
|
|
43
51
|
* --yes is rejected and confirmation must happen interactively.
|
|
44
52
|
*/
|
|
45
53
|
interactive_only?: boolean;
|
|
54
|
+
confirmation_exempt?: ConfirmationExempt;
|
|
46
55
|
}
|
|
47
56
|
export interface ToolSchema {
|
|
48
57
|
name: string;
|
|
@@ -65,6 +74,7 @@ export interface ToolSchema {
|
|
|
65
74
|
path?: string[] | null;
|
|
66
75
|
requires_confirmation?: boolean;
|
|
67
76
|
interactive_only?: boolean;
|
|
77
|
+
confirmation_exempt?: ConfirmationExempt;
|
|
68
78
|
};
|
|
69
79
|
}
|
|
70
80
|
export interface ToolListResponse {
|
|
@@ -97,4 +107,15 @@ export interface FileDownloadResponse {
|
|
|
97
107
|
content_type?: string;
|
|
98
108
|
original_url: string;
|
|
99
109
|
}
|
|
110
|
+
export interface CodeSkillFile {
|
|
111
|
+
path: string;
|
|
112
|
+
content: string;
|
|
113
|
+
}
|
|
114
|
+
export interface CodeSkill {
|
|
115
|
+
name: string;
|
|
116
|
+
files: CodeSkillFile[];
|
|
117
|
+
}
|
|
118
|
+
export interface GensparkCodeSkillsResponse {
|
|
119
|
+
skills: CodeSkill[];
|
|
120
|
+
}
|
|
100
121
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,yEAAyE;IACzE,OAAO,CA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;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,aAAa,EAAE,CAAA;CACvB;AAED,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,SAAS,EAAE,CAAA;CACpB"}
|
package/docs/confirmation.md
CHANGED
|
@@ -14,7 +14,13 @@ second call.
|
|
|
14
14
|
`google_drive share`) and, when both the CLI capability
|
|
15
15
|
(`cli-confirm-v1`) and the server-side gate agree, advertises
|
|
16
16
|
`"features": {"interactive_confirm": true}`. Both are cached with the
|
|
17
|
-
tool schemas (24h TTL).
|
|
17
|
+
tool schemas (24h TTL). Actions that dispatch on one argument (genteam
|
|
18
|
+
`members` on `op`, teams `api` on `method`, ...) additionally carry
|
|
19
|
+
`confirmation_exempt: {"param": ..., "values": [...]}` naming the
|
|
20
|
+
read-only values of that argument (plus `"default"` when the server
|
|
21
|
+
substitutes a value for an omitted argument, e.g. `method` → `GET`); the
|
|
22
|
+
CLI skips the prompt only when the final merged argument — or, if it is
|
|
23
|
+
omitted, the declared default — equals one of them exactly.
|
|
18
24
|
2. Before executing an annotated action, the CLI prints a preview of the
|
|
19
25
|
arguments you typed (attachments listed by name only) and asks
|
|
20
26
|
`About to execute <tool> <action>. Proceed? [y/N]` on **stderr**,
|
|
@@ -31,19 +37,120 @@ second call.
|
|
|
31
37
|
| Prompt answered `y`/`yes` | one server call, executes | tool result |
|
|
32
38
|
| Prompt declined / EOF | no server call | 1 |
|
|
33
39
|
| `--yes` (or `-y`) on a normal action | no prompt, executes | tool result |
|
|
34
|
-
|
|
|
35
|
-
| `--yes` or a skip param on an interactive-only action | warning + prompt anyway (locked skip params are server-stripped) | per answer |
|
|
36
|
-
| `--no-input` without `--yes` | error, no server call | 2 |
|
|
37
|
-
| `--args-file -` (stdin consumed) without `--yes` | error suggesting `--yes`, no server call | 2 |
|
|
40
|
+
| **deprecated** `--skip_confirmation true` / `auto_skip_confirmation` on a normal action | no prompt, no `cli_confirmed` — the param is forwarded verbatim and the server honors it as before; one `[DEPRECATED] ... use --yes` line on stderr | tool result |
|
|
41
|
+
| `--yes` or a deprecated skip param on an interactive-only action | warning + prompt anyway (locked skip params are server-stripped); no deprecation hint | per answer |
|
|
42
|
+
| `--no-input` without `--yes` on a gated action/value | error, no server call | 2 |
|
|
43
|
+
| `--args-file -` (stdin consumed) without `--yes` on a gated action/value | error suggesting `--yes`, no server call | 2 |
|
|
44
|
+
| `--args-file -` with an exempt value (e.g. `{"op": "list", ...}`) | no prompt, no `cli_confirmed`, one server call | tool result |
|
|
45
|
+
| omitted argument whose annotation declares an exempt `default` (e.g. `teams api --path /me` with no `--method`) | no prompt, no `cli_confirmed`, one server call | tool result |
|
|
46
|
+
| exempt-looking value in another spelling (`--op LIST`), non-string, or omitted without a declared `default` (`members` with no `--op`) | treated as gated: prompt / `--yes` / exit 2 as above | per row above |
|
|
47
|
+
|
|
48
|
+
## Per-operation actions
|
|
49
|
+
|
|
50
|
+
Some actions are gated as a whole (`requires_confirmation`) but only write
|
|
51
|
+
for some values of one argument. The server declares the read values as
|
|
52
|
+
`confirmation_exempt`; the CLI runs those without a prompt and gates
|
|
53
|
+
everything else:
|
|
54
|
+
|
|
55
|
+
| Action | Runs without a prompt | Confirmation required |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| `genteam members` | `--op list` | `add`, `remove` |
|
|
58
|
+
| `genteam pins` | `--op list` | `pin`, `unpin` |
|
|
59
|
+
| `genteam invite_link` | `--op list` | `create`, `revoke` |
|
|
60
|
+
| `genteam dm` | `--op list` | `open` |
|
|
61
|
+
| `genteam tasks` | `--op list`, `get`, `candidates` | `claim`, `unclaim`, `status`, `create`, `assign`, `rename` |
|
|
62
|
+
| `teams api` (alias of `microsoft_teams`) | `--method GET`, or no `--method` at all (GET is the server default) | `POST`, `PATCH`, `PUT`, `DELETE` |
|
|
63
|
+
|
|
64
|
+
Pass the value exactly as listed (case-sensitive, no surrounding
|
|
65
|
+
whitespace); anything else prompts. An omitted argument counts as the
|
|
66
|
+
annotation's `default` only when the server declares one — `teams api`
|
|
67
|
+
does (an omitted `method` is a GET), the genteam `op` actions do not (an
|
|
68
|
+
omitted `op` is a validation error, so a missing `--op` still prompts). The
|
|
69
|
+
match is evaluated on the final merged arguments, so the value may come
|
|
70
|
+
from a flag, a short alias or `--args-file` (including `-`). An exempt
|
|
71
|
+
call sends neither `cli_confirmed` nor a skip parameter; the server's own
|
|
72
|
+
gate still backs every write. The exemption is not the only unprompted
|
|
73
|
+
path: a deprecated `skip_confirmation` / `auto_skip_confirmation` parameter
|
|
74
|
+
(see below) still makes a write proceed without a prompt, as it did before
|
|
75
|
+
per-operation exemptions. Note that the client gate is keyed on
|
|
76
|
+
the resolved action: an action name the CLI cannot resolve (e.g.
|
|
77
|
+
`{"action": "Members"}` in an args file) is not client-gated and is sent
|
|
78
|
+
as-is; the server rejects it as an unknown action, so nothing executes.
|
|
79
|
+
|
|
80
|
+
## Deprecated skip parameters
|
|
81
|
+
|
|
82
|
+
`skip_confirmation` and `auto_skip_confirmation` were the pre-contract way
|
|
83
|
+
to run a gated action unattended: a server-side parameter, honored by the
|
|
84
|
+
server for CLI callers. On this CLI `--yes` replaces them.
|
|
85
|
+
|
|
86
|
+
- A server that supports the contract **omits both parameters from the
|
|
87
|
+
schema it serves to this CLI**: they no longer appear in `--help`, and
|
|
88
|
+
the generated skills do not teach them. Every gated command's `--help`
|
|
89
|
+
ends with a `Confirmation:` note that names `--yes` and `--no-input`
|
|
90
|
+
instead.
|
|
91
|
+
- They are still **accepted**, as hidden flags
|
|
92
|
+
(`--skip_confirmation [value]`, `--auto_skip_confirmation [value]`) and
|
|
93
|
+
as `--args-file` keys, on any tool or action the schema marks
|
|
94
|
+
`requires_confirmation`. The CLI
|
|
95
|
+
forwards them verbatim (no `cli_confirmed`), the server honors them
|
|
96
|
+
exactly as before, and a truthy value skips the prompt on a normal action
|
|
97
|
+
(equivalent to `--yes`, plus the one-time hint). This covers every
|
|
98
|
+
confirmation-gated tool or action, including ones whose schema never
|
|
99
|
+
listed the parameters before (e.g. `hubspot_*`, calendar delete).
|
|
100
|
+
Non-gated tools still refuse them as unknown parameters. In an
|
|
101
|
+
`--args-file` the value must be a JSON boolean; `"false"`, `1`, `[]` or
|
|
102
|
+
`null` exit 1 (`skip_confirmation must be a JSON boolean ... prefer --yes`)
|
|
103
|
+
with no server call.
|
|
104
|
+
- When a truthy skip parameter is what bypassed the prompt, the CLI prints
|
|
105
|
+
one line on stderr, **at most once per process**:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
[DEPRECATED] --skip_confirmation / --auto_skip_confirmation still work but are deprecated on this CLI — use --yes instead.
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
A cron caller that still passes `skip_confirmation: true` (e.g. through
|
|
112
|
+
`--args-file -`) sees exactly one such line per run; stdout is unchanged.
|
|
113
|
+
Exempt read values
|
|
114
|
+
(`--op list` with `skip_confirmation: true`, the #60498 shape), a
|
|
115
|
+
falsy value (`--skip_confirmation false` prompts), interactive-only
|
|
116
|
+
actions and feature-off servers print no hint.
|
|
117
|
+
|
|
118
|
+
- Migration: replace `--skip_confirmation true` / `--auto_skip_confirmation`
|
|
119
|
+
with `--yes` (`-y`). For `--args-file` payloads, drop the key and add
|
|
120
|
+
`--yes` to the command line.
|
|
38
121
|
|
|
39
122
|
## Compatibility
|
|
40
123
|
|
|
41
124
|
- Old server / feature disabled: the `features` bit is absent from the
|
|
42
125
|
cache, the CLI never prompts, and the server's own confirmation flow
|
|
43
|
-
(web confirmation card, pending envelope) applies unchanged.
|
|
126
|
+
(web confirmation card, pending envelope) applies unchanged. The schema
|
|
127
|
+
then still carries `skip_confirmation` / `auto_skip_confirmation`, so
|
|
128
|
+
they stay visible in `--help` (the CLI registers no hidden duplicate)
|
|
129
|
+
and the `Confirmation:` help note is not shown; no deprecation hint.
|
|
130
|
+
- New-contract schema: only a CLI declaring **both** `cli-confirm-v1` and
|
|
131
|
+
`cli-yes-only-v1` in `X-GSK-CLI-Caps`, whose user is inside the
|
|
132
|
+
server-side gate, receives the schema without the skip parameters (and
|
|
133
|
+
without the "Older CLIs require --project-id ..." sentence in action
|
|
134
|
+
descriptions). `cli-yes-only-v1` is sent only by CLIs that register the
|
|
135
|
+
hidden legacy flags and the `--args-file` allowlist described above.
|
|
136
|
+
Earlier 1.9–1.11.x CLIs send `cli-confirm-v1` alone: they keep the
|
|
137
|
+
legacy view, their `--skip_confirmation` / `auto_skip_confirmation`
|
|
138
|
+
flags stay visible and keep working, and their args-file payloads still
|
|
139
|
+
validate. Non-CLI callers and users outside the gate receive today's
|
|
140
|
+
schema unchanged. The tools cache filename is derived from the caps
|
|
141
|
+
string, so a cache written by an older CLI is never read by this one
|
|
142
|
+
(and vice versa). A schema cache written before the server upgrade keeps
|
|
143
|
+
the old view for up to 24h; `gsk --refresh ls` heals it.
|
|
44
144
|
- `--acp` mode: stdin is the JSON-RPC channel, so the ACP bridge keeps the
|
|
45
145
|
old contract (interactive confirmation over ACP is a separate track).
|
|
46
146
|
- Stale schema cache: if the server still answers
|
|
47
147
|
`data.status == "pending_confirmation"`, the CLI prints
|
|
48
148
|
`schema cache stale, run 'gsk --refresh ls' and retry` and exits 1.
|
|
49
149
|
The CLI never replays a call.
|
|
150
|
+
- `confirmation_exempt` is additive. CLIs that do not understand it ignore
|
|
151
|
+
the key and keep whole-action gating (read ops still need `--yes` or an
|
|
152
|
+
explicit skip parameter there). On an older server the key is absent and
|
|
153
|
+
a CLI that understands it keeps whole-action gating too. A schema cache
|
|
154
|
+
written before the server upgrade lacks the key for up to 24h — the
|
|
155
|
+
result is whole-action gating (fail-closed), and `gsk --refresh ls`
|
|
156
|
+
heals it immediately.
|
package/docs/skills.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
> Auto-generated by `python -m backend.genspark_tool_cli.generate_skills`. Do not edit manually.
|
|
4
4
|
|
|
5
|
-
**Total skills:**
|
|
5
|
+
**Total skills:** 57
|
|
6
6
|
|
|
7
|
-
## Service Skills (
|
|
7
|
+
## Service Skills (57)
|
|
8
8
|
|
|
9
9
|
| Skill | Description |
|
|
10
10
|
|-------|-------------|
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
| [gsk-outlook-email](../skills/gsk-outlook-email/SKILL.md) | Outlook Email operations. Actions: search, read, list_folders, create_folder, list_emails, list_email_changes, list_r... |
|
|
45
45
|
| [gsk-phone-call](../skills/gsk-phone-call/SKILL.md) | Make a real AI phone call on the user's behalf. Validates prerequisites (membership, phone setup, credits), resolves ... |
|
|
46
46
|
| [gsk-salesforce](../skills/gsk-salesforce/SKILL.md) | Salesforce DX CLI (`sf`) operations in a pre-authenticated sandbox. Actions: run (forwards any `sf` subcommand). |
|
|
47
|
+
| [gsk-sb-brain](../skills/gsk-sb-brain/SKILL.md) | Unified read-only access to the user's Second Brain — notes, emails, meetings, and connected knowledge sources. Ident... |
|
|
47
48
|
| [gsk-scholar-search](../skills/gsk-scholar-search/SKILL.md) | Search scholarly articles and academic papers. Returns matching papers with titles, authors, venues, and citation cou... |
|
|
48
49
|
| [gsk-sharepoint](../skills/gsk-sharepoint/SKILL.md) | SharePoint site, list, and file operations. Actions: list, list_items, search, read_content, read_file, upload. |
|
|
49
50
|
| [gsk-sharepoint-upload](../skills/gsk-sharepoint-upload/SKILL.md) | Upload a file to a SharePoint document library. |
|