@deimoscloud/coreai 0.1.0 → 0.1.1
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/README.md +228 -26
- package/dist/cli/index.js +362 -108
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +23 -2
- package/dist/index.js +23 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/agents/compiler.ts +61 -4
- package/src/agents/index.ts +1 -0
- package/src/agents/types.ts +10 -0
- package/src/cli/commands/build.ts +40 -0
package/dist/cli/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/cli/index.ts
|
|
4
|
-
import { join as
|
|
4
|
+
import { join as join12, dirname as dirname5 } from "path";
|
|
5
5
|
import { fileURLToPath } from "url";
|
|
6
6
|
import { Command } from "commander";
|
|
7
7
|
|
|
@@ -129,6 +129,9 @@ function configExists(startDir) {
|
|
|
129
129
|
return findConfigFile(startDir) !== null;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
// src/agents/types.ts
|
|
133
|
+
var DEFAULT_AGENT_TOOLS = ["Read", "Write", "Edit", "Bash", "Glob", "Grep"];
|
|
134
|
+
|
|
132
135
|
// src/agents/loader.ts
|
|
133
136
|
import { existsSync as existsSync2, readdirSync, readFileSync as readFileSync2 } from "fs";
|
|
134
137
|
import { basename, extname, join as join2 } from "path";
|
|
@@ -357,8 +360,24 @@ function resolveAgentDefinition(agent, config, options = {}) {
|
|
|
357
360
|
// src/agents/compiler.ts
|
|
358
361
|
import { existsSync as existsSync3, mkdirSync, writeFileSync } from "fs";
|
|
359
362
|
import { join as join3, dirname as dirname2 } from "path";
|
|
360
|
-
function
|
|
363
|
+
function buildAgentTools(agent, mcpServers) {
|
|
364
|
+
const tools = agent.tools ? [...agent.tools] : [...DEFAULT_AGENT_TOOLS];
|
|
365
|
+
if (mcpServers && mcpServers.length > 0) {
|
|
366
|
+
for (const server of mcpServers) {
|
|
367
|
+
tools.push(`mcp__${server}`);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return tools.join(", ");
|
|
371
|
+
}
|
|
372
|
+
function generateAgentMarkdown(agent, mcpServers) {
|
|
361
373
|
const lines = [];
|
|
374
|
+
const tools = buildAgentTools(agent, mcpServers);
|
|
375
|
+
lines.push("---");
|
|
376
|
+
lines.push(`name: ${agent.role}`);
|
|
377
|
+
lines.push(`description: ${agent.description.replace(/\n/g, " ").trim()}`);
|
|
378
|
+
lines.push(`tools: ${tools}`);
|
|
379
|
+
lines.push("---");
|
|
380
|
+
lines.push("");
|
|
362
381
|
lines.push(`# ${agent.display_name}`);
|
|
363
382
|
lines.push("");
|
|
364
383
|
lines.push(`**Role:** ${agent.role}`);
|
|
@@ -485,9 +504,9 @@ function generateAgentMarkdown(agent) {
|
|
|
485
504
|
function formatTitle(str) {
|
|
486
505
|
return str.replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
487
506
|
}
|
|
488
|
-
function compileAgent(agent, config) {
|
|
507
|
+
function compileAgent(agent, config, mcpServers) {
|
|
489
508
|
const resolved = resolveAgentDefinition(agent, config);
|
|
490
|
-
return generateAgentMarkdown(resolved);
|
|
509
|
+
return generateAgentMarkdown(resolved, mcpServers);
|
|
491
510
|
}
|
|
492
511
|
function loadAllAgents(options = {}) {
|
|
493
512
|
const agents2 = /* @__PURE__ */ new Map();
|
|
@@ -542,7 +561,7 @@ function compileAgents(config, options = {}) {
|
|
|
542
561
|
continue;
|
|
543
562
|
}
|
|
544
563
|
try {
|
|
545
|
-
const markdown = compileAgent(metadata.definition, config);
|
|
564
|
+
const markdown = compileAgent(metadata.definition, config, options.mcpServers);
|
|
546
565
|
const outputPath = join3(outputDir, `${role}.md`);
|
|
547
566
|
writeFileSync(outputPath, markdown, "utf-8");
|
|
548
567
|
result.compiled.push({
|
|
@@ -561,10 +580,222 @@ function compileAgents(config, options = {}) {
|
|
|
561
580
|
return result;
|
|
562
581
|
}
|
|
563
582
|
|
|
583
|
+
// src/adapters/mcp/types.ts
|
|
584
|
+
var McpError = class extends Error {
|
|
585
|
+
constructor(message, code, server, cause) {
|
|
586
|
+
super(message, { cause });
|
|
587
|
+
this.code = code;
|
|
588
|
+
this.server = server;
|
|
589
|
+
this.name = "McpError";
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
|
|
564
593
|
// src/adapters/mcp/client.ts
|
|
565
594
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
566
595
|
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
567
596
|
|
|
597
|
+
// src/adapters/mcp/discovery.ts
|
|
598
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3 } from "fs";
|
|
599
|
+
import { join as join4, dirname as dirname3 } from "path";
|
|
600
|
+
import { homedir } from "os";
|
|
601
|
+
var CONFIG_FILENAMES = ["mcp.json", ".mcp.json", "claude_desktop_config.json"];
|
|
602
|
+
var PROJECT_CONFIG_DIRS = [".claude", ".config", ""];
|
|
603
|
+
function discoverMcpServers(options = {}) {
|
|
604
|
+
const projectRoot = options.projectRoot ?? process.cwd();
|
|
605
|
+
const includeGlobal = options.includeGlobal ?? true;
|
|
606
|
+
const additionalPaths = options.additionalPaths ?? [];
|
|
607
|
+
const servers = [];
|
|
608
|
+
const seenServers = /* @__PURE__ */ new Set();
|
|
609
|
+
const configPaths = [];
|
|
610
|
+
for (const dir of PROJECT_CONFIG_DIRS) {
|
|
611
|
+
for (const filename of CONFIG_FILENAMES) {
|
|
612
|
+
const path = dir ? join4(projectRoot, dir, filename) : join4(projectRoot, filename);
|
|
613
|
+
configPaths.push(path);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
configPaths.push(...additionalPaths);
|
|
617
|
+
if (includeGlobal) {
|
|
618
|
+
const homeDir = homedir();
|
|
619
|
+
const globalPaths = [
|
|
620
|
+
join4(homeDir, ".config", "claude", "mcp.json"),
|
|
621
|
+
join4(homeDir, ".claude", "mcp.json"),
|
|
622
|
+
join4(homeDir, "Library", "Application Support", "Claude", "claude_desktop_config.json")
|
|
623
|
+
];
|
|
624
|
+
configPaths.push(...globalPaths);
|
|
625
|
+
}
|
|
626
|
+
for (const configPath of configPaths) {
|
|
627
|
+
if (!existsSync4(configPath)) continue;
|
|
628
|
+
try {
|
|
629
|
+
const fileServers = loadServersFromFile(configPath);
|
|
630
|
+
for (const server of fileServers) {
|
|
631
|
+
if (seenServers.has(server.name)) continue;
|
|
632
|
+
seenServers.add(server.name);
|
|
633
|
+
servers.push(server);
|
|
634
|
+
}
|
|
635
|
+
} catch (error) {
|
|
636
|
+
console.warn(
|
|
637
|
+
`Warning: Failed to load MCP config from ${configPath}: ${error instanceof Error ? error.message : String(error)}`
|
|
638
|
+
);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
return servers;
|
|
642
|
+
}
|
|
643
|
+
function loadServersFromFile(filePath) {
|
|
644
|
+
if (!existsSync4(filePath)) {
|
|
645
|
+
throw new McpError(`Config file not found: ${filePath}`, "invalid_config");
|
|
646
|
+
}
|
|
647
|
+
const content = readFileSync3(filePath, "utf-8");
|
|
648
|
+
let config;
|
|
649
|
+
try {
|
|
650
|
+
config = JSON.parse(content);
|
|
651
|
+
} catch (error) {
|
|
652
|
+
throw new McpError(
|
|
653
|
+
`Invalid JSON in config file ${filePath}: ${error instanceof Error ? error.message : String(error)}`,
|
|
654
|
+
"invalid_config",
|
|
655
|
+
void 0,
|
|
656
|
+
error instanceof Error ? error : void 0
|
|
657
|
+
);
|
|
658
|
+
}
|
|
659
|
+
return parseServersFromConfig(config, filePath);
|
|
660
|
+
}
|
|
661
|
+
function parseServersFromConfig(config, sourcePath) {
|
|
662
|
+
const servers = [];
|
|
663
|
+
if (!config.mcpServers) {
|
|
664
|
+
return servers;
|
|
665
|
+
}
|
|
666
|
+
for (const [name, serverConfig] of Object.entries(config.mcpServers)) {
|
|
667
|
+
try {
|
|
668
|
+
const validConfig = validateServerConfig(serverConfig, name);
|
|
669
|
+
if (validConfig.transport === "stdio" && sourcePath) {
|
|
670
|
+
validConfig.cwd = validConfig.cwd ?? dirname3(sourcePath);
|
|
671
|
+
}
|
|
672
|
+
servers.push({
|
|
673
|
+
name,
|
|
674
|
+
config: validConfig,
|
|
675
|
+
enabled: true
|
|
676
|
+
});
|
|
677
|
+
} catch (error) {
|
|
678
|
+
console.warn(
|
|
679
|
+
`Warning: Invalid server config for "${name}": ${error instanceof Error ? error.message : String(error)}`
|
|
680
|
+
);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
return servers;
|
|
684
|
+
}
|
|
685
|
+
function validateServerConfig(config, serverName) {
|
|
686
|
+
if (!config || typeof config !== "object") {
|
|
687
|
+
throw new McpError(
|
|
688
|
+
`Server config for "${serverName}" must be an object`,
|
|
689
|
+
"invalid_config",
|
|
690
|
+
serverName
|
|
691
|
+
);
|
|
692
|
+
}
|
|
693
|
+
const cfg = config;
|
|
694
|
+
if ("command" in cfg && typeof cfg.command === "string") {
|
|
695
|
+
return validateStdioConfig(cfg, serverName);
|
|
696
|
+
}
|
|
697
|
+
if ("url" in cfg && typeof cfg.url === "string") {
|
|
698
|
+
return validateHttpConfig(cfg, serverName);
|
|
699
|
+
}
|
|
700
|
+
if ("transport" in cfg) {
|
|
701
|
+
const transport = cfg.transport;
|
|
702
|
+
if (transport === "stdio") {
|
|
703
|
+
return validateStdioConfig(cfg, serverName);
|
|
704
|
+
}
|
|
705
|
+
if (transport === "http" || transport === "sse") {
|
|
706
|
+
return validateHttpConfig(cfg, serverName);
|
|
707
|
+
}
|
|
708
|
+
throw new McpError(
|
|
709
|
+
`Unknown transport type "${transport}" for server "${serverName}"`,
|
|
710
|
+
"invalid_config",
|
|
711
|
+
serverName
|
|
712
|
+
);
|
|
713
|
+
}
|
|
714
|
+
throw new McpError(
|
|
715
|
+
`Server config for "${serverName}" must have either 'command' (stdio) or 'url' (http)`,
|
|
716
|
+
"invalid_config",
|
|
717
|
+
serverName
|
|
718
|
+
);
|
|
719
|
+
}
|
|
720
|
+
function validateStdioConfig(cfg, serverName) {
|
|
721
|
+
if (!cfg.command || typeof cfg.command !== "string") {
|
|
722
|
+
throw new McpError(
|
|
723
|
+
`Server "${serverName}" requires a 'command' string`,
|
|
724
|
+
"invalid_config",
|
|
725
|
+
serverName
|
|
726
|
+
);
|
|
727
|
+
}
|
|
728
|
+
const config = {
|
|
729
|
+
transport: "stdio",
|
|
730
|
+
command: cfg.command
|
|
731
|
+
};
|
|
732
|
+
if (cfg.args !== void 0) {
|
|
733
|
+
if (!Array.isArray(cfg.args) || !cfg.args.every((a) => typeof a === "string")) {
|
|
734
|
+
throw new McpError(
|
|
735
|
+
`Server "${serverName}" 'args' must be an array of strings`,
|
|
736
|
+
"invalid_config",
|
|
737
|
+
serverName
|
|
738
|
+
);
|
|
739
|
+
}
|
|
740
|
+
config.args = cfg.args;
|
|
741
|
+
}
|
|
742
|
+
if (cfg.env !== void 0) {
|
|
743
|
+
if (typeof cfg.env !== "object" || cfg.env === null) {
|
|
744
|
+
throw new McpError(
|
|
745
|
+
`Server "${serverName}" 'env' must be an object`,
|
|
746
|
+
"invalid_config",
|
|
747
|
+
serverName
|
|
748
|
+
);
|
|
749
|
+
}
|
|
750
|
+
config.env = cfg.env;
|
|
751
|
+
}
|
|
752
|
+
if (cfg.cwd !== void 0) {
|
|
753
|
+
if (typeof cfg.cwd !== "string") {
|
|
754
|
+
throw new McpError(
|
|
755
|
+
`Server "${serverName}" 'cwd' must be a string`,
|
|
756
|
+
"invalid_config",
|
|
757
|
+
serverName
|
|
758
|
+
);
|
|
759
|
+
}
|
|
760
|
+
config.cwd = cfg.cwd;
|
|
761
|
+
}
|
|
762
|
+
return config;
|
|
763
|
+
}
|
|
764
|
+
function validateHttpConfig(cfg, serverName) {
|
|
765
|
+
if (!cfg.url || typeof cfg.url !== "string") {
|
|
766
|
+
throw new McpError(
|
|
767
|
+
`Server "${serverName}" requires a 'url' string`,
|
|
768
|
+
"invalid_config",
|
|
769
|
+
serverName
|
|
770
|
+
);
|
|
771
|
+
}
|
|
772
|
+
try {
|
|
773
|
+
new URL(cfg.url);
|
|
774
|
+
} catch {
|
|
775
|
+
throw new McpError(
|
|
776
|
+
`Server "${serverName}" has invalid URL: ${cfg.url}`,
|
|
777
|
+
"invalid_config",
|
|
778
|
+
serverName
|
|
779
|
+
);
|
|
780
|
+
}
|
|
781
|
+
const transport = cfg.transport === "sse" ? "sse" : "http";
|
|
782
|
+
const config = {
|
|
783
|
+
transport,
|
|
784
|
+
url: cfg.url
|
|
785
|
+
};
|
|
786
|
+
if (cfg.headers !== void 0) {
|
|
787
|
+
if (typeof cfg.headers !== "object" || cfg.headers === null) {
|
|
788
|
+
throw new McpError(
|
|
789
|
+
`Server "${serverName}" 'headers' must be an object`,
|
|
790
|
+
"invalid_config",
|
|
791
|
+
serverName
|
|
792
|
+
);
|
|
793
|
+
}
|
|
794
|
+
config.headers = cfg.headers;
|
|
795
|
+
}
|
|
796
|
+
return config;
|
|
797
|
+
}
|
|
798
|
+
|
|
568
799
|
// src/adapters/native/github.ts
|
|
569
800
|
import { execFile } from "child_process";
|
|
570
801
|
import { promisify } from "util";
|
|
@@ -627,7 +858,7 @@ var DEFAULT_CACHE_CONFIG = {
|
|
|
627
858
|
|
|
628
859
|
// src/cache/provider.ts
|
|
629
860
|
import { promises as fs } from "fs";
|
|
630
|
-
import { join as
|
|
861
|
+
import { join as join5, dirname as dirname4 } from "path";
|
|
631
862
|
import { createHash } from "crypto";
|
|
632
863
|
function noop() {
|
|
633
864
|
}
|
|
@@ -645,10 +876,10 @@ var FileCacheProvider = class {
|
|
|
645
876
|
index = null;
|
|
646
877
|
constructor(options) {
|
|
647
878
|
this.basePath = options.basePath;
|
|
648
|
-
this.cachePath =
|
|
649
|
-
this.contentPath =
|
|
650
|
-
this.metadataPath =
|
|
651
|
-
this.indexPath =
|
|
879
|
+
this.cachePath = join5(this.basePath, CACHE_PATHS.ROOT);
|
|
880
|
+
this.contentPath = join5(this.basePath, CACHE_PATHS.CONTENT);
|
|
881
|
+
this.metadataPath = join5(this.basePath, CACHE_PATHS.METADATA);
|
|
882
|
+
this.indexPath = join5(this.basePath, CACHE_PATHS.INDEX);
|
|
652
883
|
this.ttl = options.ttl ?? DEFAULT_CACHE_CONFIG.ttl;
|
|
653
884
|
this.maxSize = options.maxSize ?? DEFAULT_CACHE_CONFIG.maxSize;
|
|
654
885
|
this.maxEntries = options.maxEntries ?? DEFAULT_CACHE_CONFIG.maxEntries;
|
|
@@ -732,8 +963,8 @@ var FileCacheProvider = class {
|
|
|
732
963
|
const contentHash = this.hashContent(contentStr);
|
|
733
964
|
const size = Buffer.byteLength(contentStr, "utf-8");
|
|
734
965
|
const safeKey = this.sanitizeKey(key);
|
|
735
|
-
const contentFile =
|
|
736
|
-
const metadataFile =
|
|
966
|
+
const contentFile = join5(this.contentPath, `${safeKey}.cache`);
|
|
967
|
+
const metadataFile = join5(this.metadataPath, `${safeKey}.json`);
|
|
737
968
|
const fullMetadata = {
|
|
738
969
|
key,
|
|
739
970
|
source: metadata.source ?? "custom",
|
|
@@ -758,8 +989,8 @@ var FileCacheProvider = class {
|
|
|
758
989
|
fullMetadata.tags = tags;
|
|
759
990
|
}
|
|
760
991
|
try {
|
|
761
|
-
await fs.mkdir(
|
|
762
|
-
await fs.mkdir(
|
|
992
|
+
await fs.mkdir(dirname4(contentFile), { recursive: true });
|
|
993
|
+
await fs.mkdir(dirname4(metadataFile), { recursive: true });
|
|
763
994
|
await fs.writeFile(contentFile, contentStr, "utf-8");
|
|
764
995
|
await fs.writeFile(metadataFile, JSON.stringify(fullMetadata, null, 2), "utf-8");
|
|
765
996
|
if (this.index) {
|
|
@@ -1088,11 +1319,11 @@ var FileCacheProvider = class {
|
|
|
1088
1319
|
for (const file of metadataFiles) {
|
|
1089
1320
|
if (!file.endsWith(".json")) continue;
|
|
1090
1321
|
try {
|
|
1091
|
-
const metadataPath =
|
|
1322
|
+
const metadataPath = join5(this.metadataPath, file);
|
|
1092
1323
|
const content = await fs.readFile(metadataPath, "utf-8");
|
|
1093
1324
|
const metadata = JSON.parse(content);
|
|
1094
1325
|
const safeKey = this.sanitizeKey(metadata.key);
|
|
1095
|
-
const contentFile =
|
|
1326
|
+
const contentFile = join5(this.contentPath, `${safeKey}.cache`);
|
|
1096
1327
|
await fs.access(contentFile);
|
|
1097
1328
|
index.entries[metadata.key] = {
|
|
1098
1329
|
key: metadata.key,
|
|
@@ -1400,8 +1631,8 @@ var CacheManager = class {
|
|
|
1400
1631
|
};
|
|
1401
1632
|
|
|
1402
1633
|
// src/skills/generator.ts
|
|
1403
|
-
import { existsSync as
|
|
1404
|
-
import { join as
|
|
1634
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync2, writeFileSync as writeFileSync2, readFileSync as readFileSync4, readdirSync as readdirSync2, statSync } from "fs";
|
|
1635
|
+
import { join as join6, basename as basename2 } from "path";
|
|
1405
1636
|
|
|
1406
1637
|
// src/skills/templates.ts
|
|
1407
1638
|
var checkInboxSkill = {
|
|
@@ -1975,17 +2206,17 @@ function checkDependencies(skill, config) {
|
|
|
1975
2206
|
}
|
|
1976
2207
|
function loadCustomTemplates(templatesDir) {
|
|
1977
2208
|
const templates = [];
|
|
1978
|
-
if (!
|
|
2209
|
+
if (!existsSync5(templatesDir)) {
|
|
1979
2210
|
return templates;
|
|
1980
2211
|
}
|
|
1981
2212
|
const files = readdirSync2(templatesDir);
|
|
1982
2213
|
for (const file of files) {
|
|
1983
2214
|
if (!file.endsWith(".md")) continue;
|
|
1984
|
-
const filePath =
|
|
2215
|
+
const filePath = join6(templatesDir, file);
|
|
1985
2216
|
const stat = statSync(filePath);
|
|
1986
2217
|
if (!stat.isFile()) continue;
|
|
1987
2218
|
try {
|
|
1988
|
-
const content =
|
|
2219
|
+
const content = readFileSync4(filePath, "utf-8");
|
|
1989
2220
|
const template = parseSkillTemplate(file, content);
|
|
1990
2221
|
templates.push(template);
|
|
1991
2222
|
} catch {
|
|
@@ -2075,7 +2306,7 @@ function mapIntegrationName(name) {
|
|
|
2075
2306
|
}
|
|
2076
2307
|
function generateSkills(config, options = {}) {
|
|
2077
2308
|
const projectRoot = options.projectRoot ?? process.cwd();
|
|
2078
|
-
const outputDir = options.outputDir ??
|
|
2309
|
+
const outputDir = options.outputDir ?? join6(projectRoot, ".claude", "commands");
|
|
2079
2310
|
const includeCoreSkills = options.includeCoreSkills ?? true;
|
|
2080
2311
|
const includeOptionalSkills = options.includeOptionalSkills ?? true;
|
|
2081
2312
|
const overwrite = options.overwrite ?? false;
|
|
@@ -2096,14 +2327,14 @@ function generateSkills(config, options = {}) {
|
|
|
2096
2327
|
if (includeOptionalSkills) {
|
|
2097
2328
|
templates.push(...builtInSkills.filter((s) => s.category === "optional"));
|
|
2098
2329
|
}
|
|
2099
|
-
if (options.customTemplatesDir &&
|
|
2330
|
+
if (options.customTemplatesDir && existsSync5(options.customTemplatesDir)) {
|
|
2100
2331
|
templates.push(...loadCustomTemplates(options.customTemplatesDir));
|
|
2101
2332
|
}
|
|
2102
2333
|
if (options.skills && options.skills.length > 0) {
|
|
2103
2334
|
const skillsToInclude = options.skills;
|
|
2104
2335
|
templates = templates.filter((t) => skillsToInclude.includes(t.name));
|
|
2105
2336
|
}
|
|
2106
|
-
if (!
|
|
2337
|
+
if (!existsSync5(outputDir)) {
|
|
2107
2338
|
mkdirSync2(outputDir, { recursive: true });
|
|
2108
2339
|
}
|
|
2109
2340
|
for (const template of templates) {
|
|
@@ -2120,8 +2351,8 @@ function generateSkills(config, options = {}) {
|
|
|
2120
2351
|
return result;
|
|
2121
2352
|
}
|
|
2122
2353
|
function generateSkill(template, variables, config, outputDir, overwrite) {
|
|
2123
|
-
const outputPath =
|
|
2124
|
-
if (
|
|
2354
|
+
const outputPath = join6(outputDir, `${template.name}.md`);
|
|
2355
|
+
if (existsSync5(outputPath) && !overwrite) {
|
|
2125
2356
|
return {
|
|
2126
2357
|
name: template.name,
|
|
2127
2358
|
category: template.category,
|
|
@@ -2142,7 +2373,7 @@ function generateSkill(template, variables, config, outputDir, overwrite) {
|
|
|
2142
2373
|
};
|
|
2143
2374
|
}
|
|
2144
2375
|
const content = substituteVariables(template.content, variables);
|
|
2145
|
-
const isUpdate =
|
|
2376
|
+
const isUpdate = existsSync5(outputPath);
|
|
2146
2377
|
writeFileSync2(outputPath, content, "utf-8");
|
|
2147
2378
|
return {
|
|
2148
2379
|
name: template.name,
|
|
@@ -2195,15 +2426,15 @@ function formatGenerateResult(result) {
|
|
|
2195
2426
|
|
|
2196
2427
|
// src/knowledge-library/manager.ts
|
|
2197
2428
|
import {
|
|
2198
|
-
existsSync as
|
|
2429
|
+
existsSync as existsSync6,
|
|
2199
2430
|
mkdirSync as mkdirSync3,
|
|
2200
2431
|
writeFileSync as writeFileSync3,
|
|
2201
|
-
readFileSync as
|
|
2432
|
+
readFileSync as readFileSync5,
|
|
2202
2433
|
readdirSync as readdirSync3,
|
|
2203
2434
|
renameSync,
|
|
2204
2435
|
statSync as statSync2
|
|
2205
2436
|
} from "fs";
|
|
2206
|
-
import { join as
|
|
2437
|
+
import { join as join7, basename as basename3 } from "path";
|
|
2207
2438
|
var DEFAULT_KNOWLEDGE_LIBRARY_PATH = "KnowledgeLibrary";
|
|
2208
2439
|
var STANDARD_FILES = {
|
|
2209
2440
|
context: "context.txt",
|
|
@@ -2225,32 +2456,32 @@ var CONTROL_FILES = {
|
|
|
2225
2456
|
dependencies: "dependencies.txt"
|
|
2226
2457
|
};
|
|
2227
2458
|
function getAgentDirectories(basePath, agentName) {
|
|
2228
|
-
const root =
|
|
2459
|
+
const root = join7(basePath, agentName);
|
|
2229
2460
|
return {
|
|
2230
2461
|
root,
|
|
2231
|
-
inbox:
|
|
2232
|
-
inboxProcessed:
|
|
2233
|
-
outbox:
|
|
2234
|
-
context:
|
|
2235
|
-
control:
|
|
2236
|
-
history:
|
|
2237
|
-
tech:
|
|
2462
|
+
inbox: join7(root, "inbox"),
|
|
2463
|
+
inboxProcessed: join7(root, "inbox", "processed"),
|
|
2464
|
+
outbox: join7(root, "outbox"),
|
|
2465
|
+
context: join7(root, "context"),
|
|
2466
|
+
control: join7(root, "control"),
|
|
2467
|
+
history: join7(root, "history"),
|
|
2468
|
+
tech: join7(root, "tech")
|
|
2238
2469
|
};
|
|
2239
2470
|
}
|
|
2240
2471
|
function initKnowledgeLibrary(options = {}) {
|
|
2241
2472
|
const projectRoot = options.projectRoot ?? process.cwd();
|
|
2242
|
-
const basePath =
|
|
2473
|
+
const basePath = join7(projectRoot, options.basePath ?? DEFAULT_KNOWLEDGE_LIBRARY_PATH);
|
|
2243
2474
|
const createDefaults = options.createDefaults ?? true;
|
|
2244
2475
|
const createdDirs = [];
|
|
2245
2476
|
const createdFiles = [];
|
|
2246
2477
|
try {
|
|
2247
|
-
if (!
|
|
2478
|
+
if (!existsSync6(basePath)) {
|
|
2248
2479
|
mkdirSync3(basePath, { recursive: true });
|
|
2249
2480
|
createdDirs.push(basePath);
|
|
2250
2481
|
}
|
|
2251
2482
|
if (createDefaults) {
|
|
2252
|
-
const contextPath =
|
|
2253
|
-
if (!
|
|
2483
|
+
const contextPath = join7(basePath, STANDARD_FILES.context);
|
|
2484
|
+
if (!existsSync6(contextPath)) {
|
|
2254
2485
|
writeFileSync3(
|
|
2255
2486
|
contextPath,
|
|
2256
2487
|
`# Project Context
|
|
@@ -2272,8 +2503,8 @@ function initKnowledgeLibrary(options = {}) {
|
|
|
2272
2503
|
);
|
|
2273
2504
|
createdFiles.push(contextPath);
|
|
2274
2505
|
}
|
|
2275
|
-
const architecturePath =
|
|
2276
|
-
if (!
|
|
2506
|
+
const architecturePath = join7(basePath, STANDARD_FILES.architecture);
|
|
2507
|
+
if (!existsSync6(architecturePath)) {
|
|
2277
2508
|
writeFileSync3(
|
|
2278
2509
|
architecturePath,
|
|
2279
2510
|
`# Architecture Notes
|
|
@@ -2291,8 +2522,8 @@ function initKnowledgeLibrary(options = {}) {
|
|
|
2291
2522
|
);
|
|
2292
2523
|
createdFiles.push(architecturePath);
|
|
2293
2524
|
}
|
|
2294
|
-
const prdPath =
|
|
2295
|
-
if (!
|
|
2525
|
+
const prdPath = join7(basePath, STANDARD_FILES.prd);
|
|
2526
|
+
if (!existsSync6(prdPath)) {
|
|
2296
2527
|
writeFileSync3(
|
|
2297
2528
|
prdPath,
|
|
2298
2529
|
`# Product Requirements Document
|
|
@@ -2330,12 +2561,12 @@ function initKnowledgeLibrary(options = {}) {
|
|
|
2330
2561
|
}
|
|
2331
2562
|
function initAgentKnowledgeLibrary(agentName, options = {}) {
|
|
2332
2563
|
const projectRoot = options.projectRoot ?? process.cwd();
|
|
2333
|
-
const basePath =
|
|
2564
|
+
const basePath = join7(projectRoot, options.basePath ?? DEFAULT_KNOWLEDGE_LIBRARY_PATH);
|
|
2334
2565
|
const createDefaults = options.createDefaults ?? true;
|
|
2335
2566
|
const createdDirs = [];
|
|
2336
2567
|
const createdFiles = [];
|
|
2337
2568
|
try {
|
|
2338
|
-
if (!
|
|
2569
|
+
if (!existsSync6(basePath)) {
|
|
2339
2570
|
const baseResult = initKnowledgeLibrary(options);
|
|
2340
2571
|
if (!baseResult.success) {
|
|
2341
2572
|
return baseResult;
|
|
@@ -2345,15 +2576,15 @@ function initAgentKnowledgeLibrary(agentName, options = {}) {
|
|
|
2345
2576
|
}
|
|
2346
2577
|
const dirs = getAgentDirectories(basePath, agentName);
|
|
2347
2578
|
for (const dir of AGENT_DIRECTORIES) {
|
|
2348
|
-
const dirPath =
|
|
2349
|
-
if (!
|
|
2579
|
+
const dirPath = join7(dirs.root, dir);
|
|
2580
|
+
if (!existsSync6(dirPath)) {
|
|
2350
2581
|
mkdirSync3(dirPath, { recursive: true });
|
|
2351
2582
|
createdDirs.push(dirPath);
|
|
2352
2583
|
}
|
|
2353
2584
|
}
|
|
2354
2585
|
if (createDefaults) {
|
|
2355
|
-
const currentContextPath =
|
|
2356
|
-
if (!
|
|
2586
|
+
const currentContextPath = join7(dirs.context, "current.txt");
|
|
2587
|
+
if (!existsSync6(currentContextPath)) {
|
|
2357
2588
|
writeFileSync3(
|
|
2358
2589
|
currentContextPath,
|
|
2359
2590
|
`# ${agentName} Current Context
|
|
@@ -2370,8 +2601,8 @@ function initAgentKnowledgeLibrary(agentName, options = {}) {
|
|
|
2370
2601
|
);
|
|
2371
2602
|
createdFiles.push(currentContextPath);
|
|
2372
2603
|
}
|
|
2373
|
-
const objectivesPath =
|
|
2374
|
-
if (!
|
|
2604
|
+
const objectivesPath = join7(dirs.control, CONTROL_FILES.objectives);
|
|
2605
|
+
if (!existsSync6(objectivesPath)) {
|
|
2375
2606
|
writeFileSync3(
|
|
2376
2607
|
objectivesPath,
|
|
2377
2608
|
`# ${agentName} Objectives
|
|
@@ -2386,8 +2617,8 @@ function initAgentKnowledgeLibrary(agentName, options = {}) {
|
|
|
2386
2617
|
);
|
|
2387
2618
|
createdFiles.push(objectivesPath);
|
|
2388
2619
|
}
|
|
2389
|
-
const decisionsPath =
|
|
2390
|
-
if (!
|
|
2620
|
+
const decisionsPath = join7(dirs.control, CONTROL_FILES.decisions);
|
|
2621
|
+
if (!existsSync6(decisionsPath)) {
|
|
2391
2622
|
writeFileSync3(
|
|
2392
2623
|
decisionsPath,
|
|
2393
2624
|
`# ${agentName} Decision Log
|
|
@@ -2405,8 +2636,8 @@ Format:
|
|
|
2405
2636
|
);
|
|
2406
2637
|
createdFiles.push(decisionsPath);
|
|
2407
2638
|
}
|
|
2408
|
-
const dependenciesPath =
|
|
2409
|
-
if (!
|
|
2639
|
+
const dependenciesPath = join7(dirs.control, CONTROL_FILES.dependencies);
|
|
2640
|
+
if (!existsSync6(dependenciesPath)) {
|
|
2410
2641
|
writeFileSync3(
|
|
2411
2642
|
dependenciesPath,
|
|
2412
2643
|
`# ${agentName} Dependencies
|
|
@@ -2440,20 +2671,20 @@ Last Updated: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
|
2440
2671
|
}
|
|
2441
2672
|
function agentKnowledgeLibraryExists(agentName, options = {}) {
|
|
2442
2673
|
const projectRoot = options.projectRoot ?? process.cwd();
|
|
2443
|
-
const basePath =
|
|
2444
|
-
const agentRoot =
|
|
2445
|
-
return
|
|
2674
|
+
const basePath = join7(projectRoot, options.basePath ?? DEFAULT_KNOWLEDGE_LIBRARY_PATH);
|
|
2675
|
+
const agentRoot = join7(basePath, agentName);
|
|
2676
|
+
return existsSync6(agentRoot) && existsSync6(join7(agentRoot, "inbox"));
|
|
2446
2677
|
}
|
|
2447
2678
|
function getAgentKnowledgeState(agentName, options = {}) {
|
|
2448
2679
|
const projectRoot = options.projectRoot ?? process.cwd();
|
|
2449
|
-
const basePath =
|
|
2680
|
+
const basePath = join7(projectRoot, options.basePath ?? DEFAULT_KNOWLEDGE_LIBRARY_PATH);
|
|
2450
2681
|
const dirs = getAgentDirectories(basePath, agentName);
|
|
2451
2682
|
const initialized = agentKnowledgeLibraryExists(agentName, options);
|
|
2452
2683
|
const pendingMessages = initialized ? readInboxMessages(agentName, options) : [];
|
|
2453
2684
|
let context;
|
|
2454
|
-
const currentContextPath =
|
|
2455
|
-
if (
|
|
2456
|
-
const content =
|
|
2685
|
+
const currentContextPath = join7(dirs.context, "current.txt");
|
|
2686
|
+
if (existsSync6(currentContextPath)) {
|
|
2687
|
+
const content = readFileSync5(currentContextPath, "utf-8");
|
|
2457
2688
|
context = parseContextFile(content);
|
|
2458
2689
|
}
|
|
2459
2690
|
const state = {
|
|
@@ -2538,16 +2769,16 @@ function parseMessageFrontmatter(content) {
|
|
|
2538
2769
|
}
|
|
2539
2770
|
function readInboxMessages(agentName, options = {}) {
|
|
2540
2771
|
const projectRoot = options.projectRoot ?? process.cwd();
|
|
2541
|
-
const basePath =
|
|
2772
|
+
const basePath = join7(projectRoot, options.basePath ?? DEFAULT_KNOWLEDGE_LIBRARY_PATH);
|
|
2542
2773
|
const dirs = getAgentDirectories(basePath, agentName);
|
|
2543
2774
|
const messages = [];
|
|
2544
|
-
if (
|
|
2775
|
+
if (existsSync6(dirs.inbox)) {
|
|
2545
2776
|
const files = readdirSync3(dirs.inbox).filter(
|
|
2546
|
-
(f) => f.endsWith(".md") && statSync2(
|
|
2777
|
+
(f) => f.endsWith(".md") && statSync2(join7(dirs.inbox, f)).isFile()
|
|
2547
2778
|
);
|
|
2548
2779
|
for (const file of files) {
|
|
2549
|
-
const filePath =
|
|
2550
|
-
const rawContent =
|
|
2780
|
+
const filePath = join7(dirs.inbox, file);
|
|
2781
|
+
const rawContent = readFileSync5(filePath, "utf-8");
|
|
2551
2782
|
const { metadata, body } = parseMessageFrontmatter(rawContent);
|
|
2552
2783
|
if (options.type && metadata.type !== options.type) continue;
|
|
2553
2784
|
if (options.from && metadata.from !== options.from) continue;
|
|
@@ -2561,13 +2792,13 @@ function readInboxMessages(agentName, options = {}) {
|
|
|
2561
2792
|
});
|
|
2562
2793
|
}
|
|
2563
2794
|
}
|
|
2564
|
-
if (options.includeProcessed &&
|
|
2795
|
+
if (options.includeProcessed && existsSync6(dirs.inboxProcessed)) {
|
|
2565
2796
|
const files = readdirSync3(dirs.inboxProcessed).filter(
|
|
2566
|
-
(f) => f.endsWith(".md") && statSync2(
|
|
2797
|
+
(f) => f.endsWith(".md") && statSync2(join7(dirs.inboxProcessed, f)).isFile()
|
|
2567
2798
|
);
|
|
2568
2799
|
for (const file of files) {
|
|
2569
|
-
const filePath =
|
|
2570
|
-
const rawContent =
|
|
2800
|
+
const filePath = join7(dirs.inboxProcessed, file);
|
|
2801
|
+
const rawContent = readFileSync5(filePath, "utf-8");
|
|
2571
2802
|
const { metadata, body } = parseMessageFrontmatter(rawContent);
|
|
2572
2803
|
if (options.type && metadata.type !== options.type) continue;
|
|
2573
2804
|
if (options.from && metadata.from !== options.from) continue;
|
|
@@ -2593,23 +2824,23 @@ function readInboxMessages(agentName, options = {}) {
|
|
|
2593
2824
|
}
|
|
2594
2825
|
function getKnowledgeLibraryState(options = {}) {
|
|
2595
2826
|
const projectRoot = options.projectRoot ?? process.cwd();
|
|
2596
|
-
const basePath =
|
|
2597
|
-
if (!
|
|
2827
|
+
const basePath = join7(projectRoot, options.basePath ?? DEFAULT_KNOWLEDGE_LIBRARY_PATH);
|
|
2828
|
+
if (!existsSync6(basePath)) {
|
|
2598
2829
|
return null;
|
|
2599
2830
|
}
|
|
2600
2831
|
const agents2 = [];
|
|
2601
2832
|
const entries = readdirSync3(basePath);
|
|
2602
2833
|
for (const entry of entries) {
|
|
2603
|
-
const entryPath =
|
|
2604
|
-
if (statSync2(entryPath).isDirectory() &&
|
|
2834
|
+
const entryPath = join7(basePath, entry);
|
|
2835
|
+
if (statSync2(entryPath).isDirectory() && existsSync6(join7(entryPath, "inbox"))) {
|
|
2605
2836
|
agents2.push(entry);
|
|
2606
2837
|
}
|
|
2607
2838
|
}
|
|
2608
2839
|
return {
|
|
2609
2840
|
basePath,
|
|
2610
|
-
contextPath:
|
|
2611
|
-
architecturePath:
|
|
2612
|
-
prdPath:
|
|
2841
|
+
contextPath: join7(basePath, STANDARD_FILES.context),
|
|
2842
|
+
architecturePath: join7(basePath, STANDARD_FILES.architecture),
|
|
2843
|
+
prdPath: join7(basePath, STANDARD_FILES.prd),
|
|
2613
2844
|
agents: agents2
|
|
2614
2845
|
};
|
|
2615
2846
|
}
|
|
@@ -2618,13 +2849,13 @@ function getKnowledgeLibraryState(options = {}) {
|
|
|
2618
2849
|
var VERSION = "0.1.0";
|
|
2619
2850
|
|
|
2620
2851
|
// src/cli/commands/cache.ts
|
|
2621
|
-
import { join as
|
|
2852
|
+
import { join as join8 } from "path";
|
|
2622
2853
|
function getCachePath(options) {
|
|
2623
2854
|
if (options.cachePath) {
|
|
2624
2855
|
return options.cachePath;
|
|
2625
2856
|
}
|
|
2626
2857
|
const root = options.projectRoot ?? process.cwd();
|
|
2627
|
-
return
|
|
2858
|
+
return join8(root, CACHE_PATHS.base);
|
|
2628
2859
|
}
|
|
2629
2860
|
async function cacheStatus(options = {}) {
|
|
2630
2861
|
const cachePath = getCachePath(options);
|
|
@@ -2752,7 +2983,7 @@ function formatCacheStatus(result) {
|
|
|
2752
2983
|
}
|
|
2753
2984
|
|
|
2754
2985
|
// src/cli/commands/sync.ts
|
|
2755
|
-
import { join as
|
|
2986
|
+
import { join as join9 } from "path";
|
|
2756
2987
|
function createPlaceholderFetcher(source) {
|
|
2757
2988
|
return {
|
|
2758
2989
|
async fetch(url) {
|
|
@@ -2770,7 +3001,7 @@ function getCachePath2(options) {
|
|
|
2770
3001
|
return options.cachePath;
|
|
2771
3002
|
}
|
|
2772
3003
|
const root = options.projectRoot ?? process.cwd();
|
|
2773
|
-
return
|
|
3004
|
+
return join9(root, CACHE_PATHS.base);
|
|
2774
3005
|
}
|
|
2775
3006
|
async function sync(options = {}) {
|
|
2776
3007
|
const cachePath = getCachePath2(options);
|
|
@@ -2887,8 +3118,8 @@ function formatSyncResult(result) {
|
|
|
2887
3118
|
}
|
|
2888
3119
|
|
|
2889
3120
|
// src/cli/commands/init.ts
|
|
2890
|
-
import { existsSync as
|
|
2891
|
-
import { join as
|
|
3121
|
+
import { existsSync as existsSync7, writeFileSync as writeFileSync4, mkdirSync as mkdirSync4, readFileSync as readFileSync6 } from "fs";
|
|
3122
|
+
import { join as join10, basename as basename4 } from "path";
|
|
2892
3123
|
import { execSync } from "child_process";
|
|
2893
3124
|
function detectGitInfo() {
|
|
2894
3125
|
try {
|
|
@@ -2915,10 +3146,10 @@ function detectGitInfo() {
|
|
|
2915
3146
|
}
|
|
2916
3147
|
}
|
|
2917
3148
|
function detectProjectName(projectRoot) {
|
|
2918
|
-
const packageJsonPath =
|
|
2919
|
-
if (
|
|
3149
|
+
const packageJsonPath = join10(projectRoot, "package.json");
|
|
3150
|
+
if (existsSync7(packageJsonPath)) {
|
|
2920
3151
|
try {
|
|
2921
|
-
const content = JSON.parse(
|
|
3152
|
+
const content = JSON.parse(readFileSync6(packageJsonPath, "utf-8"));
|
|
2922
3153
|
if (content.name) {
|
|
2923
3154
|
return content.name;
|
|
2924
3155
|
}
|
|
@@ -2976,13 +3207,13 @@ integrations:
|
|
|
2976
3207
|
}
|
|
2977
3208
|
function createDirectories(projectRoot) {
|
|
2978
3209
|
const dirs = [
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
3210
|
+
join10(projectRoot, "coreai", "agents"),
|
|
3211
|
+
join10(projectRoot, "coreai", "commands"),
|
|
3212
|
+
join10(projectRoot, ".coreai", "cache")
|
|
2982
3213
|
];
|
|
2983
3214
|
const created = [];
|
|
2984
3215
|
for (const dir of dirs) {
|
|
2985
|
-
if (!
|
|
3216
|
+
if (!existsSync7(dir)) {
|
|
2986
3217
|
mkdirSync4(dir, { recursive: true });
|
|
2987
3218
|
created.push(dir);
|
|
2988
3219
|
}
|
|
@@ -3001,7 +3232,7 @@ function init(options = {}) {
|
|
|
3001
3232
|
const name = options.name ?? detectProjectName(projectRoot);
|
|
3002
3233
|
const type = options.type ?? "software";
|
|
3003
3234
|
const configContent = generateConfigYaml({ name, type, gitInfo });
|
|
3004
|
-
const configPath =
|
|
3235
|
+
const configPath = join10(projectRoot, "coreai.config.yaml");
|
|
3005
3236
|
try {
|
|
3006
3237
|
writeFileSync4(configPath, configContent, "utf-8");
|
|
3007
3238
|
} catch (error) {
|
|
@@ -3093,6 +3324,24 @@ function build(options = {}) {
|
|
|
3093
3324
|
const agentsList = options.agents;
|
|
3094
3325
|
compileOptions.filter = (agent) => agentsList.includes(agent.role);
|
|
3095
3326
|
}
|
|
3327
|
+
const includeMcpServers = options.mcpServers ?? true;
|
|
3328
|
+
if (includeMcpServers !== false) {
|
|
3329
|
+
try {
|
|
3330
|
+
if (Array.isArray(includeMcpServers)) {
|
|
3331
|
+
compileOptions.mcpServers = includeMcpServers;
|
|
3332
|
+
} else {
|
|
3333
|
+
const discoveredServers = discoverMcpServers({
|
|
3334
|
+
projectRoot,
|
|
3335
|
+
includeGlobal: false
|
|
3336
|
+
// Only use project-level MCP config
|
|
3337
|
+
});
|
|
3338
|
+
if (discoveredServers.length > 0) {
|
|
3339
|
+
compileOptions.mcpServers = discoveredServers.map((s) => s.name);
|
|
3340
|
+
}
|
|
3341
|
+
}
|
|
3342
|
+
} catch {
|
|
3343
|
+
}
|
|
3344
|
+
}
|
|
3096
3345
|
try {
|
|
3097
3346
|
const result = compileAgents(config, compileOptions);
|
|
3098
3347
|
if (result.errors.length > 0) {
|
|
@@ -3122,7 +3371,8 @@ function build(options = {}) {
|
|
|
3122
3371
|
result,
|
|
3123
3372
|
config,
|
|
3124
3373
|
warnings: warnings.length > 0 ? warnings : void 0,
|
|
3125
|
-
knowledgeLibraryInitialized
|
|
3374
|
+
knowledgeLibraryInitialized,
|
|
3375
|
+
mcpServers: compileOptions.mcpServers
|
|
3126
3376
|
};
|
|
3127
3377
|
} catch (error) {
|
|
3128
3378
|
return {
|
|
@@ -3188,6 +3438,10 @@ function formatBuildResult(result) {
|
|
|
3188
3438
|
}
|
|
3189
3439
|
lines.push("");
|
|
3190
3440
|
}
|
|
3441
|
+
if (result.mcpServers && result.mcpServers.length > 0) {
|
|
3442
|
+
lines.push(`MCP tools included: ${result.mcpServers.map((s) => `mcp__${s}`).join(", ")}`);
|
|
3443
|
+
lines.push("");
|
|
3444
|
+
}
|
|
3191
3445
|
if (result.knowledgeLibraryInitialized && result.knowledgeLibraryInitialized.length > 0) {
|
|
3192
3446
|
lines.push(
|
|
3193
3447
|
`KnowledgeLibrary initialized for ${result.knowledgeLibraryInitialized.length} agent(s):`
|
|
@@ -3202,8 +3456,8 @@ function formatBuildResult(result) {
|
|
|
3202
3456
|
}
|
|
3203
3457
|
|
|
3204
3458
|
// src/cli/commands/validate.ts
|
|
3205
|
-
import { existsSync as
|
|
3206
|
-
import { join as
|
|
3459
|
+
import { existsSync as existsSync8 } from "fs";
|
|
3460
|
+
import { join as join11 } from "path";
|
|
3207
3461
|
function validateConfig2(projectRoot) {
|
|
3208
3462
|
const issues = [];
|
|
3209
3463
|
if (!configExists(projectRoot)) {
|
|
@@ -3238,7 +3492,7 @@ function validateConfig2(projectRoot) {
|
|
|
3238
3492
|
}
|
|
3239
3493
|
function validateAgents(config, coreAgentsDir, projectRoot) {
|
|
3240
3494
|
const issues = [];
|
|
3241
|
-
const customAgentsDir =
|
|
3495
|
+
const customAgentsDir = join11(projectRoot, "coreai", "agents");
|
|
3242
3496
|
let availableAgents;
|
|
3243
3497
|
try {
|
|
3244
3498
|
availableAgents = loadAllAgents({
|
|
@@ -3287,8 +3541,8 @@ function validateDirectories(projectRoot) {
|
|
|
3287
3541
|
{ path: ".claude/agents", description: "Compiled agents output" }
|
|
3288
3542
|
];
|
|
3289
3543
|
for (const dir of requiredDirs) {
|
|
3290
|
-
const fullPath =
|
|
3291
|
-
if (!
|
|
3544
|
+
const fullPath = join11(projectRoot, dir.path);
|
|
3545
|
+
if (!existsSync8(fullPath)) {
|
|
3292
3546
|
issues.push({
|
|
3293
3547
|
level: "warning",
|
|
3294
3548
|
category: "directories",
|
|
@@ -3298,8 +3552,8 @@ function validateDirectories(projectRoot) {
|
|
|
3298
3552
|
}
|
|
3299
3553
|
}
|
|
3300
3554
|
for (const dir of optionalDirs) {
|
|
3301
|
-
const fullPath =
|
|
3302
|
-
if (!
|
|
3555
|
+
const fullPath = join11(projectRoot, dir.path);
|
|
3556
|
+
if (!existsSync8(fullPath)) {
|
|
3303
3557
|
issues.push({
|
|
3304
3558
|
level: "info",
|
|
3305
3559
|
category: "directories",
|
|
@@ -3345,7 +3599,7 @@ function validateIntegrations(config) {
|
|
|
3345
3599
|
}
|
|
3346
3600
|
function validate(options = {}) {
|
|
3347
3601
|
const projectRoot = options.projectRoot ?? process.cwd();
|
|
3348
|
-
const coreAgentsDir = options.coreAgentsDir ??
|
|
3602
|
+
const coreAgentsDir = options.coreAgentsDir ?? join11(projectRoot, "node_modules", "@coreai", "cli", "agents");
|
|
3349
3603
|
const checkAgents = options.checkAgents ?? true;
|
|
3350
3604
|
const checkDirs = options.checkDirs ?? true;
|
|
3351
3605
|
const allIssues = [];
|
|
@@ -3742,9 +3996,9 @@ function formatStatusResult(result) {
|
|
|
3742
3996
|
|
|
3743
3997
|
// src/cli/index.ts
|
|
3744
3998
|
var __filename = fileURLToPath(import.meta.url);
|
|
3745
|
-
var __dirname =
|
|
3999
|
+
var __dirname = dirname5(__filename);
|
|
3746
4000
|
function getCoreAgentsPath() {
|
|
3747
|
-
return
|
|
4001
|
+
return join12(__dirname, "..", "..", "agents");
|
|
3748
4002
|
}
|
|
3749
4003
|
var program = new Command();
|
|
3750
4004
|
program.name("coreai").description("A configurable, team-ready AI agent orchestration platform").version(VERSION, "-v, --version", "output the current version");
|
|
@@ -3823,7 +4077,7 @@ program.command("validate").description("Validate configuration and project setu
|
|
|
3823
4077
|
var agents = program.command("agents").description("Manage agent definitions");
|
|
3824
4078
|
agents.command("list").description("List available agents").option("--core", "show only core agents").option("--custom", "show only custom agents").action((options) => {
|
|
3825
4079
|
try {
|
|
3826
|
-
const customAgentsDir =
|
|
4080
|
+
const customAgentsDir = join12(process.cwd(), "coreai", "agents");
|
|
3827
4081
|
const allAgents = loadAllAgents({
|
|
3828
4082
|
coreAgentsDir: getCoreAgentsPath(),
|
|
3829
4083
|
customAgentsDir
|
|
@@ -3877,7 +4131,7 @@ agents.command("list").description("List available agents").option("--core", "sh
|
|
|
3877
4131
|
});
|
|
3878
4132
|
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) => {
|
|
3879
4133
|
try {
|
|
3880
|
-
const customAgentsDir =
|
|
4134
|
+
const customAgentsDir = join12(process.cwd(), "coreai", "agents");
|
|
3881
4135
|
const allAgents = loadAllAgents({
|
|
3882
4136
|
coreAgentsDir: getCoreAgentsPath(),
|
|
3883
4137
|
customAgentsDir
|