@josfox/jos 4.0.0 → 4.0.4

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/bin/jos +22 -3
  2. package/package.json +4 -3
package/bin/jos CHANGED
@@ -65,12 +65,31 @@ if (!cmd) {
65
65
  process.exit(0);
66
66
  }
67
67
 
68
- const cmdPath = path.join(JOS_HOME, 'commands', cmd, 'index.js');
69
- if (!fs.existsSync(cmdPath)) {
68
+ // Look for command in multiple locations (priority order)
69
+ const PKG_COMMANDS = path.join(__dirname, '..', 'src', 'commands'); // npm package
70
+ const USER_COMMANDS = path.join(JOS_HOME, 'commands'); // user installed
71
+
72
+ function findCommand(name) {
73
+ // 1. Check user's ~/.jos/commands first (allows overrides)
74
+ const userPath = path.join(USER_COMMANDS, name, 'index.js');
75
+ if (fs.existsSync(userPath)) return userPath;
76
+
77
+ // 2. Check npm package src/commands
78
+ const pkgPath = path.join(PKG_COMMANDS, `${name}.js`);
79
+ if (fs.existsSync(pkgPath)) return pkgPath;
80
+
81
+ // 3. Check npm package src/ directly (for serve.js)
82
+ const srcPath = path.join(__dirname, '..', 'src', `${name}.js`);
83
+ if (fs.existsSync(srcPath)) return srcPath;
84
+
85
+ return null;
86
+ }
87
+
88
+ const cmdPath = findCommand(cmd);
89
+ if (!cmdPath) {
70
90
  const color = randomAurora();
71
91
  console.log(`\n${color} ✖${C.reset} ${C.white}Unknown command:${C.reset} ${C.cyan}${rawCmd}${C.reset}`);
72
92
  console.log(`${C.dim} Try: ${C.cyan}jos --help${C.reset}${C.dim} to see available commands${C.reset}\n`);
73
93
  process.exit(1);
74
94
  }
75
95
  require(cmdPath).execute(process.argv.slice(3), JOS_HOME);
76
-
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@josfox/jos",
3
- "version": "4.0.0",
3
+ "version": "4.0.4",
4
4
  "description": "Stoic kernel for AI agent orchestration. Zero dependencies. Offline first.",
5
5
  "license": "MIT",
6
- "author": "JOS Open Solutions Foundation",
6
+ "author": "JOS Open Standards Foundation",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/josfox-ai/jos.git"
@@ -21,7 +21,8 @@
21
21
  "zero-dependencies"
22
22
  ],
23
23
  "bin": {
24
- "jos": "bin/jos"
24
+ "jos": "bin/jos",
25
+ "josfox": "bin/jos"
25
26
  },
26
27
  "files": [
27
28
  "bin/",