fastctx 0.1.0 → 0.1.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.
Files changed (3) hide show
  1. package/README.md +13 -1
  2. package/launcher.js +38 -6
  3. package/package.json +5 -5
package/README.md CHANGED
@@ -26,7 +26,19 @@ Job commands, working directories, rolling output, and exit status stay in the
26
26
  current user's private local directory and are never uploaded by FastCtx.
27
27
 
28
28
  ```console
29
- npx fastctx
29
+ npm install --global fastctx
30
+ fastctx
31
+ ```
32
+
33
+ For a one-off run without installing, `npx fastctx` opens the same control
34
+ terminal.
35
+
36
+ If your npm registry is a mirror that has not synchronized this release yet,
37
+ the install can fail with `404 Not Found` on the platform package. Install once
38
+ from the official registry:
39
+
40
+ ```console
41
+ npm install --global fastctx --registry=https://registry.npmjs.org/
30
42
  ```
31
43
 
32
44
  This package is the launcher: it selects the matching scoped platform package
package/launcher.js CHANGED
@@ -5,6 +5,9 @@ const { spawn } = require('node:child_process');
5
5
  const fs = require('node:fs');
6
6
  const os = require('node:os');
7
7
  const path = require('node:path');
8
+ const fastctxHome = process.platform === 'win32'
9
+ ? process.env.USERPROFILE || os.homedir()
10
+ : process.env.HOME || os.homedir();
8
11
 
9
12
  const targets = {
10
13
  'win32-x64': ['@fastctx/win32-x64', 'fastctx.exe'],
@@ -19,14 +22,44 @@ if (!target) {
19
22
  process.exit(1);
20
23
  }
21
24
 
22
- let packageRoot;
25
+ let executable;
26
+ let platformPackageMissing = false;
23
27
  try {
24
- packageRoot = path.dirname(require.resolve(`${target[0]}/package.json`));
28
+ const packageRoot = path.dirname(require.resolve(`${target[0]}/package.json`));
29
+ const packagedExecutable = path.join(packageRoot, 'bin', target[1]);
30
+ if (!fs.statSync(packagedExecutable).isFile()) {
31
+ platformPackageMissing = true;
32
+ } else {
33
+ executable = packagedExecutable;
34
+ }
25
35
  } catch (_) {
26
- console.error(`fastctx: platform package ${target[0]} is missing; reinstall fastctx`);
27
- process.exit(1);
36
+ platformPackageMissing = true;
37
+ }
38
+ if (platformPackageMissing) {
39
+ const stableExecutable = path.join(fastctxHome, '.fastctx', 'bin', target[1]);
40
+ let stableCopyReady = false;
41
+ try {
42
+ stableCopyReady = fs.statSync(stableExecutable).isFile();
43
+ } catch (_) {
44
+ stableCopyReady = false;
45
+ }
46
+ if (stableCopyReady) {
47
+ executable = stableExecutable;
48
+ console.error(
49
+ `fastctx: platform package ${target[0]} is missing; using the stable copy at ${stableExecutable}`,
50
+ );
51
+ } else {
52
+ console.error(
53
+ [
54
+ `fastctx: platform package ${target[0]} is missing, and no stable copy is installed.`,
55
+ 'Your configured npm registry may not have synchronized the platform package yet.',
56
+ 'Retry once from the official registry:',
57
+ ' npm install --global fastctx --registry=https://registry.npmjs.org/',
58
+ ].join('\n'),
59
+ );
60
+ process.exit(1);
61
+ }
28
62
  }
29
- const executable = path.join(packageRoot, 'bin', target[1]);
30
63
  const args = process.argv.slice(2);
31
64
  const interactive = Boolean(process.stdin.isTTY && process.stdout.isTTY && args[0] !== 'serve');
32
65
  const tuiLaunch = interactive && (args.length === 0 || args[0] === 'ui');
@@ -37,7 +70,6 @@ const npmLauncher = process.env.FASTCTX_NPM_LAUNCHER || __filename;
37
70
  const npmMode = process.env.npm_command === 'exec' || npmLauncher.includes(`${path.sep}_npx${path.sep}`)
38
71
  ? 'exec'
39
72
  : 'global';
40
- const fastctxHome = process.env.HOME || process.env.USERPROFILE || os.homedir();
41
73
  const npmHandoff = path.join(
42
74
  fastctxHome,
43
75
  '.fastctx',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastctx",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "FastCtx — fast, context-efficient repository tools for AI agents.",
5
5
  "author": "yc-duan <dy2958830371@gmail.com>",
6
6
  "license": "MIT OR Apache-2.0",
@@ -22,10 +22,10 @@
22
22
  "licenses/**"
23
23
  ],
24
24
  "optionalDependencies": {
25
- "@fastctx/win32-x64": "0.1.0",
26
- "@fastctx/linux-x64": "0.1.0",
27
- "@fastctx/darwin-x64": "0.1.0",
28
- "@fastctx/darwin-arm64": "0.1.0"
25
+ "@fastctx/win32-x64": "0.1.1",
26
+ "@fastctx/linux-x64": "0.1.1",
27
+ "@fastctx/darwin-x64": "0.1.1",
28
+ "@fastctx/darwin-arm64": "0.1.1"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"