@iris-code/core 0.4.1 → 0.4.2

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/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export * from './qualitySignals';
10
10
  export * from './fileNaming';
11
11
  export * from './sfc';
12
12
  export * from './findings';
13
+ export * from './rules';
13
14
  import { IrisConfig } from './config';
14
15
  import { AnalyseBufferResult } from './guards';
15
16
  import { CodeSmells, FileAnalysis, FunctionInfo, Language, LanguageAnalysis, TypeScriptMetrics, UnusedImport, Warning } from './types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,OAAO,CAAA;AACrB,cAAc,YAAY,CAAA;AAE1B,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAQrC,OAAO,EACL,mBAAmB,EAMpB,MAAM,UAAU,CAAA;AAOjB,OAAO,EACL,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,OAAO,EACR,MAAM,SAAS,CAAA;AAEhB,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,gBAAgB,GACjB,CAAA;AAED,MAAM,WAAW,kBAAkB;IACjC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CACpC;AAkDD,w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AAO,GAAE,kBAAuB,GAC/B,YAAY,CA+Dd;AAED,wBAAgB,aAAa,CAC3B,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,UAAU,EAClB,QAAQ,SAAe,EACvB,OAAO,GAAE,kBAAuB,GAC/B,mBAAmB,CAOrB"}
package/dist/index.js CHANGED
@@ -28,6 +28,7 @@ __exportStar(require("./qualitySignals"), exports);
28
28
  __exportStar(require("./fileNaming"), exports);
29
29
  __exportStar(require("./sfc"), exports);
30
30
  __exportStar(require("./findings"), exports);
31
+ __exportStar(require("./rules"), exports);
31
32
  const analyser_1 = require("./csharp/analyser");
32
33
  const analyser_2 = require("./java/analyser");
33
34
  const analyser_3 = require("./go/analyser");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA8GA,kCAoEC;AAED,sCAYC;AAhMD,2CAAwB;AACxB,0CAAuB;AACvB,2CAAwB;AACxB,yCAAsB;AACtB,4CAAyB;AACzB,iDAA8B;AAC9B,+CAA4B;AAC5B,8CAA2B;AAC3B,mDAAgC;AAChC,+CAA4B;AAC5B,wCAAqB;AACrB,6CAA0B;AAG1B,gDAAiD;AACjD,8CAA6C;AAC7C,4CAAyC;AACzC,gDAAiD;AACjD,8CAA6C;AAC7C,8CAA6C;AAC7C,4CAAyC;AACzC,qCAOiB;AACjB,iDAAqE;AACrE,6CAAyE;AACzE,2CAAkD;AAClD,uCAA8C;AAC9C,6CAAuE;AACvE,+BAAgD;AA4BhD,SAAS,qBAAqB,CAAC,QAAgB;IAC7C,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;AAC1D,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAS,iBAAiB,CACxB,QAAkB,EAClB,MAAc,EACd,MAAkB,EAClB,QAAgB;IAEhB,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,EAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,iBAAiB,EAAE,UAAU,EAAE,cAAc,CAAC;aAC3G,CAAA;QACH,CAAC;IACH,CAAC;IAED,0EAA0E;IAC1E,IAAI,cAAc,CAAC,kBAAkB,EAAE,CAAC;QACtC,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,OAAO,IAAA,gCAAiB,EAAC,QAAQ,EAAE,IAAA,gCAAiB,EAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,CAAA;AACxF,CAAC;AAED,SAAgB,aAAa,CAC3B,MAAkB,EAClB,MAAkB,EAClB,QAAQ,GAAG,YAAY,EACvB,UAA8B,EAAE;IAEhC,IAAI,IAAA,wBAAe,EAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,CAAA;IAChD,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACtD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAA;AACvF,CAAC"}
@@ -0,0 +1,76 @@
1
+ import type { IrisGeneratedConfig } from './config';
2
+ /**
3
+ * Project rules for a coding agent, generated from the project's own config.
4
+ *
5
+ * The point of this module is prevention rather than remediation: an agent that
6
+ * knows the file-length limit does not write a 900-line file that Iris then
7
+ * reports. Everything here is DERIVED from `.irisconfig.json` - nothing is
8
+ * invented, and no model is involved, so the output is identical for identical
9
+ * input and can be regenerated on demand without cost.
10
+ *
11
+ * Two deliberate shapes:
12
+ *
13
+ * 1. **Imperatives, not a config dump.** Models act on instructions and treat
14
+ * data structures as reference material to skim. "Keep files under 400 lines"
15
+ * changes behaviour; `fileLengthThreshold: 400` does not. Anyone who wants the
16
+ * config can read the config.
17
+ * 2. **Markers, so a regeneration is safe.** The same append-and-remove contract
18
+ * the git hook block uses, because this file is committed and usually already
19
+ * contains text a human wrote.
20
+ */
21
+ export declare const AGENT_RULES_START = "<!-- >>> iris-rules-start <<< -->";
22
+ export declare const AGENT_RULES_END = "<!-- >>> iris-rules-end <<< -->";
23
+ export type AgentRulesTarget = 'agents' | 'claude' | 'cursor' | 'copilot';
24
+ export interface AgentRulesTargetInfo {
25
+ id: AgentRulesTarget;
26
+ /** Project-relative path this target writes to. */
27
+ path: string;
28
+ label: string;
29
+ /** `mdc` targets carry Cursor's frontmatter; everything else is plain markdown. */
30
+ format: 'markdown' | 'mdc';
31
+ }
32
+ export declare const AGENT_RULES_TARGETS: Record<AgentRulesTarget, AgentRulesTargetInfo>;
33
+ export declare const DEFAULT_AGENT_RULES_TARGET: AgentRulesTarget;
34
+ export declare function isAgentRulesTarget(value: string): value is AgentRulesTarget;
35
+ export interface BuildAgentRulesOptions {
36
+ /** The resolved config, exactly as analysis will apply it. */
37
+ config: IrisGeneratedConfig;
38
+ /** False when no `.irisconfig.json` was found, so the block says these are defaults. */
39
+ hasConfigFile: boolean;
40
+ /** Language labels detected in the project, for the "these apply to" line. */
41
+ languages?: string[];
42
+ target?: AgentRulesTarget;
43
+ }
44
+ /**
45
+ * Builds the rules block WITHOUT its markers. Pure: same input, same output,
46
+ * so a regeneration on unchanged config is byte-identical.
47
+ */
48
+ export declare function buildAgentRules(options: BuildAgentRulesOptions): string;
49
+ /** The preamble a target needs above the block, or '' when it needs none. */
50
+ export declare function agentRulesPreamble(target: AgentRulesTarget): string;
51
+ /**
52
+ * Wraps a block in its markers. The preamble is deliberately NOT included.
53
+ *
54
+ * Cursor's frontmatter lives ABOVE the markers, because it has to be the first
55
+ * thing in the file for Cursor to read it. That means it cannot be part of the
56
+ * span a regeneration replaces, and including it here stacked a fresh copy on
57
+ * every run: four regenerations produced four frontmatter blocks. `spliceAgentRules`
58
+ * owns the preamble instead, adding it only when the file does not already have one.
59
+ */
60
+ export declare function renderAgentRulesBlock(block: string): string;
61
+ export type AgentRulesWriteAction = 'created' | 'replaced' | 'appended' | 'unchanged';
62
+ export interface AgentRulesSpliceResult {
63
+ content: string;
64
+ action: AgentRulesWriteAction;
65
+ /** Set when the existing file cannot be updated safely; content is then unusable. */
66
+ error?: string;
67
+ }
68
+ /**
69
+ * Places the block into existing file content.
70
+ *
71
+ * REFUSES rather than guessing when the markers are malformed: a half-deleted
72
+ * marker pair is the case where appending would silently duplicate the block and
73
+ * replacing would eat the wrong span of somebody's file.
74
+ */
75
+ export declare function spliceAgentRules(existing: string | null, rendered: string, target?: AgentRulesTarget): AgentRulesSpliceResult;
76
+ //# sourceMappingURL=rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAwB,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAIzE;;;;;;;;;;;;;;;;;;GAkBG;AAEH,eAAO,MAAM,iBAAiB,sCAAsC,CAAA;AACpE,eAAO,MAAM,eAAe,oCAAoC,CAAA;AAEhE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAA;AAEzE,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,gBAAgB,CAAA;IACpB,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,mFAAmF;IACnF,MAAM,EAAE,UAAU,GAAG,KAAK,CAAA;CAC3B;AAED,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,gBAAgB,EAAE,oBAAoB,CAU9E,CAAA;AAED,eAAO,MAAM,0BAA0B,EAAE,gBAA2B,CAAA;AAEpE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,gBAAgB,CAE3E;AAED,MAAM,WAAW,sBAAsB;IACrC,8DAA8D;IAC9D,MAAM,EAAE,mBAAmB,CAAA;IAC3B,wFAAwF;IACxF,aAAa,EAAE,OAAO,CAAA;IACtB,8EAA8E;IAC9E,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAC1B;AA+PD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,MAAM,CA+BvE;AAUD,6EAA6E;AAC7E,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAEnE;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,CAAA;AAErF,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,qBAAqB,CAAA;IAC7B,qFAAqF;IACrF,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,gBAA6C,GACpD,sBAAsB,CA6CxB"}
package/dist/rules.js ADDED
@@ -0,0 +1,380 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_AGENT_RULES_TARGET = exports.AGENT_RULES_TARGETS = exports.AGENT_RULES_END = exports.AGENT_RULES_START = void 0;
4
+ exports.isAgentRulesTarget = isAgentRulesTarget;
5
+ exports.buildAgentRules = buildAgentRules;
6
+ exports.agentRulesPreamble = agentRulesPreamble;
7
+ exports.renderAgentRulesBlock = renderAgentRulesBlock;
8
+ exports.spliceAgentRules = spliceAgentRules;
9
+ const config_1 = require("./config");
10
+ const languages_1 = require("./languages");
11
+ /**
12
+ * Project rules for a coding agent, generated from the project's own config.
13
+ *
14
+ * The point of this module is prevention rather than remediation: an agent that
15
+ * knows the file-length limit does not write a 900-line file that Iris then
16
+ * reports. Everything here is DERIVED from `.irisconfig.json` - nothing is
17
+ * invented, and no model is involved, so the output is identical for identical
18
+ * input and can be regenerated on demand without cost.
19
+ *
20
+ * Two deliberate shapes:
21
+ *
22
+ * 1. **Imperatives, not a config dump.** Models act on instructions and treat
23
+ * data structures as reference material to skim. "Keep files under 400 lines"
24
+ * changes behaviour; `fileLengthThreshold: 400` does not. Anyone who wants the
25
+ * config can read the config.
26
+ * 2. **Markers, so a regeneration is safe.** The same append-and-remove contract
27
+ * the git hook block uses, because this file is committed and usually already
28
+ * contains text a human wrote.
29
+ */
30
+ exports.AGENT_RULES_START = '<!-- >>> iris-rules-start <<< -->';
31
+ exports.AGENT_RULES_END = '<!-- >>> iris-rules-end <<< -->';
32
+ exports.AGENT_RULES_TARGETS = {
33
+ agents: { id: 'agents', path: 'AGENTS.md', label: 'AGENTS.md (most agents)', format: 'markdown' },
34
+ claude: { id: 'claude', path: 'CLAUDE.md', label: 'CLAUDE.md (Claude Code)', format: 'markdown' },
35
+ cursor: { id: 'cursor', path: '.cursor/rules/iris.mdc', label: '.cursor/rules/iris.mdc (Cursor)', format: 'mdc' },
36
+ copilot: {
37
+ id: 'copilot',
38
+ path: '.github/copilot-instructions.md',
39
+ label: '.github/copilot-instructions.md (GitHub Copilot)',
40
+ format: 'markdown',
41
+ },
42
+ };
43
+ exports.DEFAULT_AGENT_RULES_TARGET = 'agents';
44
+ function isAgentRulesTarget(value) {
45
+ return Object.prototype.hasOwnProperty.call(exports.AGENT_RULES_TARGETS, value);
46
+ }
47
+ const CONVENTION_EXAMPLES = {
48
+ 'snake_case': 'user_service.ts',
49
+ 'kebab-case': 'user-service.ts',
50
+ camelCase: 'userService.ts',
51
+ PascalCase: 'UserService.ts',
52
+ };
53
+ const LANGUAGE_EXAMPLE_EXTENSIONS = {
54
+ typescript: '.ts',
55
+ javascript: '.js',
56
+ go: '.go',
57
+ python: '.py',
58
+ ruby: '.rb',
59
+ csharp: '.cs',
60
+ java: '.java',
61
+ rust: '.rs',
62
+ };
63
+ function conventionExample(convention) {
64
+ return CONVENTION_EXAMPLES[convention] ?? '';
65
+ }
66
+ function conventionExampleForLanguage(convention, language) {
67
+ const example = conventionExample(convention);
68
+ const extension = LANGUAGE_EXAMPLE_EXTENSIONS[language];
69
+ if (!example || !extension)
70
+ return example;
71
+ return example.replace(/\.[^.]+$/, extension);
72
+ }
73
+ function numberOr(value, fallback) {
74
+ return typeof value === 'number' ? value : fallback;
75
+ }
76
+ function enabled(value, fallback) {
77
+ return typeof value === 'boolean' ? value : fallback;
78
+ }
79
+ function sizeRules(config) {
80
+ const defaults = config_1.DEFAULT_IRIS_CONFIG;
81
+ return [
82
+ `- Keep files under **${numberOr(config.fileLengthThreshold, defaults.fileLengthThreshold)} lines**. Split a file that grows past it rather than letting it grow.`,
83
+ `- Keep functions under **${numberOr(config.functionLengthThreshold, defaults.functionLengthThreshold)} lines**.`,
84
+ `- Keep at most **${numberOr(config.maxFunctionsPerFile, defaults.maxFunctionsPerFile)} functions** in one file and **${numberOr(config.maxImportsPerFile, defaults.maxImportsPerFile)} imports**.`,
85
+ // Deliberately language-neutral. "Pass an options object" is JavaScript's
86
+ // answer and reads as generic advice in a Java or Go project, which is the
87
+ // one thing this file cannot afford: an agent that spots boilerplate trusts
88
+ // the rest of it less. Say what to do in plain terms and let the developer's
89
+ // language decide the mechanism.
90
+ `- Keep parameter lists to **${numberOr(config.maxParameterCount, defaults.maxParameterCount)} parameters** or fewer. If a function needs more, group the related ones together and pass that instead.`,
91
+ `- Keep cyclomatic complexity under **${numberOr(config.complexityThreshold, defaults.complexityThreshold)}** per function. Prefer early returns over nested branches.`,
92
+ ];
93
+ }
94
+ /**
95
+ * A single-language project needs its effective per-file limits in the main
96
+ * instructions. In a mixed project that would be misleading, so the base
97
+ * limits remain primary and individual overrides stay in their own section.
98
+ */
99
+ function effectiveRulesConfig(config, languages) {
100
+ if (languages?.length !== 1)
101
+ return { config };
102
+ const language = Object.keys(config.languages ?? {})
103
+ .find(key => (0, languages_1.languageLabel)(key) === languages[0]);
104
+ if (!language)
105
+ return { config };
106
+ const override = config.languages?.[language];
107
+ if (!override)
108
+ return { config };
109
+ const fileNaming = override.fileNaming
110
+ ? {
111
+ ...override.fileNaming,
112
+ ignore: [...new Set([...(config.fileNaming?.ignore ?? []), ...override.fileNaming.ignore])],
113
+ ...(config.fileNaming?.overrides ? { overrides: config.fileNaming.overrides } : {}),
114
+ scope: override.fileNaming.scope ?? config.fileNaming?.scope ?? config.fileNamingScope,
115
+ }
116
+ : config.fileNaming;
117
+ return { config: { ...config, ...override, fileNaming }, language };
118
+ }
119
+ /**
120
+ * Debug-output call by language label, so the rule names what the project can
121
+ * actually contain.
122
+ *
123
+ * A Java-only project being told to watch for `console.log` is the kind of
124
+ * detail that makes an agent trust the whole file less: it reads as boilerplate
125
+ * rather than as this project's rules.
126
+ */
127
+ const DEBUG_OUTPUT_BY_LANGUAGE = {
128
+ TypeScript: '`console.log`',
129
+ JavaScript: '`console.log`',
130
+ Go: '`fmt.Println`',
131
+ Python: '`print`',
132
+ Ruby: '`puts`',
133
+ Java: '`System.out.println`',
134
+ 'C#': '`Console.WriteLine`',
135
+ Rust: '`println!`',
136
+ };
137
+ function debugOutputNames(languages) {
138
+ const named = [...new Set((languages ?? []).map(language => DEBUG_OUTPUT_BY_LANGUAGE[language]).filter(Boolean))];
139
+ if (!named.length)
140
+ return '`console.log`, `print`, `fmt.Println` or `System.out.println`';
141
+ if (named.length === 1)
142
+ return named[0];
143
+ return `${named.slice(0, -1).join(', ')} or ${named[named.length - 1]}`;
144
+ }
145
+ function hygieneRules(config, languages) {
146
+ const defaults = config_1.DEFAULT_IRIS_CONFIG;
147
+ const rules = [];
148
+ // TypeScript is the only language with these checks, so a project without it
149
+ // must not be told to avoid `any`.
150
+ const hasTypeScript = !languages?.length || languages.includes('TypeScript');
151
+ if (enabled(config.enableSecretsDetection, defaults.enableSecretsDetection)) {
152
+ rules.push('- **Never write a credential into source.** No API keys, tokens, passwords or connection strings, not even as a placeholder that looks real. Read them from the environment.');
153
+ }
154
+ if (enabled(config.enableSecuritySmells, defaults.enableSecuritySmells)) {
155
+ rules.push('- Do not build SQL by string concatenation, call `eval` or its equivalents, disable TLS verification, use MD5 or SHA1 for anything security-related, use a non-cryptographic random source for tokens, or redirect to an unvalidated URL.');
156
+ }
157
+ if (enabled(config.enableConsoleLogWarnings, defaults.enableConsoleLogWarnings)) {
158
+ rules.push(`- Remove debug output before you finish. No stray ${debugOutputNames(languages)} left behind.`);
159
+ }
160
+ if (enabled(config.enableMagicNumberDetection, defaults.enableMagicNumberDetection)) {
161
+ rules.push('- Name your constants. An unexplained number in an expression is a finding; a named constant is not.');
162
+ }
163
+ // No parameter-list rule here on purpose: the size section already states the
164
+ // project's own limit with its number, and a second sentence about it added
165
+ // only JavaScript-flavoured phrasing to a file that may be describing a Java
166
+ // or Go project.
167
+ if (hasTypeScript && enabled(config.enableMissingReturnTypeWarnings, defaults.enableMissingReturnTypeWarnings)) {
168
+ rules.push('- Give exported functions an explicit return type, and avoid `any`.');
169
+ }
170
+ if (enabled(config.enableDuplicateDetection, defaults.enableDuplicateDetection)) {
171
+ rules.push(`- Do not copy a block of code to a second place. Duplication is detected from **${numberOr(config.duplicateBlockMinTokens, defaults.duplicateBlockMinTokens)} tokens** upward; extract a shared function instead.`);
172
+ }
173
+ return rules;
174
+ }
175
+ function namingRules(config, language) {
176
+ const naming = config.fileNaming;
177
+ if (!naming)
178
+ return [];
179
+ const rules = [];
180
+ const example = language ? conventionExampleForLanguage(naming.convention, language) : conventionExample(naming.convention);
181
+ const scope = naming.scope ?? config.fileNamingScope;
182
+ rules.push(`- Name ${scope === 'all' ? 'files' : 'new files'} in **${naming.convention}**${example ? ` (for example \`${example}\`)` : ''}.${scope === 'new-files' ? ' Existing files that do not match are exempt, so do not rename them as a side effect of another change.' : ''}`);
183
+ for (const override of naming.overrides ?? []) {
184
+ const overrideExample = conventionExample(override.convention);
185
+ rules.push(`- Files matching ${override.files.map((glob) => `\`${glob}\``).join(', ')} use **${override.convention}**${overrideExample ? ` (for example \`${overrideExample}\`)` : ''}.`);
186
+ }
187
+ if (naming.ignore?.length) {
188
+ rules.push(`- These paths are exempt from naming rules: ${naming.ignore.map((glob) => `\`${glob}\``).join(', ')}.`);
189
+ }
190
+ return rules;
191
+ }
192
+ function gateRules(config) {
193
+ const rules = [];
194
+ const caps = [];
195
+ if (typeof config.minHealthScore === 'number') {
196
+ rules.push(`- A push is **blocked** when a file scores below **${config.minHealthScore}/100**. Check before you finish rather than after the push is refused.`);
197
+ }
198
+ if (config.gateBaselineMode) {
199
+ rules.push('- Baseline mode is on: each file is judged against its own locked baseline, so a file only fails when it gets worse than it already was.');
200
+ }
201
+ if (typeof config.gateMaxSecrets === 'number')
202
+ caps.push(`${config.gateMaxSecrets} hardcoded secret(s)`);
203
+ if (typeof config.gateMaxSecuritySmells === 'number')
204
+ caps.push(`${config.gateMaxSecuritySmells} security finding(s)`);
205
+ if (typeof config.gateMaxDuplicateBlocks === 'number')
206
+ caps.push(`${config.gateMaxDuplicateBlocks} duplicate block(s)`);
207
+ if (typeof config.gateMaxSuppressions === 'number')
208
+ caps.push(`${config.gateMaxSuppressions} suppression(s) per file`);
209
+ if (typeof config.gateMaxNamingViolations === 'number')
210
+ caps.push(`${config.gateMaxNamingViolations} naming violation(s)`);
211
+ if (typeof config.gateMaxComplexity === 'number')
212
+ caps.push(`complexity ${config.gateMaxComplexity} in any function`);
213
+ if (typeof config.gateMaxFileLength === 'number')
214
+ caps.push(`${config.gateMaxFileLength} lines in any file`);
215
+ if (typeof config.gateMaxSmellsPerFile === 'number')
216
+ caps.push(`${config.gateMaxSmellsPerFile} findings in one file`);
217
+ if (caps.length) {
218
+ rules.push(`- The push is also blocked above any of these: ${caps.join(', ')}.`);
219
+ }
220
+ return rules;
221
+ }
222
+ function suppressionRules(config) {
223
+ if (config.ignoreSuppressions) {
224
+ return [
225
+ '- `iris-ignore` comments are **disabled** in this project. A finding cannot be suppressed, so fix it rather than silencing it.',
226
+ ];
227
+ }
228
+ return [
229
+ '- To suppress a finding you have judged safe, write `// iris-ignore: <rule-id> -- <reason>` on the line above it. The reason is required: without one the directive does nothing and is itself reported.',
230
+ '- Do not suppress a finding to make a check pass. Suppress only what you can justify in that comment.',
231
+ ];
232
+ }
233
+ function describeLanguageOverride(config, language) {
234
+ const override = config.languages?.[language];
235
+ if (!override)
236
+ return '';
237
+ const details = [];
238
+ if (typeof override.fileLengthThreshold === 'number')
239
+ details.push(`files under **${override.fileLengthThreshold} lines**`);
240
+ if (typeof override.functionLengthThreshold === 'number')
241
+ details.push(`functions under **${override.functionLengthThreshold} lines**`);
242
+ if (typeof override.maxFunctionsPerFile === 'number')
243
+ details.push(`at most **${override.maxFunctionsPerFile} functions** per file`);
244
+ if (typeof override.maxImportsPerFile === 'number')
245
+ details.push(`at most **${override.maxImportsPerFile} imports** per file`);
246
+ if (typeof override.maxParameterCount === 'number')
247
+ details.push(`parameter lists at **${override.maxParameterCount}** or fewer`);
248
+ if (typeof override.complexityThreshold === 'number')
249
+ details.push(`complexity under **${override.complexityThreshold}**`);
250
+ if (typeof override.gateMaxSmellsPerFile === 'number')
251
+ details.push(`no more than **${override.gateMaxSmellsPerFile} findings** in one file before the gate fails`);
252
+ if (typeof override.gateMaxSuppressions === 'number')
253
+ details.push(`no more than **${override.gateMaxSuppressions} suppressions** in one file before the gate fails`);
254
+ if (override.fileNaming) {
255
+ const example = conventionExampleForLanguage(override.fileNaming.convention, language);
256
+ details.push(`new files in **${override.fileNaming.convention}**${example ? ` (for example \`${example}\`)` : ''}`);
257
+ }
258
+ if (!details.length)
259
+ return '';
260
+ return `- **${(0, languages_1.languageLabel)(language)}**: ${details.join('; ')}.`;
261
+ }
262
+ function languageRules(config, primaryLanguage) {
263
+ const languages = Object.keys(config.languages ?? {}).filter(language => language !== primaryLanguage);
264
+ if (!languages.length)
265
+ return [];
266
+ const described = languages.map(language => describeLanguageOverride(config, language)).filter(Boolean);
267
+ if (!described.length)
268
+ return [];
269
+ return [
270
+ '- The numbers above are the project defaults. These language-specific overrides apply where they match:',
271
+ ...described,
272
+ ];
273
+ }
274
+ function section(title, lines) {
275
+ if (!lines.length)
276
+ return [];
277
+ return [`### ${title}`, '', ...lines, ''];
278
+ }
279
+ /**
280
+ * Builds the rules block WITHOUT its markers. Pure: same input, same output,
281
+ * so a regeneration on unchanged config is byte-identical.
282
+ */
283
+ function buildAgentRules(options) {
284
+ const { config, hasConfigFile } = options;
285
+ const effective = effectiveRulesConfig(config, options.languages);
286
+ const lines = ['## Project rules (Iris Code)', ''];
287
+ lines.push(hasConfigFile
288
+ ? 'These rules are generated from this project\'s `.irisconfig.json`, which is what Iris Code enforces locally, in the pre-push hook and in CI. Follow them while writing code here.'
289
+ : 'This project has no `.irisconfig.json`, so these are the defaults Iris Code enforces. Follow them while writing code here, and run `iris config init` to set project-specific limits.');
290
+ lines.push('');
291
+ if (options.languages?.length) {
292
+ lines.push(`Languages in this project: ${options.languages.join(', ')}.`, '');
293
+ }
294
+ const sizeIntro = effective.language ? [`- These limits apply to **${(0, languages_1.languageLabel)(effective.language)}** files.`] : [];
295
+ lines.push(...section('Size and shape', [...sizeIntro, ...sizeRules(effective.config)]));
296
+ lines.push(...section('Things not to write', hygieneRules(config, options.languages)));
297
+ lines.push(...section('File naming', namingRules(effective.config, effective.language)));
298
+ lines.push(...section('Suppressions', suppressionRules(config)));
299
+ lines.push(...section('What blocks a push', gateRules(config)));
300
+ lines.push(...section('Per-language limits', languageRules(config, effective.language)));
301
+ lines.push('### Checking your work', '');
302
+ lines.push('- Run `iris check <file>` on a file you changed, or `iris gate .` before pushing, and fix what it reports rather than suppressing it.');
303
+ lines.push('- Iris Code analyses code and never runs it. It does not format: leave formatting to the project\'s configured formatter.');
304
+ lines.push('');
305
+ lines.push('_Generated by `iris rules`. Edit `.irisconfig.json` and regenerate rather than editing between the markers._');
306
+ return lines.join('\n');
307
+ }
308
+ const MDC_FRONTMATTER = [
309
+ '---',
310
+ 'description: Project rules enforced by Iris Code',
311
+ 'globs: ["**/*"]',
312
+ 'alwaysApply: true',
313
+ '---',
314
+ ].join('\n');
315
+ /** The preamble a target needs above the block, or '' when it needs none. */
316
+ function agentRulesPreamble(target) {
317
+ return exports.AGENT_RULES_TARGETS[target].format === 'mdc' ? MDC_FRONTMATTER : '';
318
+ }
319
+ /**
320
+ * Wraps a block in its markers. The preamble is deliberately NOT included.
321
+ *
322
+ * Cursor's frontmatter lives ABOVE the markers, because it has to be the first
323
+ * thing in the file for Cursor to read it. That means it cannot be part of the
324
+ * span a regeneration replaces, and including it here stacked a fresh copy on
325
+ * every run: four regenerations produced four frontmatter blocks. `spliceAgentRules`
326
+ * owns the preamble instead, adding it only when the file does not already have one.
327
+ */
328
+ function renderAgentRulesBlock(block) {
329
+ return `${exports.AGENT_RULES_START}\n${block}\n${exports.AGENT_RULES_END}`;
330
+ }
331
+ /**
332
+ * Places the block into existing file content.
333
+ *
334
+ * REFUSES rather than guessing when the markers are malformed: a half-deleted
335
+ * marker pair is the case where appending would silently duplicate the block and
336
+ * replacing would eat the wrong span of somebody's file.
337
+ */
338
+ function spliceAgentRules(existing, rendered, target = exports.DEFAULT_AGENT_RULES_TARGET) {
339
+ const preamble = agentRulesPreamble(target);
340
+ if (existing === null || existing.trim() === '') {
341
+ const body = preamble ? `${preamble}\n\n${rendered}` : rendered;
342
+ return { content: `${body}\n`, action: 'created' };
343
+ }
344
+ const start = existing.indexOf(exports.AGENT_RULES_START);
345
+ const end = existing.indexOf(exports.AGENT_RULES_END);
346
+ if (start === -1 && end === -1) {
347
+ // A file that needs a preamble but has none gets one, because Cursor reads
348
+ // only the frontmatter at the very top. A file that already has one keeps it.
349
+ const needsPreamble = preamble !== '' && !existing.trimStart().startsWith('---');
350
+ const head = needsPreamble ? `${preamble}\n\n${existing}` : existing;
351
+ const separator = head.endsWith('\n') ? '\n' : '\n\n';
352
+ return { content: `${head}${separator}${rendered}\n`, action: 'appended' };
353
+ }
354
+ if (start === -1 || end === -1) {
355
+ return {
356
+ content: existing,
357
+ action: 'unchanged',
358
+ error: `the file has ${start === -1 ? 'an end' : 'a start'} marker without its pair, so Iris Code cannot tell which lines it owns. Restore the missing marker or delete the block, then run again.`,
359
+ };
360
+ }
361
+ if (end < start) {
362
+ return {
363
+ content: existing,
364
+ action: 'unchanged',
365
+ error: 'the Iris Code markers are in the wrong order, so the block cannot be replaced safely. Fix or remove them, then run again.',
366
+ };
367
+ }
368
+ if (existing.indexOf(exports.AGENT_RULES_START, start + 1) !== -1) {
369
+ return {
370
+ content: existing,
371
+ action: 'unchanged',
372
+ error: 'the file contains more than one Iris Code block. Remove the extra one, then run again.',
373
+ };
374
+ }
375
+ const before = existing.slice(0, start);
376
+ const after = existing.slice(end + exports.AGENT_RULES_END.length);
377
+ const content = `${before}${rendered}${after}`;
378
+ return { content, action: content === existing ? 'unchanged' : 'replaced' };
379
+ }
380
+ //# sourceMappingURL=rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.js","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":";;;AAoDA,gDAEC;AA6QD,0CA+BC;AAWD,gDAEC;AAWD,sDAEC;AAkBD,4CAiDC;AA9bD,qCAA8C;AAC9C,2CAAiE;AAEjE;;;;;;;;;;;;;;;;;;GAkBG;AAEU,QAAA,iBAAiB,GAAG,mCAAmC,CAAA;AACvD,QAAA,eAAe,GAAG,iCAAiC,CAAA;AAanD,QAAA,mBAAmB,GAAmD;IACjF,MAAM,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,yBAAyB,EAAE,MAAM,EAAE,UAAU,EAAE;IACjG,MAAM,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,yBAAyB,EAAE,MAAM,EAAE,UAAU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IAC5E,CAAC;IACD,IAAI,KAAK,KAAK,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;QAC/B,OAAO;YACL,OAAO,EAAE,QAAQ;YACjB,MAAM,EAAE,WAAW;YACnB,KAAK,EAAE,gBAAgB,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,yIAAyI;SACpM,CAAA;IACH,CAAC;IACD,IAAI,GAAG,GAAG,KAAK,EAAE,CAAC;QAChB,OAAO;YACL,OAAO,EAAE,QAAQ;YACjB,MAAM,EAAE,WAAW;YACnB,KAAK,EAAE,2HAA2H;SACnI,CAAA;IACH,CAAC;IACD,IAAI,QAAQ,CAAC,OAAO,CAAC,yBAAiB,EAAE,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QAC1D,OAAO;YACL,OAAO,EAAE,QAAQ;YACjB,MAAM,EAAE,WAAW;YACnB,KAAK,EAAE,wFAAwF;SAChG,CAAA;IACH,CAAC;IAED,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;IACvC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,GAAG,uBAAe,CAAC,MAAM,CAAC,CAAA;IAC1D,MAAM,OAAO,GAAG,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,EAAE,CAAA;IAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,EAAE,CAAA;AAC7E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iris-code/core",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Shared Iris analysis engine for TypeScript, JavaScript, Vue, Svelte, Go, Python, Ruby, and C#.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,7 +29,7 @@
29
29
  "scripts": {
30
30
  "build": "node -e \"const fs=require('node:fs');fs.rmSync('dist',{recursive:true,force:true});fs.rmSync('tsconfig.tsbuildinfo',{force:true})\" && tsc -p tsconfig.json && node scripts/check-dist-orphans.mjs",
31
31
  "typecheck": "tsc -p tsconfig.json --pretty false",
32
- "test": "pnpm run build && node --test test/core.test.mjs test/gate.test.mjs test/v116.test.mjs test/bench.test.mjs test/lexers.test.mjs test/javaRust.test.mjs test/findings.test.mjs",
32
+ "test": "pnpm run build && node --test test/core.test.mjs test/gate.test.mjs test/v116.test.mjs test/bench.test.mjs test/lexers.test.mjs test/javaRust.test.mjs test/findings.test.mjs test/rules.test.mjs",
33
33
  "bench": "pnpm run build && node bench/run.mjs",
34
34
  "bench:baseline": "pnpm run build && node bench/run.mjs --baseline",
35
35
  "bench:report": "pnpm run build && node bench/run.mjs --report",