@standards/cli 1.0.0-alpha.425 → 1.0.0-alpha.427
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 +17 -5
- package/package.json +4 -4
package/dist/bin.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { createRequire } from "node:module";
|
|
|
5
5
|
import { styleText } from "node:util";
|
|
6
6
|
import { BundleConflictError, StandardsRequestError, createTransport, syncBundle } from "@standards/client";
|
|
7
7
|
import { Command, Option } from "commander";
|
|
8
|
-
import { BUNDLE_LOCALES, COUNT_MODES, DECISION_TYPE_AGENT_SETUP, DECISION_TYPE_BUNDLE_SETUP, ENVIRONMENT_HARNESSES, ENVIRONMENT_IMAGES, ENVIRONMENT_SIZES, LINK_MAX_MS, NotFoundError, PROVIDER_NAMES, RECORD_ACCESS_ROLES, RESOURCE_VISIBILITIES, SchemaError, SchemaErrorCode, ValidationError, canonicalStringify, diffSchemaState, environmentHarness, formatByteSize, formatDecisionLink, isEnvironmentHarnessId, isPlainRecord, parseRecordAccessRole, parseSchemaState, parseSkillSource, schemaStateSourcePayload } from "@standards/schema";
|
|
8
|
+
import { BUNDLE_LOCALES, COUNT_MODES, DECISION_TYPE_AGENT_SETUP, DECISION_TYPE_BUNDLE_SETUP, ENVIRONMENT_HARNESSES, ENVIRONMENT_IMAGES, ENVIRONMENT_SIZES, LINK_MAX_MS, NotFoundError, PROVIDER_NAMES, RECORD_ACCESS_ROLES, RESOURCE_VISIBILITIES, SchemaError, SchemaErrorCode, ValidationError, canonicalStringify, diffSchemaState, environmentHarness, formatByteSize, formatDecisionLink, isEnvironmentHarnessId, isPlainRecord, isSkillRepository, parseRecordAccessRole, parseSchemaState, parseSkillSource, schemaStateSourcePayload } from "@standards/schema";
|
|
9
9
|
import { createWriteStream } from "node:fs";
|
|
10
10
|
import { chmod, lstat, mkdir, readFile, readdir, readlink, stat, symlink, unlink, writeFile } from "node:fs/promises";
|
|
11
11
|
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
@@ -1543,7 +1543,7 @@ async function deviceLogin(options) {
|
|
|
1543
1543
|
print("Press Enter to open the browser…\n");
|
|
1544
1544
|
options.waitForEnter().then(() => options.openBrowser(authorization.verification_uri).catch(() => print("Open the link above on any device.\n"))).catch(() => void 0);
|
|
1545
1545
|
print("Waiting for you to approve… (Ctrl-C to cancel)\n");
|
|
1546
|
-
return await storeKey(options, await pollForToken(as, authorization, http));
|
|
1546
|
+
return await storeKey(options, await pollForToken(as, authorization, resource, http));
|
|
1547
1547
|
} catch (error) {
|
|
1548
1548
|
if (signal.aborted && !(error instanceof LoginFailure)) throw new LoginFailure("Login cancelled. Nothing was saved.", 130);
|
|
1549
1549
|
throw error;
|
|
@@ -1562,12 +1562,15 @@ async function discoverAuthorizationServer(resource, apiUrl, http) {
|
|
|
1562
1562
|
}));
|
|
1563
1563
|
}
|
|
1564
1564
|
/** Polls the token endpoint at the server's interval, slower after each `slow_down`. */
|
|
1565
|
-
async function pollForToken(as, authorization, http) {
|
|
1565
|
+
async function pollForToken(as, authorization, resource, http) {
|
|
1566
1566
|
let interval = authorization.interval ?? DEFAULT_INTERVAL_SECONDS;
|
|
1567
1567
|
for (;;) {
|
|
1568
1568
|
await sleep$2(interval * 1e3, http.signal);
|
|
1569
1569
|
try {
|
|
1570
|
-
const response = await oauth.deviceCodeGrantRequest(as, CLIENT, oauth.None(), authorization.device_code,
|
|
1570
|
+
const response = await oauth.deviceCodeGrantRequest(as, CLIENT, oauth.None(), authorization.device_code, {
|
|
1571
|
+
...http,
|
|
1572
|
+
additionalParameters: { resource: resource.href }
|
|
1573
|
+
});
|
|
1571
1574
|
return (await oauth.processDeviceCodeResponse(as, CLIENT, response)).access_token;
|
|
1572
1575
|
} catch (error) {
|
|
1573
1576
|
if (!(error instanceof oauth.ResponseBodyError)) throw error;
|
|
@@ -2549,9 +2552,18 @@ async function runSkillsSearch(client, query, options = {}) {
|
|
|
2549
2552
|
limit: searchLimit(options.limit)
|
|
2550
2553
|
})).map(catalogRow);
|
|
2551
2554
|
}
|
|
2555
|
+
/** A bare `owner/repo` names a repository, not a skill: the refusal says what to type instead. */
|
|
2556
|
+
function checkSkillSource(source) {
|
|
2557
|
+
const repository = source.trim();
|
|
2558
|
+
if (isSkillRepository(repository)) throw new ValidationError(`"${repository}" is a repository, not a skill. Add one of its skills with standards skills add ${repository}@<skill>; standards skills search lists them.`, [{
|
|
2559
|
+
path: ["source"],
|
|
2560
|
+
message: "a repository, not a skill"
|
|
2561
|
+
}]);
|
|
2562
|
+
parseSkillSource(source);
|
|
2563
|
+
}
|
|
2552
2564
|
/** `standards skills add --dry-run`: what a source would install, the source checked here first. */
|
|
2553
2565
|
async function runSkillsPreview(client, source) {
|
|
2554
|
-
|
|
2566
|
+
checkSkillSource(source);
|
|
2555
2567
|
return await client.skillCatalog.preview({ source });
|
|
2556
2568
|
}
|
|
2557
2569
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@standards/cli",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.427",
|
|
4
4
|
"description": "CLI tool to interact with Standards API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"node": ">=22"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@standards/client": "1.0.0-alpha.
|
|
28
|
-
"@standards/constants": "1.0.0-alpha.
|
|
29
|
-
"@standards/schema": "1.0.0-alpha.
|
|
27
|
+
"@standards/client": "1.0.0-alpha.427",
|
|
28
|
+
"@standards/constants": "1.0.0-alpha.427",
|
|
29
|
+
"@standards/schema": "1.0.0-alpha.427",
|
|
30
30
|
"cli-table3": "^0.6.5",
|
|
31
31
|
"commander": "^13.1.0",
|
|
32
32
|
"jiti": "2.7.0",
|