stealthos-cli 0.1.0-alpha.1 → 0.1.0-alpha.2
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.mjs +0 -0
- package/package.json +3 -2
- package/src/commands/install.mjs +1 -1
- package/src/lib/resolve-source.mjs +15 -5
- package/stealthos +2 -0
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.
|
|
3
|
+
"version": "0.1.0-alpha.2",
|
|
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": "./
|
|
7
|
+
"stealthos": "./stealthos"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
+
"stealthos",
|
|
10
11
|
"bin.mjs",
|
|
11
12
|
"src/",
|
|
12
13
|
"README.md"
|
package/src/commands/install.mjs
CHANGED
|
@@ -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.
|
|
113
|
+
cli_version: "0.1.0-alpha.2",
|
|
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
|
-
|
|
18
|
-
|
|
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
|
|
29
|
+
return ai;
|
|
21
30
|
}
|
|
22
31
|
if (process.env.STEALTHOS_SOURCE) {
|
|
23
32
|
const abs = resolve(process.env.STEALTHOS_SOURCE);
|
|
24
|
-
|
|
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
|
|
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;
|
package/stealthos
ADDED