@agents-inc/cli 0.84.1 → 0.86.0
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/CHANGELOG.md +20 -0
- package/dist/{chunk-6VGBO6SZ.js → chunk-5M6Q5UQO.js} +2 -2
- package/dist/{chunk-YJ2URWF7.js → chunk-B6MYECV6.js} +2 -2
- package/dist/{chunk-FT46LN7K.js → chunk-BV2MIQ3O.js} +7 -8
- package/dist/chunk-BV2MIQ3O.js.map +1 -0
- package/dist/{chunk-G2MINRWX.js → chunk-C5IYJ42F.js} +2 -2
- package/dist/{chunk-7UZUDHP7.js → chunk-CXWBVBDM.js} +2 -2
- package/dist/chunk-DCVCFBQ7.js +1800 -0
- package/dist/chunk-DCVCFBQ7.js.map +1 -0
- package/dist/{chunk-CYPCJ536.js → chunk-FBZR46GC.js} +92 -92
- package/dist/chunk-FBZR46GC.js.map +1 -0
- package/dist/{chunk-TXW257CU.js → chunk-GED2F75H.js} +90 -167
- package/dist/chunk-GED2F75H.js.map +1 -0
- package/dist/{chunk-LTFGEVTM.js → chunk-HH3AWXF4.js} +3 -3
- package/dist/{chunk-2XVLQDNI.js → chunk-HSLVCKVQ.js} +3 -3
- package/dist/{chunk-TAQGYJIS.js → chunk-HZ2IBXVQ.js} +3 -3
- package/dist/{chunk-LN76TJJP.js → chunk-HZQOFFKA.js} +10 -10
- package/dist/{chunk-W7LHI54P.js → chunk-I44YG6VI.js} +2 -2
- package/dist/{chunk-L7COG2EX.js → chunk-LZ7XQ3IU.js} +2 -2
- package/dist/{chunk-LMR7VAP3.js → chunk-MMTMXLI4.js} +2 -2
- package/dist/chunk-N6A7A4RA.js +16 -0
- package/dist/chunk-N6A7A4RA.js.map +1 -0
- package/dist/{chunk-WJKD6EGK.js → chunk-NUU3U43A.js} +5 -6
- package/dist/chunk-NUU3U43A.js.map +1 -0
- package/dist/chunk-O5ZWS26C.js +166 -0
- package/dist/chunk-O5ZWS26C.js.map +1 -0
- package/dist/{chunk-YYIWB42G.js → chunk-Q4DMIPZB.js} +2 -2
- package/dist/{chunk-YSLDMYWP.js → chunk-SGZOFIFF.js} +2 -2
- package/dist/{chunk-FKXD3EXJ.js → chunk-TMTUTUEV.js} +42 -228
- package/dist/chunk-TMTUTUEV.js.map +1 -0
- package/dist/{chunk-WCCWQ56J.js → chunk-UNEJKTLP.js} +3 -3
- package/dist/chunk-XQK4S22C.js +202 -0
- package/dist/chunk-XQK4S22C.js.map +1 -0
- package/dist/{chunk-ZGD7PLLC.js → chunk-ZOWRO7UQ.js} +3 -3
- package/dist/commands/build/marketplace.js +3 -3
- package/dist/commands/build/plugins.js +5 -5
- package/dist/commands/build/stack.js +5 -5
- package/dist/commands/compile.js +63 -163
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/config/index.js +5 -5
- package/dist/commands/config/path.js +4 -4
- package/dist/commands/config/show.js +5 -5
- package/dist/commands/diff.js +27 -632
- package/dist/commands/diff.js.map +1 -1
- package/dist/commands/doctor.js +41 -28
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/edit.js +128 -194
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/eject.js +58 -126
- package/dist/commands/eject.js.map +1 -1
- package/dist/commands/import/skill.js +15 -148
- package/dist/commands/import/skill.js.map +1 -1
- package/dist/commands/info.js +34 -85
- package/dist/commands/info.js.map +1 -1
- package/dist/commands/init.js +23 -17
- package/dist/commands/list.js +4 -4
- package/dist/commands/new/agent.js +23 -97
- package/dist/commands/new/agent.js.map +1 -1
- package/dist/commands/new/marketplace.js +9 -9
- package/dist/commands/new/marketplace.js.map +1 -1
- package/dist/commands/new/skill.js +169 -20
- package/dist/commands/new/skill.js.map +1 -1
- package/dist/commands/outdated.js +18 -24
- package/dist/commands/outdated.js.map +1 -1
- package/dist/commands/search.js +37 -100
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/uninstall.js +39 -156
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.js +49 -99
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/validate.js +4 -4
- package/dist/components/skill-search/skill-search.js +2 -1
- package/dist/components/wizard/category-grid.test.js +4 -4
- package/dist/components/wizard/domain-selection.js +5 -5
- package/dist/components/wizard/help-modal.js +5 -5
- package/dist/components/wizard/source-grid.test.js +4 -4
- package/dist/components/wizard/stack-selection.js +5 -5
- package/dist/components/wizard/step-agents.js +5 -5
- package/dist/components/wizard/step-agents.test.js +5 -5
- package/dist/components/wizard/step-build.js +5 -5
- package/dist/components/wizard/step-build.test.js +5 -5
- package/dist/components/wizard/step-confirm.test.js +4 -4
- package/dist/components/wizard/step-settings.js +4 -4
- package/dist/components/wizard/step-settings.test.js +7 -7
- package/dist/components/wizard/step-sources.js +5 -5
- package/dist/components/wizard/step-sources.test.js +5 -5
- package/dist/components/wizard/step-stack.js +6 -6
- package/dist/components/wizard/step-stack.test.js +6 -6
- package/dist/components/wizard/wizard-layout.js +6 -6
- package/dist/components/wizard/wizard.js +14 -14
- package/dist/hooks/init.js +21 -16
- package/dist/hooks/init.js.map +1 -1
- package/dist/{loader-GT2A7R7U.js → loader-GSEGPK64.js} +3 -3
- package/dist/{source-loader-TNQW4P47.js → source-loader-OGFTIRIX.js} +4 -4
- package/dist/{source-manager-INRXRFJE.js → source-manager-FMMDDVZA.js} +4 -4
- package/dist/stores/wizard-store.js +4 -4
- package/dist/stores/wizard-store.test.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-AABH2HSE.js +0 -340
- package/dist/chunk-AABH2HSE.js.map +0 -1
- package/dist/chunk-CYPCJ536.js.map +0 -1
- package/dist/chunk-FKXD3EXJ.js.map +0 -1
- package/dist/chunk-FT46LN7K.js.map +0 -1
- package/dist/chunk-TXW257CU.js.map +0 -1
- package/dist/chunk-WJKD6EGK.js.map +0 -1
- /package/dist/{chunk-6VGBO6SZ.js.map → chunk-5M6Q5UQO.js.map} +0 -0
- /package/dist/{chunk-YJ2URWF7.js.map → chunk-B6MYECV6.js.map} +0 -0
- /package/dist/{chunk-G2MINRWX.js.map → chunk-C5IYJ42F.js.map} +0 -0
- /package/dist/{chunk-7UZUDHP7.js.map → chunk-CXWBVBDM.js.map} +0 -0
- /package/dist/{chunk-LTFGEVTM.js.map → chunk-HH3AWXF4.js.map} +0 -0
- /package/dist/{chunk-2XVLQDNI.js.map → chunk-HSLVCKVQ.js.map} +0 -0
- /package/dist/{chunk-TAQGYJIS.js.map → chunk-HZ2IBXVQ.js.map} +0 -0
- /package/dist/{chunk-LN76TJJP.js.map → chunk-HZQOFFKA.js.map} +0 -0
- /package/dist/{chunk-W7LHI54P.js.map → chunk-I44YG6VI.js.map} +0 -0
- /package/dist/{chunk-L7COG2EX.js.map → chunk-LZ7XQ3IU.js.map} +0 -0
- /package/dist/{chunk-LMR7VAP3.js.map → chunk-MMTMXLI4.js.map} +0 -0
- /package/dist/{chunk-YYIWB42G.js.map → chunk-Q4DMIPZB.js.map} +0 -0
- /package/dist/{chunk-YSLDMYWP.js.map → chunk-SGZOFIFF.js.map} +0 -0
- /package/dist/{chunk-WCCWQ56J.js.map → chunk-UNEJKTLP.js.map} +0 -0
- /package/dist/{chunk-ZGD7PLLC.js.map → chunk-ZOWRO7UQ.js.map} +0 -0
- /package/dist/{loader-GT2A7R7U.js.map → loader-GSEGPK64.js.map} +0 -0
- /package/dist/{source-loader-TNQW4P47.js.map → source-loader-OGFTIRIX.js.map} +0 -0
- /package/dist/{source-manager-INRXRFJE.js.map → source-manager-FMMDDVZA.js.map} +0 -0
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
} from "./chunk-NL5EB57E.js";
|
|
14
14
|
import {
|
|
15
15
|
HelpModal
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-CXWBVBDM.js";
|
|
17
17
|
import {
|
|
18
18
|
useWizardStore
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-HSLVCKVQ.js";
|
|
20
20
|
import {
|
|
21
21
|
HOTKEY_FILTER_INCOMPATIBLE,
|
|
22
22
|
HOTKEY_HELP,
|
|
@@ -250,4 +250,4 @@ var WizardLayout = ({
|
|
|
250
250
|
export {
|
|
251
251
|
WizardLayout
|
|
252
252
|
};
|
|
253
|
-
//# sourceMappingURL=chunk-
|
|
253
|
+
//# sourceMappingURL=chunk-UNEJKTLP.js.map
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
computeSkillFolderHash,
|
|
4
|
+
loadConfig
|
|
5
|
+
} from "./chunk-TMTUTUEV.js";
|
|
6
|
+
import {
|
|
7
|
+
ensureDir,
|
|
8
|
+
fileExists,
|
|
9
|
+
verbose,
|
|
10
|
+
writeFile
|
|
11
|
+
} from "./chunk-NUU3U43A.js";
|
|
12
|
+
import {
|
|
13
|
+
DEFAULT_VERSION,
|
|
14
|
+
KEBAB_CASE_PATTERN,
|
|
15
|
+
SKILL_CATEGORIES_PATH,
|
|
16
|
+
SKILL_RULES_PATH,
|
|
17
|
+
STANDARD_FILES
|
|
18
|
+
} from "./chunk-6PGL2XMY.js";
|
|
19
|
+
import {
|
|
20
|
+
init_esm_shims
|
|
21
|
+
} from "./chunk-DHET7RCE.js";
|
|
22
|
+
|
|
23
|
+
// src/cli/lib/operations/scaffold-skill.ts
|
|
24
|
+
init_esm_shims();
|
|
25
|
+
import path from "path";
|
|
26
|
+
function validateSkillName(name) {
|
|
27
|
+
if (!name || name.trim() === "") {
|
|
28
|
+
return "Skill name is required";
|
|
29
|
+
}
|
|
30
|
+
if (!KEBAB_CASE_PATTERN.test(name)) {
|
|
31
|
+
return "Skill name must be kebab-case (lowercase letters, numbers, and hyphens, starting with a letter)";
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
function toTitleCase(kebabCase) {
|
|
36
|
+
return kebabCase.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
37
|
+
}
|
|
38
|
+
function generateSkillMd(name) {
|
|
39
|
+
const titleName = toTitleCase(name);
|
|
40
|
+
return `---
|
|
41
|
+
name: ${name}
|
|
42
|
+
description: Brief description of this skill
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
# ${titleName}
|
|
46
|
+
|
|
47
|
+
> **Quick Guide:** Add a brief summary of what this skill teaches.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
<critical_requirements>
|
|
52
|
+
|
|
53
|
+
## CRITICAL: Before Using This Skill
|
|
54
|
+
|
|
55
|
+
**(Add critical requirements here)**
|
|
56
|
+
|
|
57
|
+
</critical_requirements>
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
**When to use:**
|
|
62
|
+
|
|
63
|
+
- Add use cases here
|
|
64
|
+
|
|
65
|
+
**Key patterns covered:**
|
|
66
|
+
|
|
67
|
+
- Add patterns here
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
<patterns>
|
|
72
|
+
|
|
73
|
+
## Core Patterns
|
|
74
|
+
|
|
75
|
+
### Pattern 1: Example Pattern
|
|
76
|
+
|
|
77
|
+
Add your patterns here.
|
|
78
|
+
|
|
79
|
+
</patterns>
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
<critical_reminders>
|
|
84
|
+
|
|
85
|
+
## CRITICAL REMINDERS
|
|
86
|
+
|
|
87
|
+
**(Repeat critical requirements here)**
|
|
88
|
+
|
|
89
|
+
</critical_reminders>
|
|
90
|
+
`;
|
|
91
|
+
}
|
|
92
|
+
function generateMetadataYaml(name, author, category, contentHash, domain) {
|
|
93
|
+
const titleName = toTitleCase(name);
|
|
94
|
+
return `# yaml-language-server: $schema=https://raw.githubusercontent.com/agents-inc/cli/main/src/schemas/custom-metadata.schema.json
|
|
95
|
+
custom: true
|
|
96
|
+
domain: ${domain}
|
|
97
|
+
category: ${category}
|
|
98
|
+
author: "${author}"
|
|
99
|
+
displayName: ${titleName}
|
|
100
|
+
slug: ${name}
|
|
101
|
+
cliDescription: Brief description
|
|
102
|
+
usageGuidance: Use when <guidance>.
|
|
103
|
+
contentHash: ${contentHash}
|
|
104
|
+
`;
|
|
105
|
+
}
|
|
106
|
+
var DEFAULT_CATEGORY_ORDER = 99;
|
|
107
|
+
var CATEGORIES_TS_COMMENT = "// Skill category definitions";
|
|
108
|
+
var RULES_TS_COMMENT = "// Skill rules configuration";
|
|
109
|
+
function formatTsExport(comment, data) {
|
|
110
|
+
const body = JSON.stringify(data, null, 2);
|
|
111
|
+
return `${comment}
|
|
112
|
+
export default ${body};
|
|
113
|
+
`;
|
|
114
|
+
}
|
|
115
|
+
function buildCategoryEntry(category, domain) {
|
|
116
|
+
const categoryPart = category.includes("-") ? category.slice(category.indexOf("-") + 1) : category;
|
|
117
|
+
const entry = {
|
|
118
|
+
id: category,
|
|
119
|
+
displayName: toTitleCase(categoryPart),
|
|
120
|
+
description: `Skills for ${toTitleCase(categoryPart)}`,
|
|
121
|
+
exclusive: true,
|
|
122
|
+
required: false,
|
|
123
|
+
order: DEFAULT_CATEGORY_ORDER,
|
|
124
|
+
custom: true
|
|
125
|
+
};
|
|
126
|
+
entry.domain = domain;
|
|
127
|
+
return entry;
|
|
128
|
+
}
|
|
129
|
+
function generateSkillCategoriesTs(category, domain) {
|
|
130
|
+
const entry = buildCategoryEntry(category, domain);
|
|
131
|
+
const data = {
|
|
132
|
+
version: DEFAULT_VERSION,
|
|
133
|
+
categories: {
|
|
134
|
+
[category]: entry
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
return formatTsExport(CATEGORIES_TS_COMMENT, data);
|
|
138
|
+
}
|
|
139
|
+
function generateSkillRulesTs() {
|
|
140
|
+
const data = {
|
|
141
|
+
version: DEFAULT_VERSION,
|
|
142
|
+
relationships: {
|
|
143
|
+
conflicts: [],
|
|
144
|
+
discourages: [],
|
|
145
|
+
recommends: [],
|
|
146
|
+
requires: [],
|
|
147
|
+
alternatives: []
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
return formatTsExport(RULES_TS_COMMENT, data);
|
|
151
|
+
}
|
|
152
|
+
async function scaffoldSkillFiles(options) {
|
|
153
|
+
const { name, author, category, domain, skillDir } = options;
|
|
154
|
+
const skillMdContent = generateSkillMd(name);
|
|
155
|
+
const skillMdPath = path.join(skillDir, STANDARD_FILES.SKILL_MD);
|
|
156
|
+
const metadataPath = path.join(skillDir, STANDARD_FILES.METADATA_YAML);
|
|
157
|
+
await writeFile(skillMdPath, skillMdContent);
|
|
158
|
+
const contentHash = await computeSkillFolderHash(skillDir);
|
|
159
|
+
const metadataContent = generateMetadataYaml(name, author, category, contentHash, domain);
|
|
160
|
+
await writeFile(metadataPath, metadataContent);
|
|
161
|
+
return { skillMdPath, metadataPath, contentHash };
|
|
162
|
+
}
|
|
163
|
+
async function updateSkillRegistryConfig(options) {
|
|
164
|
+
const { projectRoot, category, domain } = options;
|
|
165
|
+
const categoriesPath = path.join(projectRoot, SKILL_CATEGORIES_PATH);
|
|
166
|
+
const rulesPath = path.join(projectRoot, SKILL_RULES_PATH);
|
|
167
|
+
let categoriesCreated = false;
|
|
168
|
+
let categoriesUpdated = false;
|
|
169
|
+
let rulesCreated = false;
|
|
170
|
+
if (await fileExists(categoriesPath)) {
|
|
171
|
+
const parsed = await loadConfig(categoriesPath) ?? {};
|
|
172
|
+
const categories = parsed.categories ?? {};
|
|
173
|
+
if (!categories[category]) {
|
|
174
|
+
categories[category] = buildCategoryEntry(category, domain);
|
|
175
|
+
parsed.categories = categories;
|
|
176
|
+
await writeFile(categoriesPath, formatTsExport(CATEGORIES_TS_COMMENT, parsed));
|
|
177
|
+
verbose(`Added category '${category}' to ${SKILL_CATEGORIES_PATH}`);
|
|
178
|
+
categoriesUpdated = true;
|
|
179
|
+
}
|
|
180
|
+
} else {
|
|
181
|
+
await ensureDir(path.dirname(categoriesPath));
|
|
182
|
+
await writeFile(categoriesPath, generateSkillCategoriesTs(category, domain));
|
|
183
|
+
verbose(`Created ${SKILL_CATEGORIES_PATH}`);
|
|
184
|
+
categoriesCreated = true;
|
|
185
|
+
}
|
|
186
|
+
if (!await fileExists(rulesPath)) {
|
|
187
|
+
await ensureDir(path.dirname(rulesPath));
|
|
188
|
+
await writeFile(rulesPath, generateSkillRulesTs());
|
|
189
|
+
verbose(`Created ${SKILL_RULES_PATH}`);
|
|
190
|
+
rulesCreated = true;
|
|
191
|
+
}
|
|
192
|
+
return { categoriesCreated, categoriesUpdated, rulesCreated };
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export {
|
|
196
|
+
validateSkillName,
|
|
197
|
+
generateSkillCategoriesTs,
|
|
198
|
+
generateSkillRulesTs,
|
|
199
|
+
scaffoldSkillFiles,
|
|
200
|
+
updateSkillRegistryConfig
|
|
201
|
+
};
|
|
202
|
+
//# sourceMappingURL=chunk-XQK4S22C.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/lib/operations/scaffold-skill.ts"],"sourcesContent":["import path from \"path\";\nimport { loadConfig } from \"../configuration/config-loader.js\";\nimport { computeSkillFolderHash } from \"../versioning.js\";\nimport { writeFile, fileExists, ensureDir } from \"../../utils/fs.js\";\nimport { verbose } from \"../../utils/logger.js\";\nimport {\n DEFAULT_VERSION,\n KEBAB_CASE_PATTERN,\n SKILL_CATEGORIES_PATH,\n SKILL_RULES_PATH,\n STANDARD_FILES,\n} from \"../../consts.js\";\nimport type { CategoryPath } from \"../../types/index.js\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type ScaffoldSkillOptions = {\n name: string;\n author: string;\n category: CategoryPath;\n domain: string;\n skillDir: string;\n};\n\nexport type ScaffoldSkillResult = {\n skillMdPath: string;\n metadataPath: string;\n contentHash: string;\n};\n\nexport type RegistryUpdateOptions = {\n projectRoot: string;\n category: CategoryPath;\n domain: string;\n};\n\nexport type RegistryUpdateResult = {\n categoriesCreated: boolean;\n categoriesUpdated: boolean;\n rulesCreated: boolean;\n};\n\n// ---------------------------------------------------------------------------\n// Validation\n// ---------------------------------------------------------------------------\n\n/**\n * Validates that a skill name is non-empty and matches kebab-case format.\n *\n * @returns An error message string if invalid, or `null` if valid.\n */\nexport function validateSkillName(name: string): string | null {\n if (!name || name.trim() === \"\") {\n return \"Skill name is required\";\n }\n\n if (!KEBAB_CASE_PATTERN.test(name)) {\n return \"Skill name must be kebab-case (lowercase letters, numbers, and hyphens, starting with a letter)\";\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Content generation\n// ---------------------------------------------------------------------------\n\nexport function toTitleCase(kebabCase: string): string {\n return kebabCase\n .split(\"-\")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n}\n\nexport function generateSkillMd(name: string): string {\n const titleName = toTitleCase(name);\n\n return `---\nname: ${name}\ndescription: Brief description of this skill\n---\n\n# ${titleName}\n\n> **Quick Guide:** Add a brief summary of what this skill teaches.\n\n---\n\n<critical_requirements>\n\n## CRITICAL: Before Using This Skill\n\n**(Add critical requirements here)**\n\n</critical_requirements>\n\n---\n\n**When to use:**\n\n- Add use cases here\n\n**Key patterns covered:**\n\n- Add patterns here\n\n---\n\n<patterns>\n\n## Core Patterns\n\n### Pattern 1: Example Pattern\n\nAdd your patterns here.\n\n</patterns>\n\n---\n\n<critical_reminders>\n\n## CRITICAL REMINDERS\n\n**(Repeat critical requirements here)**\n\n</critical_reminders>\n`;\n}\n\nexport function generateMetadataYaml(\n name: string,\n author: string,\n category: CategoryPath,\n contentHash: string,\n domain: string,\n): string {\n const titleName = toTitleCase(name);\n\n return `# yaml-language-server: $schema=https://raw.githubusercontent.com/agents-inc/cli/main/src/schemas/custom-metadata.schema.json\ncustom: true\ndomain: ${domain}\ncategory: ${category}\nauthor: \"${author}\"\ndisplayName: ${titleName}\nslug: ${name}\ncliDescription: Brief description\nusageGuidance: Use when <guidance>.\ncontentHash: ${contentHash}\n`;\n}\n\nconst DEFAULT_CATEGORY_ORDER = 99;\n\nconst CATEGORIES_TS_COMMENT = \"// Skill category definitions\";\nconst RULES_TS_COMMENT = \"// Skill rules configuration\";\n\nfunction formatTsExport(comment: string, data: unknown): string {\n const body = JSON.stringify(data, null, 2);\n return `${comment}\\nexport default ${body};\\n`;\n}\n\nfunction buildCategoryEntry(category: CategoryPath, domain: string): Record<string, unknown> {\n const categoryPart = category.includes(\"-\")\n ? category.slice(category.indexOf(\"-\") + 1)\n : category;\n const entry: Record<string, unknown> = {\n id: category,\n displayName: toTitleCase(categoryPart),\n description: `Skills for ${toTitleCase(categoryPart)}`,\n exclusive: true,\n required: false,\n order: DEFAULT_CATEGORY_ORDER,\n custom: true,\n };\n entry.domain = domain;\n return entry;\n}\n\nexport function generateSkillCategoriesTs(category: CategoryPath, domain: string): string {\n const entry = buildCategoryEntry(category, domain);\n const data = {\n version: DEFAULT_VERSION,\n categories: {\n [category]: entry,\n },\n };\n return formatTsExport(CATEGORIES_TS_COMMENT, data);\n}\n\nexport function generateSkillRulesTs(): string {\n const data = {\n version: DEFAULT_VERSION,\n relationships: {\n conflicts: [],\n discourages: [],\n recommends: [],\n requires: [],\n alternatives: [],\n },\n };\n return formatTsExport(RULES_TS_COMMENT, data);\n}\n\n// ---------------------------------------------------------------------------\n// Scaffold operation\n// ---------------------------------------------------------------------------\n\n/**\n * Writes SKILL.md and metadata.yaml files for a new skill scaffold.\n *\n * Generates SKILL.md first, computes the content hash from the written file,\n * then generates and writes metadata.yaml with the hash included.\n *\n * Does NOT check whether the directory exists or handle --force logic;\n * the calling command is responsible for that.\n */\nexport async function scaffoldSkillFiles(\n options: ScaffoldSkillOptions,\n): Promise<ScaffoldSkillResult> {\n const { name, author, category, domain, skillDir } = options;\n\n const skillMdContent = generateSkillMd(name);\n const skillMdPath = path.join(skillDir, STANDARD_FILES.SKILL_MD);\n const metadataPath = path.join(skillDir, STANDARD_FILES.METADATA_YAML);\n\n await writeFile(skillMdPath, skillMdContent);\n\n const contentHash = await computeSkillFolderHash(skillDir);\n const metadataContent = generateMetadataYaml(name, author, category, contentHash, domain);\n await writeFile(metadataPath, metadataContent);\n\n return { skillMdPath, metadataPath, contentHash };\n}\n\n// ---------------------------------------------------------------------------\n// Registry update operation\n// ---------------------------------------------------------------------------\n\n/**\n * Updates skill-categories.ts and skill-rules.ts registry files in a\n * marketplace project.\n *\n * - If skill-categories.ts exists, appends the new category (skips if already present).\n * - If skill-categories.ts does not exist, creates it with the new category.\n * - If skill-rules.ts does not exist, creates a default one.\n *\n * Returns what was created/updated so the command can log appropriately.\n */\nexport async function updateSkillRegistryConfig(\n options: RegistryUpdateOptions,\n): Promise<RegistryUpdateResult> {\n const { projectRoot, category, domain } = options;\n\n const categoriesPath = path.join(projectRoot, SKILL_CATEGORIES_PATH);\n const rulesPath = path.join(projectRoot, SKILL_RULES_PATH);\n\n let categoriesCreated = false;\n let categoriesUpdated = false;\n let rulesCreated = false;\n\n // Update skill-categories.ts\n if (await fileExists(categoriesPath)) {\n // Boundary cast: loadConfig returns unknown structure from TS file\n const parsed = (await loadConfig<Record<string, unknown>>(categoriesPath)) ?? {};\n const categories = (parsed.categories ?? {}) as Record<string, unknown>;\n if (!categories[category]) {\n categories[category] = buildCategoryEntry(category, domain);\n parsed.categories = categories;\n await writeFile(categoriesPath, formatTsExport(CATEGORIES_TS_COMMENT, parsed));\n verbose(`Added category '${category}' to ${SKILL_CATEGORIES_PATH}`);\n categoriesUpdated = true;\n }\n } else {\n await ensureDir(path.dirname(categoriesPath));\n await writeFile(categoriesPath, generateSkillCategoriesTs(category, domain));\n verbose(`Created ${SKILL_CATEGORIES_PATH}`);\n categoriesCreated = true;\n }\n\n // Create skill-rules.ts if it doesn't exist (no aliases to update -- slugs are in metadata.yaml)\n if (!(await fileExists(rulesPath))) {\n await ensureDir(path.dirname(rulesPath));\n await writeFile(rulesPath, generateSkillRulesTs());\n verbose(`Created ${SKILL_RULES_PATH}`);\n rulesCreated = true;\n }\n\n return { categoriesCreated, categoriesUpdated, rulesCreated };\n}\n"],"mappings":"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","names":[]}
|
|
@@ -24,11 +24,11 @@ import {
|
|
|
24
24
|
addSource,
|
|
25
25
|
getSourceSummary,
|
|
26
26
|
removeSource
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-TMTUTUEV.js";
|
|
28
28
|
import {
|
|
29
29
|
getErrorMessage,
|
|
30
30
|
verbose
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-NUU3U43A.js";
|
|
32
32
|
import {
|
|
33
33
|
CLI_COLORS
|
|
34
34
|
} from "./chunk-6PGL2XMY.js";
|
|
@@ -263,4 +263,4 @@ var StepSettings = ({
|
|
|
263
263
|
export {
|
|
264
264
|
StepSettings
|
|
265
265
|
};
|
|
266
|
-
//# sourceMappingURL=chunk-
|
|
266
|
+
//# sourceMappingURL=chunk-ZOWRO7UQ.js.map
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
generateMarketplace,
|
|
4
4
|
getMarketplaceStats,
|
|
5
5
|
writeMarketplace
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-I44YG6VI.js";
|
|
7
7
|
import {
|
|
8
8
|
BaseCommand
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-MMTMXLI4.js";
|
|
10
10
|
import {
|
|
11
11
|
setVerbose
|
|
12
|
-
} from "../../chunk-
|
|
12
|
+
} from "../../chunk-NUU3U43A.js";
|
|
13
13
|
import "../../chunk-6XWHJHNZ.js";
|
|
14
14
|
import {
|
|
15
15
|
DEFAULT_BRANDING,
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
import {
|
|
3
3
|
compileAllAgentPlugins,
|
|
4
4
|
printAgentCompilationSummary
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-FBZR46GC.js";
|
|
6
6
|
import {
|
|
7
7
|
compileAllSkillPlugins,
|
|
8
8
|
compileSkillPlugin,
|
|
9
9
|
printCompilationSummary
|
|
10
|
-
} from "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
10
|
+
} from "../../chunk-TMTUTUEV.js";
|
|
11
|
+
import "../../chunk-B6MYECV6.js";
|
|
12
12
|
import "../../chunk-ANXHMG32.js";
|
|
13
13
|
import {
|
|
14
14
|
BaseCommand
|
|
15
|
-
} from "../../chunk-
|
|
15
|
+
} from "../../chunk-MMTMXLI4.js";
|
|
16
16
|
import {
|
|
17
17
|
setVerbose
|
|
18
|
-
} from "../../chunk-
|
|
18
|
+
} from "../../chunk-NUU3U43A.js";
|
|
19
19
|
import "../../chunk-6XWHJHNZ.js";
|
|
20
20
|
import {
|
|
21
21
|
DIRS
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
getAgentDefinitions
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-FBZR46GC.js";
|
|
5
5
|
import {
|
|
6
6
|
compileStackPlugin,
|
|
7
7
|
loadStacks,
|
|
8
8
|
printStackCompilationSummary
|
|
9
|
-
} from "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
9
|
+
} from "../../chunk-TMTUTUEV.js";
|
|
10
|
+
import "../../chunk-B6MYECV6.js";
|
|
11
11
|
import "../../chunk-ANXHMG32.js";
|
|
12
12
|
import {
|
|
13
13
|
BaseCommand,
|
|
14
14
|
EXIT_CODES
|
|
15
|
-
} from "../../chunk-
|
|
15
|
+
} from "../../chunk-MMTMXLI4.js";
|
|
16
16
|
import {
|
|
17
17
|
setVerbose
|
|
18
|
-
} from "../../chunk-
|
|
18
|
+
} from "../../chunk-NUU3U43A.js";
|
|
19
19
|
import "../../chunk-6XWHJHNZ.js";
|
|
20
20
|
import {
|
|
21
21
|
PROJECT_ROOT,
|
package/dist/commands/compile.js
CHANGED
|
@@ -1,47 +1,35 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
getAgentDefinitions,
|
|
4
|
-
recompileAgents
|
|
5
|
-
} from "../chunk-CYPCJ536.js";
|
|
6
2
|
import {
|
|
7
3
|
ERROR_MESSAGES,
|
|
8
4
|
INFO_MESSAGES,
|
|
9
5
|
STATUS_MESSAGES
|
|
10
6
|
} from "../chunk-B7KZLXHV.js";
|
|
11
7
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
import
|
|
20
|
-
|
|
21
|
-
} from "../chunk-YJ2URWF7.js";
|
|
8
|
+
compileAgents,
|
|
9
|
+
detectBothInstallations,
|
|
10
|
+
discoverInstalledSkills,
|
|
11
|
+
loadAgentDefs
|
|
12
|
+
} from "../chunk-DCVCFBQ7.js";
|
|
13
|
+
import "../chunk-N6A7A4RA.js";
|
|
14
|
+
import "../chunk-O5ZWS26C.js";
|
|
15
|
+
import "../chunk-XQK4S22C.js";
|
|
16
|
+
import "../chunk-FBZR46GC.js";
|
|
22
17
|
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
resolveSource
|
|
19
|
+
} from "../chunk-TMTUTUEV.js";
|
|
20
|
+
import "../chunk-B6MYECV6.js";
|
|
21
|
+
import "../chunk-ANXHMG32.js";
|
|
26
22
|
import {
|
|
27
23
|
BaseCommand,
|
|
28
24
|
EXIT_CODES
|
|
29
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-MMTMXLI4.js";
|
|
30
26
|
import {
|
|
31
|
-
directoryExists,
|
|
32
|
-
fileExists,
|
|
33
|
-
glob,
|
|
34
|
-
readFile,
|
|
35
27
|
setVerbose,
|
|
36
|
-
verbose
|
|
37
|
-
|
|
38
|
-
} from "../chunk-WJKD6EGK.js";
|
|
28
|
+
verbose
|
|
29
|
+
} from "../chunk-NUU3U43A.js";
|
|
39
30
|
import "../chunk-6XWHJHNZ.js";
|
|
40
31
|
import {
|
|
41
|
-
CLI_BIN_NAME
|
|
42
|
-
GLOBAL_INSTALL_ROOT,
|
|
43
|
-
LOCAL_SKILLS_PATH,
|
|
44
|
-
STANDARD_FILES
|
|
32
|
+
CLI_BIN_NAME
|
|
45
33
|
} from "../chunk-6PGL2XMY.js";
|
|
46
34
|
import "../chunk-NPMMU4GY.js";
|
|
47
35
|
import {
|
|
@@ -52,62 +40,6 @@ import {
|
|
|
52
40
|
init_esm_shims();
|
|
53
41
|
import { Flags } from "@oclif/core";
|
|
54
42
|
import os from "os";
|
|
55
|
-
import path from "path";
|
|
56
|
-
async function loadSkillsFromDir(skillsDir, pathPrefix = "") {
|
|
57
|
-
const skills = {};
|
|
58
|
-
if (!await directoryExists(skillsDir)) {
|
|
59
|
-
return skills;
|
|
60
|
-
}
|
|
61
|
-
const skillFiles = await glob("**/SKILL.md", skillsDir);
|
|
62
|
-
for (const skillFile of skillFiles) {
|
|
63
|
-
const skillPath = path.join(skillsDir, skillFile);
|
|
64
|
-
const skillDir = path.dirname(skillPath);
|
|
65
|
-
const relativePath = path.relative(skillsDir, skillDir);
|
|
66
|
-
const skillDirName = path.basename(skillDir);
|
|
67
|
-
const metadataPath = path.join(skillDir, STANDARD_FILES.METADATA_YAML);
|
|
68
|
-
if (!await fileExists(metadataPath)) {
|
|
69
|
-
const displayPath = pathPrefix ? `${pathPrefix}/${relativePath}/` : `${relativePath}/`;
|
|
70
|
-
warn(
|
|
71
|
-
`Skill '${skillDirName}' in '${displayPath}' is missing ${STANDARD_FILES.METADATA_YAML} \u2014 skipped. Add ${STANDARD_FILES.METADATA_YAML} to register it with the CLI.`
|
|
72
|
-
);
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
try {
|
|
76
|
-
const content = await readFile(skillPath);
|
|
77
|
-
const frontmatter = parseFrontmatter(content, skillPath);
|
|
78
|
-
if (!frontmatter?.name) {
|
|
79
|
-
warn(`Skipping skill in '${skillDirName}': missing or invalid frontmatter name`);
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
const canonicalId = frontmatter.name;
|
|
83
|
-
const skill = {
|
|
84
|
-
id: canonicalId,
|
|
85
|
-
path: pathPrefix ? `${pathPrefix}/${relativePath}/` : `${relativePath}/`,
|
|
86
|
-
description: frontmatter?.description || ""
|
|
87
|
-
};
|
|
88
|
-
skills[canonicalId] = skill;
|
|
89
|
-
verbose(` Loaded skill: ${canonicalId}`);
|
|
90
|
-
} catch (error) {
|
|
91
|
-
verbose(` Failed to load skill: ${skillFile} - ${error}`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return skills;
|
|
95
|
-
}
|
|
96
|
-
async function discoverLocalProjectSkills(projectDir) {
|
|
97
|
-
const localSkillsDir = path.join(projectDir, LOCAL_SKILLS_PATH);
|
|
98
|
-
return loadSkillsFromDir(localSkillsDir, LOCAL_SKILLS_PATH);
|
|
99
|
-
}
|
|
100
|
-
function mergeSkills(...skillSources) {
|
|
101
|
-
const merged = {};
|
|
102
|
-
for (const source of skillSources) {
|
|
103
|
-
for (const [id, skill] of typedEntries(source)) {
|
|
104
|
-
if (skill) {
|
|
105
|
-
merged[id] = skill;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return merged;
|
|
110
|
-
}
|
|
111
43
|
var Compile = class _Compile extends BaseCommand {
|
|
112
44
|
static summary = "Compile agents using local skills and agent definitions";
|
|
113
45
|
static description = "Compile agents with resolved skill references. Compiles to the Claude plugin directory.";
|
|
@@ -131,24 +63,45 @@ var Compile = class _Compile extends BaseCommand {
|
|
|
131
63
|
setVerbose(flags.verbose);
|
|
132
64
|
const cwd = process.cwd();
|
|
133
65
|
const homeDir = os.homedir();
|
|
134
|
-
const
|
|
135
|
-
|
|
66
|
+
const {
|
|
67
|
+
global: globalInstallation,
|
|
68
|
+
project: projectInstallation,
|
|
69
|
+
hasBoth: hasBothScopes
|
|
70
|
+
} = await detectBothInstallations(cwd);
|
|
136
71
|
if (!globalInstallation && !projectInstallation) {
|
|
137
72
|
this.error(ERROR_MESSAGES.NO_INSTALLATION, {
|
|
138
73
|
exit: EXIT_CODES.ERROR
|
|
139
74
|
});
|
|
140
75
|
}
|
|
141
|
-
|
|
142
|
-
|
|
76
|
+
this.log(STATUS_MESSAGES.RESOLVING_SOURCE);
|
|
77
|
+
try {
|
|
78
|
+
const sourceConfig = await resolveSource(flags.source);
|
|
79
|
+
this.log(`Source: ${sourceConfig.sourceOrigin}`);
|
|
80
|
+
} catch (error) {
|
|
81
|
+
this.log(ERROR_MESSAGES.FAILED_RESOLVE_SOURCE);
|
|
82
|
+
this.handleError(error);
|
|
83
|
+
}
|
|
84
|
+
this.log(
|
|
85
|
+
flags["agent-source"] ? STATUS_MESSAGES.FETCHING_AGENT_PARTIALS : STATUS_MESSAGES.LOADING_AGENT_PARTIALS
|
|
86
|
+
);
|
|
87
|
+
let agentDefs;
|
|
88
|
+
try {
|
|
89
|
+
const defs = await loadAgentDefs(flags["agent-source"], { projectDir: cwd });
|
|
90
|
+
this.log(flags["agent-source"] ? "Agent partials fetched" : "Agent partials loaded");
|
|
91
|
+
verbose(` Agents: ${defs.agentSourcePaths.agentsDir}`);
|
|
92
|
+
verbose(` Templates: ${defs.agentSourcePaths.templatesDir}`);
|
|
93
|
+
agentDefs = defs;
|
|
94
|
+
} catch (error) {
|
|
95
|
+
this.log(ERROR_MESSAGES.FAILED_LOAD_AGENT_PARTIALS);
|
|
96
|
+
return this.handleError(error);
|
|
97
|
+
}
|
|
143
98
|
let totalPassesWithSkills = 0;
|
|
144
|
-
const hasBothScopes = !!globalInstallation && !!projectInstallation;
|
|
145
99
|
if (globalInstallation) {
|
|
146
100
|
const hadSkills = await this.runCompilePass({
|
|
147
101
|
label: "Global",
|
|
148
102
|
projectDir: homeDir,
|
|
149
103
|
installation: globalInstallation,
|
|
150
|
-
agentDefs,
|
|
151
|
-
flags,
|
|
104
|
+
sourcePath: agentDefs.sourcePath,
|
|
152
105
|
scopeFilter: hasBothScopes ? "global" : void 0
|
|
153
106
|
});
|
|
154
107
|
if (hadSkills) totalPassesWithSkills++;
|
|
@@ -158,8 +111,7 @@ var Compile = class _Compile extends BaseCommand {
|
|
|
158
111
|
label: "Project",
|
|
159
112
|
projectDir: cwd,
|
|
160
113
|
installation: projectInstallation,
|
|
161
|
-
agentDefs,
|
|
162
|
-
flags,
|
|
114
|
+
sourcePath: agentDefs.sourcePath,
|
|
163
115
|
scopeFilter: hasBothScopes ? "project" : void 0
|
|
164
116
|
});
|
|
165
117
|
if (hadSkills) totalPassesWithSkills++;
|
|
@@ -171,46 +123,26 @@ var Compile = class _Compile extends BaseCommand {
|
|
|
171
123
|
);
|
|
172
124
|
}
|
|
173
125
|
}
|
|
174
|
-
async discoverAllSkills(projectDir
|
|
126
|
+
async discoverAllSkills(projectDir) {
|
|
175
127
|
this.log(STATUS_MESSAGES.DISCOVERING_SKILLS);
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
if (globalPluginSkillCount > 0) {
|
|
180
|
-
verbose(` Found ${globalPluginSkillCount} skills from global plugins`);
|
|
181
|
-
}
|
|
182
|
-
const globalLocalSkillsDir = path.join(GLOBAL_INSTALL_ROOT, LOCAL_SKILLS_PATH);
|
|
183
|
-
const globalLocalSkills = isGlobalProject ? {} : await loadSkillsFromDir(globalLocalSkillsDir, LOCAL_SKILLS_PATH);
|
|
184
|
-
const globalLocalSkillCount = typedKeys(globalLocalSkills).length;
|
|
185
|
-
if (globalLocalSkillCount > 0) {
|
|
186
|
-
verbose(` Found ${globalLocalSkillCount} global local skills from ~/.claude/skills/`);
|
|
128
|
+
const result = await discoverInstalledSkills(projectDir);
|
|
129
|
+
if (result.totalSkillCount === 0) {
|
|
130
|
+
return result;
|
|
187
131
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
verbose(` Found ${pluginSkillCount} skills from installed plugins`);
|
|
191
|
-
const localSkills = await discoverLocalProjectSkills(projectDir);
|
|
192
|
-
const localSkillCount = typedKeys(localSkills).length;
|
|
193
|
-
verbose(` Found ${localSkillCount} local skills from .claude/skills/`);
|
|
194
|
-
const allSkills = mergeSkills(globalPluginSkills, globalLocalSkills, pluginSkills, localSkills);
|
|
195
|
-
const totalSkillCount = typedKeys(allSkills).length;
|
|
196
|
-
if (totalSkillCount === 0) {
|
|
197
|
-
return { allSkills, totalSkillCount };
|
|
198
|
-
}
|
|
199
|
-
const totalPluginSkillCount = globalPluginSkillCount + pluginSkillCount;
|
|
200
|
-
if (totalPluginSkillCount > 0 && totalSkillCount > totalPluginSkillCount) {
|
|
201
|
-
const localCount = totalSkillCount - totalPluginSkillCount;
|
|
132
|
+
if (result.pluginSkillCount > 0 && result.totalSkillCount > result.pluginSkillCount) {
|
|
133
|
+
const localCount = result.totalSkillCount - result.pluginSkillCount;
|
|
202
134
|
this.log(
|
|
203
|
-
`Discovered ${totalSkillCount} skills (${
|
|
135
|
+
`Discovered ${result.totalSkillCount} skills (${result.pluginSkillCount} from plugins, ${localCount} local)`
|
|
204
136
|
);
|
|
205
|
-
} else if (
|
|
206
|
-
this.log(`Discovered ${
|
|
137
|
+
} else if (result.pluginSkillCount > 0) {
|
|
138
|
+
this.log(`Discovered ${result.pluginSkillCount} skills from plugins`);
|
|
207
139
|
} else {
|
|
208
|
-
this.log(`Discovered ${totalSkillCount} local skills`);
|
|
140
|
+
this.log(`Discovered ${result.totalSkillCount} local skills`);
|
|
209
141
|
}
|
|
210
|
-
return
|
|
142
|
+
return result;
|
|
211
143
|
}
|
|
212
144
|
async runCompilePass(params) {
|
|
213
|
-
const { label, projectDir, installation,
|
|
145
|
+
const { label, projectDir, installation, sourcePath, scopeFilter } = params;
|
|
214
146
|
this.log("");
|
|
215
147
|
this.log(`Compiling ${label.toLowerCase()} agents...`);
|
|
216
148
|
this.log("");
|
|
@@ -221,19 +153,15 @@ var Compile = class _Compile extends BaseCommand {
|
|
|
221
153
|
this.log(`No skills found for ${label.toLowerCase()} pass, skipping`);
|
|
222
154
|
return false;
|
|
223
155
|
}
|
|
224
|
-
const loadedConfig = await loadProjectConfigFromDir(projectDir);
|
|
225
|
-
const agentScopeMap = loadedConfig?.config ? buildAgentScopeMap(loadedConfig.config) : void 0;
|
|
226
|
-
const filteredAgents = scopeFilter && loadedConfig?.config?.agents ? loadedConfig.config.agents.filter((a) => a.scope === scopeFilter).map((a) => a.name) : void 0;
|
|
227
156
|
this.log(STATUS_MESSAGES.RECOMPILING_AGENTS);
|
|
228
157
|
try {
|
|
229
|
-
const recompileResult = await
|
|
230
|
-
pluginDir: projectDir,
|
|
231
|
-
sourcePath: agentDefs.sourcePath,
|
|
232
|
-
skills: allSkills,
|
|
158
|
+
const recompileResult = await compileAgents({
|
|
233
159
|
projectDir,
|
|
160
|
+
sourcePath,
|
|
161
|
+
skills: allSkills,
|
|
162
|
+
pluginDir: projectDir,
|
|
234
163
|
outputDir: installation.agentsDir,
|
|
235
|
-
|
|
236
|
-
agents: filteredAgents
|
|
164
|
+
scopeFilter
|
|
237
165
|
});
|
|
238
166
|
if (recompileResult.failed.length > 0) {
|
|
239
167
|
this.log(
|
|
@@ -259,34 +187,6 @@ var Compile = class _Compile extends BaseCommand {
|
|
|
259
187
|
this.log("");
|
|
260
188
|
return true;
|
|
261
189
|
}
|
|
262
|
-
async resolveSourceForCompile(flags) {
|
|
263
|
-
this.log(STATUS_MESSAGES.RESOLVING_SOURCE);
|
|
264
|
-
try {
|
|
265
|
-
const sourceConfig = await resolveSource(flags.source);
|
|
266
|
-
this.log(`Source: ${sourceConfig.sourceOrigin}`);
|
|
267
|
-
} catch (error) {
|
|
268
|
-
this.log(ERROR_MESSAGES.FAILED_RESOLVE_SOURCE);
|
|
269
|
-
this.handleError(error);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
async loadAgentDefsForCompile(flags) {
|
|
273
|
-
const projectDir = process.cwd();
|
|
274
|
-
this.log(
|
|
275
|
-
flags["agent-source"] ? STATUS_MESSAGES.FETCHING_AGENT_PARTIALS : STATUS_MESSAGES.LOADING_AGENT_PARTIALS
|
|
276
|
-
);
|
|
277
|
-
try {
|
|
278
|
-
const agentDefs = await getAgentDefinitions(flags["agent-source"], {
|
|
279
|
-
projectDir
|
|
280
|
-
});
|
|
281
|
-
this.log(flags["agent-source"] ? "Agent partials fetched" : "Agent partials loaded");
|
|
282
|
-
verbose(` Agents: ${agentDefs.agentsDir}`);
|
|
283
|
-
verbose(` Templates: ${agentDefs.templatesDir}`);
|
|
284
|
-
return agentDefs;
|
|
285
|
-
} catch (error) {
|
|
286
|
-
this.log(ERROR_MESSAGES.FAILED_LOAD_AGENT_PARTIALS);
|
|
287
|
-
return this.handleError(error);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
190
|
};
|
|
291
191
|
export {
|
|
292
192
|
Compile as default
|