@rigstate/mcp 0.4.2 → 0.4.4
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/.agent/skills/client-side-notification-logger/SKILL.md +139 -0
- package/.agent/skills/react-state-counter/SKILL.md +73 -0
- package/.agent/skills/rigstate-evolutionary-refactor/SKILL.md +40 -0
- package/.agent/skills/rigstate-integrity-gate/SKILL.md +55 -0
- package/.agent/skills/rigstate-legacy-renovator/SKILL.md +12 -0
- package/.agent/skills/sec-auth-04/SKILL.md +22 -0
- package/.agent/skills/sec-key-01/SKILL.md +21 -0
- package/.agent/skills/sec-rls-01/SKILL.md +22 -0
- package/.agent/skills/sec-sql-01/SKILL.md +23 -0
- package/.agent/skills/sec-ui-01/SKILL.md +21 -0
- package/.cursor/rules/rigstate-database.mdc +89 -0
- package/.cursor/rules/rigstate-guardian.mdc +43 -0
- package/.cursor/rules/rigstate-identity.mdc +45 -0
- package/.cursor/rules/rigstate-roadmap.mdc +9 -0
- package/.cursor/rules/rigstate-workflow.mdc +323 -0
- package/.cursorrules +402 -0
- package/AGENTS.md +34 -0
- package/dist/index.js +2604 -3067
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/roadmap.json +815 -21
- package/src/index.ts +16 -1765
- package/src/lib/context-engine.ts +85 -0
- package/src/lib/curator/actions/fortress.ts +77 -0
- package/src/lib/curator/actions/query.ts +73 -0
- package/src/lib/curator/actions/stats.ts +70 -0
- package/src/lib/curator/actions/submit.ts +190 -0
- package/src/lib/curator/index.ts +10 -0
- package/src/lib/curator/schemas.ts +37 -0
- package/src/lib/schemas.ts +191 -0
- package/src/lib/types.ts +102 -261
- package/src/server/core.ts +40 -0
- package/src/server/factory.ts +78 -0
- package/src/server/telemetry.ts +122 -0
- package/src/server/types.ts +21 -0
- package/src/tools/analyze-database-performance.ts +157 -0
- package/src/tools/arch-tools.ts +16 -0
- package/src/tools/audit-integrity-gate.ts +166 -0
- package/src/tools/check-rules-sync.ts +20 -0
- package/src/tools/complete-roadmap-task.ts +88 -31
- package/src/tools/curator-tools.ts +74 -0
- package/src/tools/get-latest-decisions.ts +23 -1
- package/src/tools/get-next-roadmap-step.ts +21 -0
- package/src/tools/get-project-context.ts +35 -1
- package/src/tools/index.ts +7 -0
- package/src/tools/list-features.ts +4 -1
- package/src/tools/list-roadmap-tasks.ts +21 -0
- package/src/tools/planning-tools.ts +40 -0
- package/src/tools/query-brain.ts +25 -1
- package/src/tools/run-architecture-audit.ts +23 -0
- package/src/tools/save-decision.ts +26 -0
- package/src/tools/security-checks.ts +241 -0
- package/src/tools/security-tools.ts +88 -18
- package/src/tools/submit-idea.ts +25 -0
- package/src/tools/sync-ide-rules.ts +35 -3
- package/src/tools/teacher-mode.ts +92 -13
- package/src/tools/update-roadmap.ts +24 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: client-side-notification-logger
|
|
3
|
+
description: Provides a client-side logging utility that combines toast notifications with console logging for enhanced observability.
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
specialist: Sven
|
|
6
|
+
governance: OPEN
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Client-Side Notification Logger
|
|
10
|
+
|
|
11
|
+
This skill provides a reusable client-side logging utility that combines user-friendly toast notifications with detailed console logging. This approach enhances observability by providing immediate feedback to the user through toasts while retaining detailed logs for debugging.
|
|
12
|
+
|
|
13
|
+
## How to Implement
|
|
14
|
+
|
|
15
|
+
1. **Install a Toast Notification Library:**
|
|
16
|
+
|
|
17
|
+
Install a library like `sonner` for displaying toast notifications.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install sonner
|
|
21
|
+
# or
|
|
22
|
+
yarn add sonner
|
|
23
|
+
# or
|
|
24
|
+
pnpm add sonner
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
2. **Create the Logging Utility:**
|
|
28
|
+
|
|
29
|
+
Create a client component (e.g., `use-notification-logger.tsx`) that exports a `useNotificationLogger` hook. This hook should:
|
|
30
|
+
|
|
31
|
+
* Accept an optional `logLevel` parameter (e.g., 'info', 'warn', 'error', 'debug') and a `toastOptions` object for configuring the toast.
|
|
32
|
+
* Return a `log` function that accepts a message string as input.
|
|
33
|
+
* The `log` function should:
|
|
34
|
+
* Display the message as a toast notification using the chosen library (e.g., `sonner`), configurable via `toastOptions`.
|
|
35
|
+
* Log the message to the console using `console.log`, but only if the `logLevel` is appropriate (e.g., only log 'error' messages if `logLevel` is 'error' or more permissive).
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
'use client';
|
|
39
|
+
|
|
40
|
+
import { toast, ToastOptions } from 'sonner';
|
|
41
|
+
import { useCallback } from 'react';
|
|
42
|
+
|
|
43
|
+
type LogLevel = 'info' | 'warn' | 'error' | 'debug';
|
|
44
|
+
|
|
45
|
+
interface UseNotificationLoggerProps {
|
|
46
|
+
logLevel?: LogLevel;
|
|
47
|
+
toastOptions?: ToastOptions;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function useNotificationLogger({ logLevel = 'info', toastOptions }: UseNotificationLoggerProps = {}) {
|
|
51
|
+
const log = useCallback((message: string, level: LogLevel = 'info') => {
|
|
52
|
+
if (shouldLog(level, logLevel)) {
|
|
53
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
54
|
+
console.log(`[${level.toUpperCase()}]: ${message}`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (level === 'error') {
|
|
58
|
+
toast.error(message, toastOptions);
|
|
59
|
+
} else if (level === 'warn') {
|
|
60
|
+
toast.warning(message, toastOptions);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
toast(message, toastOptions);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}, [logLevel, toastOptions]);
|
|
67
|
+
|
|
68
|
+
return { log };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function shouldLog(messageLevel: LogLevel, configuredLevel: LogLevel): boolean {
|
|
72
|
+
const levels: { [key: string]: number } = {
|
|
73
|
+
'debug': 0,
|
|
74
|
+
'info': 1,
|
|
75
|
+
'warn': 2,
|
|
76
|
+
'error': 3,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
return levels[messageLevel] >= levels[configuredLevel];
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
3. **Usage:**
|
|
84
|
+
|
|
85
|
+
Import and use the `useNotificationLogger` hook in your client-side components.
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
'use client';
|
|
89
|
+
|
|
90
|
+
import { useNotificationLogger } from './use-notification-logger';
|
|
91
|
+
import { useState } from 'react';
|
|
92
|
+
|
|
93
|
+
function MyComponent() {
|
|
94
|
+
const { log } = useNotificationLogger({ logLevel: process.env.NEXT_PUBLIC_LOG_LEVEL as any || 'info', toastOptions: { duration: 5000 } });
|
|
95
|
+
const [count, setCount] = useState(0);
|
|
96
|
+
|
|
97
|
+
const handleClick = () => {
|
|
98
|
+
log(`Button clicked! Count: ${count}`, 'info');
|
|
99
|
+
setCount(count + 1);
|
|
100
|
+
// Perform other actions
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const handleWarning = () => {
|
|
104
|
+
log('This is a warning message!', 'warn');
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const handleError = () => {
|
|
108
|
+
log('This is an error message!', 'error');
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<>
|
|
113
|
+
<button onClick={handleClick}>Click Me</button>
|
|
114
|
+
<button onClick={handleWarning}>Show Warning</button>
|
|
115
|
+
<button onClick={handleError}>Show Error</button>
|
|
116
|
+
</>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Benefits
|
|
122
|
+
|
|
123
|
+
* **Improved User Experience:** Provides immediate feedback to the user through toast notifications.
|
|
124
|
+
* **Enhanced Observability:** Combines toast notifications with console logging for detailed debugging information.
|
|
125
|
+
* **Reusability:** Can be easily integrated into any client-side component.
|
|
126
|
+
* **Configurable Logging Levels:** Control the verbosity of logging based on environment or application settings.
|
|
127
|
+
* **Customizable Toast Notifications:** Configure the appearance and behavior of toast notifications.
|
|
128
|
+
|
|
129
|
+
## Considerations
|
|
130
|
+
|
|
131
|
+
* Choose a toast notification library that aligns with your project's design and accessibility requirements.
|
|
132
|
+
* Configure the `logLevel` based on the environment (e.g., more verbose logging in development, less verbose in production). Use environment variables for configuration.
|
|
133
|
+
* Implement error handling to gracefully handle potential issues with the toast notification library.
|
|
134
|
+
* Be mindful of logging sensitive data. Avoid logging any PII or secrets.
|
|
135
|
+
* The `NODE_ENV !== 'production'` check prevents console logs in production builds, further reducing performance impact.
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
*Provisioned by Rigstate CLI. Do not modify manually.*
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: react-state-counter
|
|
3
|
+
description: Creates a basic React component with state management for incrementing a counter.
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
specialist: Frank
|
|
6
|
+
governance: OPEN
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# React State Counter Component
|
|
10
|
+
|
|
11
|
+
This skill provides a basic React component that uses the `useState` hook to manage and increment a numerical counter.
|
|
12
|
+
|
|
13
|
+
## Implementation
|
|
14
|
+
|
|
15
|
+
1. **Import `useState`:**
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
import React, { useState } from 'react';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. **Define the Component:**
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
function Counter() {
|
|
25
|
+
// Initialize state with a default value of 0
|
|
26
|
+
const [count, setCount] = useState(0);
|
|
27
|
+
|
|
28
|
+
// Function to increment the counter
|
|
29
|
+
const increment = () => {
|
|
30
|
+
setCount(count + 1);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div>
|
|
35
|
+
<p>Count: {count}</p>
|
|
36
|
+
<button onClick={increment}>Increment</button>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default Counter;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
1. **Import the Component:**
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
import Counter from './Counter'; // Adjust path as needed
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
2. **Render the Component:**
|
|
53
|
+
|
|
54
|
+
```javascript
|
|
55
|
+
function App() {
|
|
56
|
+
return (
|
|
57
|
+
<div>
|
|
58
|
+
<Counter />
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default App;
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Explanation
|
|
67
|
+
|
|
68
|
+
* `useState(0)`: Initializes a state variable `count` to 0. `useState` returns an array containing the current state value (`count`) and a function to update it (`setCount`).
|
|
69
|
+
* `increment()`: This function is called when the button is clicked. It uses `setCount` to update the `count` state, triggering a re-render of the component.
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
*Provisioned by Rigstate CLI. Do not modify manually.*
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rigstate-evolutionary-refactor
|
|
3
|
+
description: Blueprint for Quad-Pattern decomposition. Frank dictates, Antigravity executes.
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
specialist: Frank
|
|
6
|
+
governance: SOFT_LOCK
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# 🧬 Rigstate Evolutionary Refactor
|
|
10
|
+
|
|
11
|
+
This is an authoritative architectural directive. When a file exceeds the line limit (or reaches the 80% proactive threshold), you must execute a structural decomposition using the **Quad-Pattern**.
|
|
12
|
+
|
|
13
|
+
## 🛡️ The No-Code Protocol (Frank's Sovereignty)
|
|
14
|
+
1. **Frank (Architect)** DICTATES the strategy. He identifies which code lines belong in which module.
|
|
15
|
+
2. **Antigravity (Agent)** EXECUTES the physical split. He creates the files and updates imports.
|
|
16
|
+
3. **Sentinal (Daemon)** VALIDATES the final integrity.
|
|
17
|
+
|
|
18
|
+
## 🛠️ The Quad-Pattern Blueprint
|
|
19
|
+
Decompose the monolith into these four distinct modules:
|
|
20
|
+
|
|
21
|
+
| Module | Responsibility | Rule |
|
|
22
|
+
| :--- | :--- | :--- |
|
|
23
|
+
| **`types.ts`** | Interfaces, Enums, Type definitions | Zero logic. Shared by all. |
|
|
24
|
+
| **`factory.ts`** | Initialization, Config parsing, Dependency injection | Returns a ready-to-use instance. |
|
|
25
|
+
| **`telemetry.ts`** | Logging, Metrics, Cloud feedback, Errors | Handles all observability. |
|
|
26
|
+
| **`core.ts`** | Business logic, Event orchestration | Max 200 lines. The primary entry point. |
|
|
27
|
+
|
|
28
|
+
## 🕹️ Activation Logic
|
|
29
|
+
- **Hard Trigger**: Triggered when `ARC-001` violation is detected by the Guardian.
|
|
30
|
+
- **Proactive Trigger**: Triggered when a file reaches 80% of its defined line limit.
|
|
31
|
+
|
|
32
|
+
## 📝 Execution Procedure:
|
|
33
|
+
1. **Analyze (Frank)**: Scan the target file. Identify logical boundaries.
|
|
34
|
+
2. **Design (Frank)**: Create a table mapping existing code blocks to the new modules.
|
|
35
|
+
3. **Execute (Antigravity)**: Perform `write_to_file` for each new module.
|
|
36
|
+
4. **Cleanup (Antigravity)**: Transform the original file into the new `core.ts` or replace it.
|
|
37
|
+
5. **Verify (Sentinel)**: Run `rigstate check` to confirm compliance.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
*Provisioned by Rigstate CLI. Do not modify manually.*
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rigstate-integrity-gate
|
|
3
|
+
description: Handles the Pre-Deployment Compliance Gate, automated quality audits (Security/Performance), and generation of the Strategic Release Manifest. Use this whenever you are finishing a task or moving code towards completion.
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
specialist: Frank (The Orchestrator)
|
|
6
|
+
governance: SOFT_LOCK
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
name: rigstate-integrity-gate
|
|
11
|
+
description: Handles the Pre-Deployment Compliance Gate, automated quality audits (Security/Performance), and generation of the Strategic Release Manifest. Use this whenever you are finishing a task or moving code towards completion.
|
|
12
|
+
version: "1.0.0"
|
|
13
|
+
specialist: Frank (The Orchestrator)
|
|
14
|
+
governance: SOFT_LOCK
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# 🎖️ Rigstate Integrity Gate Skill (Fortress Enabled)
|
|
18
|
+
|
|
19
|
+
This skill defines the high-level protocol for ensuring code quality and security before a task is marked as "COMPLETED". It orchestrates specialized agents (Sven, Sindre) and generates the audit trail known as the **Strategic Release Manifest**.
|
|
20
|
+
|
|
21
|
+
## 🔄 The Protocol Workflow
|
|
22
|
+
|
|
23
|
+
Whenever you are ready to complete a task, follow this mandatory 3-step sequence:
|
|
24
|
+
|
|
25
|
+
### 1. Audit (The Scan)
|
|
26
|
+
Run the `audit_integrity_gate` tool. This will trigger the **Fortress Matrix** checks:
|
|
27
|
+
- **SEC-SQL-01 (Parameterized Only):** Blocking any string-interpolated SQL.
|
|
28
|
+
- **SEC-RLS-01 (Mandatory RLS):** Validating RLS on all migration tables.
|
|
29
|
+
- **SEC-KEY-01 (Secret Scanner):** Scanning for hardcoded keys and tokens.
|
|
30
|
+
- **SEC-AUTH-04 (Identity Context):** Verifying ownership filters in API routes.
|
|
31
|
+
|
|
32
|
+
### 2. Decision (The Gate)
|
|
33
|
+
Evaluate the result from `audit_integrity_gate`:
|
|
34
|
+
- **Mode: OPEN:** All critical checks passed. You can proceed to completion.
|
|
35
|
+
- **Mode: SOFT_LOCK:** Warnings found (e.g. SEC-UI-01). Report to user.
|
|
36
|
+
- **Mode: HARD_LOCK:** Critical violations (SEC-SQL/RLS/KEY) detected. Completion is strictly blocked.
|
|
37
|
+
|
|
38
|
+
### 3. Manifest (The Release)
|
|
39
|
+
Upon passing the gate, use the `complete_roadmap_task` tool.
|
|
40
|
+
- Pass the **full JSON response** from the `audit_integrity_gate` into the `integrityGate` parameter.
|
|
41
|
+
- This automatically generates the **Strategic Release Manifest** in the Mission Report.
|
|
42
|
+
|
|
43
|
+
## 🛠️ Tools Used by this Skill
|
|
44
|
+
|
|
45
|
+
- `audit_integrity_gate`: Orchestrates the security and performance scans.
|
|
46
|
+
- `complete_roadmap_task`: Finalizes the task and attaches the quality certificate.
|
|
47
|
+
|
|
48
|
+
## 📝 Best Practices
|
|
49
|
+
|
|
50
|
+
- **Never skip the audit.** Even if you think the change is small, the Integrity Gate is our source of truth.
|
|
51
|
+
- **Explain violations clearly.** If in `SOFT_LOCK`, list the specific tables lacking RLS or the specific files with N+1 issues.
|
|
52
|
+
- **Summarize the Manifest.** After successful completion, tell the user: "Release Manifest generated with [X] security passes and [Y] performance checks."
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
*Provisioned by Rigstate CLI. Do not modify manually.*
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rigstate-legacy-renovator
|
|
3
|
+
description: Handles the modernization of legacy Vibeline code to the Rigstate standard.
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
specialist: Brynjar
|
|
6
|
+
governance: SOFT_LOCK
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# 🏺 Rigstate Legacy Renovator Skill\n\nHandles branding renovation and archaeological history restoration.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
*Provisioned by Rigstate CLI. Do not modify manually.*
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sec-auth-04
|
|
3
|
+
description: Ensures query isolation by validating user_id ownership.
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
specialist: Frank
|
|
6
|
+
governance: HARD_LOCK
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# 🛡️ SEC-AUTH-04: Identity Context (The Frank Protocol)
|
|
10
|
+
This is a HARD_LOCK isolation directive.
|
|
11
|
+
|
|
12
|
+
## 🚫 Forbidden
|
|
13
|
+
Queries that fetch user-specific data without filtering by `user_id` or `owner_id`.
|
|
14
|
+
|
|
15
|
+
## ✅ Mandated
|
|
16
|
+
Every request in an API route must verify that the user is only accessing their own data.
|
|
17
|
+
Example: `supabase.from('projects').select('*').eq('owner_id', userId)`
|
|
18
|
+
|
|
19
|
+
Frank will verify that all database calls in the API layer include an appropriate ownership filter.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
*Provisioned by Rigstate CLI. Do not modify manually.*
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sec-key-01
|
|
3
|
+
description: Scans for hardcoded secrets and API keys.
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
specialist: Frank
|
|
6
|
+
governance: HARD_LOCK
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# 🛡️ SEC-KEY-01: Secret Scanner (The Sentinel Protocol)
|
|
10
|
+
This is a FATAL integrity check.
|
|
11
|
+
|
|
12
|
+
## 🚫 Forbidden
|
|
13
|
+
Never hardcode API keys, service role keys, or JWT tokens in the codebase.
|
|
14
|
+
|
|
15
|
+
## ✅ Mandated
|
|
16
|
+
Always use environment variables (`process.env.VAR_NAME`) and keep them in `.env.local`.
|
|
17
|
+
|
|
18
|
+
Frank will scan for high-entropy strings and known key prefixes (Stripe, Google, Supabase) and block the commit if any are found outside of .env files.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
*Provisioned by Rigstate CLI. Do not modify manually.*
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sec-rls-01
|
|
3
|
+
description: Ensures Row Level Security is enabled on all new tables.
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
specialist: Sindre
|
|
6
|
+
governance: HARD_LOCK
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# 🛡️ SEC-RLS-01: Mandatory RLS (The Sindre Protocol)
|
|
10
|
+
This is a HARD_LOCK protocol for database integrity.
|
|
11
|
+
|
|
12
|
+
## 🚫 Forbidden
|
|
13
|
+
Never push a migration that creates a table without enabling RLS.
|
|
14
|
+
|
|
15
|
+
## ✅ Mandated
|
|
16
|
+
Every `CREATE TABLE` statement must be followed by:
|
|
17
|
+
`ALTER TABLE "public"."your_table" ENABLE ROW LEVEL SECURITY;`
|
|
18
|
+
|
|
19
|
+
Frank/Sentinel will scan all migration files and block the release if this clause is missing for any table.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
*Provisioned by Rigstate CLI. Do not modify manually.*
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sec-sql-01
|
|
3
|
+
description: Protects against SQL Injection by enforcing parameterized queries.
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
specialist: Sindre
|
|
6
|
+
governance: HARD_LOCK
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# 🛡️ SEC-SQL-01: Parameterized Only (The Sindre Protocol)
|
|
10
|
+
This is a HARD_LOCK architectural directive.
|
|
11
|
+
|
|
12
|
+
## 🚫 Forbidden
|
|
13
|
+
Never use string interpolation or concatenation to build SQL queries.
|
|
14
|
+
Example of violation: `client.rpc('get_data', { query: `SELECT * FROM ${table}` })`
|
|
15
|
+
|
|
16
|
+
## ✅ Mandated
|
|
17
|
+
Use prepared statements or the built-in query builder.
|
|
18
|
+
Example: `client.rpc('get_data', { table_id: 123 })`
|
|
19
|
+
|
|
20
|
+
Frank will block the commit if any dynamic string building is detected in a database context.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
*Provisioned by Rigstate CLI. Do not modify manually.*
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sec-ui-01
|
|
3
|
+
description: Prevents XSS by restricting dangerous React props.
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
specialist: Linus
|
|
6
|
+
governance: SOFT_LOCK
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# 🛡️ SEC-UI-01: XSS Defense (The Linus Protocol)
|
|
10
|
+
This is a SOFT_LOCK quality directive.
|
|
11
|
+
|
|
12
|
+
## 🚫 Forbidden
|
|
13
|
+
Do not use `dangerouslySetInnerHTML` unless absolutely necessary and documented.
|
|
14
|
+
|
|
15
|
+
## ✅ Mandated
|
|
16
|
+
Use safe rendering or sanitize the content through a trusted library like `DOMPurify` before passing it to the component.
|
|
17
|
+
|
|
18
|
+
Frank will nudge you and request a security audit if this pattern is detected.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
*Provisioned by Rigstate CLI. Do not modify manually.*
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Live database schema, RLS status, and table metadata"
|
|
3
|
+
globs:
|
|
4
|
+
- "supabase/**/*"
|
|
5
|
+
- "**/*.sql"
|
|
6
|
+
- "**/lib/supabase/**"
|
|
7
|
+
alwaysApply: true
|
|
8
|
+
---
|
|
9
|
+
## 🗄️ Database Context: 67 Tables
|
|
10
|
+
> **Security Check:** 67 Secured | 0 Unsecured
|
|
11
|
+
|
|
12
|
+
### ⚠️ Security Attention Required
|
|
13
|
+
- ✅ All tables have Row Level Security enabled.
|
|
14
|
+
|
|
15
|
+
### 📋 Schema Reference
|
|
16
|
+
| Table | RLS | Policies | Cols | Key Features |
|
|
17
|
+
| :--- | :---: | :---: | :---: | :--- |
|
|
18
|
+
| `admin_audit_logs` | ✅ | 2 | 9 | Timestamps |
|
|
19
|
+
| `agent_bridge` | ✅ | 4 | 10 | Timestamps |
|
|
20
|
+
| `ai_activity_log` | ✅ | 2 | 9 | User-Scoped, Timestamps |
|
|
21
|
+
| `ai_instructions` | ✅ | 3 | 11 | User-Scoped, Timestamps |
|
|
22
|
+
| `ai_response_cache` | ✅ | 1 | 12 | Timestamps |
|
|
23
|
+
| `api_keys` | ✅ | 6 | 11 | User-Scoped, Timestamps |
|
|
24
|
+
| `architectural_dna` | ✅ | 5 | 5 | - |
|
|
25
|
+
| `canvas_executions` | ✅ | 2 | 10 | - |
|
|
26
|
+
| `canvas_flows` | ✅ | 1 | 12 | User-Scoped, Timestamps |
|
|
27
|
+
| `canvas_recipients` | ✅ | 1 | 6 | Timestamps |
|
|
28
|
+
| `cli_state` | ✅ | 5 | 3 | - |
|
|
29
|
+
| `council_logs` | ✅ | 3 | 11 | Timestamps |
|
|
30
|
+
| `council_sessions` | ✅ | 5 | 9 | Timestamps |
|
|
31
|
+
| `daily_summaries` | ✅ | 2 | 5 | Timestamps |
|
|
32
|
+
| `feature_flags` | ✅ | 2 | 8 | Timestamps |
|
|
33
|
+
| `feedback_logs` | ✅ | 2 | 10 | User-Scoped, Timestamps |
|
|
34
|
+
| `focus_sessions` | ✅ | 1 | 10 | Timestamps |
|
|
35
|
+
| `git_events` | ✅ | 1 | 11 | Timestamps |
|
|
36
|
+
| `global_architecture_rules` | ✅ | 2 | 9 | Timestamps |
|
|
37
|
+
| `global_base_instructions` | ✅ | 2 | 9 | User-Scoped, Timestamps |
|
|
38
|
+
| `global_intelligence_logs` | ✅ | 1 | 11 | Timestamps |
|
|
39
|
+
| `guardian_violations` | ✅ | 4 | 15 | Timestamps |
|
|
40
|
+
| `idea_feedback` | ✅ | 3 | 5 | Timestamps |
|
|
41
|
+
| `intelligence_trends` | ✅ | 1 | 5 | - |
|
|
42
|
+
| `lab_messages` | ✅ | 2 | 7 | Timestamps |
|
|
43
|
+
| `lab_sessions` | ✅ | 6 | 8 | Timestamps |
|
|
44
|
+
| `marketplace_purchases` | ✅ | 6 | 5 | - |
|
|
45
|
+
| `memory_feedback` | ✅ | 3 | 6 | Timestamps |
|
|
46
|
+
| `mission_reports` | ✅ | 1 | 9 | Timestamps |
|
|
47
|
+
| `oauth_connections` | ✅ | 4 | 10 | User-Scoped, Timestamps |
|
|
48
|
+
| `organization_members` | ✅ | 4 | 8 | User-Scoped, Timestamps |
|
|
49
|
+
| `organization_subscriptions` | ✅ | 3 | 13 | Timestamps |
|
|
50
|
+
| `organization_usage` | ✅ | 2 | 13 | Timestamps |
|
|
51
|
+
| `organizations` | ✅ | 4 | 10 | User-Scoped, Timestamps |
|
|
52
|
+
| `platform_analytics` | ✅ | 1 | 10 | - |
|
|
53
|
+
| `profiles` | ✅ | 6 | 11 | - |
|
|
54
|
+
| `project_architecture_rules` | ✅ | 1 | 7 | Timestamps |
|
|
55
|
+
| `project_blueprints` | ✅ | 3 | 8 | Timestamps |
|
|
56
|
+
| `project_docs` | ✅ | 5 | 8 | Timestamps |
|
|
57
|
+
| `project_features` | ✅ | 5 | 25 | User-Scoped, Timestamps |
|
|
58
|
+
| `project_memories` | ✅ | 1 | 17 | Timestamps |
|
|
59
|
+
| `project_secrets` | ✅ | 4 | 9 | Timestamps |
|
|
60
|
+
| `projects` | ✅ | 5 | 39 | User-Scoped, Timestamps |
|
|
61
|
+
| `prompt_versions` | ✅ | 5 | 6 | Timestamps |
|
|
62
|
+
| `provider_configs` | ✅ | 4 | 7 | - |
|
|
63
|
+
| `pulse_blueprints` | ✅ | 1 | 11 | Timestamps |
|
|
64
|
+
| `pulse_flows` | ✅ | 6 | 8 | Timestamps |
|
|
65
|
+
| `pulse_history` | ✅ | 1 | 5 | - |
|
|
66
|
+
| `qa_defects` | ✅ | 1 | 8 | Timestamps |
|
|
67
|
+
| `qa_test_runs` | ✅ | 1 | 7 | Timestamps |
|
|
68
|
+
| `qa_test_steps` | ✅ | 1 | 7 | Timestamps |
|
|
69
|
+
| `roadmap_audit_logs` | ✅ | 1 | 8 | Timestamps |
|
|
70
|
+
| `roadmap_chunks` | ✅ | 8 | 38 | Timestamps |
|
|
71
|
+
| `saved_ideas` | ✅ | 3 | 19 | Timestamps |
|
|
72
|
+
| `security_policies` | ✅ | 2 | 15 | User-Scoped, Timestamps |
|
|
73
|
+
| `skills` | ✅ | 4 | 16 | User-Scoped, Timestamps |
|
|
74
|
+
| `system_insights` | ✅ | 2 | 11 | Timestamps |
|
|
75
|
+
| `system_prompt_versions` | ✅ | 1 | 6 | User-Scoped, Timestamps |
|
|
76
|
+
| `system_prompts` | ✅ | 4 | 24 | User-Scoped, Timestamps |
|
|
77
|
+
| `system_settings` | ✅ | 2 | 5 | - |
|
|
78
|
+
| `user_credits` | ✅ | 1 | 3 | User-Scoped |
|
|
79
|
+
| `user_integrations` | ✅ | 3 | 13 | User-Scoped, Timestamps |
|
|
80
|
+
| `user_memories` | ✅ | 3 | 5 | User-Scoped, Timestamps |
|
|
81
|
+
| `user_metadata` | ✅ | 2 | 6 | Timestamps |
|
|
82
|
+
| `user_preferences` | ✅ | 4 | 8 | User-Scoped, Timestamps |
|
|
83
|
+
| `vault_credentials` | ✅ | 1 | 12 | Timestamps |
|
|
84
|
+
| `vision_log` | ✅ | 2 | 7 | User-Scoped, Timestamps |
|
|
85
|
+
|
|
86
|
+
### 🛡️ Development Rules
|
|
87
|
+
1. **RLS is MANDATORY:** All tables containing user data must have RLS enabled.
|
|
88
|
+
2. **Use RPCs for Complex Logic:** Do not put complex business logic in client-side queries.
|
|
89
|
+
3. **Migrations:** Always use `supabase/migrations` for schema changes.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Governance rules, tech stack constraints, and file size limits"
|
|
3
|
+
globs:
|
|
4
|
+
- "**/*.ts"
|
|
5
|
+
- "**/*.tsx"
|
|
6
|
+
- "**/*.js"
|
|
7
|
+
- "**/*.jsx"
|
|
8
|
+
- "**/*.sql"
|
|
9
|
+
alwaysApply: true
|
|
10
|
+
---
|
|
11
|
+
## 🧬 STACK DNA
|
|
12
|
+
|
|
13
|
+
### Tech Stack
|
|
14
|
+
- Next.js
|
|
15
|
+
- TypeScript
|
|
16
|
+
- Supabase
|
|
17
|
+
- Tailwind CSS
|
|
18
|
+
|
|
19
|
+
### Project Configuration
|
|
20
|
+
| Attribute | Value |
|
|
21
|
+
|-----------|-------|
|
|
22
|
+
| Tenancy | SINGLE |
|
|
23
|
+
| Monetization | FREE |
|
|
24
|
+
| Compliance | NONE |
|
|
25
|
+
| Design Vibe | CORPORATE |
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### 🛡️ GUARDIAN RULES (Mandatory)
|
|
29
|
+
🛡️ **THE 400-LINE RULE (STRICT):** No file may exceed 400 lines. If approaching this limit, you MUST propose a refactor into smaller modules.
|
|
30
|
+
🛡️ **TSX LIMIT:** React components (.tsx) should not exceed 250 lines. Extract sub-components proactively.
|
|
31
|
+
🛡️ **TYPE SAFETY:** Avoid "any". Use strict TypeScript types. Infer from Zod schemas when possible.
|
|
32
|
+
👤 All queries are user-scoped (filter by user_id or RLS)
|
|
33
|
+
⚡ Enable RLS on ALL new tables immediately
|
|
34
|
+
⚡ Use @supabase/ssr patterns for server-side auth
|
|
35
|
+
🚨 **IMPACT_GUARD:** Before deleting ANY file, you MUST:
|
|
36
|
+
1. Search codebase for all imports/references (use grep_search or equivalent)
|
|
37
|
+
2. Update or remove ALL references first
|
|
38
|
+
3. Only delete after confirming ZERO references remain
|
|
39
|
+
4. Commit changes atomically (references + deletion in same commit)
|
|
40
|
+
✅ **BUILD_INTEGRITY:** After ANY structural change (new files, moved modules, refactors):
|
|
41
|
+
1. Run type-check (e.g., `tsc --noEmit` or framework equivalent)
|
|
42
|
+
2. Verify build success before declaring task complete
|
|
43
|
+
3. If errors detected, fix immediately—do NOT leave broken builds
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Project context and specialist personas"
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
## 🧠 PROJECT CONTEXT
|
|
6
|
+
|
|
7
|
+
**Project:** Rigstate Core
|
|
8
|
+
**ID:** `bb9f8445-39fd-438c-8ab6-8057f5514395`
|
|
9
|
+
**Mission:** Build a MVP application.
|
|
10
|
+
- **Target Users:** Lead Systems Architects, DevOps Compliance Engineers, and Platform Administrators responsible for hardening enterprise-grade infrastructure against architectural drift, security vulnerabilities, and unoptimized performance bottlenecks.
|
|
11
|
+
- **Problem Being Solved:** The platform is facing critical architectural entropy and security exposure due to rapid scaling without enforced governance. High-value systems suffer from monolithic code bloat (violating L_max standards), unprotected public APIs, and a lack of granular observability (audit logs, error boundaries). This technical debt threatens system stability, compliance certification, and the ability to safely iterate on complex AI-driven features.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 🤖 SPECIALIST PERSONAS
|
|
16
|
+
|
|
17
|
+
The following personas represent areas of expertise. Reference their guidelines when working in their domain.
|
|
18
|
+
|
|
19
|
+
- **Frank** (`orchestrator-lead`, Lvl 10): Orchestrate council meetings and synthesize feedback.
|
|
20
|
+
- **Einar** (`lead-architect`, Lvl 9): Enforce high-level structural integrity and dependency-first planning.
|
|
21
|
+
- **Hilde** (`compliance-guard`, Lvl 9): Ensure legal and regulatory safety (GDPR, etc.).
|
|
22
|
+
- **Sven** (`security-ops`, Lvl 9): Validate code against security standards and RLS policies
|
|
23
|
+
- **Sindre** (`scalability-expert`, Lvl 7): Design for massive scale and performance.
|
|
24
|
+
- **Gunhild** (`agent-gunhild`, Lvl 7): Turn technical changes into human-readable documentation
|
|
25
|
+
- **Astrid** (`research-specialist`, Lvl 6): Find the best libraries and architectural approaches.
|
|
26
|
+
- **Maja** (`memory-manager`, Lvl 6): Persistent context and memory management.
|
|
27
|
+
- **Kine** (`product-owner`, Lvl 5): Maximize user value and prevent scope creep.
|
|
28
|
+
- **Linus** (`ux-designer`, Lvl 4): Create delightful and accessible user experiences.
|
|
29
|
+
- **Rigstate Worker** (`rigstate-worker`, Lvl 3): To execute technical plans with surgical precision using native IDE tools while adhering to Rigstate security protocols.
|
|
30
|
+
- **Norun** (`agent-secretary`, Lvl 1): Summarizes Focus Groups and extracting Memories
|
|
31
|
+
|
|
32
|
+
### How to Use Specialists
|
|
33
|
+
1. **Architecture & Governance** → Follow Frank's guidelines for code structure and security.
|
|
34
|
+
2. **Documentation & Reports** → Use The Scribe's patterns for markdown and PDFs.
|
|
35
|
+
3. **Historical Context** → Consult The Librarian for legacy feature discovery.
|
|
36
|
+
|
|
37
|
+
> **Note:** These are informational contexts, not active agents. You (the IDE agent) execute all code.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 🎯 CODING PRINCIPLES
|
|
42
|
+
- **CONCISE:** No filler words. Get to the point.
|
|
43
|
+
- **PRECISE:** Give specific answers with file paths and code.
|
|
44
|
+
- **PRACTICAL:** Focus on what ships, not theory.
|
|
45
|
+
- **GUARDIAN-AWARE:** Respect architectural constraints in the Guardian rules.
|