@maka/maka-cli 5.70.0 → 5.72.0
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/bundle/typescript/package.json +1 -1
- package/bundle/typescript/src/commands/_index.d.ts +1 -0
- package/bundle/typescript/src/commands/_index.js +1 -0
- package/bundle/typescript/src/commands/_index.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/backlog.d.ts +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/backlog.js +3 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/backlog.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/command-registry.js +24 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/command-registry.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/command.d.ts +18 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/command.js +20 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/command.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/roles.d.ts +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/roles.js +3 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/roles.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/utilities/backlog-dump.d.ts +10 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/backlog-dump.js +91 -1
- package/bundle/typescript/src/commands/game/sideQuest/utilities/backlog-dump.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/utilities/backlog.d.ts +41 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/backlog.js +63 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/backlog.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/utilities/detach-args.d.ts +66 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/detach-args.js +75 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/detach-args.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/repro-launch.d.ts +14 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/repro-launch.js +27 -1
- package/bundle/typescript/src/commands/game/sideQuest/utilities/repro-launch.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest-backlog.sub.cmd.js +16 -0
- package/bundle/typescript/src/commands/game/sideQuest-backlog.sub.cmd.js.map +1 -1
- package/bundle/typescript/src/commands/login.js +38 -20
- package/bundle/typescript/src/commands/login.js.map +1 -1
- package/bundle/typescript/src/commands/logout.js +36 -17
- package/bundle/typescript/src/commands/logout.js.map +1 -1
- package/bundle/typescript/src/commands/register.js +24 -10
- package/bundle/typescript/src/commands/register.js.map +1 -1
- package/bundle/typescript/src/commands/registry.js +1 -0
- package/bundle/typescript/src/commands/registry.js.map +1 -1
- package/bundle/typescript/src/commands/update.d.ts +1 -0
- package/bundle/typescript/src/commands/update.js +127 -0
- package/bundle/typescript/src/commands/update.js.map +1 -0
- package/bundle/typescript/src/tools/ai/ai.class.d.ts +18 -0
- package/bundle/typescript/src/tools/ai/ai.class.js +57 -7
- package/bundle/typescript/src/tools/ai/ai.class.js.map +1 -1
- package/bundle/typescript/src/tools/fsi/fsi.class.js +5 -5
- package/bundle/typescript/src/tools/fsi/fsi.class.js.map +1 -1
- package/bundle/typescript/src/tools/https/connection-error.d.ts +79 -0
- package/bundle/typescript/src/tools/https/connection-error.js +134 -0
- package/bundle/typescript/src/tools/https/connection-error.js.map +1 -0
- package/bundle/typescript/src/tools/https/https.class.js +35 -10
- package/bundle/typescript/src/tools/https/https.class.js.map +1 -1
- package/bundle/typescript/src/tools/https/maka-host.d.ts +43 -0
- package/bundle/typescript/src/tools/https/maka-host.js +8 -0
- package/bundle/typescript/src/tools/https/maka-host.js.map +1 -0
- package/bundle/typescript/src/tools/self-update/self-update.d.ts +76 -0
- package/bundle/typescript/src/tools/self-update/self-update.js +172 -0
- package/bundle/typescript/src/tools/self-update/self-update.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHY A CALL TO maka-cli.com DID NOT ARRIVE, in one sentence naming the
|
|
3
|
+
* origin actually dialled (board item KYaqmxeW343owAnsn).
|
|
4
|
+
*
|
|
5
|
+
* `maka login`, `maka logout` and `maka register` each print the right
|
|
6
|
+
* banner now (KtbaziFuKHh8WheFn) -- and then, when nothing answers,
|
|
7
|
+
* report the failure three DIFFERENT wrong ways:
|
|
8
|
+
*
|
|
9
|
+
* login exit 0, `console.log(e)` dumping the raw error object as a
|
|
10
|
+
* wall of node:net stack, then "If you need to reset your
|
|
11
|
+
* password..." -- advice for a failure that never happened.
|
|
12
|
+
* logout exit 0, `Log.error(e)` stringifying to the bare word
|
|
13
|
+
* "AggregateError", then "You may not be logged in...".
|
|
14
|
+
* register exit 1 (the only honest code of the three) and NO MESSAGE
|
|
15
|
+
* AT ALL, because `err.message` on an AggregateError is the
|
|
16
|
+
* empty string.
|
|
17
|
+
*
|
|
18
|
+
* Three spellings of one bug is worse than one uniform bug: it reads as
|
|
19
|
+
* three unrelated quirks, so nobody fixes the shape. Hence one helper
|
|
20
|
+
* all three share.
|
|
21
|
+
*
|
|
22
|
+
* THE EMPTY MESSAGE IS THE TRAP WORTH NAMING. Node raises AggregateError
|
|
23
|
+
* when a host resolves to several addresses (::1 and 127.0.0.1 for
|
|
24
|
+
* localhost) and every attempt fails; the real codes live on `.errors`,
|
|
25
|
+
* and `.message` is `''`. So the obvious `err.message` prints nothing,
|
|
26
|
+
* looks like a silent success, and is exactly how `register` came to
|
|
27
|
+
* announce a dead server by saying nothing whatsoever.
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* The transport-level code buried in a thrown error, wherever it is.
|
|
31
|
+
*
|
|
32
|
+
* Looks in three places because Node uses all three: `code` on the error
|
|
33
|
+
* itself, `errors[]` on an AggregateError (the multi-address case), and
|
|
34
|
+
* `cause` on a wrapper. Depth-limited rather than trusting the shape --
|
|
35
|
+
* a cyclic `cause` is rare and a hung CLI is worse than a vague message.
|
|
36
|
+
*/
|
|
37
|
+
export declare function networkErrorCode(err: unknown, depth?: number): string | undefined;
|
|
38
|
+
/** Did this fail because the request never reached the server? Used to
|
|
39
|
+
* decide whether advice about PASSWORDS or SESSIONS is relevant -- it
|
|
40
|
+
* is not, when nobody was listening to hear the credentials. */
|
|
41
|
+
export declare function isUnreachable(err: unknown): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* One sentence, for a human, naming the origin that was actually
|
|
44
|
+
* dialled.
|
|
45
|
+
*
|
|
46
|
+
* NEVER RETURNS AN EMPTY STRING, and that is the load-bearing
|
|
47
|
+
* guarantee rather than a nicety: the bug being fixed here is a command
|
|
48
|
+
* that reported a dead server by printing nothing, and any fix that can
|
|
49
|
+
* still produce '' just moves that failure somewhere new.
|
|
50
|
+
*/
|
|
51
|
+
export declare function describeFailure(err: unknown, origin: string): string;
|
|
52
|
+
/** What a command should print and exit with, given a thrown error. */
|
|
53
|
+
export interface IFailureReport {
|
|
54
|
+
/** The one sentence. Never empty. */
|
|
55
|
+
message: string;
|
|
56
|
+
/** Follow-up advice, when any is warranted -- omitted for a failure the
|
|
57
|
+
* advice cannot explain. */
|
|
58
|
+
hint?: string;
|
|
59
|
+
/** Always non-zero: this is the failure path. */
|
|
60
|
+
exitCode: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* THE WHOLE FAILURE DECISION IN ONE PLACE, so the part with real cases
|
|
64
|
+
* in it can be tested without spawning a CLI.
|
|
65
|
+
*
|
|
66
|
+
* `login` and `logout` each ended their catch with `process.exit(0)`,
|
|
67
|
+
* which is the load-bearing half of KYaqmxeW343owAnsn: a login that
|
|
68
|
+
* never reached the server reported success, so `maka login && <next>`
|
|
69
|
+
* ran the next step regardless and nothing scripted could gate on it.
|
|
70
|
+
* A wrong exit code is a lie an automation acts on; a wrong message is
|
|
71
|
+
* only a lie a person reads.
|
|
72
|
+
*
|
|
73
|
+
* `hint` is dropped when the request never arrived, because both hints
|
|
74
|
+
* these commands carry -- "reset your password", "you may not be logged
|
|
75
|
+
* in" -- are guesses about CREDENTIALS or SESSION STATE, and neither is
|
|
76
|
+
* a sensible guess when nobody was listening to hear them. Advice that
|
|
77
|
+
* points the diagnosis away from a dead server is worse than none.
|
|
78
|
+
*/
|
|
79
|
+
export declare function failureReport(err: unknown, origin: string, hint?: string): IFailureReport;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHY A CALL TO maka-cli.com DID NOT ARRIVE, in one sentence naming the
|
|
3
|
+
* origin actually dialled (board item KYaqmxeW343owAnsn).
|
|
4
|
+
*
|
|
5
|
+
* `maka login`, `maka logout` and `maka register` each print the right
|
|
6
|
+
* banner now (KtbaziFuKHh8WheFn) -- and then, when nothing answers,
|
|
7
|
+
* report the failure three DIFFERENT wrong ways:
|
|
8
|
+
*
|
|
9
|
+
* login exit 0, `console.log(e)` dumping the raw error object as a
|
|
10
|
+
* wall of node:net stack, then "If you need to reset your
|
|
11
|
+
* password..." -- advice for a failure that never happened.
|
|
12
|
+
* logout exit 0, `Log.error(e)` stringifying to the bare word
|
|
13
|
+
* "AggregateError", then "You may not be logged in...".
|
|
14
|
+
* register exit 1 (the only honest code of the three) and NO MESSAGE
|
|
15
|
+
* AT ALL, because `err.message` on an AggregateError is the
|
|
16
|
+
* empty string.
|
|
17
|
+
*
|
|
18
|
+
* Three spellings of one bug is worse than one uniform bug: it reads as
|
|
19
|
+
* three unrelated quirks, so nobody fixes the shape. Hence one helper
|
|
20
|
+
* all three share.
|
|
21
|
+
*
|
|
22
|
+
* THE EMPTY MESSAGE IS THE TRAP WORTH NAMING. Node raises AggregateError
|
|
23
|
+
* when a host resolves to several addresses (::1 and 127.0.0.1 for
|
|
24
|
+
* localhost) and every attempt fails; the real codes live on `.errors`,
|
|
25
|
+
* and `.message` is `''`. So the obvious `err.message` prints nothing,
|
|
26
|
+
* looks like a silent success, and is exactly how `register` came to
|
|
27
|
+
* announce a dead server by saying nothing whatsoever.
|
|
28
|
+
*/
|
|
29
|
+
/** The failures that mean "the request never got there", mapped to what
|
|
30
|
+
* a person should do about it. Deliberately about REACHABILITY -- an
|
|
31
|
+
* HTTP status is a different thing and is reported by its own code. */
|
|
32
|
+
const NETWORK_REASONS = {
|
|
33
|
+
ECONNREFUSED: 'nothing is listening on that port',
|
|
34
|
+
ENOTFOUND: 'that host name does not resolve',
|
|
35
|
+
EAI_AGAIN: 'the DNS lookup failed',
|
|
36
|
+
ETIMEDOUT: 'it did not answer in time',
|
|
37
|
+
ECONNRESET: 'the connection was reset',
|
|
38
|
+
EHOSTUNREACH: 'that host is unreachable',
|
|
39
|
+
ENETUNREACH: 'that network is unreachable',
|
|
40
|
+
EPIPE: 'the connection closed mid-request',
|
|
41
|
+
CERT_HAS_EXPIRED: 'its TLS certificate has expired',
|
|
42
|
+
DEPTH_ZERO_SELF_SIGNED_CERT: 'its TLS certificate is self-signed',
|
|
43
|
+
UNABLE_TO_VERIFY_LEAF_SIGNATURE: 'its TLS certificate could not be verified',
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The transport-level code buried in a thrown error, wherever it is.
|
|
47
|
+
*
|
|
48
|
+
* Looks in three places because Node uses all three: `code` on the error
|
|
49
|
+
* itself, `errors[]` on an AggregateError (the multi-address case), and
|
|
50
|
+
* `cause` on a wrapper. Depth-limited rather than trusting the shape --
|
|
51
|
+
* a cyclic `cause` is rare and a hung CLI is worse than a vague message.
|
|
52
|
+
*/
|
|
53
|
+
export function networkErrorCode(err, depth = 0) {
|
|
54
|
+
if (err === null || typeof err !== 'object' || depth > 4)
|
|
55
|
+
return undefined;
|
|
56
|
+
const e = err;
|
|
57
|
+
if (typeof e.code === 'string' && e.code in NETWORK_REASONS)
|
|
58
|
+
return e.code;
|
|
59
|
+
if (Array.isArray(e.errors)) {
|
|
60
|
+
for (const inner of e.errors) {
|
|
61
|
+
const found = networkErrorCode(inner, depth + 1);
|
|
62
|
+
if (found)
|
|
63
|
+
return found;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (e.cause !== undefined)
|
|
67
|
+
return networkErrorCode(e.cause, depth + 1);
|
|
68
|
+
// A code we do not have prose for still beats nothing: report it as
|
|
69
|
+
// itself rather than pretending the error was untyped.
|
|
70
|
+
if (typeof e.code === 'string' && e.code.length > 0)
|
|
71
|
+
return e.code;
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
/** Did this fail because the request never reached the server? Used to
|
|
75
|
+
* decide whether advice about PASSWORDS or SESSIONS is relevant -- it
|
|
76
|
+
* is not, when nobody was listening to hear the credentials. */
|
|
77
|
+
export function isUnreachable(err) {
|
|
78
|
+
return networkErrorCode(err) !== undefined;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* One sentence, for a human, naming the origin that was actually
|
|
82
|
+
* dialled.
|
|
83
|
+
*
|
|
84
|
+
* NEVER RETURNS AN EMPTY STRING, and that is the load-bearing
|
|
85
|
+
* guarantee rather than a nicety: the bug being fixed here is a command
|
|
86
|
+
* that reported a dead server by printing nothing, and any fix that can
|
|
87
|
+
* still produce '' just moves that failure somewhere new.
|
|
88
|
+
*/
|
|
89
|
+
export function describeFailure(err, origin) {
|
|
90
|
+
const code = networkErrorCode(err);
|
|
91
|
+
if (code !== undefined) {
|
|
92
|
+
const reason = NETWORK_REASONS[code];
|
|
93
|
+
return reason !== undefined
|
|
94
|
+
? `Could not reach ${origin} -- ${reason} (${code}).`
|
|
95
|
+
: `Could not reach ${origin} (${code}).`;
|
|
96
|
+
}
|
|
97
|
+
// Not a transport failure: the server answered and said no. Its own
|
|
98
|
+
// words are better than anything invented here.
|
|
99
|
+
const e = (err ?? {});
|
|
100
|
+
if (typeof e.statusMessage === 'string' && e.statusMessage.trim().length > 0) {
|
|
101
|
+
return e.statusMessage;
|
|
102
|
+
}
|
|
103
|
+
if (typeof e.message === 'string' && e.message.trim().length > 0) {
|
|
104
|
+
return e.message;
|
|
105
|
+
}
|
|
106
|
+
if (typeof err === 'string' && err.trim().length > 0)
|
|
107
|
+
return err;
|
|
108
|
+
return `Something went wrong talking to ${origin}.`;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* THE WHOLE FAILURE DECISION IN ONE PLACE, so the part with real cases
|
|
112
|
+
* in it can be tested without spawning a CLI.
|
|
113
|
+
*
|
|
114
|
+
* `login` and `logout` each ended their catch with `process.exit(0)`,
|
|
115
|
+
* which is the load-bearing half of KYaqmxeW343owAnsn: a login that
|
|
116
|
+
* never reached the server reported success, so `maka login && <next>`
|
|
117
|
+
* ran the next step regardless and nothing scripted could gate on it.
|
|
118
|
+
* A wrong exit code is a lie an automation acts on; a wrong message is
|
|
119
|
+
* only a lie a person reads.
|
|
120
|
+
*
|
|
121
|
+
* `hint` is dropped when the request never arrived, because both hints
|
|
122
|
+
* these commands carry -- "reset your password", "you may not be logged
|
|
123
|
+
* in" -- are guesses about CREDENTIALS or SESSION STATE, and neither is
|
|
124
|
+
* a sensible guess when nobody was listening to hear them. Advice that
|
|
125
|
+
* points the diagnosis away from a dead server is worse than none.
|
|
126
|
+
*/
|
|
127
|
+
export function failureReport(err, origin, hint) {
|
|
128
|
+
return {
|
|
129
|
+
message: describeFailure(err, origin),
|
|
130
|
+
hint: hint !== undefined && !isUnreachable(err) ? hint : undefined,
|
|
131
|
+
exitCode: 1,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=connection-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-error.js","sourceRoot":"","sources":["../../../../../src/tools/https/connection-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH;;wEAEwE;AACxE,MAAM,eAAe,GAA2B;IAC9C,YAAY,EAAE,mCAAmC;IACjD,SAAS,EAAE,iCAAiC;IAC5C,SAAS,EAAE,uBAAuB;IAClC,SAAS,EAAE,2BAA2B;IACtC,UAAU,EAAE,0BAA0B;I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AG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;QAClE,QAAQ,EAAE,CAAC;KACZ,CAAC;AACJ,CAAC"}
|
|
@@ -47,17 +47,35 @@ export class HTTPS {
|
|
|
47
47
|
}).then(resolve).catch(reject);
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
// ONE SETTLEMENT, AND THE STATUS IS ALWAYS THE SERVER'S.
|
|
51
|
+
//
|
|
52
|
+
// This used to resolve TWICE with no `return` between them:
|
|
53
|
+
// an empty body resolved 204 first, and a promise keeps its
|
|
54
|
+
// FIRST settlement, so EVERY bodiless response reached its
|
|
55
|
+
// caller as a success and the real status was discarded. A
|
|
56
|
+
// 502, a 429, an expired-login 401 -- all of them arrived
|
|
57
|
+
// saying "no content here", which is a sentence about a
|
|
58
|
+
// request that worked.
|
|
59
|
+
//
|
|
60
|
+
// It silently defeated two fixes shipped in v5.70.0: AI.ask
|
|
61
|
+
// decides whether the relay is finished from the status, and
|
|
62
|
+
// a bodiless 401 presenting as 204 never reached that branch
|
|
63
|
+
// at all.
|
|
64
|
+
//
|
|
65
|
+
// The synthetic body STAYS -- login.ts, register.ts and
|
|
66
|
+
// cfg.class.ts all call JSON.parse straight on `data` with
|
|
67
|
+
// no try/catch, so removing it would trade a wrong status for
|
|
68
|
+
// a SyntaxError in three commands. It names the status now,
|
|
69
|
+
// because after this change it is the text AI.ask surfaces
|
|
70
|
+
// for a bodiless failure, and "No content" told a player
|
|
71
|
+
// nothing about a dead relay.
|
|
72
|
+
const statusCode = res.statusCode || 500;
|
|
57
73
|
resolve({
|
|
58
|
-
statusCode
|
|
74
|
+
statusCode,
|
|
59
75
|
statusMessage: res.statusMessage || 'BAD RETURN',
|
|
60
|
-
data: responseData
|
|
76
|
+
data: responseData || JSON.stringify({
|
|
77
|
+
message: `The server answered HTTP ${statusCode} with an empty body.`,
|
|
78
|
+
}),
|
|
61
79
|
});
|
|
62
80
|
}
|
|
63
81
|
});
|
|
@@ -88,8 +106,15 @@ export class HTTPS {
|
|
|
88
106
|
if (cert) {
|
|
89
107
|
Object.assign(options, { cert: fs.readFileSync(cert) });
|
|
90
108
|
}
|
|
109
|
+
// FOLLOW THE SCHEME YOU WERE HANDED. This was https.get
|
|
110
|
+
// unconditionally, and https.get THROWS on an http:// url rather
|
|
111
|
+
// than falling back -- so the MAKA_DEV preflight could not even be
|
|
112
|
+
// attempted, and login died before reaching the POST that gained
|
|
113
|
+
// port/protocol in kvhsgn3ouEG2znsha. Every existing caller passes
|
|
114
|
+
// an https:// url and is unaffected.
|
|
115
|
+
const transport = url.startsWith('http://') ? http : https;
|
|
91
116
|
return new Promise((resolve, reject) => {
|
|
92
|
-
const req =
|
|
117
|
+
const req = transport.get(url, options, (res) => {
|
|
93
118
|
let responseData = '';
|
|
94
119
|
res.on('data', (data) => {
|
|
95
120
|
responseData += data.toString();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"https.class.js","sourceRoot":"","sources":["../../../../../src/tools/https/https.class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AAWpB,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD,MAAM,OAAO,GAAG,MAAM,CAAC;AAEvB,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AAC5F,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,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IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;iBACxB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;YAE7C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACzB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;gBACzC,IAAI,IAAI,KAAK,QAAQ;oBAAE,SAAS;gBAEhC,IAAI,CAAC;oBACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;oBAChC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC;oBACpD,IAAI,OAAO;wBAAE,MAAM,IAAI,OAAO,CAAC;gBACjC,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO;gBACT,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC;CAEF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHERE maka-cli.com LIVES for this process (KtbaziFuKHh8WheFn).
|
|
3
|
+
*
|
|
4
|
+
* `maka login`, `maka register` and `maka logout` each carried their own
|
|
5
|
+
* copy of
|
|
6
|
+
*
|
|
7
|
+
* const hostname = process.env.MAKA_DEV === 'True' ? 'localhost' : 'www.maka-cli.com';
|
|
8
|
+
*
|
|
9
|
+
* and then built every request as `https://${hostname}` on the implicit
|
|
10
|
+
* port 443. So the hostname moved under MAKA_DEV and nothing else did:
|
|
11
|
+
* TLS, on 443, at a Meteor dev server that speaks plain http on 3000.
|
|
12
|
+
* That is not a working dev target, and it fails looking like a network
|
|
13
|
+
* fault rather than a misconfiguration -- which is the worst way for an
|
|
14
|
+
* eval tool to break, because the eval is what you are trying to trust.
|
|
15
|
+
*
|
|
16
|
+
* One answer, in one place, because the bug WAS three copies of one
|
|
17
|
+
* line. Everything a caller needs to reach the site is here:
|
|
18
|
+
* `hostname`/`port`/`protocol` for HTTPS.post, and `origin` for
|
|
19
|
+
* HTTPS.get (which takes a whole URL) and for anything printed.
|
|
20
|
+
*
|
|
21
|
+
* A FUNCTION, NOT A CONST, and that is a fix rather than a style
|
|
22
|
+
* choice. The originals read the variable once at IMPORT time, so
|
|
23
|
+
* anything setting MAKA_DEV later -- a launcher, a wrapper script, a
|
|
24
|
+
* test harness -- silently got production while believing it had asked
|
|
25
|
+
* for dev, with no line of output disagreeing.
|
|
26
|
+
*
|
|
27
|
+
* Exact-match on the capital T, the convention in every MAKA_DEV read
|
|
28
|
+
* in this repo: a loose truthiness check would send someone who set
|
|
29
|
+
* MAKA_DEV=false at their own localhost.
|
|
30
|
+
*/
|
|
31
|
+
export interface IMakaHost {
|
|
32
|
+
hostname: string;
|
|
33
|
+
/** Omitted in production so HTTPS.post keeps its own 443 default. */
|
|
34
|
+
port?: number;
|
|
35
|
+
/** Omitted in production so HTTPS.post keeps its own https default. */
|
|
36
|
+
protocol?: 'http' | 'https';
|
|
37
|
+
/** Scheme, host and port together -- for URL-taking callers and for
|
|
38
|
+
* every line that tells a human which site is being talked to. A
|
|
39
|
+
* printed target that does not match the dialled one is how a failed
|
|
40
|
+
* dev login gets diagnosed as a network problem. */
|
|
41
|
+
origin: string;
|
|
42
|
+
}
|
|
43
|
+
export declare function makaHost(): IMakaHost;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function makaHost() {
|
|
2
|
+
if (process.env.MAKA_DEV !== 'True') {
|
|
3
|
+
return { hostname: 'www.maka-cli.com', origin: 'https://www.maka-cli.com' };
|
|
4
|
+
}
|
|
5
|
+
const port = Number(process.env.MAKA_DEV_PORT ?? 3000);
|
|
6
|
+
return { hostname: 'localhost', port, protocol: 'http', origin: `http://localhost:${port}` };
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=maka-host.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maka-host.js","sourceRoot":"","sources":["../../../../../src/tools/https/maka-host.ts"],"names":[],"mappings":"AA2CA,MAAM,UAAU,QAAQ;IACtB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;QACpC,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,EAAE,0BAA0B,EAAE,CAAC;IAC9E,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,IAAI,CAAC,CAAC;IACvD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,IAAI,EAAE,EAAE,CAAC;AAC/F,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/** The dist repo the Executables workflow publishes to. */
|
|
2
|
+
export declare const DIST_REPO = "maka-io/maka-cli";
|
|
3
|
+
export interface IReleaseAsset {
|
|
4
|
+
name: string;
|
|
5
|
+
browser_download_url: string;
|
|
6
|
+
/** GitHub's own sha256 of the asset, shaped `sha256:<hex>`. Present on
|
|
7
|
+
* current releases; treated as optional because it is GitHub's field,
|
|
8
|
+
* not ours, and an update must not fail on its absence alone. */
|
|
9
|
+
digest?: string;
|
|
10
|
+
size: number;
|
|
11
|
+
}
|
|
12
|
+
export interface IRelease {
|
|
13
|
+
tag_name: string;
|
|
14
|
+
assets: IReleaseAsset[];
|
|
15
|
+
}
|
|
16
|
+
/** `v5.71.0` -> `5.71.0`. Tolerates a bare version. */
|
|
17
|
+
export declare function tagToVersion(tag: string): string;
|
|
18
|
+
/** True when the release is strictly newer than what is running. */
|
|
19
|
+
export declare function updateAvailable(current: string, latestTag: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The release asset for a platform/arch pair, or null when the workflow
|
|
22
|
+
* builds no binary for it. Names must match the Archive steps in
|
|
23
|
+
* .github/workflows/executables.yml exactly -- the PLATFORM lives in the
|
|
24
|
+
* archive name, the binary inside is always plain `maka`/`maka.exe`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function assetNameFor(platform: NodeJS.Platform, arch: string): string | null;
|
|
27
|
+
export declare function sha256Hex(filePath: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* True when GitHub's digest matches the downloaded bytes. An absent digest
|
|
30
|
+
* returns null -- "could not verify" -- which the caller reports rather than
|
|
31
|
+
* silently treating as success: unverified and verified must never print
|
|
32
|
+
* the same sentence.
|
|
33
|
+
*/
|
|
34
|
+
export declare function digestMatches(digest: string | undefined, fileHex: string): boolean | null;
|
|
35
|
+
export type SwapStep = {
|
|
36
|
+
op: 'unlink-if-present';
|
|
37
|
+
target: string;
|
|
38
|
+
} | {
|
|
39
|
+
op: 'chmod-executable';
|
|
40
|
+
target: string;
|
|
41
|
+
} | {
|
|
42
|
+
op: 'rename';
|
|
43
|
+
from: string;
|
|
44
|
+
to: string;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* The ordered filesystem steps that put the staged binary where the running
|
|
48
|
+
* one is. Two shapes:
|
|
49
|
+
*
|
|
50
|
+
* - POSIX: chmod the staged file, then one atomic rename over the running
|
|
51
|
+
* executable. The staging directory sits NEXT TO the executable so the
|
|
52
|
+
* rename never crosses a filesystem (EXDEV).
|
|
53
|
+
* - WINDOWS: a running .exe cannot be deleted or overwritten, but it CAN be
|
|
54
|
+
* renamed. So: clear any `.old` left by a previous update, rename the
|
|
55
|
+
* running exe aside to `.old`, rename the staged exe into place. The
|
|
56
|
+
* `.old` we just created belongs to the STILL-RUNNING process and cannot
|
|
57
|
+
* be removed here -- the next update's first step clears it.
|
|
58
|
+
*/
|
|
59
|
+
export declare function swapPlanFor(platform: NodeJS.Platform, exePath: string, stagedPath: string): SwapStep[];
|
|
60
|
+
export declare function executeSwapPlan(plan: SwapStep[]): void;
|
|
61
|
+
/** GET a GitHub API url with the headers GitHub requires. */
|
|
62
|
+
export declare function fetchLatestRelease(): Promise<IRelease>;
|
|
63
|
+
/** Stream an asset to disk. Size is worth checking -- a truncated download
|
|
64
|
+
* that then fails the digest check should say WHICH failure it was. */
|
|
65
|
+
export declare function downloadAsset(asset: IReleaseAsset, toFile: string): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Unpack the archive into `intoDir` and return the path of the binary
|
|
68
|
+
* inside (always plain `maka` / `maka.exe`, per the workflow's contract).
|
|
69
|
+
*
|
|
70
|
+
* .tar.gz goes through the tar package in-process. The Windows .zip goes
|
|
71
|
+
* through the system `tar.exe` (bsdtar, shipped since Windows 10 1803,
|
|
72
|
+
* which reads zip archives) -- spawning it from a packaged binary is safe:
|
|
73
|
+
* the packager's PKG_EXECPATH injection only means anything to OUR OWN
|
|
74
|
+
* executable, and real tar ignores unknown environment variables.
|
|
75
|
+
*/
|
|
76
|
+
export declare function extractArchive(archivePath: string, intoDir: string): Promise<string>;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// Self-update for the maka CLI: fetch the latest release binary from the
|
|
2
|
+
// public dist repo and swap it in place of the running executable.
|
|
3
|
+
//
|
|
4
|
+
// WHY THE DIST REPO AND NOT NPM. maka-io/maka-cli is where the Executables
|
|
5
|
+
// workflow publishes the packaged binaries (maka-cli-src is private, so its
|
|
6
|
+
// assets need a token nobody's laptop should hold). A player running the
|
|
7
|
+
// standalone binary has no Node, no npm, and no reason to acquire either --
|
|
8
|
+
// `maka update maka` keeps them current from the same place their binary
|
|
9
|
+
// came from. An npm-installed maka still updates through npm; the command
|
|
10
|
+
// hides that mechanics difference.
|
|
11
|
+
//
|
|
12
|
+
// EVERYTHING DECISION-SHAPED IN HERE IS A PURE FUNCTION on purpose: the
|
|
13
|
+
// asset matrix, the version comparison, the digest check, and the swap plan
|
|
14
|
+
// are all testable without a network, a release, or a real executable. The
|
|
15
|
+
// one effectful runner at the bottom consumes their answers.
|
|
16
|
+
import fs from 'fs';
|
|
17
|
+
import path from 'path';
|
|
18
|
+
import crypto from 'crypto';
|
|
19
|
+
import semver from 'semver';
|
|
20
|
+
/** The dist repo the Executables workflow publishes to. */
|
|
21
|
+
export const DIST_REPO = 'maka-io/maka-cli';
|
|
22
|
+
/** `v5.71.0` -> `5.71.0`. Tolerates a bare version. */
|
|
23
|
+
export function tagToVersion(tag) {
|
|
24
|
+
return tag.startsWith('v') ? tag.slice(1) : tag;
|
|
25
|
+
}
|
|
26
|
+
/** True when the release is strictly newer than what is running. */
|
|
27
|
+
export function updateAvailable(current, latestTag) {
|
|
28
|
+
const latest = tagToVersion(latestTag);
|
|
29
|
+
return Boolean(semver.valid(latest)) && semver.gt(latest, current);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The release asset for a platform/arch pair, or null when the workflow
|
|
33
|
+
* builds no binary for it. Names must match the Archive steps in
|
|
34
|
+
* .github/workflows/executables.yml exactly -- the PLATFORM lives in the
|
|
35
|
+
* archive name, the binary inside is always plain `maka`/`maka.exe`.
|
|
36
|
+
*/
|
|
37
|
+
export function assetNameFor(platform, arch) {
|
|
38
|
+
if (platform === 'win32')
|
|
39
|
+
return arch === 'x64' ? 'maka-win-x64.zip' : null;
|
|
40
|
+
if (platform === 'darwin') {
|
|
41
|
+
return arch === 'arm64' ? 'maka-macos-arm64.tar.gz'
|
|
42
|
+
: arch === 'x64' ? 'maka-macos-x64.tar.gz' : null;
|
|
43
|
+
}
|
|
44
|
+
if (platform === 'linux') {
|
|
45
|
+
return arch === 'x64' ? 'maka-linux-x64.tar.gz'
|
|
46
|
+
: arch === 'arm64' ? 'maka-linux-arm64.tar.gz' : null;
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
export function sha256Hex(filePath) {
|
|
51
|
+
const hash = crypto.createHash('sha256');
|
|
52
|
+
hash.update(fs.readFileSync(filePath));
|
|
53
|
+
return hash.digest('hex');
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* True when GitHub's digest matches the downloaded bytes. An absent digest
|
|
57
|
+
* returns null -- "could not verify" -- which the caller reports rather than
|
|
58
|
+
* silently treating as success: unverified and verified must never print
|
|
59
|
+
* the same sentence.
|
|
60
|
+
*/
|
|
61
|
+
export function digestMatches(digest, fileHex) {
|
|
62
|
+
if (!digest)
|
|
63
|
+
return null;
|
|
64
|
+
const [algo, hex] = digest.split(':');
|
|
65
|
+
if (algo !== 'sha256' || !hex)
|
|
66
|
+
return null;
|
|
67
|
+
return hex.toLowerCase() === fileHex.toLowerCase();
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The ordered filesystem steps that put the staged binary where the running
|
|
71
|
+
* one is. Two shapes:
|
|
72
|
+
*
|
|
73
|
+
* - POSIX: chmod the staged file, then one atomic rename over the running
|
|
74
|
+
* executable. The staging directory sits NEXT TO the executable so the
|
|
75
|
+
* rename never crosses a filesystem (EXDEV).
|
|
76
|
+
* - WINDOWS: a running .exe cannot be deleted or overwritten, but it CAN be
|
|
77
|
+
* renamed. So: clear any `.old` left by a previous update, rename the
|
|
78
|
+
* running exe aside to `.old`, rename the staged exe into place. The
|
|
79
|
+
* `.old` we just created belongs to the STILL-RUNNING process and cannot
|
|
80
|
+
* be removed here -- the next update's first step clears it.
|
|
81
|
+
*/
|
|
82
|
+
export function swapPlanFor(platform, exePath, stagedPath) {
|
|
83
|
+
if (platform === 'win32') {
|
|
84
|
+
return [
|
|
85
|
+
{ op: 'unlink-if-present', target: `${exePath}.old` },
|
|
86
|
+
{ op: 'rename', from: exePath, to: `${exePath}.old` },
|
|
87
|
+
{ op: 'rename', from: stagedPath, to: exePath },
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
return [
|
|
91
|
+
{ op: 'chmod-executable', target: stagedPath },
|
|
92
|
+
{ op: 'rename', from: stagedPath, to: exePath },
|
|
93
|
+
];
|
|
94
|
+
}
|
|
95
|
+
export function executeSwapPlan(plan) {
|
|
96
|
+
for (const step of plan) {
|
|
97
|
+
if (step.op === 'unlink-if-present') {
|
|
98
|
+
// A leftover .old from LAST update -- that process is long gone and
|
|
99
|
+
// the file deletes fine. If something still holds it, carrying on is
|
|
100
|
+
// correct: the subsequent rename-aside picks a fresh name below.
|
|
101
|
+
try {
|
|
102
|
+
fs.unlinkSync(step.target);
|
|
103
|
+
}
|
|
104
|
+
catch { /* stale-or-absent either way */ }
|
|
105
|
+
}
|
|
106
|
+
else if (step.op === 'chmod-executable') {
|
|
107
|
+
fs.chmodSync(step.target, 0o755);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
fs.renameSync(step.from, step.to);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/** GET a GitHub API url with the headers GitHub requires. */
|
|
115
|
+
export async function fetchLatestRelease() {
|
|
116
|
+
const res = await fetch(`https://api.github.com/repos/${DIST_REPO}/releases/latest`, {
|
|
117
|
+
headers: { 'User-Agent': 'maka-cli', Accept: 'application/vnd.github+json' },
|
|
118
|
+
});
|
|
119
|
+
if (!res.ok) {
|
|
120
|
+
throw new Error(`Could not read the latest release from github.com/${DIST_REPO} (HTTP ${res.status}).`);
|
|
121
|
+
}
|
|
122
|
+
return await res.json();
|
|
123
|
+
}
|
|
124
|
+
/** Stream an asset to disk. Size is worth checking -- a truncated download
|
|
125
|
+
* that then fails the digest check should say WHICH failure it was. */
|
|
126
|
+
export async function downloadAsset(asset, toFile) {
|
|
127
|
+
const res = await fetch(asset.browser_download_url, {
|
|
128
|
+
headers: { 'User-Agent': 'maka-cli' },
|
|
129
|
+
redirect: 'follow',
|
|
130
|
+
});
|
|
131
|
+
if (!res.ok || !res.body) {
|
|
132
|
+
throw new Error(`Download failed for ${asset.name} (HTTP ${res.status}).`);
|
|
133
|
+
}
|
|
134
|
+
const { Readable } = await import('stream');
|
|
135
|
+
const { pipeline } = await import('stream/promises');
|
|
136
|
+
await pipeline(Readable.fromWeb(res.body), fs.createWriteStream(toFile));
|
|
137
|
+
const written = fs.statSync(toFile).size;
|
|
138
|
+
if (asset.size && written !== asset.size) {
|
|
139
|
+
throw new Error(`Download of ${asset.name} is incomplete: ${written} of ${asset.size} bytes.`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Unpack the archive into `intoDir` and return the path of the binary
|
|
144
|
+
* inside (always plain `maka` / `maka.exe`, per the workflow's contract).
|
|
145
|
+
*
|
|
146
|
+
* .tar.gz goes through the tar package in-process. The Windows .zip goes
|
|
147
|
+
* through the system `tar.exe` (bsdtar, shipped since Windows 10 1803,
|
|
148
|
+
* which reads zip archives) -- spawning it from a packaged binary is safe:
|
|
149
|
+
* the packager's PKG_EXECPATH injection only means anything to OUR OWN
|
|
150
|
+
* executable, and real tar ignores unknown environment variables.
|
|
151
|
+
*/
|
|
152
|
+
export async function extractArchive(archivePath, intoDir) {
|
|
153
|
+
if (archivePath.endsWith('.zip')) {
|
|
154
|
+
const { spawnSync } = await import('child_process');
|
|
155
|
+
// The SYSTEM bsdtar by absolute path, never a bare `tar` from PATH: under
|
|
156
|
+
// Git Bash, PATH-tar is GNU tar, which reads the `C:` in a Windows path
|
|
157
|
+
// as a REMOTE HOSTNAME and dies with "Cannot connect to C". Found by the
|
|
158
|
+
// end-to-end swap test, not by reasoning.
|
|
159
|
+
const systemTar = process.env.SystemRoot
|
|
160
|
+
? path.join(process.env.SystemRoot, 'System32', 'tar.exe')
|
|
161
|
+
: 'tar';
|
|
162
|
+
const out = spawnSync(systemTar, ['-xf', archivePath, '-C', intoDir], { encoding: 'utf8' });
|
|
163
|
+
if (out.status !== 0) {
|
|
164
|
+
throw new Error(`Could not extract ${path.basename(archivePath)}: ${out.stderr || out.error?.message || `tar exited ${out.status}`}`);
|
|
165
|
+
}
|
|
166
|
+
return path.join(intoDir, 'maka.exe');
|
|
167
|
+
}
|
|
168
|
+
const tar = await import('tar');
|
|
169
|
+
await tar.x({ file: archivePath, cwd: intoDir });
|
|
170
|
+
return path.join(intoDir, 'maka');
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=self-update.js.map
|