@maka/maka-cli 5.96.0 → 5.99.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.
Files changed (22) hide show
  1. package/bundle/typescript/package.json +1 -1
  2. package/bundle/typescript/src/commands/game/sideQuest/commands/sheet.d.ts +9 -0
  3. package/bundle/typescript/src/commands/game/sideQuest/commands/sheet.js +33 -1
  4. package/bundle/typescript/src/commands/game/sideQuest/commands/sheet.js.map +1 -1
  5. package/bundle/typescript/src/commands/game/sideQuest/factories/chargen-factory.d.ts +13 -0
  6. package/bundle/typescript/src/commands/game/sideQuest/factories/chargen-factory.js +29 -4
  7. package/bundle/typescript/src/commands/game/sideQuest/factories/chargen-factory.js.map +1 -1
  8. package/bundle/typescript/src/commands/game/sideQuest/game.js +11 -0
  9. package/bundle/typescript/src/commands/game/sideQuest/game.js.map +1 -1
  10. package/bundle/typescript/src/commands/game/sideQuest/types/save-file.d.ts +5 -1
  11. package/bundle/typescript/src/commands/game/sideQuest/utilities/web-character-generator.d.ts +12 -0
  12. package/bundle/typescript/src/commands/game/sideQuest/utilities/web-character-generator.js +16 -0
  13. package/bundle/typescript/src/commands/game/sideQuest/utilities/web-character-generator.js.map +1 -1
  14. package/bundle/typescript/src/commands/update.js +4 -2
  15. package/bundle/typescript/src/commands/update.js.map +1 -1
  16. package/bundle/typescript/src/tools/self-update/binary-install.d.ts +138 -36
  17. package/bundle/typescript/src/tools/self-update/binary-install.js +243 -43
  18. package/bundle/typescript/src/tools/self-update/binary-install.js.map +1 -1
  19. package/bundle/typescript/src/tools/self-update/update-maka.d.ts +1 -0
  20. package/bundle/typescript/src/tools/self-update/update-maka.js +289 -16
  21. package/bundle/typescript/src/tools/self-update/update-maka.js.map +1 -1
  22. package/package.json +1 -1
@@ -13,7 +13,11 @@ import { ISceneSeedJson } from './seed/scene-seed.js';
13
13
  * deletion -- an old save outlives the build that can't read it).
14
14
  */
15
15
  export declare const SAVE_VERSION = 1;
16
- export type SaveReason = 'homecoming' | 'rest' | 'job-accept' | 'quit' | 'hub-arrival' | 'venue-bust' | 'sin-choice';
16
+ /** Why a save was written. `creation` is the BIRTH CERTIFICATE -- written
17
+ * once by the chargen factory before any session exists; its game/hub are
18
+ * empty shells that resume must NOT apply as world state (the world boots
19
+ * fresh from the embedded hubSeed). Every in-play save uses the others. */
20
+ export type SaveReason = 'creation' | 'homecoming' | 'rest' | 'job-accept' | 'quit' | 'hub-arrival' | 'venue-bust' | 'sin-choice';
17
21
  /**
18
22
  * A REGISTERED sprite waiting in the Resonance (SR5 p.254-256) -- what
19
23
  * it takes to rebuild its shell later. `name` is carried so a sprite
@@ -31,6 +31,18 @@ export declare function buildCharacterGeneratorUrl(resumeToken: string): string;
31
31
  * handoff message can never drift from the verb that actually works
32
32
  * (there is only one thing to play -- user ruling, 2026-08-29). */
33
33
  export declare const RELAUNCH_COMMAND = "maka play";
34
+ /**
35
+ * "sheet web" (user request, 2026-09-01): the same /cli-login handoff as
36
+ * Forge, but landing on the LIVE character sheet -- /characters, deep-
37
+ * linked to the character currently being played. Token in the FRAGMENT
38
+ * for the same reasons as above; `next` carries the deep link. Unlike the
39
+ * Forge handoff the game KEEPS RUNNING -- this is a glance at the sheet
40
+ * mid-play, not a goodbye.
41
+ *
42
+ * The /characters/<slug> shape is CO-OWNED with the web side (their
43
+ * character-sheet page) -- do not reshape it here alone.
44
+ */
45
+ export declare function buildCharacterSheetUrl(resumeToken: string, slug: string): string;
34
46
  /**
35
47
  * WHAT THE CLI SAYS ON ITS WAY OUT of the chargen handoff. Extracted
36
48
  * from the command handler so the two things that matter about it are
@@ -42,6 +42,22 @@ export function buildCharacterGeneratorUrl(resumeToken) {
42
42
  * handoff message can never drift from the verb that actually works
43
43
  * (there is only one thing to play -- user ruling, 2026-08-29). */
44
44
  export const RELAUNCH_COMMAND = 'maka play';
45
+ const CHARACTERS_PAGE = '/characters';
46
+ /**
47
+ * "sheet web" (user request, 2026-09-01): the same /cli-login handoff as
48
+ * Forge, but landing on the LIVE character sheet -- /characters, deep-
49
+ * linked to the character currently being played. Token in the FRAGMENT
50
+ * for the same reasons as above; `next` carries the deep link. Unlike the
51
+ * Forge handoff the game KEEPS RUNNING -- this is a glance at the sheet
52
+ * mid-play, not a goodbye.
53
+ *
54
+ * The /characters/<slug> shape is CO-OWNED with the web side (their
55
+ * character-sheet page) -- do not reshape it here alone.
56
+ */
57
+ export function buildCharacterSheetUrl(resumeToken, slug) {
58
+ const next = `${CHARACTERS_PAGE}/${encodeURIComponent(slug)}`;
59
+ return `${CLI_LOGIN_URL}?t=${Date.now()}#token=${encodeURIComponent(resumeToken)}&next=${next}`;
60
+ }
45
61
  /**
46
62
  * WHAT THE CLI SAYS ON ITS WAY OUT of the chargen handoff. Extracted
47
63
  * from the command handler so the two things that matter about it are
@@ -1 +1 @@
1
- {"version":3,"file":"web-character-generator.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/utilities/web-character-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,aAAa,GAAG,oCAAoC,CAAC;AAC3D,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,UAAU,gCAAgC,CAAC,KAGhD;IACC,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CAAC,WAAmB;IAC5D,qEAAqE;IACrE,oEAAoE;IACpE,mEAAmE;IACnE,oEAAoE;IACpE,kEAAkE;IAClE,gEAAgE;IAChE,+DAA+D;IAC/D,6BAA6B;IAC7B,OAAO,GAAG,aAAa,MAAM,IAAI,CAAC,GAAG,EAAE,UAAU,kBAAkB,CAAC,WAAW,CAAC,SAAS,wBAAwB,EAAE,CAAC;AACtH,CAAC;AAED;;oEAEoE;AACpE,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAE5C;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAW;IAC/C,OAAO;QACL,MAAM,EAAE,oCAAoC,GAAG,EAAE;QACjD,KAAK,EAAE;YACL,yFAAyF;YACzF,0BAA0B,gBAAgB,oCAAoC;SAC/E;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"web-character-generator.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/utilities/web-character-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,aAAa,GAAG,oCAAoC,CAAC;AAC3D,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,UAAU,gCAAgC,CAAC,KAGhD;IACC,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CAAC,WAAmB;IAC5D,qEAAqE;IACrE,oEAAoE;IACpE,mEAAmE;IACnE,oEAAoE;IACpE,kEAAkE;IAClE,gEAAgE;IAChE,+DAA+D;IAC/D,6BAA6B;IAC7B,OAAO,GAAG,aAAa,MAAM,IAAI,CAAC,GAAG,EAAE,UAAU,kBAAkB,CAAC,WAAW,CAAC,SAAS,wBAAwB,EAAE,CAAC;AACtH,CAAC;AAED;;oEAEoE;AACpE,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAE5C,MAAM,eAAe,GAAG,aAAa,CAAC;AAEtC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,sBAAsB,CAAC,WAAmB,EAAE,IAAY;IACtE,MAAM,IAAI,GAAG,GAAG,eAAe,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC9D,OAAO,GAAG,aAAa,MAAM,IAAI,CAAC,GAAG,EAAE,UAAU,kBAAkB,CAAC,WAAW,CAAC,SAAS,IAAI,EAAE,CAAC;AAClG,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAW;IAC/C,OAAO;QACL,MAAM,EAAE,oCAAoC,GAAG,EAAE;QACjD,KAAK,EAAE;YACL,yFAAyF;YACzF,0BAA0B,gBAAgB,oCAAoC;SAC/E;KACF,CAAC;AACJ,CAAC"}
@@ -3,7 +3,8 @@ import { Log } from '../tools/log/log.class.js';
3
3
  Command.create({
4
4
  name: 'update',
5
5
  validOpts: [
6
- { name: 'binary', boolFlag: true, description: 'From an npm install, switch to the standalone release binary instead of updating via npm (removes the npm install once the binary is verified on PATH)' },
6
+ { name: 'binary', boolFlag: true, description: 'Switch to the standalone release binary, unlinking or removing the npm install once the binary is verified on PATH' },
7
+ { name: 'npm', boolFlag: true, description: 'Switch back to the npm install, removing the standalone binary once the npm install is verified on PATH (needs Node.js)' },
7
8
  ],
8
9
  validArgs: ['maka'],
9
10
  minArgLength: 1,
@@ -12,6 +13,7 @@ Command.create({
12
13
  examples: [
13
14
  'maka update maka',
14
15
  'maka update maka --binary',
16
+ 'maka update maka --npm',
15
17
  ]
16
18
  }, async function (args, opts) {
17
19
  try {
@@ -21,7 +23,7 @@ Command.create({
21
23
  process.exit(1);
22
24
  }
23
25
  const { updateMakaCli } = await import('../tools/self-update/update-maka.js');
24
- await updateMakaCli({ binary: opts.binary });
26
+ await updateMakaCli({ binary: opts.binary, npm: opts.npm });
25
27
  }
26
28
  catch (e) {
27
29
  Log.error(`Update failed: ${e.message}`);
@@ -1 +1 @@
1
- {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AA6BhD,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE;QACT,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,wJAAwJ,EAAE;KAC1M;IACD,SAAS,EAAE,CAAC,MAAM,CAAC;IACnB,YAAY,EAAE,CAAC;IACf,KAAK,EAAE,kBAAkB;IACzB,SAAS,EAAE,oDAAoD;IAC/D,QAAQ,EAAE;QACR,kBAAkB;QAClB,2BAA2B;KAC5B;CACF,EAAE,KAAK,WAAW,IAAc,EAAE,IAAiB;IAClD,IAAI,CAAC;QACH,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC;YACvB,GAAG,CAAC,KAAK,CAAC,iFAAiF,CAAC,CAAC;YAC7F,GAAG,CAAC,MAAM,CAAC,qGAAqG,CAAC,CAAC;YAClH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,qCAAqC,CAAC,CAAC;QAC9E,MAAM,aAAa,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,GAAG,CAAC,KAAK,CAAC,kBAAmB,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;QACpD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAuChD,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE;QACT,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,oHAAoH,EAAE;QACrK,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,yHAAyH,EAAE;KACxK;IACD,SAAS,EAAE,CAAC,MAAM,CAAC;IACnB,YAAY,EAAE,CAAC;IACf,KAAK,EAAE,kBAAkB;IACzB,SAAS,EAAE,oDAAoD;IAC/D,QAAQ,EAAE;QACR,kBAAkB;QAClB,2BAA2B;QAC3B,wBAAwB;KACzB;CACF,EAAE,KAAK,WAAW,IAAc,EAAE,IAAiB;IAClD,IAAI,CAAC;QACH,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC;YACvB,GAAG,CAAC,KAAK,CAAC,iFAAiF,CAAC,CAAC;YAC7F,GAAG,CAAC,MAAM,CAAC,qGAAqG,CAAC,CAAC;YAClH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,qCAAqC,CAAC,CAAC;QAC9E,MAAM,aAAa,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAC9D,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,GAAG,CAAC,KAAK,CAAC,kBAAmB,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;QACpD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -14,52 +14,87 @@ export interface IInstallCheck {
14
14
  * --binary's refusal prints, naming what was actually found. */
15
15
  reason: string;
16
16
  }
17
- /**
18
- * Classifies the global npm install of @maka/maka-cli. Pure -- takes the
19
- * gathered facts instead of gathering them (see gatherInstallFacts()),
20
- * so the decision itself needs no filesystem or npm to test.
21
- *
22
- * REALPATH COMPARISON IS THE ONLY RELIABLE CHECK HERE. A Windows npm-link
23
- * junction does NOT report as a symlink via fs.lstatSync().isSymbolicLink()
24
- * -- verified directly against this machine's own global maka, a real
25
- * example of exactly this shape: isSymbolicLink() false, realpathSync()
26
- * resolving somewhere else entirely. Comparing realpathSync() against the
27
- * raw path is what actually catches it, on every platform, so that is the
28
- * only signal this function looks at.
29
- */
30
- export declare function classifyGlobalInstall(facts: {
17
+ export interface IInstallFacts {
31
18
  /** <npm root -g>/@maka/maka-cli, or undefined if npm reports no global
32
19
  * install at all. */
33
20
  globalPackagePath: string | undefined;
34
21
  /** fs.realpathSync(globalPackagePath), or undefined if the path above
35
22
  * is undefined or does not exist. */
36
23
  globalPackageRealPath: string | undefined;
37
- }): IInstallCheck;
38
- /** Gathers the facts classifyGlobalInstall() needs. The one impure half of
39
- * the classification -- kept separate so the decision above stays pure. */
40
- export declare function gatherInstallFacts(globalNpmRoot: string): {
41
- globalPackagePath: string | undefined;
42
- globalPackageRealPath: string | undefined;
43
- };
24
+ /** fs.realpathSync(<npm root -g>), or undefined when that will not
25
+ * resolve. Load-bearing -- see classifyGlobalInstall(). */
26
+ globalNpmRootRealPath: string | undefined;
27
+ }
44
28
  /**
45
- * The PATH a freshly opened shell will see once the disclosed PATH edit
46
- * has actually taken effect -- NOT what the currently-running process
47
- * inherits. A registry/profile edit never reaches an already-running
48
- * process, so verifying against process.env.PATH as-is would silently
49
- * check the OLD path (finding the npm shim pre-uninstall, or nothing
50
- * post-uninstall) and pass for the wrong reason. Pure: given the pieces,
51
- * constructs the string; the caller decides what to spawn with it.
29
+ * Classifies the global npm install of @maka/maka-cli. Pure -- takes the
30
+ * gathered facts instead of gathering them (see gatherInstallFacts()),
31
+ * so the decision itself needs no filesystem or npm to test.
32
+ *
33
+ * REALPATH COMPARISON IS THE ONLY THING THAT CATCHES AN npm link. A Windows
34
+ * npm-link junction does NOT report as a symlink via
35
+ * fs.lstatSync().isSymbolicLink() -- verified directly on this project's dev
36
+ * machine: isSymbolicLink() false, realpathSync() resolving elsewhere. So a
37
+ * realpath comparison it is.
52
38
  *
53
- * npmShimDir is removed from the old PATH (not just left alongside the
54
- * new entry) so the constructed env matches the END STATE this flow
55
- * commits to -- binary replaces, never coexists on PATH either.
39
+ * BUT THE COMPARISON HAS TO BE MADE RELATIVE TO THE NPM ROOT, and the first
40
+ * cut of this function was not. It compared the package's raw path against
41
+ * its own realpath and called any difference a dev link -- which is wrong
42
+ * for every version manager that reaches node through a symlinked prefix.
43
+ * nvm-for-windows makes `C:\Program Files\nodejs` itself a junction to the
44
+ * active version, so on that machine EVERY global package "resolves
45
+ * elsewhere" and --binary refused to run for an install that was as plain
46
+ * as they come. Homebrew, fnm, volta, asdf and n all have the same shape on
47
+ * POSIX. Measured, not theorised: it is why the switch this file exists for
48
+ * silently never worked on the machine it was written on.
49
+ *
50
+ * The distinction that actually separates the two: an ancestor-only link
51
+ * PRESERVES the package's position under the root, so the realpath is
52
+ * exactly <real root>/@maka/maka-cli. A real `npm link` points off to a
53
+ * working tree somewhere else entirely. Comparing against the resolved root
54
+ * asks that question directly.
56
55
  */
56
+ export declare function classifyGlobalInstall(facts: IInstallFacts): IInstallCheck;
57
+ /** The question --binary asks before it unlinks a dev link. Kept next to
58
+ * the classification that produces the case, and pure, so the promise it
59
+ * makes about the working tree is asserted rather than assumed.
60
+ *
61
+ * IT IS A QUESTION AND NOT A REFUSAL, which it used to be. Refusing sent
62
+ * the user off to run npm by hand for a step this flow can do correctly
63
+ * itself -- and it is safe to do, because removing a global link removes
64
+ * the LINK: the tree it points at is not npm's to delete and npm does not
65
+ * touch it. What the refusal was really protecting against is the switch
66
+ * happening without the user knowing, so that is what survives -- the
67
+ * disclosure, asked up front, before a single byte is downloaded. */
68
+ export declare function unlinkPrompt(linkPath: string, workingTreePath: string): string;
69
+ /** Gathers the facts classifyGlobalInstall() needs. The one impure half of
70
+ * the classification -- kept separate so the decision above stays pure. */
71
+ export declare function gatherInstallFacts(globalNpmRoot: string): IInstallFacts;
72
+ /** Where npm puts the command shims for a global install: the prefix
73
+ * itself on Windows, <prefix>/bin everywhere else. Both switch directions
74
+ * need it -- one to take that directory OFF the verification PATH, the
75
+ * other to put it back. */
76
+ export declare function npmShimDirFor(npmPrefix: string, platform: NodeJS.Platform): string;
77
+ /** The `--binary` direction: the downloaded binary's directory takes the
78
+ * front, npm's shim directory goes. */
57
79
  export declare function buildVerificationPath(input: {
58
80
  currentPath: string;
59
81
  newBinDir: string;
60
82
  npmShimDir: string | undefined;
61
83
  pathSeparator: string;
62
84
  }): string;
85
+ /** The `--npm` direction: the same edit run backwards. npm's shim
86
+ * directory takes the front (it is usually already on PATH, which is why
87
+ * composeVerificationPath promotes rather than duplicates it), and the
88
+ * binary's directory comes off. The directory removed is always
89
+ * binaryInstallDir() -- somewhere maka owns outright and nothing else
90
+ * lives -- never whatever directory a hand-placed binary happens to sit
91
+ * in, which could be /usr/local/bin. */
92
+ export declare function buildRevertVerificationPath(input: {
93
+ currentPath: string;
94
+ binaryBinDir: string;
95
+ npmShimDir: string;
96
+ pathSeparator: string;
97
+ }): string;
63
98
  export interface IPosixProfile {
64
99
  shell: string;
65
100
  profilePath: string;
@@ -79,14 +114,44 @@ export declare function detectPosixProfile(shellEnv: string | undefined, homeDir
79
114
  * `fish_add_path` is idiomatic there (fish does not use `export`); every
80
115
  * other shell gets a plain POSIX export. */
81
116
  export declare function pathExportLine(shell: string, binDir: string): string;
117
+ /** The comment `--binary` writes above the line it adds. Exported and used
118
+ * by BOTH the write and the removal, so the two cannot drift into a state
119
+ * where `--npm` leaves an orphaned comment behind. */
120
+ export declare const PATH_EDIT_MARKER = "# added by `maka update maka --binary`";
121
+ /**
122
+ * A shell profile with the PATH line `--binary` added taken back out,
123
+ * ready for `--npm` to write. Pure: string in, string out, so what it
124
+ * promises to leave alone is asserted rather than hoped for.
125
+ *
126
+ * MATCHES ON THE LINE, NOT ON THE MARKER, and removes the marker
127
+ * separately. Anchoring to the comment would strand the export whenever a
128
+ * user has tidied their profile, and stranding the export is the failure
129
+ * that matters: it silently keeps a deleted directory on PATH. Both shell
130
+ * dialects are checked because the profile that gets read here is not
131
+ * necessarily the one that was written -- $SHELL can change between the
132
+ * two runs.
133
+ */
134
+ export declare function withoutPathExport(profileContents: string, binDir: string): string;
135
+ /** True when the profile still carries a PATH line for this directory --
136
+ * asked before prompting, so `--npm` does not offer to edit a file it has
137
+ * nothing to change in. */
138
+ export declare function hasPathExport(profileContents: string, binDir: string): boolean;
82
139
  /** Resolves a bare command name against a PATH string by hand, the same
83
140
  * way a shell would -- used to PROVE the constructed verification PATH
84
- * actually finds our binary first, rather than trusting that spawning
85
- * "maka" and getting SOME successful output means it found the right
86
- * one. Extension order matches Windows' own PATHEXT precedence
141
+ * actually finds the incoming shape first, rather than trusting that
142
+ * spawning "maka" and getting SOME successful output means it found the
143
+ * right one. Extension order matches Windows' own PATHEXT precedence
87
144
  * (.exe before .cmd/.bat); POSIX has no such notion, so the bare name
88
- * is the only candidate there. */
89
- export declare function resolveOnPath(name: string, pathValue: string, platform: NodeJS.Platform, pathSeparator: string): string | undefined;
145
+ * is the only candidate there.
146
+ *
147
+ * `ignore` is how the `--npm` direction models its own end state. That
148
+ * flow verifies BEFORE it removes the binaries -- deliberately, so a
149
+ * failed verification can stop with the binary still working -- which
150
+ * means the files it is about to retire are still sitting on disk, still
151
+ * first, and would answer the question with the very thing being
152
+ * replaced. Skipping them asks what a shell will find AFTERWARDS, which
153
+ * is the question worth answering. */
154
+ export declare function resolveOnPath(name: string, pathValue: string, platform: NodeJS.Platform, pathSeparator: string, ignore?: string[]): string | undefined;
90
155
  /** Places a downloaded, verified binary at targetPath. Reuses
91
156
  * self-update.ts's swapPlanFor()/executeSwapPlan() for the case they
92
157
  * were built for -- overwriting an EXISTING file, where Windows' plan
@@ -96,6 +161,43 @@ export declare function resolveOnPath(name: string, pathValue: string, platform:
96
161
  * plain move instead of asking swapPlanFor to rename a file that does
97
162
  * not exist. */
98
163
  export declare function installStagedBinary(stagedPath: string, targetPath: string, platform: NodeJS.Platform): Promise<void>;
164
+ /**
165
+ * Takes the binary distribution back out of service -- the last and only
166
+ * destructive step of `--npm`, the mirror of the npm uninstall that ends
167
+ * `--binary`.
168
+ *
169
+ * ON WINDOWS THIS FILE IS THE RUNNING PROCESS and cannot be deleted, so it
170
+ * is renamed aside to `.old` instead, exactly the trick swapPlanFor() uses
171
+ * to update a binary in place. Renaming is enough for the purpose: the
172
+ * name `maka.exe` stops resolving, which is the whole requirement. POSIX
173
+ * unlinks a running executable happily, so there it simply goes.
174
+ */
175
+ export declare function retireBinaryInstall(binaryPath: string, platform: NodeJS.Platform): {
176
+ removed: boolean;
177
+ renamedTo?: string;
178
+ };
179
+ /**
180
+ * What to run to make a maka -- packaged or npm-installed -- print its
181
+ * version, used by BOTH switch directions to prove the incoming install
182
+ * actually runs before the outgoing one is taken away.
183
+ *
184
+ * IT IS THE `version` COMMAND AND NOT `--version`, and the difference is
185
+ * not cosmetic. maka's argument parser wants a command; a bare flag with
186
+ * no command reaches it as no command at all and it exits 1 with "Too few
187
+ * arguments". Both directions of this switch verify by looking for the
188
+ * version string in successful output, so `--version` fails that check
189
+ * every single time -- which is how --binary came to be a flow that could
190
+ * download, verify, stage and PATH-install a binary and then refuse to
191
+ * finish, every time, on every machine. Measured, not reasoned: `maka
192
+ * version` prints "Maka <x.y.z>" and exits 0, `maka --version` prints the
193
+ * usage banner and exits 1.
194
+ *
195
+ * A constant rather than a literal at each site because there are two
196
+ * sites now, and the failure mode of getting this wrong is silent: a
197
+ * verification that can never pass looks exactly like a careful one until
198
+ * somebody runs it.
199
+ */
200
+ export declare const VERSION_PROBE_ARGV: string[];
99
201
  /** Compares two spawnSync-style results the way check-bundle-parity.mjs
100
202
  * compares builds: same exit status, same combined stdout+stderr. No
101
203
  * path-scrubbing normalization here -- both invocations run the exact