@standards/cli 1.0.0-alpha.418 → 1.0.0-alpha.419

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.
Files changed (2) hide show
  1. package/dist/bin.mjs +56 -21
  2. package/package.json +4 -4
package/dist/bin.mjs CHANGED
@@ -266,6 +266,10 @@ function collectDecision(value, decisions) {
266
266
  };
267
267
  throw new ValidationError(`--decision must read <pieceId>=bind, <pieceId>=skip or <pieceId>=rename:<name> (received: ${value})`, []);
268
268
  }
269
+ /** A repeatable option's values, in the order given. */
270
+ function collectPieceId(value, pieceIds) {
271
+ return [...pieceIds, value];
272
+ }
269
273
  /** The input `preview` and `add` share: whole bundles, in one locale. */
270
274
  function addInput(names, opts) {
271
275
  return {
@@ -280,8 +284,9 @@ function withAddOptions(command) {
280
284
  }
281
285
  /**
282
286
  * The workspace's bundles: sync the ones the project declares, list what is
283
- * installed, remove one, and add a bundle the workspace may add as a copy it
284
- * owns (`preview`, then `add` with the preview's fingerprint).
287
+ * installed and where each stands, remove one, add a bundle the workspace may
288
+ * add as a copy it owns (`preview`, then `add` with the preview's fingerprint)
289
+ * and update such a copy (`update-preview`, then `update` with its fingerprint).
285
290
  */
286
291
  function registerBundlesCommand(program) {
287
292
  const bundles = program.command("bundles").description("Sync and manage the workspace's bundles");
@@ -296,6 +301,9 @@ function registerBundlesCommand(program) {
296
301
  installedAt: row.installedAt
297
302
  })), getFormat(cmd));
298
303
  }));
304
+ bundles.command("status").description("Show where each installed bundle stands and the bundles that depend on it").action((_opts, cmd) => run(async () => {
305
+ formatOutput(await getAppClientFromCommand(cmd).bundles.status({}), getFormat(cmd));
306
+ }));
299
307
  bundles.command("available").description("List the bundles the workspace may add, and whether each is installed").option("--locale <locale>", `language of the labels (${BUNDLE_LOCALES.join(", ")})`, "en").action((opts, cmd) => run(async () => {
300
308
  const { available } = await getAppClientFromCommand(cmd).bundles.list({ locale: parseLocale(opts.locale) });
301
309
  formatOutput(available, getFormat(cmd));
@@ -310,7 +318,20 @@ function registerBundlesCommand(program) {
310
318
  fingerprint: opts.fingerprint
311
319
  }), getFormat(cmd));
312
320
  }));
313
- bundles.command("remove").description("Remove a synced bundle; its pieces are demoted, never deleted").argument("<name>", "bundle name").option("--yes", "remove without confirmation").action((name, opts, cmd) => run(async () => {
321
+ bundles.command("update-preview").description("Plan an added bundle's update, piece by piece, and the plan's fingerprint").argument("<name>", "bundle name").action((name, _opts, cmd) => run(async () => {
322
+ formatOutput(await getAppClientFromCommand(cmd).bundles.updatePreview({ name }), getFormat(cmd));
323
+ }));
324
+ bundles.command("update").description("Update an added bundle as its preview showed; nothing is removed").argument("<name>", "bundle name").requiredOption("--fingerprint <fingerprint>", "the fingerprint `bundles update-preview` returned").option("--take <pieceId>", "take the new version of a piece you changed (repeatable)", collectPieceId, []).option("--skip-missing <pieceId>", "do not reinstall a missing piece (repeatable)", collectPieceId, []).option("--decision <pieceId=choice>", "how to settle a collision: bind, skip or rename:<name> (repeatable)", collectDecision, {}).action((name, opts, cmd) => run(async () => {
325
+ const { applied } = await getAppClientFromCommand(cmd).bundles.update({
326
+ name,
327
+ fingerprint: opts.fingerprint,
328
+ take: opts.take,
329
+ skipMissing: opts.skipMissing,
330
+ decisions: opts.decision
331
+ });
332
+ console.info(`${name} updated, ${applied} applied`);
333
+ }));
334
+ bundles.command("remove").description("Remove a synced bundle; its pieces are demoted, never deleted. An added bundle is refused: uninstall it from the Bundles window").argument("<name>", "bundle name").option("--yes", "remove without confirmation").action((name, opts, cmd) => run(async () => {
314
335
  requireConfirmation(opts.yes, `Removing bundle "${name}" demotes its objects to workspace-owned. Re-run with "--yes" to confirm.`);
315
336
  await getAppClientFromCommand(cmd).bundles.remove({ name });
316
337
  console.info(`${name} removed`);
@@ -349,7 +370,7 @@ function connectDisclosure(provider, capabilities = []) {
349
370
  if (modify) lines.push("- create, change and delete your events");
350
371
  lines.push("It shows them in the workspace, links them to records and makes them searchable.", "The default assistant can read this calendar, and AI providers process your events whenever an agent works on them.");
351
372
  } else return null;
352
- lines.push("Your data is not sold and not used for ads.", "Disconnect at any time in Settings > Integrations.", "Details: https://docs.standards.new/docs/integrations/connected-accounts");
373
+ lines.push("Your data is not sold and not used for ads.", "Disconnect at any time on the Connectors page.", "Details: https://docs.standards.new/docs/integrations/connected-accounts");
353
374
  return lines.join("\n");
354
375
  }
355
376
  /** Parse a comma-separated `--capabilities` flag; unknown tiers are refused before the request. */
@@ -371,16 +392,12 @@ function registerConnectorsCommand(program) {
371
392
  connectors.command("list").description("List connector connections").option("--scope <scope>", "connection scope (tenant or actor)", "tenant").action(async (opts, cmd) => {
372
393
  formatOutput(await getAppClientFromCommand(cmd).connectors.list({ scope: resolveScope(opts.scope) }), getFormat(cmd));
373
394
  });
374
- connectors.command("connect").description("Start an OAuth flow and return the authorization URL to open").requiredOption("--provider <provider>", `connector provider (${PROVIDERS.join(", ")}); run "connectors providers" for the ones this deployment configured`).option("--scope <scope>", "connection scope (tenant or actor)", "tenant").option("--capabilities <list>", `comma-separated capability tiers beyond read (${CAPABILITIES.join(", ")})`).option("--yes", "confirm the access a mailbox or calendar connection gives Standards").action(async (opts, cmd) => {
395
+ connectors.command("connect").description("Check a provider and capabilities; the account itself is connected from the app").requiredOption("--provider <provider>", `connector provider (${PROVIDERS.join(", ")}); run "connectors providers" for the ones this deployment configured`).option("--scope <scope>", "connection scope (tenant or actor)", "tenant").option("--capabilities <list>", `comma-separated capability tiers beyond read (${CAPABILITIES.join(", ")})`).option("--yes", "confirm the access a mailbox or calendar connection gives Standards").action((opts) => {
375
396
  if (!PROVIDERS.includes(opts.provider)) throw new ValidationError(`--provider must be one of: ${PROVIDERS.join(", ")}`, []);
376
397
  const capabilities = parseCapabilities(opts.capabilities);
377
398
  const disclosure = connectDisclosure(opts.provider, capabilities);
378
399
  if (disclosure && !opts.yes) throw new Error(`${disclosure}\n\nRe-run with "--yes" to continue.`);
379
- formatOutput(await getAppClientFromCommand(cmd).connectors.startAuth({
380
- provider: opts.provider,
381
- scope: resolveScope(opts.scope),
382
- ...capabilities ? { capabilities } : {}
383
- }), getFormat(cmd));
400
+ process.stdout.write(`${opts.provider} is connected from the Standards app: open Connectors in the sidebar and connect it there.\n`);
384
401
  });
385
402
  connectors.command("disconnect").description("Disconnect (delete) a connector connection").argument("<id>", "connection ID").option("--yes", "disconnect without confirmation").option("--remove-imported", "also remove what a mail or calendar connection imported (kept by default)").action(async (id, opts, cmd) => {
386
403
  if (!opts.yes) throw new Error("Disconnecting a connector is explicit. Re-run with \"--yes\" to confirm.");
@@ -1278,23 +1295,38 @@ async function runSkillsPull(client, dir, names) {
1278
1295
  }
1279
1296
  return written;
1280
1297
  }
1281
- /**
1282
- * `standards skills search`: our index, or skills.sh with `community`. Every
1283
- * row carries the same keys, because a table takes its columns from the first.
1284
- */
1285
- async function runSkillsSearch(client, query, options = {}) {
1286
- const limit = options.limit === void 0 ? DEFAULT_SEARCH_LIMIT : parseCount("--limit", options.limit);
1287
- return (await client.skillCatalog.search({
1288
- query,
1289
- scope: options.community === true ? "community" : "official",
1290
- limit
1291
- })).map(({ source, name, state, reason, description, installs }) => ({
1298
+ function searchLimit(limit) {
1299
+ return limit === void 0 ? DEFAULT_SEARCH_LIMIT : parseCount("--limit", limit);
1300
+ }
1301
+ /** Every row carries the same keys, because a table takes its columns from the first. */
1302
+ function catalogRow(result) {
1303
+ const { source, name, state, reason, description, installs } = result;
1304
+ return {
1292
1305
  source,
1293
1306
  name,
1294
1307
  state,
1295
1308
  reason,
1296
1309
  description,
1297
1310
  installs
1311
+ };
1312
+ }
1313
+ /** `standards skills search`: our index, or skills.sh with `community`. */
1314
+ async function runSkillsSearch(client, query, options = {}) {
1315
+ return (await client.skillCatalog.search({
1316
+ query,
1317
+ scope: options.community === true ? "community" : "official",
1318
+ limit: searchLimit(options.limit)
1319
+ })).map(catalogRow);
1320
+ }
1321
+ /** `standards skills top`: skills.sh's all-time leaderboard, or the last 24 hours with `trending`. */
1322
+ async function runSkillsTop(client, options = {}) {
1323
+ return (await client.skillCatalog.search({
1324
+ query: "",
1325
+ scope: options.trending === true ? "trending" : "top",
1326
+ limit: searchLimit(options.limit)
1327
+ })).map((result) => ({
1328
+ ...catalogRow(result),
1329
+ weeklyInstalls: result.weeklyInstalls
1298
1330
  }));
1299
1331
  }
1300
1332
  /** `standards skills preview`: what a source would install, the source checked here first. */
@@ -1376,6 +1408,9 @@ function registerSkillsCommand(program) {
1376
1408
  skills.command("search").description("Find skills to add: the official catalogue, or skills.sh with --community").argument("<query>", "what the skill should do").option("--community", "search skills.sh instead of the official catalogue").option("--limit <n>", "max results to return (up to 50)").action(async (query, opts, cmd) => {
1377
1409
  await printAnswer(cmd, () => runSkillsSearch(getAppClientFromCommand(cmd), query, opts));
1378
1410
  });
1411
+ skills.command("top").description("List skills.sh's most installed skills, or the last 24 hours with --trending").option("--trending", "rank by the last 24 hours instead of all time").option("--limit <n>", "max results to return (up to 50)").action(async (opts, cmd) => {
1412
+ await printAnswer(cmd, () => runSkillsTop(getAppClientFromCommand(cmd), opts));
1413
+ });
1379
1414
  skills.command("preview").description("Show what a source would install, without installing it").argument("<source>", "owner/repo@skill or owner/repo@skill#ref").action(async (source, _opts, cmd) => {
1380
1415
  await printAnswer(cmd, () => runSkillsPreview(getAppClientFromCommand(cmd), source));
1381
1416
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@standards/cli",
3
- "version": "1.0.0-alpha.418",
3
+ "version": "1.0.0-alpha.419",
4
4
  "description": "CLI tool to interact with Standards API",
5
5
  "type": "module",
6
6
  "bin": {
@@ -23,9 +23,9 @@
23
23
  "node": ">=22"
24
24
  },
25
25
  "dependencies": {
26
- "@standards/client": "1.0.0-alpha.418",
27
- "@standards/constants": "1.0.0-alpha.418",
28
- "@standards/schema": "1.0.0-alpha.418",
26
+ "@standards/client": "1.0.0-alpha.419",
27
+ "@standards/constants": "1.0.0-alpha.419",
28
+ "@standards/schema": "1.0.0-alpha.419",
29
29
  "cli-table3": "^0.6.5",
30
30
  "commander": "^13.1.0",
31
31
  "jiti": "2.7.0"