@fiodos/cli 0.1.9 → 0.1.10

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 +3 -2
  2. package/src/ast.js +24 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiodos/cli",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Fiodos CLI — analyzes your app's source code and generates the in-app voice-agent manifest, then wires the orb. Powers `npx @fiodos/cli analyze`.",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -21,7 +21,8 @@
21
21
  "dependencies": {
22
22
  "@fiodos/core": "^0.1.0",
23
23
  "esbuild": "^0.28.1",
24
- "jsdom": "^24.0.0"
24
+ "jsdom": "^24.0.0",
25
+ "typescript": "^5.6.0"
25
26
  },
26
27
  "license": "SEE LICENSE IN LICENSE",
27
28
  "publishConfig": {
package/src/ast.js CHANGED
@@ -20,8 +20,30 @@
20
20
 
21
21
  const fs = require('fs');
22
22
  const path = require('path');
23
- // Reuse the monorepo's TypeScript — real parser, real AST.
24
- const ts = require(path.join(__dirname, '../../../node_modules/typescript'));
23
+
24
+ // Load the TypeScript compiler (real parser, real AST). `typescript` is a
25
+ // declared dependency of this package, so when the CLI is installed from npm
26
+ // (or run via `npx`) it resolves from the CLI's own node_modules. The monorepo
27
+ // path is only a dev-time fallback for the hoisted workspace install.
28
+ const ts = loadTypeScript();
29
+
30
+ function loadTypeScript() {
31
+ try {
32
+ // Installed/npx case: resolves from @fiodos/cli's node_modules.
33
+ return require('typescript');
34
+ } catch {
35
+ // Monorepo dev fallback: TypeScript is hoisted to the repo root.
36
+ try {
37
+ return require(path.join(__dirname, '../../../node_modules/typescript'));
38
+ } catch (e) {
39
+ throw new Error(
40
+ 'Fiodos CLI could not load its TypeScript dependency. This usually means ' +
41
+ 'a corrupted install — try `npm cache clean --force` and re-run, or reinstall ' +
42
+ `@fiodos/cli. Original error: ${e.message}`,
43
+ );
44
+ }
45
+ }
46
+ }
25
47
 
26
48
  function parseFile(filePath) {
27
49
  const text = fs.readFileSync(filePath, 'utf8');