stealthos-cli 0.1.0-alpha.1 → 0.1.0-alpha.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.
package/bin.cjs ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ // CJS wrapper — loads the ESM entry point via dynamic import
3
+ // Required because npm rejects .mjs in bin entries on Windows
4
+ import("./bin.mjs").catch((err) => {
5
+ process.stderr.write("\n✖ stealthos failed: " + err.message + "\n");
6
+ process.exit(1);
7
+ });
package/bin.mjs CHANGED
File without changes
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "stealthos-cli",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.3",
4
4
  "description": "StealthOS CLI — install/manage the StealthOS knowledge base in ~/.stealthos/. Subcommands: install, status, version.",
5
5
  "type": "module",
6
6
  "bin": {
7
- "stealthos": "./bin.mjs"
7
+ "stealthos": "./bin.cjs"
8
8
  },
9
9
  "files": [
10
+ "bin.cjs",
10
11
  "bin.mjs",
11
12
  "src/",
12
13
  "README.md"
@@ -110,7 +110,7 @@ export async function installCommand(flags = {}) {
110
110
  installed_at: new Date().toISOString(),
111
111
  installed_from: source,
112
112
  source_version: sourceVersion,
113
- cli_version: "0.1.0-alpha.1",
113
+ cli_version: "0.1.0-alpha.3",
114
114
  };
115
115
  await writeFile(join(home, ".stealthos-version.json"), JSON.stringify(versionMarker, null, 2), "utf8");
116
116
 
@@ -11,20 +11,30 @@ import { fileURLToPath } from "node:url";
11
11
 
12
12
  const __dirname = dirname(fileURLToPath(import.meta.url));
13
13
 
14
+ function resolveAiDir(abs) {
15
+ // Accept either <root> (contains .ai/manifest.json) or <root>/.ai (contains manifest.json)
16
+ if (existsSync(join(abs, "manifest.json"))) return abs;
17
+ const sub = join(abs, ".ai");
18
+ if (existsSync(join(sub, "manifest.json"))) return sub;
19
+ return null;
20
+ }
21
+
14
22
  export function resolveSource({ flagSource } = {}) {
15
23
  if (flagSource) {
16
24
  const abs = resolve(flagSource);
17
- if (!existsSync(join(abs, "manifest.json"))) {
18
- throw new Error(`--source path does not contain manifest.json: ${abs}`);
25
+ const ai = resolveAiDir(abs);
26
+ if (!ai) {
27
+ throw new Error(`--source path does not contain manifest.json (checked ${abs} and ${join(abs, ".ai")})`);
19
28
  }
20
- return abs;
29
+ return ai;
21
30
  }
22
31
  if (process.env.STEALTHOS_SOURCE) {
23
32
  const abs = resolve(process.env.STEALTHOS_SOURCE);
24
- if (!existsSync(join(abs, "manifest.json"))) {
33
+ const ai = resolveAiDir(abs);
34
+ if (!ai) {
25
35
  throw new Error(`STEALTHOS_SOURCE does not contain manifest.json: ${abs}`);
26
36
  }
27
- return abs;
37
+ return ai;
28
38
  }
29
39
  // Monorepo discovery: walk up from packages/stealthos-cli/src/lib/ to find sibling .ai/
30
40
  let dir = __dirname;