@gettrace/cli 2.0.4 → 2.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gettrace/cli",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "description": "Trace IDE Bridge for connecting local filesystem to Trace browser extensions.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -41,7 +41,7 @@
41
41
  "@babel/traverse": "^7.24.0",
42
42
  "@babel/generator": "^7.24.0",
43
43
  "@babel/types": "^7.24.0",
44
- "@gettrace/agent": "^2.0.4"
44
+ "@gettrace/agent": "^2.0.5"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/node": "^20.0.0",
@@ -112,11 +112,22 @@ function generateHostEntry() {
112
112
  ? `process.env.PATH = '${dirname(tracePath)}:${dirname(nodePath)}:' + (process.env.PATH || '/usr/bin:/bin');`
113
113
  : `process.env.PATH = '${dirname(nodePath)}:/opt/homebrew/bin:/usr/local/bin:' + (process.env.PATH || '/usr/bin:/bin');`,
114
114
  ``,
115
- // Inject dev mode env vars when the local CLI exists (dev workflow).
116
- // In production these lines are absent host.cjs uses the global trace binary.
115
+ // Inject dev mode env vars ONLY when running from the trace monorepo
116
+ // (the dev workflow). Detect that by the presence of the local agent
117
+ // build that dev-mode resolution actually targets:
118
+ // <repo>/packages/trace-agent/dist/node/index.js. In a published npm
119
+ // install this path does not exist (the package lives under
120
+ // node_modules/@gettrace/cli), so production NEVER enables dev mode.
121
+ //
122
+ // NOTE: do NOT key this off `<pkg>/dist/index.js` — the published CLI
123
+ // ships that file too, which previously made every install spuriously
124
+ // enable dev mode and fail to locate the agent.
117
125
  ...(() => {
126
+ const monorepoAgent = resolve(
127
+ __dirname, '..', '..', 'packages', 'trace-agent', 'dist', 'node', 'index.js'
128
+ );
118
129
  const localCli = resolve(__dirname, '..', 'dist', 'index.js');
119
- if (existsSync(localCli)) {
130
+ if (existsSync(monorepoAgent) && existsSync(localCli)) {
120
131
  return [
121
132
  `// Dev mode: use local CLI build instead of the global npm package`,
122
133
  `process.env.TRACE_DEV_MODE = '1';`,