@intellectronica/ruler 0.2.18 → 0.2.19

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
@@ -45,6 +45,7 @@ Ruler solves this by providing a **single source of truth** for all your AI agen
45
45
  | Cursor | `.cursor/rules/ruler_cursor_instructions.mdc` | `.cursor/mcp.json`, `~/.cursor/mcp.json` |
46
46
  | Windsurf | `.windsurf/rules/ruler_windsurf_instructions.md` | `~/.codeium/windsurf/mcp_config.json` |
47
47
  | Cline | `.clinerules` | - |
48
+ | Amp | `AGENT.md` | - |
48
49
  | Aider | `ruler_aider_instructions.md`, `.aider.conf.yml` | `.mcp.json` |
49
50
  | Firebase Studio | `.idx/airules.md` | - |
50
51
  | Open Hands | `.openhands/microagents/repo.md` | `.openhands/config.toml` |
@@ -150,7 +151,7 @@ The `apply` command looks for `.ruler/` in the current directory tree, reading t
150
151
  | Option | Description |
151
152
  | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
152
153
  | `--project-root <path>` | Path to your project's root (default: current directory) |
153
- | `--agents <agent1,agent2,...>` | Comma-separated list of agent names to target (copilot, claude, codex, cursor, windsurf, cline, aider, firebase, gemini-cli, junie, augmentcode, kilocode) |
154
+ | `--agents <agent1,agent2,...>` | Comma-separated list of agent names to target (amp, copilot, claude, codex, cursor, windsurf, cline, aider, firebase, gemini-cli, junie, augmentcode, kilocode) |
154
155
  | `--config <path>` | Path to a custom `ruler.toml` configuration file |
155
156
  | `--mcp` / `--with-mcp` | Enable applying MCP server configurations (default: true) |
156
157
  | `--no-mcp` | Disable applying MCP server configurations |
@@ -222,7 +223,7 @@ ruler revert [options]
222
223
  | Option | Description |
223
224
  | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
224
225
  | `--project-root <path>` | Path to your project's root (default: current directory) |
225
- | `--agents <agent1,agent2,...>` | Comma-separated list of agent names to revert (copilot, claude, codex, cursor, windsurf, cline, aider, firebase, gemini-cli, junie, kilocode, opencode) |
226
+ | `--agents <agent1,agent2,...>` | Comma-separated list of agent names to revert (amp, copilot, claude, codex, cursor, windsurf, cline, aider, firebase, gemini-cli, junie, kilocode, opencode) |
226
227
  | `--config <path>` | Path to a custom `ruler.toml` configuration file |
227
228
  | `--keep-backups` | Keep backup files (.bak) after restoration (default: false) |
228
229
  | `--dry-run` | Preview changes without actually reverting files |
@@ -0,0 +1,55 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.AmpAgent = void 0;
37
+ const FileSystemUtils_1 = require("../core/FileSystemUtils");
38
+ const path = __importStar(require("path"));
39
+ class AmpAgent {
40
+ getIdentifier() {
41
+ return 'amp';
42
+ }
43
+ getName() {
44
+ return 'Amp';
45
+ }
46
+ async applyRulerConfig(concatenatedRules, projectRoot, rulerMcpJson, agentConfig) {
47
+ const outputPath = agentConfig?.outputPath ?? this.getDefaultOutputPath(projectRoot);
48
+ const absolutePath = path.resolve(projectRoot, outputPath);
49
+ await (0, FileSystemUtils_1.writeGeneratedFile)(absolutePath, concatenatedRules);
50
+ }
51
+ getDefaultOutputPath(projectRoot) {
52
+ return path.join(projectRoot, 'AGENT.md');
53
+ }
54
+ }
55
+ exports.AmpAgent = AmpAgent;
@@ -60,7 +60,7 @@ function run() {
60
60
  });
61
61
  y.option('agents', {
62
62
  type: 'string',
63
- description: 'Comma-separated list of agent identifiers: copilot, claude, codex, cursor, windsurf, cline, aider, firebase, gemini-cli, junie, kilocode, opencode, crush',
63
+ description: 'Comma-separated list of agent identifiers: amp, copilot, claude, codex, cursor, windsurf, cline, aider, firebase, gemini-cli, junie, kilocode, opencode, crush',
64
64
  });
65
65
  y.option('config', {
66
66
  type: 'string',
@@ -174,7 +174,7 @@ and apply them to your configured AI coding agents.
174
174
 
175
175
  # --- Agent Specific Configurations ---
176
176
  # You can enable/disable agents and override their default output paths here.
177
- # Use lowercase agent identifiers: copilot, claude, codex, cursor, windsurf, cline, aider, kilocode
177
+ # Use lowercase agent identifiers: amp, copilot, claude, codex, cursor, windsurf, cline, aider, kilocode
178
178
 
179
179
  # [agents.copilot]
180
180
  # enabled = true
@@ -259,7 +259,7 @@ and apply them to your configured AI coding agents.
259
259
  });
260
260
  y.option('agents', {
261
261
  type: 'string',
262
- description: 'Comma-separated list of agent identifiers: copilot, claude, codex, cursor, windsurf, cline, aider, firebase, gemini-cli, junie, kilocode, opencode, crush',
262
+ description: 'Comma-separated list of agent identifiers: amp, copilot, claude, codex, cursor, windsurf, cline, aider, firebase, gemini-cli, junie, kilocode, opencode, crush',
263
263
  });
264
264
  y.option('config', {
265
265
  type: 'string',
package/dist/lib.js CHANGED
@@ -57,6 +57,7 @@ const KiloCodeAgent_1 = require("./agents/KiloCodeAgent");
57
57
  const OpenCodeAgent_1 = require("./agents/OpenCodeAgent");
58
58
  const CrushAgent_1 = require("./agents/CrushAgent");
59
59
  const GooseAgent_1 = require("./agents/GooseAgent");
60
+ const AmpAgent_1 = require("./agents/AmpAgent");
60
61
  const merge_1 = require("./mcp/merge");
61
62
  const validate_1 = require("./mcp/validate");
62
63
  const mcp_1 = require("./paths/mcp");
@@ -115,6 +116,7 @@ const agents = [
115
116
  new OpenCodeAgent_1.OpenCodeAgent(),
116
117
  new GooseAgent_1.GooseAgent(),
117
118
  new CrushAgent_1.CrushAgent(),
119
+ new AmpAgent_1.AmpAgent(),
118
120
  ];
119
121
  /**
120
122
  * Applies ruler configurations for all supported AI agents.
@@ -180,12 +182,28 @@ async function applyAllAgentConfigs(projectRoot, includedAgents, configPath, cli
180
182
  let selected = agents;
181
183
  if (config.cliAgents && config.cliAgents.length > 0) {
182
184
  const filters = config.cliAgents.map((n) => n.toLowerCase());
185
+ // Check if any of the specified agents don't exist
186
+ const validAgentIdentifiers = new Set(agents.map((agent) => agent.getIdentifier()));
187
+ const validAgentNames = new Set(agents.map((agent) => agent.getName().toLowerCase()));
188
+ const invalidAgents = filters.filter((filter) => !validAgentIdentifiers.has(filter) &&
189
+ ![...validAgentNames].some((name) => name.includes(filter)));
190
+ if (invalidAgents.length > 0) {
191
+ throw (0, constants_1.createRulerError)(`Invalid agent specified: ${invalidAgents.join(', ')}`, `Valid agents are: ${[...validAgentIdentifiers].join(', ')}`);
192
+ }
183
193
  selected = agents.filter((agent) => filters.some((f) => agent.getIdentifier() === f ||
184
194
  agent.getName().toLowerCase().includes(f)));
185
195
  (0, constants_1.logVerbose)(`Selected agents via CLI filter: ${selected.map((a) => a.getName()).join(', ')}`, verbose);
186
196
  }
187
197
  else if (config.defaultAgents && config.defaultAgents.length > 0) {
188
198
  const defaults = config.defaultAgents.map((n) => n.toLowerCase());
199
+ // Check if any of the default agents don't exist
200
+ const validAgentIdentifiers = new Set(agents.map((agent) => agent.getIdentifier()));
201
+ const validAgentNames = new Set(agents.map((agent) => agent.getName().toLowerCase()));
202
+ const invalidAgents = defaults.filter((filter) => !validAgentIdentifiers.has(filter) &&
203
+ ![...validAgentNames].some((name) => name.includes(filter)));
204
+ if (invalidAgents.length > 0) {
205
+ throw (0, constants_1.createRulerError)(`Invalid agent specified in default_agents: ${invalidAgents.join(', ')}`, `Valid agents are: ${[...validAgentIdentifiers].join(', ')}`);
206
+ }
189
207
  selected = agents.filter((agent) => {
190
208
  const identifier = agent.getIdentifier();
191
209
  const override = config.agentConfigs[identifier]?.enabled;
package/dist/revert.js CHANGED
@@ -54,6 +54,7 @@ const AugmentCodeAgent_1 = require("./agents/AugmentCodeAgent");
54
54
  const KiloCodeAgent_1 = require("./agents/KiloCodeAgent");
55
55
  const OpenCodeAgent_1 = require("./agents/OpenCodeAgent");
56
56
  const GooseAgent_1 = require("./agents/GooseAgent");
57
+ const AmpAgent_1 = require("./agents/AmpAgent");
57
58
  const mcp_1 = require("./paths/mcp");
58
59
  const constants_1 = require("./constants");
59
60
  const settings_1 = require("./vscode/settings");
@@ -74,6 +75,7 @@ const agents = [
74
75
  new KiloCodeAgent_1.KiloCodeAgent(),
75
76
  new OpenCodeAgent_1.OpenCodeAgent(),
76
77
  new GooseAgent_1.GooseAgent(),
78
+ new AmpAgent_1.AmpAgent(),
77
79
  ];
78
80
  /**
79
81
  * Gets all output paths for an agent, taking into account any config overrides.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intellectronica/ruler",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
4
4
  "description": "Ruler — apply the same rules to all coding agents",
5
5
  "main": "dist/lib.js",
6
6
  "scripts": {