@bitmagic/cli 0.1.46-dev.2 → 0.1.46-dev.3
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 +1 -0
- package/dist/auth/subscribe-flow.d.ts +29 -6
- package/dist/auth/subscribe-flow.js +64 -29
- package/dist/auth/subscribe-flow.js.map +1 -1
- package/dist/cli.d.ts +19 -1
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/init.js +6 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/login.js +11 -5
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/reset-account.d.ts +90 -0
- package/dist/commands/reset-account.js +211 -0
- package/dist/commands/reset-account.js.map +1 -0
- package/dist/commands/subscribe.d.ts +1 -1
- package/dist/commands/subscribe.js +10 -7
- package/dist/commands/subscribe.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -92,6 +92,7 @@ browser reloads itself on every change and the assets panel shows each generatio
|
|
|
92
92
|
| `bitmagic usage [--days N]` | Where this account's sparks went, and what Pro allowance is left. |
|
|
93
93
|
| `bitmagic allowance [--allow-sparks \| --block-sparks]` | The two Pro allowance windows, and whether your purchased sparks may fund work once they run out. `--allow-sparks` needs a real terminal — it authorises spending your money, so an agent cannot run it for you. |
|
|
94
94
|
| `bitmagic logout [--env <env>]` | Remove stored credentials for an environment. |
|
|
95
|
+
| `bitmagic reset-account [--env <env>] [--yes] [--uninstall]` | **Deletes your account** on `dev` or `local` so the first-run experience can be tested again — games, sparks, profile, terms acceptance and Bitmagic Pro (cancelled in Stripe first). Then clears that environment's stored credentials. Refuses `prod`, where the endpoint is not deployed at all. Asks you to type the environment name; `--yes` skips that and is required in a shell with no terminal. `--uninstall` also removes the global CLI afterwards, so the next run starts at `npm install -g`. Your project directory is left alone — its `gameId` no longer exists, so start the fresh run in a new one. |
|
|
95
96
|
| `bitmagic whoami [--env <env>]` | Show the identity the CLI is authenticated as, and which environment answered — including where that environment was chosen from. |
|
|
96
97
|
| `bitmagic init [dir] [--template <id>] [--name <name>] [--idea "<pitch>"] [--env <env>] [--force]` | Scaffold a new project: mints a game, downloads the vendored engine, writes `AGENTS.md`, `GAME-DESIGN.md` and templates. Starts from `empty-3d` unless told otherwise. `--idea` seeds the design doc's pitch **and** picks the template whose camera and controls fit it — "a doom-like corridor shooter" scaffolds `first-person`, "jump between floating islands" scaffolds `sidescroller`. `--template` overrides both; a suggestion that fails for any reason falls back to `empty-3d` rather than failing the scaffold. |
|
|
97
98
|
| `bitmagic check` | Typecheck (`tsc --noEmit`) against the vendored engine. Fast; does not prove the game runs. |
|
|
@@ -13,6 +13,15 @@ export interface WhoamiResponse {
|
|
|
13
13
|
proUntil: string | null;
|
|
14
14
|
/** Set when the subscription is live but will not renew. Optional: older api-servers omit it. */
|
|
15
15
|
cancelAtPeriodEnd?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The Bitmagic Pro storefront — where Pro is bought OR a Pro voucher redeemed.
|
|
18
|
+
*
|
|
19
|
+
* Optional for the same reason `cancelAtPeriodEnd` is: a CLI published today
|
|
20
|
+
* can be pointed at an api-server deployed before the storefront existed, and
|
|
21
|
+
* must still be able to sell a subscription. Absent means "fall back to
|
|
22
|
+
* minting Stripe Checkout myself".
|
|
23
|
+
*/
|
|
24
|
+
subscribeUrl?: string;
|
|
16
25
|
}
|
|
17
26
|
/**
|
|
18
27
|
* PURE. One line describing where the caller's subscription stands.
|
|
@@ -42,18 +51,32 @@ export interface SubscribeOptions {
|
|
|
42
51
|
noWait?: boolean;
|
|
43
52
|
}
|
|
44
53
|
export interface SubscribeResult {
|
|
45
|
-
/** True when
|
|
54
|
+
/** True when Pro was confirmed active before we returned. */
|
|
46
55
|
pro: boolean;
|
|
47
|
-
/**
|
|
48
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Where the creator finishes subscribing: the storefront, or — against an
|
|
58
|
+
* api-server predating it — a Stripe Checkout URL. Absent if already subscribed.
|
|
59
|
+
*/
|
|
60
|
+
subscribeUrl?: string;
|
|
49
61
|
/** Why we stopped waiting, when we did not confirm. */
|
|
50
62
|
reason?: 'timeout' | 'not-waited';
|
|
51
63
|
}
|
|
52
64
|
/**
|
|
53
|
-
*
|
|
65
|
+
* PURE. The storefront URL to open for this caller.
|
|
66
|
+
*
|
|
67
|
+
* `cli=1` only changes the page's wording — it says "go back to your terminal"
|
|
68
|
+
* once Pro is active. `u` is the account this CLI is authenticated as, so the
|
|
69
|
+
* page can refuse to sell Pro to a DIFFERENT account that happens to be signed
|
|
70
|
+
* in to the browser. That mismatch was impossible while the CLI minted the
|
|
71
|
+
* Stripe session from its own token, and it is invisible from here: the creator
|
|
72
|
+
* would subscribe the wrong account and this poll would run to its timeout.
|
|
73
|
+
*/
|
|
74
|
+
export declare function storefrontUrlFor(subscribeUrl: string, userId: string): string;
|
|
75
|
+
/**
|
|
76
|
+
* Explain that Pro is required, open the storefront, and wait for it to land.
|
|
54
77
|
*
|
|
55
78
|
* Returns rather than throwing when the creator does not finish: abandoning
|
|
56
|
-
*
|
|
79
|
+
* the flow is a decision, not an error, and the credentials from a successful
|
|
57
80
|
* login are still worth keeping.
|
|
58
81
|
*/
|
|
59
|
-
export declare function runSubscribeFlow(environment: Environment, token: string, output: Output, options?: SubscribeOptions, deps?: SubscribeDeps): Promise<SubscribeResult>;
|
|
82
|
+
export declare function runSubscribeFlow(environment: Environment, token: string, me: WhoamiResponse, output: Output, options?: SubscribeOptions, deps?: SubscribeDeps): Promise<SubscribeResult>;
|
|
@@ -1,19 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Getting a logged-in creator from "no subscription" to "ready to work".
|
|
3
3
|
*
|
|
4
|
-
* The Bitmagic CLI requires
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* The Bitmagic CLI requires active Bitmagic Pro, so for a new creator the very
|
|
5
|
+
* first command would otherwise be a 403. Rather than print an error and a URL
|
|
6
|
+
* to retype, the CLI opens the Bitmagic Pro storefront: `bitmagic login` flows
|
|
7
|
+
* straight from the device-code approval into subscribing, in the same browser,
|
|
8
|
+
* and then confirms.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
* entitlement gate for exactly this reason (see cli-onboarding-routes.ts):
|
|
12
|
-
* `GET /whoami` answers whether the caller is entitled, and
|
|
13
|
-
* `POST /pro/checkout` mints a checkout URL for the caller's own account.
|
|
10
|
+
* ── Why a storefront and not Stripe Checkout ─────────────────────────────────
|
|
14
11
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
12
|
+
* This used to POST /pro/checkout and open the Stripe URL directly. That made a
|
|
13
|
+
* comped-Pro voucher unreachable from the CLI even though `pro_days` satisfies
|
|
14
|
+
* the entitlement gate exactly as a subscription does — someone holding a code
|
|
15
|
+
* was shown a card form and nothing else. The storefront offers both, and the
|
|
16
|
+
* poll below does not care which one the creator picked: `whoami` reports a
|
|
17
|
+
* grant and a subscription identically.
|
|
18
|
+
*
|
|
19
|
+
* The URL comes from `whoami` rather than from the CLI's own config, because
|
|
20
|
+
* PORTAL_URL is the api-server's to know. Deriving it from `apiUrl` would be
|
|
21
|
+
* wrong locally, where the api-server is on 3002 and the portal on 4000.
|
|
22
|
+
*
|
|
23
|
+
* Both routes live OUTSIDE the CLI's entitlement gate for the obvious reason
|
|
24
|
+
* (see cli-onboarding-routes.ts): `GET /whoami` answers whether the caller is
|
|
25
|
+
* entitled and where to fix it, and `POST /pro/checkout` — now called by the
|
|
26
|
+
* storefront, and by this file only against an api-server too old to have one —
|
|
27
|
+
* mints a checkout URL for the caller's own account.
|
|
28
|
+
*
|
|
29
|
+
* Shared by `login` and by `subscribe`, so a creator who abandoned the flow gets
|
|
30
|
+
* an identical second run rather than a different-looking recovery path.
|
|
17
31
|
*/
|
|
18
32
|
import { apiGet, apiPost } from '../http/client.js';
|
|
19
33
|
import { openInBrowser } from '../open-browser.js';
|
|
@@ -50,18 +64,34 @@ export function fetchWhoami(environment, token, deps) {
|
|
|
50
64
|
return apiGet(environment, '/api/cli/v1/whoami', token, { fetch: deps.fetch });
|
|
51
65
|
}
|
|
52
66
|
/**
|
|
53
|
-
*
|
|
67
|
+
* PURE. The storefront URL to open for this caller.
|
|
68
|
+
*
|
|
69
|
+
* `cli=1` only changes the page's wording — it says "go back to your terminal"
|
|
70
|
+
* once Pro is active. `u` is the account this CLI is authenticated as, so the
|
|
71
|
+
* page can refuse to sell Pro to a DIFFERENT account that happens to be signed
|
|
72
|
+
* in to the browser. That mismatch was impossible while the CLI minted the
|
|
73
|
+
* Stripe session from its own token, and it is invisible from here: the creator
|
|
74
|
+
* would subscribe the wrong account and this poll would run to its timeout.
|
|
75
|
+
*/
|
|
76
|
+
export function storefrontUrlFor(subscribeUrl, userId) {
|
|
77
|
+
const separator = subscribeUrl.includes('?') ? '&' : '?';
|
|
78
|
+
return `${subscribeUrl}${separator}cli=1&u=${encodeURIComponent(userId)}`;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Explain that Pro is required, open the storefront, and wait for it to land.
|
|
54
82
|
*
|
|
55
83
|
* Returns rather than throwing when the creator does not finish: abandoning
|
|
56
|
-
*
|
|
84
|
+
* the flow is a decision, not an error, and the credentials from a successful
|
|
57
85
|
* login are still worth keeping.
|
|
58
86
|
*/
|
|
59
|
-
export async function runSubscribeFlow(environment, token, output, options = {}, deps = defaultSubscribeDeps) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
87
|
+
export async function runSubscribeFlow(environment, token, me, output, options = {}, deps = defaultSubscribeDeps) {
|
|
88
|
+
// An api-server too old to serve a storefront still has to be able to sell a
|
|
89
|
+
// subscription, so fall back to minting Checkout the way this flow used to.
|
|
90
|
+
const url = me.subscribeUrl
|
|
91
|
+
? storefrontUrlFor(me.subscribeUrl, me.userId)
|
|
92
|
+
: (await apiPost(environment, '/api/cli/v1/pro/checkout', token, {}, { fetch: deps.fetch })).url;
|
|
63
93
|
output.info('');
|
|
64
|
-
output.info('The Bitmagic CLI needs
|
|
94
|
+
output.info('The Bitmagic CLI needs Bitmagic Pro.');
|
|
65
95
|
output.info('Pro gives you a weekly and a 5-hour spark allowance that refill on their own,');
|
|
66
96
|
output.info('and pays for generating assets, cover art and worlds.');
|
|
67
97
|
output.info('');
|
|
@@ -69,34 +99,39 @@ export async function runSubscribeFlow(environment, token, output, options = {},
|
|
|
69
99
|
// no browser, in a container, and in a log an agent reads back later.
|
|
70
100
|
const opened = options.noOpen === true
|
|
71
101
|
? false
|
|
72
|
-
: deps.openInBrowser(
|
|
73
|
-
|
|
102
|
+
: deps.openInBrowser(url, { log: (m) => output.info(m) });
|
|
103
|
+
// Naming the voucher here and not only on the page matters: an agent driving
|
|
104
|
+
// the CLI reads this text, and the human it is working for may be holding a code.
|
|
105
|
+
output.info(opened
|
|
106
|
+
? `Opening Bitmagic Pro in your browser — subscribe, or redeem a Pro voucher there:\n ${url}`
|
|
107
|
+
: `Subscribe, or redeem a Pro voucher, at:\n ${url}`);
|
|
74
108
|
if (options.noWait === true) {
|
|
75
|
-
return { pro: false,
|
|
109
|
+
return { pro: false, subscribeUrl: url, reason: 'not-waited' };
|
|
76
110
|
}
|
|
77
111
|
output.info('');
|
|
78
|
-
output.info('Waiting for
|
|
112
|
+
output.info('Waiting for Bitmagic Pro… (Ctrl-C is safe — run `bitmagic subscribe` to resume)');
|
|
79
113
|
const deadline = deps.now() + SUBSCRIBE_POLL_TIMEOUT_MS;
|
|
80
114
|
while (deps.now() < deadline) {
|
|
81
115
|
await deps.sleep(SUBSCRIBE_POLL_INTERVAL_MS);
|
|
82
116
|
// A transient failure mid-poll must not end the flow — the creator may
|
|
83
117
|
// still be typing their card in. Only a definitive "yes" stops the loop.
|
|
84
|
-
|
|
118
|
+
// This answers for a redeemed voucher too: `pro` is entitlement, not billing.
|
|
119
|
+
let current = null;
|
|
85
120
|
try {
|
|
86
|
-
|
|
121
|
+
current = await fetchWhoami(environment, token, deps);
|
|
87
122
|
}
|
|
88
123
|
catch {
|
|
89
124
|
continue;
|
|
90
125
|
}
|
|
91
|
-
if (
|
|
126
|
+
if (current.pro) {
|
|
92
127
|
output.info('');
|
|
93
128
|
output.info('Bitmagic Pro is active. You are ready — try `bitmagic init`.');
|
|
94
|
-
return { pro: true,
|
|
129
|
+
return { pro: true, subscribeUrl: url };
|
|
95
130
|
}
|
|
96
131
|
}
|
|
97
132
|
output.info('');
|
|
98
|
-
output.info('Still waiting
|
|
99
|
-
output.info('`bitmagic subscribe` to start again.');
|
|
100
|
-
return { pro: false,
|
|
133
|
+
output.info('Still waiting. If you paid, run `bitmagic usage` once Stripe confirms; otherwise');
|
|
134
|
+
output.info('run `bitmagic subscribe` to start again.');
|
|
135
|
+
return { pro: false, subscribeUrl: url, reason: 'timeout' };
|
|
101
136
|
}
|
|
102
137
|
//# sourceMappingURL=subscribe-flow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscribe-flow.js","sourceRoot":"","sources":["../../src/auth/subscribe-flow.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"subscribe-flow.js","sourceRoot":"","sources":["../../src/auth/subscribe-flow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInD,kFAAkF;AAClF,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,GAAG,MAAM,CAAC;AACrD,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,CAAC;AAsBhD;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAAkB;IAClD,MAAM,GAAG,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9C,IAAI,EAAE,CAAC,GAAG,EA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AAE,YAAY,EAAE,CAAC;IACjE,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChB,MAAM,CAAC,IAAI,CAAC,iFAAiF,CAAC,CAAC;IAE/F,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,yBAAyB,CAAC;IACxD,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC;QAC7B,MAAM,IAAI,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC7C,uEAAuE;QACvE,yEAAyE;QACzE,8EAA8E;QAC9E,IAAI,OAAO,GAA0B,IAAI,CAAC;QAC1C,IAAI,CAAC;YACH,OAAO,GAAG,MAAM,WAAW,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACxD,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;QACD,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;YAChB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAChB,MAAM,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;YAC5E,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC;QAC1C,CAAC;IACH,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChB,MAAM,CAAC,IAAI,CAAC,kFAAkF,CAAC,CAAC;IAChG,MAAM,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;IACxD,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AAC9D,CAAC"}
|
package/dist/cli.d.ts
CHANGED
|
@@ -28,6 +28,24 @@ declare const rawCommands: {
|
|
|
28
28
|
readonly description: "Print the result as JSON on stdout; all progress goes to stderr.";
|
|
29
29
|
};
|
|
30
30
|
}>;
|
|
31
|
+
'reset-account': CommandDef<{
|
|
32
|
+
readonly env: {
|
|
33
|
+
readonly type: "string";
|
|
34
|
+
readonly description: "Environment to reset in (dev, local). Never prod.";
|
|
35
|
+
};
|
|
36
|
+
readonly yes: {
|
|
37
|
+
readonly type: "boolean";
|
|
38
|
+
readonly description: "Skip the confirmation. Required in a non-interactive shell.";
|
|
39
|
+
};
|
|
40
|
+
readonly uninstall: {
|
|
41
|
+
readonly type: "boolean";
|
|
42
|
+
readonly description: "Also `npm uninstall -g @bitmagic/cli` afterwards, so the next run starts at the install.";
|
|
43
|
+
};
|
|
44
|
+
readonly json: {
|
|
45
|
+
readonly type: "boolean";
|
|
46
|
+
readonly description: "Print the result as JSON on stdout; all progress goes to stderr.";
|
|
47
|
+
};
|
|
48
|
+
}>;
|
|
31
49
|
whoami: CommandDef<{
|
|
32
50
|
readonly env: {
|
|
33
51
|
readonly type: "string";
|
|
@@ -45,7 +63,7 @@ declare const rawCommands: {
|
|
|
45
63
|
};
|
|
46
64
|
readonly 'no-wait': {
|
|
47
65
|
readonly type: "boolean";
|
|
48
|
-
readonly description: "Open
|
|
66
|
+
readonly description: "Open the Bitmagic Pro page and exit instead of waiting for it to complete.";
|
|
49
67
|
};
|
|
50
68
|
readonly json: {
|
|
51
69
|
readonly type: "boolean";
|
package/dist/cli.js
CHANGED
|
@@ -3,6 +3,7 @@ import { CliError } from './errors.js';
|
|
|
3
3
|
import { jsonErrorResult } from './output.js';
|
|
4
4
|
import { loginCommand } from './commands/login.js';
|
|
5
5
|
import { logoutCommand } from './commands/logout.js';
|
|
6
|
+
import { resetAccountCommand } from './commands/reset-account.js';
|
|
6
7
|
import { whoamiCommand } from './commands/whoami.js';
|
|
7
8
|
import { usageCommand } from './commands/usage.js';
|
|
8
9
|
import { allowanceCommand } from './commands/allowance.js';
|
|
@@ -101,6 +102,7 @@ export function isWrappedWithCleanErrors(command) {
|
|
|
101
102
|
const rawCommands = {
|
|
102
103
|
login: loginCommand,
|
|
103
104
|
logout: logoutCommand,
|
|
105
|
+
'reset-account': resetAccountCommand,
|
|
104
106
|
whoami: whoamiCommand,
|
|
105
107
|
subscribe: subscribeCommand,
|
|
106
108
|
usage: usageCommand,
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,6FAA6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ACjG,8FAA8F;AAC9F,uFAAuF;AACvF,4FAA4F;AAC5F,MAAM,CAAC,MAAM,IAAI,GAAG,aAAa,CAAC;IAChC,IAAI,EAAE;QACJ,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,gDAAgD;KAC9D;IACD,WAAW;CACZ,CAAC,CAAC"}
|
package/dist/commands/init.js
CHANGED
|
@@ -69,6 +69,12 @@ function installDependencies(dir) {
|
|
|
69
69
|
function printNextSteps(output, dir, gameId, installSucceeded, hasIdea) {
|
|
70
70
|
output.info('');
|
|
71
71
|
output.info(`Created ${dir} (game ${gameId}).`);
|
|
72
|
+
// Notice at the moment the engine actually lands on their disk, which is the strongest place
|
|
73
|
+
// to give it: the terms are contemporaneous with receiving the software and are written into
|
|
74
|
+
// the project itself, not linked from a page read once months ago. Sell your games, modify the
|
|
75
|
+
// engine, ship anywhere — the one thing the licence withholds is shipping the engine as an
|
|
76
|
+
// engine. See engine/LICENSE.md and docs/engine-license.md.
|
|
77
|
+
output.info('The engine is licensed to you under engine/LICENSE.md — your games are yours to sell.');
|
|
72
78
|
output.info('');
|
|
73
79
|
output.info('Next steps:');
|
|
74
80
|
output.info(` cd ${dir}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,YAAY,EAAe,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,4BAA4B,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAC/F,OAAO,EA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YAC7F,MAAM,CAAC,MAAM,CAAC;gBACZ,EAAE,EAAE,IAAI;gBACR,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,QAAQ,CAAC,EAAE;gBACrB,uFAAuF;gBACvF,iFAAiF;gBACjF,cAAc;gBACd,KAAK,EAAE,QAAQ,CAAC,KAAK;gBACrB,aAAa,EAAE,QAAQ,CAAC,OAAO;gBAC/B,0FAA0F;gBAC1F,WAAW,EAAE,WAAW,CAAC,IAAI;gBAC7B,uFAAuF;gBACvF,qBAAqB,EAAE,gBAAgB;gBACvC,2FAA2F;gBAC3F,eAAe,EAAE,IAAI,CAAC,IAAI,KAAK,SAAS;aACzC,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"}
|
package/dist/commands/login.js
CHANGED
|
@@ -44,6 +44,12 @@ export const loginCommand = defineCommand({
|
|
|
44
44
|
// subscribed yet — otherwise the first thing a new creator would meet is a 403.
|
|
45
45
|
const me = await fetchWhoami(environment, credentials.accessToken, defaultSubscribeDeps);
|
|
46
46
|
output.info(`Logged in to ${environment.name} as ${me.userId}.`);
|
|
47
|
+
// The terms notice. Placed here rather than behind a prompt on purpose: logging in IS the
|
|
48
|
+
// assenting act (api-server records which terms version this account accepted, keyed to the
|
|
49
|
+
// date on the page), so what this line owes the creator is notice, not another keystroke.
|
|
50
|
+
// The engine licence lives in section 5 of those terms and ships in full as engine/LICENSE.md.
|
|
51
|
+
// See docs/engine-license.md.
|
|
52
|
+
output.info('By using Bitmagic you agree to the terms at https://bitmagic.ai/terms-of-service');
|
|
47
53
|
if (me.pro) {
|
|
48
54
|
// Says "renews on X" — or warns when it will not, which is the only
|
|
49
55
|
// chance to mention that before a command is refused mid-work.
|
|
@@ -58,10 +64,10 @@ export const loginCommand = defineCommand({
|
|
|
58
64
|
// greeted as though they had never subscribed.
|
|
59
65
|
if (me.proUntil)
|
|
60
66
|
output.info(describeProStatus(me));
|
|
61
|
-
// Not subscribed: carry straight on
|
|
62
|
-
// error the creator has to decode. They are already in a
|
|
63
|
-
// just approved a device code in one.
|
|
64
|
-
const subscribed = await runSubscribeFlow(environment, credentials.accessToken, output, {
|
|
67
|
+
// Not subscribed: carry straight on to the Bitmagic Pro storefront rather
|
|
68
|
+
// than ending on an error the creator has to decode. They are already in a
|
|
69
|
+
// browser — they just approved a device code in one.
|
|
70
|
+
const subscribed = await runSubscribeFlow(environment, credentials.accessToken, me, output, {
|
|
65
71
|
noOpen: args.json === true,
|
|
66
72
|
});
|
|
67
73
|
output.result({
|
|
@@ -70,7 +76,7 @@ export const loginCommand = defineCommand({
|
|
|
70
76
|
userId: me.userId,
|
|
71
77
|
roles: me.roles,
|
|
72
78
|
pro: subscribed.pro,
|
|
73
|
-
...(subscribed.
|
|
79
|
+
...(subscribed.subscribeUrl ? { subscribeUrl: subscribed.subscribeUrl } : {}),
|
|
74
80
|
});
|
|
75
81
|
},
|
|
76
82
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MA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,CAAC;YACZ,EAAE,EAAE,IAAI;YACR,WAAW,EAAE,WAAW,CAAC,IAAI;YAC7B,MAAM,EAAE,EAAE,CAAC,MAAM;YACjB,KAAK,EAAE,EAAE,CAAC,KAAK;YACf,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9E,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { type Output } from '../output.js';
|
|
2
|
+
/**
|
|
3
|
+
* `bitmagic reset-account` — put your own account back to never-seen-before, so
|
|
4
|
+
* the first-run path can be walked again.
|
|
5
|
+
*
|
|
6
|
+
* Everything a new creator meets happens exactly once per identity: the device
|
|
7
|
+
* code, the terms notice, "no Bitmagic Pro subscription", Stripe checkout, the
|
|
8
|
+
* first `bitmagic init` and its 500 sparks. Testing a change to any of it used
|
|
9
|
+
* to mean finding a fresh Auth0 account. This deletes the account server-side
|
|
10
|
+
* instead, so the next `bitmagic login` provisions it from scratch.
|
|
11
|
+
*
|
|
12
|
+
* ── Why this cannot touch prod ──────────────────────────────────────────────
|
|
13
|
+
*
|
|
14
|
+
* The endpoint behind it is not registered on the production api-server at all,
|
|
15
|
+
* so the path does not exist there. This command refuses `--env prod` before it
|
|
16
|
+
* opens a socket anyway: the server would answer with a status code, and a
|
|
17
|
+
* sentence is a better thing to read than a 404.
|
|
18
|
+
*
|
|
19
|
+
* ── Why it asks ─────────────────────────────────────────────────────────────
|
|
20
|
+
*
|
|
21
|
+
* The confirmation wants the ENVIRONMENT NAME typed back, not a y/n. The whole
|
|
22
|
+
* hazard here is running the right command against the wrong environment, and
|
|
23
|
+
* "y" is the same keystroke whichever one you are pointed at. `--yes` skips it
|
|
24
|
+
* for scripts, and a non-interactive shell must pass `--yes` explicitly rather
|
|
25
|
+
* than have the prompt silently pass — an agent should not be able to delete a
|
|
26
|
+
* creator's account by running a command it read in a doc.
|
|
27
|
+
*/
|
|
28
|
+
/** What the api-server says a reset would destroy. */
|
|
29
|
+
export interface ResetPreview {
|
|
30
|
+
userId: string;
|
|
31
|
+
email: string;
|
|
32
|
+
publicId: string | null;
|
|
33
|
+
games: number;
|
|
34
|
+
sparkBalance: number;
|
|
35
|
+
hasProSubscription: boolean;
|
|
36
|
+
stripeSubscriptionId: string | null;
|
|
37
|
+
hasProGrant: boolean;
|
|
38
|
+
/** vip_users is keyed by email and survives the reset — worth saying out loud. */
|
|
39
|
+
vip: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface ResetAccountDeps {
|
|
42
|
+
fetch: typeof globalThis.fetch;
|
|
43
|
+
sleep: (ms: number) => Promise<void>;
|
|
44
|
+
/** Whether a human is at the keyboard; injected so the rule is testable. */
|
|
45
|
+
interactive: () => boolean;
|
|
46
|
+
/** Reads one line of confirmation. */
|
|
47
|
+
ask: (question: string) => Promise<string>;
|
|
48
|
+
/** Removes the globally installed CLI. Returns false if it could not. */
|
|
49
|
+
uninstall: () => boolean;
|
|
50
|
+
}
|
|
51
|
+
export declare const defaultResetDeps: ResetAccountDeps;
|
|
52
|
+
/** PURE. The lines shown before the confirmation. */
|
|
53
|
+
export declare function formatResetPreview(preview: ResetPreview, environmentName: string): string;
|
|
54
|
+
export interface ResetAccountOptions {
|
|
55
|
+
env?: string;
|
|
56
|
+
yes?: boolean;
|
|
57
|
+
uninstall?: boolean;
|
|
58
|
+
deps?: ResetAccountDeps;
|
|
59
|
+
/** Test-only credentials-directory override, matching the rest of the CLI. */
|
|
60
|
+
baseDir?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface ResetAccountResult {
|
|
63
|
+
environment: string;
|
|
64
|
+
userId: string;
|
|
65
|
+
stripeSubscriptionCanceled: boolean;
|
|
66
|
+
deleted: Record<string, number>;
|
|
67
|
+
credentialsCleared: boolean;
|
|
68
|
+
cliUninstalled: boolean;
|
|
69
|
+
}
|
|
70
|
+
export declare function runResetAccount(options: ResetAccountOptions, output: Output): Promise<ResetAccountResult>;
|
|
71
|
+
/** PURE. What to do next, given what the reset just did. */
|
|
72
|
+
export declare function formatNextSteps(result: ResetAccountResult): string;
|
|
73
|
+
export declare const resetAccountCommand: import("citty").CommandDef<{
|
|
74
|
+
readonly env: {
|
|
75
|
+
readonly type: "string";
|
|
76
|
+
readonly description: "Environment to reset in (dev, local). Never prod.";
|
|
77
|
+
};
|
|
78
|
+
readonly yes: {
|
|
79
|
+
readonly type: "boolean";
|
|
80
|
+
readonly description: "Skip the confirmation. Required in a non-interactive shell.";
|
|
81
|
+
};
|
|
82
|
+
readonly uninstall: {
|
|
83
|
+
readonly type: "boolean";
|
|
84
|
+
readonly description: "Also `npm uninstall -g @bitmagic/cli` afterwards, so the next run starts at the install.";
|
|
85
|
+
};
|
|
86
|
+
readonly json: {
|
|
87
|
+
readonly type: "boolean";
|
|
88
|
+
readonly description: "Print the result as JSON on stdout; all progress goes to stderr.";
|
|
89
|
+
};
|
|
90
|
+
}>;
|
|
@@ -0,0 +1,211 @@
|
|
|
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
|
+
function uninstallGlobally() {
|
|
19
|
+
const result = spawnSync('npm', ['uninstall', '-g', '@bitmagic/cli'], { stdio: 'inherit' });
|
|
20
|
+
return !result.error && result.status === 0;
|
|
21
|
+
}
|
|
22
|
+
export const defaultResetDeps = {
|
|
23
|
+
fetch: globalThis.fetch,
|
|
24
|
+
sleep: (ms) => new Promise((r) => setTimeout(r, ms)),
|
|
25
|
+
interactive: () => process.stdin.isTTY === true,
|
|
26
|
+
ask: askOnStdin,
|
|
27
|
+
uninstall: uninstallGlobally,
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* This command does NOT go through http/client.ts, and that is deliberate.
|
|
31
|
+
*
|
|
32
|
+
* Its shared mapping turns 503 into "this feature is unavailable in this
|
|
33
|
+
* environment" and everything else into "api-server returned HTTP n" — fine for
|
|
34
|
+
* the twenty routes that only ever fail one way, useless for this one, whose
|
|
35
|
+
* three interesting failures each need their own sentence: the endpoint is not
|
|
36
|
+
* deployed here, Stripe could not be reached so NOTHING was deleted, and Stripe
|
|
37
|
+
* is not configured so the subscription cannot be cancelled. The server sends
|
|
38
|
+
* the reason in the body; this reads it.
|
|
39
|
+
*/
|
|
40
|
+
async function resetRequest(environment, path, token, method, deps) {
|
|
41
|
+
let response;
|
|
42
|
+
try {
|
|
43
|
+
response = await deps.fetch(`${environment.apiUrl}${path}`, {
|
|
44
|
+
method,
|
|
45
|
+
headers: { Authorization: `Bearer ${token}`, Accept: 'application/json' },
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
throw new CliError(`Cannot reach api-server at ${environment.apiUrl}.`);
|
|
50
|
+
}
|
|
51
|
+
if (response.ok)
|
|
52
|
+
return (await response.json());
|
|
53
|
+
let serverMessage = null;
|
|
54
|
+
try {
|
|
55
|
+
const body = (await response.json());
|
|
56
|
+
if (typeof body.error === 'string')
|
|
57
|
+
serverMessage = body.error;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
// No body, or not JSON. The status alone still has to produce a sentence.
|
|
61
|
+
}
|
|
62
|
+
if (response.status === 401) {
|
|
63
|
+
throw new CliError('Your session has expired. Run `bitmagic login`.');
|
|
64
|
+
}
|
|
65
|
+
if (response.status === 404) {
|
|
66
|
+
// Two very different things share this status: the account is already gone
|
|
67
|
+
// (the server says so in the body) or the route was never mounted, which is
|
|
68
|
+
// what production looks like from out here.
|
|
69
|
+
if (serverMessage)
|
|
70
|
+
throw new CliError(serverMessage);
|
|
71
|
+
throw new CliError(`The "${environment.name}" api-server has no account-reset endpoint. It exists only outside ` +
|
|
72
|
+
'production, and only on api-servers new enough to have it.');
|
|
73
|
+
}
|
|
74
|
+
if (response.status === 403) {
|
|
75
|
+
throw new CliError(`The "${environment.name}" api-server refused the reset. It exists only outside production.`);
|
|
76
|
+
}
|
|
77
|
+
throw new CliError(serverMessage ?? `api-server returned HTTP ${response.status} for ${path}. Nothing was deleted.`);
|
|
78
|
+
}
|
|
79
|
+
/** PURE. The lines shown before the confirmation. */
|
|
80
|
+
export function formatResetPreview(preview, environmentName) {
|
|
81
|
+
const lines = [
|
|
82
|
+
`This DELETES your Bitmagic account on ${environmentName}.`,
|
|
83
|
+
'',
|
|
84
|
+
` account ${preview.userId} (${preview.email})`,
|
|
85
|
+
` games ${preview.games}`,
|
|
86
|
+
` sparks ${preview.sparkBalance.toLocaleString('en-US')}`,
|
|
87
|
+
];
|
|
88
|
+
if (preview.hasProSubscription) {
|
|
89
|
+
lines.push(' pro subscription — WILL BE CANCELLED IN STRIPE, then deleted');
|
|
90
|
+
}
|
|
91
|
+
else if (preview.hasProGrant) {
|
|
92
|
+
lines.push(' pro comped grant — deleted');
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
lines.push(' pro none');
|
|
96
|
+
}
|
|
97
|
+
lines.push('');
|
|
98
|
+
lines.push('Also removed: your profile, terms acceptance, XP, likes, follows, comments and');
|
|
99
|
+
lines.push('published game entries. Your next `bitmagic login` starts over from nothing.');
|
|
100
|
+
if (preview.vip) {
|
|
101
|
+
// Says so up front rather than letting it read as a failed reset later.
|
|
102
|
+
lines.push('');
|
|
103
|
+
lines.push('NOTE: this email is on the VIP list, which is keyed by email and is NOT reset.');
|
|
104
|
+
lines.push(' The new account will not start on the free tier.');
|
|
105
|
+
}
|
|
106
|
+
return lines.join('\n');
|
|
107
|
+
}
|
|
108
|
+
export async function runResetAccount(options, output) {
|
|
109
|
+
const deps = options.deps ?? defaultResetDeps;
|
|
110
|
+
const { environment } = selectEnvironmentForCommand({
|
|
111
|
+
explicit: options.env,
|
|
112
|
+
...(options.baseDir !== undefined ? { baseDir: options.baseDir } : {}),
|
|
113
|
+
});
|
|
114
|
+
// Before anything else, including reading a token: pointing this at prod is
|
|
115
|
+
// the mistake worth catching with a sentence rather than a status code.
|
|
116
|
+
if (environment.name === 'prod') {
|
|
117
|
+
throw new CliError('There is no account reset on prod — the endpoint is not deployed there. ' +
|
|
118
|
+
'Run this against dev or local (`bitmagic reset-account --env dev`).');
|
|
119
|
+
}
|
|
120
|
+
const clientId = resolveAuth0ClientId(environment);
|
|
121
|
+
const token = await getAccessToken(environment, clientId, deps, options.baseDir);
|
|
122
|
+
const { preview } = await resetRequest(environment, '/api/cli/v1/account/reset/preview', token, 'GET', deps);
|
|
123
|
+
output.info(formatResetPreview(preview, environment.name));
|
|
124
|
+
output.info('');
|
|
125
|
+
if (options.yes !== true) {
|
|
126
|
+
if (!deps.interactive()) {
|
|
127
|
+
throw new CliError('Deleting an account has to be confirmed by a person, and this shell has no terminal. ' +
|
|
128
|
+
'Run it yourself, or pass --yes if you meant it.');
|
|
129
|
+
}
|
|
130
|
+
// The environment name, not y/n: the hazard is doing the right thing to the
|
|
131
|
+
// wrong environment, and "y" reads identically whichever one you are on.
|
|
132
|
+
const answer = await deps.ask(`Type "${environment.name}" to confirm: `);
|
|
133
|
+
if (answer !== environment.name) {
|
|
134
|
+
throw new CliError('Not confirmed — nothing was deleted.');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const result = await resetRequest(environment, '/api/cli/v1/account/reset', token, 'POST', deps);
|
|
138
|
+
if (result.stripeSubscriptionCanceled)
|
|
139
|
+
output.info('Cancelled the Bitmagic Pro subscription in Stripe.');
|
|
140
|
+
output.info(`Deleted the account on ${environment.name}.`);
|
|
141
|
+
// A cached access token outliving the user row would leave the CLI looking
|
|
142
|
+
// logged in as an account that no longer exists — and the first command to
|
|
143
|
+
// notice would fail somewhere unrelated.
|
|
144
|
+
clearCredentials(environment.name, options.baseDir);
|
|
145
|
+
output.info(`Cleared the stored ${environment.name} credentials.`);
|
|
146
|
+
// Last, because it removes the code this process is running from. Safe where
|
|
147
|
+
// it matters: every module is already loaded by the time this line runs, and
|
|
148
|
+
// nothing after it does a dynamic import — only already-resident code and Node
|
|
149
|
+
// builtins. Do not add an `await import()` below this point.
|
|
150
|
+
let cliUninstalled = false;
|
|
151
|
+
if (options.uninstall === true) {
|
|
152
|
+
cliUninstalled = deps.uninstall();
|
|
153
|
+
}
|
|
154
|
+
return {
|
|
155
|
+
environment: environment.name,
|
|
156
|
+
userId: result.userId,
|
|
157
|
+
stripeSubscriptionCanceled: result.stripeSubscriptionCanceled,
|
|
158
|
+
deleted: result.deleted,
|
|
159
|
+
credentialsCleared: true,
|
|
160
|
+
cliUninstalled,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/** PURE. What to do next, given what the reset just did. */
|
|
164
|
+
export function formatNextSteps(result) {
|
|
165
|
+
const lines = [
|
|
166
|
+
'',
|
|
167
|
+
'Next:',
|
|
168
|
+
];
|
|
169
|
+
if (result.cliUninstalled) {
|
|
170
|
+
// The full first run starts at the install, which is why --uninstall exists.
|
|
171
|
+
lines.push(' npm install -g @bitmagic/cli');
|
|
172
|
+
}
|
|
173
|
+
lines.push(` bitmagic login${result.environment === 'dev' ? '' : ` --env ${result.environment}`}`);
|
|
174
|
+
lines.push(' bitmagic init <a new directory>');
|
|
175
|
+
lines.push('');
|
|
176
|
+
lines.push('Any project you scaffolded earlier still names a gameId that no longer exists —');
|
|
177
|
+
lines.push('nothing on disk was touched, so start the fresh run in a new directory.');
|
|
178
|
+
return lines.join('\n');
|
|
179
|
+
}
|
|
180
|
+
export const resetAccountCommand = defineCommand({
|
|
181
|
+
meta: {
|
|
182
|
+
name: 'reset-account',
|
|
183
|
+
description: 'Delete your account on dev or local so the first-run experience can be tested again.',
|
|
184
|
+
},
|
|
185
|
+
args: {
|
|
186
|
+
env: { type: 'string', description: 'Environment to reset in (dev, local). Never prod.' },
|
|
187
|
+
yes: { type: 'boolean', description: 'Skip the confirmation. Required in a non-interactive shell.' },
|
|
188
|
+
uninstall: {
|
|
189
|
+
type: 'boolean',
|
|
190
|
+
description: 'Also `npm uninstall -g @bitmagic/cli` afterwards, so the next run starts at the install.',
|
|
191
|
+
},
|
|
192
|
+
json: {
|
|
193
|
+
type: 'boolean',
|
|
194
|
+
description: 'Print the result as JSON on stdout; all progress goes to stderr.',
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
async run({ args }) {
|
|
198
|
+
const output = createOutput(args.json === true);
|
|
199
|
+
const result = await runResetAccount({ env: args.env, yes: args.yes === true, uninstall: args.uninstall === true }, output);
|
|
200
|
+
output.info(formatNextSteps(result));
|
|
201
|
+
output.result({ ok: true, ...result });
|
|
202
|
+
if (args.uninstall === true && !result.cliUninstalled) {
|
|
203
|
+
// A warning, not a failure: the account IS reset, and the JSON document
|
|
204
|
+
// above already said so. Only the last step did not happen.
|
|
205
|
+
output.info('');
|
|
206
|
+
output.info('Warning: `npm uninstall -g @bitmagic/cli` did not succeed. If you installed the CLI with ' +
|
|
207
|
+
'pnpm, yarn or npx, remove it the same way you added it.');
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
//# 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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;QAChD,MAAM,MAAM,GAAG,MAAM,eAAe,CAClC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,KAAK,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,KAAK,IAAI,EAAE,EAC7E,MAAM,CACP,CAAC;QACF,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;QACrC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;QAEvC,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;YACtD,wEAAwE;YACxE,4DAA4D;YAC5D,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAChB,MAAM,CAAC,IAAI,CACT,2FAA2F;gBACzF,yDAAyD,CAC5D,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -5,7 +5,7 @@ export declare const subscribeCommand: import("citty").CommandDef<{
|
|
|
5
5
|
};
|
|
6
6
|
readonly 'no-wait': {
|
|
7
7
|
readonly type: "boolean";
|
|
8
|
-
readonly description: "Open
|
|
8
|
+
readonly description: "Open the Bitmagic Pro page and exit instead of waiting for it to complete.";
|
|
9
9
|
};
|
|
10
10
|
readonly json: {
|
|
11
11
|
readonly type: "boolean";
|
|
@@ -7,17 +7,20 @@ import { createOutput } from '../output.js';
|
|
|
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
18
|
const deviceFlowDeps = { fetch: globalThis.fetch, sleep: (ms) => new Promise((r) => setTimeout(r, ms)) };
|
|
16
19
|
export const subscribeCommand = defineCommand({
|
|
17
20
|
meta: { name: 'subscribe', description: 'Start a Bitmagic Pro subscription, which the CLI requires.' },
|
|
18
21
|
args: {
|
|
19
22
|
env: { type: 'string', description: 'Environment to subscribe in (dev, prod, local).' },
|
|
20
|
-
'no-wait': { type: 'boolean', description: 'Open
|
|
23
|
+
'no-wait': { type: 'boolean', description: 'Open the Bitmagic Pro page and exit instead of waiting for it to complete.' },
|
|
21
24
|
json: {
|
|
22
25
|
type: 'boolean',
|
|
23
26
|
description: 'Print the result as JSON on stdout; all progress goes to stderr.',
|
|
@@ -40,7 +43,7 @@ export const subscribeCommand = defineCommand({
|
|
|
40
43
|
if (me.proUntil) {
|
|
41
44
|
output.info(`Your previous Bitmagic Pro subscription ended on ${me.proUntil.slice(0, 10)}.`);
|
|
42
45
|
}
|
|
43
|
-
const result = await runSubscribeFlow(environment, token, output, {
|
|
46
|
+
const result = await runSubscribeFlow(environment, token, me, output, {
|
|
44
47
|
noOpen: args.json === true,
|
|
45
48
|
noWait: args['no-wait'] === true,
|
|
46
49
|
});
|
|
@@ -48,7 +51,7 @@ export const subscribeCommand = defineCommand({
|
|
|
48
51
|
ok: true,
|
|
49
52
|
pro: result.pro,
|
|
50
53
|
userId: me.userId,
|
|
51
|
-
...(result.
|
|
54
|
+
...(result.subscribeUrl ? { subscribeUrl: result.subscribeUrl } : {}),
|
|
52
55
|
...(result.reason ? { reason: result.reason } : {}),
|
|
53
56
|
});
|
|
54
57
|
},
|
|
@@ -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;AAChG,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C
|
|
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;AAChG,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;;;;;;;GAWG;AACH,MAAM,cAAc,GAAG,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAO,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC;AAEvH,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC;IAC5C,IAAI,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,4DAA4D,EAAE;IACtG,IAAI,EAAE;QACJ,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,iDAAiD,EAAE;QACvF,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE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QAC/F,CAAC;QAED,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,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACrE,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitmagic/cli",
|
|
3
|
-
"version": "0.1.46-dev.
|
|
3
|
+
"version": "0.1.46-dev.3",
|
|
4
4
|
"description": "Build Bitmagic games from your own agent tool",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "Bitmagic Oy",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"fflate": "^0.8.2",
|
|
24
24
|
"playwright-core": "^1.59.1",
|
|
25
25
|
"tar": "^7.4.3",
|
|
26
|
-
"@bitmagic/
|
|
27
|
-
"@bitmagic/
|
|
28
|
-
"@bitmagic/
|
|
26
|
+
"@bitmagic/asset-core": "0.2.1-dev.1",
|
|
27
|
+
"@bitmagic/world-forger": "0.1.6-dev.1",
|
|
28
|
+
"@bitmagic/animation-forger": "0.1.1-dev.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@eslint/js": "^9.38.0",
|