@dreamboard-games/cli 0.1.30-alpha.30 → 0.1.30-alpha.31
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/agent-verifier/agent-workspace-verifier.mjs +226 -93
- package/dist/agent-verifier/agent-workspace-verifier.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/{chunk-QMOBTQ5G.mjs → chunk-NBRUEJUK.mjs} +3 -3
- package/dist/agent-verifier/{chunk-QMOBTQ5G.mjs.map → chunk-NBRUEJUK.mjs.map} +1 -1
- 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-MAGKDMK5.mjs} +2 -2
- package/dist/agent-verifier/{static-scaffold-MHVM63HU.mjs → static-scaffold-CLRRWXON.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-X244CUU4.js} +228 -148
- package/dist/chunk-X244CUU4.js.map +1 -0
- package/dist/{chunk-I4SZ7FA4.js → chunk-YNJVKC2T.js} +3 -9
- package/dist/{chunk-I4SZ7FA4.js.map → chunk-YNJVKC2T.js.map} +1 -1
- package/dist/{global-config-GK2UC2X6.js → global-config-RBMW7IVA.js} +2 -2
- package/dist/index.js +110 -295
- 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/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-MAGKDMK5.mjs.map} +0 -0
- /package/dist/agent-verifier/{static-scaffold-MHVM63HU.mjs.map → static-scaffold-CLRRWXON.mjs.map} +0 -0
- /package/dist/{global-config-GK2UC2X6.js.map → global-config-RBMW7IVA.js.map} +0 -0
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
getGlobalConfigPath,
|
|
5
5
|
loadGlobalConfig,
|
|
6
6
|
saveGlobalConfig
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-6NYVJYN4.js";
|
|
8
8
|
import "./chunk-EQNBQVIW.js";
|
|
9
9
|
import "./chunk-2H7UOFLK.js";
|
|
10
10
|
export {
|
|
@@ -13,4 +13,4 @@ export {
|
|
|
13
13
|
loadGlobalConfig,
|
|
14
14
|
saveGlobalConfig
|
|
15
15
|
};
|
|
16
|
-
//# sourceMappingURL=global-config-
|
|
16
|
+
//# sourceMappingURL=global-config-RBMW7IVA.js.map
|
package/dist/index.js
CHANGED
|
@@ -10,10 +10,9 @@ import {
|
|
|
10
10
|
configureClient,
|
|
11
11
|
createPkcePair,
|
|
12
12
|
createSessionFromScenario,
|
|
13
|
-
|
|
13
|
+
createUserSessionManager,
|
|
14
14
|
didLocalMaintainerSnapshotChange,
|
|
15
15
|
exchangeClerkOAuthCode,
|
|
16
|
-
exchangeDreamboardUserToken,
|
|
17
16
|
formatCliError,
|
|
18
17
|
generateReducerNativeArtifacts,
|
|
19
18
|
getAuthTokenExpiry,
|
|
@@ -34,11 +33,9 @@ import {
|
|
|
34
33
|
parseNewCommandArgs,
|
|
35
34
|
parsePlayerCountFlags,
|
|
36
35
|
parsePositiveInt,
|
|
37
|
-
parseProjectRepositoryCommandArgs,
|
|
38
36
|
parseReleasePublishCommandArgs,
|
|
39
37
|
presentCliError,
|
|
40
38
|
projectIdFromSessionGameSource,
|
|
41
|
-
refreshResolvedAuthSession,
|
|
42
39
|
requireAuth,
|
|
43
40
|
resolveConfig,
|
|
44
41
|
resolveLocalHarnessAccessToken,
|
|
@@ -49,7 +46,7 @@ import {
|
|
|
49
46
|
titleFromSlug,
|
|
50
47
|
toDreamboardApiError,
|
|
51
48
|
waitForCompiledResultJobSdk
|
|
52
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-X244CUU4.js";
|
|
53
50
|
import {
|
|
54
51
|
applyWorkspaceCodegen,
|
|
55
52
|
collectLocalFiles,
|
|
@@ -78,24 +75,20 @@ import {
|
|
|
78
75
|
publishProjectRelease,
|
|
79
76
|
reconcileWorkspaceDependencies,
|
|
80
77
|
resolveCliRepoRoot,
|
|
81
|
-
retryProjectRepositoryReconciliation,
|
|
82
78
|
scaffoldStaticWorkspace,
|
|
83
79
|
updateProjectEnvironmentState,
|
|
84
80
|
updateProjectLocalMaintainerRegistry,
|
|
85
81
|
updateProjectState,
|
|
86
82
|
writeSnapshot
|
|
87
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-YNJVKC2T.js";
|
|
88
84
|
import {
|
|
89
|
-
clearCredentials,
|
|
90
85
|
getActiveCredentialBackendName,
|
|
91
86
|
getGlobalAuthPath,
|
|
92
87
|
getGlobalConfigPath,
|
|
93
88
|
getStoredSession,
|
|
94
89
|
loadGlobalConfig,
|
|
95
|
-
saveGlobalConfig
|
|
96
|
-
|
|
97
|
-
setCredentials
|
|
98
|
-
} from "./chunk-UI7NWSYA.js";
|
|
90
|
+
saveGlobalConfig
|
|
91
|
+
} from "./chunk-6NYVJYN4.js";
|
|
99
92
|
import {
|
|
100
93
|
DEFAULT_LOGIN_TIMEOUT_MS,
|
|
101
94
|
MANIFEST_TYPECHECK_CONFIG_FILE,
|
|
@@ -110,6 +103,9 @@ import {
|
|
|
110
103
|
} from "./chunk-EQNBQVIW.js";
|
|
111
104
|
import "./chunk-2H7UOFLK.js";
|
|
112
105
|
|
|
106
|
+
// src/cli-main.ts
|
|
107
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
108
|
+
|
|
113
109
|
// ../../node_modules/.pnpm/citty@0.2.2/node_modules/citty/dist/_chunks/libs/scule.mjs
|
|
114
110
|
var NUMBER_CHAR_RE = /\d/;
|
|
115
111
|
var STR_SPLITTERS = [
|
|
@@ -1654,7 +1650,7 @@ function createConsola2(options = {}) {
|
|
|
1654
1650
|
if (process.env.CONSOLA_LEVEL) {
|
|
1655
1651
|
level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
|
|
1656
1652
|
}
|
|
1657
|
-
const
|
|
1653
|
+
const consola2 = createConsola({
|
|
1658
1654
|
level,
|
|
1659
1655
|
defaults: { level },
|
|
1660
1656
|
stdout: process.stdout,
|
|
@@ -1665,7 +1661,7 @@ function createConsola2(options = {}) {
|
|
|
1665
1661
|
],
|
|
1666
1662
|
...options
|
|
1667
1663
|
});
|
|
1668
|
-
return
|
|
1664
|
+
return consola2;
|
|
1669
1665
|
}
|
|
1670
1666
|
function _getDefaultLogLevel() {
|
|
1671
1667
|
if (g) {
|
|
@@ -2073,7 +2069,7 @@ async function runGitCredentialHelper(input = {}) {
|
|
|
2073
2069
|
policy: {
|
|
2074
2070
|
allowedHosts: resolveAllowedGitHosts(env2)
|
|
2075
2071
|
},
|
|
2076
|
-
tokenManager:
|
|
2072
|
+
tokenManager: createUserSessionManager(
|
|
2077
2073
|
resolveConfig(
|
|
2078
2074
|
await loadGlobalConfig(),
|
|
2079
2075
|
{},
|
|
@@ -2101,6 +2097,7 @@ async function readAll(stream) {
|
|
|
2101
2097
|
}
|
|
2102
2098
|
|
|
2103
2099
|
// src/commands/auth.ts
|
|
2100
|
+
var PUBLISHED_AUTH_ACTIONS = /* @__PURE__ */ new Set(["login", "logout", "status"]);
|
|
2104
2101
|
async function loginWithBrowser(config, quiet) {
|
|
2105
2102
|
const state = crypto2.randomUUID();
|
|
2106
2103
|
const pkce = createPkcePair();
|
|
@@ -2157,9 +2154,9 @@ async function runAuthAction(rawArgs) {
|
|
|
2157
2154
|
await runGitCredentialHelper();
|
|
2158
2155
|
return;
|
|
2159
2156
|
}
|
|
2160
|
-
if (IS_PUBLISHED_BUILD && action
|
|
2157
|
+
if (IS_PUBLISHED_BUILD && !PUBLISHED_AUTH_ACTIONS.has(action)) {
|
|
2161
2158
|
throw new Error(
|
|
2162
|
-
"The published Dreamboard CLI
|
|
2159
|
+
"The published Dreamboard CLI supports auth login, logout, and status."
|
|
2163
2160
|
);
|
|
2164
2161
|
}
|
|
2165
2162
|
if (action === "env") {
|
|
@@ -2192,12 +2189,24 @@ async function runAuthAction(rawArgs) {
|
|
|
2192
2189
|
}
|
|
2193
2190
|
const token = parsedArgs.tokenValue ?? parsedArgs.token ?? "";
|
|
2194
2191
|
if (!token) throw new Error("Usage: dreamboard auth set <token>");
|
|
2195
|
-
|
|
2192
|
+
const config = resolveConfig(
|
|
2193
|
+
globalConfig,
|
|
2194
|
+
{ env: parsedArgs.env },
|
|
2195
|
+
void 0,
|
|
2196
|
+
await getStoredSession()
|
|
2197
|
+
);
|
|
2198
|
+
await createUserSessionManager(config).establishAccessOnlySession(token);
|
|
2196
2199
|
consola.success(`Auth token saved to ${getGlobalAuthPath()}.`);
|
|
2197
2200
|
return;
|
|
2198
2201
|
}
|
|
2199
2202
|
if (action === "logout") {
|
|
2200
|
-
|
|
2203
|
+
const config = resolveConfig(
|
|
2204
|
+
globalConfig,
|
|
2205
|
+
{ env: parsedArgs.env },
|
|
2206
|
+
void 0,
|
|
2207
|
+
await getStoredSession()
|
|
2208
|
+
);
|
|
2209
|
+
await createUserSessionManager(config).logout();
|
|
2201
2210
|
consola.success(
|
|
2202
2211
|
`Stored Dreamboard session cleared from ${getGlobalAuthPath()}.`
|
|
2203
2212
|
);
|
|
@@ -2207,78 +2216,63 @@ async function runAuthAction(rawArgs) {
|
|
|
2207
2216
|
const shouldPrintJwt = !IS_PUBLISHED_BUILD && parsedArgs.jwt === true;
|
|
2208
2217
|
const environment = IS_PUBLISHED_BUILD ? PUBLISHED_ENVIRONMENT : parsedArgs.env || globalConfig.environment || "staging";
|
|
2209
2218
|
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
2219
|
const resolvedConfig = resolveConfig(
|
|
2217
2220
|
globalConfig,
|
|
2218
2221
|
{ env: environment },
|
|
2219
2222
|
void 0,
|
|
2220
2223
|
storedSession
|
|
2221
2224
|
);
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2225
|
+
const sessionManager = createUserSessionManager(resolvedConfig);
|
|
2226
|
+
const existingStatus = await sessionManager.inspectSession();
|
|
2227
|
+
if (existingStatus.kind === "active") {
|
|
2228
|
+
if (shouldPrintJwt) {
|
|
2229
|
+
const current = await getStoredSession();
|
|
2230
|
+
process.stdout.write(
|
|
2231
|
+
`${JSON.stringify(
|
|
2232
|
+
{
|
|
2233
|
+
token: current?.accessToken ?? existingStatus.apiToken.token,
|
|
2234
|
+
refreshToken: current?.refreshToken ?? null,
|
|
2235
|
+
environment
|
|
2236
|
+
},
|
|
2237
|
+
null,
|
|
2238
|
+
2
|
|
2239
|
+
)}
|
|
2240
|
+
`
|
|
2241
|
+
);
|
|
2242
|
+
} else if (existingStatus.repaired) {
|
|
2243
|
+
consola.success(
|
|
2244
|
+
`Stored Dreamboard session repaired and saved to ${getGlobalAuthPath()}`
|
|
2245
|
+
);
|
|
2246
|
+
} else {
|
|
2247
|
+
consola.success(
|
|
2248
|
+
`Stored Dreamboard session is active in ${getGlobalAuthPath()}`
|
|
2233
2249
|
);
|
|
2234
|
-
accessToken = void 0;
|
|
2235
|
-
refreshToken = void 0;
|
|
2236
2250
|
}
|
|
2251
|
+
return;
|
|
2237
2252
|
}
|
|
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.");
|
|
2253
|
+
if (existingStatus.kind === "degraded" || existingStatus.kind === "invalid") {
|
|
2254
|
+
consola.warn(existingStatus.message);
|
|
2251
2255
|
}
|
|
2256
|
+
const browserLogin = await loginWithBrowser(resolvedConfig, shouldPrintJwt);
|
|
2252
2257
|
await saveGlobalConfig({
|
|
2253
2258
|
...globalConfig,
|
|
2254
2259
|
environment
|
|
2255
2260
|
});
|
|
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
|
-
}
|
|
2261
|
+
await sessionManager.establishRefreshableSession({
|
|
2262
|
+
clerkAccessToken: browserLogin.token,
|
|
2263
|
+
refreshToken: browserLogin.refreshToken,
|
|
2264
|
+
clerkAccessExpiresAt: browserLogin.expiresAt,
|
|
2265
|
+
clerkOAuthIssuer: resolvedConfig.clerkOAuthIssuer,
|
|
2266
|
+
clerkOAuthClientId: resolvedConfig.clerkOAuthClientId,
|
|
2267
|
+
clerkOAuthTokenUrl: browserLogin.tokenUrl,
|
|
2268
|
+
environment
|
|
2269
|
+
});
|
|
2276
2270
|
if (shouldPrintJwt) {
|
|
2277
2271
|
process.stdout.write(
|
|
2278
2272
|
`${JSON.stringify(
|
|
2279
2273
|
{
|
|
2280
|
-
token:
|
|
2281
|
-
refreshToken: refreshToken
|
|
2274
|
+
token: browserLogin.token,
|
|
2275
|
+
refreshToken: browserLogin.refreshToken,
|
|
2282
2276
|
environment
|
|
2283
2277
|
},
|
|
2284
2278
|
null,
|
|
@@ -2288,19 +2282,9 @@ async function runAuthAction(rawArgs) {
|
|
|
2288
2282
|
);
|
|
2289
2283
|
return;
|
|
2290
2284
|
}
|
|
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
|
-
}
|
|
2285
|
+
consola.success(
|
|
2286
|
+
`Browser login successful. Session saved to ${getGlobalAuthPath()}`
|
|
2287
|
+
);
|
|
2304
2288
|
return;
|
|
2305
2289
|
}
|
|
2306
2290
|
if (action === "status") {
|
|
@@ -2312,68 +2296,46 @@ async function runAuthAction(rawArgs) {
|
|
|
2312
2296
|
storedSession
|
|
2313
2297
|
);
|
|
2314
2298
|
const environment = parsedArgs.env || globalConfig.environment || "staging";
|
|
2315
|
-
const
|
|
2299
|
+
const status = await createUserSessionManager(resolvedConfig).inspectSession();
|
|
2316
2300
|
const backendName = await getActiveCredentialBackendName();
|
|
2317
2301
|
consola.log(`Environment: ${environment}`);
|
|
2318
|
-
consola.log(`Auth token source: ${resolvedConfig.authTokenSource}`);
|
|
2319
|
-
consola.log(`Refresh token source: ${resolvedConfig.refreshTokenSource}`);
|
|
2320
2302
|
consola.log(
|
|
2321
2303
|
`Credential backend: ${backendName}${backendName === "keychain" ? " (OS keychain via @napi-rs/keyring)" : ` (${getGlobalAuthPath()})`}`
|
|
2322
2304
|
);
|
|
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
|
-
);
|
|
2305
|
+
consola.log(`Config path: ${getGlobalConfigPath()}`);
|
|
2306
|
+
if (status.kind === "none") {
|
|
2307
|
+
consola.log("Session state: none");
|
|
2308
|
+
consola.warn("No Dreamboard session found.");
|
|
2309
|
+
return;
|
|
2330
2310
|
}
|
|
2331
|
-
if (
|
|
2332
|
-
consola.log(
|
|
2333
|
-
|
|
2311
|
+
if (status.kind === "degraded") {
|
|
2312
|
+
consola.log("Session state: degraded (refreshable)");
|
|
2313
|
+
consola.warn(
|
|
2314
|
+
`Stored Dreamboard session is refreshable but currently API-unusable: ${status.message}`
|
|
2334
2315
|
);
|
|
2316
|
+
return;
|
|
2335
2317
|
}
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
consola.warn(
|
|
2318
|
+
if (status.kind === "invalid") {
|
|
2319
|
+
consola.log(`Session state: invalid (${status.sessionKind})`);
|
|
2320
|
+
consola.warn(status.message);
|
|
2339
2321
|
return;
|
|
2340
2322
|
}
|
|
2341
|
-
|
|
2342
|
-
|
|
2323
|
+
consola.log(`Session state: active (${status.sessionKind})`);
|
|
2324
|
+
const authTokenExpiry = status.apiToken.expiresAt !== void 0 ? new Date(status.apiToken.expiresAt) : getAuthTokenExpiry(status.apiToken.token);
|
|
2325
|
+
if (authTokenExpiry && Number.isFinite(authTokenExpiry.getTime())) {
|
|
2343
2326
|
consola.log(
|
|
2344
|
-
`
|
|
2327
|
+
`Dreamboard API token expires at: ${authTokenExpiry.toISOString()} (active)`
|
|
2345
2328
|
);
|
|
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
2329
|
} else {
|
|
2370
|
-
consola.log("
|
|
2330
|
+
consola.log("Dreamboard API token expiry: unavailable");
|
|
2371
2331
|
}
|
|
2372
|
-
consola.success(
|
|
2332
|
+
consola.success(
|
|
2333
|
+
status.repaired ? "Dreamboard session was repaired and is active." : "Dreamboard session is active."
|
|
2334
|
+
);
|
|
2373
2335
|
return;
|
|
2374
2336
|
}
|
|
2375
2337
|
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>]"
|
|
2338
|
+
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
2339
|
);
|
|
2378
2340
|
}
|
|
2379
2341
|
function defineAuthActionCommand(options) {
|
|
@@ -2557,19 +2519,6 @@ async function getProjectRepositorySdk(projectId) {
|
|
|
2557
2519
|
}
|
|
2558
2520
|
return data;
|
|
2559
2521
|
}
|
|
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
2522
|
async function pollProjectRepository(options) {
|
|
2574
2523
|
const intervalMs = options.intervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
2575
2524
|
const fetchRepository = options.fetchRepository ?? getProjectRepositorySdk;
|
|
@@ -3089,7 +3038,7 @@ async function resolveDevHostBearer(config) {
|
|
|
3089
3038
|
message: "Stored Dreamboard session is expired or invalid. Run `dreamboard auth login` to authenticate again."
|
|
3090
3039
|
};
|
|
3091
3040
|
}
|
|
3092
|
-
const resolved = await
|
|
3041
|
+
const resolved = await createUserSessionManager(config).resolveApiToken();
|
|
3093
3042
|
return { kind: "ok", token: resolved?.token ?? null };
|
|
3094
3043
|
}
|
|
3095
3044
|
|
|
@@ -4172,7 +4121,7 @@ var dev_default = defineCommand({
|
|
|
4172
4121
|
config
|
|
4173
4122
|
});
|
|
4174
4123
|
const effectiveProjectConfig = remoteProject.projectConfig;
|
|
4175
|
-
const effectiveAuthToken = resolveLocalHarnessAccessToken(config) ?? (await
|
|
4124
|
+
const effectiveAuthToken = resolveLocalHarnessAccessToken(config) ?? (await createUserSessionManager(config).resolveApiToken())?.token ?? config.authToken;
|
|
4176
4125
|
const devCompile = await ensureDevCompiledResult({
|
|
4177
4126
|
projectRoot,
|
|
4178
4127
|
projectConfig: effectiveProjectConfig,
|
|
@@ -5072,8 +5021,6 @@ Refusing to publish a mutated checkout.`
|
|
|
5072
5021
|
// src/commands/project.ts
|
|
5073
5022
|
var DEFAULT_STATUS_WAIT_TIMEOUT_MS = 12e4;
|
|
5074
5023
|
var DEFAULT_STATUS_POLL_INTERVAL_MS = 1e3;
|
|
5075
|
-
var DEFAULT_REPOSITORY_WAIT_TIMEOUT_MS3 = 12e4;
|
|
5076
|
-
var DEFAULT_REPOSITORY_POLL_INTERVAL_MS3 = 1e3;
|
|
5077
5024
|
function parsePositiveIntegerFlag3(value, flagName, defaultValue) {
|
|
5078
5025
|
if (value === void 0) {
|
|
5079
5026
|
return defaultValue;
|
|
@@ -5087,35 +5034,6 @@ function parsePositiveIntegerFlag3(value, flagName, defaultValue) {
|
|
|
5087
5034
|
function sleep(ms) {
|
|
5088
5035
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
5089
5036
|
}
|
|
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
5037
|
function isPendingStatus(status) {
|
|
5120
5038
|
if (!status.source.observed) {
|
|
5121
5039
|
return true;
|
|
@@ -5129,7 +5047,9 @@ function isPendingStatus(status) {
|
|
|
5129
5047
|
if (status.previews.some((preview) => preview.status === "PENDING_RETENTION")) {
|
|
5130
5048
|
return true;
|
|
5131
5049
|
}
|
|
5132
|
-
return status.releases.some(
|
|
5050
|
+
return status.releases.some(
|
|
5051
|
+
(release) => release.status === "PENDING_RETENTION"
|
|
5052
|
+
);
|
|
5133
5053
|
}
|
|
5134
5054
|
async function maybePollProjectCommitStatus(options) {
|
|
5135
5055
|
if (!options.wait || !isPendingStatus(options.initialStatus)) {
|
|
@@ -5169,117 +5089,6 @@ function projectStatusSummary(status) {
|
|
|
5169
5089
|
releases
|
|
5170
5090
|
].join(" ");
|
|
5171
5091
|
}
|
|
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
5092
|
var cmdProjectStatus = defineCommand({
|
|
5284
5093
|
meta: {
|
|
5285
5094
|
name: "status",
|
|
@@ -5318,10 +5127,7 @@ var cmdProjectStatus = defineCommand({
|
|
|
5318
5127
|
"wait-timeout-ms": typeof args["wait-timeout-ms"] === "string" ? args["wait-timeout-ms"] : void 0,
|
|
5319
5128
|
"status-poll-interval-ms": typeof args["status-poll-interval-ms"] === "string" ? args["status-poll-interval-ms"] : void 0
|
|
5320
5129
|
};
|
|
5321
|
-
const { projectConfig, commitOid } = await resolveCommitScopedProjectContext(
|
|
5322
|
-
parsedArgs,
|
|
5323
|
-
parsedArgs.commit
|
|
5324
|
-
);
|
|
5130
|
+
const { projectConfig, commitOid } = await resolveCommitScopedProjectContext(parsedArgs, parsedArgs.commit);
|
|
5325
5131
|
const initialStatus = await getProjectCommitStatusSdk({
|
|
5326
5132
|
projectId: projectConfig.projectId,
|
|
5327
5133
|
commitOid
|
|
@@ -5357,7 +5163,6 @@ var project_default = defineCommand({
|
|
|
5357
5163
|
subCommands: {
|
|
5358
5164
|
create: project_create_default,
|
|
5359
5165
|
clone: project_clone_default,
|
|
5360
|
-
repository: cmdProjectRepository,
|
|
5361
5166
|
status: cmdProjectStatus
|
|
5362
5167
|
}
|
|
5363
5168
|
});
|
|
@@ -6210,6 +6015,15 @@ function nextActionsFromError(error) {
|
|
|
6210
6015
|
|
|
6211
6016
|
// src/cli-main.ts
|
|
6212
6017
|
var machineOutputContext = null;
|
|
6018
|
+
function readCliVersion() {
|
|
6019
|
+
const packageJson = JSON.parse(
|
|
6020
|
+
readFileSync2(new URL("../package.json", import.meta.url), "utf8")
|
|
6021
|
+
);
|
|
6022
|
+
if (typeof packageJson.version !== "string") {
|
|
6023
|
+
throw new Error("Unable to read Dreamboard CLI version from package.json.");
|
|
6024
|
+
}
|
|
6025
|
+
return packageJson.version;
|
|
6026
|
+
}
|
|
6213
6027
|
function handleFatalError(error) {
|
|
6214
6028
|
if (machineOutputContext) {
|
|
6215
6029
|
emitMachineFailureAndExit(
|
|
@@ -6227,6 +6041,7 @@ function handleFatalError(error) {
|
|
|
6227
6041
|
process.on("uncaughtException", handleFatalError);
|
|
6228
6042
|
process.on("unhandledRejection", handleFatalError);
|
|
6229
6043
|
consola.options.formatOptions.date = false;
|
|
6044
|
+
var cliVersion = readCliVersion();
|
|
6230
6045
|
var publicSubCommands = {
|
|
6231
6046
|
auth: auth_default,
|
|
6232
6047
|
project: project_default,
|
|
@@ -6282,7 +6097,7 @@ function runDreamboardCli(internalSubCommands = {}) {
|
|
|
6282
6097
|
const main = defineCommand({
|
|
6283
6098
|
meta: {
|
|
6284
6099
|
name: "dreamboard",
|
|
6285
|
-
version:
|
|
6100
|
+
version: cliVersion,
|
|
6286
6101
|
description: "Dreamboard CLI \u2014 game development platform"
|
|
6287
6102
|
},
|
|
6288
6103
|
subCommands
|