@su-record/vibe 3.2.5 → 3.2.7
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.en.md +1 -1
- package/README.md +1 -1
- package/dist/cli/postinstall/constants.d.ts.map +1 -1
- package/dist/cli/postinstall/constants.js +10 -9
- package/dist/cli/postinstall/constants.js.map +1 -1
- package/dist/cli/setup/ProjectSetup.d.ts.map +1 -1
- package/dist/cli/setup/ProjectSetup.js +5 -0
- package/dist/cli/setup/ProjectSetup.js.map +1 -1
- package/hooks/scripts/__tests__/.vibe/command-log.txt +3 -3
- package/package.json +2 -2
- package/skills/vibe/SKILL.md +27 -86
- package/skills/vibe/references/routing-examples.md +85 -0
- package/skills/vibe.agents-md/SKILL.md +12 -10
- package/skills/vibe.analyze/SKILL.md +22 -211
- package/skills/vibe.analyze/references/mode1-feature.md +81 -0
- package/skills/vibe.analyze/references/mode2-document.md +50 -0
- package/skills/vibe.analyze/references/mode3-website.md +47 -0
- package/skills/vibe.analyze/references/mode4-quality.md +35 -0
- package/skills/vibe.brand-assets/SKILL.md +2 -2
- package/skills/vibe.brand-assets/references/mobile-assets.md +6 -0
- package/skills/vibe.capability-loop/SKILL.md +14 -80
- package/skills/vibe.capability-loop/references/escalate.md +86 -0
- package/skills/vibe.chub-usage/SKILL.md +3 -132
- package/skills/vibe.clone/SKILL.md +43 -358
- package/skills/vibe.clone/references/phase-commands.md +118 -0
- package/skills/vibe.clone/references/setup-and-layout.md +34 -0
- package/skills/vibe.clone/references/verification-loops.md +64 -0
- package/skills/vibe.commit-push-pr/SKILL.md +10 -4
- package/skills/vibe.context7-usage/SKILL.md +3 -99
- package/skills/vibe.continue/SKILL.md +17 -7
- package/skills/{vibe.handoff → vibe.continue}/agents/context-summarizer.md +1 -1
- package/skills/{vibe.handoff → vibe.continue}/agents/document-writer.md +1 -1
- package/skills/{vibe.handoff → vibe.continue}/agents/state-collector.md +1 -1
- package/skills/{vibe.handoff → vibe.continue}/agents/verifier.md +1 -1
- package/skills/{vibe.handoff/rubrics/completeness.md → vibe.continue/references/handoff-completeness.md} +1 -1
- package/skills/{vibe.handoff/templates → vibe.continue/references}/handoff.md +37 -2
- package/skills/vibe.contract/SKILL.md +4 -27
- package/skills/vibe.create-prd/SKILL.md +8 -1
- package/skills/vibe.design/SKILL.md +18 -5
- package/skills/vibe.design/references/design-context.md +184 -0
- package/skills/vibe.design-refine/SKILL.md +7 -0
- package/skills/vibe.design-review/SKILL.md +7 -0
- package/skills/vibe.design-teach/SKILL.md +2 -175
- package/skills/vibe.devlog/SKILL.md +14 -11
- package/skills/vibe.devlog/references/auto-push.md +10 -0
- package/skills/vibe.docs/SKILL.md +27 -198
- package/skills/vibe.docs/references/agent.md +55 -0
- package/skills/vibe.docs/references/arch.md +28 -0
- package/skills/vibe.docs/references/codemaps.md +17 -0
- package/skills/vibe.docs/references/diagram.md +24 -0
- package/skills/vibe.docs/references/guide.md +23 -0
- package/skills/vibe.docs/references/readme.md +45 -0
- package/skills/vibe.docs/references/release.md +31 -0
- package/skills/vibe.documentation-provider/SKILL.md +22 -0
- package/skills/vibe.documentation-provider/references/chub.md +141 -0
- package/skills/vibe.documentation-provider/references/context7.md +107 -0
- package/skills/vibe.educational-content/SKILL.md +7 -0
- package/skills/vibe.event/SKILL.md +47 -146
- package/skills/vibe.event/references/comms.md +173 -0
- package/skills/vibe.event/references/operations.md +208 -0
- package/skills/vibe.event/references/orchestration-legacy.md +97 -0
- package/skills/vibe.event/references/planning.md +145 -0
- package/skills/vibe.event-comms/SKILL.md +3 -165
- package/skills/vibe.event-ops/SKILL.md +3 -200
- package/skills/vibe.event-planning/SKILL.md +3 -137
- package/skills/vibe.figma/SKILL.md +26 -692
- package/skills/vibe.figma/references/branch1-read-convention.md +82 -0
- package/skills/vibe.figma/references/branch2-read-standalone.md +69 -0
- package/skills/vibe.figma/references/branch3-write.md +122 -0
- package/skills/vibe.figma/references/core-implementation.md +453 -0
- package/skills/vibe.git-worktree/SKILL.md +2 -6
- package/skills/vibe.git-worktree/references/troubleshooting.md +9 -0
- package/skills/vibe.handoff/SKILL.md +2 -103
- package/skills/vibe.harness/SKILL.md +17 -12
- package/skills/vibe.image/SKILL.md +8 -1
- package/skills/vibe.llm/SKILL.md +8 -1
- package/skills/vibe.loop/SKILL.md +9 -11
- package/skills/vibe.loop/references/install-adapters.md +10 -0
- package/skills/vibe.presentation/SKILL.md +7 -0
- package/skills/vibe.prioritization/SKILL.md +7 -0
- package/skills/vibe.priority-todos/SKILL.md +2 -57
- package/skills/vibe.react-best-practices/SKILL.md +1 -1
- package/skills/vibe.reason/SKILL.md +9 -2
- package/skills/vibe.regress/SKILL.md +6 -28
- package/skills/vibe.regress/templates/{test-jest.md → test-template.md} +1 -0
- package/skills/vibe.review/SKILL.md +35 -38
- package/skills/vibe.review/references/priority-todos.md +66 -0
- package/skills/vibe.review/references/ui-ux-review.md +39 -0
- package/skills/vibe.run/SKILL.md +57 -656
- package/skills/vibe.run/references/arch-guard.md +178 -0
- package/skills/vibe.run/references/e2e-and-autofix.md +40 -0
- package/skills/vibe.run/references/exec-plan.md +145 -0
- package/skills/vibe.run/references/guidelines-and-tools.md +84 -0
- package/skills/vibe.run/references/process-steps.md +179 -0
- package/skills/vibe.run/references/restraint.md +66 -0
- package/skills/vibe.scaffold/SKILL.md +9 -13
- package/skills/vibe.scaffold/references/clean-architecture.md +17 -0
- package/skills/vibe.spec/SKILL.md +12 -8
- package/skills/vibe.spec/references/legacy-artifacts.md +6 -0
- package/skills/vibe.test/SKILL.md +93 -70
- package/skills/vibe.test/references/report-template.md +101 -0
- package/skills/vibe.tool-fallback/SKILL.md +10 -32
- package/skills/vibe.tool-fallback/references/external-llm.md +10 -0
- package/skills/vibe.tool-fallback/references/file-lookup.md +9 -0
- package/skills/vibe.tool-fallback/references/web-search.md +11 -0
- package/skills/vibe.trace/SKILL.md +2 -264
- package/skills/vibe.ui-ux-pro-max/SKILL.md +1 -3
- package/skills/vibe.ui-ux-pro-max/references/charts-and-data.md +7 -0
- package/skills/vibe.user-personas/SKILL.md +8 -1
- package/skills/vibe.verify/SKILL.md +30 -4
- package/skills/vibe.verify/references/trace-mode.md +271 -0
- package/skills/vibe.regress/templates/test-vitest.md +0 -30
- /package/skills/{vibe.design-teach/rubrics → vibe.design/references}/brand-personality.md +0 -0
- /package/skills/{vibe.design-teach → vibe.design}/templates/design-context.json +0 -0
- /package/skills/{vibe.context7-usage/rubrics/when-to-use.md → vibe.documentation-provider/references/context7-when-to-use.md} +0 -0
- /package/skills/{vibe.event-ops/rubrics → vibe.event/references}/contingency.md +0 -0
- /package/skills/{vibe.event-ops/templates/d-day-checklist.md → vibe.event/references/d-day-checklist-template.md} +0 -0
- /package/skills/{vibe.event-comms/templates/email-invite.md → vibe.event/references/email-invite-template.md} +0 -0
- /package/skills/{vibe.event-planning/templates/event-plan.md → vibe.event/references/event-plan-template.md} +0 -0
- /package/skills/{vibe.event-comms/templates/sns-post.md → vibe.event/references/sns-post-template.md} +0 -0
- /package/skills/{vibe.event-planning/rubrics → vibe.event/references}/timeline.md +0 -0
- /package/skills/{vibe.priority-todos/templates/todo-board.md → vibe.review/references/todo-board-template.md} +0 -0
- /package/skills/{vibe.priority-todos/rubrics/prioritization.md → vibe.review/references/todo-prioritization.md} +0 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# Arch Guard — Architecture Boundary Test Generator
|
|
2
|
+
|
|
3
|
+
> vibe.run 내부 구현. **아키텍처 경계 테스트를 생성/검증할 때만 로드한다** — 매 run 마다 필요하지 않다.
|
|
4
|
+
|
|
5
|
+
# Arch Guard — Architecture Boundary Test Generator
|
|
6
|
+
|
|
7
|
+
> **Principle**: "Mechanical enforcement over documentation." If a rule exists only in docs, it will be violated. Turn architecture constraints into failing tests.
|
|
8
|
+
|
|
9
|
+
## When to Use
|
|
10
|
+
|
|
11
|
+
| Scenario | Signal |
|
|
12
|
+
|----------|--------|
|
|
13
|
+
| `vibe init` / `vibe update` | Auto-generate for detected stack |
|
|
14
|
+
| New layer/module added | Boundaries need enforcement |
|
|
15
|
+
| Architecture violation found in review | Prevent recurrence with test |
|
|
16
|
+
| "Services should not import UI" type rules | Turn into automated check |
|
|
17
|
+
|
|
18
|
+
## Core Flow
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
DETECT → INFER → GENERATE → VERIFY
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Step 1: DETECT — Identify Project Architecture
|
|
25
|
+
|
|
26
|
+
Analyze the project to determine its layer structure:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
Parallel exploration:
|
|
30
|
+
- Agent 1: Scan directory structure (src/, app/, lib/, etc.)
|
|
31
|
+
- Agent 2: Read existing architecture docs (CLAUDE.md, README, ADR)
|
|
32
|
+
- Agent 3: Analyze import graph (which files import what)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Common patterns to detect:**
|
|
36
|
+
|
|
37
|
+
| Pattern | Layers | Typical Stacks |
|
|
38
|
+
|---------|--------|----------------|
|
|
39
|
+
| MVC | Controller → Service → Model | Rails, NestJS, Spring |
|
|
40
|
+
| Clean Architecture | UI → Application → Domain → Infrastructure | General |
|
|
41
|
+
| Feature-based | Feature A ↛ Feature B internals | Next.js, React |
|
|
42
|
+
| Hexagonal | Adapters → Ports → Domain | DDD projects |
|
|
43
|
+
| Component hierarchy | Page → Feature → Shared → UI Primitives | Frontend |
|
|
44
|
+
|
|
45
|
+
### Step 2: INFER — Define Boundary Rules
|
|
46
|
+
|
|
47
|
+
From detected structure, generate rules:
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
// Rule format
|
|
51
|
+
interface ArchRule {
|
|
52
|
+
name: string; // "service-no-ui-import"
|
|
53
|
+
from: string; // Glob pattern: "src/services/**"
|
|
54
|
+
cannotImport: string[]; // ["src/components/**", "src/pages/**"]
|
|
55
|
+
canImport: string[]; // ["src/models/**", "src/utils/**"]
|
|
56
|
+
reason: string; // "Services must be UI-agnostic"
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Default rules by stack:**
|
|
61
|
+
|
|
62
|
+
| Stack | Rule |
|
|
63
|
+
|-------|------|
|
|
64
|
+
| Next.js / React | `components/` cannot import from `pages/` or `app/` |
|
|
65
|
+
| Next.js / React | `lib/` cannot import from `components/` |
|
|
66
|
+
| NestJS | `*.service.ts` cannot import from `*.controller.ts` |
|
|
67
|
+
| NestJS | `*.module.ts` is the only valid cross-boundary import |
|
|
68
|
+
| General TS | `src/domain/` cannot import from `src/infra/` |
|
|
69
|
+
| General TS | No circular dependencies between top-level dirs |
|
|
70
|
+
| Python Django | `models.py` cannot import from `views.py` |
|
|
71
|
+
| Python FastAPI | `schemas/` cannot import from `routers/` |
|
|
72
|
+
|
|
73
|
+
### Step 3: GENERATE — Create Test File
|
|
74
|
+
|
|
75
|
+
Output: `tests/arch-guard.test.ts` (or equivalent for stack)
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
/**
|
|
79
|
+
* Architecture Boundary Tests
|
|
80
|
+
* Generated by arch-guard skill
|
|
81
|
+
*
|
|
82
|
+
* These tests enforce architectural constraints mechanically.
|
|
83
|
+
* If a test fails, it means an import violates the intended architecture.
|
|
84
|
+
*/
|
|
85
|
+
import { describe, it, expect } from 'vitest';
|
|
86
|
+
import fs from 'fs';
|
|
87
|
+
import path from 'path';
|
|
88
|
+
|
|
89
|
+
// Helper: extract imports from a file
|
|
90
|
+
function extractImports(filePath: string): string[] {
|
|
91
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
92
|
+
const importRegex = /(?:import|require)\s*\(?['"]([^'"]+)['"]\)?/g;
|
|
93
|
+
const imports: string[] = [];
|
|
94
|
+
let match;
|
|
95
|
+
while ((match = importRegex.exec(content)) !== null) {
|
|
96
|
+
imports.push(match[1]);
|
|
97
|
+
}
|
|
98
|
+
return imports;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Helper: resolve relative import to absolute path
|
|
102
|
+
function resolveImport(fromFile: string, importPath: string): string {
|
|
103
|
+
if (importPath.startsWith('.')) {
|
|
104
|
+
return path.resolve(path.dirname(fromFile), importPath);
|
|
105
|
+
}
|
|
106
|
+
return importPath; // external package
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Helper: glob files matching pattern
|
|
110
|
+
function globFiles(pattern: string, baseDir: string): string[] {
|
|
111
|
+
// Use fast-glob or manual recursive scan
|
|
112
|
+
// Implementation depends on available dependencies
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
describe('Architecture Boundaries', () => {
|
|
116
|
+
// GENERATED RULES GO HERE
|
|
117
|
+
// Each rule becomes a test case:
|
|
118
|
+
|
|
119
|
+
it('services cannot import UI components', () => {
|
|
120
|
+
const serviceFiles = globFiles('src/services/**/*.ts', process.cwd());
|
|
121
|
+
const violations: string[] = [];
|
|
122
|
+
|
|
123
|
+
for (const file of serviceFiles) {
|
|
124
|
+
const imports = extractImports(file);
|
|
125
|
+
for (const imp of imports) {
|
|
126
|
+
const resolved = resolveImport(file, imp);
|
|
127
|
+
if (resolved.includes('/components/') || resolved.includes('/pages/')) {
|
|
128
|
+
violations.push(`${file} imports ${imp}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
expect(violations).toEqual([]);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Step 4: VERIFY — Run and Fix
|
|
139
|
+
|
|
140
|
+
1. Run the generated tests: `npx vitest run tests/arch-guard.test.ts`
|
|
141
|
+
2. If violations found:
|
|
142
|
+
- Report each violation with file:line
|
|
143
|
+
- Suggest fix (move shared code to appropriate layer)
|
|
144
|
+
- Do NOT auto-fix — violations need human review
|
|
145
|
+
|
|
146
|
+
## Output Files
|
|
147
|
+
|
|
148
|
+
| File | Purpose |
|
|
149
|
+
|------|---------|
|
|
150
|
+
| `tests/arch-guard.test.ts` | Executable boundary tests |
|
|
151
|
+
| `.vibe/arch-rules.json` | Machine-readable rules (for CI) |
|
|
152
|
+
|
|
153
|
+
## Customization
|
|
154
|
+
|
|
155
|
+
Users can add custom rules to `.vibe/arch-rules.json`:
|
|
156
|
+
|
|
157
|
+
```json
|
|
158
|
+
{
|
|
159
|
+
"rules": [
|
|
160
|
+
{
|
|
161
|
+
"name": "no-direct-db-in-handlers",
|
|
162
|
+
"from": "src/handlers/**",
|
|
163
|
+
"cannotImport": ["src/db/**"],
|
|
164
|
+
"reason": "Handlers must use services, not direct DB access"
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
The test generator reads this file and adds custom rules to the test suite.
|
|
171
|
+
|
|
172
|
+
## Integration
|
|
173
|
+
|
|
174
|
+
- `vibe init` → auto-detect and generate initial arch-guard tests
|
|
175
|
+
- `vibe update` → refresh rules if directory structure changed
|
|
176
|
+
- Explicit pre-commit JUDGE → run arch-guard tests before commit; a lifecycle hook may accelerate this check
|
|
177
|
+
- `vibe.review` (skill) → code-reviewer (focus: architecture) checks against arch-rules.json
|
|
178
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# vibe.run — E2E Closed Loop & Auto-Fix
|
|
2
|
+
|
|
3
|
+
> vibe.run SKILL.md Automated Verification 에서 참조. UI 시나리오 E2E 루프와 실패 시 자동 수정 절차.
|
|
4
|
+
|
|
5
|
+
### E2E Closed Loop (UI Scenarios)
|
|
6
|
+
|
|
7
|
+
**UI 시나리오가 포함된 Feature일 때 자동 활성화.**
|
|
8
|
+
|
|
9
|
+
Browser Tool Priority:
|
|
10
|
+
|
|
11
|
+
| Priority | Tool | 용도 |
|
|
12
|
+
|----------|------|------|
|
|
13
|
+
| 1st | Agent Browser (접근성 트리) | AI 직접 조작, 최소 토큰 |
|
|
14
|
+
| 2nd | Playwright Test Runner | 테스트 코드 실행, pass/fail 반환 |
|
|
15
|
+
| 3rd | Playwright MCP (DOM) | 최후 수단, 토큰 비효율 |
|
|
16
|
+
|
|
17
|
+
**활성화 조건:** Feature 파일에 UI 관련 시나리오 존재 + `.vibe/e2e/config.json`의 `closedLoop.enabled: true` (기본값) + dev server가 실행 중
|
|
18
|
+
|
|
19
|
+
### Auto-Fix on Failure
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
Scenario verification failed
|
|
23
|
+
↓ [Collect evidence]
|
|
24
|
+
↓ [Root cause analysis]
|
|
25
|
+
↓ [Read target file FULLY]
|
|
26
|
+
↓ [Implement fix]
|
|
27
|
+
↓ [Re-verify failed scenario only]
|
|
28
|
+
Repeat until pass (stuck 감지로 종료)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Termination conditions (loop-contract JUDGE):**
|
|
32
|
+
- PASS → 다음 scenario
|
|
33
|
+
- stuck (같은 failure가 이전 라운드와 동일, `loop-ledger.js check-stuck`) → automationLevel confirm: 사용자 질문; autonomous: TODO + next scenario
|
|
34
|
+
|
|
35
|
+
**Stakes 프로파일 (SSOT: `vibe/rules/loop-contract.md` Stakes 표):**
|
|
36
|
+
- `demo`/`prototype` → max_iterations 1, 리뷰 1패스, **검증 스크립트 신규 생성 금지** — 검증은 기존 테스트 러너·브라우저 게이트만 사용한다. 새 verify_*.py / 검증 전용 스크립트 파일을 만들지 않는다.
|
|
37
|
+
- JUDGE 검증 산출물 절제 (모든 stakes): 이번 feature 신규 검증 코드 바이트 합이 신규 구현 코드 바이트 합을 초과하면 (`git diff --numstat` 기준) P2 경고를 run-ledger 에 기록한다. advisory — 게이트 통과 여부는 불변.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# ExecPlan — Self-Contained Execution Plan Generator
|
|
2
|
+
|
|
3
|
+
> vibe.run 내부 구현. **Step 1-0 (execution packet 컴파일) 에서만 로드한다.**
|
|
4
|
+
|
|
5
|
+
# ExecPlan — Self-Contained Execution Plan Generator
|
|
6
|
+
|
|
7
|
+
> **Principle**: "If the agent can't see it, it doesn't exist." Every decision, file path, pattern, and verification step must be explicit in the plan — no implicit knowledge allowed.
|
|
8
|
+
|
|
9
|
+
## When to Use
|
|
10
|
+
|
|
11
|
+
Before `/vibe.run`, generate an ExecPlan to make execution deterministic:
|
|
12
|
+
|
|
13
|
+
| Scenario | Signal |
|
|
14
|
+
|----------|--------|
|
|
15
|
+
| Complex SPEC (3+ phases) | Agent needs long autonomous execution |
|
|
16
|
+
| Team/multi-agent execution | Multiple agents need shared understanding |
|
|
17
|
+
| Context window pressure | Plan survives `/new` session handoff |
|
|
18
|
+
| Unfamiliar codebase | Agent can't rely on implicit knowledge |
|
|
19
|
+
|
|
20
|
+
## Core Flow
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
SPEC + Feature → ANALYZE → RESOLVE → GENERATE → PERSIST
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Step 1: ANALYZE — Extract Everything Needed
|
|
27
|
+
|
|
28
|
+
Read the SPEC and Feature files, then extract:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
For each Phase → For each Scenario:
|
|
32
|
+
1. Requirements (REQ-* IDs)
|
|
33
|
+
2. Given/When/Then conditions
|
|
34
|
+
3. Affected files (MUST exist — verify with Glob)
|
|
35
|
+
4. Dependencies (imports, packages)
|
|
36
|
+
5. Existing patterns to follow (read actual code, don't assume)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Parallel exploration** (3+ agents):
|
|
40
|
+
- Agent 1: Map all file paths mentioned/implied in SPEC → verify they exist
|
|
41
|
+
- Agent 2: For each affected file, extract current interfaces/types/exports
|
|
42
|
+
- Agent 3: Find existing patterns (naming conventions, error handling, test structure)
|
|
43
|
+
|
|
44
|
+
### Step 2: RESOLVE — Eliminate All Ambiguity
|
|
45
|
+
|
|
46
|
+
For every decision point in the SPEC, resolve it NOW:
|
|
47
|
+
|
|
48
|
+
| Ambiguity | Resolution |
|
|
49
|
+
|-----------|------------|
|
|
50
|
+
| "Add validation" | → Which fields? What rules? What error messages? |
|
|
51
|
+
| "Handle errors" | → Which error codes? What response format? |
|
|
52
|
+
| "Follow existing pattern" | → Copy the ACTUAL pattern code into the plan |
|
|
53
|
+
| "Update tests" | → Which test file? What test framework? What assertions? |
|
|
54
|
+
|
|
55
|
+
**Rule**: If you'd need to "figure it out later", resolve it now. The plan must be executable by an agent with ZERO codebase knowledge.
|
|
56
|
+
|
|
57
|
+
### Step 3: GENERATE — Write the ExecPlan
|
|
58
|
+
|
|
59
|
+
Output format: `.vibe/specs/{feature-name}-execplan.md`
|
|
60
|
+
|
|
61
|
+
```markdown
|
|
62
|
+
# ExecPlan: {feature-name}
|
|
63
|
+
|
|
64
|
+
## Meta
|
|
65
|
+
- SPEC: .vibe/specs/{name}.md
|
|
66
|
+
- Feature: .vibe/features/{name}.feature
|
|
67
|
+
- Generated: {timestamp}
|
|
68
|
+
- Phases: {count}
|
|
69
|
+
- Scenarios: {count}
|
|
70
|
+
|
|
71
|
+
## Pre-flight Checks
|
|
72
|
+
- [ ] `npm run build` passes
|
|
73
|
+
- [ ] `npx vitest run` passes (baseline)
|
|
74
|
+
- [ ] Required files exist: {list}
|
|
75
|
+
|
|
76
|
+
## Phase {N}: {phase-name}
|
|
77
|
+
|
|
78
|
+
### Environment
|
|
79
|
+
- Files to modify: {exact paths}
|
|
80
|
+
- Files to create: {exact paths}
|
|
81
|
+
- Dependencies to add: {package@version}
|
|
82
|
+
- Patterns to follow: (inline code snippets from codebase)
|
|
83
|
+
|
|
84
|
+
### Scenario {N}.{M}: {scenario-name}
|
|
85
|
+
|
|
86
|
+
**Given**: {precondition}
|
|
87
|
+
→ Setup: {exact code/commands to establish precondition}
|
|
88
|
+
|
|
89
|
+
**When**: {action}
|
|
90
|
+
→ Implement: {step-by-step implementation instructions}
|
|
91
|
+
- File: {path}
|
|
92
|
+
- Location: after line containing `{anchor text}`
|
|
93
|
+
- Code: (inline snippet)
|
|
94
|
+
- Imports needed: {list}
|
|
95
|
+
|
|
96
|
+
**Then**: {expected result}
|
|
97
|
+
→ Verify:
|
|
98
|
+
- Command: `{test command}`
|
|
99
|
+
- Expected: {output/behavior}
|
|
100
|
+
- Fallback: {what to do if verification fails}
|
|
101
|
+
|
|
102
|
+
### Phase {N} Gate
|
|
103
|
+
- [ ] Build: `npm run build`
|
|
104
|
+
- [ ] Tests: `npx vitest run {relevant-test-files}`
|
|
105
|
+
- [ ] Type check: `npx tsc --noEmit`
|
|
106
|
+
|
|
107
|
+
## Completion Criteria
|
|
108
|
+
- Coverage threshold: ≥95%
|
|
109
|
+
- All scenarios passing
|
|
110
|
+
- No regressions in existing tests
|
|
111
|
+
- RTM: `generateTraceabilityMatrix("{feature-name}")`
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Step 4: PERSIST — Save and Link
|
|
115
|
+
|
|
116
|
+
1. Save ExecPlan to `.vibe/specs/{feature-name}-execplan.md`
|
|
117
|
+
2. Save session context: `save_memory("execplan-{feature}", {summary})`
|
|
118
|
+
3. Output execution command:
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
Ready to execute:
|
|
122
|
+
/vibe.run "{feature-name}" ultrawork
|
|
123
|
+
|
|
124
|
+
Or hand off to new session:
|
|
125
|
+
/vibe.continue
|
|
126
|
+
→ Load: .vibe/specs/{feature-name}-execplan.md
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Quality Checks
|
|
130
|
+
|
|
131
|
+
| Check | Criteria |
|
|
132
|
+
|-------|----------|
|
|
133
|
+
| No implicit knowledge | Every file path verified with Glob |
|
|
134
|
+
| No "figure it out" | Every decision resolved with actual code |
|
|
135
|
+
| Survives handoff | Plan readable without any prior context |
|
|
136
|
+
| Inline patterns | Actual code snippets, not "follow existing pattern" |
|
|
137
|
+
| Verification steps | Every scenario has a concrete verification command |
|
|
138
|
+
|
|
139
|
+
## Anti-patterns
|
|
140
|
+
|
|
141
|
+
- "See the existing implementation" → Copy the relevant code inline
|
|
142
|
+
- "Follow the pattern in X" → Show the actual pattern
|
|
143
|
+
- "Standard error handling" → Specify exact error codes and messages
|
|
144
|
+
- "Update tests accordingly" → Name the test file, framework, and assertions
|
|
145
|
+
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# vibe.run — Tools, Guidelines & Retrospective
|
|
2
|
+
|
|
3
|
+
> vibe.run SKILL.md 에서 참조. 시맨틱 분석·메모리 도구, 코딩 가이드라인, rules 참조표, TRUST 5, 자동 회고 템플릿.
|
|
4
|
+
|
|
5
|
+
## Core Tools (Semantic Analysis & Memory)
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# All tools via:
|
|
9
|
+
node -e "import('{{VIBE_PATH_URL}}/node_modules/@su-record/vibe/dist/tools/index.js').then(t => t.TOOL_NAME({...args}).then(r => console.log(r.content[0].text)))"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
| Tool | Purpose |
|
|
13
|
+
|------|---------|
|
|
14
|
+
| `analyzeComplexity` | Analyze code complexity |
|
|
15
|
+
| `validateCodeQuality` | Validate code quality |
|
|
16
|
+
| `saveMemory` | Save important decisions |
|
|
17
|
+
| `recallMemory` | Recall saved memory |
|
|
18
|
+
| `listMemories` | List all memories |
|
|
19
|
+
|
|
20
|
+
Session management: explicitly load the latest checkpoint at start and persist a
|
|
21
|
+
checkpoint before context reset. Lifecycle hooks may accelerate those steps when
|
|
22
|
+
available, but completion never depends on them.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Coding Guidelines (Mandatory)
|
|
27
|
+
|
|
28
|
+
> Read `references/race-review.md` for full type safety guidelines, language-specific examples, and the type-violation detection/escalation table.
|
|
29
|
+
|
|
30
|
+
**TypeScript — core rule:**
|
|
31
|
+
```typescript
|
|
32
|
+
// BAD
|
|
33
|
+
function process(data: any): any { return data.foo; }
|
|
34
|
+
|
|
35
|
+
// GOOD
|
|
36
|
+
function process(data: unknown): Result {
|
|
37
|
+
if (isValidData(data)) return data.foo;
|
|
38
|
+
throw new Error('Invalid');
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
No `any` / `as any` / `@ts-ignore` — fix at root. Explicit return types on all functions.
|
|
43
|
+
|
|
44
|
+
**Detection outcome:** Run the project's explicit static type check and treat a
|
|
45
|
+
non-zero exit as JUDGE failure. Harness diagnostics or auto-commit hooks may
|
|
46
|
+
surface the same violations earlier, but they do not replace the command result.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Rules Reference
|
|
51
|
+
|
|
52
|
+
- `core/development-philosophy.md` — Surgical precision, modify only requested scope
|
|
53
|
+
- `core/quick-start.md` — Korean, DRY, SRP, YAGNI
|
|
54
|
+
- `standards/complexity-metrics.md` — Functions ≤50 lines, nesting ≤3 levels
|
|
55
|
+
- `quality/checklist.md` — Code quality checklist
|
|
56
|
+
- Language guide: `~/.claude/vibe/languages/{stack}.md`
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## TRUST 5 Principles
|
|
61
|
+
|
|
62
|
+
| Principle | Description |
|
|
63
|
+
|-----------|-------------|
|
|
64
|
+
| **T**est-first | Write tests first |
|
|
65
|
+
| **R**eadable | Clear code |
|
|
66
|
+
| **U**nified | Consistent style |
|
|
67
|
+
| **S**ecured | Consider security |
|
|
68
|
+
| **T**rackable | Logging, monitoring |
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Auto-Retrospective (Post-Implementation)
|
|
73
|
+
|
|
74
|
+
After ALL phases complete, save to `.vibe/retros/{feature-name}.md`:
|
|
75
|
+
|
|
76
|
+
```markdown
|
|
77
|
+
## Retrospective: {feature-name}
|
|
78
|
+
### What Worked / What Didn't / Key Decisions / Lessons Learned
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Keep under 20 lines. Record key lessons in the project progress/checkpoint artifact and update `claude-progress.txt`.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# vibe.run — Process Steps 1–8 (상세)
|
|
2
|
+
|
|
3
|
+
> vibe.run SKILL.md 의 Process 표에서 참조. 각 단계의 전체 절차·체크포인트 템플릿·코드 예시.
|
|
4
|
+
|
|
5
|
+
### 1. Load SPEC + Feature
|
|
6
|
+
|
|
7
|
+
**Search order:**
|
|
8
|
+
```
|
|
9
|
+
Step 1: Check split structure (folder)
|
|
10
|
+
.vibe/specs/{feature-name}/ → Folder: _index.md + phase files
|
|
11
|
+
.vibe/features/{feature-name}/ → Folder: _index.feature + phase files
|
|
12
|
+
|
|
13
|
+
Step 2: If no folder, check single file
|
|
14
|
+
.vibe/specs/{feature-name}.md
|
|
15
|
+
.vibe/features/{feature-name}.feature
|
|
16
|
+
|
|
17
|
+
Step 3: If neither → Error: "Run /vibe.spec first"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Split structure:** Load `_index.md` first, then phase files in order. Execute phases sequentially (or per `--phase` flag).
|
|
21
|
+
|
|
22
|
+
### 1-0. Compile + validate execution packet (MANDATORY)
|
|
23
|
+
|
|
24
|
+
For a monolithic SPEC, compile it after resolving the canonical path. For a split SPEC, do not compile `_index.md`; defer this step until each active phase file is loaded in Phase Isolation Step B. Compile with `writeExecutionPacket`, then immediately verify the saved artifact with `validateExecutionPacket`.
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
node -e "import('file://{{VIBE_PATH}}/dist/tools/index.js').then(t => {
|
|
28
|
+
const projectPath=process.cwd(), specPath='.vibe/specs/{feature-name}.md';
|
|
29
|
+
const profile='{codex-or-claude-code}';
|
|
30
|
+
const written=t.writeExecutionPacket({projectPath,specPath,profile});
|
|
31
|
+
if(!written.ok){console.error(JSON.stringify(written.errors));process.exit(1)}
|
|
32
|
+
const checked=t.validateExecutionPacket({projectPath,specPath,packetPath:written.packetPath});
|
|
33
|
+
if(!checked.valid){console.error(checked.code);process.exit(1)}
|
|
34
|
+
console.log(written.packetPath);
|
|
35
|
+
})"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
- Codex uses profile `codex`; Claude Code uses `claude-code`.
|
|
39
|
+
- Split SPECs compile each active `phase-N-*.md` immediately before that phase runs; `_index.md` remains the overview ANCHOR and is not treated as a phase contract.
|
|
40
|
+
- Use the packet only when validation returns `valid: true`.
|
|
41
|
+
- `STALE_PACKET`, invalid packet, preservation-audit failure, or budget failure is blocking: recompile from the canonical SPEC and never silently fall back to an unvalidated packet.
|
|
42
|
+
- The packet is a derived execution view. The canonical SPEC remains the ANCHOR and source of truth.
|
|
43
|
+
|
|
44
|
+
### 1-1. Phase Isolation Protocol (Large SPEC Guard, MANDATORY for 3+ phases)
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
Step A: Read _index.md (overview only — phase list, REQ IDs)
|
|
48
|
+
Step B: For each Phase N:
|
|
49
|
+
1. RE-READ Phase N SPEC section (every time, no memory)
|
|
50
|
+
2. Compile + validate Phase N execution packet using the phase file path
|
|
51
|
+
3. RE-READ Phase N Feature scenarios
|
|
52
|
+
4. Extract Phase N scope: files, scenarios, requirements
|
|
53
|
+
5. Implement Phase N scenarios
|
|
54
|
+
6. Verify Phase N
|
|
55
|
+
7. Write Phase Checkpoint → .vibe/checkpoints/
|
|
56
|
+
8. DISCARD Phase N details from working memory
|
|
57
|
+
Step C: Next Phase
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Phase Checkpoint** (`.vibe/checkpoints/{feature}-phase-{N}.md`):
|
|
61
|
+
|
|
62
|
+
```markdown
|
|
63
|
+
# Checkpoint: {feature} Phase {N}
|
|
64
|
+
|
|
65
|
+
## Completed
|
|
66
|
+
- Scenario 1: {name} ✅
|
|
67
|
+
|
|
68
|
+
## Files Changed
|
|
69
|
+
- src/auth.service.ts (added login(), validateToken())
|
|
70
|
+
|
|
71
|
+
## State for Next Phase
|
|
72
|
+
- Auth service exports: login(), logout(), validateToken()
|
|
73
|
+
|
|
74
|
+
## Remaining Phases
|
|
75
|
+
- Phase {N+1}: {name} — {scenario count} scenarios
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**SPEC Re-anchoring (Before EVERY scenario):** Re-read the EXACT Given/When/Then from Feature file (not from memory). Compare: "Am I implementing what the SPEC says, or what I think it says?"
|
|
79
|
+
|
|
80
|
+
**Scope Lock (Per Phase):**
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
At Phase start, declare:
|
|
84
|
+
MODIFY: [list of files this phase will touch]
|
|
85
|
+
CREATE: [list of files this phase will create]
|
|
86
|
+
DO NOT TOUCH: everything else
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Context Pressure:**
|
|
90
|
+
|
|
91
|
+
| Context Level | Action |
|
|
92
|
+
|---------------|--------|
|
|
93
|
+
| < 50% | Normal execution |
|
|
94
|
+
| 50-85% | Save checkpoint, trim exploration results |
|
|
95
|
+
| 85%+ | Save checkpoint → `/new` → resume from checkpoint |
|
|
96
|
+
| Phase boundary | Always save checkpoint |
|
|
97
|
+
|
|
98
|
+
### 1-2. SPEC-First Gate
|
|
99
|
+
|
|
100
|
+
> SPEC is the source of truth for code. To modify code, update the SPEC first.
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
Discovery: "An API endpoint not in SPEC is needed"
|
|
104
|
+
├─ Already in SPEC? YES → Implement
|
|
105
|
+
├─ Not in SPEC but within scope? → Add to SPEC + Feature → Implement
|
|
106
|
+
└─ Outside scope? → TODO in .vibe/todos/out-of-scope-{item}.md
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
SPEC changes and code changes must be in the **same commit**.
|
|
110
|
+
|
|
111
|
+
### 2. Extract Scenario List
|
|
112
|
+
|
|
113
|
+
```markdown
|
|
114
|
+
| # | Scenario | Status |
|
|
115
|
+
|---|----------|--------|
|
|
116
|
+
| 1 | Valid login success | ⬜ |
|
|
117
|
+
| 2 | Invalid password error | ⬜ |
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 3. Scenario-by-Scenario Implementation
|
|
121
|
+
|
|
122
|
+
> Read `references/parallel-agents.md` for full parallel exploration patterns, background agents, parallel subagent group selection, and model routing.
|
|
123
|
+
|
|
124
|
+
**For each scenario:**
|
|
125
|
+
1. [Parallel exploration] Delegate up to 3 independent workers through native collaboration — related code, deps, patterns. Claude Code maps workers to Task/Agent; Codex maps them to native collaboration; inherit the session model by default.
|
|
126
|
+
2. [Implement] Write/edit the minimum required code
|
|
127
|
+
3. [Verify] Check Given/When/Then; E2E if UI scenario
|
|
128
|
+
4. [Auto-fix loop] On failure: collect evidence → root cause → fix → re-verify
|
|
129
|
+
|
|
130
|
+
**UI/UX Design Intelligence (auto-triggered before Phase 1 if UI keywords in SPEC):**
|
|
131
|
+
- Delegate `design-system-gen` through native collaboration: framework-specific component guidelines + chart/viz library advice (viz advice conditional on chart keywords). Inherit the session model.
|
|
132
|
+
- Load `.vibe/design-system/{project}/MASTER.md` if present
|
|
133
|
+
|
|
134
|
+
### 4. Brand Assets (New project only)
|
|
135
|
+
|
|
136
|
+
> Read `references/brand-assets.md` when SPEC contains brand context and this is the first run.
|
|
137
|
+
|
|
138
|
+
Trigger conditions: first run (no favicon.ico) + SPEC has brand context + Antigravity API key configured.
|
|
139
|
+
|
|
140
|
+
### 5. Race Code Review
|
|
141
|
+
|
|
142
|
+
> Read `references/race-review.md` for full Race Review invocation, confidence matrix, and quality gate thresholds.
|
|
143
|
+
|
|
144
|
+
After all scenarios: GPT + Antigravity review in parallel. ULTRAWORK enables this by default.
|
|
145
|
+
|
|
146
|
+
### 6. Quality Report (Auto-generated)
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
150
|
+
│ QUALITY REPORT: {feature} │
|
|
151
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
152
|
+
│ Scenarios: N/N passed │
|
|
153
|
+
│ Quality score: 94/100 │
|
|
154
|
+
│ Build: ✅ | Tests: ✅ | Types: ✅ | Race review: ✅ │
|
|
155
|
+
│ Started: {start_time} Completed: {system clock result} │
|
|
156
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### 7. Update Feature File
|
|
160
|
+
|
|
161
|
+
Auto-update scenario status with `Last verified` timestamp and quality score.
|
|
162
|
+
|
|
163
|
+
### 8. Coverage Verification Loop (RTM)
|
|
164
|
+
|
|
165
|
+
> 루프 시맨틱은 `vibe/rules/loop-contract.md`를 따른다. 여기서의 exit 기준은 `coveragePercent === 100`. RTM 다이어그램, 출력 형식, 반복 규칙: `references/ralph-loop.md`
|
|
166
|
+
|
|
167
|
+
After ALL phases complete:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# generateTraceabilityMatrix is synchronous — no .then()
|
|
171
|
+
node -e "import('{{VIBE_PATH_URL}}/node_modules/@su-record/vibe/dist/tools/index.js').then(t => { const r = t.generateTraceabilityMatrix('{feature-name}', {projectPath: process.cwd()}); console.log(JSON.stringify(r, null, 2)); })"
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
> Default SPEC path is `.vibe/specs/<feature>.md`. `status === 'empty'` must be treated as failed/not-applicable — never as 100% pass.
|
|
175
|
+
|
|
176
|
+
JUDGE: `coveragePercent === 100` → 루프 종료. stuck(연속 2회 동일 커버리지) → automationLevel confirm이면 사용자 질문; autonomous이면 TODO + done.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Restraint — Don't Write It, Don't Tune It (Yet)
|
|
2
|
+
|
|
3
|
+
> vibe.run 내부 구현. YAGNI 사다리 · Pike 최적화 규칙 · 차단 충동 · 무효화 불가 예외의 전문.
|
|
4
|
+
|
|
5
|
+
# Restraint — Don't Write It, Don't Tune It (Yet)
|
|
6
|
+
|
|
7
|
+
Two constraints, one gate:
|
|
8
|
+
|
|
9
|
+
- **No premature code.** New abstractions must be *pulled* by a demonstrated
|
|
10
|
+
need, never pushed by "might need it later." Once the code exists, deleting
|
|
11
|
+
it costs more than never writing it.
|
|
12
|
+
- **No premature optimization.** Performance work must be *pulled* by a
|
|
13
|
+
measurement, never by a hunch.
|
|
14
|
+
|
|
15
|
+
## The YAGNI Ladder (code axis)
|
|
16
|
+
|
|
17
|
+
Satisfy the need at the **highest** rung that covers it; lower rungs are
|
|
18
|
+
blocked while a higher one applies:
|
|
19
|
+
|
|
20
|
+
1. **Not needed** — the requirement doesn't ask for it → don't build it
|
|
21
|
+
2. **Stdlib / built-ins** already do it (`crypto`, `Intl`, `pathlib`, …)
|
|
22
|
+
3. **Native platform feature** does it (`<input type="date">`, CSS `:has()`, DB constraints)
|
|
23
|
+
4. **Already-installed dependency** covers it — check the lockfile, don't guess
|
|
24
|
+
5. **One line** — a single expression; no new file, no class
|
|
25
|
+
6. **Minimal code** — only now, and nothing for "later"
|
|
26
|
+
|
|
27
|
+
Tie-break: native beats a one-liner; stdlib beats a dependency. Generalize
|
|
28
|
+
only when a *second* caller exists.
|
|
29
|
+
|
|
30
|
+
## Pike's Rules (optimization axis)
|
|
31
|
+
|
|
32
|
+
- You can't tell where a program spends its time — bottlenecks surprise.
|
|
33
|
+
**Measure; don't guess.**
|
|
34
|
+
- Don't tune until one part *measurably* overwhelms the rest.
|
|
35
|
+
- Fancy algorithms are slow when n is small — and n is usually small.
|
|
36
|
+
Ask "what's n?" before "what's the Big-O?"
|
|
37
|
+
- Simple algorithms + the right data structures beat clever code. Data dominates.
|
|
38
|
+
|
|
39
|
+
Optimization is justified only when ALL hold: a measured bottleneck exists →
|
|
40
|
+
it dominates runtime → the fix is the simplest change addressing it → you
|
|
41
|
+
re-measure after.
|
|
42
|
+
|
|
43
|
+
## Blocked Impulses
|
|
44
|
+
|
|
45
|
+
| Impulse | Constraint | Counter |
|
|
46
|
+
|---|---|---|
|
|
47
|
+
| helper / utility / wrapper / manager class | rungs 1–5 | a stdlib call or one line usually suffices |
|
|
48
|
+
| config system for one value | rung 1 | a `const` is the config |
|
|
49
|
+
| generic `Processor(strategy, validator…)` | rung 1 | one concrete function until a second caller exists |
|
|
50
|
+
| "add a cache here" / "parallelize this" | measure first | is this path even hot? Often it's I/O |
|
|
51
|
+
| swap in a B-tree / trie / skip list | what's n? | O(n²) with n=100 is microseconds |
|
|
52
|
+
| "this loop looks slow" | measure first | the bottleneck is probably elsewhere |
|
|
53
|
+
|
|
54
|
+
## Overrides — Restraint Never Erodes These
|
|
55
|
+
|
|
56
|
+
1. **Security and trust-boundary work are requirements**, not optional
|
|
57
|
+
complexity. Input validation, auth checks, escaping stay in — "one line"
|
|
58
|
+
is no excuse to drop them.
|
|
59
|
+
2. **Deliberate simplifications get a comment + upgrade path**, so the next
|
|
60
|
+
reader sees a *choice*, not an oversight:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
// Global lock is enough at current throughput.
|
|
64
|
+
// Switch to per-account locking if write contention shows up.
|
|
65
|
+
const lock = new Mutex();
|
|
66
|
+
```
|