@skillkit/cli 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -693,6 +693,58 @@ declare class AuditCommand extends Command {
693
693
  private buildQuery;
694
694
  }
695
695
 
696
+ declare class AgentCommand extends Command {
697
+ static paths: string[][];
698
+ static usage: clipanion.Usage;
699
+ execute(): Promise<number>;
700
+ }
701
+ declare class AgentListCommand extends Command {
702
+ static paths: string[][];
703
+ static usage: clipanion.Usage;
704
+ json: boolean;
705
+ project: boolean;
706
+ global: boolean;
707
+ execute(): Promise<number>;
708
+ }
709
+ declare class AgentShowCommand extends Command {
710
+ static paths: string[][];
711
+ static usage: clipanion.Usage;
712
+ name: string;
713
+ execute(): Promise<number>;
714
+ }
715
+ declare class AgentCreateCommand extends Command {
716
+ static paths: string[][];
717
+ static usage: clipanion.Usage;
718
+ name: string;
719
+ model: string | undefined;
720
+ description: string | undefined;
721
+ global: boolean;
722
+ execute(): Promise<number>;
723
+ }
724
+ declare class AgentTranslateCommand extends Command {
725
+ static paths: string[][];
726
+ static usage: clipanion.Usage;
727
+ name: string | undefined;
728
+ to: string;
729
+ output: string | undefined;
730
+ dryRun: boolean;
731
+ all: boolean;
732
+ execute(): Promise<number>;
733
+ }
734
+ declare class AgentSyncCommand extends Command {
735
+ static paths: string[][];
736
+ static usage: clipanion.Usage;
737
+ agent: string | undefined;
738
+ execute(): Promise<number>;
739
+ }
740
+ declare class AgentValidateCommand extends Command {
741
+ static paths: string[][];
742
+ static usage: clipanion.Usage;
743
+ agentPath: string | undefined;
744
+ all: boolean;
745
+ execute(): Promise<number>;
746
+ }
747
+
696
748
  declare const loadSkillMetadata: typeof loadSkillMetadata$1;
697
749
  declare const saveSkillMetadata: typeof saveSkillMetadata$1;
698
750
  declare function getSearchDirs(agentType?: AgentType): string[];
@@ -700,4 +752,4 @@ declare function getInstallDir(global?: boolean, agentType?: AgentType): string;
700
752
  declare function getAgentConfigPath(agentType?: AgentType): string;
701
753
  declare function initProject(agentType?: AgentType): Promise<void>;
702
754
 
703
- export { AICommand, AuditCommand, CICDCommand, CommandCmd, ContextCommand, CreateCommand, DisableCommand, EnableCommand, HookCommand, InitCommand, InstallCommand, ListCommand, MarketplaceCommand, MemoryCommand, MethodologyCommand, PauseCommand, PlanCommand, PluginCommand, ReadCommand, RecommendCommand, RemoveCommand, ResumeCommand, RunCommand, SettingsCommand, StatusCommand, SyncCommand, TeamCommand, TestCommand, TranslateCommand, UICommand, UpdateCommand, ValidateCommand, WorkflowCreateCommand, WorkflowListCommand, WorkflowRunCommand, getAgentConfigPath, getInstallDir, getSearchDirs, initProject, loadSkillMetadata, saveSkillMetadata };
755
+ export { AICommand, AgentCommand, AgentCreateCommand, AgentListCommand, AgentShowCommand, AgentSyncCommand, AgentTranslateCommand, AgentValidateCommand, AuditCommand, CICDCommand, CommandCmd, ContextCommand, CreateCommand, DisableCommand, EnableCommand, HookCommand, InitCommand, InstallCommand, ListCommand, MarketplaceCommand, MemoryCommand, MethodologyCommand, PauseCommand, PlanCommand, PluginCommand, ReadCommand, RecommendCommand, RemoveCommand, ResumeCommand, RunCommand, SettingsCommand, StatusCommand, SyncCommand, TeamCommand, TestCommand, TranslateCommand, UICommand, UpdateCommand, ValidateCommand, WorkflowCreateCommand, WorkflowListCommand, WorkflowRunCommand, getAgentConfigPath, getInstallDir, getSearchDirs, initProject, loadSkillMetadata, saveSkillMetadata };
package/dist/index.js CHANGED
@@ -3803,12 +3803,12 @@ ${learning.title}
3803
3803
  }
3804
3804
  const outputPath = this.output || `.skillkit/exports/${skillName}/SKILL.md`;
3805
3805
  const { dirname: dirname5 } = await import("path");
3806
- const { existsSync: existsSync14, mkdirSync: mkdirSync7, writeFileSync: writeFileSync6 } = await import("fs");
3806
+ const { existsSync: existsSync15, mkdirSync: mkdirSync8, writeFileSync: writeFileSync7 } = await import("fs");
3807
3807
  const outputDir = dirname5(outputPath);
3808
- if (!existsSync14(outputDir)) {
3809
- mkdirSync7(outputDir, { recursive: true });
3808
+ if (!existsSync15(outputDir)) {
3809
+ mkdirSync8(outputDir, { recursive: true });
3810
3810
  }
3811
- writeFileSync6(outputPath, skillContent, "utf-8");
3811
+ writeFileSync7(outputPath, skillContent, "utf-8");
3812
3812
  console.log(chalk23.green(`\u2713 Exported learning as skill: ${skillName}`));
3813
3813
  console.log(chalk23.gray(` Path: ${outputPath}`));
3814
3814
  return 0;
@@ -3823,10 +3823,10 @@ ${learning.title}
3823
3823
  console.log(chalk23.gray("Usage: skillkit memory import --input <path>"));
3824
3824
  return 1;
3825
3825
  }
3826
- const { existsSync: existsSync14, readFileSync: readFileSync7 } = await import("fs");
3826
+ const { existsSync: existsSync15, readFileSync: readFileSync7 } = await import("fs");
3827
3827
  const { resolve: resolve16 } = await import("path");
3828
3828
  const fullPath = resolve16(inputPath);
3829
- if (!existsSync14(fullPath)) {
3829
+ if (!existsSync15(fullPath)) {
3830
3830
  console.error(chalk23.red(`File not found: ${fullPath}`));
3831
3831
  return 1;
3832
3832
  }
@@ -4905,14 +4905,14 @@ var TeamCommand = class extends Command27 {
4905
4905
  }
4906
4906
  const projectPath = process.cwd();
4907
4907
  const bundlePath = join9(projectPath, ".skillkit", "bundles", `${this.name}.json`);
4908
- const { existsSync: existsSync14, readFileSync: readFileSync7, writeFileSync: writeFileSync6 } = await import("fs");
4909
- if (!existsSync14(bundlePath)) {
4908
+ const { existsSync: existsSync15, readFileSync: readFileSync7, writeFileSync: writeFileSync7 } = await import("fs");
4909
+ if (!existsSync15(bundlePath)) {
4910
4910
  this.context.stderr.write(chalk26.red(`Bundle "${this.name}" not found. Create it first with bundle-create.
4911
4911
  `));
4912
4912
  return 1;
4913
4913
  }
4914
4914
  const content = readFileSync7(bundlePath, "utf-8");
4915
- writeFileSync6(this.output, content, "utf-8");
4915
+ writeFileSync7(this.output, content, "utf-8");
4916
4916
  this.context.stdout.write(chalk26.green(`\u2713 Bundle exported to: ${this.output}
4917
4917
  `));
4918
4918
  return 0;
@@ -4922,8 +4922,8 @@ var TeamCommand = class extends Command27 {
4922
4922
  this.context.stderr.write(chalk26.red("--source <path> is required for bundle-import\n"));
4923
4923
  return 1;
4924
4924
  }
4925
- const { existsSync: existsSync14 } = await import("fs");
4926
- if (!existsSync14(this.source)) {
4925
+ const { existsSync: existsSync15 } = await import("fs");
4926
+ if (!existsSync15(this.source)) {
4927
4927
  this.context.stderr.write(chalk26.red(`Bundle file not found: ${this.source}
4928
4928
  `));
4929
4929
  return 1;
@@ -7196,8 +7196,491 @@ Recent Errors (${stats.recentErrors.length}):`));
7196
7196
  return query;
7197
7197
  }
7198
7198
  };
7199
+
7200
+ // src/commands/agent.ts
7201
+ import chalk32 from "chalk";
7202
+ import { Command as Command35, Option as Option34 } from "clipanion";
7203
+ import { existsSync as existsSync14, mkdirSync as mkdirSync7, writeFileSync as writeFileSync6 } from "fs";
7204
+ import { join as join13 } from "path";
7205
+ import { homedir as homedir2 } from "os";
7206
+ import {
7207
+ findAllAgents,
7208
+ findAgent,
7209
+ discoverAgents,
7210
+ validateAgent,
7211
+ translateAgent,
7212
+ getAgentTargetDirectory
7213
+ } from "@skillkit/core";
7214
+ var AgentCommand = class extends Command35 {
7215
+ static paths = [["agent"]];
7216
+ static usage = Command35.Usage({
7217
+ description: "Manage custom AI sub-agents",
7218
+ details: `
7219
+ This command manages custom AI sub-agents that can be used with
7220
+ Claude Code, Cursor, and other AI coding agents.
7221
+
7222
+ Agents are specialized personas (like architects, testers, reviewers)
7223
+ that can be invoked with @mentions or the --agent flag.
7224
+
7225
+ Sub-commands:
7226
+ agent list - List all installed agents
7227
+ agent show - Show agent details
7228
+ agent create - Create a new agent
7229
+ agent translate - Translate agents between formats
7230
+ agent sync - Sync agents to target AI agent
7231
+ agent validate - Validate agent definitions
7232
+ `,
7233
+ examples: [
7234
+ ["List all agents", "$0 agent list"],
7235
+ ["Show agent details", "$0 agent show architect"],
7236
+ ["Create new agent", "$0 agent create security-reviewer"],
7237
+ ["Translate to Cursor format", "$0 agent translate --to cursor"],
7238
+ ["Sync agents", "$0 agent sync --agent claude-code"]
7239
+ ]
7240
+ });
7241
+ async execute() {
7242
+ console.log(chalk32.cyan("Agent management commands:\n"));
7243
+ console.log(" agent list List all installed agents");
7244
+ console.log(" agent show <name> Show agent details");
7245
+ console.log(" agent create <name> Create a new agent");
7246
+ console.log(" agent translate Translate agents between formats");
7247
+ console.log(" agent sync Sync agents to target AI agent");
7248
+ console.log(" agent validate [path] Validate agent definitions");
7249
+ console.log();
7250
+ console.log(chalk32.dim("Run `skillkit agent <subcommand> --help` for more info"));
7251
+ return 0;
7252
+ }
7253
+ };
7254
+ var AgentListCommand = class extends Command35 {
7255
+ static paths = [["agent", "list"], ["agent", "ls"]];
7256
+ static usage = Command35.Usage({
7257
+ description: "List all installed agents",
7258
+ examples: [
7259
+ ["List all agents", "$0 agent list"],
7260
+ ["Show JSON output", "$0 agent list --json"],
7261
+ ["Show only project agents", "$0 agent list --project"]
7262
+ ]
7263
+ });
7264
+ json = Option34.Boolean("--json,-j", false, {
7265
+ description: "Output as JSON"
7266
+ });
7267
+ project = Option34.Boolean("--project,-p", false, {
7268
+ description: "Show only project agents"
7269
+ });
7270
+ global = Option34.Boolean("--global,-g", false, {
7271
+ description: "Show only global agents"
7272
+ });
7273
+ async execute() {
7274
+ const searchDirs = [process.cwd()];
7275
+ let agents = findAllAgents(searchDirs);
7276
+ if (this.project) {
7277
+ agents = agents.filter((a) => a.location === "project");
7278
+ } else if (this.global) {
7279
+ agents = agents.filter((a) => a.location === "global");
7280
+ }
7281
+ agents.sort((a, b) => {
7282
+ if (a.location !== b.location) {
7283
+ return a.location === "project" ? -1 : 1;
7284
+ }
7285
+ return a.name.localeCompare(b.name);
7286
+ });
7287
+ if (this.json) {
7288
+ console.log(JSON.stringify(agents.map((a) => ({
7289
+ name: a.name,
7290
+ description: a.description,
7291
+ path: a.path,
7292
+ location: a.location,
7293
+ enabled: a.enabled,
7294
+ model: a.frontmatter.model,
7295
+ permissionMode: a.frontmatter.permissionMode
7296
+ })), null, 2));
7297
+ return 0;
7298
+ }
7299
+ if (agents.length === 0) {
7300
+ console.log(chalk32.yellow("No agents found"));
7301
+ console.log(chalk32.dim("Create an agent with: skillkit agent create <name>"));
7302
+ return 0;
7303
+ }
7304
+ console.log(chalk32.cyan(`Installed agents (${agents.length}):
7305
+ `));
7306
+ const projectAgents = agents.filter((a) => a.location === "project");
7307
+ const globalAgents = agents.filter((a) => a.location === "global");
7308
+ if (projectAgents.length > 0) {
7309
+ console.log(chalk32.blue("Project agents:"));
7310
+ for (const agent of projectAgents) {
7311
+ printAgent(agent);
7312
+ }
7313
+ console.log();
7314
+ }
7315
+ if (globalAgents.length > 0) {
7316
+ console.log(chalk32.dim("Global agents:"));
7317
+ for (const agent of globalAgents) {
7318
+ printAgent(agent);
7319
+ }
7320
+ console.log();
7321
+ }
7322
+ console.log(
7323
+ chalk32.dim(`${projectAgents.length} project, ${globalAgents.length} global`)
7324
+ );
7325
+ return 0;
7326
+ }
7327
+ };
7328
+ var AgentShowCommand = class extends Command35 {
7329
+ static paths = [["agent", "show"], ["agent", "info"]];
7330
+ static usage = Command35.Usage({
7331
+ description: "Show details for a specific agent",
7332
+ examples: [
7333
+ ["Show agent details", "$0 agent show architect"]
7334
+ ]
7335
+ });
7336
+ name = Option34.String({ required: true });
7337
+ async execute() {
7338
+ const searchDirs = [process.cwd()];
7339
+ const agent = findAgent(this.name, searchDirs);
7340
+ if (!agent) {
7341
+ console.log(chalk32.red(`Agent not found: ${this.name}`));
7342
+ return 1;
7343
+ }
7344
+ console.log(chalk32.cyan(`Agent: ${agent.name}
7345
+ `));
7346
+ console.log(`${chalk32.dim("Description:")} ${agent.description}`);
7347
+ console.log(`${chalk32.dim("Location:")} ${agent.location} (${agent.path})`);
7348
+ console.log(`${chalk32.dim("Enabled:")} ${agent.enabled ? chalk32.green("yes") : chalk32.red("no")}`);
7349
+ const fm = agent.frontmatter;
7350
+ if (fm.model) {
7351
+ console.log(`${chalk32.dim("Model:")} ${fm.model}`);
7352
+ }
7353
+ if (fm.permissionMode) {
7354
+ console.log(`${chalk32.dim("Permission Mode:")} ${fm.permissionMode}`);
7355
+ }
7356
+ if (fm.context) {
7357
+ console.log(`${chalk32.dim("Context:")} ${fm.context}`);
7358
+ }
7359
+ if (fm.disallowedTools && fm.disallowedTools.length > 0) {
7360
+ console.log(`${chalk32.dim("Disallowed Tools:")} ${fm.disallowedTools.join(", ")}`);
7361
+ }
7362
+ if (fm.skills && fm.skills.length > 0) {
7363
+ console.log(`${chalk32.dim("Skills:")} ${fm.skills.join(", ")}`);
7364
+ }
7365
+ if (fm.hooks && fm.hooks.length > 0) {
7366
+ console.log(`${chalk32.dim("Hooks:")} ${fm.hooks.length} defined`);
7367
+ }
7368
+ if (fm.tags && fm.tags.length > 0) {
7369
+ console.log(`${chalk32.dim("Tags:")} ${fm.tags.join(", ")}`);
7370
+ }
7371
+ if (fm.author) {
7372
+ console.log(`${chalk32.dim("Author:")} ${fm.author}`);
7373
+ }
7374
+ if (fm.version) {
7375
+ console.log(`${chalk32.dim("Version:")} ${fm.version}`);
7376
+ }
7377
+ console.log();
7378
+ console.log(chalk32.dim("Content preview:"));
7379
+ console.log(chalk32.dim("\u2500".repeat(40)));
7380
+ const preview = agent.content.slice(0, 500);
7381
+ console.log(preview + (agent.content.length > 500 ? "\n..." : ""));
7382
+ return 0;
7383
+ }
7384
+ };
7385
+ var AgentCreateCommand = class extends Command35 {
7386
+ static paths = [["agent", "create"], ["agent", "new"]];
7387
+ static usage = Command35.Usage({
7388
+ description: "Create a new agent",
7389
+ examples: [
7390
+ ["Create an agent", "$0 agent create security-reviewer"],
7391
+ ["Create with model", "$0 agent create architect --model opus"],
7392
+ ["Create globally", "$0 agent create my-agent --global"]
7393
+ ]
7394
+ });
7395
+ name = Option34.String({ required: true });
7396
+ model = Option34.String("--model,-m", {
7397
+ description: "Model to use (opus, sonnet, haiku)"
7398
+ });
7399
+ description = Option34.String("--description,-d", {
7400
+ description: "Agent description"
7401
+ });
7402
+ global = Option34.Boolean("--global,-g", false, {
7403
+ description: "Create in global agents directory"
7404
+ });
7405
+ async execute() {
7406
+ const namePattern = /^[a-z0-9]+(-[a-z0-9]+)*$/;
7407
+ if (!namePattern.test(this.name)) {
7408
+ console.log(chalk32.red("Invalid agent name: must be lowercase alphanumeric with hyphens"));
7409
+ console.log(chalk32.dim("Examples: my-agent, code-reviewer, security-expert"));
7410
+ return 1;
7411
+ }
7412
+ let targetDir;
7413
+ if (this.global) {
7414
+ targetDir = join13(homedir2(), ".claude", "agents");
7415
+ } else {
7416
+ targetDir = join13(process.cwd(), ".claude", "agents");
7417
+ }
7418
+ if (!existsSync14(targetDir)) {
7419
+ mkdirSync7(targetDir, { recursive: true });
7420
+ }
7421
+ const agentPath = join13(targetDir, `${this.name}.md`);
7422
+ if (existsSync14(agentPath)) {
7423
+ console.log(chalk32.red(`Agent already exists: ${agentPath}`));
7424
+ return 1;
7425
+ }
7426
+ const description = this.description || `${this.name} agent`;
7427
+ const content = generateAgentTemplate(this.name, description, this.model);
7428
+ writeFileSync6(agentPath, content);
7429
+ console.log(chalk32.green(`Created agent: ${agentPath}`));
7430
+ console.log();
7431
+ console.log(chalk32.dim("Edit the file to customize the agent system prompt."));
7432
+ console.log(chalk32.dim(`Invoke with: @${this.name}`));
7433
+ return 0;
7434
+ }
7435
+ };
7436
+ var AgentTranslateCommand = class extends Command35 {
7437
+ static paths = [["agent", "translate"]];
7438
+ static usage = Command35.Usage({
7439
+ description: "Translate agents between AI coding agent formats",
7440
+ examples: [
7441
+ ["Translate all to Cursor", "$0 agent translate --to cursor"],
7442
+ ["Translate specific agent", "$0 agent translate architect --to cursor"],
7443
+ ["Dry run", "$0 agent translate --to cursor --dry-run"]
7444
+ ]
7445
+ });
7446
+ name = Option34.String({ required: false });
7447
+ to = Option34.String("--to,-t", {
7448
+ description: "Target AI agent (claude-code, cursor, codex, etc.)",
7449
+ required: true
7450
+ });
7451
+ output = Option34.String("--output,-o", {
7452
+ description: "Output directory"
7453
+ });
7454
+ dryRun = Option34.Boolean("--dry-run,-n", false, {
7455
+ description: "Show what would be done without writing files"
7456
+ });
7457
+ all = Option34.Boolean("--all,-a", false, {
7458
+ description: "Translate all agents"
7459
+ });
7460
+ async execute() {
7461
+ const searchDirs = [process.cwd()];
7462
+ const targetAgent = this.to;
7463
+ let agents;
7464
+ if (this.name) {
7465
+ const agent = findAgent(this.name, searchDirs);
7466
+ if (!agent) {
7467
+ console.log(chalk32.red(`Agent not found: ${this.name}`));
7468
+ return 1;
7469
+ }
7470
+ agents = [agent];
7471
+ } else if (this.all) {
7472
+ agents = findAllAgents(searchDirs);
7473
+ } else {
7474
+ agents = discoverAgents(process.cwd());
7475
+ }
7476
+ if (agents.length === 0) {
7477
+ console.log(chalk32.yellow("No agents found to translate"));
7478
+ return 0;
7479
+ }
7480
+ const outputDir = this.output || getAgentTargetDirectory(process.cwd(), targetAgent);
7481
+ console.log(chalk32.cyan(`Translating ${agents.length} agent(s) to ${targetAgent} format...
7482
+ `));
7483
+ let successCount = 0;
7484
+ let errorCount = 0;
7485
+ for (const agent of agents) {
7486
+ try {
7487
+ const result = translateAgent(agent, targetAgent, { addMetadata: true });
7488
+ if (!result.success) {
7489
+ console.log(chalk32.red(`\u2717 ${agent.name}: Translation failed`));
7490
+ errorCount++;
7491
+ continue;
7492
+ }
7493
+ const outputPath = join13(outputDir, result.filename);
7494
+ if (this.dryRun) {
7495
+ console.log(chalk32.blue(`Would write: ${outputPath}`));
7496
+ if (result.warnings.length > 0) {
7497
+ for (const warning of result.warnings) {
7498
+ console.log(chalk32.yellow(` \u26A0 ${warning}`));
7499
+ }
7500
+ }
7501
+ if (result.incompatible.length > 0) {
7502
+ for (const incompat of result.incompatible) {
7503
+ console.log(chalk32.dim(` \u25CB ${incompat}`));
7504
+ }
7505
+ }
7506
+ } else {
7507
+ if (!existsSync14(outputDir)) {
7508
+ mkdirSync7(outputDir, { recursive: true });
7509
+ }
7510
+ writeFileSync6(outputPath, result.content);
7511
+ console.log(chalk32.green(`\u2713 ${agent.name} \u2192 ${outputPath}`));
7512
+ }
7513
+ successCount++;
7514
+ } catch (error) {
7515
+ console.log(chalk32.red(`\u2717 ${agent.name}: ${error instanceof Error ? error.message : "Unknown error"}`));
7516
+ errorCount++;
7517
+ }
7518
+ }
7519
+ console.log();
7520
+ if (this.dryRun) {
7521
+ console.log(chalk32.dim(`Would translate ${successCount} agent(s)`));
7522
+ } else {
7523
+ console.log(chalk32.dim(`Translated ${successCount} agent(s)${errorCount > 0 ? `, ${errorCount} failed` : ""}`));
7524
+ }
7525
+ return errorCount > 0 ? 1 : 0;
7526
+ }
7527
+ };
7528
+ var AgentSyncCommand = class extends Command35 {
7529
+ static paths = [["agent", "sync"]];
7530
+ static usage = Command35.Usage({
7531
+ description: "Sync agents to target AI coding agent",
7532
+ examples: [
7533
+ ["Sync to Claude Code", "$0 agent sync --agent claude-code"],
7534
+ ["Sync to multiple agents", "$0 agent sync --agent claude-code,cursor"]
7535
+ ]
7536
+ });
7537
+ agent = Option34.String("--agent,-a", {
7538
+ description: "Target AI agent(s) (comma-separated)"
7539
+ });
7540
+ async execute() {
7541
+ const searchDirs = [process.cwd()];
7542
+ const agents = findAllAgents(searchDirs);
7543
+ if (agents.length === 0) {
7544
+ console.log(chalk32.yellow("No agents found to sync"));
7545
+ return 0;
7546
+ }
7547
+ const targetAgents = this.agent ? this.agent.split(",").map((a) => a.trim()) : ["claude-code"];
7548
+ console.log(chalk32.cyan(`Syncing ${agents.length} agent(s)...
7549
+ `));
7550
+ for (const targetAgent of targetAgents) {
7551
+ const outputDir = getAgentTargetDirectory(process.cwd(), targetAgent);
7552
+ console.log(chalk32.blue(`\u2192 ${targetAgent} (${outputDir})`));
7553
+ if (!existsSync14(outputDir)) {
7554
+ mkdirSync7(outputDir, { recursive: true });
7555
+ }
7556
+ for (const agent of agents) {
7557
+ const result = translateAgent(agent, targetAgent);
7558
+ if (result.success) {
7559
+ const outputPath = join13(outputDir, result.filename);
7560
+ writeFileSync6(outputPath, result.content);
7561
+ console.log(chalk32.green(` \u2713 ${agent.name}`));
7562
+ } else {
7563
+ console.log(chalk32.red(` \u2717 ${agent.name}`));
7564
+ }
7565
+ }
7566
+ }
7567
+ console.log();
7568
+ console.log(chalk32.dim("Sync complete"));
7569
+ return 0;
7570
+ }
7571
+ };
7572
+ var AgentValidateCommand = class extends Command35 {
7573
+ static paths = [["agent", "validate"]];
7574
+ static usage = Command35.Usage({
7575
+ description: "Validate agent definitions",
7576
+ examples: [
7577
+ ["Validate specific agent", "$0 agent validate ./my-agent.md"],
7578
+ ["Validate all agents", "$0 agent validate --all"]
7579
+ ]
7580
+ });
7581
+ agentPath = Option34.String({ required: false });
7582
+ all = Option34.Boolean("--all,-a", false, {
7583
+ description: "Validate all discovered agents"
7584
+ });
7585
+ async execute() {
7586
+ let hasErrors = false;
7587
+ if (this.agentPath) {
7588
+ const result = validateAgent(this.agentPath);
7589
+ printValidationResult(this.agentPath, result);
7590
+ hasErrors = !result.valid;
7591
+ } else if (this.all) {
7592
+ const searchDirs = [process.cwd()];
7593
+ const agents = findAllAgents(searchDirs);
7594
+ if (agents.length === 0) {
7595
+ console.log(chalk32.yellow("No agents found"));
7596
+ return 0;
7597
+ }
7598
+ console.log(chalk32.cyan(`Validating ${agents.length} agent(s)...
7599
+ `));
7600
+ for (const agent of agents) {
7601
+ const result = validateAgent(agent.path);
7602
+ printValidationResult(agent.name, result);
7603
+ if (!result.valid) hasErrors = true;
7604
+ }
7605
+ } else {
7606
+ console.log(chalk32.yellow("Specify a path or use --all to validate all agents"));
7607
+ return 1;
7608
+ }
7609
+ return hasErrors ? 1 : 0;
7610
+ }
7611
+ };
7612
+ function printAgent(agent) {
7613
+ const status = agent.enabled ? chalk32.green("\u2713") : chalk32.red("\u25CB");
7614
+ const name = agent.enabled ? agent.name : chalk32.dim(agent.name);
7615
+ const model = agent.frontmatter.model ? chalk32.blue(`[${agent.frontmatter.model}]`) : "";
7616
+ const desc = chalk32.dim(truncate3(agent.description, 40));
7617
+ console.log(` ${status} ${name} ${model}`);
7618
+ if (agent.description) {
7619
+ console.log(` ${desc}`);
7620
+ }
7621
+ }
7622
+ function printValidationResult(name, result) {
7623
+ if (result.valid) {
7624
+ console.log(chalk32.green(`\u2713 ${name}`));
7625
+ for (const warning of result.warnings) {
7626
+ console.log(chalk32.yellow(` \u26A0 ${warning}`));
7627
+ }
7628
+ } else {
7629
+ console.log(chalk32.red(`\u2717 ${name}`));
7630
+ for (const error of result.errors) {
7631
+ console.log(chalk32.red(` \u2022 ${error}`));
7632
+ }
7633
+ for (const warning of result.warnings) {
7634
+ console.log(chalk32.yellow(` \u26A0 ${warning}`));
7635
+ }
7636
+ }
7637
+ }
7638
+ function truncate3(str, maxLen) {
7639
+ if (str.length <= maxLen) return str;
7640
+ return str.slice(0, maxLen - 3) + "...";
7641
+ }
7642
+ function generateAgentTemplate(name, description, model) {
7643
+ const lines = [];
7644
+ lines.push("---");
7645
+ lines.push(`name: ${name}`);
7646
+ lines.push(`description: ${description}`);
7647
+ if (model) {
7648
+ lines.push(`model: ${model}`);
7649
+ }
7650
+ lines.push("# permissionMode: default");
7651
+ lines.push("# disallowedTools: []");
7652
+ lines.push("# skills: []");
7653
+ lines.push("# context: fork");
7654
+ lines.push("---");
7655
+ lines.push("");
7656
+ lines.push(`# ${formatAgentName(name)}`);
7657
+ lines.push("");
7658
+ lines.push("You are a specialized AI assistant.");
7659
+ lines.push("");
7660
+ lines.push("## Responsibilities");
7661
+ lines.push("");
7662
+ lines.push("- TODO: Define what this agent is responsible for");
7663
+ lines.push("- TODO: Add specific tasks and behaviors");
7664
+ lines.push("");
7665
+ lines.push("## Guidelines");
7666
+ lines.push("");
7667
+ lines.push("- TODO: Add guidelines for how this agent should behave");
7668
+ lines.push("- TODO: Define any constraints or preferences");
7669
+ lines.push("");
7670
+ return lines.join("\n");
7671
+ }
7672
+ function formatAgentName(name) {
7673
+ return name.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
7674
+ }
7199
7675
  export {
7200
7676
  AICommand,
7677
+ AgentCommand,
7678
+ AgentCreateCommand,
7679
+ AgentListCommand,
7680
+ AgentShowCommand,
7681
+ AgentSyncCommand,
7682
+ AgentTranslateCommand,
7683
+ AgentValidateCommand,
7201
7684
  AuditCommand,
7202
7685
  CICDCommand,
7203
7686
  CommandCmd,