@stndrds/cli 1.0.0-alpha.293 → 1.0.0-alpha.295
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/LICENSE +111 -0
- package/README.md +4 -0
- package/dist/bin.mjs +78 -128
- package/package.json +7 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
STANDARDS SDK LICENSE
|
|
2
|
+
Version 1.0, September 2026
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2025-2026 AND YOU CREATE SAS. All rights reserved.
|
|
5
|
+
|
|
6
|
+
AND YOU CREATE, a French société par actions simplifiée with a share capital
|
|
7
|
+
of EUR 500, registered with the Paris Trade and Companies Register under
|
|
8
|
+
number 940 190 614, having its registered office at 60 rue François Ier,
|
|
9
|
+
75008 Paris, France (VAT FR34940190614) ("AYC", "we"), is the sole owner of
|
|
10
|
+
the software distributed under this license (the "SDK"): the source code,
|
|
11
|
+
compiled code, type declarations, documentation and any accompanying files
|
|
12
|
+
published in this package.
|
|
13
|
+
|
|
14
|
+
This is not an open source license. The SDK is made available so that you
|
|
15
|
+
can build software that communicates with the Standards platform operated by
|
|
16
|
+
AYC ("Standards"). Reading the source is permitted; everything else is
|
|
17
|
+
governed by the terms below. By installing, copying or using the SDK you
|
|
18
|
+
("you", the "Licensee") accept them. If you do not accept them, do not use
|
|
19
|
+
the SDK.
|
|
20
|
+
|
|
21
|
+
1. LICENSE GRANT
|
|
22
|
+
AYC grants you a limited, non-exclusive, non-transferable, non-sublicensable,
|
|
23
|
+
revocable license to:
|
|
24
|
+
(a) install and use the SDK, in unmodified form, solely to develop, test
|
|
25
|
+
and run applications that communicate with a Standards tenant, workspace
|
|
26
|
+
or API that you are authorised to access under a valid agreement with
|
|
27
|
+
AYC or with an AYC customer; and
|
|
28
|
+
(b) make the copies of the SDK reasonably necessary for that purpose,
|
|
29
|
+
including copies produced by your build tooling and bundlers.
|
|
30
|
+
|
|
31
|
+
2. RESTRICTIONS
|
|
32
|
+
Except as expressly permitted in Section 1, you shall not, and shall not
|
|
33
|
+
permit any third party to:
|
|
34
|
+
(a) modify, translate, adapt or create derivative works of the SDK;
|
|
35
|
+
(b) reverse engineer, decompile or disassemble the SDK, or otherwise attempt
|
|
36
|
+
to derive its design or internal structure, except to the extent that
|
|
37
|
+
applicable law expressly permits it despite this restriction (Articles
|
|
38
|
+
L.122-6-1 III and IV of the French Intellectual Property Code), in which
|
|
39
|
+
case you shall first request the information from AYC;
|
|
40
|
+
(c) distribute, sell, rent, lease, lend, sublicense, publish or otherwise
|
|
41
|
+
make the SDK, or any part of it, available to any third party, other
|
|
42
|
+
than as bundled inside an application described in Section 1(a);
|
|
43
|
+
(d) use the SDK, or any knowledge of its interfaces, formats, protocols or
|
|
44
|
+
schemas obtained through it, to build, train or improve a product or
|
|
45
|
+
service that competes with Standards, or to access Standards other than
|
|
46
|
+
through the interfaces AYC documents;
|
|
47
|
+
(e) use the SDK to interact with any Standards instance, tenant or API that
|
|
48
|
+
you are not authorised to access, or to circumvent any authentication,
|
|
49
|
+
authorisation, rate limit, licence key or other technical measure;
|
|
50
|
+
(f) remove, alter or obscure any copyright, trademark, licence or other
|
|
51
|
+
proprietary notice in the SDK; or
|
|
52
|
+
(g) use AYC's or Standards' names, logos or trademarks except to state
|
|
53
|
+
truthfully that your application uses the Standards SDK.
|
|
54
|
+
|
|
55
|
+
3. OWNERSHIP
|
|
56
|
+
The SDK is licensed, not sold. AYC and its licensors retain all right, title
|
|
57
|
+
and interest in and to the SDK, including all intellectual property rights.
|
|
58
|
+
No right is granted by implication, estoppel or otherwise. Any feedback or
|
|
59
|
+
suggestion you provide about the SDK may be used by AYC without restriction
|
|
60
|
+
or obligation.
|
|
61
|
+
|
|
62
|
+
4. THIRD-PARTY COMPONENTS
|
|
63
|
+
The SDK may include or depend on third-party open source components. Those
|
|
64
|
+
components are governed by their own licences, which are identified in the
|
|
65
|
+
package metadata and prevail over this license for those components only.
|
|
66
|
+
|
|
67
|
+
5. UPDATES
|
|
68
|
+
AYC may publish new versions of the SDK at any time. This license applies to
|
|
69
|
+
each version you obtain unless that version is accompanied by a different
|
|
70
|
+
licence. AYC has no obligation to maintain, support or update the SDK.
|
|
71
|
+
|
|
72
|
+
6. TERM AND TERMINATION
|
|
73
|
+
This license is effective until terminated. It terminates automatically,
|
|
74
|
+
without notice, if you breach any of its terms. AYC may also terminate it on
|
|
75
|
+
written notice if your agreement with AYC or with the AYC customer whose
|
|
76
|
+
tenant you access ends. Upon termination you shall stop using the SDK and
|
|
77
|
+
destroy every copy in your possession or control. Sections 2, 3, 7, 8 and 9
|
|
78
|
+
survive termination.
|
|
79
|
+
|
|
80
|
+
7. NO WARRANTY
|
|
81
|
+
THE SDK IS PROVIDED "AS IS" AND "AS AVAILABLE", WITHOUT WARRANTY OF ANY KIND,
|
|
82
|
+
EXPRESS OR IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
|
83
|
+
PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT, TO THE FULLEST EXTENT
|
|
84
|
+
PERMITTED BY APPLICABLE LAW. AYC does not warrant that the SDK will be
|
|
85
|
+
error-free or uninterrupted.
|
|
86
|
+
|
|
87
|
+
8. LIMITATION OF LIABILITY
|
|
88
|
+
TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW, AYC SHALL NOT BE LIABLE
|
|
89
|
+
FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL OR PUNITIVE DAMAGES, OR
|
|
90
|
+
FOR ANY LOSS OF PROFITS, REVENUE, DATA OR GOODWILL, ARISING OUT OF OR IN
|
|
91
|
+
CONNECTION WITH THE SDK OR THIS LICENSE. AYC'S TOTAL AGGREGATE LIABILITY
|
|
92
|
+
UNDER THIS LICENSE SHALL NOT EXCEED ONE HUNDRED EUROS (EUR 100). Nothing in
|
|
93
|
+
this license excludes or limits liability that cannot be excluded or limited
|
|
94
|
+
under applicable law, including liability for gross negligence, wilful
|
|
95
|
+
misconduct or death or personal injury caused by negligence.
|
|
96
|
+
|
|
97
|
+
9. GOVERNING LAW AND JURISDICTION
|
|
98
|
+
This license is governed by the laws of France. Any dispute arising out of or
|
|
99
|
+
in connection with it shall be submitted to the exclusive jurisdiction of the
|
|
100
|
+
courts of Paris, France, subject to any mandatory rule granting jurisdiction
|
|
101
|
+
to another court.
|
|
102
|
+
|
|
103
|
+
10. GENERAL
|
|
104
|
+
If any provision of this license is held unenforceable, the remaining
|
|
105
|
+
provisions remain in force. AYC's failure to enforce a provision is not a
|
|
106
|
+
waiver of it. This license is the entire agreement between you and AYC about
|
|
107
|
+
the SDK and supersedes any prior understanding about it, without prejudice to
|
|
108
|
+
any separate agreement governing your access to Standards.
|
|
109
|
+
|
|
110
|
+
To obtain a different licence, or for any question about this one, contact
|
|
111
|
+
AND YOU CREATE SAS, 60 rue François Ier, 75008 Paris, France.
|
package/README.md
CHANGED
|
@@ -32,3 +32,7 @@ claude -p "Summarize the failing tests"
|
|
|
32
32
|
|
|
33
33
|
Every agent command targeting a device requires explicit user approval. Calls to `exec_command`
|
|
34
34
|
without a `deviceId` continue to use the agent sandbox.
|
|
35
|
+
|
|
36
|
+
## License
|
|
37
|
+
|
|
38
|
+
Licensed under the Standards SDK License 1.0 — see `LICENSE`. This package is not open source: it is provided to build applications that communicate with Standards.
|
package/dist/bin.mjs
CHANGED
|
@@ -1,112 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
|
|
2
3
|
|
|
3
4
|
// src/program.ts
|
|
4
|
-
import
|
|
5
|
+
import chalk10 from "chalk";
|
|
5
6
|
import { Command } from "commander";
|
|
6
7
|
|
|
7
8
|
// src/client.ts
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
super(message);
|
|
11
|
-
this.statusCode = statusCode;
|
|
12
|
-
this.name = "ApiClientError";
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
function buildUrl(base, path, params) {
|
|
16
|
-
const normalizedBase = base.endsWith("/") ? base : `${base}/`;
|
|
17
|
-
const normalizedPath = path.replace(/^\/+/, "");
|
|
18
|
-
const url = new URL(normalizedPath, normalizedBase);
|
|
19
|
-
if (params) {
|
|
20
|
-
for (const [key, value] of Object.entries(params)) {
|
|
21
|
-
if (value !== void 0 && value !== null) {
|
|
22
|
-
url.searchParams.set(key, String(value));
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return url.toString();
|
|
27
|
-
}
|
|
9
|
+
import { StandardsRequestError, createTransport } from "@stndrds/client";
|
|
10
|
+
var ApiClientError = StandardsRequestError;
|
|
28
11
|
function createClient(config) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
async function sendRequest(url, init) {
|
|
36
|
-
let response;
|
|
37
|
-
try {
|
|
38
|
-
response = await fetch(url, { ...init, signal: AbortSignal.timeout(3e4) });
|
|
39
|
-
} catch (error) {
|
|
40
|
-
if (error instanceof TypeError || error instanceof DOMException && error.name === "TimeoutError") {
|
|
41
|
-
throw new ApiClientError(0, `Could not connect to ${apiUrl}. Is the server running?`);
|
|
42
|
-
}
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
45
|
-
if (response.status === 204) {
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
const data = await response.json();
|
|
49
|
-
if (!response.ok) {
|
|
50
|
-
const message = data.message ?? `Request failed with status ${response.status}`;
|
|
51
|
-
throw new ApiClientError(response.status, message);
|
|
52
|
-
}
|
|
53
|
-
return data;
|
|
54
|
-
}
|
|
55
|
-
function request(method, path, options) {
|
|
56
|
-
const url = buildUrl(apiUrl, path, options?.params);
|
|
57
|
-
return sendRequest(url, {
|
|
58
|
-
method,
|
|
59
|
-
headers,
|
|
60
|
-
body: options?.body ? JSON.stringify(options.body) : void 0
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
async function getText(path, params) {
|
|
64
|
-
const url = buildUrl(apiUrl, path, params);
|
|
65
|
-
let response;
|
|
66
|
-
try {
|
|
67
|
-
response = await fetch(url, { method: "GET", headers, signal: AbortSignal.timeout(3e4) });
|
|
68
|
-
} catch (error) {
|
|
69
|
-
if (error instanceof TypeError || error instanceof DOMException && error.name === "TimeoutError") {
|
|
70
|
-
throw new ApiClientError(0, `Could not connect to ${apiUrl}. Is the server running?`);
|
|
71
|
-
}
|
|
72
|
-
throw error;
|
|
73
|
-
}
|
|
74
|
-
const text = await response.text();
|
|
75
|
-
if (!response.ok) {
|
|
76
|
-
let message = `Request failed with status ${response.status}`;
|
|
77
|
-
try {
|
|
78
|
-
message = JSON.parse(text).message ?? message;
|
|
79
|
-
} catch {
|
|
80
|
-
if (text) message = text;
|
|
81
|
-
}
|
|
82
|
-
throw new ApiClientError(response.status, message);
|
|
83
|
-
}
|
|
84
|
-
return text;
|
|
85
|
-
}
|
|
86
|
-
function postMultipart(path, form) {
|
|
87
|
-
const url = buildUrl(apiUrl, path);
|
|
88
|
-
const { "Content-Type": _ct, ...multipartHeaders } = headers;
|
|
89
|
-
return sendRequest(url, { method: "POST", headers: multipartHeaders, body: form });
|
|
90
|
-
}
|
|
91
|
-
return {
|
|
92
|
-
get(path, params) {
|
|
93
|
-
return request("GET", path, { params });
|
|
94
|
-
},
|
|
95
|
-
post(path, body) {
|
|
96
|
-
return request("POST", path, { body });
|
|
97
|
-
},
|
|
98
|
-
patch(path, body) {
|
|
99
|
-
return request("PATCH", path, { body });
|
|
100
|
-
},
|
|
101
|
-
put(path, body) {
|
|
102
|
-
return request("PUT", path, { body });
|
|
103
|
-
},
|
|
104
|
-
delete(path) {
|
|
105
|
-
return request("DELETE", path);
|
|
106
|
-
},
|
|
107
|
-
getText,
|
|
108
|
-
postMultipart
|
|
109
|
-
};
|
|
12
|
+
return createTransport({
|
|
13
|
+
baseUrl: config.apiUrl,
|
|
14
|
+
apiKey: config.apiKey,
|
|
15
|
+
tenantId: config.tenantId
|
|
16
|
+
});
|
|
110
17
|
}
|
|
111
18
|
|
|
112
19
|
// src/commands/auth.ts
|
|
@@ -129,6 +36,13 @@ function getClientFromCommand(cmd) {
|
|
|
129
36
|
}
|
|
130
37
|
return createClient({ apiUrl: root.apiUrl, apiKey: root.apiKey, tenantId: root.tenant });
|
|
131
38
|
}
|
|
39
|
+
function requireTenant(cmd, message) {
|
|
40
|
+
const { tenant } = getGlobalOptions(cmd);
|
|
41
|
+
if (!tenant) {
|
|
42
|
+
throw new Error(message);
|
|
43
|
+
}
|
|
44
|
+
return tenant;
|
|
45
|
+
}
|
|
132
46
|
function messageOf(error) {
|
|
133
47
|
return error instanceof Error ? error.message : String(error);
|
|
134
48
|
}
|
|
@@ -1206,6 +1120,22 @@ function registerDocumentsCommand(program) {
|
|
|
1206
1120
|
});
|
|
1207
1121
|
}
|
|
1208
1122
|
|
|
1123
|
+
// src/commands/embeddings.ts
|
|
1124
|
+
import chalk4 from "chalk";
|
|
1125
|
+
function registerEmbeddingsCommand(program) {
|
|
1126
|
+
const embeddings = program.command("embeddings").description("Maintain record embeddings");
|
|
1127
|
+
embeddings.command("drain").description("Embed every pending memory and skill record of the tenant").action(async (_opts, cmd) => {
|
|
1128
|
+
const tenant = requireTenant(
|
|
1129
|
+
cmd,
|
|
1130
|
+
'An embedding drain names its tenant explicitly. Pass "--tenant <id>".'
|
|
1131
|
+
);
|
|
1132
|
+
const client = getClientFromCommand(cmd);
|
|
1133
|
+
await client.post("/admin/embeddings/drain", { tenantId: tenant });
|
|
1134
|
+
process.stdout.write(`${chalk4.green("\u2713")} Embedding drain accepted for tenant ${tenant}.
|
|
1135
|
+
`);
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1209
1139
|
// src/commands/folders.ts
|
|
1210
1140
|
import { readFile as readFile2 } from "fs/promises";
|
|
1211
1141
|
function registerFoldersCommand(program) {
|
|
@@ -1239,7 +1169,7 @@ function registerFoldersCommand(program) {
|
|
|
1239
1169
|
}
|
|
1240
1170
|
|
|
1241
1171
|
// src/commands/keys.ts
|
|
1242
|
-
import
|
|
1172
|
+
import chalk5 from "chalk";
|
|
1243
1173
|
function registerKeysCommand(program) {
|
|
1244
1174
|
const keys = program.command("keys").description("Manage Standards API keys");
|
|
1245
1175
|
keys.command("list").description("List API keys").action(async (_opts, cmd) => {
|
|
@@ -1266,14 +1196,14 @@ function registerKeysCommand(program) {
|
|
|
1266
1196
|
}
|
|
1267
1197
|
const client = getClientFromCommand(cmd);
|
|
1268
1198
|
await client.delete(`/api-keys/${id}`);
|
|
1269
|
-
process.stdout.write(`${
|
|
1199
|
+
process.stdout.write(`${chalk5.green("\u2713")} API key ${id} revoked.
|
|
1270
1200
|
`);
|
|
1271
1201
|
});
|
|
1272
1202
|
}
|
|
1273
1203
|
|
|
1274
1204
|
// src/commands/mcp.ts
|
|
1275
1205
|
import { RESOURCE_VISIBILITIES, ValidationError as ValidationError2 } from "@stndrds/schema";
|
|
1276
|
-
import
|
|
1206
|
+
import chalk6 from "chalk";
|
|
1277
1207
|
var AUTH_TYPES = ["none", "header"];
|
|
1278
1208
|
function buildAuth(opts) {
|
|
1279
1209
|
const type = opts.authType ?? "none";
|
|
@@ -1336,7 +1266,7 @@ function registerMcpCommand(program) {
|
|
|
1336
1266
|
const client = getClientFromCommand(cmd);
|
|
1337
1267
|
await client.post(`/mcp-servers/${id}/trust`, { trusted });
|
|
1338
1268
|
process.stdout.write(
|
|
1339
|
-
`${
|
|
1269
|
+
`${chalk6.green("\u2713")} MCP server ${id} ${trusted ? "trusted" : "untrusted"}.
|
|
1340
1270
|
`
|
|
1341
1271
|
);
|
|
1342
1272
|
});
|
|
@@ -1349,7 +1279,7 @@ function registerMcpCommand(program) {
|
|
|
1349
1279
|
}
|
|
1350
1280
|
const client = getClientFromCommand(cmd);
|
|
1351
1281
|
await client.delete(`/mcp-servers/${id}`);
|
|
1352
|
-
process.stdout.write(`${
|
|
1282
|
+
process.stdout.write(`${chalk6.green("\u2713")} MCP server ${id} disconnected.
|
|
1353
1283
|
`);
|
|
1354
1284
|
});
|
|
1355
1285
|
}
|
|
@@ -1520,7 +1450,7 @@ function registerMeetingsCommand(program) {
|
|
|
1520
1450
|
}
|
|
1521
1451
|
|
|
1522
1452
|
// src/commands/pull.ts
|
|
1523
|
-
import
|
|
1453
|
+
import chalk7 from "chalk";
|
|
1524
1454
|
|
|
1525
1455
|
// src/drift/reconciliation-prompt.ts
|
|
1526
1456
|
var PREAMBLE = [
|
|
@@ -1639,7 +1569,7 @@ function registerPullCommand(program) {
|
|
|
1639
1569
|
try {
|
|
1640
1570
|
client = getClientFromCommand(cmd);
|
|
1641
1571
|
} catch (error) {
|
|
1642
|
-
console.error(
|
|
1572
|
+
console.error(chalk7.red(`\u2717 ${messageOf(error)}`));
|
|
1643
1573
|
process.exit(2);
|
|
1644
1574
|
return;
|
|
1645
1575
|
}
|
|
@@ -1649,14 +1579,14 @@ function registerPullCommand(program) {
|
|
|
1649
1579
|
console.info(JSON.stringify(state, null, 2));
|
|
1650
1580
|
process.exit(0);
|
|
1651
1581
|
} catch (error) {
|
|
1652
|
-
console.error(
|
|
1582
|
+
console.error(chalk7.red(`\u2717 ${messageOf(error)}`));
|
|
1653
1583
|
process.exit(2);
|
|
1654
1584
|
}
|
|
1655
1585
|
return;
|
|
1656
1586
|
}
|
|
1657
1587
|
const result = await runPullCommand(client);
|
|
1658
1588
|
if (result.exitCode === 2) {
|
|
1659
|
-
console.error(
|
|
1589
|
+
console.error(chalk7.red(`\u2717 ${result.errorMessage}`));
|
|
1660
1590
|
process.exit(2);
|
|
1661
1591
|
return;
|
|
1662
1592
|
}
|
|
@@ -1752,7 +1682,7 @@ function registerRecordsCommand(program) {
|
|
|
1752
1682
|
// src/commands/root.ts
|
|
1753
1683
|
import { stdin as input, stdout as output } from "process";
|
|
1754
1684
|
import { createInterface } from "readline/promises";
|
|
1755
|
-
import
|
|
1685
|
+
import chalk8 from "chalk";
|
|
1756
1686
|
async function promptForMissingValue(label) {
|
|
1757
1687
|
const rl = createInterface({ input, output });
|
|
1758
1688
|
try {
|
|
@@ -1770,7 +1700,7 @@ function registerRootCommands(program) {
|
|
|
1770
1700
|
await client.get("/api-keys");
|
|
1771
1701
|
await upsertProfile({ name: opts.name, apiUrl: opts.url, apiKey });
|
|
1772
1702
|
process.stdout.write(
|
|
1773
|
-
`${
|
|
1703
|
+
`${chalk8.green("\u2713")} Standards instance "${opts.name}" saved and selected.
|
|
1774
1704
|
`
|
|
1775
1705
|
);
|
|
1776
1706
|
process.stdout.write(` API URL: ${opts.url}
|
|
@@ -1782,7 +1712,7 @@ function registerRootCommands(program) {
|
|
|
1782
1712
|
});
|
|
1783
1713
|
program.command("use").description("Select the active Standards instance").argument("<name>", "instance name").action(async (name) => {
|
|
1784
1714
|
await setCurrentProfile(name);
|
|
1785
|
-
process.stdout.write(`${
|
|
1715
|
+
process.stdout.write(`${chalk8.green("\u2713")} Standards instance "${name}" selected.
|
|
1786
1716
|
`);
|
|
1787
1717
|
});
|
|
1788
1718
|
program.command("instances").description("List configured Standards instances").action(async (_opts, cmd) => {
|
|
@@ -1801,7 +1731,7 @@ function registerRootCommands(program) {
|
|
|
1801
1731
|
});
|
|
1802
1732
|
program.command("logout").description("Remove a Standards instance from local CLI config").argument("[name]", "instance name, defaults to current").action(async (name) => {
|
|
1803
1733
|
await removeProfile(name);
|
|
1804
|
-
process.stdout.write(`${
|
|
1734
|
+
process.stdout.write(`${chalk8.green("\u2713")} Standards instance removed.
|
|
1805
1735
|
`);
|
|
1806
1736
|
});
|
|
1807
1737
|
}
|
|
@@ -1822,7 +1752,7 @@ function registerSchemaCommand(program) {
|
|
|
1822
1752
|
}
|
|
1823
1753
|
|
|
1824
1754
|
// src/commands/search.ts
|
|
1825
|
-
import
|
|
1755
|
+
import chalk9 from "chalk";
|
|
1826
1756
|
function registerSearchCommand(program) {
|
|
1827
1757
|
const search = program.command("search").description("Maintain the Standards search index");
|
|
1828
1758
|
search.command("reindex").description("Clear the tenant search index and re-inject every record").option("--yes", "reindex without confirmation").action(async (opts, cmd) => {
|
|
@@ -1831,21 +1761,39 @@ function registerSearchCommand(program) {
|
|
|
1831
1761
|
'A full reindex clears the index before refilling it. Re-run with "--yes" to confirm.'
|
|
1832
1762
|
);
|
|
1833
1763
|
}
|
|
1834
|
-
const
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
);
|
|
1839
|
-
}
|
|
1764
|
+
const tenant = requireTenant(
|
|
1765
|
+
cmd,
|
|
1766
|
+
'A full reindex names its tenant explicitly. Pass "--tenant <id>" with the tenant you are authenticated in.'
|
|
1767
|
+
);
|
|
1840
1768
|
const client = getClientFromCommand(cmd);
|
|
1841
1769
|
await client.post("/admin/search/full-reindex", { tenantId: tenant });
|
|
1842
1770
|
process.stdout.write(
|
|
1843
|
-
`${
|
|
1771
|
+
`${chalk9.green("\u2713")} Full reindex accepted for tenant ${tenant}. It runs in the background \u2014 follow the server logs for progress.
|
|
1844
1772
|
`
|
|
1845
1773
|
);
|
|
1846
1774
|
});
|
|
1847
1775
|
}
|
|
1848
1776
|
|
|
1777
|
+
// src/commands/sources.ts
|
|
1778
|
+
function registerSourcesCommand(program) {
|
|
1779
|
+
const sources = program.command("sources").description("Inspect and remove remote schema sources on the current tenant");
|
|
1780
|
+
sources.command("list").description("List remote schema sources: id, hash, last apply, object names").action(async (_opts, cmd) => {
|
|
1781
|
+
const client = getClientFromCommand(cmd);
|
|
1782
|
+
const result = await client.get("/schema/sources");
|
|
1783
|
+
formatOutput(result, getFormat(cmd));
|
|
1784
|
+
});
|
|
1785
|
+
sources.command("remove").description(
|
|
1786
|
+
"Remove a remote schema source: its objects are demoted to custom, records are kept"
|
|
1787
|
+
).argument("<sourceId>", "source id declared in code").option("--yes", "remove without confirmation").action(async (sourceId, opts, cmd) => {
|
|
1788
|
+
if (!opts.yes) {
|
|
1789
|
+
throw new Error('Removing a schema source is explicit. Re-run with "--yes" to confirm.');
|
|
1790
|
+
}
|
|
1791
|
+
const client = getClientFromCommand(cmd);
|
|
1792
|
+
await client.delete(`/schema/sources/${sourceId}`);
|
|
1793
|
+
formatOutput({ removed: sourceId }, getFormat(cmd));
|
|
1794
|
+
});
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1849
1797
|
// src/program.ts
|
|
1850
1798
|
var PUBLIC_COMMANDS = /* @__PURE__ */ new Set(["login", "use", "instances", "current", "logout", "help"]);
|
|
1851
1799
|
function isPublicCommand(actionCommand) {
|
|
@@ -1865,10 +1813,12 @@ function createProgram() {
|
|
|
1865
1813
|
registerKeysCommand(program);
|
|
1866
1814
|
registerAuthCommand(program);
|
|
1867
1815
|
registerBundlesCommand(program);
|
|
1816
|
+
registerSourcesCommand(program);
|
|
1868
1817
|
registerConnectorsCommand(program);
|
|
1869
1818
|
registerMcpCommand(program);
|
|
1870
1819
|
registerMeetingsCommand(program);
|
|
1871
1820
|
registerSearchCommand(program);
|
|
1821
|
+
registerEmbeddingsCommand(program);
|
|
1872
1822
|
program.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
1873
1823
|
const raw = program.opts();
|
|
1874
1824
|
const resolved = await resolveCliConfig({
|
|
@@ -1882,7 +1832,7 @@ function createProgram() {
|
|
|
1882
1832
|
program.setOptionValue("tenant", raw.tenant);
|
|
1883
1833
|
if (!(resolved.apiKey || isPublicCommand(actionCommand))) {
|
|
1884
1834
|
console.error(
|
|
1885
|
-
|
|
1835
|
+
chalk10.red(
|
|
1886
1836
|
`\u2717 Error: No Standards instance configured. Run "standards login" or pass --api-key.`
|
|
1887
1837
|
)
|
|
1888
1838
|
);
|
|
@@ -1895,13 +1845,13 @@ async function runProgram(argv = process.argv) {
|
|
|
1895
1845
|
const program = createProgram();
|
|
1896
1846
|
await program.parseAsync(argv).catch((error) => {
|
|
1897
1847
|
if (error instanceof ApiClientError) {
|
|
1898
|
-
if (error.
|
|
1899
|
-
console.error(
|
|
1848
|
+
if (error.status > 0) {
|
|
1849
|
+
console.error(chalk10.red(`\u2717 Error (${error.status}): ${error.message}`));
|
|
1900
1850
|
} else {
|
|
1901
|
-
console.error(
|
|
1851
|
+
console.error(chalk10.red(`\u2717 Error: ${error.message}`));
|
|
1902
1852
|
}
|
|
1903
1853
|
} else if (error instanceof Error) {
|
|
1904
|
-
console.error(
|
|
1854
|
+
console.error(chalk10.red(`\u2717 Error: ${error.message}`));
|
|
1905
1855
|
}
|
|
1906
1856
|
process.exit(1);
|
|
1907
1857
|
});
|
package/package.json
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stndrds/cli",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.295",
|
|
4
4
|
"description": "CLI tool to interact with Standards API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"standards": "./dist/bin.mjs"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
-
"dist"
|
|
10
|
+
"dist",
|
|
11
|
+
"LICENSE",
|
|
12
|
+
"README.md"
|
|
11
13
|
],
|
|
12
14
|
"dependencies": {
|
|
13
15
|
"chalk": "^5.4.1",
|
|
14
16
|
"cli-table3": "^0.6.5",
|
|
15
17
|
"commander": "^13.1.0",
|
|
16
|
-
"@stndrds/
|
|
18
|
+
"@stndrds/client": "1.0.0-alpha.295",
|
|
19
|
+
"@stndrds/schema": "1.0.0-alpha.295"
|
|
17
20
|
},
|
|
18
21
|
"devDependencies": {
|
|
19
22
|
"@types/node": "^25.6.0",
|
|
@@ -30,7 +33,7 @@
|
|
|
30
33
|
"url": "https://github.com/andyoucreate/standards.git",
|
|
31
34
|
"directory": "packages/cli"
|
|
32
35
|
},
|
|
33
|
-
"license": "
|
|
36
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
34
37
|
"author": "AndYouCreate",
|
|
35
38
|
"bugs": {
|
|
36
39
|
"url": "https://github.com/andyoucreate/standards/issues"
|