invar-tools 1.8.0__py3-none-any.whl → 1.11.0__py3-none-any.whl
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.
- invar/__init__.py +8 -0
- invar/core/doc_edit.py +187 -0
- invar/core/doc_parser.py +563 -0
- invar/core/language.py +88 -0
- invar/core/models.py +106 -0
- invar/core/patterns/detector.py +6 -1
- invar/core/patterns/p0_exhaustive.py +15 -3
- invar/core/patterns/p0_literal.py +15 -3
- invar/core/patterns/p0_newtype.py +15 -3
- invar/core/patterns/p0_nonempty.py +15 -3
- invar/core/patterns/p0_validation.py +15 -3
- invar/core/patterns/registry.py +5 -1
- invar/core/patterns/types.py +5 -1
- invar/core/property_gen.py +4 -0
- invar/core/rules.py +84 -18
- invar/core/sync_helpers.py +27 -1
- invar/core/ts_parsers.py +286 -0
- invar/core/ts_sig_parser.py +310 -0
- invar/mcp/handlers.py +408 -0
- invar/mcp/server.py +288 -143
- invar/node_tools/MANIFEST +7 -0
- invar/node_tools/__init__.py +51 -0
- invar/node_tools/fc-runner/cli.js +77 -0
- invar/node_tools/quick-check/cli.js +28 -0
- invar/node_tools/ts-analyzer/cli.js +480 -0
- invar/shell/claude_hooks.py +35 -12
- invar/shell/commands/doc.py +409 -0
- invar/shell/commands/guard.py +41 -1
- invar/shell/commands/init.py +154 -16
- invar/shell/commands/perception.py +157 -33
- invar/shell/commands/skill.py +187 -0
- invar/shell/commands/template_sync.py +65 -13
- invar/shell/commands/uninstall.py +60 -12
- invar/shell/commands/update.py +6 -14
- invar/shell/contract_coverage.py +1 -0
- invar/shell/doc_tools.py +459 -0
- invar/shell/fs.py +67 -13
- invar/shell/pi_hooks.py +6 -0
- invar/shell/prove/crosshair.py +3 -0
- invar/shell/prove/guard_ts.py +902 -0
- invar/shell/skill_manager.py +355 -0
- invar/shell/template_engine.py +28 -4
- invar/shell/templates.py +4 -4
- invar/templates/claude-md/python/critical-rules.md +33 -0
- invar/templates/claude-md/python/quick-reference.md +24 -0
- invar/templates/claude-md/typescript/critical-rules.md +40 -0
- invar/templates/claude-md/typescript/quick-reference.md +24 -0
- invar/templates/claude-md/universal/check-in.md +25 -0
- invar/templates/claude-md/universal/skills.md +73 -0
- invar/templates/claude-md/universal/workflow.md +55 -0
- invar/templates/commands/{audit.md → audit.md.jinja} +18 -1
- invar/templates/config/AGENT.md.jinja +58 -0
- invar/templates/config/CLAUDE.md.jinja +16 -209
- invar/templates/config/context.md.jinja +19 -0
- invar/templates/examples/{README.md → python/README.md} +2 -0
- invar/templates/examples/{conftest.py → python/conftest.py} +1 -1
- invar/templates/examples/{contracts.py → python/contracts.py} +81 -4
- invar/templates/examples/python/core_shell.py +227 -0
- invar/templates/examples/python/functional.py +613 -0
- invar/templates/examples/typescript/README.md +31 -0
- invar/templates/examples/typescript/contracts.ts +163 -0
- invar/templates/examples/typescript/core_shell.ts +374 -0
- invar/templates/examples/typescript/functional.ts +601 -0
- invar/templates/examples/typescript/workflow.md +95 -0
- invar/templates/hooks/PostToolUse.sh.jinja +10 -1
- invar/templates/hooks/PreToolUse.sh.jinja +38 -0
- invar/templates/hooks/Stop.sh.jinja +1 -1
- invar/templates/hooks/UserPromptSubmit.sh.jinja +7 -0
- invar/templates/hooks/pi/invar.ts.jinja +9 -0
- invar/templates/manifest.toml +7 -6
- invar/templates/onboard/assessment.md.jinja +214 -0
- invar/templates/onboard/patterns/python.md +347 -0
- invar/templates/onboard/patterns/typescript.md +452 -0
- invar/templates/onboard/roadmap.md.jinja +168 -0
- invar/templates/protocol/INVAR.md.jinja +51 -0
- invar/templates/protocol/python/architecture-examples.md +41 -0
- invar/templates/protocol/python/contracts-syntax.md +56 -0
- invar/templates/protocol/python/markers.md +44 -0
- invar/templates/protocol/python/tools.md +24 -0
- invar/templates/protocol/python/troubleshooting.md +38 -0
- invar/templates/protocol/typescript/architecture-examples.md +52 -0
- invar/templates/protocol/typescript/contracts-syntax.md +73 -0
- invar/templates/protocol/typescript/markers.md +48 -0
- invar/templates/protocol/typescript/tools.md +65 -0
- invar/templates/protocol/typescript/troubleshooting.md +104 -0
- invar/templates/protocol/universal/architecture.md +36 -0
- invar/templates/protocol/universal/completion.md +14 -0
- invar/templates/protocol/universal/contracts-concept.md +37 -0
- invar/templates/protocol/universal/header.md +17 -0
- invar/templates/protocol/universal/session.md +17 -0
- invar/templates/protocol/universal/six-laws.md +10 -0
- invar/templates/protocol/universal/usbv.md +14 -0
- invar/templates/protocol/universal/visible-workflow.md +25 -0
- invar/templates/skills/develop/SKILL.md.jinja +85 -3
- invar/templates/skills/extensions/_registry.yaml +93 -0
- invar/templates/skills/extensions/acceptance/SKILL.md +383 -0
- invar/templates/skills/extensions/invar-onboard/SKILL.md +448 -0
- invar/templates/skills/extensions/invar-onboard/patterns/python.md +347 -0
- invar/templates/skills/extensions/invar-onboard/patterns/typescript.md +452 -0
- invar/templates/skills/extensions/invar-onboard/templates/assessment.md.jinja +214 -0
- invar/templates/skills/extensions/invar-onboard/templates/roadmap.md.jinja +168 -0
- invar/templates/skills/extensions/security/SKILL.md +382 -0
- invar/templates/skills/extensions/security/patterns/_common.yaml +126 -0
- invar/templates/skills/extensions/security/patterns/python.yaml +155 -0
- invar/templates/skills/extensions/security/patterns/typescript.yaml +194 -0
- invar/templates/skills/review/SKILL.md.jinja +220 -248
- {invar_tools-1.8.0.dist-info → invar_tools-1.11.0.dist-info}/METADATA +336 -12
- invar_tools-1.11.0.dist-info/RECORD +178 -0
- invar/templates/examples/core_shell.py +0 -127
- invar/templates/protocol/INVAR.md +0 -310
- invar_tools-1.8.0.dist-info/RECORD +0 -116
- /invar/templates/examples/{workflow.md → python/workflow.md} +0 -0
- {invar_tools-1.8.0.dist-info → invar_tools-1.11.0.dist-info}/WHEEL +0 -0
- {invar_tools-1.8.0.dist-info → invar_tools-1.11.0.dist-info}/entry_points.txt +0 -0
- {invar_tools-1.8.0.dist-info → invar_tools-1.11.0.dist-info}/licenses/LICENSE +0 -0
- {invar_tools-1.8.0.dist-info → invar_tools-1.11.0.dist-info}/licenses/LICENSE-GPL +0 -0
- {invar_tools-1.8.0.dist-info → invar_tools-1.11.0.dist-info}/licenses/NOTICE +0 -0
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
<!--invar:skill-->
|
|
2
|
+
# /invar-onboard — Legacy Project Onboarding
|
|
3
|
+
|
|
4
|
+
> Extension Skill | Tier: T1 | Isolation: Default
|
|
5
|
+
|
|
6
|
+
## Purpose
|
|
7
|
+
|
|
8
|
+
Evaluate and plan migration of existing (legacy) projects to the Invar framework. Provides structured assessment, discussion, and planning workflow.
|
|
9
|
+
|
|
10
|
+
## Triggers
|
|
11
|
+
|
|
12
|
+
Use this skill when user says: "onboard", "migrate to invar", "can this project use invar", "invar assessment"
|
|
13
|
+
|
|
14
|
+
## Relationship to Core Skills
|
|
15
|
+
|
|
16
|
+
| Skill | Purpose | Timing |
|
|
17
|
+
|-------|---------|--------|
|
|
18
|
+
| `/invar-onboard` | One-time migration assessment | Before Invar adoption |
|
|
19
|
+
| `/develop` | Day-to-day implementation | After Invar adoption |
|
|
20
|
+
| `/review` | Code quality verification | After Invar adoption |
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
Non-Invar Project → /invar-onboard → Invar Project → /develop, /review
|
|
24
|
+
(one-time) (continuous)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Core Principles
|
|
30
|
+
|
|
31
|
+
| Principle | Description |
|
|
32
|
+
|-----------|-------------|
|
|
33
|
+
| **Claude as parser** | Use LLM understanding, no language-specific code |
|
|
34
|
+
| **Deep analysis only** | Refactoring is major decision, no quick scan |
|
|
35
|
+
| **Human checkpoint** | Pause after assessment for user confirmation |
|
|
36
|
+
| **Cross-project capable** | Can assess projects outside current directory |
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Input
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
/invar-onboard [path]
|
|
44
|
+
|
|
45
|
+
path: Target project path (optional, defaults to current directory)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Workflow
|
|
51
|
+
|
|
52
|
+
### Phase 1: ASSESS (Automatic)
|
|
53
|
+
|
|
54
|
+
Deep analysis of target project. **No user interaction required.**
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
Step 1: Discovery
|
|
58
|
+
├── Glob scan for source files
|
|
59
|
+
├── Detect package.json / pyproject.toml / go.mod
|
|
60
|
+
├── Identify primary language and framework
|
|
61
|
+
└── Calculate code metrics (LOC, files)
|
|
62
|
+
|
|
63
|
+
Step 2: Architecture Analysis
|
|
64
|
+
├── Identify layering pattern (MVC, Clean, etc.)
|
|
65
|
+
├── Map module dependencies
|
|
66
|
+
├── Detect existing test framework
|
|
67
|
+
└── Identify entry points
|
|
68
|
+
|
|
69
|
+
Step 3: Pattern Detection
|
|
70
|
+
├── Error handling (throw / Result / error return)
|
|
71
|
+
├── Validation (Zod / Pydantic / manual)
|
|
72
|
+
├── Dependency injection
|
|
73
|
+
└── Logging/monitoring patterns
|
|
74
|
+
|
|
75
|
+
Step 4: Gap Analysis
|
|
76
|
+
├── Core/Shell separation status
|
|
77
|
+
├── Contract coverage estimation
|
|
78
|
+
├── Test coverage assessment
|
|
79
|
+
└── Documentation coverage
|
|
80
|
+
|
|
81
|
+
Step 5: Risk Assessment
|
|
82
|
+
├── Complexity hotspots
|
|
83
|
+
├── Dependency risks
|
|
84
|
+
├── Refactoring blockers
|
|
85
|
+
└── Regression risk areas
|
|
86
|
+
|
|
87
|
+
Step 6: Estimation
|
|
88
|
+
├── LOC per layer
|
|
89
|
+
├── Complexity factors
|
|
90
|
+
├── Risk buffer (×1.3-1.5)
|
|
91
|
+
└── Total effort estimate
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Output:** `docs/invar-onboard-assessment.md`
|
|
95
|
+
|
|
96
|
+
**Display after Phase 1:**
|
|
97
|
+
```
|
|
98
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
99
|
+
📋 ASSESSMENT COMPLETE
|
|
100
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
101
|
+
|
|
102
|
+
| Metric | Value |
|
|
103
|
+
|--------|-------|
|
|
104
|
+
| Language | {language} |
|
|
105
|
+
| Code Size | {loc} lines / {files} files |
|
|
106
|
+
| Invar Compatibility | {compatibility}% |
|
|
107
|
+
| Estimated Effort | {days} days |
|
|
108
|
+
| Risk Level | {risk} |
|
|
109
|
+
|
|
110
|
+
Key Decision Points:
|
|
111
|
+
1. {decision_1}
|
|
112
|
+
2. {decision_2}
|
|
113
|
+
|
|
114
|
+
Proceed to planning phase? [Y/n]
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
### Phase 2: DISCUSS (With User)
|
|
120
|
+
|
|
121
|
+
Present findings and gather user input. **Requires explicit user confirmation.**
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
1. Summary Display
|
|
125
|
+
- Invar compatibility score (0-100%)
|
|
126
|
+
- Estimated effort (days)
|
|
127
|
+
- Risk level (Low/Medium/High)
|
|
128
|
+
|
|
129
|
+
2. Key Decision Points
|
|
130
|
+
- Error handling strategy (Result vs throw)
|
|
131
|
+
- Core extraction priority
|
|
132
|
+
- Test coverage requirements
|
|
133
|
+
|
|
134
|
+
3. Risk Discussion
|
|
135
|
+
- Identified blockers
|
|
136
|
+
- Mitigation options
|
|
137
|
+
- Scope adjustment suggestions
|
|
138
|
+
|
|
139
|
+
4. Confirmation
|
|
140
|
+
- "Proceed to planning phase? [Y/n]"
|
|
141
|
+
- Option to abort or adjust scope
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Gate:** User must explicitly confirm to proceed to Phase 3.
|
|
145
|
+
|
|
146
|
+
If user says "no" or "stop" → End skill with assessment only.
|
|
147
|
+
If user says "yes" or "proceed" → Continue to Phase 3.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
### Phase 3: PLAN (Automatic)
|
|
152
|
+
|
|
153
|
+
Generate detailed migration roadmap. **Only after user confirmation.**
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
Step 1: Load Assessment
|
|
157
|
+
├── Read assessment report
|
|
158
|
+
├── Extract metrics and gaps
|
|
159
|
+
└── Apply user preferences from discussion
|
|
160
|
+
|
|
161
|
+
Step 2: Dependency Analysis
|
|
162
|
+
├── Map file dependencies
|
|
163
|
+
├── Determine refactoring order
|
|
164
|
+
└── Identify parallelization opportunities
|
|
165
|
+
|
|
166
|
+
Step 3: Phase Decomposition
|
|
167
|
+
├── Group by layer (Repository → Service → Actions)
|
|
168
|
+
├── Estimate per-file effort
|
|
169
|
+
└── Define Gate criteria for each phase
|
|
170
|
+
|
|
171
|
+
Step 4: Session Planning
|
|
172
|
+
├── Break into agent sessions (2-3 files each)
|
|
173
|
+
├── Allocate context checkpoints
|
|
174
|
+
└── Define verification points
|
|
175
|
+
|
|
176
|
+
Step 5: Risk Mitigation
|
|
177
|
+
├── Define rollback points
|
|
178
|
+
├── Identify verification gates
|
|
179
|
+
└── Plan E2E test checkpoints
|
|
180
|
+
|
|
181
|
+
Step 6: Generate Roadmap
|
|
182
|
+
└── Write docs/invar-onboard-roadmap.md
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Output:** `docs/invar-onboard-roadmap.md`
|
|
186
|
+
|
|
187
|
+
**Display after Phase 3:**
|
|
188
|
+
```
|
|
189
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
190
|
+
📋 ROADMAP GENERATED
|
|
191
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
192
|
+
|
|
193
|
+
Phase breakdown:
|
|
194
|
+
1. Foundation ({days_1} days) - Error types, Result infrastructure
|
|
195
|
+
2. Core Extraction ({days_2} days) - Pure function isolation
|
|
196
|
+
3. Shell Refactor ({days_3} days) - I/O layer conversion
|
|
197
|
+
4. Contracts ({days_4} days) - @pre/@post / Zod schemas
|
|
198
|
+
5. Validation ({days_5} days) - Guard integration
|
|
199
|
+
|
|
200
|
+
Total: {total_days} days
|
|
201
|
+
|
|
202
|
+
Next step: Execute Phase 1 using /develop
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Language Adapters
|
|
208
|
+
|
|
209
|
+
Load patterns based on detected language. Pattern files are located at `.invar/templates/onboard/patterns/` after `invar init`:
|
|
210
|
+
|
|
211
|
+
| Language | Pattern File | Library |
|
|
212
|
+
|----------|--------------|---------|
|
|
213
|
+
| Python | `.invar/templates/onboard/patterns/python.md` | `returns` |
|
|
214
|
+
| TypeScript | `.invar/templates/onboard/patterns/typescript.md` | `neverthrow` |
|
|
215
|
+
|
|
216
|
+
**Note:** If running from Invar project itself, patterns are at `src/invar/templates/onboard/patterns/`.
|
|
217
|
+
|
|
218
|
+
**Pattern file contains:**
|
|
219
|
+
1. Error handling transformation examples
|
|
220
|
+
2. Contract syntax (Python: @pre/@post, TypeScript: Zod)
|
|
221
|
+
3. Core/Shell directory structure
|
|
222
|
+
4. Framework integration (FastAPI, Next.js)
|
|
223
|
+
5. Must-keep-throw scenarios
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Assessment Report Structure
|
|
228
|
+
|
|
229
|
+
```markdown
|
|
230
|
+
# Invar Onboarding Assessment
|
|
231
|
+
|
|
232
|
+
> Project: {project_name}
|
|
233
|
+
> Assessed: {timestamp}
|
|
234
|
+
> Invar Version: {invar_version}
|
|
235
|
+
|
|
236
|
+
## 1. Summary
|
|
237
|
+
|
|
238
|
+
| Metric | Value |
|
|
239
|
+
|--------|-------|
|
|
240
|
+
| Primary Language | {language} |
|
|
241
|
+
| Framework | {framework} |
|
|
242
|
+
| Code Size | {loc} lines / {files} files |
|
|
243
|
+
| Test Coverage | {test_type}: {test_count} tests |
|
|
244
|
+
| **Invar Compatibility** | **{compatibility}%** |
|
|
245
|
+
| **Estimated Effort** | **{total_days} days** |
|
|
246
|
+
| **Risk Level** | **{risk_level}** |
|
|
247
|
+
|
|
248
|
+
## 2. Architecture Analysis
|
|
249
|
+
|
|
250
|
+
### 2.1 Layer Structure
|
|
251
|
+
{architecture_diagram}
|
|
252
|
+
|
|
253
|
+
### 2.2 Dependency Map
|
|
254
|
+
{dependency_map}
|
|
255
|
+
|
|
256
|
+
## 3. Pattern Analysis
|
|
257
|
+
|
|
258
|
+
| Dimension | Current | Invar Target | Gap |
|
|
259
|
+
|-----------|---------|--------------|-----|
|
|
260
|
+
| Error Handling | {current_error} | Result[T, E] / Result<T, E> | {gap_error} |
|
|
261
|
+
| Validation | {current_validation} | @pre/@post / Zod | {gap_validation} |
|
|
262
|
+
| Core/Shell | {current_separation} | Explicit separation | {gap_separation} |
|
|
263
|
+
| Testing | {current_test} | Doctest + Property | {gap_test} |
|
|
264
|
+
|
|
265
|
+
## 4. Risk Assessment
|
|
266
|
+
|
|
267
|
+
### 4.1 High Risk Areas
|
|
268
|
+
{high_risk_areas}
|
|
269
|
+
|
|
270
|
+
### 4.2 Blockers
|
|
271
|
+
{blockers}
|
|
272
|
+
|
|
273
|
+
### 4.3 Dependency Risks
|
|
274
|
+
{dependency_risks}
|
|
275
|
+
|
|
276
|
+
## 5. Effort Breakdown
|
|
277
|
+
|
|
278
|
+
| Phase | Scope | Estimate |
|
|
279
|
+
|-------|-------|----------|
|
|
280
|
+
| Foundation | Error types, Result infrastructure | {phase1_days} days |
|
|
281
|
+
| Core Extraction | Pure function isolation | {phase2_days} days |
|
|
282
|
+
| Shell Refactor | I/O layer Result conversion | {phase3_days} days |
|
|
283
|
+
| Contracts | @pre/@post / Zod schemas | {phase4_days} days |
|
|
284
|
+
| Validation | Guard integration, test coverage | {phase5_days} days |
|
|
285
|
+
| **Total** | | **{total_days} days** |
|
|
286
|
+
|
|
287
|
+
## 6. Recommendations
|
|
288
|
+
|
|
289
|
+
### 6.1 Suggested Approach
|
|
290
|
+
{recommendation}
|
|
291
|
+
|
|
292
|
+
### 6.2 Prerequisites
|
|
293
|
+
- [ ] E2E test coverage > 80% for critical paths
|
|
294
|
+
- [ ] Result library installed (neverthrow / returns)
|
|
295
|
+
- [ ] Error type hierarchy defined
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
*Generated by /invar-onboard*
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## Roadmap Structure
|
|
305
|
+
|
|
306
|
+
```markdown
|
|
307
|
+
# Invar Onboarding Roadmap
|
|
308
|
+
|
|
309
|
+
> Project: {project_name}
|
|
310
|
+
> Generated: {timestamp}
|
|
311
|
+
> Based on: docs/invar-onboard-assessment.md
|
|
312
|
+
|
|
313
|
+
## Overview
|
|
314
|
+
|
|
315
|
+
| Metric | Value |
|
|
316
|
+
|--------|-------|
|
|
317
|
+
| Total Phases | 5 |
|
|
318
|
+
| Total Days | {total_days} |
|
|
319
|
+
| Agent Sessions | {session_count} |
|
|
320
|
+
|
|
321
|
+
## Phase 1: Foundation ({days} days)
|
|
322
|
+
|
|
323
|
+
### Objective
|
|
324
|
+
Establish error types and Result infrastructure.
|
|
325
|
+
|
|
326
|
+
### Tasks
|
|
327
|
+
| Day | Files | Scope |
|
|
328
|
+
|-----|-------|-------|
|
|
329
|
+
| 1 | errors/types.ts | Define error type hierarchy |
|
|
330
|
+
| 1 | lib/result.ts | Result helper utilities |
|
|
331
|
+
|
|
332
|
+
### Gate Checklist
|
|
333
|
+
- [ ] Error types defined
|
|
334
|
+
- [ ] Result helpers working
|
|
335
|
+
- [ ] E2E tests still pass
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## Phase 2: Core Extraction ({days} days)
|
|
340
|
+
|
|
341
|
+
### Objective
|
|
342
|
+
Extract pure functions to Core layer.
|
|
343
|
+
|
|
344
|
+
### Sessions
|
|
345
|
+
| Session | Files | Estimated |
|
|
346
|
+
|---------|-------|-----------|
|
|
347
|
+
| 2.1 | validation/*.ts | 0.5 day |
|
|
348
|
+
| 2.2 | calculation/*.ts | 0.5 day |
|
|
349
|
+
|
|
350
|
+
### Gate Checklist
|
|
351
|
+
- [ ] Core functions have no I/O
|
|
352
|
+
- [ ] All Core functions have contracts
|
|
353
|
+
- [ ] E2E tests still pass
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
[Continue for remaining phases...]
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## Rollback Strategy
|
|
362
|
+
|
|
363
|
+
| Phase | Rollback Point | Recovery Action |
|
|
364
|
+
|-------|----------------|-----------------|
|
|
365
|
+
| 1 | Pre-Foundation | Revert error types |
|
|
366
|
+
| 2 | Pre-Core | Revert Core extraction |
|
|
367
|
+
| 3 | Pre-Shell | Revert Shell changes |
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
*Generated by /invar-onboard*
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
## Detection Patterns
|
|
377
|
+
|
|
378
|
+
### Error Handling Detection
|
|
379
|
+
|
|
380
|
+
| Pattern | Regex |
|
|
381
|
+
|---------|-------|
|
|
382
|
+
| throw (JS/TS) | `throw new \w+Error` |
|
|
383
|
+
| raise (Python) | `raise \w+Error` |
|
|
384
|
+
| Result (Rust-style) | `Result<`, `Ok\(`, `Err\(` |
|
|
385
|
+
| neverthrow (TS) | `ok\(`, `err\(`, `ResultAsync` |
|
|
386
|
+
| returns (Python) | `Success\(`, `Failure\(`, `Result\[` |
|
|
387
|
+
|
|
388
|
+
### Validation Detection
|
|
389
|
+
|
|
390
|
+
| Pattern | Detection |
|
|
391
|
+
|---------|-----------|
|
|
392
|
+
| Zod | `z.object`, `z.string`, `.safeParse` |
|
|
393
|
+
| Pydantic | `BaseModel`, `Field`, `validator` |
|
|
394
|
+
| Joi | `Joi.object`, `Joi.string` |
|
|
395
|
+
| Manual | `if (!x) throw`, `if x is None: raise` |
|
|
396
|
+
|
|
397
|
+
### Architecture Detection
|
|
398
|
+
|
|
399
|
+
| Pattern | Detection |
|
|
400
|
+
|---------|-----------|
|
|
401
|
+
| MVC | `controllers/`, `models/`, `views/` |
|
|
402
|
+
| Clean | `domain/`, `application/`, `infrastructure/` |
|
|
403
|
+
| Layered | Repository, Service, Controller naming |
|
|
404
|
+
|
|
405
|
+
---
|
|
406
|
+
|
|
407
|
+
## Effort Estimation Formula
|
|
408
|
+
|
|
409
|
+
```
|
|
410
|
+
Base effort = LOC / 100 (days)
|
|
411
|
+
|
|
412
|
+
Adjustments:
|
|
413
|
+
× 1.2 if no existing tests
|
|
414
|
+
× 1.3 if complex dependencies
|
|
415
|
+
× 1.5 if high-risk areas identified
|
|
416
|
+
× 0.8 if Result library already used
|
|
417
|
+
|
|
418
|
+
Total = Base × Adjustments
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
## Installation
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
# Copy skill to project
|
|
427
|
+
cp -r src/invar/templates/skills/extensions/invar-onboard .claude/skills/
|
|
428
|
+
|
|
429
|
+
# Ensure pattern files are synced (via invar init/update)
|
|
430
|
+
invar update
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
**Note:** Pattern files at `.invar/templates/onboard/patterns/` are synced automatically by `invar init` or `invar update`.
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
*Extension Skill v1.0 — LX-09*
|
|
438
|
+
<!--/invar:skill--><!--invar:extensions-->
|
|
439
|
+
<!-- ========================================================================
|
|
440
|
+
EXTENSIONS REGION - USER EDITABLE
|
|
441
|
+
Add project-specific extensions here. This section is preserved on update.
|
|
442
|
+
|
|
443
|
+
Examples of what to add:
|
|
444
|
+
- Custom assessment criteria for your tech stack
|
|
445
|
+
- Organization-specific migration guidelines
|
|
446
|
+
- Additional language adapters
|
|
447
|
+
======================================================================== -->
|
|
448
|
+
<!--/invar:extensions-->
|