@asteroidai/cli 1.9.369 → 1.9.426
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/dist/asteroid.js +409 -363
- package/dist/core.js +118 -44
- package/package.json +1 -1
package/dist/asteroid.js
CHANGED
|
@@ -3410,19 +3410,73 @@ var COMMANDS = [
|
|
|
3410
3410
|
required: false,
|
|
3411
3411
|
description: "Profile group to select a profile from for each execution. Mutually exclusive with profileId."
|
|
3412
3412
|
},
|
|
3413
|
+
{
|
|
3414
|
+
name: "timing",
|
|
3415
|
+
flag: "timing",
|
|
3416
|
+
type: "json",
|
|
3417
|
+
required: false,
|
|
3418
|
+
description: "When the schedule fires. Send this or cronExpression, not both. A schedule needs a rule that recurs: at, every or cron.",
|
|
3419
|
+
fields: [
|
|
3420
|
+
{
|
|
3421
|
+
name: "timezone",
|
|
3422
|
+
flag: "timezone",
|
|
3423
|
+
type: "string",
|
|
3424
|
+
required: false,
|
|
3425
|
+
description: "IANA time zone every part is read in, such as America/New_York"
|
|
3426
|
+
},
|
|
3427
|
+
{
|
|
3428
|
+
name: "at",
|
|
3429
|
+
flag: "at",
|
|
3430
|
+
type: "json",
|
|
3431
|
+
required: false
|
|
3432
|
+
},
|
|
3433
|
+
{
|
|
3434
|
+
name: "every",
|
|
3435
|
+
flag: "every",
|
|
3436
|
+
type: "json",
|
|
3437
|
+
required: false
|
|
3438
|
+
},
|
|
3439
|
+
{
|
|
3440
|
+
name: "once",
|
|
3441
|
+
flag: "once",
|
|
3442
|
+
type: "json",
|
|
3443
|
+
required: false
|
|
3444
|
+
},
|
|
3445
|
+
{
|
|
3446
|
+
name: "cron",
|
|
3447
|
+
flag: "cron",
|
|
3448
|
+
type: "json",
|
|
3449
|
+
required: false
|
|
3450
|
+
},
|
|
3451
|
+
{
|
|
3452
|
+
name: "startAt",
|
|
3453
|
+
flag: "start-at",
|
|
3454
|
+
type: "string",
|
|
3455
|
+
required: false,
|
|
3456
|
+
description: "No fire before this instant. Inclusive."
|
|
3457
|
+
},
|
|
3458
|
+
{
|
|
3459
|
+
name: "endAt",
|
|
3460
|
+
flag: "end-at",
|
|
3461
|
+
type: "string",
|
|
3462
|
+
required: false,
|
|
3463
|
+
description: "No fire at or after this instant."
|
|
3464
|
+
}
|
|
3465
|
+
]
|
|
3466
|
+
},
|
|
3413
3467
|
{
|
|
3414
3468
|
name: "cronExpression",
|
|
3415
3469
|
flag: "cron-expression",
|
|
3416
3470
|
type: "string",
|
|
3417
|
-
required:
|
|
3418
|
-
description: "Five-field cron expression."
|
|
3471
|
+
required: false,
|
|
3472
|
+
description: "Five-field cron expression. Prefer timing."
|
|
3419
3473
|
},
|
|
3420
3474
|
{
|
|
3421
3475
|
name: "timezone",
|
|
3422
3476
|
flag: "timezone",
|
|
3423
3477
|
type: "string",
|
|
3424
3478
|
required: false,
|
|
3425
|
-
description: "IANA time zone the cron expression is evaluated in. Defaults to UTC."
|
|
3479
|
+
description: "IANA time zone the cron expression is evaluated in. Defaults to UTC. Ignored when timing is sent."
|
|
3426
3480
|
},
|
|
3427
3481
|
{
|
|
3428
3482
|
name: "enabled",
|
|
@@ -3653,19 +3707,73 @@ var COMMANDS = [
|
|
|
3653
3707
|
required: false,
|
|
3654
3708
|
description: "Profile group to select a profile from for each execution. Mutually exclusive with profileId."
|
|
3655
3709
|
},
|
|
3710
|
+
{
|
|
3711
|
+
name: "timing",
|
|
3712
|
+
flag: "timing",
|
|
3713
|
+
type: "json",
|
|
3714
|
+
required: false,
|
|
3715
|
+
description: "Replaces when the schedule fires. Send this or cronExpression, not both. To remove a start or end, send the timing without it.",
|
|
3716
|
+
fields: [
|
|
3717
|
+
{
|
|
3718
|
+
name: "timezone",
|
|
3719
|
+
flag: "timezone",
|
|
3720
|
+
type: "string",
|
|
3721
|
+
required: false,
|
|
3722
|
+
description: "IANA time zone every part is read in, such as America/New_York"
|
|
3723
|
+
},
|
|
3724
|
+
{
|
|
3725
|
+
name: "at",
|
|
3726
|
+
flag: "at",
|
|
3727
|
+
type: "json",
|
|
3728
|
+
required: false
|
|
3729
|
+
},
|
|
3730
|
+
{
|
|
3731
|
+
name: "every",
|
|
3732
|
+
flag: "every",
|
|
3733
|
+
type: "json",
|
|
3734
|
+
required: false
|
|
3735
|
+
},
|
|
3736
|
+
{
|
|
3737
|
+
name: "once",
|
|
3738
|
+
flag: "once",
|
|
3739
|
+
type: "json",
|
|
3740
|
+
required: false
|
|
3741
|
+
},
|
|
3742
|
+
{
|
|
3743
|
+
name: "cron",
|
|
3744
|
+
flag: "cron",
|
|
3745
|
+
type: "json",
|
|
3746
|
+
required: false
|
|
3747
|
+
},
|
|
3748
|
+
{
|
|
3749
|
+
name: "startAt",
|
|
3750
|
+
flag: "start-at",
|
|
3751
|
+
type: "string",
|
|
3752
|
+
required: false,
|
|
3753
|
+
description: "No fire before this instant. Inclusive."
|
|
3754
|
+
},
|
|
3755
|
+
{
|
|
3756
|
+
name: "endAt",
|
|
3757
|
+
flag: "end-at",
|
|
3758
|
+
type: "string",
|
|
3759
|
+
required: false,
|
|
3760
|
+
description: "No fire at or after this instant."
|
|
3761
|
+
}
|
|
3762
|
+
]
|
|
3763
|
+
},
|
|
3656
3764
|
{
|
|
3657
3765
|
name: "cronExpression",
|
|
3658
3766
|
flag: "cron-expression",
|
|
3659
3767
|
type: "string",
|
|
3660
3768
|
required: false,
|
|
3661
|
-
description: "Five-field cron expression."
|
|
3769
|
+
description: "Five-field cron expression. Replaces the timing with a cron timing. Prefer timing."
|
|
3662
3770
|
},
|
|
3663
3771
|
{
|
|
3664
3772
|
name: "timezone",
|
|
3665
3773
|
flag: "timezone",
|
|
3666
3774
|
type: "string",
|
|
3667
3775
|
required: false,
|
|
3668
|
-
description: "IANA time zone the
|
|
3776
|
+
description: "IANA time zone the timing is read in. Ignored when timing is sent."
|
|
3669
3777
|
},
|
|
3670
3778
|
{
|
|
3671
3779
|
name: "enabled",
|
|
@@ -4627,7 +4735,7 @@ var COMMANDS = [
|
|
|
4627
4735
|
command: "skill sync",
|
|
4628
4736
|
tool: "skill_sync",
|
|
4629
4737
|
title: "Sync skills",
|
|
4630
|
-
description: "Get the latest Asteroid skills for the portals your organization has added: how to build Asteroid workflows on each portal.
|
|
4738
|
+
description: "Get the latest Asteroid skills for the portals your organization has added: how to build Asteroid workflows on each portal.",
|
|
4631
4739
|
method: "POST",
|
|
4632
4740
|
path: "/astro/v2/skills",
|
|
4633
4741
|
args: [],
|
|
@@ -4643,22 +4751,7 @@ var COMMANDS = [
|
|
|
4643
4751
|
],
|
|
4644
4752
|
binary: false,
|
|
4645
4753
|
readOnly: false,
|
|
4646
|
-
destructive: false
|
|
4647
|
-
body: {
|
|
4648
|
-
required: false,
|
|
4649
|
-
contentType: "application/json",
|
|
4650
|
-
fields: [
|
|
4651
|
-
{
|
|
4652
|
-
name: "learnings",
|
|
4653
|
-
flag: "learnings",
|
|
4654
|
-
type: "json",
|
|
4655
|
-
required: false,
|
|
4656
|
-
description: "Up to 10 things you found out about portals. Leave it out to sync only."
|
|
4657
|
-
}
|
|
4658
|
-
],
|
|
4659
|
-
files: [],
|
|
4660
|
-
credentialOrganization: false
|
|
4661
|
-
}
|
|
4754
|
+
destructive: false
|
|
4662
4755
|
},
|
|
4663
4756
|
{
|
|
4664
4757
|
command: "tag create",
|
|
@@ -6973,18 +7066,7 @@ function withSyncCommands(commands) {
|
|
|
6973
7066
|
(a, b) => a.command.localeCompare(b.command)
|
|
6974
7067
|
);
|
|
6975
7068
|
}
|
|
6976
|
-
var
|
|
6977
|
-
name: "learnings",
|
|
6978
|
-
flag: "learning",
|
|
6979
|
-
type: "json[]",
|
|
6980
|
-
required: false,
|
|
6981
|
-
description: 'What you found out about a portal, as JSON: `{"portal":"<name>","content":"<text>"}`. Add `portalId` if you have one. Repeat for more.'
|
|
6982
|
-
};
|
|
6983
|
-
function withLearningFlag(command) {
|
|
6984
|
-
if (command.tool !== "skill_sync" || !command.body) return command;
|
|
6985
|
-
return { ...command, body: { ...command.body, fields: [LEARNING] } };
|
|
6986
|
-
}
|
|
6987
|
-
var ALL_COMMANDS = withSyncCommands(COMMANDS).map(withLearningFlag);
|
|
7069
|
+
var ALL_COMMANDS = withSyncCommands(COMMANDS);
|
|
6988
7070
|
|
|
6989
7071
|
// src/config.ts
|
|
6990
7072
|
import envPaths from "env-paths";
|
|
@@ -7269,18 +7351,12 @@ var BUILTINS = [
|
|
|
7269
7351
|
},
|
|
7270
7352
|
{
|
|
7271
7353
|
command: "skill sync",
|
|
7272
|
-
usage: "asteroid skill sync
|
|
7273
|
-
description: "Install the Asteroid skills, or bring them up to date, in every skills directory found: `~/.claude/skills`, `~/.cursor/skills` and `~/.agents/skills`. Writes the files that changed, removes the skills the API no longer serves, and leaves a skill directory it did not create alone. Do not edit an installed skill, because the next sync overwrites it. If a skill is missing something about how a portal works,
|
|
7354
|
+
usage: "asteroid skill sync",
|
|
7355
|
+
description: "Install the Asteroid skills, or bring them up to date, in every skills directory found: `~/.claude/skills`, `~/.cursor/skills` and `~/.agents/skills`. Writes the files that changed, removes the skills the API no longer serves, and leaves a skill directory it did not create alone. Do not edit an installed skill, because the next sync overwrites it. If a skill is missing something about how a portal works, save it with `asteroid memory create`.",
|
|
7274
7356
|
args: 0,
|
|
7275
7357
|
options: [
|
|
7276
7358
|
["--no-remove", "Keep the skills and files the API no longer serves."]
|
|
7277
7359
|
],
|
|
7278
|
-
repeatableOptions: [
|
|
7279
|
-
[
|
|
7280
|
-
"--learning <json>",
|
|
7281
|
-
'Optional. Something the portal\'s skill is missing about how the portal works, as JSON: `{"portal":"<name>","content":"<text>"}`. Add `portalId` if you have one. Repeat for more. Send this instead of editing the skill, because the next sync overwrites local edits. Send general knowledge of the portal only.'
|
|
7282
|
-
]
|
|
7283
|
-
],
|
|
7284
7360
|
section: "Skills"
|
|
7285
7361
|
}
|
|
7286
7362
|
];
|
|
@@ -7435,8 +7511,6 @@ function defineCommands(root, options, dotted2 = /* @__PURE__ */ new Map(), onIn
|
|
|
7435
7511
|
const leaf = parent.command(words.at(-1)).description(builtin.description);
|
|
7436
7512
|
if (builtin.arg) leaf.argument(`[${builtin.arg}]`);
|
|
7437
7513
|
for (const [flags, text3] of builtin.options ?? []) leaf.option(flags, text3);
|
|
7438
|
-
for (const [flags, text3] of builtin.repeatableOptions ?? [])
|
|
7439
|
-
leaf.option(flags, text3, collect);
|
|
7440
7514
|
for (const [flags, text3] of builtin.hiddenOptions ?? [])
|
|
7441
7515
|
leaf.addOption(new Flag(flags, text3).hideHelp());
|
|
7442
7516
|
leaf.action((...args) => {
|
|
@@ -8015,7 +8089,7 @@ var ApiError = class extends Error {
|
|
|
8015
8089
|
status;
|
|
8016
8090
|
body;
|
|
8017
8091
|
};
|
|
8018
|
-
var VERSION = "1.9.
|
|
8092
|
+
var VERSION = "1.9.426";
|
|
8019
8093
|
function problem(status, body, fallback) {
|
|
8020
8094
|
if (body && typeof body === "object") {
|
|
8021
8095
|
const record2 = body;
|
|
@@ -8108,310 +8182,77 @@ import {
|
|
|
8108
8182
|
lstatSync,
|
|
8109
8183
|
mkdirSync as mkdirSync3,
|
|
8110
8184
|
readdirSync,
|
|
8111
|
-
readFileSync as
|
|
8185
|
+
readFileSync as readFileSync2,
|
|
8112
8186
|
rmdirSync,
|
|
8113
8187
|
rmSync as rmSync2,
|
|
8114
8188
|
writeFileSync as writeFileSync2
|
|
8115
8189
|
} from "node:fs";
|
|
8116
8190
|
import { dirname as dirname2, join as join4 } from "node:path";
|
|
8117
8191
|
|
|
8118
|
-
// src/
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8192
|
+
// ../workflow-files/src/representation/name-charset.ts
|
|
8193
|
+
var NAME_CHARSET_RE = /^[A-Za-z0-9 !#$%&'()+,.;=@^`{}[\]~-]+$/;
|
|
8194
|
+
var WINDOWS_RESERVED = /* @__PURE__ */ new Set([
|
|
8195
|
+
"con",
|
|
8196
|
+
"prn",
|
|
8197
|
+
"aux",
|
|
8198
|
+
"nul",
|
|
8199
|
+
...Array.from({ length: 9 }, (_, i) => `com${i + 1}`),
|
|
8200
|
+
...Array.from({ length: 9 }, (_, i) => `lpt${i + 1}`)
|
|
8201
|
+
]);
|
|
8202
|
+
function isNameCharsetConforming(name) {
|
|
8203
|
+
return NAME_CHARSET_RE.test(name);
|
|
8123
8204
|
}
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
const value2 = Number(raw);
|
|
8133
|
-
if (raw.trim() === "" || Number.isNaN(value2) || type === "integer" && !Number.isInteger(value2)) {
|
|
8134
|
-
throw new UsageError(
|
|
8135
|
-
`--${option2.flag} must be ${type === "integer" ? "an integer" : "a number"}`
|
|
8136
|
-
);
|
|
8137
|
-
}
|
|
8138
|
-
return value2;
|
|
8205
|
+
|
|
8206
|
+
// ../workflow-files/src/representation/types.ts
|
|
8207
|
+
function normalizeNodeName(name) {
|
|
8208
|
+
let result = name.toLowerCase();
|
|
8209
|
+
result = result.replace(/[^a-z0-9]+/g, "_");
|
|
8210
|
+
result = result.replace(/^_+|_+$/g, "");
|
|
8211
|
+
if (result.length > 80) {
|
|
8212
|
+
result = result.slice(0, 80).replace(/_+$/, "");
|
|
8139
8213
|
}
|
|
8140
|
-
if (
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
return raw === "true";
|
|
8214
|
+
if (result === "") {
|
|
8215
|
+
throw new Error(
|
|
8216
|
+
`representation: node name "${name}" produces an empty directory name after normalization`
|
|
8217
|
+
);
|
|
8145
8218
|
}
|
|
8146
|
-
|
|
8147
|
-
return raw;
|
|
8148
|
-
}
|
|
8149
|
-
function value(option2, raws) {
|
|
8150
|
-
if (option2.type.endsWith("[]")) return raws.map((raw) => scalar(option2, raw));
|
|
8151
|
-
return scalar(option2, raws.at(-1));
|
|
8219
|
+
return result;
|
|
8152
8220
|
}
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
}
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
if (raw.startsWith("@")) return io.text(raw.slice(1));
|
|
8160
|
-
return raw;
|
|
8221
|
+
function lossySlugOr(name, fallback) {
|
|
8222
|
+
try {
|
|
8223
|
+
return normalizeNodeName(name);
|
|
8224
|
+
} catch {
|
|
8225
|
+
return fallback;
|
|
8226
|
+
}
|
|
8161
8227
|
}
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
for (const flag2 of jsonFlags) {
|
|
8166
|
-
const raws = flags.get(flag2);
|
|
8167
|
-
if (raws)
|
|
8168
|
-
flags.set(flag2, await Promise.all(raws.map((raw) => readInput(raw, io))));
|
|
8228
|
+
function nodeDirName(name) {
|
|
8229
|
+
if (isNameCharsetConforming(name)) {
|
|
8230
|
+
return name.replaceAll(" ", "_");
|
|
8169
8231
|
}
|
|
8170
|
-
|
|
8171
|
-
return { ...parsed, flags, body };
|
|
8232
|
+
return normalizeNodeName(name);
|
|
8172
8233
|
}
|
|
8173
|
-
function
|
|
8234
|
+
function agentDirName(name) {
|
|
8174
8235
|
try {
|
|
8175
|
-
return
|
|
8236
|
+
return nodeDirName(name);
|
|
8176
8237
|
} catch {
|
|
8177
|
-
|
|
8238
|
+
return "agent";
|
|
8178
8239
|
}
|
|
8179
8240
|
}
|
|
8180
|
-
function
|
|
8181
|
-
|
|
8182
|
-
try {
|
|
8183
|
-
return JSON.parse(raw);
|
|
8184
|
-
} catch {
|
|
8185
|
-
return raw;
|
|
8186
|
-
}
|
|
8187
|
-
}
|
|
8188
|
-
return raw;
|
|
8241
|
+
function executionDirName(executionId2) {
|
|
8242
|
+
return executionId2.slice(0, 8);
|
|
8189
8243
|
}
|
|
8190
|
-
function
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
if (typeof next !== "object" || next === null || Array.isArray(next))
|
|
8195
|
-
node[key] = {};
|
|
8196
|
-
node = node[key];
|
|
8244
|
+
function workflowDirName(workflowId, version, parentId, parentVersion) {
|
|
8245
|
+
const short = workflowId.slice(0, 8);
|
|
8246
|
+
if (version !== void 0 && version !== null) {
|
|
8247
|
+
return `v${version}_${short}`;
|
|
8197
8248
|
}
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
const path = [];
|
|
8202
|
-
let option2 = field;
|
|
8203
|
-
for (const [i, segment] of segments.entries()) {
|
|
8204
|
-
if (option2?.record) {
|
|
8205
|
-
const key = segments.slice(i).join(".");
|
|
8206
|
-
const entry = { ...option2, flag: flag2, type: option2.record };
|
|
8207
|
-
delete entry.enum;
|
|
8208
|
-
return [
|
|
8209
|
-
[...path, key],
|
|
8210
|
-
entry.type === "json" ? loose(raws.at(-1)) : value(entry, raws)
|
|
8211
|
-
];
|
|
8212
|
-
}
|
|
8213
|
-
if (option2?.fields) {
|
|
8214
|
-
const child = option2.fields.find(
|
|
8215
|
-
(f) => f.flag === segment
|
|
8216
|
-
);
|
|
8217
|
-
if (!child) throw new UsageError(`unknown flag: --${flag2}`);
|
|
8218
|
-
path.push(child.name);
|
|
8219
|
-
option2 = child;
|
|
8220
|
-
continue;
|
|
8221
|
-
}
|
|
8222
|
-
if (option2 && option2.type !== "json") {
|
|
8223
|
-
throw new UsageError(`unknown flag: --${flag2}`);
|
|
8249
|
+
if (parentId) {
|
|
8250
|
+
if (parentVersion !== void 0 && parentVersion !== null) {
|
|
8251
|
+
return `draft_${short}_from_v${parentVersion}`;
|
|
8224
8252
|
}
|
|
8225
|
-
|
|
8226
|
-
option2 = void 0;
|
|
8227
|
-
}
|
|
8228
|
-
if (!option2) return [path, loose(raws.at(-1))];
|
|
8229
|
-
if (option2.fields || option2.record) {
|
|
8230
|
-
throw new UsageError(`--${flag2} needs a field, as --${flag2}.<name>`);
|
|
8231
|
-
}
|
|
8232
|
-
const inputs = option2.type === "json" ? await Promise.all(raws.map((raw) => readInput(raw, io))) : raws;
|
|
8233
|
-
return [path, value({ ...option2, flag: flag2 }, inputs)];
|
|
8234
|
-
}
|
|
8235
|
-
async function buildRequest(command, input, context = {}) {
|
|
8236
|
-
const io = context.io ?? nodeReader;
|
|
8237
|
-
const parsed = await resolveInputs(command, input, io);
|
|
8238
|
-
if (parsed.positionals.length !== command.args.length) {
|
|
8239
|
-
const expected = command.args.map((a) => `<${a.flag}>`).join(" ") || "no arguments";
|
|
8240
|
-
throw new UsageError(
|
|
8241
|
-
`expected ${expected}, got ${parsed.positionals.length} argument(s)`
|
|
8242
|
-
);
|
|
8243
|
-
}
|
|
8244
|
-
let path = command.path;
|
|
8245
|
-
command.args.forEach((arg, i) => {
|
|
8246
|
-
path = path.replace(
|
|
8247
|
-
`{${arg.name}}`,
|
|
8248
|
-
encodeURIComponent(parsed.positionals[i])
|
|
8249
|
-
);
|
|
8250
|
-
});
|
|
8251
|
-
const flags = new Map(parsed.flags);
|
|
8252
|
-
const query = new URLSearchParams();
|
|
8253
|
-
for (const option2 of command.query) {
|
|
8254
|
-
const raws = flags.get(option2.flag);
|
|
8255
|
-
flags.delete(option2.flag);
|
|
8256
|
-
if (!raws) {
|
|
8257
|
-
if (option2.required) throw new UsageError(`--${option2.flag} is required`);
|
|
8258
|
-
continue;
|
|
8259
|
-
}
|
|
8260
|
-
const parsedValue = value(option2, raws);
|
|
8261
|
-
const values = Array.isArray(parsedValue) ? parsedValue : [parsedValue];
|
|
8262
|
-
if (option2.explode === false)
|
|
8263
|
-
query.append(option2.name, values.map(String).join(","));
|
|
8264
|
-
else for (const v of values) query.append(option2.name, String(v));
|
|
8265
|
-
}
|
|
8266
|
-
const built = { method: command.method, path, query };
|
|
8267
|
-
const body = command.body;
|
|
8268
|
-
if (!body) {
|
|
8269
|
-
if (parsed.body) throw new UsageError(`${command.command} takes no body`);
|
|
8270
|
-
rejectUnknown(flags);
|
|
8271
|
-
return built;
|
|
8272
|
-
}
|
|
8273
|
-
if (body.contentType === "multipart/form-data") {
|
|
8274
|
-
if (parsed.body) {
|
|
8275
|
-
throw new UsageError(
|
|
8276
|
-
`${command.command} uploads files; use the file flags, not --body`
|
|
8277
|
-
);
|
|
8278
|
-
}
|
|
8279
|
-
const form = new FormData();
|
|
8280
|
-
for (const file of body.files) {
|
|
8281
|
-
const paths = flags.get(file) ?? [];
|
|
8282
|
-
if (body.required && paths.length === 0) {
|
|
8283
|
-
throw new UsageError(`--${file} is required`);
|
|
8284
|
-
}
|
|
8285
|
-
for (const filePath of paths) {
|
|
8286
|
-
form.append(
|
|
8287
|
-
file,
|
|
8288
|
-
new Blob([await io.bytes(filePath)]),
|
|
8289
|
-
basename(filePath)
|
|
8290
|
-
);
|
|
8291
|
-
}
|
|
8292
|
-
flags.delete(file);
|
|
8293
|
-
}
|
|
8294
|
-
for (const field of body.fields) {
|
|
8295
|
-
const raws = flags.get(field.flag);
|
|
8296
|
-
flags.delete(field.flag);
|
|
8297
|
-
if (raws) for (const raw of raws) form.append(field.name, raw);
|
|
8298
|
-
}
|
|
8299
|
-
rejectUnknown(flags);
|
|
8300
|
-
built.form = form;
|
|
8301
|
-
return built;
|
|
8302
|
-
}
|
|
8303
|
-
const base = parsed.body ? parseJson(parsed.body, "--body") : {};
|
|
8304
|
-
if (typeof base !== "object" || base === null || Array.isArray(base)) {
|
|
8305
|
-
throw new UsageError("--body must be a JSON object");
|
|
8306
|
-
}
|
|
8307
|
-
const json = base;
|
|
8308
|
-
for (const field of body.fields) {
|
|
8309
|
-
const raws = flags.get(field.flag);
|
|
8310
|
-
if (!raws) continue;
|
|
8311
|
-
flags.delete(field.flag);
|
|
8312
|
-
json[field.name] = value(field, raws);
|
|
8313
|
-
}
|
|
8314
|
-
for (const [flag2, raws] of [...flags]) {
|
|
8315
|
-
const [head, ...rest] = flag2.split(".");
|
|
8316
|
-
const field = body.fields.find((f) => f.flag === head);
|
|
8317
|
-
if (!field || rest.length === 0) continue;
|
|
8318
|
-
flags.delete(flag2);
|
|
8319
|
-
const current = json[field.name];
|
|
8320
|
-
json[field.name] = typeof current === "object" && current !== null ? current : {};
|
|
8321
|
-
const [path2, value2] = await dotted(field, rest, flag2, raws, io);
|
|
8322
|
-
setPath(json, [field.name, ...path2], value2);
|
|
8323
|
-
}
|
|
8324
|
-
rejectUnknown(flags);
|
|
8325
|
-
delete json.organizationId;
|
|
8326
|
-
if (body.credentialOrganization) {
|
|
8327
|
-
if (!context.organizationId) {
|
|
8328
|
-
throw new UsageError(
|
|
8329
|
-
"could not tell which organization this credential acts in"
|
|
8330
|
-
);
|
|
8331
|
-
}
|
|
8332
|
-
json.organizationId = context.organizationId;
|
|
8333
|
-
}
|
|
8334
|
-
for (const field of body.fields) {
|
|
8335
|
-
if (field.required && json[field.name] === void 0) {
|
|
8336
|
-
throw new UsageError(`--${field.flag} is required`);
|
|
8337
|
-
}
|
|
8338
|
-
}
|
|
8339
|
-
if (body.required || Object.keys(json).length > 0) built.json = json;
|
|
8340
|
-
return built;
|
|
8341
|
-
}
|
|
8342
|
-
function rejectUnknown(flags) {
|
|
8343
|
-
const unknown = [...flags.keys()];
|
|
8344
|
-
if (unknown.length > 0) {
|
|
8345
|
-
throw new UsageError(
|
|
8346
|
-
`unknown flag${unknown.length > 1 ? "s" : ""}: ${unknown.map((f) => `--${f}`).join(", ")}`
|
|
8347
|
-
);
|
|
8253
|
+
return `draft_${short}_from_draft_${parentId.slice(0, 8)}`;
|
|
8348
8254
|
}
|
|
8349
|
-
}
|
|
8350
|
-
|
|
8351
|
-
// ../workflow-files/src/representation/name-charset.ts
|
|
8352
|
-
var NAME_CHARSET_RE = /^[A-Za-z0-9 !#$%&'()+,.;=@^`{}[\]~-]+$/;
|
|
8353
|
-
var WINDOWS_RESERVED = /* @__PURE__ */ new Set([
|
|
8354
|
-
"con",
|
|
8355
|
-
"prn",
|
|
8356
|
-
"aux",
|
|
8357
|
-
"nul",
|
|
8358
|
-
...Array.from({ length: 9 }, (_, i) => `com${i + 1}`),
|
|
8359
|
-
...Array.from({ length: 9 }, (_, i) => `lpt${i + 1}`)
|
|
8360
|
-
]);
|
|
8361
|
-
function isNameCharsetConforming(name) {
|
|
8362
|
-
return NAME_CHARSET_RE.test(name);
|
|
8363
|
-
}
|
|
8364
|
-
|
|
8365
|
-
// ../workflow-files/src/representation/types.ts
|
|
8366
|
-
function normalizeNodeName(name) {
|
|
8367
|
-
let result = name.toLowerCase();
|
|
8368
|
-
result = result.replace(/[^a-z0-9]+/g, "_");
|
|
8369
|
-
result = result.replace(/^_+|_+$/g, "");
|
|
8370
|
-
if (result.length > 80) {
|
|
8371
|
-
result = result.slice(0, 80).replace(/_+$/, "");
|
|
8372
|
-
}
|
|
8373
|
-
if (result === "") {
|
|
8374
|
-
throw new Error(
|
|
8375
|
-
`representation: node name "${name}" produces an empty directory name after normalization`
|
|
8376
|
-
);
|
|
8377
|
-
}
|
|
8378
|
-
return result;
|
|
8379
|
-
}
|
|
8380
|
-
function lossySlugOr(name, fallback) {
|
|
8381
|
-
try {
|
|
8382
|
-
return normalizeNodeName(name);
|
|
8383
|
-
} catch {
|
|
8384
|
-
return fallback;
|
|
8385
|
-
}
|
|
8386
|
-
}
|
|
8387
|
-
function nodeDirName(name) {
|
|
8388
|
-
if (isNameCharsetConforming(name)) {
|
|
8389
|
-
return name.replaceAll(" ", "_");
|
|
8390
|
-
}
|
|
8391
|
-
return normalizeNodeName(name);
|
|
8392
|
-
}
|
|
8393
|
-
function agentDirName(name) {
|
|
8394
|
-
try {
|
|
8395
|
-
return nodeDirName(name);
|
|
8396
|
-
} catch {
|
|
8397
|
-
return "agent";
|
|
8398
|
-
}
|
|
8399
|
-
}
|
|
8400
|
-
function executionDirName(executionId2) {
|
|
8401
|
-
return executionId2.slice(0, 8);
|
|
8402
|
-
}
|
|
8403
|
-
function workflowDirName(workflowId, version, parentId, parentVersion) {
|
|
8404
|
-
const short = workflowId.slice(0, 8);
|
|
8405
|
-
if (version !== void 0 && version !== null) {
|
|
8406
|
-
return `v${version}_${short}`;
|
|
8407
|
-
}
|
|
8408
|
-
if (parentId) {
|
|
8409
|
-
if (parentVersion !== void 0 && parentVersion !== null) {
|
|
8410
|
-
return `draft_${short}_from_v${parentVersion}`;
|
|
8411
|
-
}
|
|
8412
|
-
return `draft_${short}_from_draft_${parentId.slice(0, 8)}`;
|
|
8413
|
-
}
|
|
8414
|
-
return `draft_${short}`;
|
|
8255
|
+
return `draft_${short}`;
|
|
8415
8256
|
}
|
|
8416
8257
|
|
|
8417
8258
|
// src/sync/paths.ts
|
|
@@ -8560,7 +8401,7 @@ function matchesLocal(skillDir, path, digest) {
|
|
|
8560
8401
|
if (!existsSync2(file)) return false;
|
|
8561
8402
|
if (throughSymlink(skillDir, path) || !lstatSync(file).isFile())
|
|
8562
8403
|
return true;
|
|
8563
|
-
const local2 = createHash2("sha256").update(
|
|
8404
|
+
const local2 = createHash2("sha256").update(readFileSync2(file)).digest("hex");
|
|
8564
8405
|
return digest === `sha256:${local2}`;
|
|
8565
8406
|
} catch {
|
|
8566
8407
|
return false;
|
|
@@ -8739,43 +8580,17 @@ function noHosts(deps) {
|
|
|
8739
8580
|
"No skills directory found: none of ~/.claude, ~/.cursor or ~/.agents exists.\n"
|
|
8740
8581
|
);
|
|
8741
8582
|
}
|
|
8742
|
-
async function sendLearnings(deps, auth, learnings) {
|
|
8743
|
-
const command = ALL_COMMANDS.find((c) => c.tool === "skill_sync");
|
|
8744
|
-
if (!command) throw new Error("skill_sync is missing from the command table");
|
|
8745
|
-
const request = await buildRequest(command, {
|
|
8746
|
-
positionals: [],
|
|
8747
|
-
flags: /* @__PURE__ */ new Map([["learning", learnings]]),
|
|
8748
|
-
json: false
|
|
8749
|
-
});
|
|
8750
|
-
await send(deps.env.apiUrl, auth, request, false, deps.fetch);
|
|
8751
|
-
const noun = learnings.length === 1 ? "learning" : "learnings";
|
|
8752
|
-
deps.stderr(`Sent ${learnings.length} ${noun}.
|
|
8753
|
-
`);
|
|
8754
|
-
}
|
|
8755
8583
|
async function syncSkills(deps, flagOrg, options) {
|
|
8756
8584
|
const auth = await authFor(deps, flagOrg);
|
|
8757
|
-
const sent = options.learnings.length > 0;
|
|
8758
|
-
if (sent) await sendLearnings(deps, auth, options.learnings);
|
|
8759
8585
|
const hosts = detectHosts(deps.env.home);
|
|
8760
8586
|
if (hosts.length === 0) {
|
|
8761
8587
|
noHosts(deps);
|
|
8762
|
-
return
|
|
8588
|
+
return 1;
|
|
8763
8589
|
}
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
remove: options.remove && !sent
|
|
8767
|
-
});
|
|
8768
|
-
deps.stderr(`${formatInstall(result)}
|
|
8590
|
+
const result = await installSkills(deps, auth, hosts, options);
|
|
8591
|
+
deps.stderr(`${formatInstall(result)}
|
|
8769
8592
|
`);
|
|
8770
|
-
|
|
8771
|
-
} catch (error) {
|
|
8772
|
-
if (!sent) throw error;
|
|
8773
|
-
deps.stderr(
|
|
8774
|
-
`The skills did not update: ${clean(error.message)}. ${SYNC_HINT} to retry.
|
|
8775
|
-
`
|
|
8776
|
-
);
|
|
8777
|
-
return 0;
|
|
8778
|
-
}
|
|
8593
|
+
return 0;
|
|
8779
8594
|
}
|
|
8780
8595
|
async function offerSkills(deps) {
|
|
8781
8596
|
const hosts = detectHosts(deps.env.home);
|
|
@@ -9226,6 +9041,239 @@ async function whoami(deps, flagOrg, json) {
|
|
|
9226
9041
|
return 0;
|
|
9227
9042
|
}
|
|
9228
9043
|
|
|
9044
|
+
// src/request.ts
|
|
9045
|
+
import { readFileSync as readFileSync3 } from "node:fs";
|
|
9046
|
+
import { basename } from "node:path";
|
|
9047
|
+
function camel(segment) {
|
|
9048
|
+
return segment.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
|
|
9049
|
+
}
|
|
9050
|
+
function scalar(option2, raw) {
|
|
9051
|
+
const type = option2.type.replace("[]", "");
|
|
9052
|
+
if (option2.enum && !option2.enum.includes(raw)) {
|
|
9053
|
+
throw new UsageError(
|
|
9054
|
+
`--${option2.flag} must be one of ${option2.enum.join(", ")}`
|
|
9055
|
+
);
|
|
9056
|
+
}
|
|
9057
|
+
if (type === "integer" || type === "number") {
|
|
9058
|
+
const value2 = Number(raw);
|
|
9059
|
+
if (raw.trim() === "" || Number.isNaN(value2) || type === "integer" && !Number.isInteger(value2)) {
|
|
9060
|
+
throw new UsageError(
|
|
9061
|
+
`--${option2.flag} must be ${type === "integer" ? "an integer" : "a number"}`
|
|
9062
|
+
);
|
|
9063
|
+
}
|
|
9064
|
+
return value2;
|
|
9065
|
+
}
|
|
9066
|
+
if (type === "boolean") {
|
|
9067
|
+
if (raw !== "true" && raw !== "false") {
|
|
9068
|
+
throw new UsageError(`--${option2.flag} must be true or false`);
|
|
9069
|
+
}
|
|
9070
|
+
return raw === "true";
|
|
9071
|
+
}
|
|
9072
|
+
if (type === "json") return parseJson(raw, `--${option2.flag}`);
|
|
9073
|
+
return raw;
|
|
9074
|
+
}
|
|
9075
|
+
function value(option2, raws) {
|
|
9076
|
+
if (option2.type.endsWith("[]")) return raws.map((raw) => scalar(option2, raw));
|
|
9077
|
+
return scalar(option2, raws.at(-1));
|
|
9078
|
+
}
|
|
9079
|
+
var nodeReader = {
|
|
9080
|
+
text: async (path) => readFileSync3(path, "utf8"),
|
|
9081
|
+
bytes: async (path) => new Uint8Array(readFileSync3(path))
|
|
9082
|
+
};
|
|
9083
|
+
async function readInput(raw, io) {
|
|
9084
|
+
if (raw === "-") return io.text(0);
|
|
9085
|
+
if (raw.startsWith("@")) return io.text(raw.slice(1));
|
|
9086
|
+
return raw;
|
|
9087
|
+
}
|
|
9088
|
+
async function resolveInputs(command, parsed, io) {
|
|
9089
|
+
const jsonFlags = [...command.query, ...command.body?.fields ?? []].filter((option2) => option2.type === "json" || option2.type === "json[]").map((option2) => option2.flag);
|
|
9090
|
+
const flags = new Map(parsed.flags);
|
|
9091
|
+
for (const flag2 of jsonFlags) {
|
|
9092
|
+
const raws = flags.get(flag2);
|
|
9093
|
+
if (raws)
|
|
9094
|
+
flags.set(flag2, await Promise.all(raws.map((raw) => readInput(raw, io))));
|
|
9095
|
+
}
|
|
9096
|
+
const body = parsed.body === void 0 ? void 0 : await readInput(parsed.body, io);
|
|
9097
|
+
return { ...parsed, flags, body };
|
|
9098
|
+
}
|
|
9099
|
+
function parseJson(raw, label) {
|
|
9100
|
+
try {
|
|
9101
|
+
return JSON.parse(raw);
|
|
9102
|
+
} catch {
|
|
9103
|
+
throw new UsageError(`${label} is not valid JSON`);
|
|
9104
|
+
}
|
|
9105
|
+
}
|
|
9106
|
+
function loose(raw) {
|
|
9107
|
+
if (/^(true|false|null)$/.test(raw) || /^[[{]/.test(raw.trim())) {
|
|
9108
|
+
try {
|
|
9109
|
+
return JSON.parse(raw);
|
|
9110
|
+
} catch {
|
|
9111
|
+
return raw;
|
|
9112
|
+
}
|
|
9113
|
+
}
|
|
9114
|
+
return raw;
|
|
9115
|
+
}
|
|
9116
|
+
function setPath(target, path, value2) {
|
|
9117
|
+
let node = target;
|
|
9118
|
+
for (const key of path.slice(0, -1)) {
|
|
9119
|
+
const next = node[key];
|
|
9120
|
+
if (typeof next !== "object" || next === null || Array.isArray(next))
|
|
9121
|
+
node[key] = {};
|
|
9122
|
+
node = node[key];
|
|
9123
|
+
}
|
|
9124
|
+
node[path.at(-1)] = value2;
|
|
9125
|
+
}
|
|
9126
|
+
async function dotted(field, segments, flag2, raws, io) {
|
|
9127
|
+
const path = [];
|
|
9128
|
+
let option2 = field;
|
|
9129
|
+
for (const [i, segment] of segments.entries()) {
|
|
9130
|
+
if (option2?.record) {
|
|
9131
|
+
const key = segments.slice(i).join(".");
|
|
9132
|
+
const entry = { ...option2, flag: flag2, type: option2.record };
|
|
9133
|
+
delete entry.enum;
|
|
9134
|
+
return [
|
|
9135
|
+
[...path, key],
|
|
9136
|
+
entry.type === "json" ? loose(raws.at(-1)) : value(entry, raws)
|
|
9137
|
+
];
|
|
9138
|
+
}
|
|
9139
|
+
if (option2?.fields) {
|
|
9140
|
+
const child = option2.fields.find(
|
|
9141
|
+
(f) => f.flag === segment
|
|
9142
|
+
);
|
|
9143
|
+
if (!child) throw new UsageError(`unknown flag: --${flag2}`);
|
|
9144
|
+
path.push(child.name);
|
|
9145
|
+
option2 = child;
|
|
9146
|
+
continue;
|
|
9147
|
+
}
|
|
9148
|
+
if (option2 && option2.type !== "json") {
|
|
9149
|
+
throw new UsageError(`unknown flag: --${flag2}`);
|
|
9150
|
+
}
|
|
9151
|
+
path.push(camel(segment));
|
|
9152
|
+
option2 = void 0;
|
|
9153
|
+
}
|
|
9154
|
+
if (!option2) return [path, loose(raws.at(-1))];
|
|
9155
|
+
if (option2.fields || option2.record) {
|
|
9156
|
+
throw new UsageError(`--${flag2} needs a field, as --${flag2}.<name>`);
|
|
9157
|
+
}
|
|
9158
|
+
const inputs = option2.type === "json" ? await Promise.all(raws.map((raw) => readInput(raw, io))) : raws;
|
|
9159
|
+
return [path, value({ ...option2, flag: flag2 }, inputs)];
|
|
9160
|
+
}
|
|
9161
|
+
async function buildRequest(command, input, context = {}) {
|
|
9162
|
+
const io = context.io ?? nodeReader;
|
|
9163
|
+
const parsed = await resolveInputs(command, input, io);
|
|
9164
|
+
if (parsed.positionals.length !== command.args.length) {
|
|
9165
|
+
const expected = command.args.map((a) => `<${a.flag}>`).join(" ") || "no arguments";
|
|
9166
|
+
throw new UsageError(
|
|
9167
|
+
`expected ${expected}, got ${parsed.positionals.length} argument(s)`
|
|
9168
|
+
);
|
|
9169
|
+
}
|
|
9170
|
+
let path = command.path;
|
|
9171
|
+
command.args.forEach((arg, i) => {
|
|
9172
|
+
path = path.replace(
|
|
9173
|
+
`{${arg.name}}`,
|
|
9174
|
+
encodeURIComponent(parsed.positionals[i])
|
|
9175
|
+
);
|
|
9176
|
+
});
|
|
9177
|
+
const flags = new Map(parsed.flags);
|
|
9178
|
+
const query = new URLSearchParams();
|
|
9179
|
+
for (const option2 of command.query) {
|
|
9180
|
+
const raws = flags.get(option2.flag);
|
|
9181
|
+
flags.delete(option2.flag);
|
|
9182
|
+
if (!raws) {
|
|
9183
|
+
if (option2.required) throw new UsageError(`--${option2.flag} is required`);
|
|
9184
|
+
continue;
|
|
9185
|
+
}
|
|
9186
|
+
const parsedValue = value(option2, raws);
|
|
9187
|
+
const values = Array.isArray(parsedValue) ? parsedValue : [parsedValue];
|
|
9188
|
+
if (option2.explode === false)
|
|
9189
|
+
query.append(option2.name, values.map(String).join(","));
|
|
9190
|
+
else for (const v of values) query.append(option2.name, String(v));
|
|
9191
|
+
}
|
|
9192
|
+
const built = { method: command.method, path, query };
|
|
9193
|
+
const body = command.body;
|
|
9194
|
+
if (!body) {
|
|
9195
|
+
if (parsed.body) throw new UsageError(`${command.command} takes no body`);
|
|
9196
|
+
rejectUnknown(flags);
|
|
9197
|
+
return built;
|
|
9198
|
+
}
|
|
9199
|
+
if (body.contentType === "multipart/form-data") {
|
|
9200
|
+
if (parsed.body) {
|
|
9201
|
+
throw new UsageError(
|
|
9202
|
+
`${command.command} uploads files; use the file flags, not --body`
|
|
9203
|
+
);
|
|
9204
|
+
}
|
|
9205
|
+
const form = new FormData();
|
|
9206
|
+
for (const file of body.files) {
|
|
9207
|
+
const paths = flags.get(file) ?? [];
|
|
9208
|
+
if (body.required && paths.length === 0) {
|
|
9209
|
+
throw new UsageError(`--${file} is required`);
|
|
9210
|
+
}
|
|
9211
|
+
for (const filePath of paths) {
|
|
9212
|
+
form.append(
|
|
9213
|
+
file,
|
|
9214
|
+
new Blob([await io.bytes(filePath)]),
|
|
9215
|
+
basename(filePath)
|
|
9216
|
+
);
|
|
9217
|
+
}
|
|
9218
|
+
flags.delete(file);
|
|
9219
|
+
}
|
|
9220
|
+
for (const field of body.fields) {
|
|
9221
|
+
const raws = flags.get(field.flag);
|
|
9222
|
+
flags.delete(field.flag);
|
|
9223
|
+
if (raws) for (const raw of raws) form.append(field.name, raw);
|
|
9224
|
+
}
|
|
9225
|
+
rejectUnknown(flags);
|
|
9226
|
+
built.form = form;
|
|
9227
|
+
return built;
|
|
9228
|
+
}
|
|
9229
|
+
const base = parsed.body ? parseJson(parsed.body, "--body") : {};
|
|
9230
|
+
if (typeof base !== "object" || base === null || Array.isArray(base)) {
|
|
9231
|
+
throw new UsageError("--body must be a JSON object");
|
|
9232
|
+
}
|
|
9233
|
+
const json = base;
|
|
9234
|
+
for (const field of body.fields) {
|
|
9235
|
+
const raws = flags.get(field.flag);
|
|
9236
|
+
if (!raws) continue;
|
|
9237
|
+
flags.delete(field.flag);
|
|
9238
|
+
json[field.name] = value(field, raws);
|
|
9239
|
+
}
|
|
9240
|
+
for (const [flag2, raws] of [...flags]) {
|
|
9241
|
+
const [head, ...rest] = flag2.split(".");
|
|
9242
|
+
const field = body.fields.find((f) => f.flag === head);
|
|
9243
|
+
if (!field || rest.length === 0) continue;
|
|
9244
|
+
flags.delete(flag2);
|
|
9245
|
+
const current = json[field.name];
|
|
9246
|
+
json[field.name] = typeof current === "object" && current !== null ? current : {};
|
|
9247
|
+
const [path2, value2] = await dotted(field, rest, flag2, raws, io);
|
|
9248
|
+
setPath(json, [field.name, ...path2], value2);
|
|
9249
|
+
}
|
|
9250
|
+
rejectUnknown(flags);
|
|
9251
|
+
delete json.organizationId;
|
|
9252
|
+
if (body.credentialOrganization) {
|
|
9253
|
+
if (!context.organizationId) {
|
|
9254
|
+
throw new UsageError(
|
|
9255
|
+
"could not tell which organization this credential acts in"
|
|
9256
|
+
);
|
|
9257
|
+
}
|
|
9258
|
+
json.organizationId = context.organizationId;
|
|
9259
|
+
}
|
|
9260
|
+
for (const field of body.fields) {
|
|
9261
|
+
if (field.required && json[field.name] === void 0) {
|
|
9262
|
+
throw new UsageError(`--${field.flag} is required`);
|
|
9263
|
+
}
|
|
9264
|
+
}
|
|
9265
|
+
if (body.required || Object.keys(json).length > 0) built.json = json;
|
|
9266
|
+
return built;
|
|
9267
|
+
}
|
|
9268
|
+
function rejectUnknown(flags) {
|
|
9269
|
+
const unknown = [...flags.keys()];
|
|
9270
|
+
if (unknown.length > 0) {
|
|
9271
|
+
throw new UsageError(
|
|
9272
|
+
`unknown flag${unknown.length > 1 ? "s" : ""}: ${unknown.map((f) => `--${f}`).join(", ")}`
|
|
9273
|
+
);
|
|
9274
|
+
}
|
|
9275
|
+
}
|
|
9276
|
+
|
|
9229
9277
|
// src/sync/activities.ts
|
|
9230
9278
|
function indentJson(data) {
|
|
9231
9279
|
return JSON.stringify(data, null, 2).split("\n").map((line2) => ` ${line2}`).join("\n");
|
|
@@ -10222,11 +10270,9 @@ async function runBuiltin(name, parsed, deps) {
|
|
|
10222
10270
|
exit: parsed.flags.has("exit")
|
|
10223
10271
|
});
|
|
10224
10272
|
case "skill sync":
|
|
10225
|
-
if (parsed.body)
|
|
10226
|
-
throw new UsageError("skill sync takes --learning, not --body");
|
|
10273
|
+
if (parsed.body) throw new UsageError("skill sync takes no --body");
|
|
10227
10274
|
return syncSkills(deps, parsed.org, {
|
|
10228
|
-
remove: parsed.flags.get("remove")?.[0] !== "false"
|
|
10229
|
-
learnings: parsed.flags.get("learning") ?? []
|
|
10275
|
+
remove: parsed.flags.get("remove")?.[0] !== "false"
|
|
10230
10276
|
});
|
|
10231
10277
|
default:
|
|
10232
10278
|
return whoami(deps, parsed.org, parsed.json);
|
package/dist/core.js
CHANGED
|
@@ -3431,19 +3431,73 @@ var COMMANDS = [
|
|
|
3431
3431
|
required: false,
|
|
3432
3432
|
description: "Profile group to select a profile from for each execution. Mutually exclusive with profileId."
|
|
3433
3433
|
},
|
|
3434
|
+
{
|
|
3435
|
+
name: "timing",
|
|
3436
|
+
flag: "timing",
|
|
3437
|
+
type: "json",
|
|
3438
|
+
required: false,
|
|
3439
|
+
description: "When the schedule fires. Send this or cronExpression, not both. A schedule needs a rule that recurs: at, every or cron.",
|
|
3440
|
+
fields: [
|
|
3441
|
+
{
|
|
3442
|
+
name: "timezone",
|
|
3443
|
+
flag: "timezone",
|
|
3444
|
+
type: "string",
|
|
3445
|
+
required: false,
|
|
3446
|
+
description: "IANA time zone every part is read in, such as America/New_York"
|
|
3447
|
+
},
|
|
3448
|
+
{
|
|
3449
|
+
name: "at",
|
|
3450
|
+
flag: "at",
|
|
3451
|
+
type: "json",
|
|
3452
|
+
required: false
|
|
3453
|
+
},
|
|
3454
|
+
{
|
|
3455
|
+
name: "every",
|
|
3456
|
+
flag: "every",
|
|
3457
|
+
type: "json",
|
|
3458
|
+
required: false
|
|
3459
|
+
},
|
|
3460
|
+
{
|
|
3461
|
+
name: "once",
|
|
3462
|
+
flag: "once",
|
|
3463
|
+
type: "json",
|
|
3464
|
+
required: false
|
|
3465
|
+
},
|
|
3466
|
+
{
|
|
3467
|
+
name: "cron",
|
|
3468
|
+
flag: "cron",
|
|
3469
|
+
type: "json",
|
|
3470
|
+
required: false
|
|
3471
|
+
},
|
|
3472
|
+
{
|
|
3473
|
+
name: "startAt",
|
|
3474
|
+
flag: "start-at",
|
|
3475
|
+
type: "string",
|
|
3476
|
+
required: false,
|
|
3477
|
+
description: "No fire before this instant. Inclusive."
|
|
3478
|
+
},
|
|
3479
|
+
{
|
|
3480
|
+
name: "endAt",
|
|
3481
|
+
flag: "end-at",
|
|
3482
|
+
type: "string",
|
|
3483
|
+
required: false,
|
|
3484
|
+
description: "No fire at or after this instant."
|
|
3485
|
+
}
|
|
3486
|
+
]
|
|
3487
|
+
},
|
|
3434
3488
|
{
|
|
3435
3489
|
name: "cronExpression",
|
|
3436
3490
|
flag: "cron-expression",
|
|
3437
3491
|
type: "string",
|
|
3438
|
-
required:
|
|
3439
|
-
description: "Five-field cron expression."
|
|
3492
|
+
required: false,
|
|
3493
|
+
description: "Five-field cron expression. Prefer timing."
|
|
3440
3494
|
},
|
|
3441
3495
|
{
|
|
3442
3496
|
name: "timezone",
|
|
3443
3497
|
flag: "timezone",
|
|
3444
3498
|
type: "string",
|
|
3445
3499
|
required: false,
|
|
3446
|
-
description: "IANA time zone the cron expression is evaluated in. Defaults to UTC."
|
|
3500
|
+
description: "IANA time zone the cron expression is evaluated in. Defaults to UTC. Ignored when timing is sent."
|
|
3447
3501
|
},
|
|
3448
3502
|
{
|
|
3449
3503
|
name: "enabled",
|
|
@@ -3674,19 +3728,73 @@ var COMMANDS = [
|
|
|
3674
3728
|
required: false,
|
|
3675
3729
|
description: "Profile group to select a profile from for each execution. Mutually exclusive with profileId."
|
|
3676
3730
|
},
|
|
3731
|
+
{
|
|
3732
|
+
name: "timing",
|
|
3733
|
+
flag: "timing",
|
|
3734
|
+
type: "json",
|
|
3735
|
+
required: false,
|
|
3736
|
+
description: "Replaces when the schedule fires. Send this or cronExpression, not both. To remove a start or end, send the timing without it.",
|
|
3737
|
+
fields: [
|
|
3738
|
+
{
|
|
3739
|
+
name: "timezone",
|
|
3740
|
+
flag: "timezone",
|
|
3741
|
+
type: "string",
|
|
3742
|
+
required: false,
|
|
3743
|
+
description: "IANA time zone every part is read in, such as America/New_York"
|
|
3744
|
+
},
|
|
3745
|
+
{
|
|
3746
|
+
name: "at",
|
|
3747
|
+
flag: "at",
|
|
3748
|
+
type: "json",
|
|
3749
|
+
required: false
|
|
3750
|
+
},
|
|
3751
|
+
{
|
|
3752
|
+
name: "every",
|
|
3753
|
+
flag: "every",
|
|
3754
|
+
type: "json",
|
|
3755
|
+
required: false
|
|
3756
|
+
},
|
|
3757
|
+
{
|
|
3758
|
+
name: "once",
|
|
3759
|
+
flag: "once",
|
|
3760
|
+
type: "json",
|
|
3761
|
+
required: false
|
|
3762
|
+
},
|
|
3763
|
+
{
|
|
3764
|
+
name: "cron",
|
|
3765
|
+
flag: "cron",
|
|
3766
|
+
type: "json",
|
|
3767
|
+
required: false
|
|
3768
|
+
},
|
|
3769
|
+
{
|
|
3770
|
+
name: "startAt",
|
|
3771
|
+
flag: "start-at",
|
|
3772
|
+
type: "string",
|
|
3773
|
+
required: false,
|
|
3774
|
+
description: "No fire before this instant. Inclusive."
|
|
3775
|
+
},
|
|
3776
|
+
{
|
|
3777
|
+
name: "endAt",
|
|
3778
|
+
flag: "end-at",
|
|
3779
|
+
type: "string",
|
|
3780
|
+
required: false,
|
|
3781
|
+
description: "No fire at or after this instant."
|
|
3782
|
+
}
|
|
3783
|
+
]
|
|
3784
|
+
},
|
|
3677
3785
|
{
|
|
3678
3786
|
name: "cronExpression",
|
|
3679
3787
|
flag: "cron-expression",
|
|
3680
3788
|
type: "string",
|
|
3681
3789
|
required: false,
|
|
3682
|
-
description: "Five-field cron expression."
|
|
3790
|
+
description: "Five-field cron expression. Replaces the timing with a cron timing. Prefer timing."
|
|
3683
3791
|
},
|
|
3684
3792
|
{
|
|
3685
3793
|
name: "timezone",
|
|
3686
3794
|
flag: "timezone",
|
|
3687
3795
|
type: "string",
|
|
3688
3796
|
required: false,
|
|
3689
|
-
description: "IANA time zone the
|
|
3797
|
+
description: "IANA time zone the timing is read in. Ignored when timing is sent."
|
|
3690
3798
|
},
|
|
3691
3799
|
{
|
|
3692
3800
|
name: "enabled",
|
|
@@ -4648,7 +4756,7 @@ var COMMANDS = [
|
|
|
4648
4756
|
command: "skill sync",
|
|
4649
4757
|
tool: "skill_sync",
|
|
4650
4758
|
title: "Sync skills",
|
|
4651
|
-
description: "Get the latest Asteroid skills for the portals your organization has added: how to build Asteroid workflows on each portal.
|
|
4759
|
+
description: "Get the latest Asteroid skills for the portals your organization has added: how to build Asteroid workflows on each portal.",
|
|
4652
4760
|
method: "POST",
|
|
4653
4761
|
path: "/astro/v2/skills",
|
|
4654
4762
|
args: [],
|
|
@@ -4664,22 +4772,7 @@ var COMMANDS = [
|
|
|
4664
4772
|
],
|
|
4665
4773
|
binary: false,
|
|
4666
4774
|
readOnly: false,
|
|
4667
|
-
destructive: false
|
|
4668
|
-
body: {
|
|
4669
|
-
required: false,
|
|
4670
|
-
contentType: "application/json",
|
|
4671
|
-
fields: [
|
|
4672
|
-
{
|
|
4673
|
-
name: "learnings",
|
|
4674
|
-
flag: "learnings",
|
|
4675
|
-
type: "json",
|
|
4676
|
-
required: false,
|
|
4677
|
-
description: "Up to 10 things you found out about portals. Leave it out to sync only."
|
|
4678
|
-
}
|
|
4679
|
-
],
|
|
4680
|
-
files: [],
|
|
4681
|
-
credentialOrganization: false
|
|
4682
|
-
}
|
|
4775
|
+
destructive: false
|
|
4683
4776
|
},
|
|
4684
4777
|
{
|
|
4685
4778
|
command: "tag create",
|
|
@@ -7023,18 +7116,12 @@ var BUILTINS = [
|
|
|
7023
7116
|
},
|
|
7024
7117
|
{
|
|
7025
7118
|
command: "skill sync",
|
|
7026
|
-
usage: "asteroid skill sync
|
|
7027
|
-
description: "Install the Asteroid skills, or bring them up to date, in every skills directory found: `~/.claude/skills`, `~/.cursor/skills` and `~/.agents/skills`. Writes the files that changed, removes the skills the API no longer serves, and leaves a skill directory it did not create alone. Do not edit an installed skill, because the next sync overwrites it. If a skill is missing something about how a portal works,
|
|
7119
|
+
usage: "asteroid skill sync",
|
|
7120
|
+
description: "Install the Asteroid skills, or bring them up to date, in every skills directory found: `~/.claude/skills`, `~/.cursor/skills` and `~/.agents/skills`. Writes the files that changed, removes the skills the API no longer serves, and leaves a skill directory it did not create alone. Do not edit an installed skill, because the next sync overwrites it. If a skill is missing something about how a portal works, save it with `asteroid memory create`.",
|
|
7028
7121
|
args: 0,
|
|
7029
7122
|
options: [
|
|
7030
7123
|
["--no-remove", "Keep the skills and files the API no longer serves."]
|
|
7031
7124
|
],
|
|
7032
|
-
repeatableOptions: [
|
|
7033
|
-
[
|
|
7034
|
-
"--learning <json>",
|
|
7035
|
-
'Optional. Something the portal\'s skill is missing about how the portal works, as JSON: `{"portal":"<name>","content":"<text>"}`. Add `portalId` if you have one. Repeat for more. Send this instead of editing the skill, because the next sync overwrites local edits. Send general knowledge of the portal only.'
|
|
7036
|
-
]
|
|
7037
|
-
],
|
|
7038
7125
|
section: "Skills"
|
|
7039
7126
|
}
|
|
7040
7127
|
];
|
|
@@ -7189,8 +7276,6 @@ function defineCommands(root, options, dotted2 = /* @__PURE__ */ new Map(), onIn
|
|
|
7189
7276
|
const leaf = parent.command(words.at(-1)).description(builtin.description);
|
|
7190
7277
|
if (builtin.arg) leaf.argument(`[${builtin.arg}]`);
|
|
7191
7278
|
for (const [flags, text2] of builtin.options ?? []) leaf.option(flags, text2);
|
|
7192
|
-
for (const [flags, text2] of builtin.repeatableOptions ?? [])
|
|
7193
|
-
leaf.option(flags, text2, collect);
|
|
7194
7279
|
for (const [flags, text2] of builtin.hiddenOptions ?? [])
|
|
7195
7280
|
leaf.addOption(new Flag(flags, text2).hideHelp());
|
|
7196
7281
|
leaf.action((...args) => {
|
|
@@ -7709,18 +7794,7 @@ function withSyncCommands(commands) {
|
|
|
7709
7794
|
(a, b) => a.command.localeCompare(b.command)
|
|
7710
7795
|
);
|
|
7711
7796
|
}
|
|
7712
|
-
var
|
|
7713
|
-
name: "learnings",
|
|
7714
|
-
flag: "learning",
|
|
7715
|
-
type: "json[]",
|
|
7716
|
-
required: false,
|
|
7717
|
-
description: 'What you found out about a portal, as JSON: `{"portal":"<name>","content":"<text>"}`. Add `portalId` if you have one. Repeat for more.'
|
|
7718
|
-
};
|
|
7719
|
-
function withLearningFlag(command) {
|
|
7720
|
-
if (command.tool !== "skill_sync" || !command.body) return command;
|
|
7721
|
-
return { ...command, body: { ...command.body, fields: [LEARNING] } };
|
|
7722
|
-
}
|
|
7723
|
-
var ALL_COMMANDS = withSyncCommands(COMMANDS).map(withLearningFlag);
|
|
7797
|
+
var ALL_COMMANDS = withSyncCommands(COMMANDS);
|
|
7724
7798
|
|
|
7725
7799
|
// src/sync/activities.ts
|
|
7726
7800
|
function indentJson(data) {
|