@raidiant/notifai 7.0.2 → 9.0.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/CHANGELOG.md +75 -0
- package/README.md +20 -13
- package/dist/atomic-file.d.ts +14 -0
- package/dist/atomic-file.js +27 -2
- package/dist/atomic-file.js.map +1 -1
- package/dist/cli-bin.d.ts +4 -0
- package/dist/cli-bin.js +62 -0
- package/dist/cli-bin.js.map +1 -0
- package/dist/cli-release.d.ts +10 -0
- package/dist/cli-release.js +75 -0
- package/dist/cli-release.js.map +1 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +13 -3
- package/dist/client.js.map +1 -1
- package/dist/commands-auth.d.ts +6 -0
- package/dist/commands-auth.js +28 -3
- package/dist/commands-auth.js.map +1 -1
- package/dist/commands-config.js +22 -3
- package/dist/commands-config.js.map +1 -1
- package/dist/commands-core.d.ts +12 -0
- package/dist/commands-core.js +27 -3
- package/dist/commands-core.js.map +1 -1
- package/dist/commands-devices.d.ts +2 -1
- package/dist/commands-devices.js +20 -8
- package/dist/commands-devices.js.map +1 -1
- package/dist/commands-doctor.d.ts +1 -0
- package/dist/commands-doctor.js +85 -27
- package/dist/commands-doctor.js.map +1 -1
- package/dist/commands-guidance.d.ts +27 -0
- package/dist/commands-guidance.js +163 -0
- package/dist/commands-guidance.js.map +1 -0
- package/dist/commands-hooks.d.ts +16 -5
- package/dist/commands-hooks.js +433 -38
- package/dist/commands-hooks.js.map +1 -1
- package/dist/commands-init.d.ts +10 -18
- package/dist/commands-init.js +139 -54
- package/dist/commands-init.js.map +1 -1
- package/dist/commands-send-support.d.ts +17 -2
- package/dist/commands-send-support.js +66 -8
- package/dist/commands-send-support.js.map +1 -1
- package/dist/commands-send.d.ts +0 -1
- package/dist/commands-send.js +105 -39
- package/dist/commands-send.js.map +1 -1
- package/dist/commands-setup-proof.d.ts +8 -0
- package/dist/commands-setup-proof.js +31 -2
- package/dist/commands-setup-proof.js.map +1 -1
- package/dist/commands-skill.d.ts +11 -1
- package/dist/commands-skill.js +61 -11
- package/dist/commands-skill.js.map +1 -1
- package/dist/commands.d.ts +2 -1
- package/dist/commands.js +1 -0
- package/dist/commands.js.map +1 -1
- package/dist/config-schema.d.ts +1 -1
- package/dist/config-schema.js +30 -14
- package/dist/config-schema.js.map +1 -1
- package/dist/config.d.ts +24 -5
- package/dist/config.js +37 -8
- package/dist/config.js.map +1 -1
- package/dist/credentials.d.ts +10 -1
- package/dist/credentials.js +25 -12
- package/dist/credentials.js.map +1 -1
- package/dist/guidance-content.d.ts +50 -0
- package/dist/guidance-content.js +240 -0
- package/dist/guidance-content.js.map +1 -0
- package/dist/guidance.d.ts +69 -0
- package/dist/guidance.js +173 -0
- package/dist/guidance.js.map +1 -0
- package/dist/hook-adapter.js +37 -3
- package/dist/hook-adapter.js.map +1 -1
- package/dist/hooks.d.ts +68 -7
- package/dist/hooks.js +238 -92
- package/dist/hooks.js.map +1 -1
- package/dist/install-hooks.d.ts +10 -18
- package/dist/install-hooks.js +110 -23
- package/dist/install-hooks.js.map +1 -1
- package/dist/interactive.d.ts +1 -1
- package/dist/interactive.js +14 -9
- package/dist/interactive.js.map +1 -1
- package/dist/logging.d.ts +8 -1
- package/dist/logging.js +43 -2
- package/dist/logging.js.map +1 -1
- package/dist/main.js +5 -487
- package/dist/main.js.map +1 -1
- package/dist/native-skills.d.ts +19 -0
- package/dist/native-skills.js +30 -8
- package/dist/native-skills.js.map +1 -1
- package/dist/opencode-plugin.js +14 -1
- package/dist/opencode-plugin.js.map +1 -1
- package/dist/program.d.ts +49 -0
- package/dist/program.js +576 -0
- package/dist/program.js.map +1 -0
- package/dist/send.d.ts +12 -10
- package/dist/send.js +65 -29
- package/dist/send.js.map +1 -1
- package/dist/session-activation.d.ts +15 -0
- package/dist/session-activation.js +35 -0
- package/dist/session-activation.js.map +1 -0
- package/dist/session-labels.d.ts +9 -3
- package/dist/session-labels.js +38 -7
- package/dist/session-labels.js.map +1 -1
- package/dist/url-policy.d.ts +85 -0
- package/dist/url-policy.js +369 -0
- package/dist/url-policy.js.map +1 -0
- package/package.json +6 -4
- package/src/atomic-file.ts +36 -2
- package/src/cli-bin.test.ts +38 -0
- package/src/cli-bin.ts +67 -0
- package/src/cli-release.test.ts +46 -0
- package/src/cli-release.ts +78 -0
- package/src/client.test.ts +95 -0
- package/src/client.ts +16 -3
- package/src/commands-auth.ts +32 -3
- package/src/commands-config.ts +25 -2
- package/src/commands-core.ts +38 -3
- package/src/commands-devices.ts +28 -9
- package/src/commands-doctor.ts +116 -25
- package/src/commands-guidance.ts +216 -0
- package/src/commands-hooks.ts +513 -42
- package/src/commands-init.ts +170 -60
- package/src/commands-send-support.test.ts +156 -0
- package/src/commands-send-support.ts +72 -8
- package/src/commands-send.ts +123 -38
- package/src/commands-setup-proof.ts +36 -2
- package/src/commands-skill.ts +78 -15
- package/src/commands.test.ts +1490 -197
- package/src/commands.ts +6 -0
- package/src/config-schema.ts +32 -16
- package/src/config.test.ts +57 -2
- package/src/config.ts +49 -10
- package/src/credentials.test.ts +71 -3
- package/src/credentials.ts +29 -15
- package/src/guidance-content.ts +256 -0
- package/src/guidance.test.ts +299 -0
- package/src/guidance.ts +233 -0
- package/src/hook-adapter.test.ts +113 -1
- package/src/hook-adapter.ts +37 -3
- package/src/hooks.test.ts +783 -170
- package/src/hooks.ts +306 -131
- package/src/install-hooks.test.ts +135 -16
- package/src/install-hooks.ts +113 -25
- package/src/interactive.ts +14 -9
- package/src/logging.test.ts +66 -3
- package/src/logging.ts +45 -2
- package/src/main.ts +6 -614
- package/src/native-skills.test.ts +41 -1
- package/src/native-skills.ts +40 -6
- package/src/opencode-plugin.ts +14 -1
- package/src/program.test.ts +237 -0
- package/src/program.ts +751 -0
- package/src/send.test.ts +28 -0
- package/src/send.ts +81 -34
- package/src/session-activation.ts +45 -0
- package/src/session-labels.test.ts +120 -3
- package/src/session-labels.ts +38 -7
- package/src/skill.test.ts +153 -12
- package/src/trust-policy.test.ts +701 -0
- package/src/url-policy.ts +399 -0
package/dist/main.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import { Command } from 'commander';
|
|
4
|
-
import { acknowledgeCommand, askCommand, accessStatusCommand, authStatusCommand, capabilitiesCommand, closeCommand, configExplainCommand, configSetCommand, configShowCommand, configUnsetCommand, devicesCommand, doctorCommand, hookDefersDiagnosticsUntilAfterCleanup, hookRunCommand, hooksInstallCommand, hooksUninstallCommand, initCommand, loginCommand, logoutCommand, logsCommand, realIo, repliesCommand, sendCommand, statusCommand, } from './commands.js';
|
|
2
|
+
import { realIo } from './commands.js';
|
|
5
3
|
import { defaultCredentialStore } from './credentials.js';
|
|
6
|
-
import { packageVersion } from './release.js';
|
|
7
|
-
import { HARNESSES } from './install-hooks.js';
|
|
8
4
|
import { nativeSkills } from './native-skills.js';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { bootstrapLogger } from './logging.js';
|
|
5
|
+
import { argvFlagNames, bootstrapLogger } from './logging.js';
|
|
6
|
+
import { buildProgram } from './program.js';
|
|
12
7
|
/**
|
|
13
8
|
* The local record for this invocation.
|
|
14
9
|
*
|
|
@@ -26,490 +21,13 @@ const deps = {
|
|
|
26
21
|
nativeSkills,
|
|
27
22
|
logger,
|
|
28
23
|
};
|
|
29
|
-
/**
|
|
30
|
-
* One source of truth for the version: the manifest npm actually published.
|
|
31
|
-
*
|
|
32
|
-
* It was hardcoded here as well, and the first patch release proved why that
|
|
33
|
-
* does not hold — `package.json` moved and `notifai --version` kept reporting
|
|
34
|
-
* the old number, which is exactly the string someone pastes into a bug report
|
|
35
|
-
* to say what they are running.
|
|
36
|
-
*
|
|
37
|
-
* `unknown` is the display form of "this build cannot tell"; the skill pin
|
|
38
|
-
* derived from the same source refuses instead, because a wrong ref installs
|
|
39
|
-
* the wrong thing while a wrong version string only misinforms.
|
|
40
|
-
*/
|
|
41
|
-
function version() {
|
|
42
|
-
return packageVersion() ?? 'unknown';
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* The full command path, e.g. `config set`, so a filter on `cmd` distinguishes
|
|
46
|
-
* subcommands that share a leaf name.
|
|
47
|
-
*/
|
|
48
|
-
function commandPath(command) {
|
|
49
|
-
const parts = [];
|
|
50
|
-
for (let node = command; node?.parent != null; node = node.parent) {
|
|
51
|
-
parts.unshift(node.name());
|
|
52
|
-
}
|
|
53
|
-
return parts.join(' ') || 'notifai';
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Which flags were passed, without their values.
|
|
57
|
-
*
|
|
58
|
-
* The flag names answer nearly every question worth asking of an invocation —
|
|
59
|
-
* was `--reply` set, was `--all` — while the values are notification content
|
|
60
|
-
* and user text that has no business being recorded merely because a command
|
|
61
|
-
* ran. Values are available under `log_level = debug`, which is a deliberate act.
|
|
62
|
-
*/
|
|
63
|
-
function flagNames(argv) {
|
|
64
|
-
return argv.filter((token) => token.startsWith('--'));
|
|
65
|
-
}
|
|
66
24
|
const startedAt = Date.now();
|
|
67
25
|
process.on('exit', (code) => {
|
|
68
26
|
logger.info('cli.end', {
|
|
69
27
|
exit: code,
|
|
70
28
|
duration_ms: Date.now() - startedAt,
|
|
71
|
-
flags:
|
|
29
|
+
flags: argvFlagNames(process.argv.slice(2)),
|
|
72
30
|
});
|
|
73
31
|
});
|
|
74
|
-
|
|
75
|
-
.description('Send native device notifications from agents and local programs')
|
|
76
|
-
.version(version())
|
|
77
|
-
.configureHelp(helpConfiguration)
|
|
78
|
-
// Lazy on purpose. `addHelpText` also takes a string, but that builds the
|
|
79
|
-
// footer on every invocation — including the hook that runs in front of
|
|
80
|
-
// every prompt the user types, which never renders help at all.
|
|
81
|
-
.addHelpText('after', () => rootHelpFooter())
|
|
82
|
-
// Commander's default is to print the full help and exit 0 for an unknown
|
|
83
|
-
// `help` topic, so `notifai help nonsense` looked like it had worked. A
|
|
84
|
-
// reader who mistyped a command deserves to be told, and a script deserves
|
|
85
|
-
// a nonzero code.
|
|
86
|
-
.showSuggestionAfterError(true)
|
|
87
|
-
// Commander drops the implicit `help [command]` as soon as the program
|
|
88
|
-
// itself has an action handler — which the interactive default below gives
|
|
89
|
-
// it. Without this, adding that default would silently break
|
|
90
|
-
// `notifai help send` for everyone who reaches for it before `--help`.
|
|
91
|
-
.helpCommand(true)
|
|
92
|
-
.hook('preAction', (_program, actionCommand) => {
|
|
93
|
-
logger.bind({ cmd: commandPath(actionCommand) });
|
|
94
|
-
// SessionEnd uses the hook policy shared with commands.ts: local cleanup
|
|
95
|
-
// precedes every diagnostic that can wait on the shared log lock.
|
|
96
|
-
const deferDiagnostics = actionCommand.name() === 'hook' &&
|
|
97
|
-
hookDefersDiagnosticsUntilAfterCleanup(actionCommand.processedArgs[0]);
|
|
98
|
-
// Values only at `debug`; `cli.end` carries the flag names at every level.
|
|
99
|
-
if (!deferDiagnostics) {
|
|
100
|
-
logger.debug('cli.start', {
|
|
101
|
-
version: version(),
|
|
102
|
-
argv: process.argv.slice(2),
|
|
103
|
-
cwd: process.cwd(),
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
/**
|
|
108
|
-
* Bare `notifai`.
|
|
109
|
-
*
|
|
110
|
-
* At a human terminal this opens the interactive app; anywhere else it prints
|
|
111
|
-
* help exactly as before. The check is the same one every other prompt in this
|
|
112
|
-
* CLI is gated on — stdin and stdout both TTYs, not CI, `NOTIFAI_NO_INPUT`
|
|
113
|
-
* unset — because an agent that reaches a prompt does not fail, it hangs
|
|
114
|
-
* for ever waiting on a stdin nobody is typing into.
|
|
115
|
-
*
|
|
116
|
-
* The import is dynamic so that the prompt library, the banner and the whole
|
|
117
|
-
* interactive tree cost nothing to the paths that never draw them — `send`,
|
|
118
|
-
* `ask`, and the hook that runs in front of every prompt the user types.
|
|
119
|
-
*/
|
|
120
|
-
/**
|
|
121
|
-
* Commander exits 1 for every usage error it detects itself, which contradicts
|
|
122
|
-
* the exit vocabulary this CLI documents and every hand-written usage error it
|
|
123
|
-
* returns. A caller branching on exit codes should not have to know which layer
|
|
124
|
-
* rejected it. Help and version stay successful.
|
|
125
|
-
*/
|
|
126
|
-
program.exitOverride((err) => {
|
|
127
|
-
process.exit(err.exitCode === 0 ? 0 : 2);
|
|
128
|
-
});
|
|
129
|
-
/**
|
|
130
|
-
* An unrecognised subcommand reaches the root as an excess argument, and
|
|
131
|
-
* "expected 0 arguments but got 1" tells a caller nothing about what it typed
|
|
132
|
-
* or what exists. Naming it — with the nearest real command when there is one —
|
|
133
|
-
* turns a dead end into one more try.
|
|
134
|
-
*/
|
|
135
|
-
program.usage('[options] [command]');
|
|
136
|
-
program.argument('[command]').action(async (command) => {
|
|
137
|
-
if (command !== undefined) {
|
|
138
|
-
const names = program.commands.map((cmd) => cmd.name());
|
|
139
|
-
const near = names.filter((name) => name.startsWith(command.slice(0, 2)) ||
|
|
140
|
-
command.startsWith(name.slice(0, 2)) ||
|
|
141
|
-
name.includes(command) ||
|
|
142
|
-
command.includes(name));
|
|
143
|
-
deps.io.err(`Unknown command "${command}".` +
|
|
144
|
-
(near.length > 0 ? ` Did you mean: ${near.slice(0, 3).join(', ')}?` : '') +
|
|
145
|
-
' Run notifai --help for the full list.');
|
|
146
|
-
process.exit(2);
|
|
147
|
-
}
|
|
148
|
-
if (deps.io.interactive !== true) {
|
|
149
|
-
program.outputHelp();
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
const { interactiveCommand } = await import('./interactive.js');
|
|
153
|
-
process.exit(await interactiveCommand(deps, version()));
|
|
154
|
-
});
|
|
155
|
-
// Setup leads: `init` is the single entry command for first-run friendliness.
|
|
156
|
-
program
|
|
157
|
-
.command('init')
|
|
158
|
-
.helpGroup(GROUP.start)
|
|
159
|
-
.summary('Set this project up, step by step')
|
|
160
|
-
.description('Set up Notifai here, idempotently: sign-in, project id, hooks, device readiness, live receipt proof. ' +
|
|
161
|
-
'Interactive at a human terminal; never prompts otherwise (agents: pass flags)')
|
|
162
|
-
.option('--project-id <id>', 'project identifier slug (default: derived from the directory name)')
|
|
163
|
-
.option('--skills', 'install/update the agent skill from its pinned public release')
|
|
164
|
-
.option('--no-skills', 'suppress the optional agent-skill status line')
|
|
165
|
-
.option('--skills-scope <scope>', 'unattended skill scope: project or global')
|
|
166
|
-
.option('--hooks', 'install harness hooks for registered-question routing')
|
|
167
|
-
.option('--no-hooks', 'skip the hooks without being asked')
|
|
168
|
-
.action(async (opts) => {
|
|
169
|
-
process.exit(await initCommand(deps, opts));
|
|
170
|
-
});
|
|
171
|
-
program
|
|
172
|
-
.command('doctor')
|
|
173
|
-
.helpGroup(GROUP.daily)
|
|
174
|
-
.summary('Check every part of the setup')
|
|
175
|
-
.description('Audit config, credential, server, contract, device, hook, and saved receipt proof; exits nonzero when any line is FAIL (no live send)')
|
|
176
|
-
.option('--json', 'machine-readable output')
|
|
177
|
-
.action(async (opts) => {
|
|
178
|
-
process.exit(await doctorCommand(deps, opts));
|
|
179
|
-
});
|
|
180
|
-
program
|
|
181
|
-
.command('login')
|
|
182
|
-
.helpGroup(GROUP.start)
|
|
183
|
-
.summary('Sign in and pair this machine')
|
|
184
|
-
.description('Pair this machine with your Notifai account via browser approval')
|
|
185
|
-
.option('--name <name>', 'machine name shown in the dashboard (default: hostname)')
|
|
186
|
-
.option('--base-url <url>', 'developer override for the service origin (also NOTIFAI_BASE_URL)')
|
|
187
|
-
.option('--no-open', 'do not open the approval page in a browser')
|
|
188
|
-
.action(async (opts) => {
|
|
189
|
-
process.exit(await loginCommand(deps, opts));
|
|
190
|
-
});
|
|
191
|
-
program
|
|
192
|
-
.command('logout')
|
|
193
|
-
.helpGroup(GROUP.advanced)
|
|
194
|
-
.summary('Remove the stored machine credential')
|
|
195
|
-
.description('Remove the stored machine credential')
|
|
196
|
-
.action(() => {
|
|
197
|
-
process.exit(logoutCommand(deps));
|
|
198
|
-
});
|
|
199
|
-
const auth = program
|
|
200
|
-
.command('auth')
|
|
201
|
-
.description('Authentication helpers')
|
|
202
|
-
.summary('Machine identity and account plan')
|
|
203
|
-
.helpGroup(GROUP.advanced);
|
|
204
|
-
auth
|
|
205
|
-
.command('status')
|
|
206
|
-
.description('Show the stored machine identity')
|
|
207
|
-
.option('--json', 'machine-readable output')
|
|
208
|
-
.action((opts) => {
|
|
209
|
-
process.exit(authStatusCommand(deps, opts));
|
|
210
|
-
});
|
|
211
|
-
auth
|
|
212
|
-
.command('access')
|
|
213
|
-
.description('Show the account plan and access decision')
|
|
214
|
-
.option('--json', 'machine-readable output')
|
|
215
|
-
.action(async (opts) => {
|
|
216
|
-
process.exit(await accessStatusCommand(deps, opts));
|
|
217
|
-
});
|
|
218
|
-
program
|
|
219
|
-
.command('devices')
|
|
220
|
-
.helpGroup(GROUP.daily)
|
|
221
|
-
.summary('List your devices and whether they can receive')
|
|
222
|
-
.description('List registered devices and their delivery readiness')
|
|
223
|
-
.option('--json', 'machine-readable output')
|
|
224
|
-
.action(async (opts) => {
|
|
225
|
-
process.exit(await devicesCommand(deps, opts));
|
|
226
|
-
});
|
|
227
|
-
program
|
|
228
|
-
.command('capabilities')
|
|
229
|
-
.helpGroup(GROUP.advanced)
|
|
230
|
-
.summary('Show what a platform can render')
|
|
231
|
-
.description('Show a platform capability contract')
|
|
232
|
-
.option('--platform <platform>', 'platform to describe (default: ios)')
|
|
233
|
-
.option('--json', 'machine-readable output')
|
|
234
|
-
.action(async (opts) => {
|
|
235
|
-
process.exit(await capabilitiesCommand(deps, opts));
|
|
236
|
-
});
|
|
237
|
-
const send = program
|
|
238
|
-
.command('send')
|
|
239
|
-
.helpGroup(GROUP.agent)
|
|
240
|
-
.summary('Send a notification')
|
|
241
|
-
.description('Send a notification')
|
|
242
|
-
.optionsGroup(SEND_GROUP.content)
|
|
243
|
-
.requiredOption('--title <title>', 'brief title whose substance is immediately understandable')
|
|
244
|
-
.option('--body <markdown>', 'canonical Markdown body')
|
|
245
|
-
.option('--body-file <path>', 'read the canonical Markdown body from a file (use - for stdin)')
|
|
246
|
-
.option('--subtitle <subtitle>', 'a plain-text line between the title and body')
|
|
247
|
-
.option('--image <path|url|media_id>', 'upload or attach an image in collection order (repeatable, maximum 8)', (v, all = []) => [...all, v])
|
|
248
|
-
.option('--image-alt <text>', 'alt text paired with --image occurrences by position (repeatable)', (v, all = []) => [...all, v])
|
|
249
|
-
.optionsGroup(SEND_GROUP.routing)
|
|
250
|
-
.option('--kind <kind>', 'what this is (required): update | done | failed | blocked — question is set by --reply')
|
|
251
|
-
.option('--project <id>', 'project identifier override (otherwise configured or inferred)')
|
|
252
|
-
.option('--device <id>', 'target a device id (repeatable)', (v, all = []) => [...all, v])
|
|
253
|
-
.option('--all', 'target all routable devices (overrides configured devices)')
|
|
254
|
-
.option('--session-id <id>', 'opaque exact-session override (env: NOTIFAI_SESSION_ID)')
|
|
255
|
-
.option('--session-label <text>', 'first human session name, frozen locally (env: NOTIFAI_SESSION_LABEL)')
|
|
256
|
-
.option('--event <event>', 'agent event name, e.g. tests_passed')
|
|
257
|
-
.optionsGroup(SEND_GROUP.presentation)
|
|
258
|
-
.option('--collapse-key <key>', 'replace earlier notifications with the same key')
|
|
259
|
-
.option('--thread-id <id>', 'group related notifications')
|
|
260
|
-
.option('--ttl <seconds>', 'delivery window in seconds', (v) => Number(v))
|
|
261
|
-
.option('--platform <platform>', 'limit optional fields to one supported platform')
|
|
262
|
-
.optionsGroup(SEND_GROUP.reply)
|
|
263
|
-
.option('--reply', 'enable the inline reply action and block for the answer')
|
|
264
|
-
.option('--reply-timeout <seconds>', 'how long to wait for a reply (default: 900)', (v) => Number(v))
|
|
265
|
-
.option('--reply-window <seconds>', 'how long an answer is still accepted, 60-259200 (default: reply_window_seconds, a day)', (v) => Number(v))
|
|
266
|
-
.option('--reply-choice <label>', 'with --reply, ask a closed question; repeat the flag once per answer (2-6)', (v, all = []) => [...all, v])
|
|
267
|
-
.option('--reply-multi', 'with --reply-choice, several answers may be selected')
|
|
268
|
-
// Kept registered, and always a usage error with --reply, so the caller gets
|
|
269
|
-
// a message pointing at `ask` instead of "unknown option".
|
|
270
|
-
.option('--no-block', 'rejected with --reply; use `notifai ask` to ask and end the turn')
|
|
271
|
-
.optionsGroup(SEND_GROUP.advanced)
|
|
272
|
-
.option('--sound <sound>', 'override saved sound: default | done | attention | alert | none')
|
|
273
|
-
.option('--level <level>', 'override saved interruption level: passive | active | time_sensitive')
|
|
274
|
-
.option('--wait <seconds>', 'how long to wait for provider outcomes', (v) => Number(v))
|
|
275
|
-
.option('--no-wait', 'return immediately after acceptance')
|
|
276
|
-
.option('--data <key=value>', 'custom data (repeatable)', (v, all = []) => [...all, v])
|
|
277
|
-
.option('--idempotency-key <key>', 'safe-retry key (default: random)')
|
|
278
|
-
.option('--base-url <url>', 'developer override for the service origin (also NOTIFAI_BASE_URL)')
|
|
279
|
-
.option('--json', 'print the full submission receipt as JSON')
|
|
280
|
-
.action(async (opts) => {
|
|
281
|
-
// commander maps --no-wait onto the same "wait" flag; disentangle.
|
|
282
|
-
const noWait = opts['wait'] === false;
|
|
283
|
-
const wait = typeof opts['wait'] === 'number' ? opts['wait'] : undefined;
|
|
284
|
-
const noBlock = opts['block'] === false;
|
|
285
|
-
const sendOpts = { ...opts };
|
|
286
|
-
// Commander collectors default to []; an empty list means "not passed".
|
|
287
|
-
for (const key of ['replyChoice', 'image', 'imageAlt']) {
|
|
288
|
-
if (Array.isArray(sendOpts[key]) && sendOpts[key].length === 0)
|
|
289
|
-
delete sendOpts[key];
|
|
290
|
-
}
|
|
291
|
-
delete sendOpts['block'];
|
|
292
|
-
const bodyFile = sendOpts['bodyFile'];
|
|
293
|
-
delete sendOpts['bodyFile'];
|
|
294
|
-
if (typeof bodyFile === 'string') {
|
|
295
|
-
if (sendOpts['body'] !== undefined) {
|
|
296
|
-
deps.io.err('Pass either --body or --body-file, not both.');
|
|
297
|
-
process.exit(2);
|
|
298
|
-
}
|
|
299
|
-
try {
|
|
300
|
-
sendOpts['body'] = readFileSync(bodyFile === '-' ? 0 : bodyFile, 'utf8');
|
|
301
|
-
}
|
|
302
|
-
catch (err) {
|
|
303
|
-
deps.io.err(`Could not read ${bodyFile}: ${String(err)}`);
|
|
304
|
-
process.exit(2);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
const flags = { ...sendOpts, noWait, noBlock };
|
|
308
|
-
if (wait === undefined)
|
|
309
|
-
delete flags.wait;
|
|
310
|
-
else
|
|
311
|
-
flags.wait = wait;
|
|
312
|
-
process.exit(await sendCommand(deps, flags));
|
|
313
|
-
});
|
|
314
|
-
send.addHelpText('after', `\nKind is required, and it selects the sound the notification arrives with: done rings the completion chime, failed the most insistent tone, blocked and question a distinct attention tone, update the standard one.\nAn explicit --sound or --level, and the user's saved preference, both outrank that default.\n`);
|
|
315
|
-
program
|
|
316
|
-
.command('replies [request_id]')
|
|
317
|
-
.helpGroup(GROUP.agent)
|
|
318
|
-
.summary('Retrieve replies to a question')
|
|
319
|
-
.description('Retrieve replies for a notification request')
|
|
320
|
-
.option('--pending', 'use the pushed question pending for this project session')
|
|
321
|
-
.option('--wait <seconds>', 'how long to wait for a reply', (v) => Number(v))
|
|
322
|
-
.option('--after <seq>', 'return replies after this sequence number', (v) => Number(v))
|
|
323
|
-
.option('--json', 'machine-readable output')
|
|
324
|
-
.action(async (requestId, opts) => {
|
|
325
|
-
process.exit(await repliesCommand(deps, requestId, opts));
|
|
326
|
-
});
|
|
327
|
-
program
|
|
328
|
-
.command('acknowledge <request_id>')
|
|
329
|
-
.helpGroup(GROUP.agent)
|
|
330
|
-
.summary("Tell the user what you'll do because of their reply")
|
|
331
|
-
.description('Record the required Agent Acknowledgement for a replied-to notification request; never prompts')
|
|
332
|
-
.option('--text <text>', 'concrete work you will do because of the reply')
|
|
333
|
-
.option('--json', 'machine-readable output')
|
|
334
|
-
.action(async (requestId, opts) => {
|
|
335
|
-
process.exit(await acknowledgeCommand(deps, requestId, opts));
|
|
336
|
-
});
|
|
337
|
-
program
|
|
338
|
-
.command('status <request_id>')
|
|
339
|
-
.helpGroup(GROUP.agent)
|
|
340
|
-
.summary('Show the evidence trail for a request')
|
|
341
|
-
.description('Show the evidence trail for a notification request')
|
|
342
|
-
.option('--json', 'machine-readable output')
|
|
343
|
-
.action(async (requestId, opts) => {
|
|
344
|
-
process.exit(await statusCommand(deps, requestId, opts));
|
|
345
|
-
});
|
|
346
|
-
program
|
|
347
|
-
.command('ask [question]')
|
|
348
|
-
.helpGroup(GROUP.agent)
|
|
349
|
-
.summary('Register a question, then end the turn')
|
|
350
|
-
.description('Register a question for the turn-end hook to route to your devices, subject to your question-routing settings')
|
|
351
|
-
.option('--choice <label>', 'answers to offer instead of free text; repeat the flag once per answer (2-6)', (v, all = []) => [...all, v])
|
|
352
|
-
.option('--multi', 'with --choice, several answers may be selected')
|
|
353
|
-
.option('--json', 'machine-readable output')
|
|
354
|
-
.option('--body <markdown>', 'optional Markdown context appended after the question block')
|
|
355
|
-
.option('--body-file <path>', 'read optional Markdown context from a file (use - for stdin)')
|
|
356
|
-
.option('--form <path>', 'ask several questions as one form; JSON file (use - for stdin)')
|
|
357
|
-
.option('--image <path|url|media_id>', 'upload or attach an image in collection order (repeatable, maximum 8)', (v, all = []) => [...all, v])
|
|
358
|
-
.option('--image-alt <text>', 'alt text paired with --image occurrences by position (repeatable)', (v, all = []) => [...all, v])
|
|
359
|
-
.option('--project <id>', 'project identifier override (otherwise configured or inferred)')
|
|
360
|
-
.option('--session-id <id>', 'opaque exact-session override (env: NOTIFAI_SESSION_ID)')
|
|
361
|
-
.option('--session-label <text>', 'first human session name, frozen locally (env: NOTIFAI_SESSION_LABEL)')
|
|
362
|
-
.action(async (question, opts) => {
|
|
363
|
-
let body = opts.body;
|
|
364
|
-
if (typeof opts.bodyFile === 'string') {
|
|
365
|
-
if (body !== undefined) {
|
|
366
|
-
deps.io.err('Pass either --body or --body-file, not both.');
|
|
367
|
-
process.exit(2);
|
|
368
|
-
}
|
|
369
|
-
try {
|
|
370
|
-
body = readFileSync(opts.bodyFile === '-' ? 0 : opts.bodyFile, 'utf8');
|
|
371
|
-
}
|
|
372
|
-
catch (err) {
|
|
373
|
-
deps.io.err(`Could not read ${opts.bodyFile}: ${String(err)}`);
|
|
374
|
-
process.exit(2);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
let form;
|
|
378
|
-
if (typeof opts.form === 'string') {
|
|
379
|
-
try {
|
|
380
|
-
form = readFileSync(opts.form === '-' ? 0 : opts.form, 'utf8');
|
|
381
|
-
}
|
|
382
|
-
catch (err) {
|
|
383
|
-
deps.io.err(`Could not read ${opts.form}: ${String(err)}`);
|
|
384
|
-
process.exit(2);
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
// Commander collectors default to []; an empty list means "not passed".
|
|
388
|
-
const flags = {
|
|
389
|
-
...(opts.choice?.length ? { choice: opts.choice } : {}),
|
|
390
|
-
...(opts.multi ? { multi: true } : {}),
|
|
391
|
-
...(body !== undefined ? { body } : {}),
|
|
392
|
-
...(form !== undefined ? { form } : {}),
|
|
393
|
-
...(opts.image?.length ? { image: opts.image } : {}),
|
|
394
|
-
...(opts.imageAlt?.length ? { imageAlt: opts.imageAlt } : {}),
|
|
395
|
-
...(opts.project !== undefined ? { project: opts.project } : {}),
|
|
396
|
-
...(opts.sessionId !== undefined ? { sessionId: opts.sessionId } : {}),
|
|
397
|
-
...(opts.sessionLabel !== undefined ? { sessionLabel: opts.sessionLabel } : {}),
|
|
398
|
-
...(opts.json === true ? { json: true } : {}),
|
|
399
|
-
};
|
|
400
|
-
process.exit(await askCommand(deps, question, flags));
|
|
401
|
-
});
|
|
402
|
-
program
|
|
403
|
-
.command('close <request_id>')
|
|
404
|
-
.helpGroup(GROUP.agent)
|
|
405
|
-
.summary('Retire a question so late answers are rejected')
|
|
406
|
-
.description('Retire a question so late answers are rejected rather than lost')
|
|
407
|
-
.option('--json', 'machine-readable output')
|
|
408
|
-
.action(async (requestId, opts) => {
|
|
409
|
-
process.exit(await closeCommand(deps, requestId, opts));
|
|
410
|
-
});
|
|
411
|
-
// Hidden, not removed. It is an entry point the hook installer writes into a
|
|
412
|
-
// harness config file, never something a person types — and listing it beside
|
|
413
|
-
// `send` invited exactly one reading, which is that you were supposed to.
|
|
414
|
-
program
|
|
415
|
-
.command('hook <event>', { hidden: true })
|
|
416
|
-
.description('Internal: run a harness hook (reads hook JSON on stdin)')
|
|
417
|
-
// Inert, and the point of it is that it is inert: the installed command line
|
|
418
|
-
// carries a marker that says "Notifai wrote this" independently of which
|
|
419
|
-
// checkout wrote it.
|
|
420
|
-
.option('--owner <name>', 'internal ownership marker')
|
|
421
|
-
.option('--harness <name>', 'internal harness output adapter')
|
|
422
|
-
.action(async (event, opts) => {
|
|
423
|
-
const harness = HARNESSES.find((candidate) => candidate === opts.harness);
|
|
424
|
-
process.exit(await hookRunCommand(deps, event, () => readStdinWithTimeout(), harness));
|
|
425
|
-
});
|
|
426
|
-
const hooks = program
|
|
427
|
-
.command('hooks')
|
|
428
|
-
.description('Install harness hooks for registered-question routing')
|
|
429
|
-
.summary('Wire a harness to route questions to your devices')
|
|
430
|
-
.helpGroup(GROUP.advanced);
|
|
431
|
-
hooks
|
|
432
|
-
.command('install')
|
|
433
|
-
.description('Wire this harness to route registered questions to your devices')
|
|
434
|
-
.option('--harness <name>', 'claude-code | codex | cursor | opencode (default: every detected harness)')
|
|
435
|
-
.option('--global', 'install for every project instead of just this one')
|
|
436
|
-
.action((opts) => {
|
|
437
|
-
process.exit(hooksInstallCommand(deps, opts));
|
|
438
|
-
});
|
|
439
|
-
hooks
|
|
440
|
-
.command('uninstall')
|
|
441
|
-
.description('Remove the hooks this CLI installed')
|
|
442
|
-
.option('--harness <name>', 'claude-code | codex | cursor | opencode (default: detected)')
|
|
443
|
-
.option('--global', 'remove the machine-wide install')
|
|
444
|
-
.action((opts) => {
|
|
445
|
-
process.exit(hooksUninstallCommand(deps, opts));
|
|
446
|
-
});
|
|
447
|
-
program
|
|
448
|
-
.command('logs')
|
|
449
|
-
.helpGroup(GROUP.daily)
|
|
450
|
-
.summary('Show what this machine recorded about what it did')
|
|
451
|
-
.description('Read the local record of commands, notifications, and the question decisions harness hooks made. ' +
|
|
452
|
-
'Bounded and scoped to this project by default; never leaves this machine')
|
|
453
|
-
.option('-n, --limit <count>', 'how many records to show (default: 30)', (v) => Number(v))
|
|
454
|
-
.option('--all', 'lift the default limit, up to a hard cap')
|
|
455
|
-
.option('--since <when>', 'only records newer than this: 10m, 2h, 1d, or an ISO 8601 instant')
|
|
456
|
-
.option('--level <level>', 'minimum severity: error | info | debug (error shows only failures)')
|
|
457
|
-
.option('--event <name>', 'only this event; repeatable', (v, all = []) => [...all, v])
|
|
458
|
-
.option('--run <id>', 'everything one command invocation did')
|
|
459
|
-
.option('--request <id>', 'everything about one notification request')
|
|
460
|
-
.option('--session <id>', 'only this harness session')
|
|
461
|
-
.option('--project <id>', 'only this project')
|
|
462
|
-
.option('--all-projects', 'do not scope to the project in this directory')
|
|
463
|
-
.option('--grep <text>', 'only records containing this text')
|
|
464
|
-
.option('--json', 'one JSON record per line on stdout')
|
|
465
|
-
.option('--path', 'print the log file paths instead of the records')
|
|
466
|
-
.option('--clear', 'delete the log files')
|
|
467
|
-
.action((opts) => {
|
|
468
|
-
const flags = { ...opts };
|
|
469
|
-
if (Array.isArray(flags.event) && flags.event.length === 0)
|
|
470
|
-
delete flags.event;
|
|
471
|
-
process.exit(logsCommand(deps, flags));
|
|
472
|
-
});
|
|
473
|
-
const config = program
|
|
474
|
-
.command('config')
|
|
475
|
-
.description('Show or change settings')
|
|
476
|
-
.summary('Show or change settings')
|
|
477
|
-
.helpGroup(GROUP.daily);
|
|
478
|
-
config
|
|
479
|
-
.command('show')
|
|
480
|
-
.description('Show every setting, what it does, and where its value came from')
|
|
481
|
-
.option('--explain', 'include advanced settings and the file each value came from')
|
|
482
|
-
.option('--plain', 'the flat key = value form, even at a terminal')
|
|
483
|
-
.option('--json', 'machine-readable output')
|
|
484
|
-
.action((opts) => {
|
|
485
|
-
process.exit(configShowCommand(deps, opts));
|
|
486
|
-
});
|
|
487
|
-
config
|
|
488
|
-
.command('explain <key>')
|
|
489
|
-
.description('Explain one setting in full: what it does, what it accepts, what it is now')
|
|
490
|
-
.option('--json', 'machine-readable output')
|
|
491
|
-
.action((key, opts) => {
|
|
492
|
-
process.exit(configExplainCommand(deps, key, opts));
|
|
493
|
-
});
|
|
494
|
-
config
|
|
495
|
-
.command('set <key> <value>')
|
|
496
|
-
.description('Set a configuration value (choose a layer interactively; unattended defaults machine-global and requires --yes)')
|
|
497
|
-
.option('--project', 'write to the shared .notifai/config.toml instead')
|
|
498
|
-
.option('--local', 'write a personal project preference on this machine (not in the repo)')
|
|
499
|
-
.option('--session <id>', 'apply only to one session')
|
|
500
|
-
.option('--yes', 'skip the confirmation gate')
|
|
501
|
-
.action(async (key, value, opts) => {
|
|
502
|
-
process.exit(await configSetCommand(deps, key, value, opts));
|
|
503
|
-
});
|
|
504
|
-
config
|
|
505
|
-
.command('unset <key>')
|
|
506
|
-
.description('Remove a configuration value so the next layer or shipped default applies (choose a layer interactively; unattended defaults machine-global and requires --yes)')
|
|
507
|
-
.option('--project', 'remove from the shared .notifai/config.toml instead')
|
|
508
|
-
.option('--local', 'remove a personal project preference stored on this machine')
|
|
509
|
-
.option('--session <id>', 'remove from one session')
|
|
510
|
-
.option('--yes', 'skip the confirmation gate')
|
|
511
|
-
.action(async (key, opts) => {
|
|
512
|
-
process.exit(await configUnsetCommand(deps, key, opts));
|
|
513
|
-
});
|
|
514
|
-
await program.parseAsync(process.argv);
|
|
32
|
+
await buildProgram(deps).parseAsync(process.argv);
|
|
515
33
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OA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":["../src/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAoB,MAAM,eAAe,CAAA;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C;;;;;;;GAOG;AACH,MAAM,MAAM,GAAG,eAAe,EAAE,CAAA;AAEhC,MAAM,IAAI,GAAgB;IACxB,EAAE,EAAE,MAAM,EAAE;IACZ,KAAK,EAAE,sBAAsB,EAAE;IAC/B,GAAG,EAAE,OAAO,CAAC,GAAG;IAChB,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;IAClB,YAAY;IACZ,MAAM;CACP,CAAA;AAED,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;AAC5B,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;IAC1B,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE;QACrB,IAAI,EAAE,IAAI;QACV,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;QACnC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KAC5C,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA"}
|
package/dist/native-skills.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exact reviewed version of the external `skills` installer.
|
|
3
|
+
*
|
|
4
|
+
* The GitHub skill source stays the immutable CLI version tag. The installer
|
|
5
|
+
* program that fetches it must not float on `latest`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SKILLS_INSTALLER_SPEC = "skills@1.5.23";
|
|
1
8
|
/** The two scopes offered by the skills installer. */
|
|
2
9
|
export type SkillScope = 'project' | 'global';
|
|
3
10
|
/** The installer-managed evidence needed by Notifai readiness. */
|
|
@@ -21,11 +28,23 @@ export interface SkillsAddOptions {
|
|
|
21
28
|
cwd: string;
|
|
22
29
|
env: NodeJS.ProcessEnv;
|
|
23
30
|
}
|
|
31
|
+
export interface SkillsRemoveOptions {
|
|
32
|
+
skill: string;
|
|
33
|
+
scope: SkillScope;
|
|
34
|
+
cwd: string;
|
|
35
|
+
env: NodeJS.ProcessEnv;
|
|
36
|
+
}
|
|
24
37
|
export interface NativeSkills {
|
|
25
38
|
/** Launch the native interactive `npx skills add` flow. */
|
|
26
39
|
add(options: SkillsAddOptions): Promise<number>;
|
|
40
|
+
/** Uninstall one installer-managed skill in one scope. */
|
|
41
|
+
remove(options: SkillsRemoveOptions): Promise<number>;
|
|
27
42
|
/** Read installer-managed inventory from lock files. Does not spawn npx. */
|
|
28
43
|
list(scope: SkillScope, cwd: string, env: NodeJS.ProcessEnv): Promise<SkillsListResult>;
|
|
29
44
|
}
|
|
45
|
+
/** argv for `npx`, including the pinned installer spec. */
|
|
46
|
+
export declare function skillsAddArgv(options: SkillsAddOptions): string[];
|
|
47
|
+
/** argv for uninstalling one skill in one installer scope. */
|
|
48
|
+
export declare function skillsRemoveArgv(options: SkillsRemoveOptions): string[];
|
|
30
49
|
/** The only process/filesystem adapter Notifai needs for the external installer. */
|
|
31
50
|
export declare const nativeSkills: NativeSkills;
|
package/dist/native-skills.js
CHANGED
|
@@ -2,6 +2,13 @@ import { spawn } from 'node:child_process';
|
|
|
2
2
|
import { existsSync, readFileSync } from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { accountHome, npxLaunch } from './platform.js';
|
|
5
|
+
/**
|
|
6
|
+
* Exact reviewed version of the external `skills` installer.
|
|
7
|
+
*
|
|
8
|
+
* The GitHub skill source stays the immutable CLI version tag. The installer
|
|
9
|
+
* program that fetches it must not float on `latest`.
|
|
10
|
+
*/
|
|
11
|
+
export const SKILLS_INSTALLER_SPEC = 'skills@1.5.23';
|
|
5
12
|
function skillLockPath(scope, cwd, env) {
|
|
6
13
|
if (scope === 'project')
|
|
7
14
|
return path.join(cwd, 'skills-lock.json');
|
|
@@ -55,17 +62,32 @@ function run(args, options) {
|
|
|
55
62
|
child.on('exit', (code) => resolve(code ?? 1));
|
|
56
63
|
});
|
|
57
64
|
}
|
|
65
|
+
/** argv for `npx`, including the pinned installer spec. */
|
|
66
|
+
export function skillsAddArgv(options) {
|
|
67
|
+
const args = ['-y', SKILLS_INSTALLER_SPEC, 'add', options.source, '--skill', options.skill];
|
|
68
|
+
if (options.scope === 'global')
|
|
69
|
+
args.push('--global');
|
|
70
|
+
// An explicit scope is the unattended contract. Native `--yes` keeps all
|
|
71
|
+
// remaining installer prompts non-interactive after the scope is chosen.
|
|
72
|
+
if (options.scope !== undefined)
|
|
73
|
+
args.push('--yes');
|
|
74
|
+
return args;
|
|
75
|
+
}
|
|
76
|
+
/** argv for uninstalling one skill in one installer scope. */
|
|
77
|
+
export function skillsRemoveArgv(options) {
|
|
78
|
+
const args = ['-y', SKILLS_INSTALLER_SPEC, 'remove', options.skill];
|
|
79
|
+
if (options.scope === 'global')
|
|
80
|
+
args.push('--global');
|
|
81
|
+
args.push('--yes');
|
|
82
|
+
return args;
|
|
83
|
+
}
|
|
58
84
|
/** The only process/filesystem adapter Notifai needs for the external installer. */
|
|
59
85
|
export const nativeSkills = {
|
|
60
86
|
async add(options) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
// remaining installer prompts non-interactive after the scope is chosen.
|
|
66
|
-
if (options.scope !== undefined)
|
|
67
|
-
args.push('--yes');
|
|
68
|
-
return run(args, { cwd: options.cwd, env: options.env });
|
|
87
|
+
return run(skillsAddArgv(options), { cwd: options.cwd, env: options.env });
|
|
88
|
+
},
|
|
89
|
+
async remove(options) {
|
|
90
|
+
return run(skillsRemoveArgv(options), { cwd: options.cwd, env: options.env });
|
|
69
91
|
},
|
|
70
92
|
async list(scope, cwd, env) {
|
|
71
93
|
// Presence is already on disk. `npx skills list` takes seconds and cannot
|