@quadient/skillshare 1.10.3 → 1.11.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 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`.
@@ -110,7 +117,7 @@ permissions, Microsoft session lifetime and file-tool differences in the hosted
110
117
  Starting with 1.9.0:
111
118
 
112
119
  - `agents listen` and `agents status` run Claude Code and Codex sessions from Skillshare on this computer (see [Connected agents](#connected-agents)); `--sandbox` keeps them read-only.
113
- - Commands print readable text. Scripts that parsed JSON from `whoami`, `list`, `show`, `upload`, `pages list|show|runtime|upload` or `teams status|test|upload` must add `--json`; with `--json` progress goes to stderr and stdout contains only JSON.
120
+ - Commands print readable text. Scripts that parsed JSON from `whoami`, `list`, `show`, `upload`, `pages list|show|runtime|upload|secrets` or `teams status|test|upload` must add `--json`; with `--json` progress goes to stderr and stdout contains only JSON.
114
121
  - `show` accepts a skill name as well as an id.
115
122
  - `pages upload` refuses build output folder names such as `dist` or `build` without `--slug`, says whether it creates or replaces a page, refuses pages owned by someone else unless you are an admin, and prints the page URL.
116
123
 
@@ -322,6 +329,18 @@ them and build frontend assets before uploading. Inspect process status and logs
322
329
  with `skillshare pages runtime <slug>`. Pages are served below `/p/<slug>/`, so use
323
330
  that base path when building assets. Runtime data survives content replacement.
324
331
 
332
+ Manage the write-only secrets an application reads through `SKILLSHARE_SECRETS`
333
+ (page owner or admin only). `set` reads the value from piped stdin or a masked
334
+ prompt, so it never appears in shell history; the running app restarts to pick
335
+ up changes:
336
+
337
+ ```bash
338
+ skillshare pages secrets list my-app
339
+ skillshare pages secrets set my-app API_TOKEN
340
+ printf %s "$TOKEN" | skillshare pages secrets set my-app API_TOKEN
341
+ skillshare pages secrets delete my-app API_TOKEN
342
+ ```
343
+
325
344
  ## Local Pages development (1.6.0+)
326
345
 
327
346
  Run a celld application without a SkillShare server, repository checkout, Docker,
@@ -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
- export function claudeArgs(context, mcpConfigPath) {
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
- const instructions = [start.instructions?.trim(), sandbox ? SANDBOX_NOTE : undefined].filter(Boolean).join('\n\n');
44
- if (instructions)
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
- if (servers.length > 0) {
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,
@@ -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. */
@@ -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
- const child = (options.spawnAgent ?? spawn)(options.command, options.args, {
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, shell: !posix,
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
  }
@@ -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 without a shell, except for Windows .cmd scripts, which Node only starts through one. */
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 shell = process.platform === 'win32' && /\.cmd$/i.test(command);
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, resolve } from 'node:path';
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 = resolve(flags.workdir ?? process.cwd());
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 = resolve(flags.workdir ?? process.cwd());
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/dist/help.js CHANGED
@@ -87,11 +87,14 @@ export const COMMANDS = [
87
87
  'pages show <slug> [--json]',
88
88
  'pages runtime <slug> [--json]',
89
89
  'pages upload <directory> [--slug <slug>] [--json]',
90
+ 'pages secrets list <slug> [--json]',
91
+ 'pages secrets set <slug> <name> [--json]',
92
+ 'pages secrets delete <slug> <name> [--json]',
90
93
  'pages dev [directory] [--slug <slug>] [--port <port>] [--build <command> --watch-dir <sources>]',
91
94
  ' [--celld <executable>] [--user-id <id>] [--user-name <name>] [--user-email <email>]',
92
95
  ],
93
- description: 'An upload replaces all content of the page. Without --slug the directory name is used; build output folders such as dist need an explicit --slug. Pages owned by someone else are refused unless you are an admin.',
94
- examples: ['skillshare pages upload ./site --slug release-notes', 'skillshare pages dev . --slug my-app'],
96
+ description: 'An upload replaces all content of the page. Without --slug the directory name is used; build output folders such as dist need an explicit --slug. Pages owned by someone else are refused unless you are an admin. pages secrets manages the write-only secrets an app reads through SKILLSHARE_SECRETS (owner or admin only, at most 32 per page, 16 KiB each); set reads the value from piped stdin or a masked prompt, never from the command line.',
97
+ examples: ['skillshare pages upload ./site --slug release-notes', 'skillshare pages dev . --slug my-app', 'skillshare pages secrets set my-app API_TOKEN', 'printf %s "$TOKEN" | skillshare pages secrets set my-app API_TOKEN'],
95
98
  flags: ['slug', 'json'],
96
99
  },
97
100
  {
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ import { inspectInstallTarget, installFilesAtomically } from './install-files.js
7
7
  import { preparePageFiles, resolvePageSlug } from './pages.js';
8
8
  import { formatByteSize, formatDateTime, pageUrl, plural, renderPageDetail, renderPageList, renderPageRuntime, renderSkillDetail, renderSkillList, renderSkillVersion, renderUser, } from './output.js';
9
9
  import { runPageDev } from './pages-dev.js';
10
+ import { runPageSecretsCommand } from './pages-secrets.js';
10
11
  import { createServer } from 'node:http';
11
12
  import { createHash, randomBytes } from 'node:crypto';
12
13
  import { spawn } from 'node:child_process';
@@ -378,7 +379,11 @@ async function main() {
378
379
  }
379
380
  return;
380
381
  }
381
- throw new Error(`Unknown pages command '${action}'. Use list, show, runtime, or upload.`);
382
+ if (action === 'secrets') {
383
+ await runPageSecretsCommand(client, options.positionals.slice(1), print);
384
+ return;
385
+ }
386
+ throw new Error(`Unknown pages command '${action}'. Use list, show, runtime, upload, or secrets.`);
382
387
  }
383
388
  }
384
389
  return;
@@ -0,0 +1,76 @@
1
+ import { isCancel, password } from '@clack/prompts';
2
+ import { formatDateTime, formatTable } from './output.js';
3
+ const MAX_VALUE_BYTES = 16 * 1024;
4
+ export function renderPageSecrets(slug, secrets) {
5
+ if (secrets.length === 0)
6
+ return `/p/${slug}/ has no secrets.`;
7
+ return formatTable(['NAME', 'UPDATED', 'BY USER'], secrets.map((secret) => [
8
+ secret.name,
9
+ formatDateTime(secret.updated),
10
+ String(secret.updatedBy),
11
+ ]));
12
+ }
13
+ /**
14
+ * Manages a Page's write-only secrets. Values are read from stdin when it is piped, or from a
15
+ * masked prompt, so they never land in shell history or the process list.
16
+ */
17
+ export async function runPageSecretsCommand(client, positionals, print, readValue = readSecretValue) {
18
+ const [action = 'list', slug, name] = positionals;
19
+ if (!['list', 'set', 'delete'].includes(action)) {
20
+ throw new Error(`Unknown pages secrets command '${action}'. Use list, set, or delete.`);
21
+ }
22
+ if (!slug)
23
+ throw new Error(`pages secrets ${action} requires <slug>`);
24
+ const path = `/api/pages/${encodeURIComponent(slug)}/secrets`;
25
+ if (action === 'list') {
26
+ const { secrets } = await expectSecrets(slug, await client.request(path, { method: 'GET' }));
27
+ print(secrets, () => renderPageSecrets(slug, secrets));
28
+ return;
29
+ }
30
+ if (!name)
31
+ throw new Error(`pages secrets ${action} requires <slug> <name>`);
32
+ if (action === 'delete') {
33
+ const { secrets } = await expectSecrets(slug, await client.request(`${path}?name=${encodeURIComponent(name)}`, { method: 'DELETE' }), name);
34
+ print(secrets, () => `Deleted ${name} from /p/${slug}/. A running app restarts to pick up the change.`);
35
+ return;
36
+ }
37
+ const value = await readValue();
38
+ if (!value)
39
+ throw new Error('The secret value is empty.');
40
+ if (Buffer.byteLength(value, 'utf8') > MAX_VALUE_BYTES)
41
+ throw new Error('Secret values are limited to 16384 UTF-8 bytes.');
42
+ const { secrets } = await expectSecrets(slug, await client.request(path, {
43
+ method: 'PUT',
44
+ headers: { 'Content-Type': 'application/json' },
45
+ body: JSON.stringify({ name, value }),
46
+ }));
47
+ print(secrets, () => `Saved ${name} for /p/${slug}/. A running app restarts to pick it up.`);
48
+ }
49
+ async function expectSecrets(slug, response, name) {
50
+ if (response.ok)
51
+ return await response.json();
52
+ if (response.status === 403)
53
+ throw new Error(`Only the owner of /p/${slug}/ or an administrator can manage its secrets.`);
54
+ if (response.status === 404) {
55
+ throw new Error(name ? `Page /p/${slug}/ or its secret ${name} was not found.` : `Page /p/${slug}/ was not found.`);
56
+ }
57
+ let error = {};
58
+ try {
59
+ error = await response.json();
60
+ }
61
+ catch { }
62
+ throw new Error(error.error ?? `Skillshare returned HTTP ${response.status} for the Page secrets.`);
63
+ }
64
+ async function readSecretValue() {
65
+ if (!process.stdin.isTTY) {
66
+ const chunks = [];
67
+ for await (const chunk of process.stdin)
68
+ chunks.push(Buffer.from(chunk));
69
+ // `echo value |` adds a line ending that is not part of the secret.
70
+ return Buffer.concat(chunks).toString('utf8').replace(/\r?\n$/, '');
71
+ }
72
+ const value = await password({ message: 'Secret value', mask: '*' });
73
+ if (isCancel(value))
74
+ throw new Error('Cancelled.');
75
+ return value;
76
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quadient/skillshare",
3
- "version": "1.10.3",
3
+ "version": "1.11.0",
4
4
  "description": "Skillshare CLI for installing and publishing Quadient skills",
5
5
  "type": "module",
6
6
  "bin": {
@@ -16,12 +16,13 @@
16
16
  "build": "rm -rf dist && tsc -p tsconfig.build.json",
17
17
  "start": "node ./dist/index.js",
18
18
  "prepublishOnly": "npm run build",
19
- "test": "tsx --test cli-args.test.ts install-files.test.ts output.test.ts pages.test.ts pages-dev.test.ts teams-auth.test.ts teams-watch.test.ts teams-browser.test.ts agents.test.ts agents-update.test.ts"
19
+ "test": "tsx --test cli-args.test.ts install-files.test.ts output.test.ts pages.test.ts pages-secrets.test.ts pages-dev.test.ts teams-auth.test.ts teams-watch.test.ts teams-browser.test.ts agents.test.ts agents-update.test.ts"
20
20
  },
21
21
  "publishConfig": {
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"