@rigour-labs/cli 2.7.0 → 2.8.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/dist/commands/constants.d.ts +1 -0
- package/dist/commands/constants.js +22 -1
- package/dist/commands/init.d.ts +1 -1
- package/dist/commands/init.js +19 -2
- package/dist/init-rules.test.js +15 -9
- package/package.json +2 -2
- package/src/commands/constants.ts +22 -0
- package/src/commands/init.ts +34 -13
- package/src/init-rules.test.ts +19 -9
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const CODE_QUALITY_RULES = "\n# Code Quality Standards\n\n## PRODUCTION-GRADE CODE ONLY\n- No debug logging in production code\n- No shortcuts or \"temporary\" fixes\n- No over-engineering - simplest solution that works\n- Follow existing code patterns and conventions\n- Handle edge cases properly\n- No TODO/FIXME comments in final code\n\n## MODULAR CODE STRUCTURE\n- Write SMALL, focused functions (< 50 lines ideally)\n- One function = one job, clearly named\n- New features go in SEPARATE FILES, not flooding existing ones\n- Keep files under 500 lines - split if growing larger\n- Extract reusable logic into utility modules\n- Avoid \"god files\" that do everything\n- When adding to existing code, check if a new module is more appropriate\n\n## Technical Standards\n\n### DRY Principle\n- Extract repeated logic into utilities\n- Single Responsibility: One function, one job\n- Defensive coding: Validate inputs at boundaries\n- Lazy initialization for external dependencies (secrets, connections)\n- Graceful degradation over hard failures\n\n### File Organization\n```\n# Good: Separate concerns into focused files\ngovernor/\n main.py # Entry point only\n drift_detector.py # Drift detection logic\n lip_sync_analyzer.py # SyncNet integration\n audio_analyzer.py # Audio analysis\n\n# Bad: One massive file with everything\ngovernor/\n main.py (2000+ lines with all logic mixed)\n```\n\n### API Design\n- Consistent error responses\n- Proper HTTP status codes\n- Authentication at the edge\n- Rate limiting on public endpoints\n\n## PRODUCTION-READY SELF-REVIEW (THE GATEKEEPER)\n\nBefore asking for \"approval,\" internally verify:\n\n- **Zero-Dependency Check**: Does this fix rely on a local environment variable not yet in `talentlyt-kv`?\n- **Side-Effect Audit**: Could this change trigger a 502 Bad Gateway at the `/auth/callback` or `/api/agent` endpoints?\n- **Biometric Integrity**: If touching the `Governor`, have I verified that the `similarity_score` logic remains deterministic?\n- **Cost Impact**: Does this change increase egress costs (e.g., unnecessary cross-region logging)?\n- **Error Handling**: Does the UI have a graceful fallback if the backend service is slow?\n";
|
|
2
2
|
export declare const DEBUGGING_RULES = "\n# Investigation & Debugging Protocol\n\n## INVESTIGATION PROTOCOL\n\nWhen debugging:\n1. Check DEPLOYED environment (Azure, prod), not localhost unless explicitly asked\n2. Trace the actual request flow end-to-end\n3. Collect evidence at each step\n4. Present findings before proposing fixes\n\n## GAP ANALYSIS\n\nWhen debugging or proposing changes:\n\n1. **Trace the actual request flow** end-to-end:\n - Client \u2192 Cloudflare \u2192 Vercel/Container App \u2192 DB\n\n2. **Identify Hidden Gaps** - Explicitly check if the change affects:\n - **Cross-Region Handshakes**: Will this increase latency for users in Pakistan/India?\n - **Forensic Continuity**: Does this change how Maya captures gaze or audio data?\n - **Auth Persistence**: Will this interfere with WorkOS session tokens or M2M keys?\n\n3. **Evidence-First**: Collect logs from `talentlyt-dashboard` before proposing a fix.\n\n## Request Flow Tracing\n\n```\nClient Browser\n \u2193\nCloudflare (CDN/WAF)\n \u2193\nAzure Container Apps\n \u251C\u2500\u2500 talentlyt-dashboard (Next.js)\n \u2514\u2500\u2500 talentlyt-agent (Python/LiveKit)\n \u2193\nPostgreSQL Database\n \u2193\nAzure Blob Storage (recordings, evidence)\n```\n\n## Evidence Collection\n\nBefore proposing any fix:\n1. Get the actual error from logs (not assumed)\n2. Identify the exact file and line number\n3. Trace the data flow that led to the error\n4. Verify the fix doesn't break other paths\n";
|
|
3
3
|
export declare const COLLABORATION_RULES = "\n# Role & Collaboration\n\nYou are a Senior Staff Engineer working alongside a Principal Engineer (the user). \nYou do NOT work autonomously - you work collaboratively with approval at each step.\n\n## 1. NO ASSUMPTIONS\n- Never assume root cause without evidence from logs/code\n- Never assume a fix works without verification\n- Always trace the ACTUAL flow, not the expected flow\n- When debugging, read the DEPLOYED code, not local code\n\n## 2. APPROVAL REQUIRED\nBefore making ANY code change, you MUST:\n1. Show the evidence (logs, code trace) proving the issue\n2. Explain the root cause with proof\n3. Propose the fix with rationale\n4. Wait for explicit approval: \"approved\", \"go ahead\", \"do it\"\n\nException: Only proceed without approval if user explicitly says \"just do it\" or \"fix it\"\n\n## 3. NEVER LOSE TRACK\n- Maintain TODO list for multi-step tasks\n- Complete current task before starting new ones\n- If interrupted, summarize current state before switching\n- Reference previous findings, don't repeat investigations\n\n## Communication\n\n### When Reporting Issues\n```\n**Evidence:** [actual log/error message]\n**Location:** [file:line or endpoint]\n**Root Cause:** [proven, not assumed]\n**Privacy Impact:** [Does this affect biometric/PII data?]\n**Fix:** [proposed solution]\n```\n\n### When Asking for Approval\n```\nI found: [evidence]\nRoot cause: [explanation]\nProposed fix: [code change summary]\n\nApprove to proceed?\n```\n\n### When Stuck\n- Say \"I need more information\" not guess\n- Ask specific questions\n- Propose diagnostic steps\n\n## \u26A0\uFE0F RIGOUR.YML IS SACRED\n\nThe `rigour.yml` file represents **team-agreed quality standards**. You are FORBIDDEN from:\n\n1. \u274C Increasing thresholds to pass checks (e.g., raising `complexity: 100`)\n2. \u274C Adding patterns to `ignore:` to skip problematic files\n3. \u274C Removing items from `required_files`\n4. \u274C Disabling gates to avoid failures\n\n**Your job is to FIX THE CODE to meet the standards, NOT weaken the standards to pass the check.**\n\nIf thresholds genuinely need adjustment, escalate to the team lead with justification.\n\n## Forbidden Actions\n\n1. \u274C Making code changes without showing evidence first\n2. \u274C Testing on localhost when asked to check production\n3. \u274C Adding debug logs as a \"fix\"\n4. \u274C Multiple deployment attempts hoping it works\n5. \u274C Over-engineering simple solutions\n6. \u274C Assuming secrets/env vars are available at init time\n7. \u274C Ignoring user corrections\n8. \u274C Losing context between messages\n9. \u274C Modifying rigour.yml to pass quality checks\n";
|
|
4
|
+
export declare const AGNOSTIC_AI_INSTRUCTIONS = "\n# \uD83E\uDD16 CRITICAL INSTRUCTION FOR AI\n\nWhen asked to implement a feature or fix an issue:\n\n1. **FIRST**: Read ALL relevant rules files (e.g., `.cursor/rules/*.mdc`, `.clinerules`, `docs/AGENT_INSTRUCTIONS.md`).\n2. **NEVER** claim \"done\" until you can demonstrate the feature WORKS or the fix is verified.\n3. **ALWAYS** run `npx @rigour-labs/cli check` before claiming completion.\n4. **CONNECTivity**: \n - If you create backend code, you MUST wire it to the frontend.\n - If you create a service, you MUST connect it to the UI.\n\n## \u2705 VERIFICATION PROOF REQUIRED\n\nBefore saying \"done\", show ONE of:\n- Screenshot/output proving it works.\n- The exact commands the user can run to verify.\n- The full flow from initiation (e.g., button click) to result.\n\n\"Code exists\" \u2260 \"Feature works\"\n";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.COLLABORATION_RULES = exports.DEBUGGING_RULES = exports.CODE_QUALITY_RULES = void 0;
|
|
3
|
+
exports.AGNOSTIC_AI_INSTRUCTIONS = exports.COLLABORATION_RULES = exports.DEBUGGING_RULES = exports.CODE_QUALITY_RULES = void 0;
|
|
4
4
|
exports.CODE_QUALITY_RULES = `
|
|
5
5
|
# Code Quality Standards
|
|
6
6
|
|
|
@@ -186,3 +186,24 @@ If thresholds genuinely need adjustment, escalate to the team lead with justific
|
|
|
186
186
|
8. ❌ Losing context between messages
|
|
187
187
|
9. ❌ Modifying rigour.yml to pass quality checks
|
|
188
188
|
`;
|
|
189
|
+
exports.AGNOSTIC_AI_INSTRUCTIONS = `
|
|
190
|
+
# 🤖 CRITICAL INSTRUCTION FOR AI
|
|
191
|
+
|
|
192
|
+
When asked to implement a feature or fix an issue:
|
|
193
|
+
|
|
194
|
+
1. **FIRST**: Read ALL relevant rules files (e.g., \`.cursor/rules/*.mdc\`, \`.clinerules\`, \`docs/AGENT_INSTRUCTIONS.md\`).
|
|
195
|
+
2. **NEVER** claim "done" until you can demonstrate the feature WORKS or the fix is verified.
|
|
196
|
+
3. **ALWAYS** run \`npx @rigour-labs/cli check\` before claiming completion.
|
|
197
|
+
4. **CONNECTivity**:
|
|
198
|
+
- If you create backend code, you MUST wire it to the frontend.
|
|
199
|
+
- If you create a service, you MUST connect it to the UI.
|
|
200
|
+
|
|
201
|
+
## ✅ VERIFICATION PROOF REQUIRED
|
|
202
|
+
|
|
203
|
+
Before saying "done", show ONE of:
|
|
204
|
+
- Screenshot/output proving it works.
|
|
205
|
+
- The exact commands the user can run to verify.
|
|
206
|
+
- The full flow from initiation (e.g., button click) to result.
|
|
207
|
+
|
|
208
|
+
"Code exists" ≠ "Feature works"
|
|
209
|
+
`;
|
package/dist/commands/init.d.ts
CHANGED
package/dist/commands/init.js
CHANGED
|
@@ -11,6 +11,10 @@ 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 Cline-specific markers
|
|
15
|
+
if (fs_extra_1.default.existsSync(path_1.default.join(cwd, '.clinerules'))) {
|
|
16
|
+
return 'cline';
|
|
17
|
+
}
|
|
14
18
|
// Check for Cursor-specific markers
|
|
15
19
|
if (fs_extra_1.default.existsSync(path_1.default.join(cwd, '.cursor'))) {
|
|
16
20
|
return 'cursor';
|
|
@@ -19,12 +23,16 @@ function detectIDE(cwd) {
|
|
|
19
23
|
if (fs_extra_1.default.existsSync(path_1.default.join(cwd, '.vscode'))) {
|
|
20
24
|
return 'vscode';
|
|
21
25
|
}
|
|
22
|
-
// Check environment variables that IDEs set
|
|
26
|
+
// Check environment variables that IDEs/Agents set
|
|
23
27
|
const termProgram = process.env.TERM_PROGRAM || '';
|
|
24
28
|
const terminal = process.env.TERMINAL_EMULATOR || '';
|
|
29
|
+
const appName = process.env.APP_NAME || '';
|
|
25
30
|
if (termProgram.toLowerCase().includes('cursor') || terminal.toLowerCase().includes('cursor')) {
|
|
26
31
|
return 'cursor';
|
|
27
32
|
}
|
|
33
|
+
if (termProgram.toLowerCase().includes('cline') || appName.toLowerCase().includes('cline')) {
|
|
34
|
+
return 'cline';
|
|
35
|
+
}
|
|
28
36
|
if (termProgram.toLowerCase().includes('vscode') || process.env.VSCODE_INJECTION) {
|
|
29
37
|
return 'vscode';
|
|
30
38
|
}
|
|
@@ -136,6 +144,7 @@ npx @rigour-labs/cli check
|
|
|
136
144
|
npx @rigour-labs/cli run -- <agent-command>
|
|
137
145
|
\`\`\`
|
|
138
146
|
|
|
147
|
+
${constants_js_1.AGNOSTIC_AI_INSTRUCTIONS}
|
|
139
148
|
${constants_js_1.CODE_QUALITY_RULES}
|
|
140
149
|
|
|
141
150
|
${constants_js_1.DEBUGGING_RULES}
|
|
@@ -168,10 +177,18 @@ ${ruleContent}`;
|
|
|
168
177
|
console.log(chalk_1.default.green('✔ Initialized Cursor Handshake (.cursor/rules/rigour.mdc)'));
|
|
169
178
|
}
|
|
170
179
|
}
|
|
171
|
-
if (targetIDE === 'vscode') {
|
|
180
|
+
if (targetIDE === 'vscode' || targetIDE === 'all') {
|
|
172
181
|
// VS Code users use the universal AGENT_INSTRUCTIONS.md (already created above)
|
|
182
|
+
// We could also add .vscode/settings.json or snippets here if needed
|
|
173
183
|
console.log(chalk_1.default.green('✔ VS Code mode - using Universal Handshake (docs/AGENT_INSTRUCTIONS.md)'));
|
|
174
184
|
}
|
|
185
|
+
if (targetIDE === 'cline' || targetIDE === 'all') {
|
|
186
|
+
const clineRulesPath = path_1.default.join(cwd, '.clinerules');
|
|
187
|
+
if (!(await fs_extra_1.default.pathExists(clineRulesPath))) {
|
|
188
|
+
await fs_extra_1.default.writeFile(clineRulesPath, ruleContent);
|
|
189
|
+
console.log(chalk_1.default.green('✔ Initialized Cline Handshake (.clinerules)'));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
175
192
|
// 3. Update .gitignore
|
|
176
193
|
const gitignorePath = path_1.default.join(cwd, '.gitignore');
|
|
177
194
|
const ignorePatterns = ['rigour-report.json', 'rigour-fix-packet.json', '.rigour/'];
|
package/dist/init-rules.test.js
CHANGED
|
@@ -15,23 +15,29 @@ const path_1 = __importDefault(require("path"));
|
|
|
15
15
|
(0, vitest_1.afterEach)(async () => {
|
|
16
16
|
await fs_extra_1.default.remove(testDir);
|
|
17
17
|
});
|
|
18
|
-
(0, vitest_1.it)('should create
|
|
19
|
-
// Run init in test directory
|
|
20
|
-
await (0, init_js_1.initCommand)(testDir);
|
|
18
|
+
(0, vitest_1.it)('should create instructions with agnostic rules and cursor rules on init', async () => {
|
|
19
|
+
// Run init in test directory with all IDEs to verify rules in both locations
|
|
20
|
+
await (0, init_js_1.initCommand)(testDir, { ide: 'all' });
|
|
21
21
|
const instructionsPath = path_1.default.join(testDir, 'docs', 'AGENT_INSTRUCTIONS.md');
|
|
22
22
|
const mdcPath = path_1.default.join(testDir, '.cursor', 'rules', 'rigour.mdc');
|
|
23
23
|
(0, vitest_1.expect)(await fs_extra_1.default.pathExists(instructionsPath)).toBe(true);
|
|
24
24
|
(0, vitest_1.expect)(await fs_extra_1.default.pathExists(mdcPath)).toBe(true);
|
|
25
25
|
const instructionsContent = await fs_extra_1.default.readFile(instructionsPath, 'utf-8');
|
|
26
26
|
const mdcContent = await fs_extra_1.default.readFile(mdcPath, 'utf-8');
|
|
27
|
+
// Check for agnostic instructions
|
|
28
|
+
(0, vitest_1.expect)(instructionsContent).toContain('# 🤖 CRITICAL INSTRUCTION FOR AI');
|
|
29
|
+
(0, vitest_1.expect)(instructionsContent).toContain('VERIFICATION PROOF REQUIRED');
|
|
27
30
|
// Check for key sections in universal instructions
|
|
28
31
|
(0, vitest_1.expect)(instructionsContent).toContain('# 🛡️ Rigour: Engineering Excellence Protocol');
|
|
29
32
|
(0, vitest_1.expect)(instructionsContent).toContain('# Code Quality Standards');
|
|
30
|
-
|
|
31
|
-
(0, vitest_1.expect)(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
(0,
|
|
35
|
-
|
|
33
|
+
// Check that MDC includes agnostic rules
|
|
34
|
+
(0, vitest_1.expect)(mdcContent).toContain('# 🤖 CRITICAL INSTRUCTION FOR AI');
|
|
35
|
+
});
|
|
36
|
+
(0, vitest_1.it)('should create .clinerules when ide is cline or all', async () => {
|
|
37
|
+
await (0, init_js_1.initCommand)(testDir, { ide: 'cline' });
|
|
38
|
+
const clineRulesPath = path_1.default.join(testDir, '.clinerules');
|
|
39
|
+
(0, vitest_1.expect)(await fs_extra_1.default.pathExists(clineRulesPath)).toBe(true);
|
|
40
|
+
const content = await fs_extra_1.default.readFile(clineRulesPath, 'utf-8');
|
|
41
|
+
(0, vitest_1.expect)(content).toContain('# 🤖 CRITICAL INSTRUCTION FOR AI');
|
|
36
42
|
});
|
|
37
43
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rigour-labs/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
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.8.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -185,3 +185,25 @@ If thresholds genuinely need adjustment, escalate to the team lead with justific
|
|
|
185
185
|
8. ❌ Losing context between messages
|
|
186
186
|
9. ❌ Modifying rigour.yml to pass quality checks
|
|
187
187
|
`;
|
|
188
|
+
|
|
189
|
+
export const AGNOSTIC_AI_INSTRUCTIONS = `
|
|
190
|
+
# 🤖 CRITICAL INSTRUCTION FOR AI
|
|
191
|
+
|
|
192
|
+
When asked to implement a feature or fix an issue:
|
|
193
|
+
|
|
194
|
+
1. **FIRST**: Read ALL relevant rules files (e.g., \`.cursor/rules/*.mdc\`, \`.clinerules\`, \`docs/AGENT_INSTRUCTIONS.md\`).
|
|
195
|
+
2. **NEVER** claim "done" until you can demonstrate the feature WORKS or the fix is verified.
|
|
196
|
+
3. **ALWAYS** run \`npx @rigour-labs/cli check\` before claiming completion.
|
|
197
|
+
4. **CONNECTivity**:
|
|
198
|
+
- If you create backend code, you MUST wire it to the frontend.
|
|
199
|
+
- If you create a service, you MUST connect it to the UI.
|
|
200
|
+
|
|
201
|
+
## ✅ VERIFICATION PROOF REQUIRED
|
|
202
|
+
|
|
203
|
+
Before saying "done", show ONE of:
|
|
204
|
+
- Screenshot/output proving it works.
|
|
205
|
+
- The exact commands the user can run to verify.
|
|
206
|
+
- The full flow from initiation (e.g., button click) to result.
|
|
207
|
+
|
|
208
|
+
"Code exists" ≠ "Feature works"
|
|
209
|
+
`;
|
package/src/commands/init.ts
CHANGED
|
@@ -3,44 +3,55 @@ import path from 'path';
|
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import yaml from 'yaml';
|
|
5
5
|
import { DiscoveryService } from '@rigour-labs/core';
|
|
6
|
-
import { CODE_QUALITY_RULES, DEBUGGING_RULES, COLLABORATION_RULES } from './constants.js';
|
|
6
|
+
import { CODE_QUALITY_RULES, DEBUGGING_RULES, COLLABORATION_RULES, AGNOSTIC_AI_INSTRUCTIONS } from './constants.js';
|
|
7
7
|
|
|
8
8
|
export interface InitOptions {
|
|
9
9
|
preset?: string;
|
|
10
10
|
paradigm?: string;
|
|
11
|
-
ide?: 'cursor' | 'vscode' | 'all';
|
|
11
|
+
ide?: 'cursor' | 'vscode' | 'cline' | 'all';
|
|
12
12
|
dryRun?: boolean;
|
|
13
13
|
explain?: boolean;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
type DetectedIDE = 'cursor' | 'vscode' | 'unknown';
|
|
16
|
+
type DetectedIDE = 'cursor' | 'vscode' | 'cline' | 'unknown';
|
|
17
17
|
|
|
18
18
|
function detectIDE(cwd: string): DetectedIDE {
|
|
19
|
+
// Check for Cline-specific markers
|
|
20
|
+
if (fs.existsSync(path.join(cwd, '.clinerules'))) {
|
|
21
|
+
return 'cline';
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
// Check for Cursor-specific markers
|
|
20
25
|
if (fs.existsSync(path.join(cwd, '.cursor'))) {
|
|
21
26
|
return 'cursor';
|
|
22
27
|
}
|
|
23
|
-
|
|
28
|
+
|
|
24
29
|
// Check for VS Code markers
|
|
25
30
|
if (fs.existsSync(path.join(cwd, '.vscode'))) {
|
|
26
31
|
return 'vscode';
|
|
27
32
|
}
|
|
28
|
-
|
|
29
|
-
// Check environment variables that IDEs set
|
|
33
|
+
|
|
34
|
+
// Check environment variables that IDEs/Agents set
|
|
30
35
|
const termProgram = process.env.TERM_PROGRAM || '';
|
|
31
36
|
const terminal = process.env.TERMINAL_EMULATOR || '';
|
|
32
|
-
|
|
37
|
+
const appName = process.env.APP_NAME || '';
|
|
38
|
+
|
|
33
39
|
if (termProgram.toLowerCase().includes('cursor') || terminal.toLowerCase().includes('cursor')) {
|
|
34
40
|
return 'cursor';
|
|
35
41
|
}
|
|
36
|
-
|
|
42
|
+
|
|
43
|
+
if (termProgram.toLowerCase().includes('cline') || appName.toLowerCase().includes('cline')) {
|
|
44
|
+
return 'cline';
|
|
45
|
+
}
|
|
46
|
+
|
|
37
47
|
if (termProgram.toLowerCase().includes('vscode') || process.env.VSCODE_INJECTION) {
|
|
38
48
|
return 'vscode';
|
|
39
49
|
}
|
|
40
|
-
|
|
50
|
+
|
|
41
51
|
return 'unknown';
|
|
42
52
|
}
|
|
43
53
|
|
|
54
|
+
|
|
44
55
|
export async function initCommand(cwd: string, options: InitOptions = {}) {
|
|
45
56
|
const discovery = new DiscoveryService();
|
|
46
57
|
const result = await discovery.discover(cwd);
|
|
@@ -152,6 +163,7 @@ npx @rigour-labs/cli check
|
|
|
152
163
|
npx @rigour-labs/cli run -- <agent-command>
|
|
153
164
|
\`\`\`
|
|
154
165
|
|
|
166
|
+
${AGNOSTIC_AI_INSTRUCTIONS}
|
|
155
167
|
${CODE_QUALITY_RULES}
|
|
156
168
|
|
|
157
169
|
${DEBUGGING_RULES}
|
|
@@ -168,11 +180,11 @@ ${COLLABORATION_RULES}
|
|
|
168
180
|
// 2. Create IDE-Specific Rules based on detection or user preference
|
|
169
181
|
const detectedIDE = detectIDE(cwd);
|
|
170
182
|
const targetIDE = options.ide || (detectedIDE !== 'unknown' ? detectedIDE : 'all');
|
|
171
|
-
|
|
183
|
+
|
|
172
184
|
if (detectedIDE !== 'unknown' && !options.ide) {
|
|
173
185
|
console.log(chalk.dim(` (Auto-detected IDE: ${detectedIDE})`));
|
|
174
186
|
}
|
|
175
|
-
|
|
187
|
+
|
|
176
188
|
if (targetIDE === 'cursor' || targetIDE === 'all') {
|
|
177
189
|
const cursorRulesDir = path.join(cwd, '.cursor', 'rules');
|
|
178
190
|
await fs.ensureDir(cursorRulesDir);
|
|
@@ -189,12 +201,21 @@ ${ruleContent}`;
|
|
|
189
201
|
console.log(chalk.green('✔ Initialized Cursor Handshake (.cursor/rules/rigour.mdc)'));
|
|
190
202
|
}
|
|
191
203
|
}
|
|
192
|
-
|
|
193
|
-
if (targetIDE === 'vscode') {
|
|
204
|
+
|
|
205
|
+
if (targetIDE === 'vscode' || targetIDE === 'all') {
|
|
194
206
|
// VS Code users use the universal AGENT_INSTRUCTIONS.md (already created above)
|
|
207
|
+
// We could also add .vscode/settings.json or snippets here if needed
|
|
195
208
|
console.log(chalk.green('✔ VS Code mode - using Universal Handshake (docs/AGENT_INSTRUCTIONS.md)'));
|
|
196
209
|
}
|
|
197
210
|
|
|
211
|
+
if (targetIDE === 'cline' || targetIDE === 'all') {
|
|
212
|
+
const clineRulesPath = path.join(cwd, '.clinerules');
|
|
213
|
+
if (!(await fs.pathExists(clineRulesPath))) {
|
|
214
|
+
await fs.writeFile(clineRulesPath, ruleContent);
|
|
215
|
+
console.log(chalk.green('✔ Initialized Cline Handshake (.clinerules)'));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
198
219
|
// 3. Update .gitignore
|
|
199
220
|
const gitignorePath = path.join(cwd, '.gitignore');
|
|
200
221
|
const ignorePatterns = ['rigour-report.json', 'rigour-fix-packet.json', '.rigour/'];
|
package/src/init-rules.test.ts
CHANGED
|
@@ -14,9 +14,9 @@ describe('Init Command Rules Verification', () => {
|
|
|
14
14
|
await fs.remove(testDir);
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
it('should create
|
|
18
|
-
// Run init in test directory
|
|
19
|
-
await initCommand(testDir);
|
|
17
|
+
it('should create instructions with agnostic rules and cursor rules on init', async () => {
|
|
18
|
+
// Run init in test directory with all IDEs to verify rules in both locations
|
|
19
|
+
await initCommand(testDir, { ide: 'all' });
|
|
20
20
|
|
|
21
21
|
const instructionsPath = path.join(testDir, 'docs', 'AGENT_INSTRUCTIONS.md');
|
|
22
22
|
const mdcPath = path.join(testDir, '.cursor', 'rules', 'rigour.mdc');
|
|
@@ -27,15 +27,25 @@ describe('Init Command Rules Verification', () => {
|
|
|
27
27
|
const instructionsContent = await fs.readFile(instructionsPath, 'utf-8');
|
|
28
28
|
const mdcContent = await fs.readFile(mdcPath, 'utf-8');
|
|
29
29
|
|
|
30
|
+
// Check for agnostic instructions
|
|
31
|
+
expect(instructionsContent).toContain('# 🤖 CRITICAL INSTRUCTION FOR AI');
|
|
32
|
+
expect(instructionsContent).toContain('VERIFICATION PROOF REQUIRED');
|
|
33
|
+
|
|
30
34
|
// Check for key sections in universal instructions
|
|
31
35
|
expect(instructionsContent).toContain('# 🛡️ Rigour: Engineering Excellence Protocol');
|
|
32
36
|
expect(instructionsContent).toContain('# Code Quality Standards');
|
|
33
|
-
expect(instructionsContent).toContain('# Investigation & Debugging Protocol');
|
|
34
|
-
expect(instructionsContent).toContain('# Role & Collaboration');
|
|
35
37
|
|
|
36
|
-
// Check that MDC includes
|
|
37
|
-
expect(mdcContent).toContain('
|
|
38
|
-
expect(mdcContent).toContain('description: Enforcement of Rigour quality gates and best practices.');
|
|
39
|
-
expect(mdcContent).toContain('# Code Quality Standards');
|
|
38
|
+
// Check that MDC includes agnostic rules
|
|
39
|
+
expect(mdcContent).toContain('# 🤖 CRITICAL INSTRUCTION FOR AI');
|
|
40
40
|
});
|
|
41
|
+
|
|
42
|
+
it('should create .clinerules when ide is cline or all', async () => {
|
|
43
|
+
await initCommand(testDir, { ide: 'cline' });
|
|
44
|
+
const clineRulesPath = path.join(testDir, '.clinerules');
|
|
45
|
+
expect(await fs.pathExists(clineRulesPath)).toBe(true);
|
|
46
|
+
|
|
47
|
+
const content = await fs.readFile(clineRulesPath, 'utf-8');
|
|
48
|
+
expect(content).toContain('# 🤖 CRITICAL INSTRUCTION FOR AI');
|
|
49
|
+
});
|
|
50
|
+
|
|
41
51
|
});
|