@intellectronica/ruler 0.3.40 → 0.3.42

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 (95) hide show
  1. package/README.md +59 -46
  2. package/dist/agents/AbstractAgent.d.ts +53 -0
  3. package/dist/agents/AgentsMdAgent.d.ts +14 -0
  4. package/dist/agents/AiderAgent.d.ts +14 -0
  5. package/dist/agents/AiderAgent.js +3 -1
  6. package/dist/agents/AmazonQCliAgent.d.ts +13 -0
  7. package/dist/agents/AmpAgent.d.ts +6 -0
  8. package/dist/agents/AntigravityAgent.d.ts +10 -0
  9. package/dist/agents/AugmentCodeAgent.d.ts +13 -0
  10. package/dist/agents/ClaudeAgent.d.ts +13 -0
  11. package/dist/agents/ClineAgent.d.ts +9 -0
  12. package/dist/agents/CodexCliAgent.d.ts +31 -0
  13. package/dist/agents/CopilotAgent.d.ts +20 -0
  14. package/dist/agents/CrushAgent.d.ts +14 -0
  15. package/dist/agents/CrushAgent.js +5 -2
  16. package/dist/agents/CursorAgent.d.ts +17 -0
  17. package/dist/agents/FactoryDroidAgent.d.ts +13 -0
  18. package/dist/agents/FirebaseAgent.d.ts +11 -0
  19. package/dist/agents/FirebenderAgent.d.ts +36 -0
  20. package/dist/agents/GeminiCliAgent.d.ts +11 -0
  21. package/dist/agents/GeminiCliAgent.js +2 -2
  22. package/dist/agents/GooseAgent.d.ts +12 -0
  23. package/dist/agents/IAgent.d.ts +72 -0
  24. package/dist/agents/JetBrainsAiAssistantAgent.d.ts +10 -0
  25. package/dist/agents/JulesAgent.d.ts +5 -0
  26. package/dist/agents/JunieAgent.d.ts +12 -0
  27. package/dist/agents/KiloCodeAgent.d.ts +14 -0
  28. package/dist/agents/KiroAgent.d.ts +8 -0
  29. package/dist/agents/MistralVibeAgent.d.ts +31 -0
  30. package/dist/agents/OpenCodeAgent.d.ts +11 -0
  31. package/dist/agents/OpenCodeAgent.js +14 -9
  32. package/dist/agents/OpenHandsAgent.d.ts +8 -0
  33. package/dist/agents/PiAgent.d.ts +9 -0
  34. package/dist/agents/QwenCodeAgent.d.ts +10 -0
  35. package/dist/agents/QwenCodeAgent.js +2 -2
  36. package/dist/agents/RooCodeAgent.d.ts +16 -0
  37. package/dist/agents/TraeAgent.d.ts +10 -0
  38. package/dist/agents/WarpAgent.d.ts +12 -0
  39. package/dist/agents/WindsurfAgent.d.ts +13 -0
  40. package/dist/agents/ZedAgent.d.ts +21 -0
  41. package/dist/agents/ZedAgent.js +5 -2
  42. package/dist/agents/agent-utils.d.ts +5 -0
  43. package/dist/agents/agent-utils.js +8 -5
  44. package/dist/agents/index.d.ts +9 -0
  45. package/dist/cli/commands.d.ts +4 -0
  46. package/dist/cli/commands.js +2 -3
  47. package/dist/cli/handlers.d.ts +41 -0
  48. package/dist/cli/handlers.js +76 -60
  49. package/dist/cli/index.d.ts +2 -0
  50. package/dist/constants.d.ts +35 -0
  51. package/dist/core/ConfigLoader.d.ts +57 -0
  52. package/dist/core/ConfigLoader.js +123 -41
  53. package/dist/core/FileSystemUtils.d.ts +51 -0
  54. package/dist/core/FileSystemUtils.js +37 -17
  55. package/dist/core/GitignoreUtils.d.ts +15 -0
  56. package/dist/core/GitignoreUtils.js +32 -1
  57. package/dist/core/RuleProcessor.d.ts +8 -0
  58. package/dist/core/SkillsProcessor.d.ts +127 -0
  59. package/dist/core/SkillsProcessor.js +104 -218
  60. package/dist/core/SkillsUtils.d.ts +26 -0
  61. package/dist/core/SubagentsProcessor.d.ts +38 -0
  62. package/dist/core/SubagentsProcessor.js +68 -22
  63. package/dist/core/SubagentsUtils.d.ts +34 -0
  64. package/dist/core/UnifiedConfigLoader.d.ts +10 -0
  65. package/dist/core/UnifiedConfigLoader.js +61 -31
  66. package/dist/core/UnifiedConfigTypes.d.ts +95 -0
  67. package/dist/core/agent-selection.d.ts +12 -0
  68. package/dist/core/agent-selection.js +11 -3
  69. package/dist/core/apply-engine.d.ts +69 -0
  70. package/dist/core/apply-engine.js +57 -50
  71. package/dist/core/config-utils.d.ts +14 -0
  72. package/dist/core/config-utils.js +9 -3
  73. package/dist/core/hash.d.ts +2 -0
  74. package/dist/core/path-utils.d.ts +1 -0
  75. package/dist/core/path-utils.js +42 -0
  76. package/dist/core/revert-engine.d.ts +36 -0
  77. package/dist/core/revert-engine.js +70 -9
  78. package/dist/lib.d.ts +13 -0
  79. package/dist/lib.js +23 -5
  80. package/dist/mcp/capabilities.d.ts +20 -0
  81. package/dist/mcp/merge.d.ts +10 -0
  82. package/dist/mcp/merge.js +19 -1
  83. package/dist/mcp/propagateOpenCodeMcp.d.ts +2 -0
  84. package/dist/mcp/propagateOpenCodeMcp.js +21 -9
  85. package/dist/mcp/propagateOpenHandsMcp.d.ts +2 -0
  86. package/dist/mcp/propagateOpenHandsMcp.js +31 -15
  87. package/dist/mcp/validate.d.ts +7 -0
  88. package/dist/mcp/validate.js +6 -1
  89. package/dist/paths/mcp.d.ts +8 -0
  90. package/dist/paths/mcp.js +33 -4
  91. package/dist/revert.d.ts +6 -0
  92. package/dist/revert.js +39 -27
  93. package/dist/types.d.ts +87 -0
  94. package/dist/vscode/settings.d.ts +40 -0
  95. package/package.json +7 -4
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Updates an ignore file in the project root with paths in a managed Ruler block.
3
+ * Creates the file if it doesn't exist, and creates or updates the Ruler-managed block.
4
+ *
5
+ * @param projectRoot The project root directory
6
+ * @param paths Array of file paths to add to the ignore file (can be absolute or relative)
7
+ * @param ignoreFile Relative path to the ignore file from project root (defaults to .gitignore)
8
+ */
9
+ export declare function updateGitignore(projectRoot: string, paths: string[], ignoreFile?: string): Promise<void>;
10
+ /**
11
+ * Resolves ignore files Ruler manages. Linked worktrees store `.git` as a
12
+ * file containing a `gitdir:` pointer, so `.git/info/exclude` must be resolved
13
+ * through that pointer.
14
+ */
15
+ export declare function resolveIgnoreFilePath(projectRoot: string, ignoreFile: string): Promise<string>;
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.updateGitignore = updateGitignore;
37
+ exports.resolveIgnoreFilePath = resolveIgnoreFilePath;
37
38
  const fs_1 = require("fs");
38
39
  const path = __importStar(require("path"));
39
40
  const RULER_START_MARKER = '# START Ruler Generated Files';
@@ -47,7 +48,7 @@ const RULER_END_MARKER = '# END Ruler Generated Files';
47
48
  * @param ignoreFile Relative path to the ignore file from project root (defaults to .gitignore)
48
49
  */
49
50
  async function updateGitignore(projectRoot, paths, ignoreFile = '.gitignore') {
50
- const gitignorePath = path.join(projectRoot, ignoreFile);
51
+ const gitignorePath = await resolveIgnoreFilePath(projectRoot, ignoreFile);
51
52
  // Read existing .gitignore or start with empty content
52
53
  let existingContent = '';
53
54
  try {
@@ -101,6 +102,36 @@ async function updateGitignore(projectRoot, paths, ignoreFile = '.gitignore') {
101
102
  await fs_1.promises.mkdir(path.dirname(gitignorePath), { recursive: true });
102
103
  await fs_1.promises.writeFile(gitignorePath, newContent);
103
104
  }
105
+ /**
106
+ * Resolves ignore files Ruler manages. Linked worktrees store `.git` as a
107
+ * file containing a `gitdir:` pointer, so `.git/info/exclude` must be resolved
108
+ * through that pointer.
109
+ */
110
+ async function resolveIgnoreFilePath(projectRoot, ignoreFile) {
111
+ if (ignoreFile !== '.git/info/exclude') {
112
+ return path.join(projectRoot, ignoreFile);
113
+ }
114
+ const dotGitPath = path.join(projectRoot, '.git');
115
+ try {
116
+ const dotGitStat = await fs_1.promises.lstat(dotGitPath);
117
+ if (dotGitStat.isFile()) {
118
+ const dotGitContent = await fs_1.promises.readFile(dotGitPath, 'utf8');
119
+ const gitDirMatch = dotGitContent.match(/^gitdir:\s*(.+)\s*$/m);
120
+ if (gitDirMatch) {
121
+ const gitDir = gitDirMatch[1];
122
+ const resolvedGitDir = path.isAbsolute(gitDir)
123
+ ? gitDir
124
+ : path.resolve(projectRoot, gitDir);
125
+ return path.join(resolvedGitDir, 'info', 'exclude');
126
+ }
127
+ }
128
+ }
129
+ catch {
130
+ // Fall back to the historical project-root path for non-git test fixtures
131
+ // and unusual repositories where `.git` cannot be inspected.
132
+ }
133
+ return path.join(projectRoot, ignoreFile);
134
+ }
104
135
  /**
105
136
  * Gets all paths from .gitignore content excluding those in the Ruler block.
106
137
  */
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Concatenates markdown rule files into a single string,
3
+ * marking each section with its source filename.
4
+ */
5
+ export declare function concatenateRules(files: {
6
+ path: string;
7
+ content: string;
8
+ }[], baseDir?: string): string;
@@ -0,0 +1,127 @@
1
+ import * as fs from 'fs/promises';
2
+ import { SkillInfo } from '../types';
3
+ import type { IAgent } from '../agents/IAgent';
4
+ /**
5
+ * Discovers skills in the project's .ruler/skills directory.
6
+ * Returns discovered skills and any validation warnings.
7
+ */
8
+ export declare function discoverSkills(projectRoot: string): Promise<{
9
+ skills: SkillInfo[];
10
+ warnings: string[];
11
+ }>;
12
+ /**
13
+ * Gets the paths that skills will generate, for gitignore purposes.
14
+ * Returns empty array if skills directory doesn't exist.
15
+ */
16
+ export declare function getSkillsGitignorePaths(projectRoot: string, agents: IAgent[]): Promise<string[]>;
17
+ type ReplaceSkillsFsOps = Pick<typeof fs, 'rename' | 'cp' | 'rm'>;
18
+ export declare function replaceSkillsDirectory(tempDir: string, targetDir: string, fsOps?: ReplaceSkillsFsOps): Promise<void>;
19
+ /**
20
+ * Propagates skills for agents that need them.
21
+ */
22
+ export declare function propagateSkills(projectRoot: string, agents: IAgent[], skillsEnabled: boolean, verbose: boolean, dryRun: boolean): Promise<void>;
23
+ /**
24
+ * Propagates skills for Claude Code by copying .ruler/skills to .claude/skills.
25
+ * Uses atomic replace to ensure safe overwriting of existing skills.
26
+ * Returns dry-run steps if dryRun is true, otherwise returns empty array.
27
+ */
28
+ export declare function propagateSkillsForClaude(projectRoot: string, options: {
29
+ dryRun: boolean;
30
+ }): Promise<string[]>;
31
+ /**
32
+ * Propagates skills for OpenAI Codex CLI by copying .ruler/skills to .codex/skills.
33
+ * Uses atomic replace to ensure safe overwriting of existing skills.
34
+ * Returns dry-run steps if dryRun is true, otherwise returns empty array.
35
+ */
36
+ export declare function propagateSkillsForCodex(projectRoot: string, options: {
37
+ dryRun: boolean;
38
+ }): Promise<string[]>;
39
+ /**
40
+ * Propagates skills for OpenCode by copying .ruler/skills to .opencode/skills.
41
+ * Uses atomic replace to ensure safe overwriting of existing skills.
42
+ * Returns dry-run steps if dryRun is true, otherwise returns empty array.
43
+ */
44
+ export declare function propagateSkillsForOpenCode(projectRoot: string, options: {
45
+ dryRun: boolean;
46
+ }): Promise<string[]>;
47
+ /**
48
+ * Propagates skills for Pi Coding Agent by copying .ruler/skills to .pi/skills.
49
+ * Uses atomic replace to ensure safe overwriting of existing skills.
50
+ * Returns dry-run steps if dryRun is true, otherwise returns empty array.
51
+ */
52
+ export declare function propagateSkillsForPi(projectRoot: string, options: {
53
+ dryRun: boolean;
54
+ }): Promise<string[]>;
55
+ /**
56
+ * Propagates skills for Goose by copying .ruler/skills to .agents/skills.
57
+ * Uses atomic replace to ensure safe overwriting of existing skills.
58
+ * Returns dry-run steps if dryRun is true, otherwise returns empty array.
59
+ */
60
+ export declare function propagateSkillsForGoose(projectRoot: string, options: {
61
+ dryRun: boolean;
62
+ }): Promise<string[]>;
63
+ /**
64
+ * Propagates skills for Mistral Vibe by copying .ruler/skills to .vibe/skills.
65
+ * Uses atomic replace to ensure safe overwriting of existing skills.
66
+ * Returns dry-run steps if dryRun is true, otherwise returns empty array.
67
+ */
68
+ export declare function propagateSkillsForVibe(projectRoot: string, options: {
69
+ dryRun: boolean;
70
+ }): Promise<string[]>;
71
+ /**
72
+ * Propagates skills for Roo Code by copying .ruler/skills to .roo/skills.
73
+ * Uses atomic replace to ensure safe overwriting of existing skills.
74
+ * Returns dry-run steps if dryRun is true, otherwise returns empty array.
75
+ */
76
+ export declare function propagateSkillsForRoo(projectRoot: string, options: {
77
+ dryRun: boolean;
78
+ }): Promise<string[]>;
79
+ /**
80
+ * Propagates skills for Gemini CLI by copying .ruler/skills to .gemini/skills.
81
+ * Uses atomic replace to ensure safe overwriting of existing skills.
82
+ * Returns dry-run steps if dryRun is true, otherwise returns empty array.
83
+ */
84
+ export declare function propagateSkillsForGemini(projectRoot: string, options: {
85
+ dryRun: boolean;
86
+ }): Promise<string[]>;
87
+ /**
88
+ * Propagates skills for Junie by copying .ruler/skills to .junie/skills.
89
+ * Uses atomic replace to ensure safe overwriting of existing skills.
90
+ * Returns dry-run steps if dryRun is true, otherwise returns empty array.
91
+ */
92
+ export declare function propagateSkillsForJunie(projectRoot: string, options: {
93
+ dryRun: boolean;
94
+ }): Promise<string[]>;
95
+ /**
96
+ * Propagates skills for Cursor by copying .ruler/skills to .cursor/skills.
97
+ * Uses atomic replace to ensure safe overwriting of existing skills.
98
+ * Returns dry-run steps if dryRun is true, otherwise returns empty array.
99
+ */
100
+ export declare function propagateSkillsForCursor(projectRoot: string, options: {
101
+ dryRun: boolean;
102
+ }): Promise<string[]>;
103
+ /**
104
+ * Propagates skills for Windsurf by copying .ruler/skills to .windsurf/skills.
105
+ * Uses atomic replace to ensure safe overwriting of existing skills.
106
+ * Returns dry-run steps if dryRun is true, otherwise returns empty array.
107
+ */
108
+ export declare function propagateSkillsForWindsurf(projectRoot: string, options: {
109
+ dryRun: boolean;
110
+ }): Promise<string[]>;
111
+ /**
112
+ * Propagates skills for Factory Droid by copying .ruler/skills to .factory/skills.
113
+ * Uses atomic replace to ensure safe overwriting of existing skills.
114
+ * Returns dry-run steps if dryRun is true, otherwise returns empty array.
115
+ */
116
+ export declare function propagateSkillsForFactory(projectRoot: string, options: {
117
+ dryRun: boolean;
118
+ }): Promise<string[]>;
119
+ /**
120
+ * Propagates skills for Antigravity by copying .ruler/skills to .agent/skills.
121
+ * Uses atomic replace to ensure safe overwriting of existing skills.
122
+ * Returns dry-run steps if dryRun is true, otherwise returns empty array.
123
+ */
124
+ export declare function propagateSkillsForAntigravity(projectRoot: string, options: {
125
+ dryRun: boolean;
126
+ }): Promise<string[]>;
127
+ export {};