@odla-ai/cli 0.30.2 → 0.30.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/odla-ai.js +33 -0
- package/bin/workspace-build.d.ts +2 -0
- package/bin/workspace-build.js +36 -0
- package/package.json +3 -2
package/bin/odla-ai.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
|
+
import { workspaceBuildOrder } from "./workspace-build.js";
|
|
7
|
+
|
|
8
|
+
const packageRoot = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
9
|
+
const builtEntry = join(packageRoot, "dist", "bin.js");
|
|
10
|
+
|
|
11
|
+
if (!existsSync(builtEntry)) {
|
|
12
|
+
const workspaceRoot = join(packageRoot, "..", "..");
|
|
13
|
+
const rootManifestPath = join(workspaceRoot, "package.json");
|
|
14
|
+
const rootManifest = existsSync(rootManifestPath)
|
|
15
|
+
? JSON.parse(readFileSync(rootManifestPath, "utf8"))
|
|
16
|
+
: null;
|
|
17
|
+
if (rootManifest?.name !== "odla-ai" || rootManifest.private !== true) {
|
|
18
|
+
throw new Error("odla-ai CLI build is missing; reinstall @odla-ai/cli from npm");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
console.error("odla-ai: workspace CLI is not built; building the local monorepo first");
|
|
22
|
+
const npm = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
23
|
+
const workspaces = workspaceBuildOrder(workspaceRoot);
|
|
24
|
+
const child = spawnSync(
|
|
25
|
+
npm,
|
|
26
|
+
["run", "build", ...workspaces.map((name) => `--workspace=${name}`)],
|
|
27
|
+
{ cwd: workspaceRoot, stdio: "inherit" },
|
|
28
|
+
);
|
|
29
|
+
if (child.error) throw child.error;
|
|
30
|
+
if (child.status !== 0) process.exit(child.status ?? 1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
await import(pathToFileURL(builtEntry).href);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
|
|
4
|
+
const manifestAt = (path) => JSON.parse(readFileSync(path, "utf8"));
|
|
5
|
+
|
|
6
|
+
/** Return buildable internal dependencies in dependency-first order. */
|
|
7
|
+
export function workspaceBuildOrder(root) {
|
|
8
|
+
const rootManifest = manifestAt(join(root, "package.json"));
|
|
9
|
+
const workspaces = new Map();
|
|
10
|
+
for (const pattern of rootManifest.workspaces ?? []) {
|
|
11
|
+
if (!pattern.endsWith("/*")) continue;
|
|
12
|
+
const parent = join(root, pattern.slice(0, -2));
|
|
13
|
+
if (!existsSync(parent)) continue;
|
|
14
|
+
for (const entry of readdirSync(parent, { withFileTypes: true })) {
|
|
15
|
+
if (!entry.isDirectory()) continue;
|
|
16
|
+
const manifestPath = join(parent, entry.name, "package.json");
|
|
17
|
+
if (!existsSync(manifestPath)) continue;
|
|
18
|
+
const manifest = manifestAt(manifestPath);
|
|
19
|
+
if (manifest.name) workspaces.set(manifest.name, manifest);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const visited = new Set();
|
|
24
|
+
const order = [];
|
|
25
|
+
const visit = (name) => {
|
|
26
|
+
if (visited.has(name)) return;
|
|
27
|
+
visited.add(name);
|
|
28
|
+
const manifest = workspaces.get(name);
|
|
29
|
+
if (!manifest) return;
|
|
30
|
+
const dependencies = { ...manifest.dependencies, ...manifest.devDependencies };
|
|
31
|
+
for (const dependency of Object.keys(dependencies)) visit(dependency);
|
|
32
|
+
if (manifest.scripts?.build) order.push(name);
|
|
33
|
+
};
|
|
34
|
+
visit("@odla-ai/cli");
|
|
35
|
+
return order;
|
|
36
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odla-ai/cli",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.3",
|
|
4
4
|
"description": "Agent-operable CLI for odla provisioning, calendar consent and connection lifecycle, System AI administration, Worker secrets, security jobs, and smoke checks.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://odla.ai/docs/packages/cli",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"type": "module",
|
|
13
13
|
"bin": {
|
|
14
|
-
"odla-ai": "
|
|
14
|
+
"odla-ai": "bin/odla-ai.js"
|
|
15
15
|
},
|
|
16
16
|
"main": "./dist/index.cjs",
|
|
17
17
|
"module": "./dist/index.js",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"files": [
|
|
27
|
+
"bin",
|
|
27
28
|
"dist",
|
|
28
29
|
"skills",
|
|
29
30
|
"README.md",
|