@rigour-labs/cli 2.8.0 → 2.9.1
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/commands/init.d.ts +1 -1
- package/dist/commands/init.js +110 -0
- package/package.json +2 -2
- package/src/commands/init.ts +125 -2
package/dist/commands/init.d.ts
CHANGED
package/dist/commands/init.js
CHANGED
|
@@ -11,6 +11,22 @@ const yaml_1 = __importDefault(require("yaml"));
|
|
|
11
11
|
const core_1 = require("@rigour-labs/core");
|
|
12
12
|
const constants_js_1 = require("./constants.js");
|
|
13
13
|
function detectIDE(cwd) {
|
|
14
|
+
// Check for Claude Code markers
|
|
15
|
+
if (fs_extra_1.default.existsSync(path_1.default.join(cwd, 'CLAUDE.md')) || fs_extra_1.default.existsSync(path_1.default.join(cwd, '.claude'))) {
|
|
16
|
+
return 'claude';
|
|
17
|
+
}
|
|
18
|
+
// Check for Gemini Code Assist markers
|
|
19
|
+
if (fs_extra_1.default.existsSync(path_1.default.join(cwd, '.gemini'))) {
|
|
20
|
+
return 'gemini';
|
|
21
|
+
}
|
|
22
|
+
// Check for Codex/Aider AGENTS.md (universal standard)
|
|
23
|
+
if (fs_extra_1.default.existsSync(path_1.default.join(cwd, 'AGENTS.md'))) {
|
|
24
|
+
return 'codex';
|
|
25
|
+
}
|
|
26
|
+
// Check for Windsurf markers
|
|
27
|
+
if (fs_extra_1.default.existsSync(path_1.default.join(cwd, '.windsurfrules')) || fs_extra_1.default.existsSync(path_1.default.join(cwd, '.windsurf'))) {
|
|
28
|
+
return 'windsurf';
|
|
29
|
+
}
|
|
14
30
|
// Check for Cline-specific markers
|
|
15
31
|
if (fs_extra_1.default.existsSync(path_1.default.join(cwd, '.clinerules'))) {
|
|
16
32
|
return 'cline';
|
|
@@ -36,6 +52,14 @@ function detectIDE(cwd) {
|
|
|
36
52
|
if (termProgram.toLowerCase().includes('vscode') || process.env.VSCODE_INJECTION) {
|
|
37
53
|
return 'vscode';
|
|
38
54
|
}
|
|
55
|
+
// Check for Claude Code environment
|
|
56
|
+
if (process.env.CLAUDE_CODE || process.env.ANTHROPIC_API_KEY) {
|
|
57
|
+
return 'claude';
|
|
58
|
+
}
|
|
59
|
+
// Check for Gemini environment
|
|
60
|
+
if (process.env.GEMINI_API_KEY || process.env.GOOGLE_CLOUD_PROJECT) {
|
|
61
|
+
return 'gemini';
|
|
62
|
+
}
|
|
39
63
|
return 'unknown';
|
|
40
64
|
}
|
|
41
65
|
async function initCommand(cwd, options = {}) {
|
|
@@ -189,6 +213,92 @@ ${ruleContent}`;
|
|
|
189
213
|
console.log(chalk_1.default.green('✔ Initialized Cline Handshake (.clinerules)'));
|
|
190
214
|
}
|
|
191
215
|
}
|
|
216
|
+
// Claude Code (CLAUDE.md)
|
|
217
|
+
if (targetIDE === 'claude' || targetIDE === 'all') {
|
|
218
|
+
const claudePath = path_1.default.join(cwd, 'CLAUDE.md');
|
|
219
|
+
const claudeContent = `# CLAUDE.md - Project Instructions for Claude Code
|
|
220
|
+
|
|
221
|
+
This file provides Claude Code with context about this project.
|
|
222
|
+
|
|
223
|
+
## Project Overview
|
|
224
|
+
|
|
225
|
+
This project uses Rigour for quality gates. Always run \`npx @rigour-labs/cli check\` before marking tasks complete.
|
|
226
|
+
|
|
227
|
+
## Commands
|
|
228
|
+
|
|
229
|
+
\`\`\`bash
|
|
230
|
+
# Verify quality gates
|
|
231
|
+
npx @rigour-labs/cli check
|
|
232
|
+
|
|
233
|
+
# Get fix packet for failures
|
|
234
|
+
npx @rigour-labs/cli explain
|
|
235
|
+
|
|
236
|
+
# Self-healing agent loop
|
|
237
|
+
npx @rigour-labs/cli run -- claude "<task>"
|
|
238
|
+
\`\`\`
|
|
239
|
+
|
|
240
|
+
${ruleContent}`;
|
|
241
|
+
if (!(await fs_extra_1.default.pathExists(claudePath))) {
|
|
242
|
+
await fs_extra_1.default.writeFile(claudePath, claudeContent);
|
|
243
|
+
console.log(chalk_1.default.green('✔ Initialized Claude Code Handshake (CLAUDE.md)'));
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
// Gemini Code Assist (.gemini/styleguide.md)
|
|
247
|
+
if (targetIDE === 'gemini' || targetIDE === 'all') {
|
|
248
|
+
const geminiDir = path_1.default.join(cwd, '.gemini');
|
|
249
|
+
await fs_extra_1.default.ensureDir(geminiDir);
|
|
250
|
+
const geminiStylePath = path_1.default.join(geminiDir, 'styleguide.md');
|
|
251
|
+
const geminiContent = `# Gemini Code Assist Style Guide
|
|
252
|
+
|
|
253
|
+
This project uses Rigour for quality gates.
|
|
254
|
+
|
|
255
|
+
## Required Before Completion
|
|
256
|
+
|
|
257
|
+
Always run \`npx @rigour-labs/cli check\` before marking any task complete.
|
|
258
|
+
|
|
259
|
+
${ruleContent}`;
|
|
260
|
+
if (!(await fs_extra_1.default.pathExists(geminiStylePath))) {
|
|
261
|
+
await fs_extra_1.default.writeFile(geminiStylePath, geminiContent);
|
|
262
|
+
console.log(chalk_1.default.green('✔ Initialized Gemini Handshake (.gemini/styleguide.md)'));
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
// OpenAI Codex / Aider (AGENTS.md - Universal Standard)
|
|
266
|
+
if (targetIDE === 'codex' || targetIDE === 'all') {
|
|
267
|
+
const agentsPath = path_1.default.join(cwd, 'AGENTS.md');
|
|
268
|
+
const agentsContent = `# AGENTS.md - Universal AI Agent Instructions
|
|
269
|
+
|
|
270
|
+
This file provides instructions for AI coding agents (Codex, Aider, and others).
|
|
271
|
+
|
|
272
|
+
## Setup
|
|
273
|
+
|
|
274
|
+
\`\`\`bash
|
|
275
|
+
npm install
|
|
276
|
+
npm run dev
|
|
277
|
+
npm test
|
|
278
|
+
\`\`\`
|
|
279
|
+
|
|
280
|
+
## Quality Gates
|
|
281
|
+
|
|
282
|
+
This project uses Rigour. Before completing any task:
|
|
283
|
+
|
|
284
|
+
\`\`\`bash
|
|
285
|
+
npx @rigour-labs/cli check
|
|
286
|
+
\`\`\`
|
|
287
|
+
|
|
288
|
+
${ruleContent}`;
|
|
289
|
+
if (!(await fs_extra_1.default.pathExists(agentsPath))) {
|
|
290
|
+
await fs_extra_1.default.writeFile(agentsPath, agentsContent);
|
|
291
|
+
console.log(chalk_1.default.green('✔ Initialized Universal Agent Handshake (AGENTS.md)'));
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
// Windsurf (.windsurfrules)
|
|
295
|
+
if (targetIDE === 'windsurf' || targetIDE === 'all') {
|
|
296
|
+
const windsurfPath = path_1.default.join(cwd, '.windsurfrules');
|
|
297
|
+
if (!(await fs_extra_1.default.pathExists(windsurfPath))) {
|
|
298
|
+
await fs_extra_1.default.writeFile(windsurfPath, ruleContent);
|
|
299
|
+
console.log(chalk_1.default.green('✔ Initialized Windsurf Handshake (.windsurfrules)'));
|
|
300
|
+
}
|
|
301
|
+
}
|
|
192
302
|
// 3. Update .gitignore
|
|
193
303
|
const gitignorePath = path_1.default.join(cwd, '.gitignore');
|
|
194
304
|
const ignorePatterns = ['rigour-report.json', 'rigour-fix-packet.json', '.rigour/'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rigour-labs/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.1",
|
|
4
4
|
"bin": {
|
|
5
5
|
"rigour": "dist/cli.js"
|
|
6
6
|
},
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"globby": "^14.0.1",
|
|
22
22
|
"inquirer": "9.2.16",
|
|
23
23
|
"yaml": "^2.8.2",
|
|
24
|
-
"@rigour-labs/core": "2.
|
|
24
|
+
"@rigour-labs/core": "2.9.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/fs-extra": "^11.0.4",
|
package/src/commands/init.ts
CHANGED
|
@@ -8,14 +8,34 @@ import { CODE_QUALITY_RULES, DEBUGGING_RULES, COLLABORATION_RULES, AGNOSTIC_AI_I
|
|
|
8
8
|
export interface InitOptions {
|
|
9
9
|
preset?: string;
|
|
10
10
|
paradigm?: string;
|
|
11
|
-
ide?: 'cursor' | 'vscode' | 'cline' | 'all';
|
|
11
|
+
ide?: 'cursor' | 'vscode' | 'cline' | 'claude' | 'gemini' | 'codex' | 'windsurf' | 'all';
|
|
12
12
|
dryRun?: boolean;
|
|
13
13
|
explain?: boolean;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
type DetectedIDE = 'cursor' | 'vscode' | 'cline' | 'unknown';
|
|
16
|
+
type DetectedIDE = 'cursor' | 'vscode' | 'cline' | 'claude' | 'gemini' | 'codex' | 'windsurf' | 'unknown';
|
|
17
17
|
|
|
18
18
|
function detectIDE(cwd: string): DetectedIDE {
|
|
19
|
+
// Check for Claude Code markers
|
|
20
|
+
if (fs.existsSync(path.join(cwd, 'CLAUDE.md')) || fs.existsSync(path.join(cwd, '.claude'))) {
|
|
21
|
+
return 'claude';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Check for Gemini Code Assist markers
|
|
25
|
+
if (fs.existsSync(path.join(cwd, '.gemini'))) {
|
|
26
|
+
return 'gemini';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Check for Codex/Aider AGENTS.md (universal standard)
|
|
30
|
+
if (fs.existsSync(path.join(cwd, 'AGENTS.md'))) {
|
|
31
|
+
return 'codex';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Check for Windsurf markers
|
|
35
|
+
if (fs.existsSync(path.join(cwd, '.windsurfrules')) || fs.existsSync(path.join(cwd, '.windsurf'))) {
|
|
36
|
+
return 'windsurf';
|
|
37
|
+
}
|
|
38
|
+
|
|
19
39
|
// Check for Cline-specific markers
|
|
20
40
|
if (fs.existsSync(path.join(cwd, '.clinerules'))) {
|
|
21
41
|
return 'cline';
|
|
@@ -48,6 +68,16 @@ function detectIDE(cwd: string): DetectedIDE {
|
|
|
48
68
|
return 'vscode';
|
|
49
69
|
}
|
|
50
70
|
|
|
71
|
+
// Check for Claude Code environment
|
|
72
|
+
if (process.env.CLAUDE_CODE || process.env.ANTHROPIC_API_KEY) {
|
|
73
|
+
return 'claude';
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Check for Gemini environment
|
|
77
|
+
if (process.env.GEMINI_API_KEY || process.env.GOOGLE_CLOUD_PROJECT) {
|
|
78
|
+
return 'gemini';
|
|
79
|
+
}
|
|
80
|
+
|
|
51
81
|
return 'unknown';
|
|
52
82
|
}
|
|
53
83
|
|
|
@@ -216,6 +246,99 @@ ${ruleContent}`;
|
|
|
216
246
|
}
|
|
217
247
|
}
|
|
218
248
|
|
|
249
|
+
// Claude Code (CLAUDE.md)
|
|
250
|
+
if (targetIDE === 'claude' || targetIDE === 'all') {
|
|
251
|
+
const claudePath = path.join(cwd, 'CLAUDE.md');
|
|
252
|
+
const claudeContent = `# CLAUDE.md - Project Instructions for Claude Code
|
|
253
|
+
|
|
254
|
+
This file provides Claude Code with context about this project.
|
|
255
|
+
|
|
256
|
+
## Project Overview
|
|
257
|
+
|
|
258
|
+
This project uses Rigour for quality gates. Always run \`npx @rigour-labs/cli check\` before marking tasks complete.
|
|
259
|
+
|
|
260
|
+
## Commands
|
|
261
|
+
|
|
262
|
+
\`\`\`bash
|
|
263
|
+
# Verify quality gates
|
|
264
|
+
npx @rigour-labs/cli check
|
|
265
|
+
|
|
266
|
+
# Get fix packet for failures
|
|
267
|
+
npx @rigour-labs/cli explain
|
|
268
|
+
|
|
269
|
+
# Self-healing agent loop
|
|
270
|
+
npx @rigour-labs/cli run -- claude "<task>"
|
|
271
|
+
\`\`\`
|
|
272
|
+
|
|
273
|
+
${ruleContent}`;
|
|
274
|
+
|
|
275
|
+
if (!(await fs.pathExists(claudePath))) {
|
|
276
|
+
await fs.writeFile(claudePath, claudeContent);
|
|
277
|
+
console.log(chalk.green('✔ Initialized Claude Code Handshake (CLAUDE.md)'));
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// Gemini Code Assist (.gemini/styleguide.md)
|
|
282
|
+
if (targetIDE === 'gemini' || targetIDE === 'all') {
|
|
283
|
+
const geminiDir = path.join(cwd, '.gemini');
|
|
284
|
+
await fs.ensureDir(geminiDir);
|
|
285
|
+
const geminiStylePath = path.join(geminiDir, 'styleguide.md');
|
|
286
|
+
const geminiContent = `# Gemini Code Assist Style Guide
|
|
287
|
+
|
|
288
|
+
This project uses Rigour for quality gates.
|
|
289
|
+
|
|
290
|
+
## Required Before Completion
|
|
291
|
+
|
|
292
|
+
Always run \`npx @rigour-labs/cli check\` before marking any task complete.
|
|
293
|
+
|
|
294
|
+
${ruleContent}`;
|
|
295
|
+
|
|
296
|
+
if (!(await fs.pathExists(geminiStylePath))) {
|
|
297
|
+
await fs.writeFile(geminiStylePath, geminiContent);
|
|
298
|
+
console.log(chalk.green('✔ Initialized Gemini Handshake (.gemini/styleguide.md)'));
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// OpenAI Codex / Aider (AGENTS.md - Universal Standard)
|
|
303
|
+
if (targetIDE === 'codex' || targetIDE === 'all') {
|
|
304
|
+
const agentsPath = path.join(cwd, 'AGENTS.md');
|
|
305
|
+
const agentsContent = `# AGENTS.md - Universal AI Agent Instructions
|
|
306
|
+
|
|
307
|
+
This file provides instructions for AI coding agents (Codex, Aider, and others).
|
|
308
|
+
|
|
309
|
+
## Setup
|
|
310
|
+
|
|
311
|
+
\`\`\`bash
|
|
312
|
+
npm install
|
|
313
|
+
npm run dev
|
|
314
|
+
npm test
|
|
315
|
+
\`\`\`
|
|
316
|
+
|
|
317
|
+
## Quality Gates
|
|
318
|
+
|
|
319
|
+
This project uses Rigour. Before completing any task:
|
|
320
|
+
|
|
321
|
+
\`\`\`bash
|
|
322
|
+
npx @rigour-labs/cli check
|
|
323
|
+
\`\`\`
|
|
324
|
+
|
|
325
|
+
${ruleContent}`;
|
|
326
|
+
|
|
327
|
+
if (!(await fs.pathExists(agentsPath))) {
|
|
328
|
+
await fs.writeFile(agentsPath, agentsContent);
|
|
329
|
+
console.log(chalk.green('✔ Initialized Universal Agent Handshake (AGENTS.md)'));
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// Windsurf (.windsurfrules)
|
|
334
|
+
if (targetIDE === 'windsurf' || targetIDE === 'all') {
|
|
335
|
+
const windsurfPath = path.join(cwd, '.windsurfrules');
|
|
336
|
+
if (!(await fs.pathExists(windsurfPath))) {
|
|
337
|
+
await fs.writeFile(windsurfPath, ruleContent);
|
|
338
|
+
console.log(chalk.green('✔ Initialized Windsurf Handshake (.windsurfrules)'));
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
219
342
|
// 3. Update .gitignore
|
|
220
343
|
const gitignorePath = path.join(cwd, '.gitignore');
|
|
221
344
|
const ignorePatterns = ['rigour-report.json', 'rigour-fix-packet.json', '.rigour/'];
|