@dreamboard-games/cli 0.1.30-alpha.30 → 0.1.30-alpha.32
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/README.md +8 -8
- package/dist/agent-verifier/agent-workspace-verifier.mjs +243 -102
- package/dist/agent-verifier/agent-workspace-verifier.mjs.map +1 -1
- package/dist/agent-verifier/{chunk-QMOBTQ5G.mjs → chunk-3SPDNMLA.mjs} +3 -3
- package/dist/agent-verifier/{chunk-QMOBTQ5G.mjs.map → chunk-3SPDNMLA.mjs.map} +1 -1
- package/dist/agent-verifier/{chunk-FNSHNMDY.mjs → chunk-MIRGCMUC.mjs} +3 -10
- package/dist/agent-verifier/chunk-MIRGCMUC.mjs.map +1 -0
- package/dist/agent-verifier/{global-config-SWWR2LP4.mjs → global-config-2NUESNEQ.mjs} +2 -2
- package/dist/agent-verifier/{keychain-backend-UF3Z26JM.mjs → keychain-backend-FF4I6ODB.mjs} +1 -1
- package/dist/agent-verifier/{keychain-backend-UF3Z26JM.mjs.map → keychain-backend-FF4I6ODB.mjs.map} +1 -1
- package/dist/agent-verifier/{materialize-workspace-K4WYFG5E.mjs → materialize-workspace-J2S4XIIC.mjs} +2 -2
- package/dist/agent-verifier/{static-scaffold-MHVM63HU.mjs → static-scaffold-56QBCO6P.mjs} +2 -2
- package/dist/authoring-compatibility-internal.js +1 -1
- package/dist/{chunk-UI7NWSYA.js → chunk-6NYVJYN4.js} +7 -28
- package/dist/chunk-6NYVJYN4.js.map +1 -0
- package/dist/{chunk-RTNKVNQA.js → chunk-DWWMZBFB.js} +247 -158
- package/dist/chunk-DWWMZBFB.js.map +1 -0
- package/dist/{chunk-I4SZ7FA4.js → chunk-TRF7IPXK.js} +3 -9
- package/dist/{chunk-I4SZ7FA4.js.map → chunk-TRF7IPXK.js.map} +1 -1
- package/dist/{global-config-GK2UC2X6.js → global-config-RBMW7IVA.js} +2 -2
- package/dist/index.js +123 -305
- package/dist/index.js.map +1 -1
- package/dist/internal.js +3 -3
- package/dist/internal.js.map +1 -1
- package/dist/{keychain-backend-GO34KGTG.js → keychain-backend-FSNTNTZE.js} +1 -1
- package/dist/{keychain-backend-GO34KGTG.js.map → keychain-backend-FSNTNTZE.js.map} +1 -1
- package/package.json +1 -1
- package/release/authoring-release-set.json +2 -2
- package/skills/dreamboard/SKILL.md +3 -3
- package/skills/dreamboard/references/building-your-first-game.md +1 -1
- package/skills/dreamboard/references/cli.md +20 -19
- package/skills/dreamboard/references/quickstart.md +3 -3
- package/dist/agent-verifier/chunk-FNSHNMDY.mjs.map +0 -1
- package/dist/chunk-RTNKVNQA.js.map +0 -1
- package/dist/chunk-UI7NWSYA.js.map +0 -1
- /package/dist/agent-verifier/{global-config-SWWR2LP4.mjs.map → global-config-2NUESNEQ.mjs.map} +0 -0
- /package/dist/agent-verifier/{materialize-workspace-K4WYFG5E.mjs.map → materialize-workspace-J2S4XIIC.mjs.map} +0 -0
- /package/dist/agent-verifier/{static-scaffold-MHVM63HU.mjs.map → static-scaffold-56QBCO6P.mjs.map} +0 -0
- /package/dist/{global-config-GK2UC2X6.js.map → global-config-RBMW7IVA.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
CAN_SELECT_ENVIRONMENT,
|
|
3
4
|
CONFIG_FLAG_ARGS,
|
|
4
5
|
IS_PUBLISHED_BUILD,
|
|
5
6
|
LOCAL_REGISTRY_URL,
|
|
@@ -10,10 +11,9 @@ import {
|
|
|
10
11
|
configureClient,
|
|
11
12
|
createPkcePair,
|
|
12
13
|
createSessionFromScenario,
|
|
13
|
-
|
|
14
|
+
createUserSessionManager,
|
|
14
15
|
didLocalMaintainerSnapshotChange,
|
|
15
16
|
exchangeClerkOAuthCode,
|
|
16
|
-
exchangeDreamboardUserToken,
|
|
17
17
|
formatCliError,
|
|
18
18
|
generateReducerNativeArtifacts,
|
|
19
19
|
getAuthTokenExpiry,
|
|
@@ -34,11 +34,9 @@ import {
|
|
|
34
34
|
parseNewCommandArgs,
|
|
35
35
|
parsePlayerCountFlags,
|
|
36
36
|
parsePositiveInt,
|
|
37
|
-
parseProjectRepositoryCommandArgs,
|
|
38
37
|
parseReleasePublishCommandArgs,
|
|
39
38
|
presentCliError,
|
|
40
39
|
projectIdFromSessionGameSource,
|
|
41
|
-
refreshResolvedAuthSession,
|
|
42
40
|
requireAuth,
|
|
43
41
|
resolveConfig,
|
|
44
42
|
resolveLocalHarnessAccessToken,
|
|
@@ -49,7 +47,7 @@ import {
|
|
|
49
47
|
titleFromSlug,
|
|
50
48
|
toDreamboardApiError,
|
|
51
49
|
waitForCompiledResultJobSdk
|
|
52
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-DWWMZBFB.js";
|
|
53
51
|
import {
|
|
54
52
|
applyWorkspaceCodegen,
|
|
55
53
|
collectLocalFiles,
|
|
@@ -78,24 +76,20 @@ import {
|
|
|
78
76
|
publishProjectRelease,
|
|
79
77
|
reconcileWorkspaceDependencies,
|
|
80
78
|
resolveCliRepoRoot,
|
|
81
|
-
retryProjectRepositoryReconciliation,
|
|
82
79
|
scaffoldStaticWorkspace,
|
|
83
80
|
updateProjectEnvironmentState,
|
|
84
81
|
updateProjectLocalMaintainerRegistry,
|
|
85
82
|
updateProjectState,
|
|
86
83
|
writeSnapshot
|
|
87
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-TRF7IPXK.js";
|
|
88
85
|
import {
|
|
89
|
-
clearCredentials,
|
|
90
86
|
getActiveCredentialBackendName,
|
|
91
87
|
getGlobalAuthPath,
|
|
92
88
|
getGlobalConfigPath,
|
|
93
89
|
getStoredSession,
|
|
94
90
|
loadGlobalConfig,
|
|
95
|
-
saveGlobalConfig
|
|
96
|
-
|
|
97
|
-
setCredentials
|
|
98
|
-
} from "./chunk-UI7NWSYA.js";
|
|
91
|
+
saveGlobalConfig
|
|
92
|
+
} from "./chunk-6NYVJYN4.js";
|
|
99
93
|
import {
|
|
100
94
|
DEFAULT_LOGIN_TIMEOUT_MS,
|
|
101
95
|
MANIFEST_TYPECHECK_CONFIG_FILE,
|
|
@@ -110,6 +104,9 @@ import {
|
|
|
110
104
|
} from "./chunk-EQNBQVIW.js";
|
|
111
105
|
import "./chunk-2H7UOFLK.js";
|
|
112
106
|
|
|
107
|
+
// src/cli-main.ts
|
|
108
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
109
|
+
|
|
113
110
|
// ../../node_modules/.pnpm/citty@0.2.2/node_modules/citty/dist/_chunks/libs/scule.mjs
|
|
114
111
|
var NUMBER_CHAR_RE = /\d/;
|
|
115
112
|
var STR_SPLITTERS = [
|
|
@@ -1654,7 +1651,7 @@ function createConsola2(options = {}) {
|
|
|
1654
1651
|
if (process.env.CONSOLA_LEVEL) {
|
|
1655
1652
|
level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
|
|
1656
1653
|
}
|
|
1657
|
-
const
|
|
1654
|
+
const consola2 = createConsola({
|
|
1658
1655
|
level,
|
|
1659
1656
|
defaults: { level },
|
|
1660
1657
|
stdout: process.stdout,
|
|
@@ -1665,7 +1662,7 @@ function createConsola2(options = {}) {
|
|
|
1665
1662
|
],
|
|
1666
1663
|
...options
|
|
1667
1664
|
});
|
|
1668
|
-
return
|
|
1665
|
+
return consola2;
|
|
1669
1666
|
}
|
|
1670
1667
|
function _getDefaultLogLevel() {
|
|
1671
1668
|
if (g) {
|
|
@@ -2073,7 +2070,7 @@ async function runGitCredentialHelper(input = {}) {
|
|
|
2073
2070
|
policy: {
|
|
2074
2071
|
allowedHosts: resolveAllowedGitHosts(env2)
|
|
2075
2072
|
},
|
|
2076
|
-
tokenManager:
|
|
2073
|
+
tokenManager: createUserSessionManager(
|
|
2077
2074
|
resolveConfig(
|
|
2078
2075
|
await loadGlobalConfig(),
|
|
2079
2076
|
{},
|
|
@@ -2101,6 +2098,7 @@ async function readAll(stream) {
|
|
|
2101
2098
|
}
|
|
2102
2099
|
|
|
2103
2100
|
// src/commands/auth.ts
|
|
2101
|
+
var PUBLISHED_AUTH_ACTIONS = /* @__PURE__ */ new Set(["login", "logout", "status"]);
|
|
2104
2102
|
async function loginWithBrowser(config, quiet) {
|
|
2105
2103
|
const state = crypto2.randomUUID();
|
|
2106
2104
|
const pkce = createPkcePair();
|
|
@@ -2157,13 +2155,13 @@ async function runAuthAction(rawArgs) {
|
|
|
2157
2155
|
await runGitCredentialHelper();
|
|
2158
2156
|
return;
|
|
2159
2157
|
}
|
|
2160
|
-
if (IS_PUBLISHED_BUILD && action
|
|
2158
|
+
if (IS_PUBLISHED_BUILD && !PUBLISHED_AUTH_ACTIONS.has(action) && !(CAN_SELECT_ENVIRONMENT && action === "env")) {
|
|
2161
2159
|
throw new Error(
|
|
2162
|
-
"The published Dreamboard CLI
|
|
2160
|
+
"The published Dreamboard CLI supports auth login, logout, and status."
|
|
2163
2161
|
);
|
|
2164
2162
|
}
|
|
2165
2163
|
if (action === "env") {
|
|
2166
|
-
if (
|
|
2164
|
+
if (!CAN_SELECT_ENVIRONMENT) {
|
|
2167
2165
|
throw new Error(
|
|
2168
2166
|
"The published Dreamboard CLI is production-only and does not support switching environments."
|
|
2169
2167
|
);
|
|
@@ -2192,12 +2190,24 @@ async function runAuthAction(rawArgs) {
|
|
|
2192
2190
|
}
|
|
2193
2191
|
const token = parsedArgs.tokenValue ?? parsedArgs.token ?? "";
|
|
2194
2192
|
if (!token) throw new Error("Usage: dreamboard auth set <token>");
|
|
2195
|
-
|
|
2193
|
+
const config = resolveConfig(
|
|
2194
|
+
globalConfig,
|
|
2195
|
+
{ env: parsedArgs.env },
|
|
2196
|
+
void 0,
|
|
2197
|
+
await getStoredSession()
|
|
2198
|
+
);
|
|
2199
|
+
await createUserSessionManager(config).establishAccessOnlySession(token);
|
|
2196
2200
|
consola.success(`Auth token saved to ${getGlobalAuthPath()}.`);
|
|
2197
2201
|
return;
|
|
2198
2202
|
}
|
|
2199
2203
|
if (action === "logout") {
|
|
2200
|
-
|
|
2204
|
+
const config = resolveConfig(
|
|
2205
|
+
globalConfig,
|
|
2206
|
+
{ env: parsedArgs.env },
|
|
2207
|
+
void 0,
|
|
2208
|
+
await getStoredSession()
|
|
2209
|
+
);
|
|
2210
|
+
await createUserSessionManager(config).logout();
|
|
2201
2211
|
consola.success(
|
|
2202
2212
|
`Stored Dreamboard session cleared from ${getGlobalAuthPath()}.`
|
|
2203
2213
|
);
|
|
@@ -2205,80 +2215,65 @@ async function runAuthAction(rawArgs) {
|
|
|
2205
2215
|
}
|
|
2206
2216
|
if (action === "login") {
|
|
2207
2217
|
const shouldPrintJwt = !IS_PUBLISHED_BUILD && parsedArgs.jwt === true;
|
|
2208
|
-
const environment =
|
|
2218
|
+
const environment = !CAN_SELECT_ENVIRONMENT ? PUBLISHED_ENVIRONMENT : parsedArgs.env || globalConfig.environment || (IS_PUBLISHED_BUILD ? PUBLISHED_ENVIRONMENT : "staging");
|
|
2209
2219
|
const storedSession = await getStoredSession();
|
|
2210
|
-
let accessToken = storedSession?.accessToken;
|
|
2211
|
-
let refreshToken = storedSession?.refreshToken;
|
|
2212
|
-
let tokenExpiresAt = storedSession?.tokenExpiresAt;
|
|
2213
|
-
let clerkOAuthTokenUrl = storedSession?.clerkOAuthTokenUrl;
|
|
2214
|
-
let didRefreshStoredSession = false;
|
|
2215
|
-
let didUseBrowserLogin = false;
|
|
2216
2220
|
const resolvedConfig = resolveConfig(
|
|
2217
2221
|
globalConfig,
|
|
2218
2222
|
{ env: environment },
|
|
2219
2223
|
void 0,
|
|
2220
2224
|
storedSession
|
|
2221
2225
|
);
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2226
|
+
const sessionManager = createUserSessionManager(resolvedConfig);
|
|
2227
|
+
const existingStatus = await sessionManager.inspectSession();
|
|
2228
|
+
if (existingStatus.kind === "active") {
|
|
2229
|
+
if (shouldPrintJwt) {
|
|
2230
|
+
const current = await getStoredSession();
|
|
2231
|
+
process.stdout.write(
|
|
2232
|
+
`${JSON.stringify(
|
|
2233
|
+
{
|
|
2234
|
+
token: current?.accessToken ?? existingStatus.apiToken.token,
|
|
2235
|
+
refreshToken: current?.refreshToken ?? null,
|
|
2236
|
+
environment
|
|
2237
|
+
},
|
|
2238
|
+
null,
|
|
2239
|
+
2
|
|
2240
|
+
)}
|
|
2241
|
+
`
|
|
2242
|
+
);
|
|
2243
|
+
} else if (existingStatus.repaired) {
|
|
2244
|
+
consola.success(
|
|
2245
|
+
`Stored Dreamboard session repaired and saved to ${getGlobalAuthPath()}`
|
|
2246
|
+
);
|
|
2247
|
+
} else {
|
|
2248
|
+
consola.success(
|
|
2249
|
+
`Stored Dreamboard session is active in ${getGlobalAuthPath()}`
|
|
2233
2250
|
);
|
|
2234
|
-
accessToken = void 0;
|
|
2235
|
-
refreshToken = void 0;
|
|
2236
2251
|
}
|
|
2252
|
+
return;
|
|
2237
2253
|
}
|
|
2238
|
-
if (
|
|
2239
|
-
|
|
2240
|
-
resolvedConfig,
|
|
2241
|
-
shouldPrintJwt
|
|
2242
|
-
);
|
|
2243
|
-
accessToken = browserLogin.token;
|
|
2244
|
-
refreshToken = browserLogin.refreshToken;
|
|
2245
|
-
tokenExpiresAt = browserLogin.expiresAt;
|
|
2246
|
-
clerkOAuthTokenUrl = browserLogin.tokenUrl;
|
|
2247
|
-
didUseBrowserLogin = true;
|
|
2248
|
-
}
|
|
2249
|
-
if (!accessToken) {
|
|
2250
|
-
throw new Error("Login completed but no access token was returned.");
|
|
2254
|
+
if (existingStatus.kind === "degraded" || existingStatus.kind === "invalid") {
|
|
2255
|
+
consola.warn(existingStatus.message);
|
|
2251
2256
|
}
|
|
2257
|
+
const browserLogin = await loginWithBrowser(resolvedConfig, shouldPrintJwt);
|
|
2252
2258
|
await saveGlobalConfig({
|
|
2253
2259
|
...globalConfig,
|
|
2254
2260
|
environment
|
|
2255
2261
|
});
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
tokenExpiresAt,
|
|
2266
|
-
dreamboardApiToken: dreamboardApiToken.accessToken,
|
|
2267
|
-
dreamboardApiExpiresAt: dreamboardApiToken.expiresAt,
|
|
2268
|
-
clerkOAuthIssuer: resolvedConfig.clerkOAuthIssuer,
|
|
2269
|
-
clerkOAuthClientId: resolvedConfig.clerkOAuthClientId,
|
|
2270
|
-
clerkOAuthTokenUrl,
|
|
2271
|
-
environment
|
|
2272
|
-
});
|
|
2273
|
-
} else {
|
|
2274
|
-
await setAccessOnlySession(accessToken);
|
|
2275
|
-
}
|
|
2262
|
+
await sessionManager.establishRefreshableSession({
|
|
2263
|
+
clerkAccessToken: browserLogin.token,
|
|
2264
|
+
refreshToken: browserLogin.refreshToken,
|
|
2265
|
+
clerkAccessExpiresAt: browserLogin.expiresAt,
|
|
2266
|
+
clerkOAuthIssuer: resolvedConfig.clerkOAuthIssuer,
|
|
2267
|
+
clerkOAuthClientId: resolvedConfig.clerkOAuthClientId,
|
|
2268
|
+
clerkOAuthTokenUrl: browserLogin.tokenUrl,
|
|
2269
|
+
environment
|
|
2270
|
+
});
|
|
2276
2271
|
if (shouldPrintJwt) {
|
|
2277
2272
|
process.stdout.write(
|
|
2278
2273
|
`${JSON.stringify(
|
|
2279
2274
|
{
|
|
2280
|
-
token:
|
|
2281
|
-
refreshToken: refreshToken
|
|
2275
|
+
token: browserLogin.token,
|
|
2276
|
+
refreshToken: browserLogin.refreshToken,
|
|
2282
2277
|
environment
|
|
2283
2278
|
},
|
|
2284
2279
|
null,
|
|
@@ -2288,19 +2283,9 @@ async function runAuthAction(rawArgs) {
|
|
|
2288
2283
|
);
|
|
2289
2284
|
return;
|
|
2290
2285
|
}
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
);
|
|
2295
|
-
} else if (storedSession?.accessToken && didRefreshStoredSession) {
|
|
2296
|
-
consola.success(
|
|
2297
|
-
`Stored auth session refreshed and saved to ${getGlobalAuthPath()}`
|
|
2298
|
-
);
|
|
2299
|
-
} else if (storedSession?.accessToken) {
|
|
2300
|
-
consola.success(
|
|
2301
|
-
`Stored auth token found. Session data remains in ${getGlobalAuthPath()}`
|
|
2302
|
-
);
|
|
2303
|
-
}
|
|
2286
|
+
consola.success(
|
|
2287
|
+
`Browser login successful. Session saved to ${getGlobalAuthPath()}`
|
|
2288
|
+
);
|
|
2304
2289
|
return;
|
|
2305
2290
|
}
|
|
2306
2291
|
if (action === "status") {
|
|
@@ -2311,69 +2296,47 @@ async function runAuthAction(rawArgs) {
|
|
|
2311
2296
|
void 0,
|
|
2312
2297
|
storedSession
|
|
2313
2298
|
);
|
|
2314
|
-
const environment =
|
|
2315
|
-
const
|
|
2299
|
+
const environment = resolvedConfig.environment;
|
|
2300
|
+
const status = await createUserSessionManager(resolvedConfig).inspectSession();
|
|
2316
2301
|
const backendName = await getActiveCredentialBackendName();
|
|
2317
2302
|
consola.log(`Environment: ${environment}`);
|
|
2318
|
-
consola.log(`Auth token source: ${resolvedConfig.authTokenSource}`);
|
|
2319
|
-
consola.log(`Refresh token source: ${resolvedConfig.refreshTokenSource}`);
|
|
2320
2303
|
consola.log(
|
|
2321
2304
|
`Credential backend: ${backendName}${backendName === "keychain" ? " (OS keychain via @napi-rs/keyring)" : ` (${getGlobalAuthPath()})`}`
|
|
2322
2305
|
);
|
|
2323
|
-
|
|
2324
|
-
if (
|
|
2325
|
-
consola.log(
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
'Credential backend preference (config): file (default; set `"credentialBackend": "keychain"` in config.json to opt in)'
|
|
2329
|
-
);
|
|
2306
|
+
consola.log(`Config path: ${getGlobalConfigPath()}`);
|
|
2307
|
+
if (status.kind === "none") {
|
|
2308
|
+
consola.log("Session state: none");
|
|
2309
|
+
consola.warn("No Dreamboard session found.");
|
|
2310
|
+
return;
|
|
2330
2311
|
}
|
|
2331
|
-
if (
|
|
2332
|
-
consola.log(
|
|
2333
|
-
|
|
2312
|
+
if (status.kind === "degraded") {
|
|
2313
|
+
consola.log("Session state: degraded (refreshable)");
|
|
2314
|
+
consola.warn(
|
|
2315
|
+
`Stored Dreamboard session is refreshable but currently API-unusable: ${status.message}`
|
|
2334
2316
|
);
|
|
2317
|
+
return;
|
|
2335
2318
|
}
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
consola.warn(
|
|
2319
|
+
if (status.kind === "invalid") {
|
|
2320
|
+
consola.log(`Session state: invalid (${status.sessionKind})`);
|
|
2321
|
+
consola.warn(status.message);
|
|
2339
2322
|
return;
|
|
2340
2323
|
}
|
|
2341
|
-
|
|
2342
|
-
|
|
2324
|
+
consola.log(`Session state: active (${status.sessionKind})`);
|
|
2325
|
+
const authTokenExpiry = status.apiToken.expiresAt !== void 0 ? new Date(status.apiToken.expiresAt) : getAuthTokenExpiry(status.apiToken.token);
|
|
2326
|
+
if (authTokenExpiry && Number.isFinite(authTokenExpiry.getTime())) {
|
|
2343
2327
|
consola.log(
|
|
2344
|
-
`
|
|
2328
|
+
`Dreamboard API token expires at: ${authTokenExpiry.toISOString()} (active)`
|
|
2345
2329
|
);
|
|
2346
|
-
if (isExpired) {
|
|
2347
|
-
if (!resolvedConfig.refreshToken) {
|
|
2348
|
-
consola.warn(
|
|
2349
|
-
"Access token is expired and no refresh token is available. Run `dreamboard auth login` to authenticate again."
|
|
2350
|
-
);
|
|
2351
|
-
return;
|
|
2352
|
-
}
|
|
2353
|
-
const refreshed = await refreshResolvedAuthSession(resolvedConfig);
|
|
2354
|
-
if (!refreshed?.accessToken) {
|
|
2355
|
-
consola.warn(
|
|
2356
|
-
"Access token is expired and refresh did not return a new session."
|
|
2357
|
-
);
|
|
2358
|
-
return;
|
|
2359
|
-
}
|
|
2360
|
-
const refreshedExpiry = getAuthTokenExpiry(refreshed.accessToken);
|
|
2361
|
-
consola.success("Access token was expired and has been refreshed.");
|
|
2362
|
-
if (refreshedExpiry) {
|
|
2363
|
-
consola.log(
|
|
2364
|
-
`Refreshed access token expires at: ${refreshedExpiry.toISOString()}`
|
|
2365
|
-
);
|
|
2366
|
-
}
|
|
2367
|
-
return;
|
|
2368
|
-
}
|
|
2369
2330
|
} else {
|
|
2370
|
-
consola.log("
|
|
2331
|
+
consola.log("Dreamboard API token expiry: unavailable");
|
|
2371
2332
|
}
|
|
2372
|
-
consola.success(
|
|
2333
|
+
consola.success(
|
|
2334
|
+
status.repaired ? "Dreamboard session was repaired and is active." : "Dreamboard session is active."
|
|
2335
|
+
);
|
|
2373
2336
|
return;
|
|
2374
2337
|
}
|
|
2375
2338
|
throw new Error(
|
|
2376
|
-
IS_PUBLISHED_BUILD ? "Usage:\n dreamboard auth login\n dreamboard auth logout" : "Usage:\n dreamboard auth login [--env <local|staging|prod>] [--jwt]\n dreamboard auth logout\n dreamboard auth set <token>\n dreamboard auth env <local|staging|prod>\n dreamboard auth status [--env <local|staging|prod>]"
|
|
2339
|
+
IS_PUBLISHED_BUILD ? "Usage:\n dreamboard auth login\n dreamboard auth logout\n dreamboard auth status" : "Usage:\n dreamboard auth login [--env <local|staging|prod>] [--jwt]\n dreamboard auth logout\n dreamboard auth set <token>\n dreamboard auth env <local|staging|prod>\n dreamboard auth status [--env <local|staging|prod>]"
|
|
2377
2340
|
);
|
|
2378
2341
|
}
|
|
2379
2342
|
function defineAuthActionCommand(options) {
|
|
@@ -2396,16 +2359,18 @@ var auth_default = defineCommand({
|
|
|
2396
2359
|
name: "login",
|
|
2397
2360
|
description: "Open browser login and store a refreshable session",
|
|
2398
2361
|
action: "login",
|
|
2399
|
-
args:
|
|
2362
|
+
args: CAN_SELECT_ENVIRONMENT ? {
|
|
2400
2363
|
env: {
|
|
2401
2364
|
type: "string",
|
|
2402
2365
|
description: "Environment: local | staging | prod"
|
|
2403
2366
|
},
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2367
|
+
...IS_PUBLISHED_BUILD ? {} : {
|
|
2368
|
+
jwt: {
|
|
2369
|
+
type: "boolean",
|
|
2370
|
+
description: "Print auth token JSON to stdout"
|
|
2371
|
+
}
|
|
2407
2372
|
}
|
|
2408
|
-
}
|
|
2373
|
+
} : {}
|
|
2409
2374
|
}),
|
|
2410
2375
|
logout: defineAuthActionCommand({
|
|
2411
2376
|
name: "logout",
|
|
@@ -2416,12 +2381,12 @@ var auth_default = defineCommand({
|
|
|
2416
2381
|
name: "status",
|
|
2417
2382
|
description: "Show stored Dreamboard session status",
|
|
2418
2383
|
action: "status",
|
|
2419
|
-
args:
|
|
2384
|
+
args: CAN_SELECT_ENVIRONMENT ? {
|
|
2420
2385
|
env: {
|
|
2421
2386
|
type: "string",
|
|
2422
2387
|
description: "Environment: local | staging | prod"
|
|
2423
2388
|
}
|
|
2424
|
-
}
|
|
2389
|
+
} : {}
|
|
2425
2390
|
}),
|
|
2426
2391
|
"git-credential": defineAuthActionCommand({
|
|
2427
2392
|
name: "git-credential",
|
|
@@ -2557,19 +2522,6 @@ async function getProjectRepositorySdk(projectId) {
|
|
|
2557
2522
|
}
|
|
2558
2523
|
return data;
|
|
2559
2524
|
}
|
|
2560
|
-
async function retryProjectRepositoryReconciliationSdk(projectId) {
|
|
2561
|
-
const { data, error, response } = await retryProjectRepositoryReconciliation({
|
|
2562
|
-
path: { projectId }
|
|
2563
|
-
});
|
|
2564
|
-
if (error || !data) {
|
|
2565
|
-
throw toDreamboardApiError(
|
|
2566
|
-
error,
|
|
2567
|
-
response,
|
|
2568
|
-
"Failed to retry project repository reconciliation"
|
|
2569
|
-
);
|
|
2570
|
-
}
|
|
2571
|
-
return data;
|
|
2572
|
-
}
|
|
2573
2525
|
async function pollProjectRepository(options) {
|
|
2574
2526
|
const intervalMs = options.intervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
2575
2527
|
const fetchRepository = options.fetchRepository ?? getProjectRepositorySdk;
|
|
@@ -3089,7 +3041,7 @@ async function resolveDevHostBearer(config) {
|
|
|
3089
3041
|
message: "Stored Dreamboard session is expired or invalid. Run `dreamboard auth login` to authenticate again."
|
|
3090
3042
|
};
|
|
3091
3043
|
}
|
|
3092
|
-
const resolved = await
|
|
3044
|
+
const resolved = await createUserSessionManager(config).resolveApiToken();
|
|
3093
3045
|
return { kind: "ok", token: resolved?.token ?? null };
|
|
3094
3046
|
}
|
|
3095
3047
|
|
|
@@ -4172,7 +4124,7 @@ var dev_default = defineCommand({
|
|
|
4172
4124
|
config
|
|
4173
4125
|
});
|
|
4174
4126
|
const effectiveProjectConfig = remoteProject.projectConfig;
|
|
4175
|
-
const effectiveAuthToken = resolveLocalHarnessAccessToken(config) ?? (await
|
|
4127
|
+
const effectiveAuthToken = resolveLocalHarnessAccessToken(config) ?? (await createUserSessionManager(config).resolveApiToken())?.token ?? config.authToken;
|
|
4176
4128
|
const devCompile = await ensureDevCompiledResult({
|
|
4177
4129
|
projectRoot,
|
|
4178
4130
|
projectConfig: effectiveProjectConfig,
|
|
@@ -5072,8 +5024,6 @@ Refusing to publish a mutated checkout.`
|
|
|
5072
5024
|
// src/commands/project.ts
|
|
5073
5025
|
var DEFAULT_STATUS_WAIT_TIMEOUT_MS = 12e4;
|
|
5074
5026
|
var DEFAULT_STATUS_POLL_INTERVAL_MS = 1e3;
|
|
5075
|
-
var DEFAULT_REPOSITORY_WAIT_TIMEOUT_MS3 = 12e4;
|
|
5076
|
-
var DEFAULT_REPOSITORY_POLL_INTERVAL_MS3 = 1e3;
|
|
5077
5027
|
function parsePositiveIntegerFlag3(value, flagName, defaultValue) {
|
|
5078
5028
|
if (value === void 0) {
|
|
5079
5029
|
return defaultValue;
|
|
@@ -5087,35 +5037,6 @@ function parsePositiveIntegerFlag3(value, flagName, defaultValue) {
|
|
|
5087
5037
|
function sleep(ms) {
|
|
5088
5038
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
5089
5039
|
}
|
|
5090
|
-
async function configureAuthenticatedClient(args) {
|
|
5091
|
-
const [globalConfig, storedSession] = await Promise.all([
|
|
5092
|
-
loadGlobalConfig(),
|
|
5093
|
-
getStoredSession()
|
|
5094
|
-
]);
|
|
5095
|
-
const config = resolveConfig(globalConfig, args, void 0, storedSession);
|
|
5096
|
-
requireAuth(config);
|
|
5097
|
-
await configureClient(config);
|
|
5098
|
-
}
|
|
5099
|
-
function repositorySummary(repository) {
|
|
5100
|
-
const retryable = repository.retryable ? ", retryable" : "";
|
|
5101
|
-
const error = repository.errorCode ? `, error=${repository.errorCode}` : "";
|
|
5102
|
-
return [
|
|
5103
|
-
`state=${repository.provisioningState}`,
|
|
5104
|
-
`clone=${repository.cloneUrl}`,
|
|
5105
|
-
`defaultBranch=${repository.defaultBranch}`,
|
|
5106
|
-
`generation=${repository.observedGeneration}/${repository.desiredGeneration}${retryable}${error}`
|
|
5107
|
-
].join(", ");
|
|
5108
|
-
}
|
|
5109
|
-
async function maybePollRepository(options) {
|
|
5110
|
-
if (!options.wait || options.initialRepository.provisioningState === "READY") {
|
|
5111
|
-
return options.initialRepository;
|
|
5112
|
-
}
|
|
5113
|
-
return pollProjectRepository({
|
|
5114
|
-
projectId: options.projectId,
|
|
5115
|
-
timeoutMs: options.timeoutMs,
|
|
5116
|
-
intervalMs: options.intervalMs
|
|
5117
|
-
});
|
|
5118
|
-
}
|
|
5119
5040
|
function isPendingStatus(status) {
|
|
5120
5041
|
if (!status.source.observed) {
|
|
5121
5042
|
return true;
|
|
@@ -5129,7 +5050,9 @@ function isPendingStatus(status) {
|
|
|
5129
5050
|
if (status.previews.some((preview) => preview.status === "PENDING_RETENTION")) {
|
|
5130
5051
|
return true;
|
|
5131
5052
|
}
|
|
5132
|
-
return status.releases.some(
|
|
5053
|
+
return status.releases.some(
|
|
5054
|
+
(release) => release.status === "PENDING_RETENTION"
|
|
5055
|
+
);
|
|
5133
5056
|
}
|
|
5134
5057
|
async function maybePollProjectCommitStatus(options) {
|
|
5135
5058
|
if (!options.wait || !isPendingStatus(options.initialStatus)) {
|
|
@@ -5169,117 +5092,6 @@ function projectStatusSummary(status) {
|
|
|
5169
5092
|
releases
|
|
5170
5093
|
].join(" ");
|
|
5171
5094
|
}
|
|
5172
|
-
var repositoryArgs = {
|
|
5173
|
-
project: {
|
|
5174
|
-
type: "string",
|
|
5175
|
-
description: "Project ID",
|
|
5176
|
-
required: true
|
|
5177
|
-
},
|
|
5178
|
-
wait: {
|
|
5179
|
-
type: "boolean",
|
|
5180
|
-
description: "Wait for repository reconciliation to reach a terminal state",
|
|
5181
|
-
default: false
|
|
5182
|
-
},
|
|
5183
|
-
"wait-timeout-ms": {
|
|
5184
|
-
type: "string",
|
|
5185
|
-
description: "Maximum time to wait for Git repository setup"
|
|
5186
|
-
},
|
|
5187
|
-
"repository-poll-interval-ms": {
|
|
5188
|
-
type: "string",
|
|
5189
|
-
description: "Polling interval for Git repository setup"
|
|
5190
|
-
},
|
|
5191
|
-
json: {
|
|
5192
|
-
type: "boolean",
|
|
5193
|
-
description: "Print machine-readable repository JSON",
|
|
5194
|
-
default: false
|
|
5195
|
-
},
|
|
5196
|
-
...CONFIG_FLAG_ARGS
|
|
5197
|
-
};
|
|
5198
|
-
async function runRepositoryCommand(commandName, args, action) {
|
|
5199
|
-
const parsedArgs = parseProjectRepositoryCommandArgs(commandName, args);
|
|
5200
|
-
const waitTimeoutMs = parsePositiveIntegerFlag3(
|
|
5201
|
-
parsedArgs["wait-timeout-ms"],
|
|
5202
|
-
"--wait-timeout-ms",
|
|
5203
|
-
DEFAULT_REPOSITORY_WAIT_TIMEOUT_MS3
|
|
5204
|
-
);
|
|
5205
|
-
const pollIntervalMs = parsePositiveIntegerFlag3(
|
|
5206
|
-
parsedArgs["repository-poll-interval-ms"],
|
|
5207
|
-
"--repository-poll-interval-ms",
|
|
5208
|
-
DEFAULT_REPOSITORY_POLL_INTERVAL_MS3
|
|
5209
|
-
);
|
|
5210
|
-
await configureAuthenticatedClient(parsedArgs);
|
|
5211
|
-
const repository = await action(parsedArgs.project);
|
|
5212
|
-
if (!repository) {
|
|
5213
|
-
throw new Error(
|
|
5214
|
-
`Repository binding not found for project ${parsedArgs.project}.`
|
|
5215
|
-
);
|
|
5216
|
-
}
|
|
5217
|
-
const finalRepository = await maybePollRepository({
|
|
5218
|
-
projectId: parsedArgs.project,
|
|
5219
|
-
wait: parsedArgs.wait,
|
|
5220
|
-
timeoutMs: waitTimeoutMs,
|
|
5221
|
-
intervalMs: pollIntervalMs,
|
|
5222
|
-
initialRepository: repository
|
|
5223
|
-
});
|
|
5224
|
-
printJsonOrSummary({
|
|
5225
|
-
json: parsedArgs.json,
|
|
5226
|
-
value: finalRepository,
|
|
5227
|
-
summary: repositorySummary(finalRepository)
|
|
5228
|
-
});
|
|
5229
|
-
}
|
|
5230
|
-
var cmdProjectRepositoryGet = defineCommand({
|
|
5231
|
-
meta: {
|
|
5232
|
-
name: "get",
|
|
5233
|
-
description: "Show a project's Git repository binding"
|
|
5234
|
-
},
|
|
5235
|
-
args: repositoryArgs,
|
|
5236
|
-
async run({ args }) {
|
|
5237
|
-
await runRepositoryCommand(
|
|
5238
|
-
"project repository get",
|
|
5239
|
-
args,
|
|
5240
|
-
getProjectRepositorySdk
|
|
5241
|
-
);
|
|
5242
|
-
}
|
|
5243
|
-
});
|
|
5244
|
-
var cmdProjectRepositoryEnsure = defineCommand({
|
|
5245
|
-
meta: {
|
|
5246
|
-
name: "ensure",
|
|
5247
|
-
description: "Ensure a project's Git repository binding exists"
|
|
5248
|
-
},
|
|
5249
|
-
args: repositoryArgs,
|
|
5250
|
-
async run({ args }) {
|
|
5251
|
-
await runRepositoryCommand(
|
|
5252
|
-
"project repository ensure",
|
|
5253
|
-
args,
|
|
5254
|
-
ensureProjectRepositorySdk
|
|
5255
|
-
);
|
|
5256
|
-
}
|
|
5257
|
-
});
|
|
5258
|
-
var cmdProjectRepositoryRetry = defineCommand({
|
|
5259
|
-
meta: {
|
|
5260
|
-
name: "retry",
|
|
5261
|
-
description: "Retry Git repository reconciliation for a project"
|
|
5262
|
-
},
|
|
5263
|
-
args: repositoryArgs,
|
|
5264
|
-
async run({ args }) {
|
|
5265
|
-
await runRepositoryCommand(
|
|
5266
|
-
"project repository retry",
|
|
5267
|
-
args,
|
|
5268
|
-
retryProjectRepositoryReconciliationSdk
|
|
5269
|
-
);
|
|
5270
|
-
}
|
|
5271
|
-
});
|
|
5272
|
-
var cmdProjectRepository = defineCommand({
|
|
5273
|
-
meta: {
|
|
5274
|
-
name: "repository",
|
|
5275
|
-
description: "Inspect and reconcile project Git repository bindings"
|
|
5276
|
-
},
|
|
5277
|
-
subCommands: {
|
|
5278
|
-
get: cmdProjectRepositoryGet,
|
|
5279
|
-
ensure: cmdProjectRepositoryEnsure,
|
|
5280
|
-
retry: cmdProjectRepositoryRetry
|
|
5281
|
-
}
|
|
5282
|
-
});
|
|
5283
5095
|
var cmdProjectStatus = defineCommand({
|
|
5284
5096
|
meta: {
|
|
5285
5097
|
name: "status",
|
|
@@ -5318,10 +5130,7 @@ var cmdProjectStatus = defineCommand({
|
|
|
5318
5130
|
"wait-timeout-ms": typeof args["wait-timeout-ms"] === "string" ? args["wait-timeout-ms"] : void 0,
|
|
5319
5131
|
"status-poll-interval-ms": typeof args["status-poll-interval-ms"] === "string" ? args["status-poll-interval-ms"] : void 0
|
|
5320
5132
|
};
|
|
5321
|
-
const { projectConfig, commitOid } = await resolveCommitScopedProjectContext(
|
|
5322
|
-
parsedArgs,
|
|
5323
|
-
parsedArgs.commit
|
|
5324
|
-
);
|
|
5133
|
+
const { projectConfig, commitOid } = await resolveCommitScopedProjectContext(parsedArgs, parsedArgs.commit);
|
|
5325
5134
|
const initialStatus = await getProjectCommitStatusSdk({
|
|
5326
5135
|
projectId: projectConfig.projectId,
|
|
5327
5136
|
commitOid
|
|
@@ -5357,7 +5166,6 @@ var project_default = defineCommand({
|
|
|
5357
5166
|
subCommands: {
|
|
5358
5167
|
create: project_create_default,
|
|
5359
5168
|
clone: project_clone_default,
|
|
5360
|
-
repository: cmdProjectRepository,
|
|
5361
5169
|
status: cmdProjectStatus
|
|
5362
5170
|
}
|
|
5363
5171
|
});
|
|
@@ -6210,6 +6018,15 @@ function nextActionsFromError(error) {
|
|
|
6210
6018
|
|
|
6211
6019
|
// src/cli-main.ts
|
|
6212
6020
|
var machineOutputContext = null;
|
|
6021
|
+
function readCliVersion() {
|
|
6022
|
+
const packageJson = JSON.parse(
|
|
6023
|
+
readFileSync2(new URL("../package.json", import.meta.url), "utf8")
|
|
6024
|
+
);
|
|
6025
|
+
if (typeof packageJson.version !== "string") {
|
|
6026
|
+
throw new Error("Unable to read Dreamboard CLI version from package.json.");
|
|
6027
|
+
}
|
|
6028
|
+
return packageJson.version;
|
|
6029
|
+
}
|
|
6213
6030
|
function handleFatalError(error) {
|
|
6214
6031
|
if (machineOutputContext) {
|
|
6215
6032
|
emitMachineFailureAndExit(
|
|
@@ -6227,6 +6044,7 @@ function handleFatalError(error) {
|
|
|
6227
6044
|
process.on("uncaughtException", handleFatalError);
|
|
6228
6045
|
process.on("unhandledRejection", handleFatalError);
|
|
6229
6046
|
consola.options.formatOptions.date = false;
|
|
6047
|
+
var cliVersion = readCliVersion();
|
|
6230
6048
|
var publicSubCommands = {
|
|
6231
6049
|
auth: auth_default,
|
|
6232
6050
|
project: project_default,
|
|
@@ -6282,7 +6100,7 @@ function runDreamboardCli(internalSubCommands = {}) {
|
|
|
6282
6100
|
const main = defineCommand({
|
|
6283
6101
|
meta: {
|
|
6284
6102
|
name: "dreamboard",
|
|
6285
|
-
version:
|
|
6103
|
+
version: cliVersion,
|
|
6286
6104
|
description: "Dreamboard CLI \u2014 game development platform"
|
|
6287
6105
|
},
|
|
6288
6106
|
subCommands
|