@quadient/skillshare 1.10.3 → 1.10.4
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 +7 -0
- package/dist/agents-claude.js +16 -6
- package/dist/agents-detect.js +2 -1
- package/dist/agents-process.js +8 -2
- package/dist/agents-update.js +3 -6
- package/dist/agents.js +4 -4
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -55,6 +55,13 @@ skillshare agents service logs --lines 100
|
|
|
55
55
|
skillshare agents service uninstall
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
+
On Windows, run these in PowerShell or Command Prompt as yourself, not as administrator. Use
|
|
59
|
+
`npx.cmd` instead of `npx` where PowerShell's script policy blocks `npx`, and pass a Windows
|
|
60
|
+
working directory such as `--workdir ~\Projects`. The service is the scheduled task
|
|
61
|
+
"Skillshare Agents", which starts at logon without a console window. Agents installed as npm
|
|
62
|
+
shims (`claude.cmd`, `codex.cmd`) are started through `cmd.exe` with every argument quoted;
|
|
63
|
+
Claude Code gets the session instructions as a file.
|
|
64
|
+
|
|
58
65
|
`--sandbox` keeps every agent read-only. Claude Code may only read files, search the web
|
|
59
66
|
and use the Skillshare MCP; Codex runs in its read-only sandbox. A profile can do the same
|
|
60
67
|
with `"sandbox": true`.
|
package/dist/agents-claude.js
CHANGED
|
@@ -24,7 +24,11 @@ export function claudeContent(message) {
|
|
|
24
24
|
return message.text;
|
|
25
25
|
return [...(message.text ? [{ type: 'text', text: message.text }] : []), ...images];
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
/** The session's instructions for Claude Code's system prompt; they go in a file, because newlines do not survive cmd.exe on Windows. */
|
|
28
|
+
export function claudeInstructions(context) {
|
|
29
|
+
return [context.start.instructions?.trim(), isSandboxed(context.start.configuration, context) ? SANDBOX_NOTE : undefined].filter(Boolean).join('\n\n');
|
|
30
|
+
}
|
|
31
|
+
export function claudeArgs(context, mcpConfigPath, instructionsPath) {
|
|
28
32
|
const { start } = context;
|
|
29
33
|
const sandbox = isSandboxed(start.configuration, context);
|
|
30
34
|
const servers = start.mcpServers ?? [];
|
|
@@ -40,9 +44,8 @@ export function claudeArgs(context, mcpConfigPath) {
|
|
|
40
44
|
args.push('--effort', start.configuration.reasoning);
|
|
41
45
|
if (mcpConfigPath)
|
|
42
46
|
args.push('--mcp-config', mcpConfigPath);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
args.push('--append-system-prompt', instructions);
|
|
47
|
+
if (instructionsPath)
|
|
48
|
+
args.push('--append-system-prompt-file', instructionsPath);
|
|
46
49
|
if (start.resumeThreadId)
|
|
47
50
|
args.push('--resume', start.resumeThreadId);
|
|
48
51
|
return [...args, ...(context.profile?.args ?? [])];
|
|
@@ -110,15 +113,22 @@ class ClaudeDriver {
|
|
|
110
113
|
}
|
|
111
114
|
async open() {
|
|
112
115
|
const servers = this.context.start.mcpServers ?? [];
|
|
116
|
+
const instructions = claudeInstructions(this.context);
|
|
113
117
|
let mcpConfig;
|
|
114
|
-
|
|
118
|
+
let instructionsFile;
|
|
119
|
+
if (servers.length > 0 || instructions)
|
|
115
120
|
this.directory = await mkdtemp(join(tmpdir(), 'skillshare-session-'));
|
|
121
|
+
if (servers.length > 0) {
|
|
116
122
|
mcpConfig = join(this.directory, 'mcp.json');
|
|
117
123
|
await writeFile(mcpConfig, claudeMcpConfig(servers), { mode: 0o600 });
|
|
118
124
|
}
|
|
125
|
+
if (instructions) {
|
|
126
|
+
instructionsFile = join(this.directory, 'instructions.md');
|
|
127
|
+
await writeFile(instructionsFile, instructions, { mode: 0o600 });
|
|
128
|
+
}
|
|
119
129
|
this.process = startAgentProcess({
|
|
120
130
|
command: this.options.command ?? 'claude',
|
|
121
|
-
args: claudeArgs(this.context, mcpConfig),
|
|
131
|
+
args: claudeArgs(this.context, mcpConfig, instructionsFile),
|
|
122
132
|
cwd: this.context.profile?.workdir ?? this.context.workdir,
|
|
123
133
|
env: {
|
|
124
134
|
...mcpTokenEnvironment(servers), SKILLSHARE_SESSION_ID: this.context.sessionId,
|
package/dist/agents-detect.js
CHANGED
|
@@ -162,8 +162,9 @@ export function parseProfiles(text, home, problems = []) {
|
|
|
162
162
|
}
|
|
163
163
|
return profiles.slice(0, 32);
|
|
164
164
|
}
|
|
165
|
+
/** Expands a leading ~ itself: PowerShell and cmd pass it on unchanged, unlike Unix shells. */
|
|
165
166
|
export function expandHome(path, home = homedir()) {
|
|
166
|
-
const expanded = path === '~' ? home : path.startsWith('~/') ? join(home, path.slice(2)) : path;
|
|
167
|
+
const expanded = path === '~' ? home : path.startsWith('~/') || path.startsWith('~\\') ? join(home, path.slice(2)) : path;
|
|
167
168
|
return isAbsolute(expanded) ? expanded : resolve(expanded);
|
|
168
169
|
}
|
|
169
170
|
/** Reads the top-level model key only; profiles and providers further down the file are ignored. */
|
package/dist/agents-process.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import { createInterface } from 'node:readline';
|
|
3
|
+
import crossSpawn from 'cross-spawn';
|
|
3
4
|
/**
|
|
4
5
|
* Starts an agent that speaks newline-delimited JSON on stdio. Tokens go through the environment only. A separate
|
|
5
6
|
* process group lets stopping the agent also stop the shell commands it runs.
|
|
6
7
|
*/
|
|
7
8
|
export function startAgentProcess(options) {
|
|
8
9
|
const posix = process.platform !== 'win32';
|
|
9
|
-
|
|
10
|
+
// On Windows, claude and codex are often npm .cmd shims, which only run through cmd.exe; cross-spawn finds the right file
|
|
11
|
+
// and quotes every argument for it.
|
|
12
|
+
const child = (options.spawnAgent ?? (posix ? spawn : crossSpawn))(options.command, options.args, {
|
|
10
13
|
cwd: options.cwd, env: { ...process.env, ...options.env }, stdio: ['pipe', 'pipe', 'pipe'],
|
|
11
|
-
detached: posix, windowsHide: true,
|
|
14
|
+
detached: posix, windowsHide: true,
|
|
12
15
|
});
|
|
13
16
|
let stderr = '';
|
|
14
17
|
child.stderr?.on('data', chunk => { stderr = (stderr + chunk).slice(-4000); });
|
|
@@ -32,6 +35,9 @@ export function startAgentProcess(options) {
|
|
|
32
35
|
try {
|
|
33
36
|
if (posix && child.pid)
|
|
34
37
|
process.kill(-child.pid, sig);
|
|
38
|
+
// Windows has no process groups: taskkill ends the shim, the agent and the commands it started.
|
|
39
|
+
else if (!posix && child.pid)
|
|
40
|
+
spawn('taskkill', ['/pid', String(child.pid), '/T', ...(sig === 'SIGKILL' ? ['/F'] : [])], { windowsHide: true, stdio: 'ignore' });
|
|
35
41
|
else
|
|
36
42
|
child.kill(sig);
|
|
37
43
|
}
|
package/dist/agents-update.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
|
+
import crossSpawn from 'cross-spawn';
|
|
2
3
|
import { appendFileSync, existsSync, mkdirSync, renameSync, statSync } from 'node:fs';
|
|
3
4
|
import { mkdir, readFile, readdir, rename, rm, writeFile } from 'node:fs/promises';
|
|
4
5
|
import { dirname, join } from 'node:path';
|
|
@@ -44,10 +45,9 @@ export async function installedVersions(appDir) {
|
|
|
44
45
|
return names.filter(name => /^\d+\.\d+\.\d+$/.test(name) && existsSync(join(versionsDirectory(appDir), name, INSTALLED_MARKER)))
|
|
45
46
|
.sort(compareVersions);
|
|
46
47
|
}
|
|
47
|
-
/** Runs a command
|
|
48
|
+
/** Runs a command and collects its output; on Windows through cross-spawn, which also starts .cmd scripts such as npm.cmd. */
|
|
48
49
|
export const runCommand = (command, args, options = {}) => new Promise((resolve, reject) => {
|
|
49
|
-
const
|
|
50
|
-
const child = spawn(shell ? quoteForCmd(command) : command, shell ? args.map(quoteForCmd) : args, { cwd: options.cwd, shell, windowsHide: true, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
50
|
+
const child = (process.platform === 'win32' ? crossSpawn : spawn)(command, args, { cwd: options.cwd, windowsHide: true, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
51
51
|
let stdout = '';
|
|
52
52
|
let stderr = '';
|
|
53
53
|
child.stdout.on('data', chunk => { stdout += chunk; });
|
|
@@ -55,9 +55,6 @@ export const runCommand = (command, args, options = {}) => new Promise((resolve,
|
|
|
55
55
|
child.on('error', reject);
|
|
56
56
|
child.on('close', code => resolve({ code: code ?? 1, stdout, stderr }));
|
|
57
57
|
});
|
|
58
|
-
function quoteForCmd(value) {
|
|
59
|
-
return /[\s"&|<>^]/.test(value) ? `"${value.replace(/"/g, '""')}"` : value;
|
|
60
|
-
}
|
|
61
58
|
/** npm next to the running Node, so a service with a bare PATH still finds it; otherwise npm on PATH. */
|
|
62
59
|
export function npmCommand() {
|
|
63
60
|
const bin = dirname(process.execPath);
|
package/dist/agents.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createHash, randomBytes } from 'node:crypto';
|
|
2
2
|
import { mkdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { hostname, platform, tmpdir } from 'node:os';
|
|
4
|
-
import { dirname, join
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
5
|
import { setTimeout as delay } from 'node:timers/promises';
|
|
6
6
|
import { createClaudeDriver } from './agents-claude.js';
|
|
7
7
|
import { defaultServiceEnvironment, installService, renderServiceStatus, serviceLogs, serviceStatus, uninstallService, } from './agents-service.js';
|
|
8
8
|
import { createCodexDriver } from './agents-codex.js';
|
|
9
|
-
import { detectAgents, profilesPath } from './agents-detect.js';
|
|
9
|
+
import { detectAgents, expandHome, profilesPath } from './agents-detect.js';
|
|
10
10
|
import { SessionRunner, errorMessage, } from './agents-session.js';
|
|
11
11
|
import { RESTART_FOR_UPDATE, SERVICE_ENV, WORKER_ENV, acquireListenerLock, compareVersions, describeOtherListener, installVersion, releaseListenerLock, superviseListener, } from './agents-update.js';
|
|
12
12
|
import { readCliVersion } from './help.js';
|
|
@@ -113,7 +113,7 @@ export async function runAgentsCommand(client, args, flags, appDirectory, teamsW
|
|
|
113
113
|
if (other)
|
|
114
114
|
throw new Error(describeOtherListener(other));
|
|
115
115
|
}
|
|
116
|
-
const workdir =
|
|
116
|
+
const workdir = expandHome(flags.workdir ?? process.cwd());
|
|
117
117
|
const sandbox = flags.sandbox === 'true';
|
|
118
118
|
const user = await client.get('/api/auth/me');
|
|
119
119
|
const listenerId = await loadListenerId(appDirectory, client.baseUrl, user.id);
|
|
@@ -177,7 +177,7 @@ export async function runServiceCommand(action, flags, appDirectory, server) {
|
|
|
177
177
|
if (!server)
|
|
178
178
|
throw new Error('agents service install needs a Skillshare server.');
|
|
179
179
|
maxConcurrency(flags);
|
|
180
|
-
const workdir =
|
|
180
|
+
const workdir = expandHome(flags.workdir ?? process.cwd());
|
|
181
181
|
const version = readCliVersion();
|
|
182
182
|
console.log(`Installing Skillshare CLI ${version} for the agents service…`);
|
|
183
183
|
await installService(environment, { server, workdir, args: serviceListenArgs(flags), version });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quadient/skillshare",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.4",
|
|
4
4
|
"description": "Skillshare CLI for installing and publishing Quadient skills",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
+
"@types/cross-spawn": "6.0.6",
|
|
25
26
|
"@types/node": "^26.1.1",
|
|
26
27
|
"tsx": "^4.23.1",
|
|
27
28
|
"typescript": "^7.0.2"
|
|
@@ -32,6 +33,7 @@
|
|
|
32
33
|
"dependencies": {
|
|
33
34
|
"@clack/prompts": "^1.7.0",
|
|
34
35
|
"chokidar": "4.0.3",
|
|
36
|
+
"cross-spawn": "7.0.6",
|
|
35
37
|
"esbuild": "0.28.2",
|
|
36
38
|
"jsonc-parser": "3.3.1",
|
|
37
39
|
"playwright": "^1.63.0"
|