kronk-cli 0.8.1 → 0.8.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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/update.js +21 -1
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "kronk-cli",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "description": "A Claude-Code-style terminal agent for local models served by Kronk.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "bin": {
8
- "kronk-cli": "./src/index.js"
8
+ "kronk-cli": "src/index.js"
9
9
  },
10
10
  "engines": {
11
11
  "node": ">=20"
package/src/update.js CHANGED
@@ -28,7 +28,7 @@
28
28
  */
29
29
  import { execFile } from 'node:child_process';
30
30
  import { promisify } from 'node:util';
31
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
31
+ import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from 'node:fs';
32
32
  import { dirname, join, sep } from 'node:path';
33
33
  import { config } from './config.js';
34
34
  import { VERSION } from './version.js';
@@ -90,6 +90,15 @@ function findGitRoot(startDir) {
90
90
 
91
91
  const toPosix = (p) => p.split(sep).join('/');
92
92
 
93
+ /** The file a symlinked entry point really is; as given when it cannot be resolved. */
94
+ function resolveEntry(entryPath) {
95
+ try {
96
+ return realpathSync(entryPath);
97
+ } catch {
98
+ return entryPath;
99
+ }
100
+ }
101
+
93
102
  /**
94
103
  * Where this running copy of kronk-cli came from, read off the path Node
95
104
  * resolved for `src/index.js` rather than asked of any registry — the issue's
@@ -117,10 +126,21 @@ const toPosix = (p) => p.split(sep).join('/');
117
126
  * is worse than nothing". With no receipt there is nothing to go on but the
118
127
  * path, and then a `.git` ancestor is the better guess and wins.
119
128
  *
129
+ * The path is read *after* resolving symlinks. npm installs a global package's
130
+ * bin as a symlink — `<prefix>/bin/kronk-cli -> ../lib/node_modules/kronk-cli/
131
+ * src/index.js` — and Node leaves `process.argv[1]` as the link, not its
132
+ * target. Matched as given, that path has no `node_modules` in it, and the
133
+ * `.git` walk then climbs out of `bin/` into whatever encloses the prefix:
134
+ * under nvm that is `~/.nvm`, itself a git checkout, and the banner offered
135
+ * nvm's own release tag with `git pull` as the fix. Homebrew and `install.sh`
136
+ * both install a wrapper script that runs the real path, so npm was the only
137
+ * route that tripped it, but resolving here covers every caller.
138
+ *
120
139
  * Returns null when none of the above matches — a shape this function was
121
140
  * never taught, which is the honest answer, not a guess dressed as one.
122
141
  */
123
142
  export function detectInstall(entryPath) {
143
+ entryPath = resolveEntry(entryPath);
124
144
  const norm = toPosix(entryPath);
125
145
  if (/\/Cellar\/kronk-cli\//.test(norm)) return { route: 'brew' };
126
146
  if (/\/node_modules\/kronk-cli(\/|$)/.test(norm)) return { route: 'npm' };