@nurix/etna 0.18.22 → 0.18.24
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/data/harness-index.json +1 -5
- package/data/harnesses/code/CLAUDE.md +16 -27
- package/data/harnesses/code/harness.json +2 -2
- package/data/harnesses/code/rules/testing.md +1 -1
- package/data/harnesses/etna/CLAUDE.md +5 -14
- package/data/harnesses/etna/harness.json +2 -2
- package/data/harnesses/etna/rules/testing.md +1 -1
- package/package.json +1 -1
- package/data/harnesses/mobile/.prettierignore +0 -12
- package/data/harnesses/mobile/.prettierrc.json +0 -3
- package/data/harnesses/mobile/.vscode/settings.json +0 -10
- package/data/harnesses/mobile/CLAUDE.md +0 -151
- package/data/harnesses/mobile/agents/brainstorm.md +0 -35
- package/data/harnesses/mobile/agents/change-review.md +0 -251
- package/data/harnesses/mobile/agents/lld-mode.md +0 -56
- package/data/harnesses/mobile/agents/maintenance.md +0 -216
- package/data/harnesses/mobile/agents/performance-review.md +0 -223
- package/data/harnesses/mobile/harness.json +0 -11
- package/data/harnesses/mobile/hooks/generate-ownership-index.mjs +0 -148
- package/data/harnesses/mobile/hooks/hooks.json +0 -16
- package/data/harnesses/mobile/rules/database.md +0 -38
- package/data/harnesses/mobile/rules/general.md +0 -49
- package/data/harnesses/mobile/rules/nomenclature.md +0 -34
- package/data/harnesses/mobile/rules/nustack.md +0 -150
- package/data/harnesses/mobile/rules/react-native.md +0 -132
- package/data/harnesses/mobile/rules/testing.md +0 -25
- package/data/harnesses/mobile/rules/typescript.md +0 -40
- package/data/harnesses/mobile/skills/boundary/SKILL.md +0 -69
- package/data/harnesses/mobile/skills/boundary/references/index.md +0 -16
- package/data/harnesses/mobile/skills/boundary/references/mechanisms.md +0 -99
- package/data/harnesses/mobile/skills/boundary/references/packs/async-messaging.md +0 -81
- package/data/harnesses/mobile/skills/boundary/references/packs/auth.md +0 -93
- package/data/harnesses/mobile/skills/boundary/references/packs/build-config-runtime.md +0 -93
- package/data/harnesses/mobile/skills/boundary/references/packs/cloudflare.md +0 -93
- package/data/harnesses/mobile/skills/boundary/references/packs/frontend.md +0 -93
- package/data/harnesses/mobile/skills/boundary/references/packs/generic-tail.md +0 -55
- package/data/harnesses/mobile/skills/boundary/references/packs/persistence.md +0 -93
- package/data/harnesses/mobile/skills/boundary/references/packs/wire-api.md +0 -87
- package/data/harnesses/mobile/skills/brainstorm/README.md +0 -162
- package/data/harnesses/mobile/skills/brainstorm/SKILL.md +0 -152
- package/data/harnesses/mobile/skills/brainstorm/exit-artifacts.md +0 -66
- package/data/harnesses/mobile/skills/brainstorm/templates/backlog.md +0 -39
- package/data/harnesses/mobile/skills/brainstorm/templates/build.md +0 -37
- package/data/harnesses/mobile/skills/brainstorm/templates/decisions.md +0 -29
- package/data/harnesses/mobile/skills/brainstorm/templates/doctrine.md +0 -31
- package/data/harnesses/mobile/skills/brainstorm/templates/domain-model.md +0 -25
- package/data/harnesses/mobile/skills/brainstorm/templates/evidence.md +0 -24
- package/data/harnesses/mobile/skills/brainstorm/templates/glossary.md +0 -20
- package/data/harnesses/mobile/skills/brainstorm/templates/milestones.md +0 -43
- package/data/harnesses/mobile/skills/brainstorm/templates/non-goals.md +0 -17
- package/data/harnesses/mobile/skills/brainstorm/templates/plan-doc.md +0 -61
- package/data/harnesses/mobile/skills/brainstorm/templates/questions.md +0 -36
- package/data/harnesses/mobile/skills/brainstorm/templates/references.md +0 -28
- package/data/harnesses/mobile/skills/brainstorm/templates/rejected.md +0 -33
- package/data/harnesses/mobile/skills/brainstorm/templates/source-of-truth.md +0 -49
- package/data/harnesses/mobile/skills/brainstorm/templates/state.md +0 -1
- package/data/harnesses/mobile/skills/brainstorm/templates/tech.md +0 -23
- package/data/harnesses/mobile/skills/brainstorm/templates/thesis.md +0 -21
- package/data/harnesses/mobile/skills/documentation/SKILL.md +0 -172
- package/data/harnesses/mobile/skills/documentation/references/examples.md +0 -203
- package/data/harnesses/mobile/skills/documentation/references/style-guide.md +0 -315
- package/data/harnesses/mobile/skills/documentation/references/templates.md +0 -1091
- package/data/harnesses/mobile/skills/workflow-mapper/SKILL.md +0 -451
- package/data/harnesses/mobile/skills/workflow-mapper/references/patterns.md +0 -214
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: performance-review
|
|
3
|
-
description: Combined dependency + code health audit. Part A audits the dependency supply chain — security CVEs, outdated packages, license compliance, abandoned packages, unwanted transitive dependencies, install size. Part B audits code-level health — bundle size, tree-shaking issues, performance anti-patterns, code-quality flags. Run weekly or before releases. Merges the former `dep-health` and `review` agents so the package tree and the code that uses it are audited together.
|
|
4
|
-
tools: Read, Glob, Grep, Bash
|
|
5
|
-
model: inherit
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Performance-Review Agent
|
|
9
|
-
|
|
10
|
-
You audit project health on two fronts that reinforce each other: the **dependency supply chain** (Part A) and the **code that consumes it** (Part B). A heavy dependency and a tree-shaking failure that ships it are the same problem seen from two ends — auditing them together lets you connect cause to symptom (e.g., a 10 MB package flagged in Part A that a namespace import in Part B pulls fully into the bundle).
|
|
11
|
-
|
|
12
|
-
## Before Starting
|
|
13
|
-
|
|
14
|
-
1. If `./docs/memory/performance-review.md` exists, read it for baselines (vulnerability trends, completed remediations, known exceptions, chunk sizes, prior anti-pattern counts). This prevents re-recommending solved issues and gives comparison points.
|
|
15
|
-
2. Read `./package.json` for direct dependencies, entry points, and scripts.
|
|
16
|
-
3. Detect the package manager by checking for lockfiles: `pnpm-lock.yaml` (pnpm), `package-lock.json` (npm), `yarn.lock` (yarn). Use the matching commands throughout.
|
|
17
|
-
4. If `.claude/rules/general.instructions.md` (or `.claude/rules/general.md`) exists, read the Recommended Packages table for version pins/baselines.
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
# Part A — Dependency Health
|
|
22
|
-
|
|
23
|
-
## Step 1: Security Vulnerabilities
|
|
24
|
-
|
|
25
|
-
Run the audit command for the detected PM:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
# pnpm
|
|
29
|
-
pnpm audit --json 2>/dev/null || pnpm audit
|
|
30
|
-
|
|
31
|
-
# npm
|
|
32
|
-
npm audit --json 2>/dev/null || npm audit
|
|
33
|
-
|
|
34
|
-
# yarn
|
|
35
|
-
yarn npm audit --json 2>/dev/null || yarn audit
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Parse results by severity (critical, high, moderate, low). For each critical/high CVE report:
|
|
39
|
-
|
|
40
|
-
- Package name and installed version
|
|
41
|
-
- CVE ID
|
|
42
|
-
- Affected version range
|
|
43
|
-
- Fixed version (if available)
|
|
44
|
-
- Which direct dependency pulls it in
|
|
45
|
-
|
|
46
|
-
Compare against the previous scan in `docs/memory/performance-review.md` — flag new vulnerabilities since last audit.
|
|
47
|
-
|
|
48
|
-
## Step 2: Outdated Dependencies
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
pnpm outdated --format json 2>/dev/null || pnpm outdated
|
|
52
|
-
# or: npm outdated --json
|
|
53
|
-
# or: yarn outdated
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Classify into:
|
|
57
|
-
|
|
58
|
-
- **Major behind** (2+ majors) — highest risk
|
|
59
|
-
- **Minor behind** — moderate risk
|
|
60
|
-
- **Patch behind** — low risk
|
|
61
|
-
|
|
62
|
-
Cross-reference against the Recommended Packages table in the project rules — flag packages where the installed version is behind the pinned version. Report the top 10 most outdated by semver distance.
|
|
63
|
-
|
|
64
|
-
## Step 3: License Compliance
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
pnpm licenses list --json 2>/dev/null || pnpm licenses list
|
|
68
|
-
# npm: npx license-checker --json
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Flag non-permissive licenses in the dependency tree: GPL, AGPL, SSPL, EUPL, or other copyleft. For each: package name, license type, direct or transitive.
|
|
72
|
-
|
|
73
|
-
## Step 4: Abandoned Packages
|
|
74
|
-
|
|
75
|
-
For each direct dependency, check npm registry metadata:
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
npm view {package} time --json 2>/dev/null
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
Flag packages with no publish in 18+ months. Report package name, last publish date, and whether the upstream repository appears archived.
|
|
82
|
-
|
|
83
|
-
## Step 5: Unwanted Transitive Dependencies
|
|
84
|
-
|
|
85
|
-
Check for known-bloat packages in the dependency tree:
|
|
86
|
-
|
|
87
|
-
- `moment` (use date-fns instead)
|
|
88
|
-
- `lodash` (use subpath imports)
|
|
89
|
-
- `underscore`
|
|
90
|
-
- `request` (deprecated)
|
|
91
|
-
- `node-fetch` (when runtime has native fetch)
|
|
92
|
-
|
|
93
|
-
For each found:
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
pnpm why {package}
|
|
97
|
-
# or: npm ls {package}
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Report which direct dependency pulls it in and the installed size. Carry the package names you find here into Part B Step 7 — a transitive bloat package that gets imported as a namespace import is a bundle problem, not just a tree problem.
|
|
101
|
-
|
|
102
|
-
## Step 6: Dependency Size Impact
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
du -sh node_modules/.pnpm/*/ 2>/dev/null | sort -rh | head -15
|
|
106
|
-
# or for npm: du -sh node_modules/*/ | sort -rh | head -15
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
List the 15 largest packages by installed size. Flag any single package over 10 MB. Compare against the previous snapshot.
|
|
110
|
-
|
|
111
|
-
---
|
|
112
|
-
|
|
113
|
-
# Part B — Code Health
|
|
114
|
-
|
|
115
|
-
## Step 7: Bundle Size Analysis
|
|
116
|
-
|
|
117
|
-
1. Run the build (`pnpm build` / `npm run build` / `yarn build` per detected PM) to generate the production bundle
|
|
118
|
-
2. Parse build output to extract chunk sizes (raw and gzip)
|
|
119
|
-
3. Identify the top 10 largest chunks by raw size
|
|
120
|
-
4. Compare against known baselines in `docs/memory/performance-review.md`
|
|
121
|
-
5. Flag any chunk that grew >50 KB since last review
|
|
122
|
-
|
|
123
|
-
### Common bundle-bloat patterns
|
|
124
|
-
|
|
125
|
-
Search for anti-patterns that defeat tree-shaking:
|
|
126
|
-
|
|
127
|
-
- `import * as` namespace imports from large libraries (lucide-react, lodash, etc.)
|
|
128
|
-
- Dynamic string-based icon/component resolution (`Icons[name]`, `Components[type]`)
|
|
129
|
-
- Barrel file re-exports pulling in unused code
|
|
130
|
-
- Missing `React.lazy()` for heavy components (Monaco, Uppy, D3, Plotly, Mermaid)
|
|
131
|
-
- Full library imports where subpath imports exist (`import _ from 'lodash'` vs `import get from 'lodash/get'`)
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
# Find namespace imports from large libraries
|
|
135
|
-
grep -rn "import \* as" src/ --include="*.jsx" --include="*.tsx" --include="*.js" --include="*.ts"
|
|
136
|
-
|
|
137
|
-
# Find dynamic component/icon resolution
|
|
138
|
-
grep -rn "Icons\[" src/ --include="*.jsx" --include="*.tsx"
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
## Step 8: Performance Anti-Patterns
|
|
142
|
-
|
|
143
|
-
Scan for React performance issues:
|
|
144
|
-
|
|
145
|
-
### Missing memoization
|
|
146
|
-
|
|
147
|
-
- Components rendering large lists without `React.memo`
|
|
148
|
-
- Expensive computations without `useMemo`
|
|
149
|
-
- Callback props without `useCallback` causing child re-renders
|
|
150
|
-
- Focus on components in tables, lists, grids, repeated rows
|
|
151
|
-
|
|
152
|
-
### Request waterfalls
|
|
153
|
-
|
|
154
|
-
- Sequential `await` calls that could be `Promise.all`
|
|
155
|
-
- `useEffect` chains where one fetch triggers another
|
|
156
|
-
- Component trees where parent fetches block child renders
|
|
157
|
-
|
|
158
|
-
### Missing virtualization
|
|
159
|
-
|
|
160
|
-
- Lists rendering >50 items without react-window or similar
|
|
161
|
-
- Tables with unbounded row counts
|
|
162
|
-
- Grids without lazy loading
|
|
163
|
-
|
|
164
|
-
## Step 9: Import Health
|
|
165
|
-
|
|
166
|
-
1. Check for circular dependencies using import chains
|
|
167
|
-
2. Identify unused exports (files exporting functions not imported elsewhere)
|
|
168
|
-
|
|
169
|
-
## Step 10: Code-Quality Flags
|
|
170
|
-
|
|
171
|
-
- `dangerouslySetInnerHTML` usage without sanitization context
|
|
172
|
-
- `// TODO` and `// FIXME` comments older than 30 days
|
|
173
|
-
- `console.log` / `console.warn` / `console.error` left in production code
|
|
174
|
-
- Hardcoded API URLs, credentials, or environment-specific values
|
|
175
|
-
- Missing error boundaries around async components
|
|
176
|
-
|
|
177
|
-
```bash
|
|
178
|
-
grep -rn "console\.\(log\|warn\|error\)" src/ --include="*.jsx" --include="*.tsx" --include="*.js" --include="*.ts" | grep -v "// eslint"
|
|
179
|
-
grep -rn "TODO\|FIXME\|HACK\|XXX" src/ --include="*.jsx" --include="*.tsx" --include="*.js" --include="*.ts"
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
---
|
|
183
|
-
|
|
184
|
-
## Step 11: Report & Track
|
|
185
|
-
|
|
186
|
-
### Report format
|
|
187
|
-
|
|
188
|
-
**Dependencies**
|
|
189
|
-
|
|
190
|
-
- **Vulnerabilities**: critical/high CVEs, new since last audit
|
|
191
|
-
- **Outdated**: top outdated packages by semver distance
|
|
192
|
-
- **Licenses**: non-permissive license flags
|
|
193
|
-
- **Abandoned**: packages with no recent publishes
|
|
194
|
-
- **Transitive bloat**: unwanted packages pulled in transitively
|
|
195
|
-
- **Dependency size**: largest installed packages
|
|
196
|
-
|
|
197
|
-
**Code**
|
|
198
|
-
|
|
199
|
-
- **Bundle size**: total vendor size, top offenders, growth since last review
|
|
200
|
-
- **Tree-shaking issues**: namespace imports, barrel-file problems (cross-referenced with the heavy/bloat packages from Part A)
|
|
201
|
-
- **Performance**: missing memoization, request waterfalls, missing virtualization
|
|
202
|
-
- **Code quality**: console statements, TODOs, hardcoded values
|
|
203
|
-
|
|
204
|
-
**Recommendations**: a single prioritized list spanning both fronts, with estimated impact. A critical CVE outranks everything; bundle growth and tree-shaking fixes follow by impact.
|
|
205
|
-
|
|
206
|
-
### Update tracking
|
|
207
|
-
|
|
208
|
-
1. Write a snapshot to `docs/memory/performance-review.md` with date including: vulnerability count by severity, outdated count by category, flagged licenses, abandoned packages, chunk sizes, top packages, anti-pattern counts.
|
|
209
|
-
2. Append new items to `docs/history/backlog.md`:
|
|
210
|
-
- `- **[P0]** Critical CVE in \`{package}\`: {CVE-ID} — discovered by performance-review`
|
|
211
|
-
- `- **[P2]** Abandoned dependency: \`{package}\` (last published {date}) — discovered by performance-review`
|
|
212
|
-
- `- **[P2]** Bundle grew by 80KB in chunk \`{name}\` — discovered by performance-review`
|
|
213
|
-
3. Report summary to the user
|
|
214
|
-
|
|
215
|
-
## Rules
|
|
216
|
-
|
|
217
|
-
- Read-only for source code — never modify `src/` files
|
|
218
|
-
- Never run `npm install`, `pnpm install`, `yarn install`, or any command that modifies dependencies
|
|
219
|
-
- May write to `docs/memory/performance-review.md` and `docs/history/backlog.md`
|
|
220
|
-
- Be specific: include package names, byte sizes, CVE IDs, version numbers, file paths, line numbers
|
|
221
|
-
- Prioritize by impact — a critical CVE matters more than a patch update; trends matter more than absolutes when baselines exist
|
|
222
|
-
- If a command isn't available or applicable (e.g., audit unsupported, build fails on a non-JS project), skip that step and note it in the report
|
|
223
|
-
- A clean report is valid — do not invent issues
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
// plugins/code/hooks/generate-ownership-index.mjs — SessionStart hook: scan docs/features/**/*.md,
|
|
2
|
-
// extract the focal frontmatter (owns / module / keywords / status), and inject a compact
|
|
3
|
-
// code-path → owning-doc index via additionalContext. Fires on startup/resume/clear/compact so the
|
|
4
|
-
// map survives /clear and /compact and is regenerated fresh every time. Writes no file.
|
|
5
|
-
|
|
6
|
-
import fs from "node:fs";
|
|
7
|
-
import path from "node:path";
|
|
8
|
-
|
|
9
|
-
// Read all of stdin synchronously; returns "" if nothing is piped.
|
|
10
|
-
function readStdin() {
|
|
11
|
-
try {
|
|
12
|
-
return fs.readFileSync(0, "utf8");
|
|
13
|
-
} catch (e) {
|
|
14
|
-
return "";
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Resolve the project root: CLAUDE_PROJECT_DIR env, else payload cwd, else process cwd.
|
|
19
|
-
function resolveProjectDir(payload) {
|
|
20
|
-
return process.env.CLAUDE_PROJECT_DIR || (payload && payload.cwd) || process.cwd();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Recursively collect every .md file under dir (returns [] if the dir is absent).
|
|
24
|
-
function listMarkdown(dir) {
|
|
25
|
-
const out = [];
|
|
26
|
-
let entries;
|
|
27
|
-
try {
|
|
28
|
-
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
29
|
-
} catch (e) {
|
|
30
|
-
return out;
|
|
31
|
-
}
|
|
32
|
-
for (const entry of entries) {
|
|
33
|
-
const full = path.join(dir, entry.name);
|
|
34
|
-
if (entry.isDirectory()) out.push(...listMarkdown(full));
|
|
35
|
-
else if (entry.isFile() && entry.name.endsWith(".md")) out.push(full);
|
|
36
|
-
}
|
|
37
|
-
return out;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Pull the leading `--- … ---` frontmatter block; "" if the file has none.
|
|
41
|
-
function frontmatter(text) {
|
|
42
|
-
const m = /^?---\r?\n([\s\S]*?)\r?\n---/.exec(text);
|
|
43
|
-
return m ? m[1] : "";
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Trim surrounding whitespace, then strip one layer of matching quotes.
|
|
47
|
-
function unquote(s) {
|
|
48
|
-
return String(s).trim().replace(/^["']|["']$/g, "").trim();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Read one frontmatter key: scalar (`k: v`), inline array (`k: [a, b]`), or a following `- item` block.
|
|
52
|
-
// Returns a string for scalars, an array for lists, or undefined when the key is absent.
|
|
53
|
-
function field(block, key) {
|
|
54
|
-
const lines = block.split(/\r?\n/);
|
|
55
|
-
const head = new RegExp(`^${key}\\s*:\\s*(.*)$`);
|
|
56
|
-
for (let i = 0; i < lines.length; i++) {
|
|
57
|
-
const m = head.exec(lines[i]);
|
|
58
|
-
if (!m) continue;
|
|
59
|
-
const raw = m[1].trim();
|
|
60
|
-
if (raw === "") {
|
|
61
|
-
const items = [];
|
|
62
|
-
for (let j = i + 1; j < lines.length; j++) {
|
|
63
|
-
const li = /^\s*-\s+(.*)$/.exec(lines[j]);
|
|
64
|
-
if (!li) break;
|
|
65
|
-
items.push(unquote(li[1]));
|
|
66
|
-
}
|
|
67
|
-
return items;
|
|
68
|
-
}
|
|
69
|
-
if (raw.startsWith("[")) {
|
|
70
|
-
return raw.replace(/^\[|\]$/g, "").split(",").map((s) => unquote(s)).filter(Boolean);
|
|
71
|
-
}
|
|
72
|
-
return unquote(raw);
|
|
73
|
-
}
|
|
74
|
-
return undefined;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Coerce a field that may be scalar/array/undefined into a clean string array.
|
|
78
|
-
function asList(v) {
|
|
79
|
-
if (v == null) return [];
|
|
80
|
-
return (Array.isArray(v) ? v : [v]).map((s) => String(s).trim()).filter(Boolean);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Build the ownership index text from every feature doc's frontmatter.
|
|
84
|
-
function buildIndex(projectDir) {
|
|
85
|
-
const featuresDir = path.join(projectDir, "docs", "features");
|
|
86
|
-
const files = listMarkdown(featuresDir);
|
|
87
|
-
const lines = [];
|
|
88
|
-
let deprecated = 0;
|
|
89
|
-
for (const file of files) {
|
|
90
|
-
let text;
|
|
91
|
-
try {
|
|
92
|
-
text = fs.readFileSync(file, "utf8");
|
|
93
|
-
} catch (e) {
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
const block = frontmatter(text);
|
|
97
|
-
if (!block) continue;
|
|
98
|
-
const owns = asList(field(block, "owns"));
|
|
99
|
-
if (owns.length === 0) continue;
|
|
100
|
-
const status = (field(block, "status") || "active").toString().toLowerCase();
|
|
101
|
-
if (status === "deprecated") {
|
|
102
|
-
deprecated += 1;
|
|
103
|
-
continue; // keep deprecated docs out of the routing lines
|
|
104
|
-
}
|
|
105
|
-
const moduleLabel = (field(block, "module") || "—").toString();
|
|
106
|
-
const keywords = asList(field(block, "keywords"));
|
|
107
|
-
const doc = path.relative(projectDir, file).split(path.sep).join("/");
|
|
108
|
-
const kw = keywords.length ? `[${keywords.join(", ")}]` : "[]";
|
|
109
|
-
for (const glob of owns) {
|
|
110
|
-
lines.push(`${glob} → ${doc} · ${moduleLabel} · ${kw} · ${status}`);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
if (lines.length === 0) return "";
|
|
114
|
-
lines.sort();
|
|
115
|
-
const header =
|
|
116
|
-
"# Ownership index (generated) — code-path glob → owning feature doc · module · keywords · status\n" +
|
|
117
|
-
"# Match the file or topic you're about to touch, then read the owning doc before changing it.\n";
|
|
118
|
-
const footer = deprecated > 0 ? `\n# (${deprecated} deprecated feature doc(s) omitted)` : "";
|
|
119
|
-
return header + lines.join("\n") + footer;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function main() {
|
|
123
|
-
const raw = readStdin();
|
|
124
|
-
let payload = {};
|
|
125
|
-
try {
|
|
126
|
-
payload = raw ? JSON.parse(raw) : {};
|
|
127
|
-
} catch (e) {
|
|
128
|
-
payload = {};
|
|
129
|
-
}
|
|
130
|
-
const index = buildIndex(resolveProjectDir(payload));
|
|
131
|
-
if (!index) return; // no feature docs yet → inject nothing
|
|
132
|
-
process.stdout.write(
|
|
133
|
-
JSON.stringify({
|
|
134
|
-
hookSpecificOutput: {
|
|
135
|
-
hookEventName: "SessionStart",
|
|
136
|
-
additionalContext: index,
|
|
137
|
-
},
|
|
138
|
-
})
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
try {
|
|
143
|
-
main();
|
|
144
|
-
} catch (e) {
|
|
145
|
-
// Best-effort: a routing index is a convenience, never a gate. Inject nothing on failure.
|
|
146
|
-
} finally {
|
|
147
|
-
process.exit(0);
|
|
148
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# Database
|
|
2
|
-
|
|
3
|
-
Fixed conventions for relational schemas — table/column/index **names**, the **key vocabulary** (`id` / `slug` / `label`), column types, and Drizzle mirrors — so the same concept carries the same name in **every** Nurix project. This is a cross-project consistency rule: **one concept, one name, everywhere** — never `slug` in one repo and `handle` / `key` / `code` in another. General code naming (variables, files, casing) is [`nomenclature.md`](nomenclature.md); this rule owns the database.
|
|
4
|
-
|
|
5
|
-
Written for SQLite / Cloudflare D1 + Drizzle (the concrete types below). The **names and key vocabulary are engine-agnostic** — a Postgres project keeps the same column names and semantics with native types (`uuid`, `timestamptz`, `boolean`).
|
|
6
|
-
|
|
7
|
-
## Keys & the shared vocabulary
|
|
8
|
-
|
|
9
|
-
Three column roles are fixed across every table and every project:
|
|
10
|
-
|
|
11
|
-
- **`id`** — the primary key, **always a UUID** (`TEXT PRIMARY KEY` on D1, `uuid` on Postgres). Never a synthetic or natural key (`type_page_button`, `human:default` are ❌). Runtime rows mint a UUIDv7; seed rows derive a deterministic UUIDv5 of the natural key so re-seeds stay stable. Never mix synthetic and UUID ids in one table.
|
|
12
|
-
- **`slug`** — the **stable key other rows reference**: `UNIQUE`, lowercase `snake_case`. **Foreign keys point at `slug`, not `id`.** One concept = one slug name across every table and repo. ❌ Never rename this role `handle`, `key`, `code`, or `name` in a different project — it is always `slug`.
|
|
13
|
-
- **`label`** — the **human display name**. Always `label` — ❌ never `name`, `title`, or `display_name`.
|
|
14
|
-
|
|
15
|
-
Reference columns name what they point at: `<entity>_id` for a UUID-PK reference (`user_id`, `app_id`), `<entity>_slug` for a slug reference (`source_slug`).
|
|
16
|
-
|
|
17
|
-
- **Enforced** (the referenced row must exist) → a real `FOREIGN KEY (<x>_slug) REFERENCES <table>(slug)`.
|
|
18
|
-
- **Drift-tolerant** (a controlled-vocabulary value that may fall off-list) → a plain value column, **no** FK, paired with an `is_*` boolean recording whether the value is in the canonical set.
|
|
19
|
-
|
|
20
|
-
## Naming
|
|
21
|
-
|
|
22
|
-
- **Tables** — `snake_case`, plural noun for what they hold (`users`, `apps`, `devices`).
|
|
23
|
-
- **Junction (M:N) tables** — `<entityA>_<entityB>_map`, **always**, even when the join carries its own columns; singular stems, owning/anchor entity first (`app_user_map`, `app_device_map`). ❌ Never a "nice" noun (`members`, `installs`, `memberships`, `enrolments`) — the name must read as a join, and a reviewer should know both sides from it.
|
|
24
|
-
- **Columns** — `snake_case`; booleans `is_*` / `has_*`; timestamps `created_at` / `updated_at`; foreign keys `<entity>_id`.
|
|
25
|
-
- **Indexes** — `<table>_<col(s)>_idx`; unique `<table>_<col(s)>_unique`; a junction's composite unique reads `<table>_<colA>_<colB>_unique` (`app_user_map_app_user_unique`).
|
|
26
|
-
- **Drizzle mirror** — the exported object is the camelCase table name (`app_user_map` → `appUserMap`); column props are the camelCase of the column (`created_at` → `createdAt`). The `sqliteTable("…")` string and every index name must match the DDL (`init.sql`) exactly — the schema-parity boundary.
|
|
27
|
-
|
|
28
|
-
## Column types (SQLite / D1)
|
|
29
|
-
|
|
30
|
-
- **Timestamps** — `created_at` + `updated_at`, both `TEXT NOT NULL DEFAULT (datetime('now'))`, on **every** table — except append-only logs, which carry only `created_at`.
|
|
31
|
-
- **Booleans** — `INTEGER`, named `is_*` / `has_*` (Drizzle `integer(…, { mode: "boolean" })`).
|
|
32
|
-
- **JSON** — `TEXT` (Drizzle `text(…, { mode: "json" })`).
|
|
33
|
-
|
|
34
|
-
## Vocabulary / lookup tables
|
|
35
|
-
|
|
36
|
-
A controlled-vocabulary table (statuses, kinds, categories) follows a fixed shape: `id` (UUID) · `slug` (UNIQUE) · `label` · optional `description` · `status` · timestamps.
|
|
37
|
-
|
|
38
|
-
- **Seeds are generated, never hand-written** — the source of truth is a CSV or a shared package; a generator emits the `*.seed.sql` with UUIDv5 ids and an idempotent `ON CONFLICT(slug)` upsert that preserves live counts / admin-tuned columns. Hand-editing seed SQL is ❌ — regenerate it.
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# General Standards
|
|
2
|
-
|
|
3
|
-
Runtime versions and the canonical package list — the workspace baseline every Nurix code harness loads. Web-frontend/styling conventions are [`frontend.md`](frontend.md); the Express server and the API response envelope are [`express.md`](express.md).
|
|
4
|
-
|
|
5
|
-
## Runtime Versions
|
|
6
|
-
|
|
7
|
-
- **Node.js:** 22 LTS (latest)
|
|
8
|
-
- **Package manager:** detect from lockfile (`pnpm-lock.yaml` → pnpm, `yarn.lock` → yarn, `package-lock.json` → npm). Don't hardcode one.
|
|
9
|
-
- **PostgreSQL:** 17 · **Redis:** 7.x (latest)
|
|
10
|
-
|
|
11
|
-
## Recommended Packages
|
|
12
|
-
|
|
13
|
-
No alternatives. Just use these.
|
|
14
|
-
|
|
15
|
-
| Package | Version | Use | Don't use |
|
|
16
|
-
| ------------------------ | --------- | ---------------------- | -------------------------- |
|
|
17
|
-
| react | ^19.2.3 | UI components | - |
|
|
18
|
-
| vite | ^8.0.0 | Build tool, dev server | webpack, CRA |
|
|
19
|
-
| tailwindcss | ^4.1.18 | Styling | styled-components |
|
|
20
|
-
| @vitejs/plugin-react-swc | ^4.2.2 | JSX compilation | @vitejs/plugin-react |
|
|
21
|
-
| react-router-dom | ^7.11.0 | Routing | - |
|
|
22
|
-
| @reduxjs/toolkit | ^2.11.2 | State management | zustand, jotai |
|
|
23
|
-
| react-redux | ^9.2.0 | Redux React bindings | - |
|
|
24
|
-
| axios | ^1.13.2 | HTTP requests | fetch |
|
|
25
|
-
| date-fns | ^4.1.0 | Date formatting | moment, dayjs |
|
|
26
|
-
| @dnd-kit/core | ^6.3.1 | Drag and drop | react-beautiful-dnd |
|
|
27
|
-
| motion | ^12.23.26 | Animations | react-spring |
|
|
28
|
-
| sonner | ^2.0.7 | Toast notifications | react-toastify |
|
|
29
|
-
| react-window | ^2.2.3 | List virtualization | react-virtualized |
|
|
30
|
-
| nanoid | ^5.1.6 | ID generation | uuid |
|
|
31
|
-
| express | ^5.2.1 | HTTP server | fastify, koa |
|
|
32
|
-
| drizzle-orm | latest | Database ORM | prisma, sequelize, typeorm |
|
|
33
|
-
| drizzle-kit | latest | Schema tooling | - |
|
|
34
|
-
| zod | ^4.2.1 | Schema validation | yup, joi |
|
|
35
|
-
| jose | ^6.1.3 | JWT handling | jsonwebtoken |
|
|
36
|
-
| microdiff | ^1.5.0 | JSON object diffing | deep-diff, just-diff |
|
|
37
|
-
| react18-json-view | ^0.2.9 | JSON tree view | react-json-view |
|
|
38
|
-
| @tiptap/react | ^3.11.1 | Rich text editor | slate, quill, draft-js |
|
|
39
|
-
| shiki | ^3.22.0 | Syntax highlighting | prism, highlight.js |
|
|
40
|
-
| lucide-react | ^0.562.0 | Icons | react-icons, heroicons |
|
|
41
|
-
| @pdfme/generator | ^5.5.8 | PDF generation | jspdf, pdfkit |
|
|
42
|
-
| cmdk | ^1.1.1 | Command palette | kbar, ninja-keys |
|
|
43
|
-
| @monaco-editor/react | ^4.7.0 | Code editor | codemirror, ace |
|
|
44
|
-
| localforage | ^1.10.0 | Client-side storage | idb, dexie |
|
|
45
|
-
| react-markdown | ^10.1.0 | Markdown rendering | marked, markdown-it |
|
|
46
|
-
| remark-gfm | ^4.0.1 | GFM (tables, tasklists) | remark-github, custom |
|
|
47
|
-
| fast-deep-equal | ^3.1.3 | Deep equality checks | lodash.isEqual |
|
|
48
|
-
| @ngneat/falso | latest | Fake data generation | @faker-js/faker, chance |
|
|
49
|
-
| pino | ^10.1.0 | Logging | winston |
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# Nomenclature Guidelines
|
|
2
|
-
|
|
3
|
-
## Naming Guidelines
|
|
4
|
-
|
|
5
|
-
- Use descriptive names that reveal intent, purpose, and usage
|
|
6
|
-
- Names should explain why something exists and how it's used
|
|
7
|
-
- Favor clarity over brevity
|
|
8
|
-
- Maintain consistency within the codebase
|
|
9
|
-
- Avoid abbreviations unless they're universally understood
|
|
10
|
-
|
|
11
|
-
## Naming Styles
|
|
12
|
-
|
|
13
|
-
- Variables : Use nouns or noun phrases. Examples: `userData`, `firstName`, `paymentStatus`, `configOptions`
|
|
14
|
-
- Functions & Methods : Use verbs or verb phrases that describe the action. Examples: `calculateTotal`, `getUserInfo`, `validateInput`, `sendNotification`
|
|
15
|
-
- Boolean Variables : Prefix with is**, has**, can**, or should**. Examples: `isValid`, `hasPermission`, `canEdit`, `shouldRefresh`
|
|
16
|
-
- Arrays : Use plural nouns. Examples: `users`, `productList`, `errorMessages`, `activeConnections`
|
|
17
|
-
- Classes & Components : Use singular nouns or noun phrases. Examples: `RequestHandler`, `UserProfile`, `PaymentProcessor`, `DataValidator`
|
|
18
|
-
- Constants : Use uppercase with meaningful names. Examples: `DEFAULT_TIMEOUT`, `API_BASE_URL`, `MAX_RETRY_COUNT`, `COLOR_PRIMARY`
|
|
19
|
-
- Event Handlers : Use Prefix with handle or on. Examples: `handleSubmit`, `onUserLogin`, `handleInputChange`, `onPageLoad`
|
|
20
|
-
- Interfaces & Types : Use Consider prefixing with I for interfaces (if preferred). Examples: `IUserData`, `IConfigOptions`, `AuthResponse`, `RequestParams`
|
|
21
|
-
- Promises & Async Functions : Use Consider using future tense or suffixes like Async. Examples: `fetchUserData`, `getUserProfileAsync`, `loadConfigAsync`, `processPayment`
|
|
22
|
-
- File & Folder Structure : Use lowercase with descriptive names. Group by feature or function type. Example: `auth/login_service.js`
|
|
23
|
-
|
|
24
|
-
## Casing Styles
|
|
25
|
-
|
|
26
|
-
- camelCase : Used in Variables, function names, method names, property names. Examples: `userData`, `calculateTotal`, `firstName`, `isValidEmail`
|
|
27
|
-
- PascalCase : Used in Class names, component names, type definitions. Examples: `UserProfile`, `DataService`, `AuthProvider`, `RequestHandler`
|
|
28
|
-
- snake_case : Used in File names, folder names. Examples: `user_service`, `api_utils`, `auth_middleware`, `data_models`
|
|
29
|
-
- UPPER_SNAKE_CASE : Used in Constants, environment variables. Examples: `MAX_RETRY_COUNT`, `API_KEY`, `DEFAULT_TIMEOUT`, `COLOR_PRIMARY`
|
|
30
|
-
- kebab-case : Used in URLs, CSS class names, HTML IDs. Examples: `nav-container`, `user-profile`, `button-primary`, `form-wrapper`
|
|
31
|
-
|
|
32
|
-
## Database
|
|
33
|
-
|
|
34
|
-
Table, column, index, and key naming for relational schemas — the `id` / `slug` / `label` vocabulary, junction `_map` tables, and Drizzle mirrors — lives in [`database.md`](database.md), the cross-project database conventions rule. Kept there, not here, so there is one canonical home and the same concept carries the same name in every project.
|