@stndrds/cli 1.0.0-alpha.275 → 1.0.0-alpha.277

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 +31 -5
  2. package/package.json +2 -2
package/dist/bin.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/program.ts
4
- import chalk7 from "chalk";
4
+ import chalk8 from "chalk";
5
5
  import { Command } from "commander";
6
6
 
7
7
  // src/client.ts
@@ -819,6 +819,31 @@ function registerSchemaCommand(program) {
819
819
  });
820
820
  }
821
821
 
822
+ // src/commands/search.ts
823
+ import chalk7 from "chalk";
824
+ function registerSearchCommand(program) {
825
+ const search = program.command("search").description("Maintain the Standards search index");
826
+ search.command("reindex").description("Clear the tenant search index and re-inject every record").option("--yes", "reindex without confirmation").action(async (opts, cmd) => {
827
+ if (!opts.yes) {
828
+ throw new Error(
829
+ 'A full reindex clears the index before refilling it. Re-run with "--yes" to confirm.'
830
+ );
831
+ }
832
+ const { tenant } = getGlobalOptions(cmd);
833
+ if (!tenant) {
834
+ throw new Error(
835
+ 'A full reindex names its tenant explicitly. Pass "--tenant <id>" with the tenant you are authenticated in.'
836
+ );
837
+ }
838
+ const client = getClientFromCommand(cmd);
839
+ await client.post("/admin/search/full-reindex", { tenantId: tenant });
840
+ process.stdout.write(
841
+ `${chalk7.green("\u2713")} Full reindex accepted for tenant ${tenant}. It runs in the background \u2014 follow the server logs for progress.
842
+ `
843
+ );
844
+ });
845
+ }
846
+
822
847
  // src/program.ts
823
848
  var PUBLIC_COMMANDS = /* @__PURE__ */ new Set(["login", "use", "instances", "current", "logout", "help"]);
824
849
  function isPublicCommand(actionCommand) {
@@ -838,6 +863,7 @@ function createProgram() {
838
863
  registerAuthCommand(program);
839
864
  registerBundlesCommand(program);
840
865
  registerConnectorsCommand(program);
866
+ registerSearchCommand(program);
841
867
  program.hook("preAction", async (_thisCommand, actionCommand) => {
842
868
  const raw = program.opts();
843
869
  const resolved = await resolveCliConfig({
@@ -851,7 +877,7 @@ function createProgram() {
851
877
  program.setOptionValue("tenant", raw.tenant);
852
878
  if (!(resolved.apiKey || isPublicCommand(actionCommand))) {
853
879
  console.error(
854
- chalk7.red(
880
+ chalk8.red(
855
881
  `\u2717 Error: No Standards instance configured. Run "standards login" or pass --api-key.`
856
882
  )
857
883
  );
@@ -865,12 +891,12 @@ async function runProgram(argv = process.argv) {
865
891
  await program.parseAsync(argv).catch((error) => {
866
892
  if (error instanceof ApiClientError) {
867
893
  if (error.statusCode > 0) {
868
- console.error(chalk7.red(`\u2717 Error (${error.statusCode}): ${error.message}`));
894
+ console.error(chalk8.red(`\u2717 Error (${error.statusCode}): ${error.message}`));
869
895
  } else {
870
- console.error(chalk7.red(`\u2717 Error: ${error.message}`));
896
+ console.error(chalk8.red(`\u2717 Error: ${error.message}`));
871
897
  }
872
898
  } else if (error instanceof Error) {
873
- console.error(chalk7.red(`\u2717 Error: ${error.message}`));
899
+ console.error(chalk8.red(`\u2717 Error: ${error.message}`));
874
900
  }
875
901
  process.exit(1);
876
902
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stndrds/cli",
3
- "version": "1.0.0-alpha.275",
3
+ "version": "1.0.0-alpha.277",
4
4
  "description": "CLI tool to interact with Standards API",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,7 +13,7 @@
13
13
  "chalk": "^5.4.1",
14
14
  "cli-table3": "^0.6.5",
15
15
  "commander": "^13.1.0",
16
- "@stndrds/schema": "1.0.0-alpha.275"
16
+ "@stndrds/schema": "1.0.0-alpha.277"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/node": "^25.6.0",