@deimoscloud/coreai 0.1.3 → 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 +47 -25
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +25 -1
package/dist/cli/index.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
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
|
+
// src/index.ts
|
|
9
|
+
import { readFileSync as readFileSync6 } from "fs";
|
|
10
|
+
import { dirname as dirname5, join as join8 } from "path";
|
|
11
|
+
import { fileURLToPath } from "url";
|
|
12
|
+
|
|
8
13
|
// src/config/loader.ts
|
|
9
14
|
import { existsSync, readFileSync } from "fs";
|
|
10
15
|
import { dirname, join, resolve } from "path";
|
|
@@ -2846,16 +2851,33 @@ function getKnowledgeLibraryState(options = {}) {
|
|
|
2846
2851
|
}
|
|
2847
2852
|
|
|
2848
2853
|
// src/index.ts
|
|
2849
|
-
|
|
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());
|
|
2871
|
+
var VERSION = packageJson.version;
|
|
2850
2872
|
|
|
2851
2873
|
// src/cli/commands/cache.ts
|
|
2852
|
-
import { join as
|
|
2874
|
+
import { join as join9 } from "path";
|
|
2853
2875
|
function getCachePath(options) {
|
|
2854
2876
|
if (options.cachePath) {
|
|
2855
2877
|
return options.cachePath;
|
|
2856
2878
|
}
|
|
2857
2879
|
const root = options.projectRoot ?? process.cwd();
|
|
2858
|
-
return
|
|
2880
|
+
return join9(root, CACHE_PATHS.base);
|
|
2859
2881
|
}
|
|
2860
2882
|
async function cacheStatus(options = {}) {
|
|
2861
2883
|
const cachePath = getCachePath(options);
|
|
@@ -2983,7 +3005,7 @@ function formatCacheStatus(result) {
|
|
|
2983
3005
|
}
|
|
2984
3006
|
|
|
2985
3007
|
// src/cli/commands/sync.ts
|
|
2986
|
-
import { join as
|
|
3008
|
+
import { join as join10 } from "path";
|
|
2987
3009
|
function createPlaceholderFetcher(source) {
|
|
2988
3010
|
return {
|
|
2989
3011
|
async fetch(url) {
|
|
@@ -3001,7 +3023,7 @@ function getCachePath2(options) {
|
|
|
3001
3023
|
return options.cachePath;
|
|
3002
3024
|
}
|
|
3003
3025
|
const root = options.projectRoot ?? process.cwd();
|
|
3004
|
-
return
|
|
3026
|
+
return join10(root, CACHE_PATHS.base);
|
|
3005
3027
|
}
|
|
3006
3028
|
async function sync(options = {}) {
|
|
3007
3029
|
const cachePath = getCachePath2(options);
|
|
@@ -3118,8 +3140,8 @@ function formatSyncResult(result) {
|
|
|
3118
3140
|
}
|
|
3119
3141
|
|
|
3120
3142
|
// src/cli/commands/init.ts
|
|
3121
|
-
import { existsSync as existsSync7, writeFileSync as writeFileSync4, mkdirSync as mkdirSync4, readFileSync as
|
|
3122
|
-
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";
|
|
3123
3145
|
import { execSync } from "child_process";
|
|
3124
3146
|
function detectGitInfo() {
|
|
3125
3147
|
try {
|
|
@@ -3146,10 +3168,10 @@ function detectGitInfo() {
|
|
|
3146
3168
|
}
|
|
3147
3169
|
}
|
|
3148
3170
|
function detectProjectName(projectRoot) {
|
|
3149
|
-
const packageJsonPath =
|
|
3171
|
+
const packageJsonPath = join11(projectRoot, "package.json");
|
|
3150
3172
|
if (existsSync7(packageJsonPath)) {
|
|
3151
3173
|
try {
|
|
3152
|
-
const content = JSON.parse(
|
|
3174
|
+
const content = JSON.parse(readFileSync7(packageJsonPath, "utf-8"));
|
|
3153
3175
|
if (content.name) {
|
|
3154
3176
|
return content.name;
|
|
3155
3177
|
}
|
|
@@ -3207,9 +3229,9 @@ integrations:
|
|
|
3207
3229
|
}
|
|
3208
3230
|
function createDirectories(projectRoot) {
|
|
3209
3231
|
const dirs = [
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3232
|
+
join11(projectRoot, "coreai", "agents"),
|
|
3233
|
+
join11(projectRoot, "coreai", "commands"),
|
|
3234
|
+
join11(projectRoot, ".coreai", "cache")
|
|
3213
3235
|
];
|
|
3214
3236
|
const created = [];
|
|
3215
3237
|
for (const dir of dirs) {
|
|
@@ -3232,7 +3254,7 @@ function init(options = {}) {
|
|
|
3232
3254
|
const name = options.name ?? detectProjectName(projectRoot);
|
|
3233
3255
|
const type = options.type ?? "software";
|
|
3234
3256
|
const configContent = generateConfigYaml({ name, type, gitInfo });
|
|
3235
|
-
const configPath =
|
|
3257
|
+
const configPath = join11(projectRoot, "coreai.config.yaml");
|
|
3236
3258
|
try {
|
|
3237
3259
|
writeFileSync4(configPath, configContent, "utf-8");
|
|
3238
3260
|
} catch (error) {
|
|
@@ -3457,7 +3479,7 @@ function formatBuildResult(result) {
|
|
|
3457
3479
|
|
|
3458
3480
|
// src/cli/commands/validate.ts
|
|
3459
3481
|
import { existsSync as existsSync8 } from "fs";
|
|
3460
|
-
import { join as
|
|
3482
|
+
import { join as join12 } from "path";
|
|
3461
3483
|
function validateConfig2(projectRoot) {
|
|
3462
3484
|
const issues = [];
|
|
3463
3485
|
if (!configExists(projectRoot)) {
|
|
@@ -3492,7 +3514,7 @@ function validateConfig2(projectRoot) {
|
|
|
3492
3514
|
}
|
|
3493
3515
|
function validateAgents(config, coreAgentsDir, projectRoot) {
|
|
3494
3516
|
const issues = [];
|
|
3495
|
-
const customAgentsDir =
|
|
3517
|
+
const customAgentsDir = join12(projectRoot, "coreai", "agents");
|
|
3496
3518
|
let availableAgents;
|
|
3497
3519
|
try {
|
|
3498
3520
|
availableAgents = loadAllAgents({
|
|
@@ -3541,7 +3563,7 @@ function validateDirectories(projectRoot) {
|
|
|
3541
3563
|
{ path: ".claude/agents", description: "Compiled agents output" }
|
|
3542
3564
|
];
|
|
3543
3565
|
for (const dir of requiredDirs) {
|
|
3544
|
-
const fullPath =
|
|
3566
|
+
const fullPath = join12(projectRoot, dir.path);
|
|
3545
3567
|
if (!existsSync8(fullPath)) {
|
|
3546
3568
|
issues.push({
|
|
3547
3569
|
level: "warning",
|
|
@@ -3552,7 +3574,7 @@ function validateDirectories(projectRoot) {
|
|
|
3552
3574
|
}
|
|
3553
3575
|
}
|
|
3554
3576
|
for (const dir of optionalDirs) {
|
|
3555
|
-
const fullPath =
|
|
3577
|
+
const fullPath = join12(projectRoot, dir.path);
|
|
3556
3578
|
if (!existsSync8(fullPath)) {
|
|
3557
3579
|
issues.push({
|
|
3558
3580
|
level: "info",
|
|
@@ -3599,7 +3621,7 @@ function validateIntegrations(config) {
|
|
|
3599
3621
|
}
|
|
3600
3622
|
function validate(options = {}) {
|
|
3601
3623
|
const projectRoot = options.projectRoot ?? process.cwd();
|
|
3602
|
-
const coreAgentsDir = options.coreAgentsDir ??
|
|
3624
|
+
const coreAgentsDir = options.coreAgentsDir ?? join12(projectRoot, "node_modules", "@coreai", "cli", "agents");
|
|
3603
3625
|
const checkAgents = options.checkAgents ?? true;
|
|
3604
3626
|
const checkDirs = options.checkDirs ?? true;
|
|
3605
3627
|
const allIssues = [];
|
|
@@ -3995,10 +4017,10 @@ function formatStatusResult(result) {
|
|
|
3995
4017
|
}
|
|
3996
4018
|
|
|
3997
4019
|
// src/cli/index.ts
|
|
3998
|
-
var __filename =
|
|
3999
|
-
var __dirname =
|
|
4020
|
+
var __filename = fileURLToPath2(import.meta.url);
|
|
4021
|
+
var __dirname = dirname6(__filename);
|
|
4000
4022
|
function getCoreAgentsPath() {
|
|
4001
|
-
return
|
|
4023
|
+
return join13(__dirname, "..", "..", "agents");
|
|
4002
4024
|
}
|
|
4003
4025
|
var program = new Command();
|
|
4004
4026
|
program.name("coreai").description("A configurable, team-ready AI agent orchestration platform").version(VERSION, "-v, --version", "output the current version");
|
|
@@ -4077,7 +4099,7 @@ program.command("validate").description("Validate configuration and project setu
|
|
|
4077
4099
|
var agents = program.command("agents").description("Manage agent definitions");
|
|
4078
4100
|
agents.command("list").description("List available agents").option("--core", "show only core agents").option("--custom", "show only custom agents").action((options) => {
|
|
4079
4101
|
try {
|
|
4080
|
-
const customAgentsDir =
|
|
4102
|
+
const customAgentsDir = join13(process.cwd(), "coreai", "agents");
|
|
4081
4103
|
const allAgents = loadAllAgents({
|
|
4082
4104
|
coreAgentsDir: getCoreAgentsPath(),
|
|
4083
4105
|
customAgentsDir
|
|
@@ -4131,7 +4153,7 @@ agents.command("list").description("List available agents").option("--core", "sh
|
|
|
4131
4153
|
});
|
|
4132
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) => {
|
|
4133
4155
|
try {
|
|
4134
|
-
const customAgentsDir =
|
|
4156
|
+
const customAgentsDir = join13(process.cwd(), "coreai", "agents");
|
|
4135
4157
|
const allAgents = loadAllAgents({
|
|
4136
4158
|
coreAgentsDir: getCoreAgentsPath(),
|
|
4137
4159
|
customAgentsDir
|