skiller 0.9.13 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  Apply the same rules (and skills) to multiple AI coding agents.
4
4
 
5
+ Write shared project instructions in the repository's root `AGENTS.md`. Skiller
6
+ reads that file when producing agent-specific rules and never rewrites it.
7
+
5
8
  ```bash
6
9
  npx skiller@latest init
7
10
  npx skiller@latest install
@@ -37,7 +40,7 @@ npx skiller@latest install
37
40
  | Identifier | Agent | Rules | MCP | Skills |
38
41
  | ---------------- | -------------- | -------------------------------------------------- | ------------------------------ | ------------------- |
39
42
  | `github-copilot` | GitHub Copilot | `AGENTS.md` | `.vscode/mcp.json` (`servers`) | `.agents/skills` |
40
- | `claude-code` | Claude Code | `CLAUDE.md` (`@file` refs) | `.mcp.json` | `.claude/skills` |
43
+ | `claude-code` | Claude Code | `AGENTS.md` | `.mcp.json` | `.claude/skills` |
41
44
  | `codex` | Codex | `AGENTS.md`, `.codex/config.toml` | `.codex/config.toml` | `.agents/skills` |
42
45
  | `cursor` | Cursor | `AGENTS.md` | `.cursor/mcp.json` | `.agents/skills` |
43
46
  | `windsurf` | Windsurf | `AGENTS.md` | `.windsurf/mcp_config.json` | `.windsurf/skills` |
@@ -35,13 +35,9 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.AgentsMdAgent = void 0;
37
37
  const path = __importStar(require("path"));
38
- const fs_1 = require("fs");
39
38
  const AbstractAgent_1 = require("./AbstractAgent");
40
- const FileSystemUtils_1 = require("../core/FileSystemUtils");
41
39
  /**
42
- * Pseudo-agent that ensures the concatenated rules are written to root-level `AGENTS.md`.
43
- * Does not participate in MCP propagation. Idempotent: only writes (and creates a backup)
44
- * when content differs from existing file.
40
+ * Agents that read the authored root AGENTS.md directly.
45
41
  */
46
42
  class AgentsMdAgent extends AbstractAgent_1.AbstractAgent {
47
43
  getIdentifier() {
@@ -53,30 +49,11 @@ class AgentsMdAgent extends AbstractAgent_1.AbstractAgent {
53
49
  getDefaultOutputPath(projectRoot) {
54
50
  return path.join(projectRoot, 'AGENTS.md');
55
51
  }
56
- async applySkillerConfig(concatenatedRules, projectRoot, _skillerMcpJson, agentConfig, backup = true) {
57
- const output = agentConfig?.outputPath ?? this.getDefaultOutputPath(projectRoot);
58
- const absolutePath = path.resolve(projectRoot, output);
59
- await (0, FileSystemUtils_1.ensureDirExists)(path.dirname(absolutePath));
60
- // Add marker comment to the content to identify it as generated
61
- const contentWithMarker = `<!-- Generated by Skiller -->\n${concatenatedRules}`;
62
- // Read existing content if present and skip write if identical
63
- let existing = null;
64
- try {
65
- existing = await fs_1.promises.readFile(absolutePath, 'utf8');
66
- }
67
- catch {
68
- existing = null;
69
- }
70
- if (existing !== null && existing === contentWithMarker) {
71
- // No change; skip backup/write for idempotency
72
- return;
73
- }
74
- // Backup (only if file existed and backup is enabled) then write new content
75
- if (backup) {
76
- await (0, FileSystemUtils_1.backupFile)(absolutePath);
77
- }
78
- await (0, FileSystemUtils_1.writeGeneratedFile)(absolutePath, contentWithMarker);
52
+ /* eslint-disable @typescript-eslint/no-unused-vars */
53
+ async applySkillerConfig(_concatenatedRules, _projectRoot, _skillerMcpJson, _agentConfig, _backup, _ruleFiles, _skillerDir, _mergeStrategy) {
54
+ // Shared instructions are authored in place and need no projection.
79
55
  }
56
+ /* eslint-enable @typescript-eslint/no-unused-vars */
80
57
  getMcpServerKey() {
81
58
  // No MCP configuration for this pseudo-agent
82
59
  return '';
@@ -35,7 +35,6 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.AiderAgent = void 0;
37
37
  const path = __importStar(require("path"));
38
- const AgentsMdAgent_1 = require("./AgentsMdAgent");
39
38
  const FileSystemUtils_1 = require("../core/FileSystemUtils");
40
39
  const fs = __importStar(require("fs/promises"));
41
40
  const yaml = __importStar(require("js-yaml"));
@@ -43,23 +42,13 @@ const yaml = __importStar(require("js-yaml"));
43
42
  * Aider agent adapter that uses AGENTS.md for instructions and .aider.conf.yml for configuration.
44
43
  */
45
44
  class AiderAgent {
46
- constructor() {
47
- this.agentsMdAgent = new AgentsMdAgent_1.AgentsMdAgent();
48
- }
49
45
  getIdentifier() {
50
46
  return 'aider';
51
47
  }
52
48
  getName() {
53
49
  return 'Aider';
54
50
  }
55
- async applySkillerConfig(concatenatedRules, projectRoot, skillerMcpJson, agentConfig, backup = true) {
56
- // First perform idempotent AGENTS.md write via composed AgentsMdAgent
57
- await this.agentsMdAgent.applySkillerConfig(concatenatedRules, projectRoot, null, {
58
- // Preserve explicit outputPath precedence semantics if provided.
59
- outputPath: agentConfig?.outputPath ||
60
- agentConfig?.outputPathInstructions ||
61
- undefined,
62
- }, backup);
51
+ async applySkillerConfig(_concatenatedRules, projectRoot, skillerMcpJson, agentConfig, backup = true) {
63
52
  // Now handle .aider.conf.yml configuration
64
53
  const cfgPath = agentConfig?.outputPathConfig ??
65
54
  this.getDefaultOutputPath(projectRoot).config;
@@ -1,87 +1,17 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.ClaudeAgent = void 0;
37
- const path = __importStar(require("path"));
38
- const AbstractAgent_1 = require("./AbstractAgent");
39
- const FileSystemUtils_1 = require("../core/FileSystemUtils");
4
+ const AgentsMdAgent_1 = require("./AgentsMdAgent");
40
5
  const catalog_1 = require("./catalog");
41
- /**
42
- * Claude Code agent adapter.
43
- * Uses @filename references instead of concatenating content.
44
- */
45
- class ClaudeAgent extends AbstractAgent_1.AbstractAgent {
6
+ class ClaudeAgent extends AgentsMdAgent_1.AgentsMdAgent {
46
7
  getIdentifier() {
47
8
  return 'claude-code';
48
9
  }
49
10
  getName() {
50
11
  return (0, catalog_1.getAgentDisplayName)('claude-code');
51
12
  }
52
- getDefaultOutputPath(projectRoot) {
53
- return path.join(projectRoot, 'CLAUDE.md');
54
- }
55
- /**
56
- * Override to write @filename references instead of concatenated content.
57
- * This allows Claude Code to auto-include file contents on-demand.
58
- */
59
- async applySkillerConfig(_concatenatedRules, projectRoot, _skillerMcpJson, agentConfig, backup = true, ruleFiles) {
60
- const output = agentConfig?.outputPath ?? this.getDefaultOutputPath(projectRoot);
61
- const absolutePath = path.resolve(projectRoot, output);
62
- await (0, FileSystemUtils_1.ensureDirExists)(path.dirname(absolutePath));
63
- if (backup) {
64
- await (0, FileSystemUtils_1.backupFile)(absolutePath);
65
- }
66
- // Generate @filename references instead of concatenated content
67
- if (ruleFiles && ruleFiles.length > 0) {
68
- const references = ruleFiles
69
- .map((file) => {
70
- // Get relative path from project root
71
- const relativePath = path.relative(projectRoot, file.path);
72
- // Normalize to forward slashes for consistency
73
- const normalizedPath = relativePath.replace(/\\/g, '/');
74
- return `@${normalizedPath}`;
75
- })
76
- .join('\n');
77
- const content = `${references}
78
- `;
79
- await (0, FileSystemUtils_1.writeGeneratedFile)(absolutePath, content);
80
- }
81
- else {
82
- // Fallback to empty file if no rules
83
- await (0, FileSystemUtils_1.writeGeneratedFile)(absolutePath, '<!-- No rules configured -->\n');
84
- }
13
+ getMcpServerKey() {
14
+ return 'mcpServers';
85
15
  }
86
16
  supportsMcpStdio() {
87
17
  return true;
@@ -37,7 +37,6 @@ exports.CodexCliAgent = void 0;
37
37
  const path = __importStar(require("path"));
38
38
  const fs_1 = require("fs");
39
39
  const toml_1 = require("@iarna/toml");
40
- const AgentsMdAgent_1 = require("./AgentsMdAgent");
41
40
  const FileSystemUtils_1 = require("../core/FileSystemUtils");
42
41
  const constants_1 = require("../constants");
43
42
  const catalog_1 = require("./catalog");
@@ -45,23 +44,17 @@ const catalog_1 = require("./catalog");
45
44
  * OpenAI Codex CLI agent adapter.
46
45
  */
47
46
  class CodexCliAgent {
48
- constructor() {
49
- this.agentsMdAgent = new AgentsMdAgent_1.AgentsMdAgent();
50
- }
51
47
  getIdentifier() {
52
48
  return 'codex';
53
49
  }
54
50
  getName() {
55
51
  return (0, catalog_1.getAgentDisplayName)('codex');
56
52
  }
57
- async applySkillerConfig(concatenatedRules, projectRoot, skillerMcpJson, agentConfig, backup = true) {
58
- // First perform idempotent AGENTS.md write via composed AgentsMdAgent
59
- await this.agentsMdAgent.applySkillerConfig(concatenatedRules, projectRoot, null, {
60
- // Preserve explicit outputPath precedence semantics if provided.
61
- outputPath: agentConfig?.outputPath ||
62
- agentConfig?.outputPathInstructions ||
63
- undefined,
64
- }, backup);
53
+ async applySkillerConfig(_concatenatedRules, projectRoot, skillerMcpJson, agentConfig, _backup, _ruleFiles, _skillerDir, _mergeStrategy) {
54
+ void _backup;
55
+ void _ruleFiles;
56
+ void _skillerDir;
57
+ void _mergeStrategy;
65
58
  // Use proper path resolution from getDefaultOutputPath and agentConfig
66
59
  const defaults = this.getDefaultOutputPath(projectRoot);
67
60
  const mcpEnabled = agentConfig?.mcp?.enabled ?? true;
@@ -5,32 +5,15 @@ const AgentsMdAgent_1 = require("./AgentsMdAgent");
5
5
  const catalog_1 = require("./catalog");
6
6
  /**
7
7
  * GitHub Copilot agent adapter.
8
- * Writes to AGENTS.md for both web-based GitHub Copilot and VS Code extension.
8
+ * Uses the authored AGENTS.md for both web-based GitHub Copilot and VS Code.
9
9
  */
10
- class CopilotAgent {
11
- constructor() {
12
- this.agentsMdAgent = new AgentsMdAgent_1.AgentsMdAgent();
13
- }
10
+ class CopilotAgent extends AgentsMdAgent_1.AgentsMdAgent {
14
11
  getIdentifier() {
15
12
  return 'github-copilot';
16
13
  }
17
14
  getName() {
18
15
  return (0, catalog_1.getAgentDisplayName)('github-copilot');
19
16
  }
20
- /**
21
- * Returns the default output path for AGENTS.md.
22
- */
23
- getDefaultOutputPath(projectRoot) {
24
- return this.agentsMdAgent.getDefaultOutputPath(projectRoot);
25
- }
26
- async applySkillerConfig(concatenatedRules, projectRoot, skillerMcpJson, agentConfig, backup = true) {
27
- // Write to AGENTS.md using the existing AgentsMdAgent infrastructure
28
- await this.agentsMdAgent.applySkillerConfig(concatenatedRules, projectRoot, null, // No MCP config needed for the instructions file
29
- {
30
- // Preserve explicit outputPath precedence semantics if provided
31
- outputPath: agentConfig?.outputPath || agentConfig?.outputPathInstructions,
32
- }, backup);
33
- }
34
17
  getMcpServerKey() {
35
18
  return 'servers';
36
19
  }
@@ -51,16 +51,12 @@ class CursorAgent extends AgentsMdAgent_1.AgentsMdAgent {
51
51
  getName() {
52
52
  return (0, catalog_1.getAgentDisplayName)('cursor');
53
53
  }
54
- async applySkillerConfig(concatenatedRules, projectRoot, _skillerMcpJson, agentConfig, backup = true, _ruleFiles, skillerDir, mergeStrategy) {
55
- // Write AGENTS.md via base class
56
- // Cursor natively reads AGENTS.md from the project root
57
- await super.applySkillerConfig(concatenatedRules, projectRoot, null, {
58
- outputPath: agentConfig?.outputPath,
59
- }, backup);
60
- // Copy .claude/rules to .cursor/rules when using cursor merge strategy
54
+ async applySkillerConfig(concatenatedRules, projectRoot, _skillerMcpJson, agentConfig, _backup = true, _ruleFiles, skillerDir, mergeStrategy) {
55
+ void _backup;
56
+ // Copy canonical rules to .cursor/rules when using cursor merge strategy.
61
57
  if (mergeStrategy === 'cursor' && skillerDir) {
62
58
  const skillerDirName = path.basename(skillerDir);
63
- if (skillerDirName === '.claude') {
59
+ if (skillerDirName === '.agents') {
64
60
  const sourceRulesDir = path.join(skillerDir, 'rules');
65
61
  const targetRulesDir = path.join(projectRoot, '.cursor', 'rules');
66
62
  // Check if source rules directory exists
@@ -37,7 +37,6 @@ exports.FirebenderAgent = void 0;
37
37
  const path = __importStar(require("path"));
38
38
  const fs = __importStar(require("fs"));
39
39
  const FileSystemUtils_1 = require("../core/FileSystemUtils");
40
- const catalog_1 = require("./catalog");
41
40
  /**
42
41
  * Firebender agent adapter.
43
42
  */
@@ -57,7 +56,7 @@ class FirebenderAgent {
57
56
  return 'firebender';
58
57
  }
59
58
  getName() {
60
- return (0, catalog_1.getAgentDisplayName)('firebender');
59
+ return 'Firebender';
61
60
  }
62
61
  async applySkillerConfig(concatenatedRules, projectRoot, skillerMcpJson, agentConfig, backup = true) {
63
62
  const rulesPath = this.resolveOutputPath(projectRoot, agentConfig);
@@ -180,7 +179,7 @@ class FirebenderAgent {
180
179
  return true;
181
180
  }
182
181
  getSkillsPath(projectRoot) {
183
- return (0, catalog_1.getAgentSkillsPath)('firebender', projectRoot);
182
+ return path.join(projectRoot, '.agents', 'skills');
184
183
  }
185
184
  /**
186
185
  * Extracts file paths from concatenated rules by parsing HTML source comments.
@@ -46,10 +46,6 @@ class GeminiCliAgent extends AgentsMdAgent_1.AgentsMdAgent {
46
46
  return (0, catalog_1.getAgentDisplayName)('gemini-cli');
47
47
  }
48
48
  async applySkillerConfig(concatenatedRules, projectRoot, skillerMcpJson, agentConfig) {
49
- // First, perform idempotent write of AGENTS.md via base class
50
- await super.applySkillerConfig(concatenatedRules, projectRoot, null, {
51
- outputPath: agentConfig?.outputPath,
52
- });
53
49
  // Prepare .gemini/settings.json with contextFileName and MCP configuration
54
50
  const settingsPath = path.join(projectRoot, '.gemini', 'settings.json');
55
51
  let existingSettings = {};
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.JulesAgent = void 0;
4
4
  const AgentsMdAgent_1 = require("./AgentsMdAgent");
5
- // Jules agent now simply inherits AgentsMdAgent behavior (idempotent AGENTS.md writes).
6
5
  class JulesAgent extends AgentsMdAgent_1.AgentsMdAgent {
7
6
  getIdentifier() {
8
7
  return 'jules';
@@ -50,11 +50,9 @@ class OpenCodeAgent {
50
50
  mcp: path.join(projectRoot, 'opencode.json'),
51
51
  };
52
52
  }
53
- async applySkillerConfig(concatenatedRules, projectRoot, skillerMcpJson, agentConfig) {
53
+ async applySkillerConfig(_concatenatedRules, projectRoot, skillerMcpJson, agentConfig) {
54
54
  const outputPaths = this.getDefaultOutputPath(projectRoot);
55
- const instructionsPath = path.resolve(projectRoot, agentConfig?.outputPathInstructions ?? outputPaths['instructions']);
56
55
  const mcpPath = path.resolve(projectRoot, agentConfig?.outputPathConfig ?? outputPaths['mcp']);
57
- await fs.writeFile(instructionsPath, concatenatedRules);
58
56
  // Create OpenCode config with schema and MCP configuration
59
57
  let finalMcpConfig = {
60
58
  $schema: 'https://opencode.ai/config.json',
@@ -45,11 +45,8 @@ class QwenCodeAgent extends AgentsMdAgent_1.AgentsMdAgent {
45
45
  getName() {
46
46
  return (0, catalog_1.getAgentDisplayName)('qwen-code');
47
47
  }
48
- async applySkillerConfig(concatenatedRules, projectRoot, _skillerMcpJson, agentConfig) {
49
- // First, perform idempotent write of AGENTS.md via base class
50
- await super.applySkillerConfig(concatenatedRules, projectRoot, null, {
51
- outputPath: agentConfig?.outputPath,
52
- });
48
+ async applySkillerConfig(_concatenatedRules, projectRoot, _skillerMcpJson) {
49
+ void _skillerMcpJson;
53
50
  // Ensure .qwen/settings.json has contextFileName set to AGENTS.md
54
51
  const settingsPath = path.join(projectRoot, '.qwen', 'settings.json');
55
52
  let existingSettings = {};
@@ -36,17 +36,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.RooCodeAgent = void 0;
37
37
  const path = __importStar(require("path"));
38
38
  const fs_1 = require("fs");
39
- const AgentsMdAgent_1 = require("./AgentsMdAgent");
40
39
  const FileSystemUtils_1 = require("../core/FileSystemUtils");
41
40
  const catalog_1 = require("./catalog");
42
41
  /**
43
- * Agent for RooCode that writes to AGENTS.md and generates .roo/mcp.json
42
+ * Agent for RooCode that reads AGENTS.md and generates .roo/mcp.json
44
43
  * with project-level MCP server configuration.
45
44
  */
46
45
  class RooCodeAgent {
47
- constructor() {
48
- this.agentsMdAgent = new AgentsMdAgent_1.AgentsMdAgent();
49
- }
50
46
  getIdentifier() {
51
47
  return 'roo';
52
48
  }
@@ -59,14 +55,7 @@ class RooCodeAgent {
59
55
  mcp: path.join(projectRoot, '.roo', 'mcp.json'),
60
56
  };
61
57
  }
62
- async applySkillerConfig(concatenatedRules, projectRoot, skillerMcpJson, agentConfig, backup = true) {
63
- // First perform idempotent AGENTS.md write via composed AgentsMdAgent
64
- await this.agentsMdAgent.applySkillerConfig(concatenatedRules, projectRoot, null, {
65
- // Preserve explicit outputPath precedence semantics if provided.
66
- outputPath: agentConfig?.outputPath ||
67
- agentConfig?.outputPathInstructions ||
68
- undefined,
69
- }, backup);
58
+ async applySkillerConfig(_concatenatedRules, projectRoot, skillerMcpJson, agentConfig, backup = true) {
70
59
  // Now handle .roo/mcp.json configuration
71
60
  const outputPaths = this.getDefaultOutputPath(projectRoot);
72
61
  const mcpPath = path.resolve(projectRoot, agentConfig?.outputPathConfig ?? outputPaths['mcp']);
@@ -39,7 +39,7 @@ const path = __importStar(require("path"));
39
39
  const AgentsMdAgent_1 = require("./AgentsMdAgent");
40
40
  /**
41
41
  * Zed editor agent adapter.
42
- * Inherits from AgentsMdAgent to write instructions to AGENTS.md and handles
42
+ * Reads the authored AGENTS.md and handles
43
43
  * MCP server configuration in .zed/settings.json at the project root.
44
44
  */
45
45
  class ZedAgent extends AgentsMdAgent_1.AgentsMdAgent {
@@ -50,10 +50,6 @@ class ZedAgent extends AgentsMdAgent_1.AgentsMdAgent {
50
50
  return 'Zed';
51
51
  }
52
52
  async applySkillerConfig(concatenatedRules, projectRoot, skillerMcpJson, agentConfig) {
53
- // First, perform idempotent AGENTS.md write via base class
54
- await super.applySkillerConfig(concatenatedRules, projectRoot, null, {
55
- outputPath: agentConfig?.outputPath,
56
- });
57
53
  // Handle MCP server configuration if enabled and provided
58
54
  const mcpEnabled = agentConfig?.mcp?.enabled ?? true;
59
55
  if (mcpEnabled && skillerMcpJson) {
@@ -1,22 +1,60 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.getAgentOutputPaths = getAgentOutputPaths;
37
+ const path = __importStar(require("path"));
4
38
  /**
5
39
  * Gets all output paths for an agent, taking into account any config overrides.
6
40
  */
7
41
  function getAgentOutputPaths(agent, projectRoot, agentConfig) {
8
42
  const paths = [];
9
43
  const defaults = agent.getDefaultOutputPath(projectRoot);
44
+ const rootAgentsPath = path.resolve(projectRoot, 'AGENTS.md');
45
+ const authoredInstructions = (candidate) => path.resolve(candidate) === rootAgentsPath;
10
46
  if (typeof defaults === 'string') {
11
47
  // Single output path (most agents)
12
48
  const actualPath = agentConfig?.outputPath ?? defaults;
13
- paths.push(actualPath);
49
+ if (!authoredInstructions(defaults))
50
+ paths.push(actualPath);
14
51
  }
15
52
  else {
16
53
  // Multiple output paths (e.g., AiderAgent)
17
54
  const defaultPaths = defaults;
18
55
  // Handle instructions path
19
- if ('instructions' in defaultPaths) {
56
+ if ('instructions' in defaultPaths &&
57
+ !authoredInstructions(defaultPaths.instructions)) {
20
58
  const instructionsPath = agentConfig?.outputPathInstructions ?? defaultPaths.instructions;
21
59
  paths.push(instructionsPath);
22
60
  }
@@ -584,7 +584,9 @@ async function initHandler(argv) {
584
584
  ? path.join(process.env.XDG_CONFIG_HOME || path.join(os.homedir(), '.config'), 'skiller')
585
585
  : path.join(projectRoot, project_paths_1.CANONICAL_SKILLER_DIR);
586
586
  await fs.mkdir(skillerDir, { recursive: true });
587
- const instructionsPath = path.join(skillerDir, constants_1.DEFAULT_RULES_FILENAME);
587
+ const instructionsPath = isGlobal
588
+ ? path.join(skillerDir, constants_1.DEFAULT_RULES_FILENAME)
589
+ : path.join(projectRoot, constants_1.DEFAULT_RULES_FILENAME);
588
590
  const tomlPath = path.join(skillerDir, project_paths_1.SKILLER_CONFIG_FILE);
589
591
  const exists = async (p) => {
590
592
  try {
@@ -595,7 +597,7 @@ async function initHandler(argv) {
595
597
  return false;
596
598
  }
597
599
  };
598
- const DEFAULT_INSTRUCTIONS = `# AGENTS.md\n\nCentralised AI agent instructions. Add coding guidelines, style guides, and project context here.\n\nSkiller concatenates all .md files in this directory (and subdirectories), starting with AGENTS.md (if present), then remaining files in sorted order.\n`;
600
+ const DEFAULT_INSTRUCTIONS = `# AGENTS.md\n\nShared AI agent instructions. Add coding guidelines, style guides, and project context here.\n`;
599
601
  const DEFAULT_TOML = `# Skiller Configuration File
600
602
  # See https://github.com/udecode/skiller for documentation.
601
603
 
@@ -615,10 +617,6 @@ async function initHandler(argv) {
615
617
  # enabled = true
616
618
  # output_path = ".github/copilot-instructions.md"
617
619
 
618
- # [agents.claude-code]
619
- # enabled = true
620
- # output_path = "CLAUDE.md"
621
-
622
620
  # [agents.gemini-cli]
623
621
  # enabled = true
624
622
 
@@ -637,7 +635,6 @@ async function initHandler(argv) {
637
635
  # headers = { Authorization = "Bearer REPLACE_ME" }
638
636
  `;
639
637
  if (!(await exists(instructionsPath))) {
640
- // Create new AGENTS.md regardless of legacy presence.
641
638
  await fs.writeFile(instructionsPath, DEFAULT_INSTRUCTIONS);
642
639
  console.log(`[skiller] Created ${instructionsPath}`);
643
640
  }
package/dist/cli/index.js CHANGED
File without changes
@@ -231,11 +231,6 @@ async function readMarkdownFiles(skillerDir, options) {
231
231
  for (const file of filteredFiles) {
232
232
  const relativePath = path.relative(skillerDir, file.path);
233
233
  const normalizedPath = relativePath.replace(/\\/g, '/');
234
- // Always include AGENTS.md for backward compatibility
235
- if (/^AGENTS\.md$/i.test(normalizedPath)) {
236
- cursorFiles.push(file);
237
- continue;
238
- }
239
234
  // Check if file is in rules/ or skills/ folder and is .mdc
240
235
  if ((normalizedPath.startsWith('rules/') ||
241
236
  normalizedPath.startsWith('skills/')) &&
@@ -254,37 +249,25 @@ async function readMarkdownFiles(skillerDir, options) {
254
249
  }
255
250
  processedFiles = cursorFiles;
256
251
  }
257
- // Prioritisation logic:
258
- // 1. Prefer top-level AGENTS.md if present.
259
- // 2. If AGENTS.md absent but legacy instructions.md present, use it (no longer emits a warning; legacy accepted silently).
260
- // 3. Include any remaining .md files (excluding whichever of the above was used if present) in
261
- // sorted order AFTER the preferred primary file so that new concatenation priority starts with AGENTS.md.
262
- const topLevelAgents = path.join(skillerDir, project_paths_1.PROJECT_AGENTS_FILE);
263
- const topLevelLegacy = path.join(skillerDir, project_paths_1.LEGACY_INSTRUCTIONS_FILE);
264
- // Separate primary candidates from others
265
- let primaryFile = null;
266
- const others = [];
267
- for (const f of processedFiles) {
268
- if (f.path === topLevelAgents) {
269
- primaryFile = f; // Highest priority
270
- }
252
+ const isCanonicalSkillerDir = path.basename(skillerDir) === project_paths_1.CANONICAL_SKILLER_DIR;
253
+ const supplementalFiles = processedFiles
254
+ .filter((file) => !isCanonicalSkillerDir ||
255
+ file.path !== path.join(skillerDir, project_paths_1.PROJECT_AGENTS_FILE))
256
+ .sort((a, b) => a.path.localeCompare(b.path));
257
+ if (!isCanonicalSkillerDir) {
258
+ return supplementalFiles;
271
259
  }
272
- if (!primaryFile) {
273
- for (const f of processedFiles) {
274
- if (f.path === topLevelLegacy) {
275
- primaryFile = f;
276
- break;
277
- }
278
- }
260
+ const rootAgentsPath = path.join(path.dirname(skillerDir), project_paths_1.PROJECT_AGENTS_FILE);
261
+ try {
262
+ const content = await fs_1.promises.readFile(rootAgentsPath, 'utf8');
263
+ return [{ path: rootAgentsPath, content }, ...supplementalFiles];
279
264
  }
280
- for (const f of processedFiles) {
281
- if (primaryFile && f.path === primaryFile.path)
282
- continue;
283
- others.push(f);
265
+ catch (error) {
266
+ if (error.code === 'ENOENT') {
267
+ return supplementalFiles;
268
+ }
269
+ throw error;
284
270
  }
285
- // Sort the remaining others for stable deterministic concatenation order.
286
- others.sort((a, b) => a.path.localeCompare(b.path));
287
- return primaryFile ? [primaryFile, ...others] : others;
288
271
  }
289
272
  /**
290
273
  * Writes content to filePath, creating parent directories if necessary.