@deimoscloud/coreai 0.1.4 → 0.1.5
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/dist/cli/index.js +44 -27
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +23 -3
package/dist/cli/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/cli/index.ts
|
|
4
|
-
import { join as
|
|
5
|
-
import { fileURLToPath } from "url";
|
|
4
|
+
import { join as join13, dirname as dirname6 } from "path";
|
|
5
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
6
6
|
import { Command } from "commander";
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
9
|
-
import {
|
|
9
|
+
import { readFileSync as readFileSync6 } from "fs";
|
|
10
|
+
import { dirname as dirname5, join as join8 } from "path";
|
|
11
|
+
import { fileURLToPath } from "url";
|
|
10
12
|
|
|
11
13
|
// src/config/loader.ts
|
|
12
14
|
import { existsSync, readFileSync } from "fs";
|
|
@@ -2849,18 +2851,33 @@ function getKnowledgeLibraryState(options = {}) {
|
|
|
2849
2851
|
}
|
|
2850
2852
|
|
|
2851
2853
|
// src/index.ts
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
+
function findPackageJson() {
|
|
2855
|
+
let dir = dirname5(fileURLToPath(import.meta.url));
|
|
2856
|
+
while (dir !== dirname5(dir)) {
|
|
2857
|
+
const pkgPath = join8(dir, "package.json");
|
|
2858
|
+
try {
|
|
2859
|
+
const content = readFileSync6(pkgPath, "utf-8");
|
|
2860
|
+
const pkg = JSON.parse(content);
|
|
2861
|
+
if (pkg.name === "@deimoscloud/coreai") {
|
|
2862
|
+
return content;
|
|
2863
|
+
}
|
|
2864
|
+
} catch {
|
|
2865
|
+
}
|
|
2866
|
+
dir = dirname5(dir);
|
|
2867
|
+
}
|
|
2868
|
+
return '{"version": "unknown"}';
|
|
2869
|
+
}
|
|
2870
|
+
var packageJson = JSON.parse(findPackageJson());
|
|
2854
2871
|
var VERSION = packageJson.version;
|
|
2855
2872
|
|
|
2856
2873
|
// src/cli/commands/cache.ts
|
|
2857
|
-
import { join as
|
|
2874
|
+
import { join as join9 } from "path";
|
|
2858
2875
|
function getCachePath(options) {
|
|
2859
2876
|
if (options.cachePath) {
|
|
2860
2877
|
return options.cachePath;
|
|
2861
2878
|
}
|
|
2862
2879
|
const root = options.projectRoot ?? process.cwd();
|
|
2863
|
-
return
|
|
2880
|
+
return join9(root, CACHE_PATHS.base);
|
|
2864
2881
|
}
|
|
2865
2882
|
async function cacheStatus(options = {}) {
|
|
2866
2883
|
const cachePath = getCachePath(options);
|
|
@@ -2988,7 +3005,7 @@ function formatCacheStatus(result) {
|
|
|
2988
3005
|
}
|
|
2989
3006
|
|
|
2990
3007
|
// src/cli/commands/sync.ts
|
|
2991
|
-
import { join as
|
|
3008
|
+
import { join as join10 } from "path";
|
|
2992
3009
|
function createPlaceholderFetcher(source) {
|
|
2993
3010
|
return {
|
|
2994
3011
|
async fetch(url) {
|
|
@@ -3006,7 +3023,7 @@ function getCachePath2(options) {
|
|
|
3006
3023
|
return options.cachePath;
|
|
3007
3024
|
}
|
|
3008
3025
|
const root = options.projectRoot ?? process.cwd();
|
|
3009
|
-
return
|
|
3026
|
+
return join10(root, CACHE_PATHS.base);
|
|
3010
3027
|
}
|
|
3011
3028
|
async function sync(options = {}) {
|
|
3012
3029
|
const cachePath = getCachePath2(options);
|
|
@@ -3123,8 +3140,8 @@ function formatSyncResult(result) {
|
|
|
3123
3140
|
}
|
|
3124
3141
|
|
|
3125
3142
|
// src/cli/commands/init.ts
|
|
3126
|
-
import { existsSync as existsSync7, writeFileSync as writeFileSync4, mkdirSync as mkdirSync4, readFileSync as
|
|
3127
|
-
import { join as
|
|
3143
|
+
import { existsSync as existsSync7, writeFileSync as writeFileSync4, mkdirSync as mkdirSync4, readFileSync as readFileSync7 } from "fs";
|
|
3144
|
+
import { join as join11, basename as basename4 } from "path";
|
|
3128
3145
|
import { execSync } from "child_process";
|
|
3129
3146
|
function detectGitInfo() {
|
|
3130
3147
|
try {
|
|
@@ -3151,10 +3168,10 @@ function detectGitInfo() {
|
|
|
3151
3168
|
}
|
|
3152
3169
|
}
|
|
3153
3170
|
function detectProjectName(projectRoot) {
|
|
3154
|
-
const packageJsonPath =
|
|
3171
|
+
const packageJsonPath = join11(projectRoot, "package.json");
|
|
3155
3172
|
if (existsSync7(packageJsonPath)) {
|
|
3156
3173
|
try {
|
|
3157
|
-
const content = JSON.parse(
|
|
3174
|
+
const content = JSON.parse(readFileSync7(packageJsonPath, "utf-8"));
|
|
3158
3175
|
if (content.name) {
|
|
3159
3176
|
return content.name;
|
|
3160
3177
|
}
|
|
@@ -3212,9 +3229,9 @@ integrations:
|
|
|
3212
3229
|
}
|
|
3213
3230
|
function createDirectories(projectRoot) {
|
|
3214
3231
|
const dirs = [
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3232
|
+
join11(projectRoot, "coreai", "agents"),
|
|
3233
|
+
join11(projectRoot, "coreai", "commands"),
|
|
3234
|
+
join11(projectRoot, ".coreai", "cache")
|
|
3218
3235
|
];
|
|
3219
3236
|
const created = [];
|
|
3220
3237
|
for (const dir of dirs) {
|
|
@@ -3237,7 +3254,7 @@ function init(options = {}) {
|
|
|
3237
3254
|
const name = options.name ?? detectProjectName(projectRoot);
|
|
3238
3255
|
const type = options.type ?? "software";
|
|
3239
3256
|
const configContent = generateConfigYaml({ name, type, gitInfo });
|
|
3240
|
-
const configPath =
|
|
3257
|
+
const configPath = join11(projectRoot, "coreai.config.yaml");
|
|
3241
3258
|
try {
|
|
3242
3259
|
writeFileSync4(configPath, configContent, "utf-8");
|
|
3243
3260
|
} catch (error) {
|
|
@@ -3462,7 +3479,7 @@ function formatBuildResult(result) {
|
|
|
3462
3479
|
|
|
3463
3480
|
// src/cli/commands/validate.ts
|
|
3464
3481
|
import { existsSync as existsSync8 } from "fs";
|
|
3465
|
-
import { join as
|
|
3482
|
+
import { join as join12 } from "path";
|
|
3466
3483
|
function validateConfig2(projectRoot) {
|
|
3467
3484
|
const issues = [];
|
|
3468
3485
|
if (!configExists(projectRoot)) {
|
|
@@ -3497,7 +3514,7 @@ function validateConfig2(projectRoot) {
|
|
|
3497
3514
|
}
|
|
3498
3515
|
function validateAgents(config, coreAgentsDir, projectRoot) {
|
|
3499
3516
|
const issues = [];
|
|
3500
|
-
const customAgentsDir =
|
|
3517
|
+
const customAgentsDir = join12(projectRoot, "coreai", "agents");
|
|
3501
3518
|
let availableAgents;
|
|
3502
3519
|
try {
|
|
3503
3520
|
availableAgents = loadAllAgents({
|
|
@@ -3546,7 +3563,7 @@ function validateDirectories(projectRoot) {
|
|
|
3546
3563
|
{ path: ".claude/agents", description: "Compiled agents output" }
|
|
3547
3564
|
];
|
|
3548
3565
|
for (const dir of requiredDirs) {
|
|
3549
|
-
const fullPath =
|
|
3566
|
+
const fullPath = join12(projectRoot, dir.path);
|
|
3550
3567
|
if (!existsSync8(fullPath)) {
|
|
3551
3568
|
issues.push({
|
|
3552
3569
|
level: "warning",
|
|
@@ -3557,7 +3574,7 @@ function validateDirectories(projectRoot) {
|
|
|
3557
3574
|
}
|
|
3558
3575
|
}
|
|
3559
3576
|
for (const dir of optionalDirs) {
|
|
3560
|
-
const fullPath =
|
|
3577
|
+
const fullPath = join12(projectRoot, dir.path);
|
|
3561
3578
|
if (!existsSync8(fullPath)) {
|
|
3562
3579
|
issues.push({
|
|
3563
3580
|
level: "info",
|
|
@@ -3604,7 +3621,7 @@ function validateIntegrations(config) {
|
|
|
3604
3621
|
}
|
|
3605
3622
|
function validate(options = {}) {
|
|
3606
3623
|
const projectRoot = options.projectRoot ?? process.cwd();
|
|
3607
|
-
const coreAgentsDir = options.coreAgentsDir ??
|
|
3624
|
+
const coreAgentsDir = options.coreAgentsDir ?? join12(projectRoot, "node_modules", "@coreai", "cli", "agents");
|
|
3608
3625
|
const checkAgents = options.checkAgents ?? true;
|
|
3609
3626
|
const checkDirs = options.checkDirs ?? true;
|
|
3610
3627
|
const allIssues = [];
|
|
@@ -4000,10 +4017,10 @@ function formatStatusResult(result) {
|
|
|
4000
4017
|
}
|
|
4001
4018
|
|
|
4002
4019
|
// src/cli/index.ts
|
|
4003
|
-
var __filename =
|
|
4004
|
-
var __dirname =
|
|
4020
|
+
var __filename = fileURLToPath2(import.meta.url);
|
|
4021
|
+
var __dirname = dirname6(__filename);
|
|
4005
4022
|
function getCoreAgentsPath() {
|
|
4006
|
-
return
|
|
4023
|
+
return join13(__dirname, "..", "..", "agents");
|
|
4007
4024
|
}
|
|
4008
4025
|
var program = new Command();
|
|
4009
4026
|
program.name("coreai").description("A configurable, team-ready AI agent orchestration platform").version(VERSION, "-v, --version", "output the current version");
|
|
@@ -4082,7 +4099,7 @@ program.command("validate").description("Validate configuration and project setu
|
|
|
4082
4099
|
var agents = program.command("agents").description("Manage agent definitions");
|
|
4083
4100
|
agents.command("list").description("List available agents").option("--core", "show only core agents").option("--custom", "show only custom agents").action((options) => {
|
|
4084
4101
|
try {
|
|
4085
|
-
const customAgentsDir =
|
|
4102
|
+
const customAgentsDir = join13(process.cwd(), "coreai", "agents");
|
|
4086
4103
|
const allAgents = loadAllAgents({
|
|
4087
4104
|
coreAgentsDir: getCoreAgentsPath(),
|
|
4088
4105
|
customAgentsDir
|
|
@@ -4136,7 +4153,7 @@ agents.command("list").description("List available agents").option("--core", "sh
|
|
|
4136
4153
|
});
|
|
4137
4154
|
agents.command("show <name>").description("Show details for a specific agent").option("--markdown", "output as compiled markdown").option("--json", "output as JSON").action((name, options) => {
|
|
4138
4155
|
try {
|
|
4139
|
-
const customAgentsDir =
|
|
4156
|
+
const customAgentsDir = join13(process.cwd(), "coreai", "agents");
|
|
4140
4157
|
const allAgents = loadAllAgents({
|
|
4141
4158
|
coreAgentsDir: getCoreAgentsPath(),
|
|
4142
4159
|
customAgentsDir
|