@bitmagic/cli 0.1.46-dev.2 → 0.1.46-dev.4
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 +46 -0
- package/dist/auth/session.js +1 -1
- package/dist/auth/session.js.map +1 -1
- package/dist/auth/subscribe-flow.d.ts +30 -6
- package/dist/auth/subscribe-flow.js +64 -29
- package/dist/auth/subscribe-flow.js.map +1 -1
- package/dist/bin.js +6 -2
- package/dist/bin.js.map +1 -1
- package/dist/cli.d.ts +43 -2
- package/dist/cli.js +78 -7
- package/dist/cli.js.map +1 -1
- package/dist/commands/dev.js +9 -0
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/forge.js +1 -1
- package/dist/commands/forge.js.map +1 -1
- package/dist/commands/generate.js +9 -1
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/init.js +6 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/login.js +15 -11
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/reset-account.d.ts +103 -0
- package/dist/commands/reset-account.js +227 -0
- package/dist/commands/reset-account.js.map +1 -0
- package/dist/commands/subscribe.d.ts +13 -1
- package/dist/commands/subscribe.js +21 -17
- package/dist/commands/subscribe.js.map +1 -1
- package/dist/commands/upgrade.d.ts +2 -1
- package/dist/commands/upgrade.js +12 -5
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/config/environments.d.ts +14 -0
- package/dist/config/environments.js +22 -0
- package/dist/config/environments.js.map +1 -1
- package/dist/errors.d.ts +10 -1
- package/dist/errors.js +11 -1
- package/dist/errors.js.map +1 -1
- package/dist/forge/run-pipeline.js +1 -1
- package/dist/forge/run-pipeline.js.map +1 -1
- package/dist/forge/stream.js +10 -5
- package/dist/forge/stream.js.map +1 -1
- package/dist/forge/upload-proxy.js +2 -0
- package/dist/forge/upload-proxy.js.map +1 -1
- package/dist/generate/stream.js +10 -5
- package/dist/generate/stream.js.map +1 -1
- package/dist/http/client.d.ts +6 -2
- package/dist/http/client.js +22 -12
- package/dist/http/client.js.map +1 -1
- package/dist/http/spark-refusal.d.ts +11 -0
- package/dist/http/spark-refusal.js +13 -0
- package/dist/http/spark-refusal.js.map +1 -1
- package/dist/publish/client.js +3 -1
- package/dist/publish/client.js.map +1 -1
- package/dist/scaffold/agents-md.d.ts +2 -1
- package/dist/scaffold/agents-md.js +7 -2
- package/dist/scaffold/agents-md.js.map +1 -1
- package/dist/scaffold/engine-download.js +5 -18
- package/dist/scaffold/engine-download.js.map +1 -1
- package/dist/scaffold/project-files.d.ts +3 -2
- package/dist/scaffold/project-files.js +46 -2
- package/dist/scaffold/project-files.js.map +1 -1
- package/dist/scaffold/project.d.ts +30 -0
- package/dist/scaffold/project.js +55 -29
- package/dist/scaffold/project.js.map +1 -1
- package/dist/scaffold/upgrade-project.js +19 -33
- package/dist/scaffold/upgrade-project.js.map +1 -1
- package/dist/telemetry/command-context.d.ts +73 -0
- package/dist/telemetry/command-context.js +114 -0
- package/dist/telemetry/command-context.js.map +1 -0
- package/dist/telemetry/report.d.ts +43 -0
- package/dist/telemetry/report.js +123 -0
- package/dist/telemetry/report.js.map +1 -0
- package/dist/telemetry/request-headers.d.ts +14 -0
- package/dist/telemetry/request-headers.js +48 -0
- package/dist/telemetry/request-headers.js.map +1 -0
- package/dist/update/check.d.ts +14 -0
- package/dist/update/check.js +17 -1
- package/dist/update/check.js.map +1 -1
- package/dist/update/notice.d.ts +40 -0
- package/dist/update/notice.js +53 -0
- package/dist/update/notice.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { defineCommand } from 'citty';
|
|
2
|
+
import { spawnSync } from 'child_process';
|
|
3
|
+
import { createInterface } from 'readline/promises';
|
|
4
|
+
import { selectEnvironmentForCommand, resolveAuth0ClientId } from '../config/environments.js';
|
|
5
|
+
import { clearCredentials } from '../config/credentials.js';
|
|
6
|
+
import { getAccessToken } from '../auth/session.js';
|
|
7
|
+
import { createOutput } from '../output.js';
|
|
8
|
+
import { CliError } from '../errors.js';
|
|
9
|
+
async function askOnStdin(question) {
|
|
10
|
+
const rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
11
|
+
try {
|
|
12
|
+
return (await rl.question(question)).trim();
|
|
13
|
+
}
|
|
14
|
+
finally {
|
|
15
|
+
rl.close();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* npm's output is CAPTURED, not inherited. Under `--json` this command's stdout
|
|
20
|
+
* is contractually one JSON document (see output.ts), and a subprocess writing
|
|
21
|
+
* its own progress there would corrupt it — the exact hazard the Output seam
|
|
22
|
+
* exists to prevent, reintroduced by spawning a process instead of calling
|
|
23
|
+
* console.log. Nothing is printed unless it fails, and then it goes through
|
|
24
|
+
* `output.info` like every other line.
|
|
25
|
+
*/
|
|
26
|
+
function uninstallGlobally() {
|
|
27
|
+
const result = spawnSync('npm', ['uninstall', '-g', '@bitmagic/cli'], { encoding: 'utf-8' });
|
|
28
|
+
return !result.error && result.status === 0;
|
|
29
|
+
}
|
|
30
|
+
export const defaultResetDeps = {
|
|
31
|
+
fetch: globalThis.fetch,
|
|
32
|
+
sleep: (ms) => new Promise((r) => setTimeout(r, ms)),
|
|
33
|
+
interactive: () => process.stdin.isTTY === true,
|
|
34
|
+
ask: askOnStdin,
|
|
35
|
+
uninstall: uninstallGlobally,
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* This command does NOT go through http/client.ts, and that is deliberate.
|
|
39
|
+
*
|
|
40
|
+
* Its shared mapping turns 503 into "this feature is unavailable in this
|
|
41
|
+
* environment" and everything else into "api-server returned HTTP n" — fine for
|
|
42
|
+
* the twenty routes that only ever fail one way, useless for this one, whose
|
|
43
|
+
* three interesting failures each need their own sentence: the endpoint is not
|
|
44
|
+
* deployed here, Stripe could not be reached so NOTHING was deleted, and Stripe
|
|
45
|
+
* is not configured so the subscription cannot be cancelled. The server sends
|
|
46
|
+
* the reason in the body; this reads it.
|
|
47
|
+
*/
|
|
48
|
+
async function resetRequest(environment, path, token, method, deps) {
|
|
49
|
+
let response;
|
|
50
|
+
try {
|
|
51
|
+
response = await deps.fetch(`${environment.apiUrl}${path}`, {
|
|
52
|
+
method,
|
|
53
|
+
headers: { Authorization: `Bearer ${token}`, Accept: 'application/json' },
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
throw new CliError(`Cannot reach api-server at ${environment.apiUrl}.`);
|
|
58
|
+
}
|
|
59
|
+
if (response.ok)
|
|
60
|
+
return (await response.json());
|
|
61
|
+
let serverMessage = null;
|
|
62
|
+
try {
|
|
63
|
+
const body = (await response.json());
|
|
64
|
+
if (typeof body.error === 'string')
|
|
65
|
+
serverMessage = body.error;
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// No body, or not JSON. The status alone still has to produce a sentence.
|
|
69
|
+
}
|
|
70
|
+
if (response.status === 401) {
|
|
71
|
+
throw new CliError('Your session has expired. Run `bitmagic login`.');
|
|
72
|
+
}
|
|
73
|
+
if (response.status === 404) {
|
|
74
|
+
// Two very different things share this status: the account is already gone
|
|
75
|
+
// (the server says so in the body) or the route was never mounted, which is
|
|
76
|
+
// what production looks like from out here.
|
|
77
|
+
if (serverMessage)
|
|
78
|
+
throw new CliError(serverMessage);
|
|
79
|
+
throw new CliError(`The "${environment.name}" api-server has no account-reset endpoint. It exists only outside ` +
|
|
80
|
+
'production, and only on api-servers new enough to have it.');
|
|
81
|
+
}
|
|
82
|
+
if (response.status === 403) {
|
|
83
|
+
throw new CliError(`The "${environment.name}" api-server refused the reset. It exists only outside production.`);
|
|
84
|
+
}
|
|
85
|
+
throw new CliError(serverMessage ?? `api-server returned HTTP ${response.status} for ${path}. Nothing was deleted.`);
|
|
86
|
+
}
|
|
87
|
+
/** PURE. The lines shown before the confirmation. */
|
|
88
|
+
export function formatResetPreview(preview, environmentName, removesCli) {
|
|
89
|
+
const pro = preview.hasProSubscription
|
|
90
|
+
? 'subscription — WILL BE CANCELLED IN STRIPE, then deleted'
|
|
91
|
+
: preview.hasProGrant
|
|
92
|
+
? 'comped grant — deleted'
|
|
93
|
+
: 'none';
|
|
94
|
+
return [
|
|
95
|
+
`This DELETES your Bitmagic account on ${environmentName}.`,
|
|
96
|
+
'',
|
|
97
|
+
` account ${preview.userId} (${preview.email})`,
|
|
98
|
+
` games ${preview.games}`,
|
|
99
|
+
` sparks ${preview.sparkBalance.toLocaleString('en-US')}`,
|
|
100
|
+
` pro ${pro}`,
|
|
101
|
+
'',
|
|
102
|
+
'Also removed: your profile, terms acceptance, XP, likes, follows, comments and',
|
|
103
|
+
'published game entries. Your next `bitmagic login` starts over from nothing.',
|
|
104
|
+
// Said here rather than only in the flag's help: this is the one effect that
|
|
105
|
+
// outlives the command, and the confirmation below is what covers it.
|
|
106
|
+
...(removesCli
|
|
107
|
+
? [
|
|
108
|
+
'',
|
|
109
|
+
'Finally, this uninstalls the bitmagic CLI itself, so the next run starts where a',
|
|
110
|
+
'new creator starts: `npm install -g @bitmagic/cli`. Pass --keep-cli to skip that.',
|
|
111
|
+
]
|
|
112
|
+
: []),
|
|
113
|
+
// Says so up front rather than letting it read as a failed reset later.
|
|
114
|
+
...(preview.vip
|
|
115
|
+
? [
|
|
116
|
+
'',
|
|
117
|
+
'NOTE: this email is on the VIP list, which is keyed by email and is NOT reset.',
|
|
118
|
+
' The new account will not start on the free tier.',
|
|
119
|
+
]
|
|
120
|
+
: []),
|
|
121
|
+
].join('\n');
|
|
122
|
+
}
|
|
123
|
+
export async function runResetAccount(options, output) {
|
|
124
|
+
const deps = options.deps ?? defaultResetDeps;
|
|
125
|
+
const removesCli = options.keepCli !== true;
|
|
126
|
+
const { environment } = selectEnvironmentForCommand({
|
|
127
|
+
explicit: options.env,
|
|
128
|
+
...(options.baseDir !== undefined ? { baseDir: options.baseDir } : {}),
|
|
129
|
+
});
|
|
130
|
+
// Before anything else, including reading a token: pointing this at prod is
|
|
131
|
+
// the mistake worth catching with a sentence rather than a status code.
|
|
132
|
+
if (environment.name === 'prod') {
|
|
133
|
+
throw new CliError('There is no account reset on prod — the endpoint is not deployed there. ' +
|
|
134
|
+
'Run this against dev or local (`bitmagic reset-account --env dev`).');
|
|
135
|
+
}
|
|
136
|
+
const clientId = resolveAuth0ClientId(environment);
|
|
137
|
+
const token = await getAccessToken(environment, clientId, deps, options.baseDir);
|
|
138
|
+
const { preview } = await resetRequest(environment, '/api/cli/v1/account/reset/preview', token, 'GET', deps);
|
|
139
|
+
output.info(formatResetPreview(preview, environment.name, removesCli));
|
|
140
|
+
output.info('');
|
|
141
|
+
if (options.yes !== true) {
|
|
142
|
+
if (!deps.interactive()) {
|
|
143
|
+
throw new CliError('Deleting an account has to be confirmed by a person, and this shell has no terminal. ' +
|
|
144
|
+
'Run it yourself, or pass --yes if you meant it.');
|
|
145
|
+
}
|
|
146
|
+
// The environment name, not y/n: the hazard is doing the right thing to the
|
|
147
|
+
// wrong environment, and "y" reads identically whichever one you are on.
|
|
148
|
+
const answer = await deps.ask(`Type "${environment.name}" to confirm: `);
|
|
149
|
+
if (answer !== environment.name) {
|
|
150
|
+
throw new CliError('Not confirmed — nothing was deleted.');
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const result = await resetRequest(environment, '/api/cli/v1/account/reset', token, 'POST', deps);
|
|
154
|
+
if (result.stripeSubscriptionCanceled)
|
|
155
|
+
output.info('Cancelled the Bitmagic Pro subscription in Stripe.');
|
|
156
|
+
output.info(`Deleted the account on ${environment.name}.`);
|
|
157
|
+
// A cached access token outliving the user row would leave the CLI looking
|
|
158
|
+
// logged in as an account that no longer exists — and the first command to
|
|
159
|
+
// notice would fail somewhere unrelated.
|
|
160
|
+
clearCredentials(environment.name, options.baseDir);
|
|
161
|
+
output.info(`Cleared the stored ${environment.name} credentials.`);
|
|
162
|
+
// Last, because it removes the code this process is running from. Safe where
|
|
163
|
+
// it matters: every module is already loaded by the time this line runs, and
|
|
164
|
+
// nothing after it does a dynamic import — only already-resident code and Node
|
|
165
|
+
// builtins. Do not add an `await import()` below this point.
|
|
166
|
+
let cliUninstalled = false;
|
|
167
|
+
if (removesCli) {
|
|
168
|
+
cliUninstalled = deps.uninstall();
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
environment: environment.name,
|
|
172
|
+
userId: result.userId,
|
|
173
|
+
stripeSubscriptionCanceled: result.stripeSubscriptionCanceled,
|
|
174
|
+
deleted: result.deleted,
|
|
175
|
+
credentialsCleared: true,
|
|
176
|
+
cliUninstalled,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
/** PURE. What to do next, given what the reset just did. */
|
|
180
|
+
export function formatNextSteps(result) {
|
|
181
|
+
return [
|
|
182
|
+
'',
|
|
183
|
+
'Next:',
|
|
184
|
+
// The first run starts at the install, which is why the reset removes the
|
|
185
|
+
// CLI — so this line is the first step, not a footnote.
|
|
186
|
+
...(result.cliUninstalled ? [' npm install -g @bitmagic/cli'] : []),
|
|
187
|
+
` bitmagic login${result.environment === 'dev' ? '' : ` --env ${result.environment}`}`,
|
|
188
|
+
' bitmagic init <a new directory>',
|
|
189
|
+
'',
|
|
190
|
+
'Any project you scaffolded earlier still names a gameId that no longer exists —',
|
|
191
|
+
'nothing on disk was touched, so start the fresh run in a new directory.',
|
|
192
|
+
].join('\n');
|
|
193
|
+
}
|
|
194
|
+
export const resetAccountCommand = defineCommand({
|
|
195
|
+
meta: {
|
|
196
|
+
name: 'reset-account',
|
|
197
|
+
description: 'Delete your account on dev or local so the first-run experience can be tested again.',
|
|
198
|
+
},
|
|
199
|
+
args: {
|
|
200
|
+
env: { type: 'string', description: 'Environment to reset in (dev, local). Never prod.' },
|
|
201
|
+
yes: { type: 'boolean', description: 'Skip the confirmation. Required in a non-interactive shell.' },
|
|
202
|
+
'keep-cli': {
|
|
203
|
+
type: 'boolean',
|
|
204
|
+
description: 'Keep the globally installed CLI. By default the reset also runs ' +
|
|
205
|
+
'`npm uninstall -g @bitmagic/cli`, so the next run starts at the install like a new creator does.',
|
|
206
|
+
},
|
|
207
|
+
json: {
|
|
208
|
+
type: 'boolean',
|
|
209
|
+
description: 'Print the result as JSON on stdout; all progress goes to stderr.',
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
async run({ args }) {
|
|
213
|
+
const output = createOutput(args.json === true);
|
|
214
|
+
const keepCli = args['keep-cli'] === true;
|
|
215
|
+
const result = await runResetAccount({ env: args.env, yes: args.yes === true, keepCli }, output);
|
|
216
|
+
output.info(formatNextSteps(result));
|
|
217
|
+
output.result({ ok: true, ...result });
|
|
218
|
+
if (!keepCli && !result.cliUninstalled) {
|
|
219
|
+
// A warning, not a failure: the account IS reset, and the JSON document
|
|
220
|
+
// above already said so. Only the last step did not happen.
|
|
221
|
+
output.info('');
|
|
222
|
+
output.info('Warning: `npm uninstall -g @bitmagic/cli` did not succeed, so the CLI is still installed. ' +
|
|
223
|
+
'If you installed it with pnpm, yarn or npx, remove it the same way you added it.');
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
});
|
|
227
|
+
//# sourceMappingURL=reset-account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset-account.js","sourceRoot":"","sources":["../../src/commands/reset-account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,oBAAoB,EAAoB,MAAM,2BAA2B,CAAC;AAChH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAe,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AA0ExC,KAAK,UAAU,UAAU,CAAC,QAAgB;IACxC,MA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+
* `bitmagic subscribe` — start (or finish) a Bitmagic Pro subscription.
|
|
3
|
+
*
|
|
4
|
+
* `login` already runs this flow for a creator who has not subscribed, so this
|
|
5
|
+
* command exists for the second attempt: someone who closed the tab, whose card
|
|
6
|
+
* was declined, or whose subscription has since lapsed. Same code path, so the
|
|
7
|
+
* recovery looks exactly like the first run rather than being a differently-worded
|
|
8
|
+
* special case.
|
|
9
|
+
*
|
|
10
|
+
* It opens the Bitmagic Pro storefront, which sells a subscription AND redeems a
|
|
11
|
+
* Pro voucher — so this is the command to reach for with a comped-Pro code too.
|
|
12
|
+
*/
|
|
1
13
|
export declare const subscribeCommand: import("citty").CommandDef<{
|
|
2
14
|
readonly env: {
|
|
3
15
|
readonly type: "string";
|
|
@@ -5,7 +17,7 @@ export declare const subscribeCommand: import("citty").CommandDef<{
|
|
|
5
17
|
};
|
|
6
18
|
readonly 'no-wait': {
|
|
7
19
|
readonly type: "boolean";
|
|
8
|
-
readonly description: "Open
|
|
20
|
+
readonly description: "Open the Bitmagic Pro page and exit instead of waiting for it to complete.";
|
|
9
21
|
};
|
|
10
22
|
readonly json: {
|
|
11
23
|
readonly type: "boolean";
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { defineCommand } from 'citty';
|
|
2
2
|
import { resolveEnvironmentForCommand, resolveAuth0ClientId } from '../config/environments.js';
|
|
3
3
|
import { getAccessToken } from '../auth/session.js';
|
|
4
|
-
import { fetchWhoami, runSubscribeFlow, defaultSubscribeDeps } from '../auth/subscribe-flow.js';
|
|
4
|
+
import { fetchWhoami, runSubscribeFlow, defaultSubscribeDeps, describeProStatus } from '../auth/subscribe-flow.js';
|
|
5
5
|
import { createOutput } from '../output.js';
|
|
6
6
|
/**
|
|
7
7
|
* `bitmagic subscribe` — start (or finish) a Bitmagic Pro subscription.
|
|
8
8
|
*
|
|
9
9
|
* `login` already runs this flow for a creator who has not subscribed, so this
|
|
10
|
-
* command exists for the second attempt: someone who closed the
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* command exists for the second attempt: someone who closed the tab, whose card
|
|
11
|
+
* was declined, or whose subscription has since lapsed. Same code path, so the
|
|
12
|
+
* recovery looks exactly like the first run rather than being a differently-worded
|
|
13
|
+
* special case.
|
|
14
|
+
*
|
|
15
|
+
* It opens the Bitmagic Pro storefront, which sells a subscription AND redeems a
|
|
16
|
+
* Pro voucher — so this is the command to reach for with a comped-Pro code too.
|
|
14
17
|
*/
|
|
15
|
-
const deviceFlowDeps = { fetch: globalThis.fetch, sleep: (ms) => new Promise((r) => setTimeout(r, ms)) };
|
|
16
18
|
export const subscribeCommand = defineCommand({
|
|
17
19
|
meta: { name: 'subscribe', description: 'Start a Bitmagic Pro subscription, which the CLI requires.' },
|
|
18
20
|
args: {
|
|
19
21
|
env: { type: 'string', description: 'Environment to subscribe in (dev, prod, local).' },
|
|
20
|
-
'no-wait': { type: 'boolean', description: 'Open
|
|
22
|
+
'no-wait': { type: 'boolean', description: 'Open the Bitmagic Pro page and exit instead of waiting for it to complete.' },
|
|
21
23
|
json: {
|
|
22
24
|
type: 'boolean',
|
|
23
25
|
description: 'Print the result as JSON on stdout; all progress goes to stderr.',
|
|
@@ -27,20 +29,22 @@ export const subscribeCommand = defineCommand({
|
|
|
27
29
|
const output = createOutput(args.json === true);
|
|
28
30
|
const environment = resolveEnvironmentForCommand({ explicit: args.env });
|
|
29
31
|
const clientId = resolveAuth0ClientId(environment);
|
|
30
|
-
const token = await getAccessToken(environment, clientId,
|
|
32
|
+
const token = await getAccessToken(environment, clientId, defaultSubscribeDeps);
|
|
31
33
|
const me = await fetchWhoami(environment, token, defaultSubscribeDeps);
|
|
34
|
+
// Both status lines below come from describeProStatus, the one place the
|
|
35
|
+
// wording and the date live (`login` and `whoami` print it too). It also warns
|
|
36
|
+
// when a live subscription will NOT renew — precisely why someone would run
|
|
37
|
+
// this command while still entitled, and what a second hand-written
|
|
38
|
+
// "already active. Renews X." line got wrong.
|
|
32
39
|
if (me.pro) {
|
|
33
|
-
|
|
34
|
-
// which is the question behind the question.
|
|
35
|
-
const until = me.proUntil ? ` Renews ${me.proUntil.slice(0, 10)}.` : '';
|
|
36
|
-
output.info(`Bitmagic Pro is already active for ${me.userId}.${until}`);
|
|
40
|
+
output.info(`Signed in as ${me.userId}. ${describeProStatus(me)}`);
|
|
37
41
|
output.result({ ok: true, pro: true, userId: me.userId, proUntil: me.proUntil ?? null });
|
|
38
42
|
return;
|
|
39
43
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const result = await runSubscribeFlow(environment, token, output, {
|
|
44
|
+
// A returning creator whose subscription lapsed should be told so.
|
|
45
|
+
if (me.proUntil)
|
|
46
|
+
output.info(describeProStatus(me));
|
|
47
|
+
const result = await runSubscribeFlow(environment, token, me, output, {
|
|
44
48
|
noOpen: args.json === true,
|
|
45
49
|
noWait: args['no-wait'] === true,
|
|
46
50
|
});
|
|
@@ -48,7 +52,7 @@ export const subscribeCommand = defineCommand({
|
|
|
48
52
|
ok: true,
|
|
49
53
|
pro: result.pro,
|
|
50
54
|
userId: me.userId,
|
|
51
|
-
|
|
55
|
+
subscribeUrl: result.subscribeUrl,
|
|
52
56
|
...(result.reason ? { reason: result.reason } : {}),
|
|
53
57
|
});
|
|
54
58
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscribe.js","sourceRoot":"","sources":["../../src/commands/subscribe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,4BAA4B,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"subscribe.js","sourceRoot":"","sources":["../../src/commands/subscribe.ts"],"names":[],"mappings":"A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QAC9C,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC;YACX,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,MAAM,KAAK,iBAAiB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACnE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,CAAC,QAAQ,IAAI,IAAI,EAAE,CAAC,CAAC;YACzF,OAAO;QACT,CAAC;QAED,mEAAmE;QACnE,IAAI,EAAE,CAAC,QAAQ;YAAE,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC;QAEpD,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE;YACpE,MAAM,EAAE,IAAI,CAAC,IAAI,KAAK,IAAI;YAC1B,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI;SACjC,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC;YACZ,EAAE,EAAE,IAAI;YACR,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,MAAM,EAAE,EAAE,CAAC,MAAM;YACjB,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACpD,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Output } from '../output.js';
|
|
2
2
|
import type { AgentsMdOutcome } from '../scaffold/agents-md.js';
|
|
3
3
|
import { type DependencyMismatch } from '../scaffold/dependency-diff.js';
|
|
4
|
+
import { type UpdateTag } from '../update/notice.js';
|
|
4
5
|
export interface GitStatus {
|
|
5
6
|
dirty: boolean;
|
|
6
7
|
}
|
|
@@ -81,7 +82,7 @@ export interface CliUpdateStatus {
|
|
|
81
82
|
* the time it runs, and `fetchLatestVersion` carries its own short timeout and swallows every
|
|
82
83
|
* failure into null. A sulking registry costs a hint, never the upgrade.
|
|
83
84
|
*/
|
|
84
|
-
export declare function reportCliUpdate(output: Output, engineChanged: boolean, version?: string, fetchLatest?: () => Promise<string | null>): Promise<CliUpdateStatus | null>;
|
|
85
|
+
export declare function reportCliUpdate(output: Output, engineChanged: boolean, version?: string, tag?: UpdateTag, fetchLatest?: () => Promise<string | null>): Promise<CliUpdateStatus | null>;
|
|
85
86
|
export declare const upgradeCommand: import("citty").CommandDef<{
|
|
86
87
|
readonly engine: {
|
|
87
88
|
readonly type: "string";
|
package/dist/commands/upgrade.js
CHANGED
|
@@ -15,7 +15,7 @@ import { loadProjectContext } from '../project/context.js';
|
|
|
15
15
|
import { addCommand, detectPackageManager } from '../project/package-manager.js';
|
|
16
16
|
import { isOlderSemverVersion } from '../project/version-compare.js';
|
|
17
17
|
import { fetchTagVersion } from '../update/check.js';
|
|
18
|
-
import { installCommandFor, updateTagFor } from '../update/notice.js';
|
|
18
|
+
import { installCommandFor, updateTagFor, updateTagForEnvironment } from '../update/notice.js';
|
|
19
19
|
import { currentCliVersion } from '../update/cli-version.js';
|
|
20
20
|
const deps = {
|
|
21
21
|
fetch: globalThis.fetch,
|
|
@@ -202,8 +202,12 @@ export function reportMissingDesignDoc(output, root) {
|
|
|
202
202
|
* failure into null. A sulking registry costs a hint, never the upgrade.
|
|
203
203
|
*/
|
|
204
204
|
export async function reportCliUpdate(output, engineChanged, version = currentCliVersion(),
|
|
205
|
-
//
|
|
206
|
-
|
|
205
|
+
// The line to ask about and to name. Defaults to the one this build is already on; `upgrade`
|
|
206
|
+
// passes the one the project's environment implies, so a creator on the wrong line here is told
|
|
207
|
+
// to cross over rather than offered the newest build of a line that does not fit their project.
|
|
208
|
+
tag = updateTagFor(version),
|
|
209
|
+
// A later default may reference an earlier parameter, which is why this one comes after `tag`.
|
|
210
|
+
fetchLatest = () => fetchTagVersion(tag)) {
|
|
207
211
|
if (!engineChanged)
|
|
208
212
|
return null;
|
|
209
213
|
const latest = await fetchLatest();
|
|
@@ -213,7 +217,7 @@ fetchLatest = () => fetchTagVersion(updateTagFor(version))) {
|
|
|
213
217
|
if (updateAvailable) {
|
|
214
218
|
output.info('');
|
|
215
219
|
output.info(`Your CLI is older than the engine you just vendored: ${latest} is on npm, you have ${version}.`);
|
|
216
|
-
output.info(` Run \`${installCommandFor(
|
|
220
|
+
output.info(` Run \`${installCommandFor(tag)}\` before the next build.`);
|
|
217
221
|
output.info(' The CLI and the engine ship together, so a newer engine can need build config or a ' +
|
|
218
222
|
'command only the newer CLI has.');
|
|
219
223
|
}
|
|
@@ -297,7 +301,10 @@ export const upgradeCommand = defineCommand({
|
|
|
297
301
|
// Printed ahead of the other advisories on purpose: an out-of-date CLI can invalidate them
|
|
298
302
|
// (the dependency list and the skills are the ones this CLI knows about, not the ones the
|
|
299
303
|
// engine that just landed may want), so it is the first thing to act on.
|
|
300
|
-
|
|
304
|
+
// The tag comes from the project's environment, not from the installed version: the engine
|
|
305
|
+
// just vendored came from THIS environment, so the CLI that ships with it is on that
|
|
306
|
+
// environment's line — which is the same rule AGENTS.md hands the agent.
|
|
307
|
+
const cliUpdate = await reportCliUpdate(output, result.previousEngineVersion !== result.engineVersion, currentCliVersion(), updateTagForEnvironment(environment.name));
|
|
301
308
|
const mismatches = printDependencyReport(output, context.root);
|
|
302
309
|
reportAgentsMd(output, result.agentsMd);
|
|
303
310
|
const needsDesignDoc = reportMissingDesignDoc(output, context.root);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,YAAY,EAAe,MAAM,cAAc,CAAC;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C,MAAM;oBAC9B,eAAe,EAAE,MAAM,CAAC,QAAQ,CAAC,eAAe;oBAChD,YAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,YAAY,IAAI,IAAI;iBACnD;aACF,CAAC,CAAC;QACL,CAAC;gBAAS,CAAC;YACT,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -52,4 +52,18 @@ export interface CommandEnvironmentOptions {
|
|
|
52
52
|
export declare function selectEnvironmentForCommand(options?: CommandEnvironmentOptions): EnvironmentSelection;
|
|
53
53
|
/** The common case: the environment, without caring which input chose it. */
|
|
54
54
|
export declare function resolveEnvironmentForCommand(options?: CommandEnvironmentOptions): Environment;
|
|
55
|
+
/**
|
|
56
|
+
* What the project itself says it belongs to — its committed pin, and nothing else.
|
|
57
|
+
*
|
|
58
|
+
* A different question from `selectEnvironmentForCommand`, which answers "where should THIS command
|
|
59
|
+
* point" and therefore lets `--env`, `BITMAGIC_ENV` and the stored default in. Some answers are
|
|
60
|
+
* properties of the project rather than of one invocation — which npm line its CLI comes from is
|
|
61
|
+
* the first — and for those an override must not change the answer.
|
|
62
|
+
*
|
|
63
|
+
* Undefined for every "we do not know": no project, a project scaffolded before the field existed,
|
|
64
|
+
* an unrecognised value, and an unreadable bitmagic.json. That is the opposite of `selectEnvironment`
|
|
65
|
+
* on purpose — this feeds an advisory printed before any command runs, where a thrown CliError would
|
|
66
|
+
* turn a malformed file into a CLI that cannot run at all.
|
|
67
|
+
*/
|
|
68
|
+
export declare function readPinnedEnvironment(cwd?: string): EnvironmentName | undefined;
|
|
55
69
|
export declare function resolveAuth0ClientId(environment: Environment, env?: Record<string, string | undefined>): string;
|
|
@@ -120,6 +120,28 @@ export function selectEnvironmentForCommand(options = {}) {
|
|
|
120
120
|
export function resolveEnvironmentForCommand(options = {}) {
|
|
121
121
|
return selectEnvironmentForCommand(options).environment;
|
|
122
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* What the project itself says it belongs to — its committed pin, and nothing else.
|
|
125
|
+
*
|
|
126
|
+
* A different question from `selectEnvironmentForCommand`, which answers "where should THIS command
|
|
127
|
+
* point" and therefore lets `--env`, `BITMAGIC_ENV` and the stored default in. Some answers are
|
|
128
|
+
* properties of the project rather than of one invocation — which npm line its CLI comes from is
|
|
129
|
+
* the first — and for those an override must not change the answer.
|
|
130
|
+
*
|
|
131
|
+
* Undefined for every "we do not know": no project, a project scaffolded before the field existed,
|
|
132
|
+
* an unrecognised value, and an unreadable bitmagic.json. That is the opposite of `selectEnvironment`
|
|
133
|
+
* on purpose — this feeds an advisory printed before any command runs, where a thrown CliError would
|
|
134
|
+
* turn a malformed file into a CLI that cannot run at all.
|
|
135
|
+
*/
|
|
136
|
+
export function readPinnedEnvironment(cwd) {
|
|
137
|
+
try {
|
|
138
|
+
const pinned = readProjectEnvironment(cwd);
|
|
139
|
+
return pinned !== undefined && isEnvironmentName(pinned) ? pinned : undefined;
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
123
145
|
export function resolveAuth0ClientId(environment, env = process.env) {
|
|
124
146
|
const clientId = env.BITMAGIC_AUTH0_CLIENT_ID ?? environment.auth0ClientId;
|
|
125
147
|
if (!clientId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environments.js","sourceRoot":"","sources":["../../src/config/environments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAa1D,MAAM,gBAAgB,GAAG,kCAAkC,CAAC;AAC5D,MAAM,kBAAkB,GAAG,4BAA4B,CAAC;AAExD,8FAA8F;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AAO,CAAC;QACtD,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,CAAC,CAAC;AACL,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,4BAA4B,CAAC,UAAqC,EAAE;IAClF,OAAO,2BAA2B,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC;AAC1D,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAY;IAChD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAC;QAC3C,OAAO,MAAM,KAAK,SAAS,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAChF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,WAAwB,EACxB,MAA0C,OAAO,CAAC,GAAG;IAErD,MAAM,QAAQ,GAAG,GAAG,CAAC,wBAAwB,IAAI,WAAW,CAAC,aAAa,CAAC;IAC3E,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,QAAQ,CAChB,6CAA6C,WAAW,CAAC,IAAI,iBAAiB;YAC5E,gFAAgF;YAChF,yCAAyC,CAC5C,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* An error whose message is meant for the user, not a stack trace.
|
|
3
3
|
* cli.ts prints the message and exits with `exitCode`.
|
|
4
|
+
*
|
|
5
|
+
* `code` is a short machine-readable category (`not_logged_in`, `unreachable`,
|
|
6
|
+
* `pro_expired`, ...) for the command-outcome report the CLI sends to api-server
|
|
7
|
+
* (telemetry/report.ts). It is deliberately NOT the message: messages name
|
|
8
|
+
* paths, games and balances, and none of that belongs in an analytics event.
|
|
9
|
+
* Optional, because most refusals are one-of-a-kind and are counted under the
|
|
10
|
+
* generic bucket by exit code alone; set it at the shared throw sites — the
|
|
11
|
+
* http client, the session — where one line classifies a whole family.
|
|
4
12
|
*/
|
|
5
13
|
export declare class CliError extends Error {
|
|
6
14
|
readonly exitCode: number;
|
|
7
|
-
|
|
15
|
+
readonly code: string | undefined;
|
|
16
|
+
constructor(message: string, exitCode?: number, code?: string);
|
|
8
17
|
}
|
package/dist/errors.js
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* An error whose message is meant for the user, not a stack trace.
|
|
3
3
|
* cli.ts prints the message and exits with `exitCode`.
|
|
4
|
+
*
|
|
5
|
+
* `code` is a short machine-readable category (`not_logged_in`, `unreachable`,
|
|
6
|
+
* `pro_expired`, ...) for the command-outcome report the CLI sends to api-server
|
|
7
|
+
* (telemetry/report.ts). It is deliberately NOT the message: messages name
|
|
8
|
+
* paths, games and balances, and none of that belongs in an analytics event.
|
|
9
|
+
* Optional, because most refusals are one-of-a-kind and are counted under the
|
|
10
|
+
* generic bucket by exit code alone; set it at the shared throw sites — the
|
|
11
|
+
* http client, the session — where one line classifies a whole family.
|
|
4
12
|
*/
|
|
5
13
|
export class CliError extends Error {
|
|
6
14
|
exitCode;
|
|
7
|
-
|
|
15
|
+
code;
|
|
16
|
+
constructor(message, exitCode = 1, code) {
|
|
8
17
|
super(message);
|
|
9
18
|
this.name = 'CliError';
|
|
10
19
|
this.exitCode = exitCode;
|
|
20
|
+
this.code = code;
|
|
11
21
|
}
|
|
12
22
|
}
|
|
13
23
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK;IACxB,QAAQ,CAAS;IACjB,IAAI,CAAqB;IAElC,YAAY,OAAe,EAAE,QAAQ,GAAG,CAAC,EAAE,IAAa;QACtD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -247,7 +247,7 @@ export async function runForgePipeline(options) {
|
|
|
247
247
|
throw new CliError(`The level was designed, forged and baked successfully, but could not be written into `
|
|
248
248
|
+ `world.json: ${detail} world.json is UNCHANGED — the level is not lost, it has been paid `
|
|
249
249
|
+ 'for and is saved server-side, but it is not yet in your project. Fix the problem above '
|
|
250
|
-
+ 'and resume this job; nothing will be re-forged or re-billed.', error instanceof CliError ? error.exitCode : 1);
|
|
250
|
+
+ 'and resume this job; nothing will be re-forged or re-billed.', error instanceof CliError ? error.exitCode : 1, error instanceof CliError ? error.code : undefined);
|
|
251
251
|
}
|
|
252
252
|
// The world-space heightfield, next to world.json, so objects placed AFTER this forge can
|
|
253
253
|
// resolve `placeOnTerrain` Y on the forged surface — a placement raycast cannot, because the
|