@stndrds/cli 1.0.0-alpha.293 → 1.0.0-alpha.294
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/bin.mjs +48 -26
- 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
|
|
4
|
+
import chalk10 from "chalk";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
|
|
7
7
|
// src/client.ts
|
|
@@ -129,6 +129,13 @@ function getClientFromCommand(cmd) {
|
|
|
129
129
|
}
|
|
130
130
|
return createClient({ apiUrl: root.apiUrl, apiKey: root.apiKey, tenantId: root.tenant });
|
|
131
131
|
}
|
|
132
|
+
function requireTenant(cmd, message) {
|
|
133
|
+
const { tenant } = getGlobalOptions(cmd);
|
|
134
|
+
if (!tenant) {
|
|
135
|
+
throw new Error(message);
|
|
136
|
+
}
|
|
137
|
+
return tenant;
|
|
138
|
+
}
|
|
132
139
|
function messageOf(error) {
|
|
133
140
|
return error instanceof Error ? error.message : String(error);
|
|
134
141
|
}
|
|
@@ -1206,6 +1213,22 @@ function registerDocumentsCommand(program) {
|
|
|
1206
1213
|
});
|
|
1207
1214
|
}
|
|
1208
1215
|
|
|
1216
|
+
// src/commands/embeddings.ts
|
|
1217
|
+
import chalk4 from "chalk";
|
|
1218
|
+
function registerEmbeddingsCommand(program) {
|
|
1219
|
+
const embeddings = program.command("embeddings").description("Maintain record embeddings");
|
|
1220
|
+
embeddings.command("drain").description("Embed every pending memory and skill record of the tenant").action(async (_opts, cmd) => {
|
|
1221
|
+
const tenant = requireTenant(
|
|
1222
|
+
cmd,
|
|
1223
|
+
'An embedding drain names its tenant explicitly. Pass "--tenant <id>".'
|
|
1224
|
+
);
|
|
1225
|
+
const client = getClientFromCommand(cmd);
|
|
1226
|
+
await client.post("/admin/embeddings/drain", { tenantId: tenant });
|
|
1227
|
+
process.stdout.write(`${chalk4.green("\u2713")} Embedding drain accepted for tenant ${tenant}.
|
|
1228
|
+
`);
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1209
1232
|
// src/commands/folders.ts
|
|
1210
1233
|
import { readFile as readFile2 } from "fs/promises";
|
|
1211
1234
|
function registerFoldersCommand(program) {
|
|
@@ -1239,7 +1262,7 @@ function registerFoldersCommand(program) {
|
|
|
1239
1262
|
}
|
|
1240
1263
|
|
|
1241
1264
|
// src/commands/keys.ts
|
|
1242
|
-
import
|
|
1265
|
+
import chalk5 from "chalk";
|
|
1243
1266
|
function registerKeysCommand(program) {
|
|
1244
1267
|
const keys = program.command("keys").description("Manage Standards API keys");
|
|
1245
1268
|
keys.command("list").description("List API keys").action(async (_opts, cmd) => {
|
|
@@ -1266,14 +1289,14 @@ function registerKeysCommand(program) {
|
|
|
1266
1289
|
}
|
|
1267
1290
|
const client = getClientFromCommand(cmd);
|
|
1268
1291
|
await client.delete(`/api-keys/${id}`);
|
|
1269
|
-
process.stdout.write(`${
|
|
1292
|
+
process.stdout.write(`${chalk5.green("\u2713")} API key ${id} revoked.
|
|
1270
1293
|
`);
|
|
1271
1294
|
});
|
|
1272
1295
|
}
|
|
1273
1296
|
|
|
1274
1297
|
// src/commands/mcp.ts
|
|
1275
1298
|
import { RESOURCE_VISIBILITIES, ValidationError as ValidationError2 } from "@stndrds/schema";
|
|
1276
|
-
import
|
|
1299
|
+
import chalk6 from "chalk";
|
|
1277
1300
|
var AUTH_TYPES = ["none", "header"];
|
|
1278
1301
|
function buildAuth(opts) {
|
|
1279
1302
|
const type = opts.authType ?? "none";
|
|
@@ -1336,7 +1359,7 @@ function registerMcpCommand(program) {
|
|
|
1336
1359
|
const client = getClientFromCommand(cmd);
|
|
1337
1360
|
await client.post(`/mcp-servers/${id}/trust`, { trusted });
|
|
1338
1361
|
process.stdout.write(
|
|
1339
|
-
`${
|
|
1362
|
+
`${chalk6.green("\u2713")} MCP server ${id} ${trusted ? "trusted" : "untrusted"}.
|
|
1340
1363
|
`
|
|
1341
1364
|
);
|
|
1342
1365
|
});
|
|
@@ -1349,7 +1372,7 @@ function registerMcpCommand(program) {
|
|
|
1349
1372
|
}
|
|
1350
1373
|
const client = getClientFromCommand(cmd);
|
|
1351
1374
|
await client.delete(`/mcp-servers/${id}`);
|
|
1352
|
-
process.stdout.write(`${
|
|
1375
|
+
process.stdout.write(`${chalk6.green("\u2713")} MCP server ${id} disconnected.
|
|
1353
1376
|
`);
|
|
1354
1377
|
});
|
|
1355
1378
|
}
|
|
@@ -1520,7 +1543,7 @@ function registerMeetingsCommand(program) {
|
|
|
1520
1543
|
}
|
|
1521
1544
|
|
|
1522
1545
|
// src/commands/pull.ts
|
|
1523
|
-
import
|
|
1546
|
+
import chalk7 from "chalk";
|
|
1524
1547
|
|
|
1525
1548
|
// src/drift/reconciliation-prompt.ts
|
|
1526
1549
|
var PREAMBLE = [
|
|
@@ -1639,7 +1662,7 @@ function registerPullCommand(program) {
|
|
|
1639
1662
|
try {
|
|
1640
1663
|
client = getClientFromCommand(cmd);
|
|
1641
1664
|
} catch (error) {
|
|
1642
|
-
console.error(
|
|
1665
|
+
console.error(chalk7.red(`\u2717 ${messageOf(error)}`));
|
|
1643
1666
|
process.exit(2);
|
|
1644
1667
|
return;
|
|
1645
1668
|
}
|
|
@@ -1649,14 +1672,14 @@ function registerPullCommand(program) {
|
|
|
1649
1672
|
console.info(JSON.stringify(state, null, 2));
|
|
1650
1673
|
process.exit(0);
|
|
1651
1674
|
} catch (error) {
|
|
1652
|
-
console.error(
|
|
1675
|
+
console.error(chalk7.red(`\u2717 ${messageOf(error)}`));
|
|
1653
1676
|
process.exit(2);
|
|
1654
1677
|
}
|
|
1655
1678
|
return;
|
|
1656
1679
|
}
|
|
1657
1680
|
const result = await runPullCommand(client);
|
|
1658
1681
|
if (result.exitCode === 2) {
|
|
1659
|
-
console.error(
|
|
1682
|
+
console.error(chalk7.red(`\u2717 ${result.errorMessage}`));
|
|
1660
1683
|
process.exit(2);
|
|
1661
1684
|
return;
|
|
1662
1685
|
}
|
|
@@ -1752,7 +1775,7 @@ function registerRecordsCommand(program) {
|
|
|
1752
1775
|
// src/commands/root.ts
|
|
1753
1776
|
import { stdin as input, stdout as output } from "process";
|
|
1754
1777
|
import { createInterface } from "readline/promises";
|
|
1755
|
-
import
|
|
1778
|
+
import chalk8 from "chalk";
|
|
1756
1779
|
async function promptForMissingValue(label) {
|
|
1757
1780
|
const rl = createInterface({ input, output });
|
|
1758
1781
|
try {
|
|
@@ -1770,7 +1793,7 @@ function registerRootCommands(program) {
|
|
|
1770
1793
|
await client.get("/api-keys");
|
|
1771
1794
|
await upsertProfile({ name: opts.name, apiUrl: opts.url, apiKey });
|
|
1772
1795
|
process.stdout.write(
|
|
1773
|
-
`${
|
|
1796
|
+
`${chalk8.green("\u2713")} Standards instance "${opts.name}" saved and selected.
|
|
1774
1797
|
`
|
|
1775
1798
|
);
|
|
1776
1799
|
process.stdout.write(` API URL: ${opts.url}
|
|
@@ -1782,7 +1805,7 @@ function registerRootCommands(program) {
|
|
|
1782
1805
|
});
|
|
1783
1806
|
program.command("use").description("Select the active Standards instance").argument("<name>", "instance name").action(async (name) => {
|
|
1784
1807
|
await setCurrentProfile(name);
|
|
1785
|
-
process.stdout.write(`${
|
|
1808
|
+
process.stdout.write(`${chalk8.green("\u2713")} Standards instance "${name}" selected.
|
|
1786
1809
|
`);
|
|
1787
1810
|
});
|
|
1788
1811
|
program.command("instances").description("List configured Standards instances").action(async (_opts, cmd) => {
|
|
@@ -1801,7 +1824,7 @@ function registerRootCommands(program) {
|
|
|
1801
1824
|
});
|
|
1802
1825
|
program.command("logout").description("Remove a Standards instance from local CLI config").argument("[name]", "instance name, defaults to current").action(async (name) => {
|
|
1803
1826
|
await removeProfile(name);
|
|
1804
|
-
process.stdout.write(`${
|
|
1827
|
+
process.stdout.write(`${chalk8.green("\u2713")} Standards instance removed.
|
|
1805
1828
|
`);
|
|
1806
1829
|
});
|
|
1807
1830
|
}
|
|
@@ -1822,7 +1845,7 @@ function registerSchemaCommand(program) {
|
|
|
1822
1845
|
}
|
|
1823
1846
|
|
|
1824
1847
|
// src/commands/search.ts
|
|
1825
|
-
import
|
|
1848
|
+
import chalk9 from "chalk";
|
|
1826
1849
|
function registerSearchCommand(program) {
|
|
1827
1850
|
const search = program.command("search").description("Maintain the Standards search index");
|
|
1828
1851
|
search.command("reindex").description("Clear the tenant search index and re-inject every record").option("--yes", "reindex without confirmation").action(async (opts, cmd) => {
|
|
@@ -1831,16 +1854,14 @@ function registerSearchCommand(program) {
|
|
|
1831
1854
|
'A full reindex clears the index before refilling it. Re-run with "--yes" to confirm.'
|
|
1832
1855
|
);
|
|
1833
1856
|
}
|
|
1834
|
-
const
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
);
|
|
1839
|
-
}
|
|
1857
|
+
const tenant = requireTenant(
|
|
1858
|
+
cmd,
|
|
1859
|
+
'A full reindex names its tenant explicitly. Pass "--tenant <id>" with the tenant you are authenticated in.'
|
|
1860
|
+
);
|
|
1840
1861
|
const client = getClientFromCommand(cmd);
|
|
1841
1862
|
await client.post("/admin/search/full-reindex", { tenantId: tenant });
|
|
1842
1863
|
process.stdout.write(
|
|
1843
|
-
`${
|
|
1864
|
+
`${chalk9.green("\u2713")} Full reindex accepted for tenant ${tenant}. It runs in the background \u2014 follow the server logs for progress.
|
|
1844
1865
|
`
|
|
1845
1866
|
);
|
|
1846
1867
|
});
|
|
@@ -1869,6 +1890,7 @@ function createProgram() {
|
|
|
1869
1890
|
registerMcpCommand(program);
|
|
1870
1891
|
registerMeetingsCommand(program);
|
|
1871
1892
|
registerSearchCommand(program);
|
|
1893
|
+
registerEmbeddingsCommand(program);
|
|
1872
1894
|
program.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
1873
1895
|
const raw = program.opts();
|
|
1874
1896
|
const resolved = await resolveCliConfig({
|
|
@@ -1882,7 +1904,7 @@ function createProgram() {
|
|
|
1882
1904
|
program.setOptionValue("tenant", raw.tenant);
|
|
1883
1905
|
if (!(resolved.apiKey || isPublicCommand(actionCommand))) {
|
|
1884
1906
|
console.error(
|
|
1885
|
-
|
|
1907
|
+
chalk10.red(
|
|
1886
1908
|
`\u2717 Error: No Standards instance configured. Run "standards login" or pass --api-key.`
|
|
1887
1909
|
)
|
|
1888
1910
|
);
|
|
@@ -1896,12 +1918,12 @@ async function runProgram(argv = process.argv) {
|
|
|
1896
1918
|
await program.parseAsync(argv).catch((error) => {
|
|
1897
1919
|
if (error instanceof ApiClientError) {
|
|
1898
1920
|
if (error.statusCode > 0) {
|
|
1899
|
-
console.error(
|
|
1921
|
+
console.error(chalk10.red(`\u2717 Error (${error.statusCode}): ${error.message}`));
|
|
1900
1922
|
} else {
|
|
1901
|
-
console.error(
|
|
1923
|
+
console.error(chalk10.red(`\u2717 Error: ${error.message}`));
|
|
1902
1924
|
}
|
|
1903
1925
|
} else if (error instanceof Error) {
|
|
1904
|
-
console.error(
|
|
1926
|
+
console.error(chalk10.red(`\u2717 Error: ${error.message}`));
|
|
1905
1927
|
}
|
|
1906
1928
|
process.exit(1);
|
|
1907
1929
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stndrds/cli",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.294",
|
|
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.
|
|
16
|
+
"@stndrds/schema": "1.0.0-alpha.294"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/node": "^25.6.0",
|