@nebulaos/cli 0.1.1 → 0.1.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/LICENSE.txt +21 -0
- package/README.md +310 -298
- package/dist/bin/nebulaos.js +133 -17
- package/dist/bin/nebulaos.js.map +1 -1
- package/dist/index.js +135 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/nebulaos.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { CommanderError } from "commander";
|
|
5
5
|
|
|
6
6
|
// src/program.ts
|
|
7
|
-
import { Command as
|
|
7
|
+
import { Command as Command68 } from "commander";
|
|
8
8
|
|
|
9
9
|
// src/lib/flags.ts
|
|
10
10
|
import { Option } from "commander";
|
|
@@ -1066,11 +1066,12 @@ import { Command as Command23 } from "commander";
|
|
|
1066
1066
|
import ora from "ora";
|
|
1067
1067
|
import chalk11 from "chalk";
|
|
1068
1068
|
function createExecutionRunCommand() {
|
|
1069
|
-
const cmd = new Command23("run").description("Trigger execution of an agent or workflow by resource ID").argument("<resourceId>", "Resource ID to execute").option("-i, --input <json>", "Input data as JSON string").addHelpText("after", `
|
|
1069
|
+
const cmd = new Command23("run").description("Trigger execution of an agent or workflow by resource ID").argument("<resourceId>", "Resource ID to execute").option("-i, --input <json>", "Input data as JSON string").option("-m, --memory-key <key>", "Memory partition key for conversation context").addHelpText("after", `
|
|
1070
1070
|
Examples:
|
|
1071
1071
|
$ nebulaos exec run 550e8400-e29b... Run a resource
|
|
1072
1072
|
$ nebulaos exec run my-agent -i '{"prompt":"Hello"}' Run with JSON input
|
|
1073
1073
|
$ nebulaos exec run my-workflow -i '{"data":[1,2,3]}' -o json Run and output as JSON
|
|
1074
|
+
$ nebulaos exec run my-agent -i '"Oi"' -m user-123 Run with memory context
|
|
1074
1075
|
`).action(async (resourceId, options, command) => {
|
|
1075
1076
|
try {
|
|
1076
1077
|
const globalOpts = command.optsWithGlobals();
|
|
@@ -1088,9 +1089,11 @@ Examples:
|
|
|
1088
1089
|
}
|
|
1089
1090
|
}
|
|
1090
1091
|
const spinner = ora("Starting execution...").start();
|
|
1092
|
+
const executionOptions = options.memoryKey ? { memoryKey: options.memoryKey } : void 0;
|
|
1091
1093
|
const { data: execution } = await api.post("/execution", {
|
|
1092
1094
|
resourceId,
|
|
1093
|
-
input: input4
|
|
1095
|
+
input: input4,
|
|
1096
|
+
options: executionOptions
|
|
1094
1097
|
});
|
|
1095
1098
|
spinner.succeed("Execution started.");
|
|
1096
1099
|
if (format === "table") {
|
|
@@ -1307,7 +1310,7 @@ Examples:
|
|
|
1307
1310
|
const params = {};
|
|
1308
1311
|
if (globalOpts.page) params.page = globalOpts.page;
|
|
1309
1312
|
if (globalOpts.pageSize) params.pageSize = globalOpts.pageSize;
|
|
1310
|
-
const { data } = await api.get("/rag/
|
|
1313
|
+
const { data } = await api.get("/rag-openai/connections", { params });
|
|
1311
1314
|
const connections = Array.isArray(data) ? data : data.data || [];
|
|
1312
1315
|
output(format, {
|
|
1313
1316
|
table: {
|
|
@@ -1344,7 +1347,7 @@ Examples:
|
|
|
1344
1347
|
const globalOpts = command.optsWithGlobals();
|
|
1345
1348
|
const format = resolveFormat(globalOpts.output);
|
|
1346
1349
|
const api = getApiClient();
|
|
1347
|
-
const { data } = await api.get(`/rag/
|
|
1350
|
+
const { data } = await api.get(`/rag-openai/connections/${id}`);
|
|
1348
1351
|
if (format === "table") {
|
|
1349
1352
|
console.log(chalk14.bold("RAG Connection\n"));
|
|
1350
1353
|
printDetail("ID", data.id);
|
|
@@ -1392,7 +1395,7 @@ Examples:
|
|
|
1392
1395
|
if (options.apiKey) body.apiKey = options.apiKey;
|
|
1393
1396
|
if (options.model) body.model = options.model;
|
|
1394
1397
|
if (options.dimensions) body.dimensions = options.dimensions;
|
|
1395
|
-
const { data } = await api.post("/rag/
|
|
1398
|
+
const { data } = await api.post("/rag-openai/connections", body);
|
|
1396
1399
|
if (format === "table") {
|
|
1397
1400
|
printSuccess("RAG connection created successfully.");
|
|
1398
1401
|
printDetail("ID", data.id);
|
|
@@ -1430,7 +1433,7 @@ Examples:
|
|
|
1430
1433
|
if (options.apiKey) body.apiKey = options.apiKey;
|
|
1431
1434
|
if (options.model) body.model = options.model;
|
|
1432
1435
|
if (options.dimensions) body.dimensions = options.dimensions;
|
|
1433
|
-
const { data } = await api.patch(`/rag/
|
|
1436
|
+
const { data } = await api.patch(`/rag-openai/connections/${id}`, body);
|
|
1434
1437
|
if (format === "table") {
|
|
1435
1438
|
printSuccess("RAG connection updated successfully.");
|
|
1436
1439
|
printDetail("ID", data.id);
|
|
@@ -1470,7 +1473,7 @@ Examples:
|
|
|
1470
1473
|
}
|
|
1471
1474
|
}
|
|
1472
1475
|
const api = getApiClient();
|
|
1473
|
-
await api.delete(`/rag/
|
|
1476
|
+
await api.delete(`/rag-openai/connections/${id}`);
|
|
1474
1477
|
printSuccess(`RAG connection '${id}' deleted.`);
|
|
1475
1478
|
} catch (error) {
|
|
1476
1479
|
handleError(error);
|
|
@@ -1493,7 +1496,7 @@ Examples:
|
|
|
1493
1496
|
const format = resolveFormat(globalOpts.output);
|
|
1494
1497
|
const api = getApiClient();
|
|
1495
1498
|
console.log("Testing connection...");
|
|
1496
|
-
const { data } = await api.post(`/rag/
|
|
1499
|
+
const { data } = await api.post(`/rag-openai/connections/${id}/test`);
|
|
1497
1500
|
if (format === "table") {
|
|
1498
1501
|
if (data.success) {
|
|
1499
1502
|
console.log(chalk15.green("Connection test passed."));
|
|
@@ -1588,7 +1591,7 @@ Examples:
|
|
|
1588
1591
|
const globalOpts = command.optsWithGlobals();
|
|
1589
1592
|
const format = resolveFormat(globalOpts.output);
|
|
1590
1593
|
const api = getApiClient();
|
|
1591
|
-
const { data } = await api.get("/features/catalog");
|
|
1594
|
+
const { data } = await api.get("/ai-features/catalog");
|
|
1592
1595
|
const features = Array.isArray(data) ? data : data.data || [];
|
|
1593
1596
|
output(format, {
|
|
1594
1597
|
table: {
|
|
@@ -1622,7 +1625,7 @@ Examples:
|
|
|
1622
1625
|
const globalOpts = command.optsWithGlobals();
|
|
1623
1626
|
const format = resolveFormat(globalOpts.output);
|
|
1624
1627
|
const api = getApiClient();
|
|
1625
|
-
const { data } = await api.get("/features");
|
|
1628
|
+
const { data } = await api.get("/ai-features");
|
|
1626
1629
|
const features = Array.isArray(data) ? data : data.data || [];
|
|
1627
1630
|
output(format, {
|
|
1628
1631
|
table: {
|
|
@@ -1657,7 +1660,7 @@ Examples:
|
|
|
1657
1660
|
const globalOpts = command.optsWithGlobals();
|
|
1658
1661
|
const format = resolveFormat(globalOpts.output);
|
|
1659
1662
|
const api = getApiClient();
|
|
1660
|
-
const { data } = await api.get(`/features/${key}`);
|
|
1663
|
+
const { data } = await api.get(`/ai-features/${key}`);
|
|
1661
1664
|
if (format === "table") {
|
|
1662
1665
|
console.log(chalk16.bold("Feature\n"));
|
|
1663
1666
|
printDetail("Key", data.key);
|
|
@@ -1692,7 +1695,7 @@ Examples:
|
|
|
1692
1695
|
`).action(async (key) => {
|
|
1693
1696
|
try {
|
|
1694
1697
|
const api = getApiClient();
|
|
1695
|
-
await api.post(`/features/${key}/enable`);
|
|
1698
|
+
await api.post(`/ai-features/${key}/enable`);
|
|
1696
1699
|
printSuccess(`Feature '${key}' enabled.`);
|
|
1697
1700
|
} catch (error) {
|
|
1698
1701
|
handleError(error);
|
|
@@ -1711,7 +1714,7 @@ Examples:
|
|
|
1711
1714
|
`).action(async (key) => {
|
|
1712
1715
|
try {
|
|
1713
1716
|
const api = getApiClient();
|
|
1714
|
-
await api.post(`/features/${key}/disable`);
|
|
1717
|
+
await api.post(`/ai-features/${key}/disable`);
|
|
1715
1718
|
printSuccess(`Feature '${key}' disabled.`);
|
|
1716
1719
|
} catch (error) {
|
|
1717
1720
|
handleError(error);
|
|
@@ -1749,10 +1752,10 @@ Examples:
|
|
|
1749
1752
|
const v = entry.slice(eqIndex + 1);
|
|
1750
1753
|
configValues[k] = v;
|
|
1751
1754
|
}
|
|
1752
|
-
await api.patch(`/features/${key}/config`, configValues);
|
|
1755
|
+
await api.patch(`/ai-features/${key}/config`, configValues);
|
|
1753
1756
|
printSuccess(`Feature '${key}' configuration updated.`);
|
|
1754
1757
|
} else {
|
|
1755
|
-
const { data } = await api.get(`/features/${key}`);
|
|
1758
|
+
const { data } = await api.get(`/ai-features/${key}`);
|
|
1756
1759
|
const featureConfig = data.config || {};
|
|
1757
1760
|
if (format === "table") {
|
|
1758
1761
|
console.log(chalk17.bold(`Feature '${key}' Configuration
|
|
@@ -2577,9 +2580,121 @@ function createLlmGatewayCommand() {
|
|
|
2577
2580
|
return llmGateway;
|
|
2578
2581
|
}
|
|
2579
2582
|
|
|
2583
|
+
// src/commands/init/index.ts
|
|
2584
|
+
import { Command as Command67 } from "commander";
|
|
2585
|
+
import { execSync } from "child_process";
|
|
2586
|
+
import { existsSync, cpSync, readFileSync, writeFileSync } from "fs";
|
|
2587
|
+
import { join, resolve } from "path";
|
|
2588
|
+
import chalk22 from "chalk";
|
|
2589
|
+
import ora2 from "ora";
|
|
2590
|
+
var TEMPLATE_REPO = "nebulaos/template";
|
|
2591
|
+
var TEMPLATE_REPO_URL = `https://github.com/${TEMPLATE_REPO}`;
|
|
2592
|
+
function createInitCommand() {
|
|
2593
|
+
const cmd = new Command67("init").description("Create a new NebulaOS project from template").argument("<name>", "Project name (will create a directory with this name)").option("-t, --template <template>", "Template to use", "default").option("--from <path>", "Use local template path instead of remote").option("--skip-install", "Skip installing dependencies").addHelpText(
|
|
2594
|
+
"after",
|
|
2595
|
+
`
|
|
2596
|
+
Examples:
|
|
2597
|
+
$ nebulaos init my-project Create a new project
|
|
2598
|
+
$ nebulaos init my-project --skip-install Create without installing deps
|
|
2599
|
+
|
|
2600
|
+
After creating your project:
|
|
2601
|
+
$ cd my-project
|
|
2602
|
+
$ cp .env.example .env
|
|
2603
|
+
$ # Edit .env with your API keys
|
|
2604
|
+
$ pnpm dev
|
|
2605
|
+
`
|
|
2606
|
+
).action(async (name, options) => {
|
|
2607
|
+
try {
|
|
2608
|
+
const targetDir = resolve(process.cwd(), name);
|
|
2609
|
+
if (existsSync(targetDir)) {
|
|
2610
|
+
throw new CLIError(
|
|
2611
|
+
`Directory '${name}' already exists. Choose a different name or delete the existing directory.`,
|
|
2612
|
+
6 /* ConflictError */
|
|
2613
|
+
);
|
|
2614
|
+
}
|
|
2615
|
+
console.log();
|
|
2616
|
+
console.log(chalk22.bold("Creating NebulaOS project..."));
|
|
2617
|
+
console.log();
|
|
2618
|
+
const spinner = ora2(options.from ? "Copying template..." : "Downloading template...").start();
|
|
2619
|
+
try {
|
|
2620
|
+
if (options.from) {
|
|
2621
|
+
const sourcePath = resolve(process.cwd(), options.from);
|
|
2622
|
+
if (!existsSync(sourcePath)) {
|
|
2623
|
+
throw new Error(`Template path not found: ${sourcePath}`);
|
|
2624
|
+
}
|
|
2625
|
+
cpSync(sourcePath, targetDir, { recursive: true });
|
|
2626
|
+
const gitDir = join(targetDir, ".git");
|
|
2627
|
+
if (existsSync(gitDir)) {
|
|
2628
|
+
execSync(`rm -rf "${gitDir}"`, { stdio: "pipe" });
|
|
2629
|
+
}
|
|
2630
|
+
} else {
|
|
2631
|
+
execSync(`npx degit ${TEMPLATE_REPO} ${name}`, {
|
|
2632
|
+
stdio: "pipe",
|
|
2633
|
+
cwd: process.cwd()
|
|
2634
|
+
});
|
|
2635
|
+
}
|
|
2636
|
+
spinner.succeed(options.from ? "Template copied" : "Template downloaded");
|
|
2637
|
+
} catch (error) {
|
|
2638
|
+
spinner.fail(options.from ? "Failed to copy template" : "Failed to download template");
|
|
2639
|
+
if (options.from) {
|
|
2640
|
+
throw new CLIError(
|
|
2641
|
+
`Failed to copy template from ${options.from}. Make sure the path exists.`,
|
|
2642
|
+
5 /* NotFound */
|
|
2643
|
+
);
|
|
2644
|
+
}
|
|
2645
|
+
throw new CLIError(
|
|
2646
|
+
`Failed to download template from ${TEMPLATE_REPO}. Make sure you have internet access.`,
|
|
2647
|
+
8 /* NetworkError */
|
|
2648
|
+
);
|
|
2649
|
+
}
|
|
2650
|
+
const packageJsonPath = join(targetDir, "package.json");
|
|
2651
|
+
if (existsSync(packageJsonPath)) {
|
|
2652
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
2653
|
+
packageJson.name = name;
|
|
2654
|
+
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n");
|
|
2655
|
+
}
|
|
2656
|
+
if (!options.skipInstall) {
|
|
2657
|
+
const installSpinner = ora2("Installing dependencies...").start();
|
|
2658
|
+
try {
|
|
2659
|
+
const usesPnpm = existsSync(join(targetDir, "pnpm-lock.yaml"));
|
|
2660
|
+
const usesYarn = existsSync(join(targetDir, "yarn.lock"));
|
|
2661
|
+
const pm = usesPnpm ? "pnpm" : usesYarn ? "yarn" : "npm";
|
|
2662
|
+
execSync(`${pm} install`, {
|
|
2663
|
+
stdio: "pipe",
|
|
2664
|
+
cwd: targetDir
|
|
2665
|
+
});
|
|
2666
|
+
installSpinner.succeed("Dependencies installed");
|
|
2667
|
+
} catch {
|
|
2668
|
+
installSpinner.warn("Failed to install dependencies. Run 'pnpm install' manually.");
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
console.log();
|
|
2672
|
+
console.log(chalk22.green("\u2713 Project created successfully!"));
|
|
2673
|
+
console.log();
|
|
2674
|
+
console.log("Next steps:");
|
|
2675
|
+
console.log();
|
|
2676
|
+
console.log(chalk22.cyan(` cd ${name}`));
|
|
2677
|
+
console.log(chalk22.cyan(" cp .env.example .env"));
|
|
2678
|
+
console.log(chalk22.dim(" # Edit .env with your API keys"));
|
|
2679
|
+
console.log(chalk22.cyan(" pnpm dev"));
|
|
2680
|
+
console.log();
|
|
2681
|
+
console.log("Get your API keys:");
|
|
2682
|
+
console.log(chalk22.dim(" nebulaos clients api-keys create <client-id>"));
|
|
2683
|
+
console.log(chalk22.dim(" nebulaos llm keys create --name my-key --type personal"));
|
|
2684
|
+
console.log();
|
|
2685
|
+
console.log("Documentation:");
|
|
2686
|
+
console.log(chalk22.dim(" https://docs.nebulaos.dev"));
|
|
2687
|
+
console.log();
|
|
2688
|
+
} catch (error) {
|
|
2689
|
+
handleError(error);
|
|
2690
|
+
}
|
|
2691
|
+
});
|
|
2692
|
+
return cmd;
|
|
2693
|
+
}
|
|
2694
|
+
|
|
2580
2695
|
// src/program.ts
|
|
2581
2696
|
function createProgram() {
|
|
2582
|
-
const program = new
|
|
2697
|
+
const program = new Command68();
|
|
2583
2698
|
program.name("nebulaos").description("NebulaOS CLI - Manage your AI agents, workflows, and resources").version("0.1.0").configureHelp({
|
|
2584
2699
|
sortSubcommands: true,
|
|
2585
2700
|
sortOptions: true
|
|
@@ -2595,6 +2710,7 @@ function createProgram() {
|
|
|
2595
2710
|
process.env.NEBULAOS_VERBOSE = "1";
|
|
2596
2711
|
}
|
|
2597
2712
|
});
|
|
2713
|
+
program.addCommand(createInitCommand());
|
|
2598
2714
|
program.addCommand(createAuthCommand());
|
|
2599
2715
|
program.addCommand(createOrgsCommand());
|
|
2600
2716
|
program.addCommand(createClientsCommand());
|