@rigstate/rules-engine 0.6.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/README.md +38 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +347 -0
- package/dist/sections/current-step.d.ts +2 -0
- package/dist/sections/current-step.js +52 -0
- package/dist/sections/identity.d.ts +2 -0
- package/dist/sections/identity.js +48 -0
- package/dist/sections/skills.d.ts +13 -0
- package/dist/sections/skills.js +130 -0
- package/dist/sections/stack-dna.d.ts +2 -0
- package/dist/sections/stack-dna.js +89 -0
- package/dist/sections/tooling.d.ts +2 -0
- package/dist/sections/tooling.js +67 -0
- package/dist/sections/workflow.d.ts +2 -0
- package/dist/sections/workflow.js +281 -0
- package/dist/types.d.ts +114 -0
- package/dist/types.js +15 -0
- package/dist/utils/mdc.d.ts +8 -0
- package/dist/utils/mdc.js +23 -0
- package/package.json +16 -0
- package/src/index.ts +416 -0
- package/src/sections/current-step.ts +62 -0
- package/src/sections/identity.ts +58 -0
- package/src/sections/skills.ts +130 -0
- package/src/sections/stack-dna.ts +100 -0
- package/src/sections/tooling.ts +72 -0
- package/src/sections/workflow.ts +281 -0
- package/src/skills/rigstate-integrity-gate/content.md +34 -0
- package/src/types.ts +122 -0
- package/src/utils/mdc.ts +33 -0
- package/tsconfig.json +19 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported IDE providers for rules file generation.
|
|
3
|
+
* - cursor: .cursorrules + .cursor/rules/*.mdc
|
|
4
|
+
* - antigravity: .cursorrules + .cursor/rules/*.mdc (Cursor-compatible)
|
|
5
|
+
* - windsurf: .windsurfrules
|
|
6
|
+
* - vscode: .cursorrules + .cursor/rules/*.mdc
|
|
7
|
+
* - copilot: .github/copilot-instructions.md
|
|
8
|
+
* - generic: CONVENTIONS.md (universal markdown format)
|
|
9
|
+
*/
|
|
10
|
+
export type IDEProvider = 'cursor' | 'antigravity' | 'windsurf' | 'vscode' | 'copilot' | 'generic';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Mapping of IDE providers to their respective rules file names.
|
|
14
|
+
* Centralized here to ensure consistency across all consumers.
|
|
15
|
+
*/
|
|
16
|
+
export const IDE_FILE_NAMES: Record<IDEProvider, string> = {
|
|
17
|
+
cursor: '.cursorrules',
|
|
18
|
+
antigravity: '.cursorrules',
|
|
19
|
+
windsurf: '.windsurfrules',
|
|
20
|
+
vscode: '.cursorrules',
|
|
21
|
+
copilot: '.github/copilot-instructions.md',
|
|
22
|
+
generic: 'CONVENTIONS.md'
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Dynamic Project Settings for variable injection
|
|
26
|
+
export interface ProjectSettings {
|
|
27
|
+
lmax: number; // Default: 400
|
|
28
|
+
lmax_ui: number; // Default: 250
|
|
29
|
+
security_level: string; // STANDARD, STRICT, MINIMAL
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface RuleFile {
|
|
33
|
+
path: string; // E.g. ".cursor/rules/guardian.mdc" or "AGENTS.md"
|
|
34
|
+
content: string; // Raw content (with frontmatter if .mdc)
|
|
35
|
+
metadata?: {
|
|
36
|
+
description?: string;
|
|
37
|
+
globs?: string[];
|
|
38
|
+
alwaysApply?: boolean;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface MultiFileRuleResult {
|
|
43
|
+
files: RuleFile[];
|
|
44
|
+
suggestedIde: IDEProvider;
|
|
45
|
+
version: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface RuleGenerationContext {
|
|
49
|
+
project: {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
description?: string;
|
|
53
|
+
functional_spec?: {
|
|
54
|
+
projectDescription?: string;
|
|
55
|
+
coreProblem?: string;
|
|
56
|
+
targetAudience?: string;
|
|
57
|
+
featureList?: Array<{ name: string; description: string; priority: string }>;
|
|
58
|
+
keyInsights?: string[];
|
|
59
|
+
};
|
|
60
|
+
ambition_level?: string;
|
|
61
|
+
tenancy?: 'SINGLE' | 'MULTI_ORG';
|
|
62
|
+
monetization?: 'FREE' | 'SAAS';
|
|
63
|
+
compliance?: 'NONE' | 'GDPR' | 'HIPAA';
|
|
64
|
+
vibe?: 'CORPORATE' | 'CREATIVE' | 'BRUTALIST';
|
|
65
|
+
settings?: ProjectSettings;
|
|
66
|
+
};
|
|
67
|
+
stack: string[];
|
|
68
|
+
roadmap: Array<{
|
|
69
|
+
step_number: number;
|
|
70
|
+
title: string;
|
|
71
|
+
status: string;
|
|
72
|
+
sprint_focus?: string;
|
|
73
|
+
prompt_content?: string;
|
|
74
|
+
is_legacy?: boolean;
|
|
75
|
+
}>;
|
|
76
|
+
ide: IDEProvider;
|
|
77
|
+
legacyStats?: {
|
|
78
|
+
total: number;
|
|
79
|
+
legacyCount: number;
|
|
80
|
+
activeCount: number;
|
|
81
|
+
};
|
|
82
|
+
activeAgents?: Array<{
|
|
83
|
+
id: string;
|
|
84
|
+
key: string;
|
|
85
|
+
name: string;
|
|
86
|
+
job_title?: string;
|
|
87
|
+
content: string;
|
|
88
|
+
authority_level: number;
|
|
89
|
+
primary_mission?: string;
|
|
90
|
+
trigger_keywords?: string;
|
|
91
|
+
}>;
|
|
92
|
+
databaseMetadata?: TableMetadata[];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface TableMetadata {
|
|
96
|
+
table_name: string;
|
|
97
|
+
rls_enabled: boolean;
|
|
98
|
+
policy_count: number;
|
|
99
|
+
column_count: number;
|
|
100
|
+
has_id: boolean;
|
|
101
|
+
has_created_at: boolean;
|
|
102
|
+
has_updated_at: boolean;
|
|
103
|
+
has_user_id: boolean;
|
|
104
|
+
indexed_columns: string[];
|
|
105
|
+
foreign_keys: { column: string, target_table: string }[];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface AgentSkill {
|
|
109
|
+
name: string;
|
|
110
|
+
description: string;
|
|
111
|
+
specialist: string;
|
|
112
|
+
version: string;
|
|
113
|
+
governance: 'OPEN' | 'SOFT_LOCK' | 'HARD_LOCK';
|
|
114
|
+
content: string; // Markdown body
|
|
115
|
+
activation?: {
|
|
116
|
+
imports?: string[];
|
|
117
|
+
content?: string[];
|
|
118
|
+
files?: string[];
|
|
119
|
+
violation_id?: string;
|
|
120
|
+
metric_threshold?: number;
|
|
121
|
+
};
|
|
122
|
+
}
|
package/src/utils/mdc.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* Utility to wrap markdown content with MDC (Modern Cursor) frontmatter.
|
|
4
|
+
*/
|
|
5
|
+
export function wrapMdc(
|
|
6
|
+
content: string,
|
|
7
|
+
metadata: {
|
|
8
|
+
description?: string;
|
|
9
|
+
globs?: string[];
|
|
10
|
+
alwaysApply?: boolean;
|
|
11
|
+
}
|
|
12
|
+
): string {
|
|
13
|
+
const yaml: string[] = ['---'];
|
|
14
|
+
|
|
15
|
+
if (metadata.description) {
|
|
16
|
+
yaml.push(`description: "${metadata.description.replace(/"/g, '\\"')}"`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (metadata.globs && metadata.globs.length > 0) {
|
|
20
|
+
yaml.push('globs:');
|
|
21
|
+
for (const glob of metadata.globs) {
|
|
22
|
+
yaml.push(` - "${glob}"`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (metadata.alwaysApply !== undefined) {
|
|
27
|
+
yaml.push(`alwaysApply: ${metadata.alwaysApply}`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
yaml.push('---');
|
|
31
|
+
|
|
32
|
+
return `${yaml.join('\n')}\n${content}`;
|
|
33
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"rootDir": "./src",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true
|
|
12
|
+
},
|
|
13
|
+
"include": [
|
|
14
|
+
"src/**/*"
|
|
15
|
+
],
|
|
16
|
+
"exclude": [
|
|
17
|
+
"node_modules"
|
|
18
|
+
]
|
|
19
|
+
}
|