@solidactions/cli 1.27.0 → 1.29.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 +20 -2
- package/dist/commands/crew-env-delete.js +50 -0
- package/dist/commands/crew-env-list.js +78 -0
- package/dist/commands/crew-env-push.js +162 -0
- package/dist/commands/crew-env-set.js +78 -0
- package/dist/commands/dev.js +39 -10
- package/dist/commands/docs-pull.js +422 -0
- package/dist/commands/docs-push.js +115 -3
- package/dist/commands/docs-upload.js +111 -0
- package/dist/commands/skill-exec.js +61 -0
- package/dist/commands/skill-publish.js +22 -0
- package/dist/commands/skill-pull.js +12 -0
- package/dist/commands/skill-push.js +160 -7
- package/dist/commands/skill-run.js +164 -0
- package/dist/index.js +106 -1
- package/dist/utils/crew.js +72 -0
- package/dist/utils/skill-snapshot.js +89 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36,12 +36,21 @@ const oauth_actions_show_1 = require("./commands/oauth-actions-show");
|
|
|
36
36
|
const oauth_actions_platforms_1 = require("./commands/oauth-actions-platforms");
|
|
37
37
|
const workspaces_1 = require("./commands/workspaces");
|
|
38
38
|
const skill_push_1 = require("./commands/skill-push");
|
|
39
|
+
const skill_publish_1 = require("./commands/skill-publish");
|
|
39
40
|
const skill_pull_1 = require("./commands/skill-pull");
|
|
40
41
|
const skill_list_1 = require("./commands/skill-list");
|
|
41
42
|
const skill_view_1 = require("./commands/skill-view");
|
|
42
43
|
const skill_delete_1 = require("./commands/skill-delete");
|
|
44
|
+
const skill_run_1 = require("./commands/skill-run");
|
|
45
|
+
const skill_exec_1 = require("./commands/skill-exec");
|
|
43
46
|
const role_push_1 = require("./commands/role-push");
|
|
44
47
|
const docs_push_1 = require("./commands/docs-push");
|
|
48
|
+
const docs_pull_1 = require("./commands/docs-pull");
|
|
49
|
+
const docs_upload_1 = require("./commands/docs-upload");
|
|
50
|
+
const crew_env_set_1 = require("./commands/crew-env-set");
|
|
51
|
+
const crew_env_list_1 = require("./commands/crew-env-list");
|
|
52
|
+
const crew_env_delete_1 = require("./commands/crew-env-delete");
|
|
53
|
+
const crew_env_push_1 = require("./commands/crew-env-push");
|
|
45
54
|
const config_1 = require("./utils/config");
|
|
46
55
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
47
56
|
const pkg = require('../package.json');
|
|
@@ -319,6 +328,50 @@ env
|
|
|
319
328
|
(0, env_push_1.envPush)(projectName, path, options);
|
|
320
329
|
});
|
|
321
330
|
// =============================================================================
|
|
331
|
+
// crew env <subcommand>
|
|
332
|
+
// =============================================================================
|
|
333
|
+
const crew = program.command('crew').description('Manage crews');
|
|
334
|
+
const crewEnv = crew.command('env').description('Manage crew variables');
|
|
335
|
+
crewEnv
|
|
336
|
+
.command('set')
|
|
337
|
+
.description('Set a crew variable (create or update)')
|
|
338
|
+
.argument('<crew>', 'Crew name or id')
|
|
339
|
+
.argument('<key>', 'Variable key')
|
|
340
|
+
.argument('<value>', 'Variable value')
|
|
341
|
+
.option('-e, --env <environment>', 'Target environment (production/staging/dev/all)', 'all')
|
|
342
|
+
.option('--no-secret', 'Do not mark as secret — crew variables are secret by default (unlike `env set`)')
|
|
343
|
+
.action((crewArg, key, value, options) => {
|
|
344
|
+
(0, crew_env_set_1.crewEnvSet)(crewArg, key, value, options);
|
|
345
|
+
});
|
|
346
|
+
crewEnv
|
|
347
|
+
.command('list')
|
|
348
|
+
.description('List crew variables')
|
|
349
|
+
.argument('<crew>', 'Crew name or id')
|
|
350
|
+
.option('--json', 'Output as JSON')
|
|
351
|
+
.action((crewArg, options) => {
|
|
352
|
+
(0, crew_env_list_1.crewEnvList)(crewArg, options);
|
|
353
|
+
});
|
|
354
|
+
crewEnv
|
|
355
|
+
.command('delete')
|
|
356
|
+
.description('Delete a crew variable')
|
|
357
|
+
.argument('<crew>', 'Crew name or id')
|
|
358
|
+
.argument('<key>', 'Variable key')
|
|
359
|
+
.option('-y, --yes', 'Skip confirmation prompt')
|
|
360
|
+
.action((crewArg, key, options) => {
|
|
361
|
+
(0, crew_env_delete_1.crewEnvDelete)(crewArg, key, options);
|
|
362
|
+
});
|
|
363
|
+
crewEnv
|
|
364
|
+
.command('push')
|
|
365
|
+
.description('Push variables from a .env file to a crew')
|
|
366
|
+
.argument('<crew>', 'Crew name or id')
|
|
367
|
+
.argument('[file]', 'Source .env file', '.env')
|
|
368
|
+
.option('-e, --env <environment>', 'Target environment (production/staging/dev/all)', 'all')
|
|
369
|
+
.option('--no-secret', 'Do not mark pushed variables as secret — secret by default (unlike `env push`)')
|
|
370
|
+
.option('-y, --yes', 'Skip confirmation prompt')
|
|
371
|
+
.action((crewArg, file, options) => {
|
|
372
|
+
(0, crew_env_push_1.crewEnvPush)(crewArg, file, options);
|
|
373
|
+
});
|
|
374
|
+
// =============================================================================
|
|
322
375
|
// schedule <subcommand>
|
|
323
376
|
// =============================================================================
|
|
324
377
|
const schedule = program.command('schedule').description('Manage cron schedules');
|
|
@@ -459,9 +512,19 @@ skill
|
|
|
459
512
|
.option('--role <name>', 'Scope the skill to a role instead of the shared library')
|
|
460
513
|
.option('--json', 'Output result as JSON')
|
|
461
514
|
.option('--dry-run', 'Preview create vs update without writing')
|
|
515
|
+
.option('--publish', 'Publish (snapshot) the skill after pushing, making it live for agents')
|
|
516
|
+
.option('--force', 'Skip the drift guard: push without checking the remote against your local sidecar revision')
|
|
462
517
|
.action(async (dir, options) => {
|
|
463
518
|
await (0, skill_push_1.skillPush)(dir, options);
|
|
464
519
|
});
|
|
520
|
+
skill
|
|
521
|
+
.command('publish')
|
|
522
|
+
.description('Publish (snapshot) a skill so its latest pushed revision goes live for agents')
|
|
523
|
+
.argument('<name>', 'Skill name/identifier (e.g. "my-skill" or "shared/my-skill")')
|
|
524
|
+
.option('--json', 'Output result as JSON')
|
|
525
|
+
.action(async (name, options) => {
|
|
526
|
+
await (0, skill_publish_1.skillPublish)(name, options);
|
|
527
|
+
});
|
|
465
528
|
skill
|
|
466
529
|
.command('pull')
|
|
467
530
|
.description('Fetch a skill from the library to a local folder for editing (inverse of push)')
|
|
@@ -493,6 +556,28 @@ skill
|
|
|
493
556
|
.action(async (name, options) => {
|
|
494
557
|
await (0, skill_delete_1.skillDelete)(name, options);
|
|
495
558
|
});
|
|
559
|
+
skill
|
|
560
|
+
.command('run')
|
|
561
|
+
.description('Run a skill script LOCALLY with crew variables fetched from the platform (dev loop; default env dev; secrets need env:reveal; see `skill exec` for the remote/deployed counterpart, default env production)')
|
|
562
|
+
.argument('<dir>', 'Local skill directory (must contain SKILL.md)')
|
|
563
|
+
.argument('<command...>', 'Command to run (after --), e.g. -- node scripts/q.js')
|
|
564
|
+
.option('--crew <nameOrId>', 'Crew whose variables to fetch (omit for shared skills)')
|
|
565
|
+
.option('--environment <env>', 'Variable environment: production|staging|dev', 'dev')
|
|
566
|
+
.option('--env-file <path>', 'Local KEY=VALUE overrides (reserved names ignored)')
|
|
567
|
+
.action(async (dir, commandParts, options) => {
|
|
568
|
+
await (0, skill_run_1.skillRun)(dir, commandParts, options);
|
|
569
|
+
});
|
|
570
|
+
skill
|
|
571
|
+
.command('exec')
|
|
572
|
+
.description('Run a command against the DEPLOYED skill in its real sandbox runtime (post-push smoke; default env production; see `skill run` for the local dev-loop counterpart, default env dev)')
|
|
573
|
+
.argument('<name>', 'Skill name or identifier')
|
|
574
|
+
.argument('<command...>', 'Command to run remotely (after --), e.g. -- node scripts/q.js')
|
|
575
|
+
.option('--role <name>', 'Role-scoped skill (uses roles.exec_skill)')
|
|
576
|
+
.option('--in-crew <crew>', 'Disambiguate when the role name exists in multiple crews')
|
|
577
|
+
.option('--environment <env>', 'Sandbox environment: production|staging|dev (default production)')
|
|
578
|
+
.action(async (name, commandParts, options) => {
|
|
579
|
+
await (0, skill_exec_1.skillExec)(name, commandParts, options);
|
|
580
|
+
});
|
|
496
581
|
// =============================================================================
|
|
497
582
|
// role <subcommand> (SOP surface — flat peer of skill, per cli#34)
|
|
498
583
|
// =============================================================================
|
|
@@ -517,9 +602,29 @@ docs
|
|
|
517
602
|
.option('--type <slug>', 'Doc-type slug to apply to all uploaded docs')
|
|
518
603
|
.option('--folder <base>', 'Nest the whole upload under this base folder path in SA-Docs')
|
|
519
604
|
.option('--dry-run', 'Preview what would be created without writing')
|
|
605
|
+
.option('--force', 'Overwrite tracked docs (from a prior docs pull) without a base-revision drift guard')
|
|
520
606
|
.option('--json', 'Output result as JSON')
|
|
521
607
|
.action(async (dir, options) => {
|
|
522
|
-
await (0, docs_push_1.docsPush)(dir, { onConflict: options.onConflict, type: options.type, folder: options.folder, dryRun: options.dryRun, json: options.json });
|
|
608
|
+
await (0, docs_push_1.docsPush)(dir, { onConflict: options.onConflict, type: options.type, folder: options.folder, dryRun: options.dryRun, force: options.force, json: options.json });
|
|
609
|
+
});
|
|
610
|
+
docs
|
|
611
|
+
.command('pull')
|
|
612
|
+
.description('Download a Docs folder tree to a local directory for editing (inverse of push)')
|
|
613
|
+
.argument('<folder>', 'Docs folder path (or a single doc path)')
|
|
614
|
+
.argument('[dest]', 'Destination directory (defaults to ./<last-segment>/)')
|
|
615
|
+
.option('-y, --yes', 'Overwrite a non-empty destination without confirmation')
|
|
616
|
+
.option('--overwrite', 'DESTRUCTIVE: discard unpushed local changes (tracked files whose content no longer matches the last pull) and overwrite them; implies --yes')
|
|
617
|
+
.option('--json', 'Machine-readable output')
|
|
618
|
+
.action(async (folder, dest, options) => {
|
|
619
|
+
await (0, docs_pull_1.docsPull)(folder, dest, options);
|
|
620
|
+
});
|
|
621
|
+
docs
|
|
622
|
+
.command('upload <files...>')
|
|
623
|
+
.description('Upload one or more media files to SA-Docs (requires a token with the "docs" ability)')
|
|
624
|
+
.option('--folder <path>', 'Folder path to upload into (auto-created if missing)')
|
|
625
|
+
.option('--title <title>', 'Title for the uploaded doc (only valid with a single file)')
|
|
626
|
+
.action(async (files, options) => {
|
|
627
|
+
await (0, docs_upload_1.docsUpload)(files, { folder: options.folder, title: options.title });
|
|
523
628
|
});
|
|
524
629
|
program.parseAsync().catch((err) => {
|
|
525
630
|
console.error(chalk_1.default.red(err.message ?? String(err)));
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CREW_ENV_VALUES = void 0;
|
|
7
|
+
exports.isValidCrewEnv = isValidCrewEnv;
|
|
8
|
+
exports.crewEnvError = crewEnvError;
|
|
9
|
+
exports.isNumericCrewArg = isNumericCrewArg;
|
|
10
|
+
exports.matchCrewByName = matchCrewByName;
|
|
11
|
+
exports.fetchCrews = fetchCrews;
|
|
12
|
+
exports.resolveCrewId = resolveCrewId;
|
|
13
|
+
const axios_1 = __importDefault(require("axios"));
|
|
14
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
15
|
+
const api_1 = require("./api");
|
|
16
|
+
exports.CREW_ENV_VALUES = ['production', 'staging', 'dev', 'all'];
|
|
17
|
+
function isValidCrewEnv(value) {
|
|
18
|
+
return exports.CREW_ENV_VALUES.includes(value);
|
|
19
|
+
}
|
|
20
|
+
function crewEnvError(value) {
|
|
21
|
+
return `Invalid --env "${value}" — must be one of: ${exports.CREW_ENV_VALUES.join(', ')}.`;
|
|
22
|
+
}
|
|
23
|
+
/** True when the crew argument should be used as an id directly, bypassing name lookup. */
|
|
24
|
+
function isNumericCrewArg(input) {
|
|
25
|
+
return /^\d+$/.test(input);
|
|
26
|
+
}
|
|
27
|
+
/** Pure: case-insensitive name match against a fetched crew list. */
|
|
28
|
+
function matchCrewByName(input, crews) {
|
|
29
|
+
const matches = crews.filter((c) => c.name.toLowerCase() === input.toLowerCase());
|
|
30
|
+
if (matches.length === 0)
|
|
31
|
+
return { status: 'not_found' };
|
|
32
|
+
if (matches.length > 1)
|
|
33
|
+
return { status: 'ambiguous', candidates: matches };
|
|
34
|
+
return { status: 'ok', crew: matches[0] };
|
|
35
|
+
}
|
|
36
|
+
async function fetchCrews(config) {
|
|
37
|
+
const response = await axios_1.default.get(`${config.host}/api/v1/crews`, { headers: (0, api_1.getApiHeaders)(config) });
|
|
38
|
+
return response.data?.data ?? [];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Resolve a crew CLI argument to an id. Numeric input is used directly as
|
|
42
|
+
* the id (no network call) — lets scripts skip the name lookup entirely and
|
|
43
|
+
* sidesteps ambiguity. Non-numeric input is matched by case-insensitive name
|
|
44
|
+
* against `GET /api/v1/crews`; ambiguous matches list candidates by id so
|
|
45
|
+
* the caller can retry unambiguously.
|
|
46
|
+
*/
|
|
47
|
+
async function resolveCrewId(config, input) {
|
|
48
|
+
if (isNumericCrewArg(input)) {
|
|
49
|
+
return { id: input, name: input };
|
|
50
|
+
}
|
|
51
|
+
let crews;
|
|
52
|
+
try {
|
|
53
|
+
crews = await fetchCrews(config);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
console.error(chalk_1.default.red('Failed to list crews:'), error.response?.data?.message || error.message);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
const result = matchCrewByName(input, crews);
|
|
60
|
+
if (result.status === 'not_found') {
|
|
61
|
+
console.error(chalk_1.default.red(`Crew "${input}" not found.`));
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
if (result.status === 'ambiguous') {
|
|
65
|
+
console.error(chalk_1.default.red(`Multiple crews named "${input}" found — specify by id instead:`));
|
|
66
|
+
for (const c of result.candidates) {
|
|
67
|
+
console.error(chalk_1.default.gray(` id=${c.id}${c.path ? ` path=${c.path}` : ''}`));
|
|
68
|
+
}
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
return result.crew;
|
|
72
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Publish (snapshot) helpers for crews skills.
|
|
4
|
+
*
|
|
5
|
+
* Composes two existing MCP actions: crews_skills.read resolves a skill name to
|
|
6
|
+
* its doc_id and reports whether the current revision is unpublished, and
|
|
7
|
+
* crews_versions.take_snapshot promotes that revision to all agents.
|
|
8
|
+
*/
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.publishSkillByDocId = publishSkillByDocId;
|
|
14
|
+
exports.publishSkillByName = publishSkillByName;
|
|
15
|
+
exports.emitPublishOutcome = emitPublishOutcome;
|
|
16
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
17
|
+
const mcp_1 = require("./mcp");
|
|
18
|
+
/** Snapshot a skill by its doc_id (crews_versions.take_snapshot). */
|
|
19
|
+
async function publishSkillByDocId(config, docId) {
|
|
20
|
+
let result;
|
|
21
|
+
try {
|
|
22
|
+
result = await (0, mcp_1.callCrewsTool)(config, 'crews_versions', { action: 'take_snapshot', doc_id: docId });
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
return { status: 'error', code: 'mcp_request_failed', message: e.message };
|
|
26
|
+
}
|
|
27
|
+
if (!result.ok) {
|
|
28
|
+
return { status: 'error', code: result.data?.code ?? 'unknown_error', message: result.data?.message ?? 'take_snapshot returned an error with no message' };
|
|
29
|
+
}
|
|
30
|
+
return { status: 'published', snapshotId: result.data.snapshot_id };
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Resolve a skill name to its doc_id, then publish — short-circuiting when the
|
|
34
|
+
* current revision is already live (no take_snapshot call). Detection uses the
|
|
35
|
+
* read response, NOT the take_snapshot error code (the server maps both
|
|
36
|
+
* "nothing to snapshot" and "live-mode" to the same not_snapshotable code).
|
|
37
|
+
*/
|
|
38
|
+
async function publishSkillByName(config, name) {
|
|
39
|
+
let read;
|
|
40
|
+
try {
|
|
41
|
+
read = await (0, mcp_1.callCrewsTool)(config, 'skills', { action: 'read', identifier: name });
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
return { status: 'error', code: 'mcp_request_failed', message: e.message };
|
|
45
|
+
}
|
|
46
|
+
if (!read.ok) {
|
|
47
|
+
return { status: 'error', code: read.data?.code ?? 'unknown_error', message: read.data?.message ?? 'read returned an error with no message' };
|
|
48
|
+
}
|
|
49
|
+
const data = read.data;
|
|
50
|
+
// Metadata absent entirely → live-mode doc (edits are already live).
|
|
51
|
+
if (data.has_unpublished_revisions === undefined) {
|
|
52
|
+
return { status: 'live_mode' };
|
|
53
|
+
}
|
|
54
|
+
// HEAD already snapshotted → nothing to publish.
|
|
55
|
+
if (data.has_unpublished_revisions === false) {
|
|
56
|
+
return { status: 'already_published' };
|
|
57
|
+
}
|
|
58
|
+
return publishSkillByDocId(config, data.doc_id);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Print a PublishOutcome and exit. `opts.pushed` tailors error copy for the
|
|
62
|
+
* `skill push --publish` case (push succeeded, publish failed). `opts.json`
|
|
63
|
+
* prints the raw outcome as JSON instead of human text.
|
|
64
|
+
*/
|
|
65
|
+
function emitPublishOutcome(name, outcome, opts = {}) {
|
|
66
|
+
if (opts.json) {
|
|
67
|
+
console.log(JSON.stringify(outcome));
|
|
68
|
+
process.exit(outcome.status === 'error' ? 1 : 0);
|
|
69
|
+
}
|
|
70
|
+
switch (outcome.status) {
|
|
71
|
+
case 'published':
|
|
72
|
+
console.log(chalk_1.default.green(`✔ published '${name}' — now live for agents`));
|
|
73
|
+
process.exit(0);
|
|
74
|
+
case 'already_published':
|
|
75
|
+
console.log(chalk_1.default.green('already published — nothing to do'));
|
|
76
|
+
process.exit(0);
|
|
77
|
+
case 'live_mode':
|
|
78
|
+
console.log(chalk_1.default.green('live-mode skill — edits are already live, nothing to publish'));
|
|
79
|
+
process.exit(0);
|
|
80
|
+
case 'error': {
|
|
81
|
+
const prefix = opts.pushed ? 'pushed, but publish failed — ' : '';
|
|
82
|
+
process.stderr.write(chalk_1.default.red(`${prefix}${outcome.code}: ${outcome.message}\n`));
|
|
83
|
+
if (opts.pushed) {
|
|
84
|
+
process.stderr.write(chalk_1.default.yellow(` The skill was pushed. Retry: solidactions skill publish ${name}\n`));
|
|
85
|
+
}
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|