tokentracky 0.2.1 → 0.3.1

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 CHANGED
@@ -38,3 +38,5 @@ The package currently contains an empty release manifest, so it intentionally re
38
38
  Each CLI's `url` is its file under the same release tag. The launcher supports macOS 13+ on arm64, Linux on x64 and arm64 (one static binary for every distribution) and Windows on x64. It verifies SHA-256 before execution, caches the binary under the user's cache directory (`%LOCALAPPDATA%\tokentracky` on Windows), and rejects redirects outside GitHub's HTTPS release asset hosts. `TOKENTRACKY_CACHE_DIR` selects an isolated cache. The disposable install harness edits only its installed manifest; the shipped launcher has no test manifest override. Downloads have a 60-second total deadline and a 100 MiB limit, reject URL credentials/nondefault ports, and cancel redirect bodies.
39
39
 
40
40
  `login` from a Mac terminal without `Tokentracky.app` in `/Applications` or `~/Applications` first asks whether to install it (Enter or Ctrl-D is no; Ctrl-C stops). On yes the launcher downloads the version's DMG from the manifest's `macos.arm64.app` entry under the same checks, refuses it unless its SHA-256 matches, attaches it read-only, copies the app into `/Applications` (else `~/Applications`) and detaches it. The CLI then opens the app once the computer is approved. A failed install says why and carries on without the app.
41
+
42
+ `login --install-app` answers yes in advance and installs the app the same way without a terminal, so an AI agent can run `npx --yes tokentracky login --install-app`. The launcher removes the flag before starting the CLI; it does nothing outside `login` on a Mac.
@@ -155,11 +155,14 @@ export async function installVerifiedBinary({ manifest, version = VERSION, platf
155
155
  /** Where the Mac app is looked for and put: the system's Applications folder, then the user's own. */
156
156
  export const APP_FOLDERS = ['/Applications', join(homedir(), 'Applications')];
157
157
  const APP = 'Tokentracky.app';
158
+ /** The launcher's own flag: yes to the app in advance, for `login` run without a terminal (by an AI agent, say). The
159
+ * CLI never sees it. */
160
+ const INSTALL_APP = '--install-app';
158
161
 
159
- /** `login` from a Mac terminal, where the launcher offers the app before the CLI starts. Not with `TOKENTRACKY_HOME`:
160
- * the app opens with the system's environment, so the CLI does not hand that credential to it. */
162
+ /** `login` from a Mac terminal, or with `--install-app`, where the launcher offers the app before the CLI starts. Not
163
+ * with `TOKENTRACKY_HOME`: the app opens with the system's environment, so the CLI does not hand that credential to it. */
161
164
  export function offersApp(args, { platform = process.platform, interactive = Boolean(process.stdin.isTTY && process.stdout.isTTY), env = process.env } = {}) {
162
- return platform === 'darwin' && interactive && !env.TOKENTRACKY_HOME && args.includes('login') && !args.some((arg) => ['-h', '--help', '-v', '--version'].includes(arg));
165
+ return platform === 'darwin' && (interactive || args.includes(INSTALL_APP)) && !env.TOKENTRACKY_HOME && args.includes('login') && !args.some((arg) => ['-h', '--help', '-v', '--version'].includes(arg));
163
166
  }
164
167
 
165
168
  /** The installed Mac app, or null. */
@@ -208,13 +211,15 @@ export async function installMacApp({ manifest, version = VERSION, folders = APP
208
211
  * menu bar. Without it the CLI keeps uploading itself while its terminal stays open. */
209
212
  async function offerMacApp(args) {
210
213
  if (!offersApp(args) || (await installedApp())) return;
211
- const { createInterface } = await import('node:readline/promises');
212
- const terminal = createInterface({ input: process.stdin, output: process.stdout });
213
- // Ctrl-C stops here, as it stops the CLI; Ctrl-D answers no.
214
- terminal.once('SIGINT', () => { terminal.close(); process.stdout.write('\n'); process.exit(130); });
215
- const answer = await terminal.question('Tokentracky for Mac keeps uploading from the menu bar after you close this terminal. Install it in Applications? [y/N] ').catch(() => '');
216
- terminal.close();
217
- if (!/^y(es)?$/i.test(answer.trim())) return;
214
+ if (!args.includes(INSTALL_APP)) {
215
+ const { createInterface } = await import('node:readline/promises');
216
+ const terminal = createInterface({ input: process.stdin, output: process.stdout });
217
+ // Ctrl-C stops here, as it stops the CLI; Ctrl-D answers no.
218
+ terminal.once('SIGINT', () => { terminal.close(); process.stdout.write('\n'); process.exit(130); });
219
+ const answer = await terminal.question('Tokentracky for Mac keeps uploading from the menu bar after you close this terminal. Install it in Applications? [y/N] ').catch(() => '');
220
+ terminal.close();
221
+ if (!/^y(es)?$/i.test(answer.trim())) return;
222
+ }
218
223
  try {
219
224
  process.stdout.write('Downloading Tokentracky for Mac…\n');
220
225
  const app = await installMacApp({ manifest: JSON.parse(await readFile(MANIFEST_PATH, 'utf8')) });
@@ -233,7 +238,7 @@ export async function main(args = process.argv.slice(2)) {
233
238
  try {
234
239
  const binary = await getBinary();
235
240
  await offerMacApp(args);
236
- const child = spawn(binary, args, { stdio: 'inherit' });
241
+ const child = spawn(binary, args.filter((arg) => arg !== INSTALL_APP), { stdio: 'inherit' });
237
242
  // Windows has no signals to pass on: the console sends Ctrl+C and Ctrl+Break to the CLI itself, and Node could
238
243
  // only end it outright. The launcher waits for it to stop.
239
244
  const windows = process.platform === 'win32';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokentracky",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
4
4
  "description": "Tokentracky Rust CLI for Apple Silicon Macs, Linux and Windows",
5
5
  "type": "module",
6
6
  "repository": { "type": "git", "url": "git+https://github.com/AuvreyDurelle/tokentracky.git" },
@@ -1,45 +1,45 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "latest": "0.2.1",
3
+ "latest": "0.3.1",
4
4
  "releases": {
5
- "0.2.1": {
5
+ "0.3.1": {
6
6
  "verified": true,
7
7
  "macos": {
8
8
  "arm64": {
9
9
  "cli": {
10
- "file": "tokentracky-0.2.1-macos-arm64",
11
- "url": "https://github.com/AuvreyDurelle/tokentracky/releases/download/v0.2.1/tokentracky-0.2.1-macos-arm64",
12
- "sha256": "bad7a1fa9b20ce37cda55c0a4042b168162f85a37c0c06c5c2dca53fa608a3fb"
10
+ "file": "tokentracky-0.3.1-macos-arm64",
11
+ "url": "https://github.com/AuvreyDurelle/tokentracky/releases/download/v0.3.1/tokentracky-0.3.1-macos-arm64",
12
+ "sha256": "3c7540f969721d62dcff0a4c393d146d9f856f8d6073fda4e895f16709c5981f"
13
13
  },
14
14
  "app": {
15
- "file": "tokentracky-0.2.1-macos-arm64.dmg",
16
- "url": "https://github.com/AuvreyDurelle/tokentracky/releases/download/v0.2.1/tokentracky-0.2.1-macos-arm64.dmg",
17
- "sha256": "524a88b5d13aa74051e8ae783660e831d5a691faf8d387ee9cba7417a6d8649c"
15
+ "file": "tokentracky-0.3.1-macos-arm64.dmg",
16
+ "url": "https://github.com/AuvreyDurelle/tokentracky/releases/download/v0.3.1/tokentracky-0.3.1-macos-arm64.dmg",
17
+ "sha256": "91a74c71503f08661eae6b21d0b0b00125623810f1009a3953e013ed979c43ed"
18
18
  }
19
19
  }
20
20
  },
21
21
  "linux": {
22
22
  "aarch64": {
23
23
  "cli": {
24
- "file": "tokentracky-0.2.1-linux-aarch64",
25
- "url": "https://github.com/AuvreyDurelle/tokentracky/releases/download/v0.2.1/tokentracky-0.2.1-linux-aarch64",
26
- "sha256": "2b185606154670c92f6c8e511406199f56d8fd6d058fb303a9b62cec71c727aa"
24
+ "file": "tokentracky-0.3.1-linux-aarch64",
25
+ "url": "https://github.com/AuvreyDurelle/tokentracky/releases/download/v0.3.1/tokentracky-0.3.1-linux-aarch64",
26
+ "sha256": "f50dcaa4ce9aec9a026c5a0edfc1a438abca10cab4942da67e4517ae8de2a43f"
27
27
  }
28
28
  },
29
29
  "x86_64": {
30
30
  "cli": {
31
- "file": "tokentracky-0.2.1-linux-x86_64",
32
- "url": "https://github.com/AuvreyDurelle/tokentracky/releases/download/v0.2.1/tokentracky-0.2.1-linux-x86_64",
33
- "sha256": "b1afc2c080c415787940dd07a6014e5f134a2ceba500b7ceea812ceb288d2c47"
31
+ "file": "tokentracky-0.3.1-linux-x86_64",
32
+ "url": "https://github.com/AuvreyDurelle/tokentracky/releases/download/v0.3.1/tokentracky-0.3.1-linux-x86_64",
33
+ "sha256": "2765e532d47124c9f1b9c09f2b557988e00ed4d06f8d31fd199c27f150e77f2a"
34
34
  }
35
35
  }
36
36
  },
37
37
  "windows": {
38
38
  "x86_64": {
39
39
  "cli": {
40
- "file": "tokentracky-0.2.1-windows-x86_64.exe",
41
- "url": "https://github.com/AuvreyDurelle/tokentracky/releases/download/v0.2.1/tokentracky-0.2.1-windows-x86_64.exe",
42
- "sha256": "424b8dd1bd240014829e27f610d75ee613dbcb249853ca6e8ed31858c7e4232a"
40
+ "file": "tokentracky-0.3.1-windows-x86_64.exe",
41
+ "url": "https://github.com/AuvreyDurelle/tokentracky/releases/download/v0.3.1/tokentracky-0.3.1-windows-x86_64.exe",
42
+ "sha256": "afe56bb030c6fc7854859b11d17b5949da55a9f353d793e8032b9382f69834db"
43
43
  }
44
44
  }
45
45
  }