@antasphere/cli 0.1.0 → 0.1.1
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.js +49 -6
- package/package.json +12 -11
package/dist/bin.js
CHANGED
|
@@ -3056,7 +3056,7 @@ var {
|
|
|
3056
3056
|
Help
|
|
3057
3057
|
} = import_index.default;
|
|
3058
3058
|
|
|
3059
|
-
// ../../node_modules/.pnpm/@antasphere+cli-core@0.
|
|
3059
|
+
// ../../node_modules/.pnpm/@antasphere+cli-core@0.2.0/node_modules/@antasphere/cli-core/dist/config.js
|
|
3060
3060
|
import { chmodSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
3061
3061
|
import { dirname, join } from "node:path";
|
|
3062
3062
|
var HUB_TOOL = "hub";
|
|
@@ -3119,7 +3119,7 @@ function redactKey(key) {
|
|
|
3119
3119
|
return `${key.slice(0, 13)}\u2026${key.slice(-4)}`;
|
|
3120
3120
|
}
|
|
3121
3121
|
|
|
3122
|
-
// ../../node_modules/.pnpm/@antasphere+cli-core@0.
|
|
3122
|
+
// ../../node_modules/.pnpm/@antasphere+cli-core@0.2.0/node_modules/@antasphere/cli-core/dist/io.js
|
|
3123
3123
|
async function ask(io, question) {
|
|
3124
3124
|
if (!io.prompt) {
|
|
3125
3125
|
throw new Error("This command is interactive \u2014 no prompt available (pass the value as a flag).");
|
|
@@ -3134,7 +3134,7 @@ function printJson(io, value) {
|
|
|
3134
3134
|
`);
|
|
3135
3135
|
}
|
|
3136
3136
|
|
|
3137
|
-
// ../../node_modules/.pnpm/@antasphere+cli-core@0.
|
|
3137
|
+
// ../../node_modules/.pnpm/@antasphere+cli-core@0.2.0/node_modules/@antasphere/cli-core/dist/resolve.js
|
|
3138
3138
|
var CliUsageError = class extends Error {
|
|
3139
3139
|
};
|
|
3140
3140
|
var DEFAULT_PROFILE = "default";
|
|
@@ -3149,7 +3149,7 @@ function resolveApiKey(opts) {
|
|
|
3149
3149
|
return opts.flag ?? opts.env[opts.envVar] ?? opts.profile?.apiKey;
|
|
3150
3150
|
}
|
|
3151
3151
|
|
|
3152
|
-
// ../../node_modules/.pnpm/@antasphere+cli-core@0.
|
|
3152
|
+
// ../../node_modules/.pnpm/@antasphere+cli-core@0.2.0/node_modules/@antasphere/cli-core/dist/auth.js
|
|
3153
3153
|
var CliAuthError = class extends Error {
|
|
3154
3154
|
status;
|
|
3155
3155
|
code;
|
|
@@ -17741,7 +17741,13 @@ var apiErrorSchema = external_exports.object({
|
|
|
17741
17741
|
})
|
|
17742
17742
|
});
|
|
17743
17743
|
var workspaceRoleSchema = external_exports.enum(["owner", "admin", "member"]);
|
|
17744
|
-
var scopeSchema = external_exports.enum([
|
|
17744
|
+
var scopeSchema = external_exports.enum([
|
|
17745
|
+
"account:read",
|
|
17746
|
+
"account:write",
|
|
17747
|
+
"data:export",
|
|
17748
|
+
"accounts:status",
|
|
17749
|
+
"sso:exchange"
|
|
17750
|
+
]);
|
|
17745
17751
|
var cursorPageQuerySchema = external_exports.object({
|
|
17746
17752
|
cursor: external_exports.string().optional(),
|
|
17747
17753
|
limit: external_exports.coerce.number().int().min(1).max(100).default(50)
|
|
@@ -18036,6 +18042,32 @@ var accountMemberStatusSchema = external_exports.object({
|
|
|
18036
18042
|
role: workspaceRoleSchema.optional()
|
|
18037
18043
|
});
|
|
18038
18044
|
|
|
18045
|
+
// ../contract/dist/schemas/sso.js
|
|
18046
|
+
var ssoToolTokenRequestSchema = external_exports.object({
|
|
18047
|
+
/**
|
|
18048
|
+
* The target tool's RFC 8707 resource identifier — MUST equal a registered
|
|
18049
|
+
* tool's `resourceUrl` (the hub tool registry is the source of truth);
|
|
18050
|
+
* anything else is a 400. Becomes the JWT `aud`.
|
|
18051
|
+
*/
|
|
18052
|
+
resource: external_exports.url(),
|
|
18053
|
+
/**
|
|
18054
|
+
* Target organization. May be ANY org the key's HOLDER (the user) is a
|
|
18055
|
+
* live ACTIVE member of — the documented gcloud-model deviation (the same
|
|
18056
|
+
* rationale that lets a machine key read GET /orgs). Omit = the key's own
|
|
18057
|
+
* bound workspace. Non-membership, an unknown org, and a deactivated
|
|
18058
|
+
* membership all answer one uniform 403 (no oracle); a suspended org is
|
|
18059
|
+
* refused after the membership check, like every issuance gate.
|
|
18060
|
+
*/
|
|
18061
|
+
workspaceId: external_exports.uuid().optional()
|
|
18062
|
+
});
|
|
18063
|
+
var ssoToolTokenSchema = external_exports.object({
|
|
18064
|
+
token: external_exports.string(),
|
|
18065
|
+
/** Absolute expiry (ISO 8601) — 120 seconds from mint. */
|
|
18066
|
+
expiresAt: external_exports.string(),
|
|
18067
|
+
/** The resolved target organization the token is bound to. */
|
|
18068
|
+
workspaceId: external_exports.string()
|
|
18069
|
+
});
|
|
18070
|
+
|
|
18039
18071
|
// ../contract/dist/schemas/files.js
|
|
18040
18072
|
var fileSchema = external_exports.object({
|
|
18041
18073
|
id: external_exports.string(),
|
|
@@ -18248,6 +18280,17 @@ var PlatformClient = class {
|
|
|
18248
18280
|
accountMemberStatus(workspaceId, userId) {
|
|
18249
18281
|
return this.request("GET", `/accounts/${encodeURIComponent(workspaceId)}/members/${encodeURIComponent(userId)}/status`);
|
|
18250
18282
|
}
|
|
18283
|
+
/**
|
|
18284
|
+
* CLI cross-tool token exchange (hub, delta H3): trade the presenting API
|
|
18285
|
+
* key (scope sso:exchange — CLI keys carry it) for a short-lived (120 s)
|
|
18286
|
+
* single-org SSO JWT audienced to a registered tool's `resource` URL. The
|
|
18287
|
+
* tool's /sso/cli-connect verifies it against the hub JWKS and mints a
|
|
18288
|
+
* tool-local key. `workspaceId` may be any org the key's holder is an
|
|
18289
|
+
* active member of (gcloud model); omitted = the key's bound workspace.
|
|
18290
|
+
*/
|
|
18291
|
+
ssoToolToken(req) {
|
|
18292
|
+
return this.request("POST", "/sso/tool-token", req);
|
|
18293
|
+
}
|
|
18251
18294
|
/** Create an organization (session-only; the caller becomes its owner). */
|
|
18252
18295
|
createOrg(req, opts = {}) {
|
|
18253
18296
|
return this.request("POST", "/orgs", req, idempotencyHeader(opts));
|
|
@@ -18371,7 +18414,7 @@ function requireApiKey(ctx) {
|
|
|
18371
18414
|
}
|
|
18372
18415
|
|
|
18373
18416
|
// src/index.ts
|
|
18374
|
-
var VERSION = "0.1.
|
|
18417
|
+
var VERSION = "0.1.1";
|
|
18375
18418
|
function fmtBytes(n) {
|
|
18376
18419
|
if (n < 1024) return `${n} B`;
|
|
18377
18420
|
if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antasphere/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "The Antasphere account CLI — login, identity, organizations for account.antasphere.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -22,19 +22,20 @@
|
|
|
22
22
|
"files": [
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"@antasphere/cli-core": "^0.1.0",
|
|
27
|
-
"@types/node": "^22.15.0",
|
|
28
|
-
"commander": "^12.1.0",
|
|
29
|
-
"esbuild": "^0.25.0",
|
|
30
|
-
"vitest": "^3.2.0",
|
|
31
|
-
"@antasphere/contract": "0.1.0",
|
|
32
|
-
"@antasphere/sdk": "0.1.0"
|
|
33
|
-
},
|
|
34
25
|
"scripts": {
|
|
35
26
|
"build": "rm -rf dist && esbuild src/bin.ts --bundle --platform=node --format=esm --target=node22 --outfile=dist/bin.js --log-level=warning --banner:js=\"import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);\"",
|
|
27
|
+
"prepack": "npm run build",
|
|
36
28
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
37
29
|
"lint": "eslint src",
|
|
38
30
|
"test": "vitest run --passWithNoTests"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@antasphere/cli-core": "^0.2.0",
|
|
34
|
+
"@antasphere/contract": "workspace:*",
|
|
35
|
+
"@antasphere/sdk": "workspace:*",
|
|
36
|
+
"@types/node": "^22.15.0",
|
|
37
|
+
"commander": "^12.1.0",
|
|
38
|
+
"esbuild": "^0.25.0",
|
|
39
|
+
"vitest": "^3.2.0"
|
|
39
40
|
}
|
|
40
|
-
}
|
|
41
|
+
}
|