@stndrds/cli 1.0.0-alpha.237 → 1.0.0-alpha.238

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 +34 -36
  2. package/package.json +1 -1
package/dist/bin.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/program.ts
4
- import chalk8 from "chalk";
4
+ import chalk7 from "chalk";
5
5
  import { Command } from "commander";
6
6
 
7
7
  // src/client.ts
@@ -209,7 +209,6 @@ function registerAutofillCommand(program) {
209
209
  }
210
210
 
211
211
  // src/commands/bundles.ts
212
- import chalk3 from "chalk";
213
212
  function registerBundlesCommand(program) {
214
213
  const bundles = program.command("bundles").description("Manage system bundles assigned to the current tenant (admin)");
215
214
  bundles.command("list").description("List the bundles actively assigned to the current tenant").action(async (_opts, cmd) => {
@@ -227,14 +226,13 @@ function registerBundlesCommand(program) {
227
226
  const result = await client.post("/bundles/assign", { bundleId });
228
227
  formatOutput(result, getFormat(cmd));
229
228
  });
230
- bundles.command("unassign").description("Remove a bundle assignment from the current tenant").argument("<bundleId>", "bundle ID to remove").option("--yes", "remove without confirmation").action(async (bundleId, opts, cmd) => {
229
+ bundles.command("uninstall").description("Uninstall a bundle: deactivate it and demote its now-orphaned objects").argument("<bundleId>", "bundle ID to uninstall").option("--yes", "uninstall without confirmation").action(async (bundleId, opts, cmd) => {
231
230
  if (!opts.yes) {
232
- throw new Error('Removing a bundle is explicit. Re-run with "--yes" to confirm.');
231
+ throw new Error('Uninstalling a bundle is explicit. Re-run with "--yes" to confirm.');
233
232
  }
234
233
  const client = getClientFromCommand(cmd);
235
- await client.delete(`/bundles/${bundleId}`);
236
- process.stdout.write(`${chalk3.green("\u2713")} Bundle ${bundleId} unassigned.
237
- `);
234
+ const result = await client.delete(`/bundles/${bundleId}`);
235
+ formatOutput(result, getFormat(cmd));
238
236
  });
239
237
  bundles.command("update").description("Apply assigned bundles \u2014 picks up newer bundle versions (additive sync)").action(async (_opts, cmd) => {
240
238
  const client = getClientFromCommand(cmd);
@@ -244,7 +242,7 @@ function registerBundlesCommand(program) {
244
242
  }
245
243
 
246
244
  // src/commands/connectors.ts
247
- import chalk4 from "chalk";
245
+ import chalk3 from "chalk";
248
246
  var PROVIDERS = ["gmail", "outlook"];
249
247
  function resolveScope(scope) {
250
248
  return scope === "actor" ? "actor" : "tenant";
@@ -275,7 +273,7 @@ function registerConnectorsCommand(program) {
275
273
  }
276
274
  const client = getClientFromCommand(cmd);
277
275
  await client.delete(`/connectors/connections/${id}`);
278
- process.stdout.write(`${chalk4.green("\u2713")} Connector connection ${id} disconnected.
276
+ process.stdout.write(`${chalk3.green("\u2713")} Connector connection ${id} disconnected.
279
277
  `);
280
278
  });
281
279
  }
@@ -376,7 +374,7 @@ function registerFoldersCommand(program) {
376
374
  }
377
375
 
378
376
  // src/commands/keys.ts
379
- import chalk5 from "chalk";
377
+ import chalk4 from "chalk";
380
378
  function registerKeysCommand(program) {
381
379
  const keys = program.command("keys").description("Manage Standards API keys");
382
380
  keys.command("list").description("List API keys").action(async (_opts, cmd) => {
@@ -403,7 +401,7 @@ function registerKeysCommand(program) {
403
401
  }
404
402
  const client = getClientFromCommand(cmd);
405
403
  await client.delete(`/api-keys/${id}`);
406
- process.stdout.write(`${chalk5.green("\u2713")} API key ${id} revoked.
404
+ process.stdout.write(`${chalk4.green("\u2713")} API key ${id} revoked.
407
405
  `);
408
406
  });
409
407
  }
@@ -488,7 +486,7 @@ function registerRecordsCommand(program) {
488
486
  // src/commands/root.ts
489
487
  import { stdin as input, stdout as output } from "process";
490
488
  import { createInterface } from "readline/promises";
491
- import chalk6 from "chalk";
489
+ import chalk5 from "chalk";
492
490
 
493
491
  // src/config.ts
494
492
  import { mkdir, readFile as readFile3, rm, writeFile } from "fs/promises";
@@ -628,7 +626,7 @@ function registerRootCommands(program) {
628
626
  await client.get("/api-keys");
629
627
  await upsertProfile({ name: opts.name, apiUrl: opts.url, apiKey });
630
628
  process.stdout.write(
631
- `${chalk6.green("\u2713")} Standards instance "${opts.name}" saved and selected.
629
+ `${chalk5.green("\u2713")} Standards instance "${opts.name}" saved and selected.
632
630
  `
633
631
  );
634
632
  process.stdout.write(` API URL: ${opts.url}
@@ -640,7 +638,7 @@ function registerRootCommands(program) {
640
638
  });
641
639
  program.command("use").description("Select the active Standards instance").argument("<name>", "instance name").action(async (name) => {
642
640
  await setCurrentProfile(name);
643
- process.stdout.write(`${chalk6.green("\u2713")} Standards instance "${name}" selected.
641
+ process.stdout.write(`${chalk5.green("\u2713")} Standards instance "${name}" selected.
644
642
  `);
645
643
  });
646
644
  program.command("instances").description("List configured Standards instances").action(async (_opts, cmd) => {
@@ -659,7 +657,7 @@ function registerRootCommands(program) {
659
657
  });
660
658
  program.command("logout").description("Remove a Standards instance from local CLI config").argument("[name]", "instance name, defaults to current").action(async (name) => {
661
659
  await removeProfile(name);
662
- process.stdout.write(`${chalk6.green("\u2713")} Standards instance removed.
660
+ process.stdout.write(`${chalk5.green("\u2713")} Standards instance removed.
663
661
  `);
664
662
  });
665
663
  }
@@ -669,7 +667,7 @@ import { createHash } from "crypto";
669
667
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
670
668
  import { join as join2 } from "path";
671
669
  import { fileURLToPath } from "url";
672
- import chalk7 from "chalk";
670
+ import chalk6 from "chalk";
673
671
  function registerSchemaCommand(program) {
674
672
  const schema = program.command("schema").description("Inspect schema objects and attributes");
675
673
  schema.command("list").description("List all schema objects").action(async (_opts, cmd) => {
@@ -696,7 +694,7 @@ function registerSchemaCommand(program) {
696
694
  const result = await fetchDrift(getClientFromCommand(cmd), opts.object);
697
695
  const totalDrift = result.summary.totalCustomObjects + result.summary.totalCustomAttributes;
698
696
  if (totalDrift === 0) {
699
- console.info(chalk7.green("\u2713 No drift detected \u2014 nothing to pull."));
697
+ console.info(chalk6.green("\u2713 No drift detected \u2014 nothing to pull."));
700
698
  process.exit(0);
701
699
  }
702
700
  const globalOpts = cmd.optsWithGlobals();
@@ -704,7 +702,7 @@ function registerSchemaCommand(program) {
704
702
  const shouldSave = opts.save !== false;
705
703
  if (opts.output) {
706
704
  writeFileSync(opts.output, prompt, "utf-8");
707
- console.info(chalk7.green(`\u2713 Prompt written to ${opts.output}`));
705
+ console.info(chalk6.green(`\u2713 Prompt written to ${opts.output}`));
708
706
  return;
709
707
  }
710
708
  if (shouldSave) {
@@ -718,8 +716,8 @@ function registerSchemaCommand(program) {
718
716
  const filename = join2(pullsDir, `${date}-${hash}.md`);
719
717
  writeFileSync(filename, prompt, "utf-8");
720
718
  writeFileSync(join2(diffDir, "latest.json"), JSON.stringify(result, null, 2), "utf-8");
721
- console.info(chalk7.green(`\u2713 Pull prompt written to ${filename}`));
722
- console.info(chalk7.dim(" Copy-paste its contents into your LLM to resolve the drift."));
719
+ console.info(chalk6.green(`\u2713 Pull prompt written to ${filename}`));
720
+ console.info(chalk6.dim(" Copy-paste its contents into your LLM to resolve the drift."));
723
721
  } else {
724
722
  process.stdout.write(prompt);
725
723
  }
@@ -734,46 +732,46 @@ var attrInline = (attr) => {
734
732
  function printDiffOutput(result) {
735
733
  const lines = [];
736
734
  for (const obj of result.customObjects) {
737
- lines.push(chalk7.yellow(`\u26A0 ${obj.name} (${obj.label}) \u2014 custom object, not in code`));
738
- lines.push(chalk7.dim(' \u2192 Run "standards pull" to promote or leave.'));
735
+ lines.push(chalk6.yellow(`\u26A0 ${obj.name} (${obj.label}) \u2014 custom object, not in code`));
736
+ lines.push(chalk6.dim(' \u2192 Run "standards pull" to promote or leave.'));
739
737
  }
740
738
  for (const entry of result.systemObjectDrift) {
741
739
  const unexpected = entry.sealed ? entry.customAttributes.filter((a) => !a.tolerated) : [];
742
740
  const tolerated = entry.customAttributes.filter((a) => a.tolerated);
743
741
  if (entry.sealed && unexpected.length > 0) {
744
742
  lines.push(
745
- chalk7.red(
743
+ chalk6.red(
746
744
  `\u2717 ${entry.objectName} \u2014 ${unexpected.length} unexpected custom attribute(s) (sealed object)`
747
745
  )
748
746
  );
749
- for (const attr of unexpected) lines.push(chalk7.red(attrInline(attr)));
750
- lines.push(chalk7.dim(' \u2192 Run "standards pull" to promote or tolerate these attributes.'));
747
+ for (const attr of unexpected) lines.push(chalk6.red(attrInline(attr)));
748
+ lines.push(chalk6.dim(' \u2192 Run "standards pull" to promote or tolerate these attributes.'));
751
749
  if (tolerated.length > 0) {
752
- lines.push(chalk7.dim(` Also tolerated: ${tolerated.length} attribute(s)`));
753
- for (const attr of tolerated) lines.push(chalk7.dim(attrInline(attr)));
750
+ lines.push(chalk6.dim(` Also tolerated: ${tolerated.length} attribute(s)`));
751
+ for (const attr of tolerated) lines.push(chalk6.dim(attrInline(attr)));
754
752
  }
755
753
  continue;
756
754
  }
757
755
  const okAttrs = entry.sealed ? tolerated : entry.customAttributes;
758
756
  if (okAttrs.length === 0) continue;
759
757
  const okSuffix = entry.sealed ? "tolerated custom attribute(s) (sealed)" : "custom attribute(s) (extensible)";
760
- lines.push(chalk7.green(`\u2713 ${entry.objectName} \u2014 ${okAttrs.length} ${okSuffix}`));
761
- for (const attr of okAttrs) lines.push(chalk7.dim(attrInline(attr)));
758
+ lines.push(chalk6.green(`\u2713 ${entry.objectName} \u2014 ${okAttrs.length} ${okSuffix}`));
759
+ for (const attr of okAttrs) lines.push(chalk6.dim(attrInline(attr)));
762
760
  }
763
761
  if (lines.length === 0) {
764
- console.info(chalk7.green("\u2713 No drift detected."));
762
+ console.info(chalk6.green("\u2713 No drift detected."));
765
763
  return;
766
764
  }
767
765
  console.info(lines.join("\n"));
768
766
  if (result.hasUnexpectedDrift) {
769
767
  console.info(
770
- chalk7.red(
768
+ chalk6.red(
771
769
  `
772
770
  \u2717 Unexpected drift: ${result.summary.totalUnexpected} attribute(s) on sealed object(s).`
773
771
  )
774
772
  );
775
773
  } else {
776
- console.info(chalk7.green("\n\u2713 No unexpected drift."));
774
+ console.info(chalk6.green("\n\u2713 No unexpected drift."));
777
775
  }
778
776
  }
779
777
  function resolveStandardsDir() {
@@ -907,7 +905,7 @@ function createProgram() {
907
905
  program.setOptionValue("tenant", raw.tenant);
908
906
  if (!(resolved.apiKey || isPublicCommand(actionCommand))) {
909
907
  console.error(
910
- chalk8.red(
908
+ chalk7.red(
911
909
  `\u2717 Error: No Standards instance configured. Run "standards login" or pass --api-key.`
912
910
  )
913
911
  );
@@ -921,12 +919,12 @@ async function runProgram(argv = process.argv) {
921
919
  await program.parseAsync(argv).catch((error) => {
922
920
  if (error instanceof ApiClientError) {
923
921
  if (error.statusCode > 0) {
924
- console.error(chalk8.red(`\u2717 Error (${error.statusCode}): ${error.message}`));
922
+ console.error(chalk7.red(`\u2717 Error (${error.statusCode}): ${error.message}`));
925
923
  } else {
926
- console.error(chalk8.red(`\u2717 Error: ${error.message}`));
924
+ console.error(chalk7.red(`\u2717 Error: ${error.message}`));
927
925
  }
928
926
  } else if (error instanceof Error) {
929
- console.error(chalk8.red(`\u2717 Error: ${error.message}`));
927
+ console.error(chalk7.red(`\u2717 Error: ${error.message}`));
930
928
  }
931
929
  process.exit(1);
932
930
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stndrds/cli",
3
- "version": "1.0.0-alpha.237",
3
+ "version": "1.0.0-alpha.238",
4
4
  "description": "CLI tool to interact with Standards API",
5
5
  "type": "module",
6
6
  "bin": {