agents-united 1.0.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.
Files changed (128) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +2 -0
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.js +542 -0
  5. package/dist/cli.js.map +1 -0
  6. package/package.json +70 -0
  7. package/registry/agents/orchestrator-business.md +24 -0
  8. package/registry/agents/orchestrator-design.md +30 -0
  9. package/registry/agents/orchestrator-engineering.md +44 -0
  10. package/registry/agents/orchestrator-marketing.md +24 -0
  11. package/registry/agents/orchestrator-research.md +24 -0
  12. package/registry/agents/orchestrator-security.md +29 -0
  13. package/registry/agents/orchestrator-system-architecture.md +29 -0
  14. package/registry/agents/subagent-backend-architect.md +19 -0
  15. package/registry/agents/subagent-business-panel-experts.md +16 -0
  16. package/registry/agents/subagent-code-reviewer.md +17 -0
  17. package/registry/agents/subagent-deep-research.md +17 -0
  18. package/registry/agents/subagent-design-ops-lead.md +16 -0
  19. package/registry/agents/subagent-design-researcher.md +16 -0
  20. package/registry/agents/subagent-design-systems-architect.md +17 -0
  21. package/registry/agents/subagent-designer-toolkit-expert.md +16 -0
  22. package/registry/agents/subagent-frontend-architect.md +19 -0
  23. package/registry/agents/subagent-interaction-designer.md +16 -0
  24. package/registry/agents/subagent-marketing-campaign-specialist.md +16 -0
  25. package/registry/agents/subagent-marketing-content-strategist.md +16 -0
  26. package/registry/agents/subagent-marketing-conversion-specialist.md +16 -0
  27. package/registry/agents/subagent-marketing-growth-strategist.md +16 -0
  28. package/registry/agents/subagent-prototype-tester.md +16 -0
  29. package/registry/agents/subagent-repo-index.md +17 -0
  30. package/registry/agents/subagent-security-engineer.md +17 -0
  31. package/registry/agents/subagent-socratic-mentor.md +15 -0
  32. package/registry/agents/subagent-system-architect.md +18 -0
  33. package/registry/agents/subagent-ui-designer.md +17 -0
  34. package/registry/agents/subagent-ux-strategist.md +16 -0
  35. package/registry/bundles.json +334 -0
  36. package/registry/rules/GEMINI.md +6 -0
  37. package/registry/skills/ab-test-setup/SKILL.md +13 -0
  38. package/registry/skills/analytics-tracking/SKILL.md +13 -0
  39. package/registry/skills/architecture-design/SKILL.md +13 -0
  40. package/registry/skills/brainstorming/SKILL.md +13 -0
  41. package/registry/skills/browser-agent/SKILL.md +13 -0
  42. package/registry/skills/campaign-strategy/SKILL.md +13 -0
  43. package/registry/skills/competitor-alternatives/SKILL.md +13 -0
  44. package/registry/skills/confidence-check/SKILL.md +13 -0
  45. package/registry/skills/copy-editing/SKILL.md +13 -0
  46. package/registry/skills/copywriting/SKILL.md +13 -0
  47. package/registry/skills/deep-research/SKILL.md +13 -0
  48. package/registry/skills/dependency-management/SKILL.md +13 -0
  49. package/registry/skills/design-ops/SKILL.md +13 -0
  50. package/registry/skills/design-research/SKILL.md +13 -0
  51. package/registry/skills/design-systems/SKILL.md +13 -0
  52. package/registry/skills/designer-toolkit/SKILL.md +13 -0
  53. package/registry/skills/email-sequence/SKILL.md +13 -0
  54. package/registry/skills/executing-plans/SKILL.md +13 -0
  55. package/registry/skills/finishing-a-development-branch/SKILL.md +13 -0
  56. package/registry/skills/form-cro/SKILL.md +13 -0
  57. package/registry/skills/free-tool-strategy/SKILL.md +13 -0
  58. package/registry/skills/interaction-design/SKILL.md +13 -0
  59. package/registry/skills/launch-strategy/SKILL.md +13 -0
  60. package/registry/skills/marketing-ideas/SKILL.md +13 -0
  61. package/registry/skills/marketing-psychology/SKILL.md +13 -0
  62. package/registry/skills/onboarding-cro/SKILL.md +13 -0
  63. package/registry/skills/page-cro/SKILL.md +13 -0
  64. package/registry/skills/paid-ads/SKILL.md +13 -0
  65. package/registry/skills/paywall-upgrade-cro/SKILL.md +13 -0
  66. package/registry/skills/performance-optimization/SKILL.md +13 -0
  67. package/registry/skills/popup-cro/SKILL.md +13 -0
  68. package/registry/skills/pricing-strategy/SKILL.md +13 -0
  69. package/registry/skills/programmatic-seo/SKILL.md +13 -0
  70. package/registry/skills/prototyping-testing/SKILL.md +13 -0
  71. package/registry/skills/receiving-code-review/SKILL.md +13 -0
  72. package/registry/skills/referral-program/SKILL.md +13 -0
  73. package/registry/skills/requesting-code-review/SKILL.md +13 -0
  74. package/registry/skills/schema-markup/SKILL.md +13 -0
  75. package/registry/skills/security-review/SKILL.md +13 -0
  76. package/registry/skills/seo-audit/SKILL.md +13 -0
  77. package/registry/skills/signup-flow-cro/SKILL.md +13 -0
  78. package/registry/skills/social-content/SKILL.md +13 -0
  79. package/registry/skills/subagent-driven-development/SKILL.md +13 -0
  80. package/registry/skills/systematic-debugging/SKILL.md +13 -0
  81. package/registry/skills/test-driven-development/SKILL.md +13 -0
  82. package/registry/skills/ui-design/SKILL.md +13 -0
  83. package/registry/skills/ux-strategy/SKILL.md +13 -0
  84. package/registry/skills/writing-plans/SKILL.md +13 -0
  85. package/registry/workflows/workflow-analyze.md +15 -0
  86. package/registry/workflows/workflow-brainstorm.md +15 -0
  87. package/registry/workflows/workflow-build.md +15 -0
  88. package/registry/workflows/workflow-business-panel.md +15 -0
  89. package/registry/workflows/workflow-cleanup.md +15 -0
  90. package/registry/workflows/workflow-design-code.md +15 -0
  91. package/registry/workflows/workflow-design-ops--handoff.md +15 -0
  92. package/registry/workflows/workflow-design-ops--plan-sprint.md +15 -0
  93. package/registry/workflows/workflow-design-ops--setup-workflow.md +15 -0
  94. package/registry/workflows/workflow-design-orchestrate.md +15 -0
  95. package/registry/workflows/workflow-design-systems--audit-system.md +15 -0
  96. package/registry/workflows/workflow-design-systems--create-component.md +15 -0
  97. package/registry/workflows/workflow-design-systems--tokenize.md +15 -0
  98. package/registry/workflows/workflow-estimate.md +15 -0
  99. package/registry/workflows/workflow-explain.md +15 -0
  100. package/registry/workflows/workflow-git.md +15 -0
  101. package/registry/workflows/workflow-implement.md +15 -0
  102. package/registry/workflows/workflow-interaction-design--design-interaction.md +15 -0
  103. package/registry/workflows/workflow-interaction-design--error-flow.md +15 -0
  104. package/registry/workflows/workflow-interaction-design--map-states.md +15 -0
  105. package/registry/workflows/workflow-marketing-audit.md +15 -0
  106. package/registry/workflows/workflow-marketing-campaign-builder.md +15 -0
  107. package/registry/workflows/workflow-marketing-content-pipeline.md +15 -0
  108. package/registry/workflows/workflow-marketing-growth-experiment.md +15 -0
  109. package/registry/workflows/workflow-marketing-launch.md +15 -0
  110. package/registry/workflows/workflow-marketing-panel.md +15 -0
  111. package/registry/workflows/workflow-plan.md +15 -0
  112. package/registry/workflows/workflow-prototyping-testing--evaluate.md +15 -0
  113. package/registry/workflows/workflow-prototyping-testing--experiment.md +15 -0
  114. package/registry/workflows/workflow-prototyping-testing--prototype-plan.md +15 -0
  115. package/registry/workflows/workflow-prototyping-testing--test-plan.md +15 -0
  116. package/registry/workflows/workflow-recommend.md +15 -0
  117. package/registry/workflows/workflow-research.md +15 -0
  118. package/registry/workflows/workflow-review.md +15 -0
  119. package/registry/workflows/workflow-spec-panel.md +15 -0
  120. package/registry/workflows/workflow-test.md +15 -0
  121. package/registry/workflows/workflow-troubleshoot.md +15 -0
  122. package/registry/workflows/workflow-ui-design--color-palette.md +15 -0
  123. package/registry/workflows/workflow-ui-design--design-screen.md +15 -0
  124. package/registry/workflows/workflow-ui-design--responsive-audit.md +15 -0
  125. package/registry/workflows/workflow-ui-design--type-system.md +15 -0
  126. package/registry/workflows/workflow-ux-strategy--benchmark.md +15 -0
  127. package/registry/workflows/workflow-ux-strategy--frame-problem.md +15 -0
  128. package/registry/workflows/workflow-ux-strategy--strategize.md +15 -0
package/dist/cli.js ADDED
@@ -0,0 +1,542 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/cli.ts
4
+ import { cac } from "cac";
5
+ import pc from "picocolors";
6
+ import { intro, outro, spinner, note } from "@clack/prompts";
7
+
8
+ // src/core/registry.ts
9
+ import path from "path";
10
+ import fs from "fs-extra";
11
+ import { fileURLToPath } from "url";
12
+ var __filename = fileURLToPath(import.meta.url);
13
+ var __dirname = path.dirname(__filename);
14
+ var RegistryResolver = class {
15
+ registryDir;
16
+ bundlesManifest = null;
17
+ constructor(customRegistryDir) {
18
+ if (customRegistryDir) {
19
+ this.registryDir = path.resolve(customRegistryDir);
20
+ } else {
21
+ const candidatePaths = [
22
+ path.resolve(__dirname, "../registry"),
23
+ path.resolve(__dirname, "../../registry"),
24
+ path.resolve(process.cwd(), "registry")
25
+ ];
26
+ const found = candidatePaths.find((p) => fs.existsSync(path.join(p, "bundles.json")));
27
+ this.registryDir = found || candidatePaths[0];
28
+ }
29
+ }
30
+ getRegistryDir() {
31
+ return this.registryDir;
32
+ }
33
+ async loadBundles() {
34
+ if (this.bundlesManifest) {
35
+ return this.bundlesManifest;
36
+ }
37
+ const manifestPath = path.join(this.registryDir, "bundles.json");
38
+ if (!await fs.pathExists(manifestPath)) {
39
+ throw new Error(`Registry bundles.json not found at ${manifestPath}`);
40
+ }
41
+ this.bundlesManifest = await fs.readJson(manifestPath);
42
+ return this.bundlesManifest;
43
+ }
44
+ async getBundle(bundleName) {
45
+ const manifest = await this.loadBundles();
46
+ return manifest.bundles[bundleName] || null;
47
+ }
48
+ async listBundles() {
49
+ const manifest = await this.loadBundles();
50
+ return Object.values(manifest.bundles);
51
+ }
52
+ async resolve(identifier) {
53
+ const manifest = await this.loadBundles();
54
+ const bundle = manifest.bundles[identifier];
55
+ if (bundle) {
56
+ const agents = /* @__PURE__ */ new Set();
57
+ if (bundle.orchestrator) agents.add(bundle.orchestrator);
58
+ if (bundle.agents) bundle.agents.forEach((a) => agents.add(a));
59
+ const skills = new Set(bundle.skills || []);
60
+ const workflows = new Set(bundle.workflows || []);
61
+ const rules = ["GEMINI.md"];
62
+ return {
63
+ targetBundle: bundle.name,
64
+ agents: Array.from(agents),
65
+ skills: Array.from(skills),
66
+ workflows: Array.from(workflows),
67
+ rules
68
+ };
69
+ }
70
+ const agentPath = path.join(this.registryDir, "agents", identifier.endsWith(".md") ? identifier : `${identifier}.md`);
71
+ if (await fs.pathExists(agentPath)) {
72
+ return {
73
+ agents: [path.basename(agentPath)],
74
+ skills: [],
75
+ workflows: [],
76
+ rules: []
77
+ };
78
+ }
79
+ const skillPath = path.join(this.registryDir, "skills", identifier);
80
+ if (await fs.pathExists(skillPath)) {
81
+ return {
82
+ agents: [],
83
+ skills: [identifier],
84
+ workflows: [],
85
+ rules: []
86
+ };
87
+ }
88
+ const workflowFileName = identifier.startsWith("workflow-") ? `${identifier}.md` : `workflow-${identifier}.md`;
89
+ const workflowPath = path.join(this.registryDir, "workflows", workflowFileName);
90
+ if (await fs.pathExists(workflowPath)) {
91
+ return {
92
+ agents: [],
93
+ skills: [],
94
+ workflows: [path.basename(workflowPath)],
95
+ rules: []
96
+ };
97
+ }
98
+ throw new Error(`Item or bundle "${identifier}" not found in registry.`);
99
+ }
100
+ async find(query) {
101
+ const manifest = await this.loadBundles();
102
+ const q = query.toLowerCase();
103
+ const matchedBundles = Object.values(manifest.bundles).filter(
104
+ (b) => b.name.toLowerCase().includes(q) || b.description.toLowerCase().includes(q)
105
+ );
106
+ const agentsDir = path.join(this.registryDir, "agents");
107
+ let matchedAgents = [];
108
+ if (await fs.pathExists(agentsDir)) {
109
+ const files = await fs.readdir(agentsDir);
110
+ matchedAgents = files.filter((f) => f.toLowerCase().includes(q));
111
+ }
112
+ const skillsDir = path.join(this.registryDir, "skills");
113
+ let matchedSkills = [];
114
+ if (await fs.pathExists(skillsDir)) {
115
+ const dirs = await fs.readdir(skillsDir);
116
+ matchedSkills = dirs.filter((d) => d.toLowerCase().includes(q));
117
+ }
118
+ return {
119
+ bundles: matchedBundles,
120
+ agents: matchedAgents,
121
+ skills: matchedSkills
122
+ };
123
+ }
124
+ };
125
+
126
+ // src/core/installer.ts
127
+ import path3 from "path";
128
+ import crypto from "crypto";
129
+ import fs2 from "fs-extra";
130
+
131
+ // src/core/adapter.ts
132
+ import path2 from "path";
133
+ import os from "os";
134
+ var TargetAdapter = class {
135
+ static resolveTargetDir(scope = "workspace", overrideDir) {
136
+ if (overrideDir) {
137
+ return path2.resolve(overrideDir);
138
+ }
139
+ if (scope === "global") {
140
+ const home = os.homedir();
141
+ return path2.join(home, ".gemini", "config");
142
+ }
143
+ return path2.resolve(process.cwd(), ".agents");
144
+ }
145
+ static getSubPaths(targetDir) {
146
+ return {
147
+ agentsDir: path2.join(targetDir, "agents"),
148
+ skillsDir: path2.join(targetDir, "skills"),
149
+ workflowsDir: path2.join(targetDir, "workflows"),
150
+ rulesDir: path2.join(targetDir, "rules"),
151
+ lockfile: path2.join(targetDir, "agents-united.json")
152
+ };
153
+ }
154
+ };
155
+
156
+ // src/core/installer.ts
157
+ var InstallEngine = class {
158
+ registry;
159
+ constructor(registry2) {
160
+ this.registry = registry2 || new RegistryResolver();
161
+ }
162
+ async calculateHash(filePath) {
163
+ const buffer = await fs2.readFile(filePath);
164
+ return "sha256:" + crypto.createHash("sha256").update(buffer).digest("hex");
165
+ }
166
+ async readLockfile(lockfilePath) {
167
+ if (await fs2.pathExists(lockfilePath)) {
168
+ try {
169
+ return await fs2.readJson(lockfilePath);
170
+ } catch {
171
+ }
172
+ }
173
+ return {
174
+ $schema: "https://agents-united.dev/schema/lockfile.v1.json",
175
+ version: 1,
176
+ installed: {
177
+ bundles: [],
178
+ agents: [],
179
+ skills: [],
180
+ workflows: []
181
+ },
182
+ files: {}
183
+ };
184
+ }
185
+ async install(identifier, options = {}) {
186
+ const scope = options.global ? "global" : options.scope || "workspace";
187
+ const targetDir = TargetAdapter.resolveTargetDir(scope, options.targetDir);
188
+ const subPaths = TargetAdapter.getSubPaths(targetDir);
189
+ const resolved = await this.registry.resolve(identifier);
190
+ const registryDir = this.registry.getRegistryDir();
191
+ if (options.dryRun) {
192
+ return { installed: resolved, targetDir, dryRun: true };
193
+ }
194
+ await fs2.ensureDir(subPaths.agentsDir);
195
+ await fs2.ensureDir(subPaths.skillsDir);
196
+ await fs2.ensureDir(subPaths.workflowsDir);
197
+ await fs2.ensureDir(subPaths.rulesDir);
198
+ const lockfile = await this.readLockfile(subPaths.lockfile);
199
+ const now = (/* @__PURE__ */ new Date()).toISOString();
200
+ for (const agentFile of resolved.agents) {
201
+ const src = path3.join(registryDir, "agents", agentFile);
202
+ const dest = path3.join(subPaths.agentsDir, agentFile);
203
+ if (await fs2.pathExists(dest) && !options.force) {
204
+ const existingHash = await this.calculateHash(dest);
205
+ const relPath2 = path3.relative(targetDir, dest);
206
+ if (lockfile.files[relPath2] && lockfile.files[relPath2].hash !== existingHash) {
207
+ throw new Error(`File ${relPath2} has user modifications. Use --force to overwrite.`);
208
+ }
209
+ }
210
+ await fs2.copy(src, dest, { overwrite: true });
211
+ const hash = await this.calculateHash(dest);
212
+ const relPath = path3.relative(targetDir, dest);
213
+ lockfile.files[relPath] = {
214
+ hash,
215
+ bundle: resolved.targetBundle,
216
+ installedAt: now
217
+ };
218
+ if (!lockfile.installed.agents.includes(agentFile)) {
219
+ lockfile.installed.agents.push(agentFile);
220
+ }
221
+ }
222
+ for (const skillName of resolved.skills) {
223
+ const src = path3.join(registryDir, "skills", skillName);
224
+ const dest = path3.join(subPaths.skillsDir, skillName);
225
+ if (await fs2.pathExists(dest) && !options.force) {
226
+ }
227
+ await fs2.copy(src, dest, { overwrite: true });
228
+ const skillFile = path3.join(dest, "SKILL.md");
229
+ if (await fs2.pathExists(skillFile)) {
230
+ const hash = await this.calculateHash(skillFile);
231
+ const relPath = path3.relative(targetDir, skillFile);
232
+ lockfile.files[relPath] = {
233
+ hash,
234
+ bundle: resolved.targetBundle,
235
+ installedAt: now
236
+ };
237
+ }
238
+ if (!lockfile.installed.skills.includes(skillName)) {
239
+ lockfile.installed.skills.push(skillName);
240
+ }
241
+ }
242
+ for (const workflowFile of resolved.workflows) {
243
+ const src = path3.join(registryDir, "workflows", workflowFile);
244
+ const dest = path3.join(subPaths.workflowsDir, workflowFile);
245
+ await fs2.copy(src, dest, { overwrite: true });
246
+ const hash = await this.calculateHash(dest);
247
+ const relPath = path3.relative(targetDir, dest);
248
+ lockfile.files[relPath] = {
249
+ hash,
250
+ bundle: resolved.targetBundle,
251
+ installedAt: now
252
+ };
253
+ if (!lockfile.installed.workflows.includes(workflowFile)) {
254
+ lockfile.installed.workflows.push(workflowFile);
255
+ }
256
+ }
257
+ for (const ruleFile of resolved.rules) {
258
+ const src = path3.join(registryDir, "rules", ruleFile);
259
+ const dest = path3.join(subPaths.rulesDir, ruleFile);
260
+ if (await fs2.pathExists(src)) {
261
+ await fs2.copy(src, dest, { overwrite: true });
262
+ const hash = await this.calculateHash(dest);
263
+ const relPath = path3.relative(targetDir, dest);
264
+ lockfile.files[relPath] = {
265
+ hash,
266
+ bundle: resolved.targetBundle,
267
+ installedAt: now
268
+ };
269
+ }
270
+ }
271
+ if (resolved.targetBundle && !lockfile.installed.bundles.includes(resolved.targetBundle)) {
272
+ lockfile.installed.bundles.push(resolved.targetBundle);
273
+ }
274
+ await fs2.writeJson(subPaths.lockfile, lockfile, { spaces: 2 });
275
+ return { installed: resolved, targetDir, dryRun: false };
276
+ }
277
+ };
278
+
279
+ // src/core/uninstaller.ts
280
+ import path4 from "path";
281
+ import crypto2 from "crypto";
282
+ import fs3 from "fs-extra";
283
+ var UninstallEngine = class {
284
+ registry;
285
+ constructor(registry2) {
286
+ this.registry = registry2 || new RegistryResolver();
287
+ }
288
+ async calculateHash(filePath) {
289
+ const buffer = await fs3.readFile(filePath);
290
+ return "sha256:" + crypto2.createHash("sha256").update(buffer).digest("hex");
291
+ }
292
+ async uninstall(identifier, options = {}) {
293
+ const scope = options.global ? "global" : options.scope || "workspace";
294
+ const targetDir = TargetAdapter.resolveTargetDir(scope, options.targetDir);
295
+ const subPaths = TargetAdapter.getSubPaths(targetDir);
296
+ if (!await fs3.pathExists(subPaths.lockfile)) {
297
+ throw new Error(`No agents-united.json lockfile found in ${targetDir}. Nothing to uninstall.`);
298
+ }
299
+ const lockfile = await fs3.readJson(subPaths.lockfile);
300
+ const resolved = await this.registry.resolve(identifier).catch(() => null);
301
+ const removedFiles = [];
302
+ if (resolved && resolved.targetBundle) {
303
+ const bundleName = resolved.targetBundle;
304
+ if (!lockfile.installed.bundles.includes(bundleName)) {
305
+ throw new Error(`Bundle "${bundleName}" is not currently installed.`);
306
+ }
307
+ if (options.dryRun) {
308
+ return { removed: resolved.agents.concat(resolved.skills, resolved.workflows), targetDir, dryRun: true };
309
+ }
310
+ for (const [relPath, assetMeta] of Object.entries(lockfile.files)) {
311
+ if (assetMeta.bundle === bundleName) {
312
+ const fullPath = path4.join(targetDir, relPath);
313
+ if (await fs3.pathExists(fullPath)) {
314
+ if (!options.force) {
315
+ const currentHash = await this.calculateHash(fullPath).catch(() => null);
316
+ if (currentHash && currentHash !== assetMeta.hash) {
317
+ throw new Error(`File ${relPath} has user modifications. Use --force to remove.`);
318
+ }
319
+ }
320
+ await fs3.remove(fullPath);
321
+ removedFiles.push(relPath);
322
+ }
323
+ delete lockfile.files[relPath];
324
+ }
325
+ }
326
+ lockfile.installed.bundles = lockfile.installed.bundles.filter((b) => b !== bundleName);
327
+ if (resolved.agents) {
328
+ lockfile.installed.agents = lockfile.installed.agents.filter((a) => !resolved.agents.includes(a));
329
+ }
330
+ if (resolved.skills) {
331
+ lockfile.installed.skills = lockfile.installed.skills.filter((s) => !resolved.skills.includes(s));
332
+ }
333
+ if (resolved.workflows) {
334
+ lockfile.installed.workflows = lockfile.installed.workflows.filter((w) => !resolved.workflows.includes(w));
335
+ }
336
+ await fs3.writeJson(subPaths.lockfile, lockfile, { spaces: 2 });
337
+ return { removed: removedFiles, targetDir, dryRun: false };
338
+ }
339
+ const itemTargetRelPaths = Object.keys(lockfile.files).filter((p) => p.includes(identifier));
340
+ if (itemTargetRelPaths.length === 0) {
341
+ throw new Error(`No installed assets found matching "${identifier}".`);
342
+ }
343
+ if (options.dryRun) {
344
+ return { removed: itemTargetRelPaths, targetDir, dryRun: true };
345
+ }
346
+ for (const relPath of itemTargetRelPaths) {
347
+ const fullPath = path4.join(targetDir, relPath);
348
+ if (await fs3.pathExists(fullPath)) {
349
+ if (!options.force) {
350
+ const currentHash = await this.calculateHash(fullPath).catch(() => null);
351
+ const assetMeta = lockfile.files[relPath];
352
+ if (currentHash && assetMeta && currentHash !== assetMeta.hash) {
353
+ throw new Error(`File ${relPath} has user modifications. Use --force to remove.`);
354
+ }
355
+ }
356
+ await fs3.remove(fullPath);
357
+ removedFiles.push(relPath);
358
+ }
359
+ delete lockfile.files[relPath];
360
+ }
361
+ await fs3.writeJson(subPaths.lockfile, lockfile, { spaces: 2 });
362
+ return { removed: removedFiles, targetDir, dryRun: false };
363
+ }
364
+ };
365
+
366
+ // src/core/doctor.ts
367
+ import path5 from "path";
368
+ import fs4 from "fs-extra";
369
+ import parseYaml from "yaml";
370
+ var DoctorEngine = class {
371
+ static async runDoctor(targetDir) {
372
+ const root = TargetAdapter.resolveTargetDir("workspace", targetDir);
373
+ const subPaths = TargetAdapter.getSubPaths(root);
374
+ const issues = [];
375
+ const warnings = [];
376
+ let agentsCount = 0;
377
+ let skillsCount = 0;
378
+ let workflowsCount = 0;
379
+ if (!await fs4.pathExists(subPaths.lockfile)) {
380
+ warnings.push(`No lockfile found at ${subPaths.lockfile}. Workspace might not be initialized.`);
381
+ } else {
382
+ try {
383
+ const manifest = await fs4.readJson(subPaths.lockfile);
384
+ agentsCount = manifest.installed.agents.length;
385
+ skillsCount = manifest.installed.skills.length;
386
+ workflowsCount = manifest.installed.workflows.length;
387
+ } catch (err) {
388
+ issues.push(`Corrupt lockfile at ${subPaths.lockfile}: ${err.message}`);
389
+ }
390
+ }
391
+ if (await fs4.pathExists(subPaths.agentsDir)) {
392
+ const agentFiles = await fs4.readdir(subPaths.agentsDir);
393
+ for (const file of agentFiles) {
394
+ if (file.endsWith(".md")) {
395
+ const content = await fs4.readFile(path5.join(subPaths.agentsDir, file), "utf8");
396
+ const frontmatterMatch = content.match(/^---\r?\n([\s\S]+?)\r?\n---/);
397
+ if (!frontmatterMatch) {
398
+ warnings.push(`Agent ${file} is missing YAML frontmatter.`);
399
+ } else {
400
+ try {
401
+ const meta = parseYaml.parse(frontmatterMatch[1]);
402
+ if (!meta.name) issues.push(`Agent ${file} missing 'name' in frontmatter.`);
403
+ if (!meta.description) warnings.push(`Agent ${file} missing 'description'.`);
404
+ if (!meta.model) warnings.push(`Agent ${file} missing 'model' definition.`);
405
+ } catch (err) {
406
+ issues.push(`Invalid YAML in agent ${file}: ${err.message}`);
407
+ }
408
+ }
409
+ }
410
+ }
411
+ }
412
+ return {
413
+ valid: issues.length === 0,
414
+ issues,
415
+ warnings,
416
+ agentsCount,
417
+ skillsCount,
418
+ workflowsCount
419
+ };
420
+ }
421
+ };
422
+
423
+ // src/cli.ts
424
+ var cli = cac("agents-united");
425
+ var registry = new RegistryResolver();
426
+ var installer = new InstallEngine(registry);
427
+ var uninstaller = new UninstallEngine(registry);
428
+ cli.command("add <identifier>", "Add a bundle, agent, skill, or workflow to workspace or global configuration").option("-g, --global", "Install globally to ~/.gemini/config/").option("-y, --yes", "Skip confirmation prompts").option("-f, --force", "Force overwrite user modified files").option("--dry-run", "Simulate installation without writing files").action(async (identifier, options) => {
429
+ intro(pc.cyan("Agents United - Add Package"));
430
+ const s = spinner();
431
+ s.start(`Resolving "${identifier}"...`);
432
+ try {
433
+ const result = await installer.install(identifier, {
434
+ global: options.global,
435
+ yes: options.yes,
436
+ force: options.force,
437
+ dryRun: options.dryRun
438
+ });
439
+ s.stop(`Resolved assets for "${identifier}"`);
440
+ if (options.dryRun) {
441
+ outro(pc.yellow(`[DRY RUN] Would install ${result.installed.agents.length} agents, ${result.installed.skills.length} skills to ${result.targetDir}`));
442
+ return;
443
+ }
444
+ note(
445
+ `Bundle: ${result.installed.targetBundle || "Single Item"}
446
+ Agents: ${result.installed.agents.join(", ") || "None"}
447
+ Skills: ${result.installed.skills.join(", ") || "None"}
448
+ Target Directory: ${result.targetDir}`,
449
+ "Installation Success"
450
+ );
451
+ outro(pc.green(`\u2714 Installed "${identifier}" successfully!`));
452
+ } catch (err) {
453
+ s.stop(pc.red("Failed resolution"));
454
+ outro(pc.red(`Error: ${err.message}`));
455
+ process.exit(1);
456
+ }
457
+ });
458
+ cli.command("remove <identifier>", "Remove a bundle, agent, skill, or workflow").alias("uninstall").option("-g, --global", "Uninstall from global ~/.gemini/config/").option("-y, --yes", "Skip confirmation prompts").option("-f, --force", "Force removal of modified files").option("--dry-run", "Simulate removal without unlinking files").action(async (identifier, options) => {
459
+ intro(pc.cyan("Agents United - Remove Package"));
460
+ const s = spinner();
461
+ s.start(`Removing "${identifier}"...`);
462
+ try {
463
+ const result = await uninstaller.uninstall(identifier, {
464
+ global: options.global,
465
+ yes: options.yes,
466
+ force: options.force,
467
+ dryRun: options.dryRun
468
+ });
469
+ s.stop(`Uninstall processed`);
470
+ if (options.dryRun) {
471
+ outro(pc.yellow(`[DRY RUN] Would remove ${result.removed.length} assets from ${result.targetDir}`));
472
+ return;
473
+ }
474
+ outro(pc.green(`\u2714 Successfully removed ${result.removed.length} files matching "${identifier}"`));
475
+ } catch (err) {
476
+ s.stop(pc.red("Uninstall failed"));
477
+ outro(pc.red(`Error: ${err.message}`));
478
+ process.exit(1);
479
+ }
480
+ });
481
+ cli.command("list", "List available and installed bundles").alias("ls").action(async () => {
482
+ intro(pc.cyan("Agents United - Available Bundles"));
483
+ const bundles = await registry.listBundles();
484
+ for (const b of bundles) {
485
+ console.log(` ${pc.bold(pc.green(b.name))}`);
486
+ console.log(` ${pc.dim(b.description)}`);
487
+ console.log(` ${pc.gray(`Orchestrator: ${b.orchestrator} | Skills: ${b.skills?.length || 0} | Workflows: ${b.workflows?.length || 0}`)}
488
+ `);
489
+ }
490
+ outro(pc.cyan('Run "npx agents-united add <bundle>" to install a bundle.'));
491
+ });
492
+ cli.command("find <query>", "Search for agents, skills, or bundles in the registry").alias("search").action(async (query) => {
493
+ intro(pc.cyan(`Agents United - Search: "${query}"`));
494
+ const results = await registry.find(query);
495
+ console.log(pc.bold("\nMatching Bundles:"));
496
+ results.bundles.forEach((b) => console.log(` - ${pc.green(b.name)}: ${pc.dim(b.description)}`));
497
+ console.log(pc.bold("\nMatching Agents:"));
498
+ results.agents.forEach((a) => console.log(` - ${pc.blue(a)}`));
499
+ console.log(pc.bold("\nMatching Skills:"));
500
+ results.skills.forEach((s) => console.log(` - ${pc.yellow(s)}`));
501
+ outro(pc.cyan('\nUse "npx agents-united add <name>" to install any match.'));
502
+ });
503
+ cli.command("init", "Initialize workspace .agents folder and install recommended bundle").option("-b, --bundle <bundle>", "Default bundle to install", { default: "software-engineering" }).action(async (options) => {
504
+ intro(pc.cyan("Agents United - Initialize Workspace"));
505
+ const s = spinner();
506
+ s.start(`Initializing .agents directory with bundle "${options.bundle}"...`);
507
+ try {
508
+ const result = await installer.install(options.bundle, { scope: "workspace" });
509
+ s.stop(`Initialized ${result.targetDir}`);
510
+ outro(pc.green(`\u2714 Initialized workspace with "${options.bundle}" bundle!`));
511
+ } catch (err) {
512
+ s.stop(pc.red("Initialization failed"));
513
+ outro(pc.red(`Error: ${err.message}`));
514
+ process.exit(1);
515
+ }
516
+ });
517
+ cli.command("doctor", "Verify health of installed agents, frontmatter schemas, and hooks").action(async () => {
518
+ intro(pc.cyan("Agents United - Health Doctor"));
519
+ const report = await DoctorEngine.runDoctor();
520
+ console.log(` Installed Agents: ${report.agentsCount}`);
521
+ console.log(` Installed Skills: ${report.skillsCount}`);
522
+ console.log(` Installed Workflows: ${report.workflowsCount}
523
+ `);
524
+ if (report.issues.length > 0) {
525
+ console.log(pc.red(pc.bold("Issues Found:")));
526
+ report.issues.forEach((i) => console.log(` \u2716 ${i}`));
527
+ }
528
+ if (report.warnings.length > 0) {
529
+ console.log(pc.yellow(pc.bold("Warnings:")));
530
+ report.warnings.forEach((w) => console.log(` \u26A0 ${w}`));
531
+ }
532
+ if (report.valid && report.issues.length === 0) {
533
+ outro(pc.green("\u2714 All installed agents and frontmatter schemas are healthy!"));
534
+ } else {
535
+ outro(pc.red("\u2716 Doctor found issues in workspace configuration."));
536
+ process.exit(1);
537
+ }
538
+ });
539
+ cli.help();
540
+ cli.version("1.0.0");
541
+ cli.parse();
542
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli.ts","../src/core/registry.ts","../src/core/installer.ts","../src/core/adapter.ts","../src/core/uninstaller.ts","../src/core/doctor.ts"],"sourcesContent":["import { cac } from 'cac';\nimport pc from 'picocolors';\nimport { intro, outro, spinner, note } from '@clack/prompts';\nimport { RegistryResolver } from './core/registry.js';\nimport { InstallEngine } from './core/installer.js';\nimport { UninstallEngine } from './core/uninstaller.js';\nimport { DoctorEngine } from './core/doctor.js';\nimport { TargetAdapter } from './core/adapter.js';\n\nconst cli = cac('agents-united');\nconst registry = new RegistryResolver();\nconst installer = new InstallEngine(registry);\nconst uninstaller = new UninstallEngine(registry);\n\ncli\n .command('add <identifier>', 'Add a bundle, agent, skill, or workflow to workspace or global configuration')\n .option('-g, --global', 'Install globally to ~/.gemini/config/')\n .option('-y, --yes', 'Skip confirmation prompts')\n .option('-f, --force', 'Force overwrite user modified files')\n .option('--dry-run', 'Simulate installation without writing files')\n .action(async (identifier: string, options: any) => {\n intro(pc.cyan('Agents United - Add Package'));\n const s = spinner();\n s.start(`Resolving \"${identifier}\"...`);\n\n try {\n const result = await installer.install(identifier, {\n global: options.global,\n yes: options.yes,\n force: options.force,\n dryRun: options.dryRun,\n });\n\n s.stop(`Resolved assets for \"${identifier}\"`);\n\n if (options.dryRun) {\n outro(pc.yellow(`[DRY RUN] Would install ${result.installed.agents.length} agents, ${result.installed.skills.length} skills to ${result.targetDir}`));\n return;\n }\n\n note(\n `Bundle: ${result.installed.targetBundle || 'Single Item'}\\n` +\n `Agents: ${result.installed.agents.join(', ') || 'None'}\\n` +\n `Skills: ${result.installed.skills.join(', ') || 'None'}\\n` +\n `Target Directory: ${result.targetDir}`,\n 'Installation Success'\n );\n\n outro(pc.green(`✔ Installed \"${identifier}\" successfully!`));\n } catch (err: any) {\n s.stop(pc.red('Failed resolution'));\n outro(pc.red(`Error: ${err.message}`));\n process.exit(1);\n }\n });\n\ncli\n .command('remove <identifier>', 'Remove a bundle, agent, skill, or workflow')\n .alias('uninstall')\n .option('-g, --global', 'Uninstall from global ~/.gemini/config/')\n .option('-y, --yes', 'Skip confirmation prompts')\n .option('-f, --force', 'Force removal of modified files')\n .option('--dry-run', 'Simulate removal without unlinking files')\n .action(async (identifier: string, options: any) => {\n intro(pc.cyan('Agents United - Remove Package'));\n const s = spinner();\n s.start(`Removing \"${identifier}\"...`);\n\n try {\n const result = await uninstaller.uninstall(identifier, {\n global: options.global,\n yes: options.yes,\n force: options.force,\n dryRun: options.dryRun,\n });\n\n s.stop(`Uninstall processed`);\n\n if (options.dryRun) {\n outro(pc.yellow(`[DRY RUN] Would remove ${result.removed.length} assets from ${result.targetDir}`));\n return;\n }\n\n outro(pc.green(`✔ Successfully removed ${result.removed.length} files matching \"${identifier}\"`));\n } catch (err: any) {\n s.stop(pc.red('Uninstall failed'));\n outro(pc.red(`Error: ${err.message}`));\n process.exit(1);\n }\n });\n\ncli\n .command('list', 'List available and installed bundles')\n .alias('ls')\n .action(async () => {\n intro(pc.cyan('Agents United - Available Bundles'));\n const bundles = await registry.listBundles();\n\n for (const b of bundles) {\n console.log(` ${pc.bold(pc.green(b.name))}`);\n console.log(` ${pc.dim(b.description)}`);\n console.log(` ${pc.gray(`Orchestrator: ${b.orchestrator} | Skills: ${b.skills?.length || 0} | Workflows: ${b.workflows?.length || 0}`)}\\n`);\n }\n\n outro(pc.cyan('Run \"npx agents-united add <bundle>\" to install a bundle.'));\n });\n\ncli\n .command('find <query>', 'Search for agents, skills, or bundles in the registry')\n .alias('search')\n .action(async (query: string) => {\n intro(pc.cyan(`Agents United - Search: \"${query}\"`));\n const results = await registry.find(query);\n\n console.log(pc.bold('\\nMatching Bundles:'));\n results.bundles.forEach(b => console.log(` - ${pc.green(b.name)}: ${pc.dim(b.description)}`));\n\n console.log(pc.bold('\\nMatching Agents:'));\n results.agents.forEach(a => console.log(` - ${pc.blue(a)}`));\n\n console.log(pc.bold('\\nMatching Skills:'));\n results.skills.forEach(s => console.log(` - ${pc.yellow(s)}`));\n\n outro(pc.cyan('\\nUse \"npx agents-united add <name>\" to install any match.'));\n });\n\ncli\n .command('init', 'Initialize workspace .agents folder and install recommended bundle')\n .option('-b, --bundle <bundle>', 'Default bundle to install', { default: 'software-engineering' })\n .action(async (options: any) => {\n intro(pc.cyan('Agents United - Initialize Workspace'));\n const s = spinner();\n s.start(`Initializing .agents directory with bundle \"${options.bundle}\"...`);\n\n try {\n const result = await installer.install(options.bundle, { scope: 'workspace' });\n s.stop(`Initialized ${result.targetDir}`);\n outro(pc.green(`✔ Initialized workspace with \"${options.bundle}\" bundle!`));\n } catch (err: any) {\n s.stop(pc.red('Initialization failed'));\n outro(pc.red(`Error: ${err.message}`));\n process.exit(1);\n }\n });\n\ncli\n .command('doctor', 'Verify health of installed agents, frontmatter schemas, and hooks')\n .action(async () => {\n intro(pc.cyan('Agents United - Health Doctor'));\n const report = await DoctorEngine.runDoctor();\n\n console.log(` Installed Agents: ${report.agentsCount}`);\n console.log(` Installed Skills: ${report.skillsCount}`);\n console.log(` Installed Workflows: ${report.workflowsCount}\\n`);\n\n if (report.issues.length > 0) {\n console.log(pc.red(pc.bold('Issues Found:')));\n report.issues.forEach(i => console.log(` ✖ ${i}`));\n }\n\n if (report.warnings.length > 0) {\n console.log(pc.yellow(pc.bold('Warnings:')));\n report.warnings.forEach(w => console.log(` ⚠ ${w}`));\n }\n\n if (report.valid && report.issues.length === 0) {\n outro(pc.green('✔ All installed agents and frontmatter schemas are healthy!'));\n } else {\n outro(pc.red('✖ Doctor found issues in workspace configuration.'));\n process.exit(1);\n }\n });\n\ncli.help();\ncli.version('1.0.0');\n\ncli.parse();\n","import path from 'node:path';\nimport fs from 'fs-extra';\nimport { fileURLToPath } from 'node:url';\nimport type { BundlesManifest, BundleDefinition, ResolvedAssets } from './types.js';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\nexport class RegistryResolver {\n private registryDir: string;\n private bundlesManifest: BundlesManifest | null = null;\n\n constructor(customRegistryDir?: string) {\n if (customRegistryDir) {\n this.registryDir = path.resolve(customRegistryDir);\n } else {\n // Check candidate paths for registry folder\n const candidatePaths = [\n path.resolve(__dirname, '../registry'),\n path.resolve(__dirname, '../../registry'),\n path.resolve(process.cwd(), 'registry'),\n ];\n\n const found = candidatePaths.find(p => fs.existsSync(path.join(p, 'bundles.json')));\n this.registryDir = found || candidatePaths[0];\n }\n }\n\n public getRegistryDir(): string {\n return this.registryDir;\n }\n\n public async loadBundles(): Promise<BundlesManifest> {\n if (this.bundlesManifest) {\n return this.bundlesManifest;\n }\n\n const manifestPath = path.join(this.registryDir, 'bundles.json');\n if (!await fs.pathExists(manifestPath)) {\n throw new Error(`Registry bundles.json not found at ${manifestPath}`);\n }\n\n this.bundlesManifest = await fs.readJson(manifestPath);\n return this.bundlesManifest!;\n }\n\n public async getBundle(bundleName: string): Promise<BundleDefinition | null> {\n const manifest = await this.loadBundles();\n return manifest.bundles[bundleName] || null;\n }\n\n public async listBundles(): Promise<BundleDefinition[]> {\n const manifest = await this.loadBundles();\n return Object.values(manifest.bundles);\n }\n\n public async resolve(identifier: string): Promise<ResolvedAssets> {\n const manifest = await this.loadBundles();\n const bundle = manifest.bundles[identifier];\n\n if (bundle) {\n const agents = new Set<string>();\n if (bundle.orchestrator) agents.add(bundle.orchestrator);\n if (bundle.agents) bundle.agents.forEach(a => agents.add(a));\n\n const skills = new Set<string>(bundle.skills || []);\n const workflows = new Set<string>(bundle.workflows || []);\n const rules = ['GEMINI.md'];\n\n return {\n targetBundle: bundle.name,\n agents: Array.from(agents),\n skills: Array.from(skills),\n workflows: Array.from(workflows),\n rules,\n };\n }\n\n // Check if identifier refers to a specific single item (agent, skill, or workflow)\n const agentPath = path.join(this.registryDir, 'agents', identifier.endsWith('.md') ? identifier : `${identifier}.md`);\n if (await fs.pathExists(agentPath)) {\n return {\n agents: [path.basename(agentPath)],\n skills: [],\n workflows: [],\n rules: [],\n };\n }\n\n const skillPath = path.join(this.registryDir, 'skills', identifier);\n if (await fs.pathExists(skillPath)) {\n return {\n agents: [],\n skills: [identifier],\n workflows: [],\n rules: [],\n };\n }\n\n const workflowFileName = identifier.startsWith('workflow-') ? `${identifier}.md` : `workflow-${identifier}.md`;\n const workflowPath = path.join(this.registryDir, 'workflows', workflowFileName);\n if (await fs.pathExists(workflowPath)) {\n return {\n agents: [],\n skills: [],\n workflows: [path.basename(workflowPath)],\n rules: [],\n };\n }\n\n throw new Error(`Item or bundle \"${identifier}\" not found in registry.`);\n }\n\n public async find(query: string): Promise<{ bundles: BundleDefinition[]; agents: string[]; skills: string[] }> {\n const manifest = await this.loadBundles();\n const q = query.toLowerCase();\n\n const matchedBundles = Object.values(manifest.bundles).filter(\n b => b.name.toLowerCase().includes(q) || b.description.toLowerCase().includes(q)\n );\n\n const agentsDir = path.join(this.registryDir, 'agents');\n let matchedAgents: string[] = [];\n if (await fs.pathExists(agentsDir)) {\n const files = await fs.readdir(agentsDir);\n matchedAgents = files.filter(f => f.toLowerCase().includes(q));\n }\n\n const skillsDir = path.join(this.registryDir, 'skills');\n let matchedSkills: string[] = [];\n if (await fs.pathExists(skillsDir)) {\n const dirs = await fs.readdir(skillsDir);\n matchedSkills = dirs.filter(d => d.toLowerCase().includes(q));\n }\n\n return {\n bundles: matchedBundles,\n agents: matchedAgents,\n skills: matchedSkills,\n };\n }\n}\n","import path from 'node:path';\nimport crypto from 'node:crypto';\nimport fs from 'fs-extra';\nimport { RegistryResolver } from './registry.js';\nimport { TargetAdapter } from './adapter.js';\nimport type { InstallOptions, LockfileManifest, ResolvedAssets } from './types.js';\n\nexport class InstallEngine {\n private registry: RegistryResolver;\n\n constructor(registry?: RegistryResolver) {\n this.registry = registry || new RegistryResolver();\n }\n\n private async calculateHash(filePath: string): Promise<string> {\n const buffer = await fs.readFile(filePath);\n return 'sha256:' + crypto.createHash('sha256').update(buffer).digest('hex');\n }\n\n private async readLockfile(lockfilePath: string): Promise<LockfileManifest> {\n if (await fs.pathExists(lockfilePath)) {\n try {\n return await fs.readJson(lockfilePath);\n } catch {\n // Fallback to empty manifest on corrupt file\n }\n }\n\n return {\n $schema: 'https://agents-united.dev/schema/lockfile.v1.json',\n version: 1,\n installed: {\n bundles: [],\n agents: [],\n skills: [],\n workflows: [],\n },\n files: {},\n };\n }\n\n public async install(identifier: string, options: InstallOptions = {}): Promise<{ installed: ResolvedAssets; targetDir: string; dryRun: boolean }> {\n const scope = options.global ? 'global' : (options.scope || 'workspace');\n const targetDir = TargetAdapter.resolveTargetDir(scope, options.targetDir);\n const subPaths = TargetAdapter.getSubPaths(targetDir);\n\n const resolved = await this.registry.resolve(identifier);\n const registryDir = this.registry.getRegistryDir();\n\n if (options.dryRun) {\n return { installed: resolved, targetDir, dryRun: true };\n }\n\n await fs.ensureDir(subPaths.agentsDir);\n await fs.ensureDir(subPaths.skillsDir);\n await fs.ensureDir(subPaths.workflowsDir);\n await fs.ensureDir(subPaths.rulesDir);\n\n const lockfile = await this.readLockfile(subPaths.lockfile);\n const now = new Date().toISOString();\n\n // Copy Agents\n for (const agentFile of resolved.agents) {\n const src = path.join(registryDir, 'agents', agentFile);\n const dest = path.join(subPaths.agentsDir, agentFile);\n\n if (await fs.pathExists(dest) && !options.force) {\n const existingHash = await this.calculateHash(dest);\n const relPath = path.relative(targetDir, dest);\n if (lockfile.files[relPath] && lockfile.files[relPath].hash !== existingHash) {\n throw new Error(`File ${relPath} has user modifications. Use --force to overwrite.`);\n }\n }\n\n await fs.copy(src, dest, { overwrite: true });\n const hash = await this.calculateHash(dest);\n const relPath = path.relative(targetDir, dest);\n lockfile.files[relPath] = {\n hash,\n bundle: resolved.targetBundle,\n installedAt: now,\n };\n\n if (!lockfile.installed.agents.includes(agentFile)) {\n lockfile.installed.agents.push(agentFile);\n }\n }\n\n // Copy Skills\n for (const skillName of resolved.skills) {\n const src = path.join(registryDir, 'skills', skillName);\n const dest = path.join(subPaths.skillsDir, skillName);\n\n if (await fs.pathExists(dest) && !options.force) {\n // Skip directory hash check if forced\n }\n\n await fs.copy(src, dest, { overwrite: true });\n const skillFile = path.join(dest, 'SKILL.md');\n if (await fs.pathExists(skillFile)) {\n const hash = await this.calculateHash(skillFile);\n const relPath = path.relative(targetDir, skillFile);\n lockfile.files[relPath] = {\n hash,\n bundle: resolved.targetBundle,\n installedAt: now,\n };\n }\n\n if (!lockfile.installed.skills.includes(skillName)) {\n lockfile.installed.skills.push(skillName);\n }\n }\n\n // Copy Workflows\n for (const workflowFile of resolved.workflows) {\n const src = path.join(registryDir, 'workflows', workflowFile);\n const dest = path.join(subPaths.workflowsDir, workflowFile);\n\n await fs.copy(src, dest, { overwrite: true });\n const hash = await this.calculateHash(dest);\n const relPath = path.relative(targetDir, dest);\n lockfile.files[relPath] = {\n hash,\n bundle: resolved.targetBundle,\n installedAt: now,\n };\n\n if (!lockfile.installed.workflows.includes(workflowFile)) {\n lockfile.installed.workflows.push(workflowFile);\n }\n }\n\n // Copy Rules\n for (const ruleFile of resolved.rules) {\n const src = path.join(registryDir, 'rules', ruleFile);\n const dest = path.join(subPaths.rulesDir, ruleFile);\n\n if (await fs.pathExists(src)) {\n await fs.copy(src, dest, { overwrite: true });\n const hash = await this.calculateHash(dest);\n const relPath = path.relative(targetDir, dest);\n lockfile.files[relPath] = {\n hash,\n bundle: resolved.targetBundle,\n installedAt: now,\n };\n }\n }\n\n // Update Lockfile Bundles\n if (resolved.targetBundle && !lockfile.installed.bundles.includes(resolved.targetBundle)) {\n lockfile.installed.bundles.push(resolved.targetBundle);\n }\n\n await fs.writeJson(subPaths.lockfile, lockfile, { spaces: 2 });\n\n return { installed: resolved, targetDir, dryRun: false };\n }\n}\n","import path from 'node:path';\nimport os from 'node:os';\nimport type { Scope } from './types.js';\n\nexport class TargetAdapter {\n public static resolveTargetDir(scope: Scope = 'workspace', overrideDir?: string): string {\n if (overrideDir) {\n return path.resolve(overrideDir);\n }\n\n if (scope === 'global') {\n const home = os.homedir();\n return path.join(home, '.gemini', 'config');\n }\n\n // Default workspace target\n return path.resolve(process.cwd(), '.agents');\n }\n\n public static getSubPaths(targetDir: string) {\n return {\n agentsDir: path.join(targetDir, 'agents'),\n skillsDir: path.join(targetDir, 'skills'),\n workflowsDir: path.join(targetDir, 'workflows'),\n rulesDir: path.join(targetDir, 'rules'),\n lockfile: path.join(targetDir, 'agents-united.json'),\n };\n }\n}\n","import path from 'node:path';\nimport crypto from 'node:crypto';\nimport fs from 'fs-extra';\nimport { RegistryResolver } from './registry.js';\nimport { TargetAdapter } from './adapter.js';\nimport type { UninstallOptions, LockfileManifest } from './types.js';\n\nexport class UninstallEngine {\n private registry: RegistryResolver;\n\n constructor(registry?: RegistryResolver) {\n this.registry = registry || new RegistryResolver();\n }\n\n private async calculateHash(filePath: string): Promise<string> {\n const buffer = await fs.readFile(filePath);\n return 'sha256:' + crypto.createHash('sha256').update(buffer).digest('hex');\n }\n\n public async uninstall(identifier: string, options: UninstallOptions = {}): Promise<{ removed: string[]; targetDir: string; dryRun: boolean }> {\n const scope = options.global ? 'global' : (options.scope || 'workspace');\n const targetDir = TargetAdapter.resolveTargetDir(scope, options.targetDir);\n const subPaths = TargetAdapter.getSubPaths(targetDir);\n\n if (!await fs.pathExists(subPaths.lockfile)) {\n throw new Error(`No agents-united.json lockfile found in ${targetDir}. Nothing to uninstall.`);\n }\n\n const lockfile: LockfileManifest = await fs.readJson(subPaths.lockfile);\n const resolved = await this.registry.resolve(identifier).catch(() => null);\n\n const removedFiles: string[] = [];\n\n // Bundle removal mode\n if (resolved && resolved.targetBundle) {\n const bundleName = resolved.targetBundle;\n if (!lockfile.installed.bundles.includes(bundleName)) {\n throw new Error(`Bundle \"${bundleName}\" is not currently installed.`);\n }\n\n if (options.dryRun) {\n return { removed: resolved.agents.concat(resolved.skills, resolved.workflows), targetDir, dryRun: true };\n }\n\n // Identify files belonging to this bundle in lockfile\n for (const [relPath, assetMeta] of Object.entries(lockfile.files)) {\n if (assetMeta.bundle === bundleName) {\n const fullPath = path.join(targetDir, relPath);\n if (await fs.pathExists(fullPath)) {\n if (!options.force) {\n const currentHash = await this.calculateHash(fullPath).catch(() => null);\n if (currentHash && currentHash !== assetMeta.hash) {\n throw new Error(`File ${relPath} has user modifications. Use --force to remove.`);\n }\n }\n\n await fs.remove(fullPath);\n removedFiles.push(relPath);\n }\n\n delete lockfile.files[relPath];\n }\n }\n\n // Update lockfile installed lists\n lockfile.installed.bundles = lockfile.installed.bundles.filter(b => b !== bundleName);\n if (resolved.agents) {\n lockfile.installed.agents = lockfile.installed.agents.filter(a => !resolved.agents.includes(a));\n }\n if (resolved.skills) {\n lockfile.installed.skills = lockfile.installed.skills.filter(s => !resolved.skills.includes(s));\n }\n if (resolved.workflows) {\n lockfile.installed.workflows = lockfile.installed.workflows.filter(w => !resolved.workflows.includes(w));\n }\n\n await fs.writeJson(subPaths.lockfile, lockfile, { spaces: 2 });\n return { removed: removedFiles, targetDir, dryRun: false };\n }\n\n // Item removal mode\n const itemTargetRelPaths = Object.keys(lockfile.files).filter(p => p.includes(identifier));\n\n if (itemTargetRelPaths.length === 0) {\n throw new Error(`No installed assets found matching \"${identifier}\".`);\n }\n\n if (options.dryRun) {\n return { removed: itemTargetRelPaths, targetDir, dryRun: true };\n }\n\n for (const relPath of itemTargetRelPaths) {\n const fullPath = path.join(targetDir, relPath);\n if (await fs.pathExists(fullPath)) {\n if (!options.force) {\n const currentHash = await this.calculateHash(fullPath).catch(() => null);\n const assetMeta = lockfile.files[relPath];\n if (currentHash && assetMeta && currentHash !== assetMeta.hash) {\n throw new Error(`File ${relPath} has user modifications. Use --force to remove.`);\n }\n }\n await fs.remove(fullPath);\n removedFiles.push(relPath);\n }\n delete lockfile.files[relPath];\n }\n\n await fs.writeJson(subPaths.lockfile, lockfile, { spaces: 2 });\n return { removed: removedFiles, targetDir, dryRun: false };\n }\n}\n","import path from 'node:path';\nimport fs from 'fs-extra';\nimport parseYaml from 'yaml';\nimport { TargetAdapter } from './adapter.js';\nimport type { LockfileManifest } from './types.js';\n\nexport interface HealthReport {\n valid: boolean;\n issues: string[];\n warnings: string[];\n agentsCount: number;\n skillsCount: number;\n workflowsCount: number;\n}\n\nexport class DoctorEngine {\n public static async runDoctor(targetDir?: string): Promise<HealthReport> {\n const root = TargetAdapter.resolveTargetDir('workspace', targetDir);\n const subPaths = TargetAdapter.getSubPaths(root);\n\n const issues: string[] = [];\n const warnings: string[] = [];\n\n let agentsCount = 0;\n let skillsCount = 0;\n let workflowsCount = 0;\n\n // Check Lockfile\n if (!await fs.pathExists(subPaths.lockfile)) {\n warnings.push(`No lockfile found at ${subPaths.lockfile}. Workspace might not be initialized.`);\n } else {\n try {\n const manifest: LockfileManifest = await fs.readJson(subPaths.lockfile);\n agentsCount = manifest.installed.agents.length;\n skillsCount = manifest.installed.skills.length;\n workflowsCount = manifest.installed.workflows.length;\n } catch (err: any) {\n issues.push(`Corrupt lockfile at ${subPaths.lockfile}: ${err.message}`);\n }\n }\n\n // Validate Agents YAML Frontmatter\n if (await fs.pathExists(subPaths.agentsDir)) {\n const agentFiles = await fs.readdir(subPaths.agentsDir);\n for (const file of agentFiles) {\n if (file.endsWith('.md')) {\n const content = await fs.readFile(path.join(subPaths.agentsDir, file), 'utf8');\n const frontmatterMatch = content.match(/^---\\r?\\n([\\s\\S]+?)\\r?\\n---/);\n if (!frontmatterMatch) {\n warnings.push(`Agent ${file} is missing YAML frontmatter.`);\n } else {\n try {\n const meta = parseYaml.parse(frontmatterMatch[1]);\n if (!meta.name) issues.push(`Agent ${file} missing 'name' in frontmatter.`);\n if (!meta.description) warnings.push(`Agent ${file} missing 'description'.`);\n if (!meta.model) warnings.push(`Agent ${file} missing 'model' definition.`);\n } catch (err: any) {\n issues.push(`Invalid YAML in agent ${file}: ${err.message}`);\n }\n }\n }\n }\n }\n\n return {\n valid: issues.length === 0,\n issues,\n warnings,\n agentsCount,\n skillsCount,\n workflowsCount,\n };\n }\n}\n"],"mappings":";;;AAAA,SAAS,WAAW;AACpB,OAAO,Q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