aigent-team 0.3.0 → 0.4.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 (67) hide show
  1. package/README.md +48 -7
  2. package/dist/{chunk-RH4B2QFX.js → chunk-OMO7OMKB.js} +254 -22
  3. package/dist/cli.js +684 -23
  4. package/dist/index.d.ts +49 -0
  5. package/dist/index.js +1 -1
  6. package/package.json +1 -1
  7. package/templates/teams/ba/assets/story-template.md +49 -0
  8. package/templates/teams/ba/examples/acceptance-criteria.md +39 -0
  9. package/templates/teams/ba/output-contracts/user-story-rubric.md +33 -0
  10. package/templates/teams/ba/references/acceptance-criteria.md +7 -0
  11. package/templates/teams/ba/references/api-contract-design.md +7 -0
  12. package/templates/teams/ba/references/requirements-analysis.md +7 -0
  13. package/templates/teams/ba/references/user-story-mapping.md +7 -0
  14. package/templates/teams/ba/skills/requirement-validation.md +11 -0
  15. package/templates/teams/ba/skills/story-decomposition.md +16 -0
  16. package/templates/teams/be/references/api-design.md +7 -0
  17. package/templates/teams/be/references/async-processing.md +7 -0
  18. package/templates/teams/be/references/auth-security.md +7 -0
  19. package/templates/teams/be/references/caching.md +7 -0
  20. package/templates/teams/be/references/database.md +7 -0
  21. package/templates/teams/be/references/error-handling.md +7 -0
  22. package/templates/teams/be/references/observability.md +7 -0
  23. package/templates/teams/be/references/review-checklist.md +7 -0
  24. package/templates/teams/be/references/testing.md +7 -0
  25. package/templates/teams/be/skills/api-load-test.md +11 -0
  26. package/templates/teams/be/skills/database-migration.md +11 -0
  27. package/templates/teams/devops/references/ci-cd.md +7 -0
  28. package/templates/teams/devops/references/cost-optimization.md +7 -0
  29. package/templates/teams/devops/references/disaster-recovery.md +7 -0
  30. package/templates/teams/devops/references/docker.md +7 -0
  31. package/templates/teams/devops/references/infrastructure-as-code.md +7 -0
  32. package/templates/teams/devops/references/kubernetes.md +7 -0
  33. package/templates/teams/devops/references/monitoring.md +7 -0
  34. package/templates/teams/devops/references/review-checklist.md +7 -0
  35. package/templates/teams/devops/references/security.md +7 -0
  36. package/templates/teams/devops/scripts/health-check.sh +35 -0
  37. package/templates/teams/devops/skills/health-check.md +11 -0
  38. package/templates/teams/devops/skills/rollback-procedure.md +15 -0
  39. package/templates/teams/fe/examples/component-audit.md +35 -0
  40. package/templates/teams/fe/references/accessibility.md +7 -0
  41. package/templates/teams/fe/references/component-architecture.md +7 -0
  42. package/templates/teams/fe/references/css-styling.md +7 -0
  43. package/templates/teams/fe/references/forms.md +7 -0
  44. package/templates/teams/fe/references/performance.md +7 -0
  45. package/templates/teams/fe/references/review-checklist.md +7 -0
  46. package/templates/teams/fe/references/security.md +7 -0
  47. package/templates/teams/fe/references/state-management.md +7 -0
  48. package/templates/teams/fe/references/testing.md +7 -0
  49. package/templates/teams/fe/skills/analyze-bundle.md +16 -0
  50. package/templates/teams/fe/skills/component-audit.md +11 -0
  51. package/templates/teams/lead/references/cross-team-coordination.md +7 -0
  52. package/templates/teams/lead/references/quality-gates.md +7 -0
  53. package/templates/teams/lead/references/task-decomposition.md +7 -0
  54. package/templates/teams/lead/skills/parallel-orchestration.md +11 -0
  55. package/templates/teams/lead/skills/sprint-review.md +11 -0
  56. package/templates/teams/qa/assets/test-report-template.md +63 -0
  57. package/templates/teams/qa/output-contracts/test-plan-rubric.md +36 -0
  58. package/templates/teams/qa/references/ci-integration.md +7 -0
  59. package/templates/teams/qa/references/e2e-testing.md +7 -0
  60. package/templates/teams/qa/references/mocking.md +7 -0
  61. package/templates/teams/qa/references/performance-testing.md +7 -0
  62. package/templates/teams/qa/references/review-checklist.md +7 -0
  63. package/templates/teams/qa/references/security-testing.md +7 -0
  64. package/templates/teams/qa/references/test-data.md +7 -0
  65. package/templates/teams/qa/references/test-strategy.md +7 -0
  66. package/templates/teams/qa/skills/flaky-test-diagnosis.md +11 -0
  67. package/templates/teams/qa/skills/generate-test-data.md +15 -0
package/dist/cli.js CHANGED
@@ -5,17 +5,22 @@ import {
5
5
  PLATFORMS,
6
6
  PLUGIN_BUNDLE_DIRS,
7
7
  TEAM_ROLES,
8
+ assembleAsset,
9
+ assembleExample,
10
+ assembleOutputContract,
8
11
  assembleReference,
12
+ assembleScript,
9
13
  assembleSkill,
10
14
  assembleSkillIndex,
11
15
  configExists,
12
16
  loadAgents,
13
- loadConfig
14
- } from "./chunk-RH4B2QFX.js";
17
+ loadConfig,
18
+ parseFrontmatter
19
+ } from "./chunk-OMO7OMKB.js";
15
20
 
16
21
  // bin/cli.ts
17
22
  import { Command } from "commander";
18
- import chalk6 from "chalk";
23
+ import chalk7 from "chalk";
19
24
 
20
25
  // src/cli/init.ts
21
26
  import { writeFileSync } from "fs";
@@ -163,6 +168,10 @@ var BaseCompiler = class {
163
168
  normalized.add("agents");
164
169
  normalized.add("skills");
165
170
  normalized.add("references");
171
+ normalized.add("examples");
172
+ normalized.add("output-contracts");
173
+ normalized.add("scripts");
174
+ normalized.add("assets");
166
175
  } else {
167
176
  normalized.add(s);
168
177
  }
@@ -178,6 +187,18 @@ var BaseCompiler = class {
178
187
  if (normalized.has("references")) {
179
188
  outputs.push(...this.compileAllReferences(agents));
180
189
  }
190
+ if (normalized.has("examples")) {
191
+ outputs.push(...this.compileAllExamples(agents));
192
+ }
193
+ if (normalized.has("output-contracts")) {
194
+ outputs.push(...this.compileAllOutputContracts(agents));
195
+ }
196
+ if (normalized.has("scripts")) {
197
+ outputs.push(...this.compileAllScripts(agents));
198
+ }
199
+ if (normalized.has("assets")) {
200
+ outputs.push(...this.compileAllAssets(agents));
201
+ }
181
202
  return outputs;
182
203
  }
183
204
  /**
@@ -186,7 +207,7 @@ var BaseCompiler = class {
186
207
  */
187
208
  countArtifacts(outputs, rootDir) {
188
209
  const counts = {};
189
- const categories = ["rules", "skills", "agents", "kb", "ai"];
210
+ const categories = ["rules", "skills", "agents", "kb", "examples", "contracts", "ai"];
190
211
  for (const cat of categories) {
191
212
  const prefix = `${rootDir}/${cat}/`;
192
213
  const count = outputs.filter((o) => o.filePath.startsWith(prefix)).length;
@@ -194,6 +215,30 @@ var BaseCompiler = class {
194
215
  }
195
216
  return counts;
196
217
  }
218
+ /**
219
+ * Compile all example files. Default no-op — override in subclasses.
220
+ */
221
+ compileAllExamples(_agents) {
222
+ return [];
223
+ }
224
+ /**
225
+ * Compile all output contract files. Default no-op — override in subclasses.
226
+ */
227
+ compileAllOutputContracts(_agents) {
228
+ return [];
229
+ }
230
+ /**
231
+ * Compile all script files. Default no-op — override in subclasses.
232
+ */
233
+ compileAllScripts(_agents) {
234
+ return [];
235
+ }
236
+ /**
237
+ * Compile all asset files. Default no-op — override in subclasses.
238
+ */
239
+ compileAllAssets(_agents) {
240
+ return [];
241
+ }
197
242
  // ---- Shared helpers ----
198
243
  /**
199
244
  * Compile reference files for an agent into a given directory.
@@ -219,6 +264,50 @@ var BaseCompiler = class {
219
264
  overwriteStrategy: "replace"
220
265
  }));
221
266
  }
267
+ /**
268
+ * Compile example files for an agent into a given directory.
269
+ */
270
+ compileExamples(agent, baseDir, extension = ".md") {
271
+ if (!agent.examples?.length) return [];
272
+ return agent.examples.map((example) => ({
273
+ filePath: `${baseDir}/${example.id}${extension}`,
274
+ content: assembleExample(example) + "\n",
275
+ overwriteStrategy: "replace"
276
+ }));
277
+ }
278
+ /**
279
+ * Compile output contract files for an agent into a given directory.
280
+ */
281
+ compileOutputContracts(agent, baseDir, extension = ".md") {
282
+ if (!agent.outputContracts?.length) return [];
283
+ return agent.outputContracts.map((contract) => ({
284
+ filePath: `${baseDir}/${contract.id}${extension}`,
285
+ content: assembleOutputContract(contract) + "\n",
286
+ overwriteStrategy: "replace"
287
+ }));
288
+ }
289
+ /**
290
+ * Compile script files for an agent into a given directory.
291
+ */
292
+ compileScriptFiles(agent, baseDir, extension = ".md") {
293
+ if (!agent.scripts?.length) return [];
294
+ return agent.scripts.map((script) => ({
295
+ filePath: `${baseDir}/${script.id}${extension}`,
296
+ content: assembleScript(script) + "\n",
297
+ overwriteStrategy: "replace"
298
+ }));
299
+ }
300
+ /**
301
+ * Compile asset files for an agent into a given directory.
302
+ */
303
+ compileAssetFiles(agent, baseDir, extension = ".md") {
304
+ if (!agent.assets?.length) return [];
305
+ return agent.assets.map((asset) => ({
306
+ filePath: `${baseDir}/${asset.id}${extension}`,
307
+ content: assembleAsset(asset) + "\n",
308
+ overwriteStrategy: "replace"
309
+ }));
310
+ }
222
311
  formatFrontmatter(data) {
223
312
  const lines = ["---"];
224
313
  for (const [key, value] of Object.entries(data)) {
@@ -306,6 +395,46 @@ ${body}
306
395
  }
307
396
  return outputs;
308
397
  }
398
+ compileAllExamples(agents) {
399
+ const outputs = [];
400
+ for (const agent of agents) {
401
+ outputs.push(...this.compileExamples(
402
+ agent,
403
+ `.claude/agents/${agent.id}-agent/examples`
404
+ ));
405
+ }
406
+ return outputs;
407
+ }
408
+ compileAllOutputContracts(agents) {
409
+ const outputs = [];
410
+ for (const agent of agents) {
411
+ outputs.push(...this.compileOutputContracts(
412
+ agent,
413
+ `.claude/agents/${agent.id}-agent/contracts`
414
+ ));
415
+ }
416
+ return outputs;
417
+ }
418
+ compileAllScripts(agents) {
419
+ const outputs = [];
420
+ for (const agent of agents) {
421
+ outputs.push(...this.compileScriptFiles(
422
+ agent,
423
+ `.claude/agents/${agent.id}-agent/scripts`
424
+ ));
425
+ }
426
+ return outputs;
427
+ }
428
+ compileAllAssets(agents) {
429
+ const outputs = [];
430
+ for (const agent of agents) {
431
+ outputs.push(...this.compileAssetFiles(
432
+ agent,
433
+ `.claude/agents/${agent.id}-agent/assets`
434
+ ));
435
+ }
436
+ return outputs;
437
+ }
309
438
  compilePluginBundle(agents, config, rootDir) {
310
439
  const outputs = [];
311
440
  const agentList = agents.map((a) => `- **${a.name}** (\`${a.id}\`): ${a.description.trim().split("\n")[0]}`).join("\n");
@@ -363,6 +492,46 @@ ${body}
363
492
  });
364
493
  }
365
494
  }
495
+ for (const agent of agents) {
496
+ if (!agent.examples?.length) continue;
497
+ for (const example of agent.examples) {
498
+ outputs.push({
499
+ filePath: `${rootDir}/examples/${agent.id}/${example.id}.md`,
500
+ content: assembleExample(example) + "\n",
501
+ overwriteStrategy: "replace"
502
+ });
503
+ }
504
+ }
505
+ for (const agent of agents) {
506
+ if (!agent.outputContracts?.length) continue;
507
+ for (const contract of agent.outputContracts) {
508
+ outputs.push({
509
+ filePath: `${rootDir}/contracts/${agent.id}/${contract.id}.md`,
510
+ content: assembleOutputContract(contract) + "\n",
511
+ overwriteStrategy: "replace"
512
+ });
513
+ }
514
+ }
515
+ for (const agent of agents) {
516
+ if (!agent.scripts?.length) continue;
517
+ for (const script of agent.scripts) {
518
+ outputs.push({
519
+ filePath: `${rootDir}/scripts/${agent.id}/${script.id}.md`,
520
+ content: assembleScript(script) + "\n",
521
+ overwriteStrategy: "replace"
522
+ });
523
+ }
524
+ }
525
+ for (const agent of agents) {
526
+ if (!agent.assets?.length) continue;
527
+ for (const asset of agent.assets) {
528
+ outputs.push({
529
+ filePath: `${rootDir}/assets/${agent.id}/${asset.id}.md`,
530
+ content: assembleAsset(asset) + "\n",
531
+ overwriteStrategy: "replace"
532
+ });
533
+ }
534
+ }
366
535
  const sharedKnowledge = agents.flatMap((a) => a.sharedKnowledge).filter((v, i, arr) => arr.indexOf(v) === i && v);
367
536
  for (let i = 0; i < sharedKnowledge.length; i++) {
368
537
  outputs.push({
@@ -491,6 +660,50 @@ ${ref.content}
491
660
  }
492
661
  return outputs;
493
662
  }
663
+ compileAllExamples(agents) {
664
+ const outputs = [];
665
+ for (const agent of agents) {
666
+ outputs.push(...this.compileExamples(
667
+ agent,
668
+ `.cursor/rules/${agent.id}-examples`,
669
+ ".mdc"
670
+ ));
671
+ }
672
+ return outputs;
673
+ }
674
+ compileAllOutputContracts(agents) {
675
+ const outputs = [];
676
+ for (const agent of agents) {
677
+ outputs.push(...this.compileOutputContracts(
678
+ agent,
679
+ `.cursor/rules/${agent.id}-contracts`,
680
+ ".mdc"
681
+ ));
682
+ }
683
+ return outputs;
684
+ }
685
+ compileAllScripts(agents) {
686
+ const outputs = [];
687
+ for (const agent of agents) {
688
+ outputs.push(...this.compileScriptFiles(
689
+ agent,
690
+ `.cursor/rules/${agent.id}-scripts`,
691
+ ".mdc"
692
+ ));
693
+ }
694
+ return outputs;
695
+ }
696
+ compileAllAssets(agents) {
697
+ const outputs = [];
698
+ for (const agent of agents) {
699
+ outputs.push(...this.compileAssetFiles(
700
+ agent,
701
+ `.cursor/rules/${agent.id}-assets`,
702
+ ".mdc"
703
+ ));
704
+ }
705
+ return outputs;
706
+ }
494
707
  compilePluginBundle(agents, config, rootDir) {
495
708
  const outputs = [];
496
709
  const pluginId = toKebabCursorPluginId(config.projectName);
@@ -576,6 +789,82 @@ ${assembleSkill(skill)}
576
789
  content: `${refFrontmatter}
577
790
 
578
791
  ${assembleReference(ref)}
792
+ `,
793
+ overwriteStrategy: "replace"
794
+ });
795
+ }
796
+ }
797
+ for (const agent of agents) {
798
+ if (!agent.examples?.length) continue;
799
+ const globs = agent.globs?.length ? agent.globs.join(", ") : void 0;
800
+ for (const example of agent.examples) {
801
+ const exFrontmatter = this.formatFrontmatter({
802
+ description: `${agent.name} example: ${example.name}`,
803
+ alwaysApply: false,
804
+ globs: globs || void 0
805
+ });
806
+ outputs.push({
807
+ filePath: `${rootDir}/examples/${agent.id}/${example.id}.mdc`,
808
+ content: `${exFrontmatter}
809
+
810
+ ${assembleExample(example)}
811
+ `,
812
+ overwriteStrategy: "replace"
813
+ });
814
+ }
815
+ }
816
+ for (const agent of agents) {
817
+ if (!agent.outputContracts?.length) continue;
818
+ const globs = agent.globs?.length ? agent.globs.join(", ") : void 0;
819
+ for (const contract of agent.outputContracts) {
820
+ const cFrontmatter = this.formatFrontmatter({
821
+ description: `${agent.name} contract: ${contract.name}`,
822
+ alwaysApply: false,
823
+ globs: globs || void 0
824
+ });
825
+ outputs.push({
826
+ filePath: `${rootDir}/contracts/${agent.id}/${contract.id}.mdc`,
827
+ content: `${cFrontmatter}
828
+
829
+ ${assembleOutputContract(contract)}
830
+ `,
831
+ overwriteStrategy: "replace"
832
+ });
833
+ }
834
+ }
835
+ for (const agent of agents) {
836
+ if (!agent.scripts?.length) continue;
837
+ const globs = agent.globs?.length ? agent.globs.join(", ") : void 0;
838
+ for (const script of agent.scripts) {
839
+ const sFrontmatter = this.formatFrontmatter({
840
+ description: `${agent.name} script: ${script.name}`,
841
+ alwaysApply: false,
842
+ globs: globs || void 0
843
+ });
844
+ outputs.push({
845
+ filePath: `${rootDir}/scripts/${agent.id}/${script.id}.mdc`,
846
+ content: `${sFrontmatter}
847
+
848
+ ${assembleScript(script)}
849
+ `,
850
+ overwriteStrategy: "replace"
851
+ });
852
+ }
853
+ }
854
+ for (const agent of agents) {
855
+ if (!agent.assets?.length) continue;
856
+ const globs = agent.globs?.length ? agent.globs.join(", ") : void 0;
857
+ for (const asset of agent.assets) {
858
+ const aFrontmatter = this.formatFrontmatter({
859
+ description: `${agent.name} asset: ${asset.name}`,
860
+ alwaysApply: false,
861
+ globs: globs || void 0
862
+ });
863
+ outputs.push({
864
+ filePath: `${rootDir}/assets/${agent.id}/${asset.id}.mdc`,
865
+ content: `${aFrontmatter}
866
+
867
+ ${assembleAsset(asset)}
579
868
  `,
580
869
  overwriteStrategy: "replace"
581
870
  });
@@ -669,6 +958,46 @@ ${body}
669
958
  }
670
959
  return outputs;
671
960
  }
961
+ compileAllExamples(agents) {
962
+ const outputs = [];
963
+ for (const agent of agents) {
964
+ outputs.push(...this.compileExamples(
965
+ agent,
966
+ `.codex/agents/${agent.id}-agent/examples`
967
+ ));
968
+ }
969
+ return outputs;
970
+ }
971
+ compileAllOutputContracts(agents) {
972
+ const outputs = [];
973
+ for (const agent of agents) {
974
+ outputs.push(...this.compileOutputContracts(
975
+ agent,
976
+ `.codex/agents/${agent.id}-agent/contracts`
977
+ ));
978
+ }
979
+ return outputs;
980
+ }
981
+ compileAllScripts(agents) {
982
+ const outputs = [];
983
+ for (const agent of agents) {
984
+ outputs.push(...this.compileScriptFiles(
985
+ agent,
986
+ `.codex/agents/${agent.id}-agent/scripts`
987
+ ));
988
+ }
989
+ return outputs;
990
+ }
991
+ compileAllAssets(agents) {
992
+ const outputs = [];
993
+ for (const agent of agents) {
994
+ outputs.push(...this.compileAssetFiles(
995
+ agent,
996
+ `.codex/agents/${agent.id}-agent/assets`
997
+ ));
998
+ }
999
+ return outputs;
1000
+ }
672
1001
  compilePluginBundle(agents, _config, rootDir) {
673
1002
  const outputs = [];
674
1003
  const sections = agents.map((agent) => {
@@ -729,6 +1058,46 @@ ${body}
729
1058
  });
730
1059
  }
731
1060
  }
1061
+ for (const agent of agents) {
1062
+ if (!agent.examples?.length) continue;
1063
+ for (const example of agent.examples) {
1064
+ outputs.push({
1065
+ filePath: `${rootDir}/examples/${agent.id}/${example.id}.md`,
1066
+ content: assembleExample(example) + "\n",
1067
+ overwriteStrategy: "replace"
1068
+ });
1069
+ }
1070
+ }
1071
+ for (const agent of agents) {
1072
+ if (!agent.outputContracts?.length) continue;
1073
+ for (const contract of agent.outputContracts) {
1074
+ outputs.push({
1075
+ filePath: `${rootDir}/contracts/${agent.id}/${contract.id}.md`,
1076
+ content: assembleOutputContract(contract) + "\n",
1077
+ overwriteStrategy: "replace"
1078
+ });
1079
+ }
1080
+ }
1081
+ for (const agent of agents) {
1082
+ if (!agent.scripts?.length) continue;
1083
+ for (const script of agent.scripts) {
1084
+ outputs.push({
1085
+ filePath: `${rootDir}/scripts/${agent.id}/${script.id}.md`,
1086
+ content: assembleScript(script) + "\n",
1087
+ overwriteStrategy: "replace"
1088
+ });
1089
+ }
1090
+ }
1091
+ for (const agent of agents) {
1092
+ if (!agent.assets?.length) continue;
1093
+ for (const asset of agent.assets) {
1094
+ outputs.push({
1095
+ filePath: `${rootDir}/assets/${agent.id}/${asset.id}.md`,
1096
+ content: assembleAsset(asset) + "\n",
1097
+ overwriteStrategy: "replace"
1098
+ });
1099
+ }
1100
+ }
732
1101
  return outputs;
733
1102
  }
734
1103
  validate(outputs) {
@@ -817,6 +1186,46 @@ ${body}
817
1186
  }
818
1187
  return outputs;
819
1188
  }
1189
+ compileAllExamples(agents) {
1190
+ const outputs = [];
1191
+ for (const agent of agents) {
1192
+ outputs.push(...this.compileExamples(
1193
+ agent,
1194
+ `.agents/skills/${agent.id}-agent/examples`
1195
+ ));
1196
+ }
1197
+ return outputs;
1198
+ }
1199
+ compileAllOutputContracts(agents) {
1200
+ const outputs = [];
1201
+ for (const agent of agents) {
1202
+ outputs.push(...this.compileOutputContracts(
1203
+ agent,
1204
+ `.agents/skills/${agent.id}-agent/contracts`
1205
+ ));
1206
+ }
1207
+ return outputs;
1208
+ }
1209
+ compileAllScripts(agents) {
1210
+ const outputs = [];
1211
+ for (const agent of agents) {
1212
+ outputs.push(...this.compileScriptFiles(
1213
+ agent,
1214
+ `.agents/skills/${agent.id}-agent/scripts`
1215
+ ));
1216
+ }
1217
+ return outputs;
1218
+ }
1219
+ compileAllAssets(agents) {
1220
+ const outputs = [];
1221
+ for (const agent of agents) {
1222
+ outputs.push(...this.compileAssetFiles(
1223
+ agent,
1224
+ `.agents/skills/${agent.id}-agent/assets`
1225
+ ));
1226
+ }
1227
+ return outputs;
1228
+ }
820
1229
  compilePluginBundle(agents, _config, rootDir) {
821
1230
  const outputs = [];
822
1231
  const agentList = agents.map((a) => `- **${a.name}** (\`${a.id}\`): ${a.description.trim().split("\n")[0]}`).join("\n");
@@ -872,6 +1281,46 @@ ${body}
872
1281
  });
873
1282
  }
874
1283
  }
1284
+ for (const agent of agents) {
1285
+ if (!agent.examples?.length) continue;
1286
+ for (const example of agent.examples) {
1287
+ outputs.push({
1288
+ filePath: `${rootDir}/examples/${agent.id}/${example.id}.md`,
1289
+ content: assembleExample(example) + "\n",
1290
+ overwriteStrategy: "replace"
1291
+ });
1292
+ }
1293
+ }
1294
+ for (const agent of agents) {
1295
+ if (!agent.outputContracts?.length) continue;
1296
+ for (const contract of agent.outputContracts) {
1297
+ outputs.push({
1298
+ filePath: `${rootDir}/contracts/${agent.id}/${contract.id}.md`,
1299
+ content: assembleOutputContract(contract) + "\n",
1300
+ overwriteStrategy: "replace"
1301
+ });
1302
+ }
1303
+ }
1304
+ for (const agent of agents) {
1305
+ if (!agent.scripts?.length) continue;
1306
+ for (const script of agent.scripts) {
1307
+ outputs.push({
1308
+ filePath: `${rootDir}/scripts/${agent.id}/${script.id}.md`,
1309
+ content: assembleScript(script) + "\n",
1310
+ overwriteStrategy: "replace"
1311
+ });
1312
+ }
1313
+ }
1314
+ for (const agent of agents) {
1315
+ if (!agent.assets?.length) continue;
1316
+ for (const asset of agent.assets) {
1317
+ outputs.push({
1318
+ filePath: `${rootDir}/assets/${agent.id}/${asset.id}.md`,
1319
+ content: assembleAsset(asset) + "\n",
1320
+ overwriteStrategy: "replace"
1321
+ });
1322
+ }
1323
+ }
875
1324
  const sharedKnowledge = agents.flatMap((a) => a.sharedKnowledge).filter((v, i, arr) => arr.indexOf(v) === i && v);
876
1325
  for (let i = 0; i < sharedKnowledge.length; i++) {
877
1326
  outputs.push({
@@ -951,10 +1400,30 @@ var PluginCompiler = class {
951
1400
  files: {
952
1401
  agents: agents.length,
953
1402
  skills: agents.reduce((sum, a) => sum + a.skills.length, 0),
954
- references: agents.reduce((sum, a) => sum + a.references.length, 0)
1403
+ references: agents.reduce((sum, a) => sum + a.references.length, 0),
1404
+ examples: agents.reduce((sum, a) => sum + (a.examples?.length ?? 0), 0),
1405
+ outputContracts: agents.reduce((sum, a) => sum + (a.outputContracts?.length ?? 0), 0),
1406
+ scripts: agents.reduce((sum, a) => sum + (a.scripts?.length ?? 0), 0),
1407
+ assets: agents.reduce((sum, a) => sum + (a.assets?.length ?? 0), 0)
955
1408
  },
956
1409
  bundles
957
1410
  };
1411
+ const governanceEntries = [];
1412
+ for (const agent of agents) {
1413
+ for (const skill of agent.skills) {
1414
+ if (skill.governance) {
1415
+ governanceEntries.push({
1416
+ skillId: skill.id,
1417
+ agentId: agent.id,
1418
+ name: skill.name,
1419
+ governance: skill.governance
1420
+ });
1421
+ }
1422
+ }
1423
+ }
1424
+ if (governanceEntries.length) {
1425
+ manifest.governance = governanceEntries;
1426
+ }
958
1427
  outputs.push({
959
1428
  filePath: `${pluginDir}/manifest.json`,
960
1429
  content: JSON.stringify(manifest, null, 2) + "\n",
@@ -1017,7 +1486,11 @@ async function promptGenerateOptions(configTeams, configPlatforms) {
1017
1486
  choices: [
1018
1487
  { name: "Agents", value: "agents", checked: true },
1019
1488
  { name: "Skills", value: "skills", checked: true },
1020
- { name: "References", value: "references", checked: true }
1489
+ { name: "References", value: "references", checked: true },
1490
+ { name: "Examples", value: "examples", checked: true },
1491
+ { name: "Output Contracts", value: "output-contracts", checked: true },
1492
+ { name: "Scripts", value: "scripts", checked: true },
1493
+ { name: "Assets", value: "assets", checked: true }
1021
1494
  ]
1022
1495
  },
1023
1496
  {
@@ -1165,6 +1638,10 @@ function loadPlugin(pluginPath) {
1165
1638
  const skillContent = readFileSync3(agentFilePath, "utf-8").trim();
1166
1639
  const skills = loadSkillFiles(resolve5(bundleDir, "skills", meta.id));
1167
1640
  const references = loadReferenceFiles(resolve5(bundleDir, "kb", meta.id));
1641
+ const examples = loadExampleFiles(resolve5(bundleDir, "examples", meta.id));
1642
+ const outputContracts = loadOutputContractFiles(resolve5(bundleDir, "contracts", meta.id));
1643
+ const scripts = loadScriptFilesFromPlugin(resolve5(bundleDir, "scripts", meta.id));
1644
+ const assets = loadAssetFilesFromPlugin(resolve5(bundleDir, "assets", meta.id));
1168
1645
  const sharedKnowledge = loadSharedKnowledge(resolve5(bundleDir, "kb", "shared"));
1169
1646
  agents.push({
1170
1647
  id: meta.id,
@@ -1180,6 +1657,10 @@ function loadPlugin(pluginPath) {
1180
1657
  rulesContent: "",
1181
1658
  skills,
1182
1659
  references,
1660
+ examples,
1661
+ outputContracts,
1662
+ scripts,
1663
+ assets,
1183
1664
  sharedKnowledge,
1184
1665
  // Unused during install — compilers only need the fields above
1185
1666
  systemPrompt: "",
@@ -1207,13 +1688,16 @@ function loadSkillFiles(dir) {
1207
1688
  if (!existsSync4(dir)) return [];
1208
1689
  return readdirSync(dir).filter((f) => f.endsWith(".md")).map((f) => {
1209
1690
  const id = basename(f, ".md");
1210
- const content = readFileSync3(resolve5(dir, f), "utf-8").trim();
1691
+ const raw = readFileSync3(resolve5(dir, f), "utf-8").trim();
1692
+ const { data, content } = parseFrontmatter(raw);
1211
1693
  return {
1212
1694
  id,
1213
- name: id.replace(/-/g, " "),
1214
- description: "",
1215
- trigger: "",
1216
- content
1695
+ name: data.name || id.replace(/-/g, " "),
1696
+ description: data.description || "",
1697
+ trigger: data.trigger || "",
1698
+ content,
1699
+ useCases: data.useCases || void 0,
1700
+ tags: data.tags || void 0
1217
1701
  };
1218
1702
  });
1219
1703
  }
@@ -1221,13 +1705,80 @@ function loadReferenceFiles(dir) {
1221
1705
  if (!existsSync4(dir)) return [];
1222
1706
  return readdirSync(dir).filter((f) => f.endsWith(".md")).map((f) => {
1223
1707
  const id = basename(f, ".md");
1224
- const content = readFileSync3(resolve5(dir, f), "utf-8").trim();
1708
+ const raw = readFileSync3(resolve5(dir, f), "utf-8").trim();
1709
+ const { data, content } = parseFrontmatter(raw);
1710
+ return {
1711
+ id,
1712
+ title: data.title || id.replace(/-/g, " "),
1713
+ description: data.description || "",
1714
+ whenToRead: data.whenToRead || "",
1715
+ content,
1716
+ tags: data.tags || void 0
1717
+ };
1718
+ });
1719
+ }
1720
+ function loadExampleFiles(dir) {
1721
+ if (!existsSync4(dir)) return [];
1722
+ return readdirSync(dir).filter((f) => f.endsWith(".md")).map((f) => {
1723
+ const id = basename(f, ".md");
1724
+ const raw = readFileSync3(resolve5(dir, f), "utf-8").trim();
1725
+ const { data, content } = parseFrontmatter(raw);
1726
+ return {
1727
+ id,
1728
+ name: data.name || id.replace(/-/g, " "),
1729
+ description: data.description || "",
1730
+ skillRef: data.skillRef || void 0,
1731
+ content,
1732
+ tags: data.tags || void 0
1733
+ };
1734
+ });
1735
+ }
1736
+ function loadOutputContractFiles(dir) {
1737
+ if (!existsSync4(dir)) return [];
1738
+ return readdirSync(dir).filter((f) => f.endsWith(".md")).map((f) => {
1739
+ const id = basename(f, ".md");
1740
+ const raw = readFileSync3(resolve5(dir, f), "utf-8").trim();
1741
+ const { data, content } = parseFrontmatter(raw);
1742
+ return {
1743
+ id,
1744
+ name: data.name || id.replace(/-/g, " "),
1745
+ description: data.description || "",
1746
+ skillRef: data.skillRef || void 0,
1747
+ format: data.format || void 0,
1748
+ content,
1749
+ tags: data.tags || void 0
1750
+ };
1751
+ });
1752
+ }
1753
+ function loadScriptFilesFromPlugin(dir) {
1754
+ if (!existsSync4(dir)) return [];
1755
+ return readdirSync(dir).filter((f) => f.endsWith(".md")).map((f) => {
1756
+ const id = basename(f, ".md");
1757
+ const raw = readFileSync3(resolve5(dir, f), "utf-8").trim();
1758
+ const { data, content } = parseFrontmatter(raw);
1225
1759
  return {
1226
1760
  id,
1227
- title: id.replace(/-/g, " "),
1228
- description: "",
1229
- whenToRead: "",
1230
- content
1761
+ name: data.name || id.replace(/-/g, " "),
1762
+ description: data.description || "",
1763
+ language: data.language || "unknown",
1764
+ content,
1765
+ tags: data.tags || void 0
1766
+ };
1767
+ });
1768
+ }
1769
+ function loadAssetFilesFromPlugin(dir) {
1770
+ if (!existsSync4(dir)) return [];
1771
+ return readdirSync(dir).filter((f) => f.endsWith(".md")).map((f) => {
1772
+ const id = basename(f, ".md");
1773
+ const raw = readFileSync3(resolve5(dir, f), "utf-8").trim();
1774
+ const { data, content } = parseFrontmatter(raw);
1775
+ return {
1776
+ id,
1777
+ name: data.name || id.replace(/-/g, " "),
1778
+ description: data.description || "",
1779
+ format: data.format || "unknown",
1780
+ content,
1781
+ tags: data.tags || void 0
1231
1782
  };
1232
1783
  });
1233
1784
  }
@@ -1428,30 +1979,137 @@ function tryRemoveEmptyDir(dir) {
1428
1979
  }
1429
1980
  }
1430
1981
 
1982
+ // src/cli/audit.ts
1983
+ import chalk6 from "chalk";
1984
+ function auditSkill(agent, skill) {
1985
+ const entries = [];
1986
+ const base = { agentId: agent.id, agentName: agent.name, skillId: skill.id, skillName: skill.name };
1987
+ if (!skill.governance) {
1988
+ entries.push({ ...base, issue: "No governance metadata", severity: "warning" });
1989
+ return entries;
1990
+ }
1991
+ const gov = skill.governance;
1992
+ if (gov.status === "deprecated") {
1993
+ entries.push({
1994
+ ...base,
1995
+ issue: `Deprecated${gov.deprecatedReason ? `: ${gov.deprecatedReason}` : ""}`,
1996
+ severity: "error"
1997
+ });
1998
+ }
1999
+ if (gov.status === "review-needed") {
2000
+ entries.push({ ...base, issue: "Marked for review", severity: "warning" });
2001
+ }
2002
+ if (gov.status === "draft") {
2003
+ entries.push({ ...base, issue: "Still in draft", severity: "info" });
2004
+ }
2005
+ if (!gov.version) {
2006
+ entries.push({ ...base, issue: "Missing version", severity: "info" });
2007
+ }
2008
+ if (!gov.owner) {
2009
+ entries.push({ ...base, issue: "Missing owner", severity: "info" });
2010
+ }
2011
+ if (!skill.description) {
2012
+ entries.push({ ...base, issue: "Missing skill description", severity: "warning" });
2013
+ }
2014
+ if (!skill.trigger) {
2015
+ entries.push({ ...base, issue: "Missing skill trigger", severity: "info" });
2016
+ }
2017
+ return entries;
2018
+ }
2019
+ async function runAudit(cwd = process.cwd()) {
2020
+ const config = await loadConfig(cwd);
2021
+ const agents = loadAgents(config, cwd);
2022
+ const allEntries = [];
2023
+ let totalSkills = 0;
2024
+ let withGovernance = 0;
2025
+ for (const agent of agents) {
2026
+ for (const skill of agent.skills) {
2027
+ totalSkills++;
2028
+ if (skill.governance) withGovernance++;
2029
+ allEntries.push(...auditSkill(agent, skill));
2030
+ }
2031
+ }
2032
+ console.log(chalk6.bold("\nSkill Governance Audit"));
2033
+ console.log(chalk6.dim("\u2500".repeat(50)));
2034
+ console.log(`Total skills: ${totalSkills}`);
2035
+ console.log(`With governance metadata: ${withGovernance}/${totalSkills}`);
2036
+ const statusCounts = {
2037
+ "active": 0,
2038
+ "draft": 0,
2039
+ "review-needed": 0,
2040
+ "deprecated": 0,
2041
+ "none": 0
2042
+ };
2043
+ for (const agent of agents) {
2044
+ for (const skill of agent.skills) {
2045
+ const status = skill.governance?.status ?? "none";
2046
+ statusCounts[status]++;
2047
+ }
2048
+ }
2049
+ console.log(`
2050
+ Status breakdown:`);
2051
+ if (statusCounts.active) console.log(chalk6.green(` active: ${statusCounts.active}`));
2052
+ if (statusCounts.draft) console.log(chalk6.blue(` draft: ${statusCounts.draft}`));
2053
+ if (statusCounts["review-needed"]) console.log(chalk6.yellow(` review-needed: ${statusCounts["review-needed"]}`));
2054
+ if (statusCounts.deprecated) console.log(chalk6.red(` deprecated: ${statusCounts.deprecated}`));
2055
+ if (statusCounts.none) console.log(chalk6.dim(` no status: ${statusCounts.none}`));
2056
+ const errors = allEntries.filter((e) => e.severity === "error");
2057
+ const warnings = allEntries.filter((e) => e.severity === "warning");
2058
+ const infos = allEntries.filter((e) => e.severity === "info");
2059
+ if (errors.length) {
2060
+ console.log(chalk6.red(`
2061
+ \u2717 Errors (${errors.length}):`));
2062
+ for (const e of errors) {
2063
+ console.log(chalk6.red(` ${e.agentId}/${e.skillId}: ${e.issue}`));
2064
+ }
2065
+ }
2066
+ if (warnings.length) {
2067
+ console.log(chalk6.yellow(`
2068
+ \u26A0 Warnings (${warnings.length}):`));
2069
+ for (const e of warnings) {
2070
+ console.log(chalk6.yellow(` ${e.agentId}/${e.skillId}: ${e.issue}`));
2071
+ }
2072
+ }
2073
+ if (infos.length) {
2074
+ console.log(chalk6.blue(`
2075
+ \u2139 Info (${infos.length}):`));
2076
+ for (const e of infos) {
2077
+ console.log(chalk6.blue(` ${e.agentId}/${e.skillId}: ${e.issue}`));
2078
+ }
2079
+ }
2080
+ if (!allEntries.length) {
2081
+ console.log(chalk6.green("\n\u2713 All skills pass governance checks"));
2082
+ }
2083
+ console.log();
2084
+ if (errors.length) {
2085
+ process.exit(1);
2086
+ }
2087
+ }
2088
+
1431
2089
  // bin/cli.ts
1432
2090
  var program = new Command();
1433
- program.name("aigent-team").description("Cross-platform AI agent team plugin for Claude Code, Cursor, Codex, and Antigravity").version("0.2.0");
2091
+ program.name("aigent-team").description("Cross-platform AI agent team plugin for Claude Code, Cursor, Codex, and Antigravity").version("0.4.0");
1434
2092
  program.command("init").description("Initialize aigent-team in your project (interactive)").action(async () => {
1435
2093
  await runInit(process.cwd());
1436
2094
  });
1437
2095
  program.command("generate").description("Generate platform-specific config files from aigent-team config").option("-p, --platform <platform>", "Generate for a specific platform only").option("-s, --scope <scopes>", "Output scope(s), comma-separated: all | agents | skills | references | plugin", "all").option("-t, --team <teams>", "Team roles to generate, comma-separated (overrides config)").action(async (options) => {
1438
2096
  if (options.platform && !PLATFORMS.includes(options.platform)) {
1439
- console.log(chalk6.red(`Unknown platform: ${options.platform}. Valid: ${PLATFORMS.join(", ")}`));
2097
+ console.log(chalk7.red(`Unknown platform: ${options.platform}. Valid: ${PLATFORMS.join(", ")}`));
1440
2098
  process.exit(1);
1441
2099
  }
1442
2100
  const scopes = options.scope.split(",");
1443
2101
  for (const s of scopes) {
1444
2102
  if (!GENERATE_SCOPES.includes(s)) {
1445
- console.log(chalk6.red(`Unknown scope: ${s}. Valid: ${GENERATE_SCOPES.join(", ")}`));
2103
+ console.log(chalk7.red(`Unknown scope: ${s}. Valid: ${GENERATE_SCOPES.join(", ")}`));
1446
2104
  process.exit(1);
1447
2105
  }
1448
2106
  }
1449
2107
  if (scopes.includes("plugin") && scopes.length > 1) {
1450
- console.log(chalk6.red(`Scope 'plugin' is exclusive and cannot be combined with other scopes.`));
2108
+ console.log(chalk7.red(`Scope 'plugin' is exclusive and cannot be combined with other scopes.`));
1451
2109
  process.exit(1);
1452
2110
  }
1453
2111
  if (scopes.includes("all") && scopes.length > 1) {
1454
- console.log(chalk6.red(`Scope 'all' is exclusive and cannot be combined with other scopes.`));
2112
+ console.log(chalk7.red(`Scope 'all' is exclusive and cannot be combined with other scopes.`));
1455
2113
  process.exit(1);
1456
2114
  }
1457
2115
  let teams;
@@ -1459,7 +2117,7 @@ program.command("generate").description("Generate platform-specific config files
1459
2117
  teams = options.team.split(",");
1460
2118
  for (const t of teams) {
1461
2119
  if (!TEAM_ROLES.includes(t)) {
1462
- console.log(chalk6.red(`Unknown team role: ${t}. Valid: ${TEAM_ROLES.join(", ")}`));
2120
+ console.log(chalk7.red(`Unknown team role: ${t}. Valid: ${TEAM_ROLES.join(", ")}`));
1463
2121
  process.exit(1);
1464
2122
  }
1465
2123
  }
@@ -1478,7 +2136,7 @@ program.command("install").description("Install a plugin bundle into the current
1478
2136
  "Install Cursor IDE bundle from plugin cursor-ide-plugin/ to ~/.cursor/plugins/local/ (see cursor.com/docs/plugins)"
1479
2137
  ).action(async (pluginPath, options) => {
1480
2138
  if (options.platform && !PLATFORMS.includes(options.platform)) {
1481
- console.log(chalk6.red(`Unknown platform: ${options.platform}. Valid: ${PLATFORMS.join(", ")}`));
2139
+ console.log(chalk7.red(`Unknown platform: ${options.platform}. Valid: ${PLATFORMS.join(", ")}`));
1482
2140
  process.exit(1);
1483
2141
  }
1484
2142
  await runInstall(pluginPath, process.cwd(), {
@@ -1490,4 +2148,7 @@ program.command("install").description("Install a plugin bundle into the current
1490
2148
  program.command("uninstall").description("Uninstall a previously installed plugin").argument("<plugin-name>", "Name of the plugin to uninstall").action(async (pluginName) => {
1491
2149
  await runUninstall(pluginName, process.cwd());
1492
2150
  });
2151
+ program.command("audit").description("Audit skill governance metadata \u2014 report deprecated, review-needed, and missing metadata").action(async () => {
2152
+ await runAudit(process.cwd());
2153
+ });
1493
2154
  program.parse();