invar-tools 1.3.0__py3-none-any.whl → 1.3.1__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.
Files changed (28) hide show
  1. invar/shell/claude_hooks.py +387 -0
  2. invar/shell/commands/guard.py +2 -0
  3. invar/shell/commands/hooks.py +74 -0
  4. invar/shell/commands/init.py +30 -0
  5. invar/shell/commands/template_sync.py +42 -11
  6. invar/shell/commands/test.py +1 -1
  7. invar/templates/CLAUDE.md.template +25 -5
  8. invar/templates/config/CLAUDE.md.jinja +16 -0
  9. invar/templates/config/context.md.jinja +11 -6
  10. invar/templates/context.md.template +35 -18
  11. invar/templates/hooks/PostToolUse.sh.jinja +102 -0
  12. invar/templates/hooks/PreToolUse.sh.jinja +74 -0
  13. invar/templates/hooks/Stop.sh.jinja +23 -0
  14. invar/templates/hooks/UserPromptSubmit.sh.jinja +77 -0
  15. invar/templates/hooks/__init__.py +1 -0
  16. invar/templates/manifest.toml +2 -2
  17. invar/templates/protocol/INVAR.md +105 -6
  18. invar/templates/skills/develop/SKILL.md.jinja +4 -7
  19. invar/templates/skills/investigate/SKILL.md.jinja +4 -7
  20. invar/templates/skills/propose/SKILL.md.jinja +4 -7
  21. invar/templates/skills/review/SKILL.md.jinja +63 -15
  22. {invar_tools-1.3.0.dist-info → invar_tools-1.3.1.dist-info}/METADATA +1 -1
  23. {invar_tools-1.3.0.dist-info → invar_tools-1.3.1.dist-info}/RECORD +28 -21
  24. {invar_tools-1.3.0.dist-info → invar_tools-1.3.1.dist-info}/WHEEL +0 -0
  25. {invar_tools-1.3.0.dist-info → invar_tools-1.3.1.dist-info}/entry_points.txt +0 -0
  26. {invar_tools-1.3.0.dist-info → invar_tools-1.3.1.dist-info}/licenses/LICENSE +0 -0
  27. {invar_tools-1.3.0.dist-info → invar_tools-1.3.1.dist-info}/licenses/LICENSE-GPL +0 -0
  28. {invar_tools-1.3.0.dist-info → invar_tools-1.3.1.dist-info}/licenses/NOTICE +0 -0
@@ -1,13 +1,11 @@
1
- <!--invar:skill version="{{ version }}"-->
2
- <!-- ========================================================================
3
- SKILL REGION - DO NOT EDIT
4
- This section is managed by Invar and will be overwritten on update.
5
- To add project-specific extensions, use the "extensions" region below.
6
- ======================================================================== -->
7
1
  ---
8
2
  name: propose
9
3
  description: Decision facilitation phase. Use when design decision is needed, multiple approaches are valid, or user asks "should we", "how should", "which", "compare", "design", "architect". Presents options with trade-offs for human choice.
4
+ _invar:
5
+ version: "{{ version }}"
6
+ managed: skill
10
7
  ---
8
+ <!--invar:skill-->
11
9
 
12
10
  # Proposal Mode
13
11
 
@@ -89,7 +87,6 @@ Create `docs/proposals/DX-XX-[topic].md`:
89
87
  | Needs more info | /investigate for analysis |
90
88
  | Approves proposal | Document created |
91
89
  <!--/invar:skill-->
92
-
93
90
  <!--invar:extensions-->
94
91
  <!-- ========================================================================
95
92
  EXTENSIONS REGION - USER EDITABLE
@@ -1,19 +1,30 @@
1
- <!--invar:skill version="{{ version }}"-->
2
- <!-- ========================================================================
3
- SKILL REGION - DO NOT EDIT
4
- This section is managed by Invar and will be overwritten on update.
5
- To add project-specific extensions, use the "extensions" region below.
6
- ======================================================================== -->
7
1
  ---
8
2
  name: review
9
3
  description: Adversarial code review with fix loop. Use after development, when Guard reports review_suggested, or user explicitly requests review. Finds issues that automated verification misses. Supports isolated mode (sub-agent) and quick mode (same context).
4
+ _invar:
5
+ version: "{{ version }}"
6
+ managed: skill
10
7
  ---
8
+ <!--invar:skill-->
11
9
 
12
10
  # Review Mode
13
11
 
14
12
  > **Purpose:** Find problems that Guard, doctests, and property tests missed.
15
13
  > **Mindset:** Adversarial. Your success is measured by problems found, not code approved.
16
14
 
15
+ ## Adversarial Reviewer Persona
16
+
17
+ Assume:
18
+ - The code has bugs until proven otherwise
19
+ - The contracts may be meaningless ceremony
20
+ - The implementer may have rationalized poor decisions
21
+ - Escape hatches may be abused
22
+
23
+ You ARE here to:
24
+ - Find bugs, logic errors, edge cases
25
+ - Challenge whether contracts have semantic value
26
+ - Check if code matches contracts (not if code "seems right")
27
+
17
28
  ## Entry Actions
18
29
 
19
30
  ### Context Refresh (DX-54)
@@ -50,23 +61,61 @@ WARNING: review_suggested - Low contract coverage
50
61
 
51
62
  ## Review Checklist
52
63
 
64
+ > **Principle:** Only items requiring semantic judgment. Mechanical checks are handled by Guard.
65
+
53
66
  ### A. Contract Semantic Value
54
67
  - [ ] Does @pre constrain inputs beyond type checking?
68
+ - Bad: `@pre(lambda x: isinstance(x, int))`
69
+ - Good: `@pre(lambda x: x > 0 and x < MAX_VALUE)`
55
70
  - [ ] Does @post verify meaningful output properties?
71
+ - Bad: `@post(lambda result: result is not None)`
72
+ - Good: `@post(lambda result: len(result) == len(input))`
56
73
  - [ ] Could someone implement correctly from contracts alone?
74
+ - [ ] Are boundary conditions explicit in contracts?
57
75
 
58
- ### B. Logic Verification
59
- - [ ] Do contracts correctly capture intended behavior?
60
- - [ ] Are there paths bypassing contract checks?
61
- - [ ] Is there dead code or unreachable branches?
76
+ ### B. Doctest Coverage
77
+ - [ ] Do doctests cover normal cases?
78
+ - [ ] Do doctests cover boundary cases?
79
+ - [ ] Do doctests cover error cases?
80
+ - [ ] Are doctests testing behavior, not just syntax?
62
81
 
63
- ### C. Escape Hatch Audit
82
+ ### C. Code Quality
83
+ - [ ] Is duplicated code worth extracting?
84
+ - [ ] Is naming consistent and clear?
85
+ - [ ] Is complexity justified?
86
+
87
+ ### D. Escape Hatch Audit
64
88
  - [ ] Is each @invar:allow justification valid?
65
89
  - [ ] Could refactoring eliminate the need?
90
+ - [ ] Is there a pattern suggesting systematic issues?
91
+
92
+ ### E. Logic Verification
93
+ - [ ] Do contracts correctly capture intended behavior?
94
+ - [ ] Are there paths that bypass contract checks?
95
+ - [ ] Are there implicit assumptions not in contracts?
96
+ - [ ] Is there dead code or unreachable branches?
66
97
 
67
- ### D. Security (if applicable)
68
- - [ ] Input validation against injection, XSS?
69
- - [ ] No hardcoded secrets?
98
+ ### F. Security
99
+ - [ ] Are inputs validated against security threats (injection, XSS)?
100
+ - [ ] No hardcoded secrets (API keys, passwords, tokens)?
101
+ - [ ] Are authentication/authorization checks correct?
102
+ - [ ] Is sensitive data properly protected?
103
+
104
+ ### G. Error Handling & Observability
105
+ - [ ] Are exceptions caught at appropriate level?
106
+ - [ ] Are error messages clear without leaking sensitive info?
107
+ - [ ] Are critical operations logged for debugging?
108
+ - [ ] Is there graceful degradation on failure?
109
+
110
+ ## Excluded (Covered by Guard)
111
+
112
+ These are checked by Guard or linters - don't duplicate:
113
+ - Core/Shell separation → Guard (forbidden_import, impure_call)
114
+ - Shell returns Result[T,E] → Guard (shell_result)
115
+ - Missing contracts → Guard (missing_contract)
116
+ - File/function size limits → Guard (file_size, function_size)
117
+ - Entry point thickness → Guard (entry_point_too_thick)
118
+ - Escape hatch count → Guard (review_suggested)
70
119
 
71
120
  ## Review-Fix Loop
72
121
 
@@ -110,7 +159,6 @@ Convergence check:
110
159
  - [ ] Needs more work: [issues]
111
160
  ```
112
161
  <!--/invar:skill-->
113
-
114
162
  <!--invar:extensions-->
115
163
  <!-- ========================================================================
116
164
  EXTENSIONS REGION - USER EDITABLE
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: invar-tools
3
- Version: 1.3.0
3
+ Version: 1.3.1
4
4
  Summary: AI-native software engineering tools with design-by-contract verification
5
5
  Project-URL: Homepage, https://github.com/tefx/invar
6
6
  Project-URL: Documentation, https://github.com/tefx/invar#readme
@@ -35,6 +35,7 @@ invar/mcp/__init__.py,sha256=n3S7QwMjSMqOMT8cI2jf9E0yZPjKmBOJyIYhq4WZ8TQ,226
35
35
  invar/mcp/__main__.py,sha256=ZcIT2U6xUyGOWucl4jq422BDE3lRLjqyxb9pFylRBdk,219
36
36
  invar/mcp/server.py,sha256=0a9eAuIZ62UaDGewKhAn8-PhLYvFHta-w_XcygcXCtE,11981
37
37
  invar/shell/__init__.py,sha256=FFw1mNbh_97PeKPcHIqQpQ7mw-JoIvyLM1yOdxLw5uk,204
38
+ invar/shell/claude_hooks.py,sha256=kxkdF2gwTWcGpglccDi6-8IN1zRwelDG6Lg1VPYQgyA,12912
38
39
  invar/shell/config.py,sha256=cixlq47h8HYa9Ku-JOo66KCUyrf59R0NX_Yb7A1fAv4,16134
39
40
  invar/shell/coverage.py,sha256=m01o898IFIdBztEBQLwwL1Vt5PWrpUntO4lv4nWEkls,11344
40
41
  invar/shell/fs.py,sha256=wVD7DPWsCIJXuTyY_pi-5_LS82mXRdn_grJCOLn9zpU,3699
@@ -49,47 +50,53 @@ invar/shell/template_engine.py,sha256=IzOiGsKVFo0lDUdtg27wMzIJJKToclv151RDZuDnHH
49
50
  invar/shell/templates.py,sha256=l2En95E8jRVlojdQIqdZgRLVB43f_b1d_AJapKkozwA,15908
50
51
  invar/shell/testing.py,sha256=PTrrCB0nIARuDQa_XREoRzbnqjXxju1l9Eb83pivH6c,10634
51
52
  invar/shell/commands/__init__.py,sha256=MEkKwVyjI9DmkvBpJcuumXo2Pg_FFkfEr-Rr3nrAt7A,284
52
- invar/shell/commands/guard.py,sha256=0v4kfDyxIEl3iZiYjCeTwTgAEUnL-DvCKSvXaDwqRX8,17895
53
- invar/shell/commands/init.py,sha256=K8nz1D3RqWPUr61-gYnMiSg-9cRnnYXPCR-4x37LMQA,17004
53
+ invar/shell/commands/guard.py,sha256=aYqOhxclt_oF93TcSGN1zaB4RUsSQjMUYxfBw2QmqoM,18038
54
+ invar/shell/commands/hooks.py,sha256=W-SOnT4VQyUvXwipozkJwgEYfiOJGz7wksrbcdWegUg,2356
55
+ invar/shell/commands/init.py,sha256=UzHLfAP9ddIY32HrLd32nUveFcHnB0HlbMcIgtfob9Y,18297
54
56
  invar/shell/commands/merge.py,sha256=nuvKo8m32-OL-SCQlS4SLKmOZxQ3qj-1nGCx1Pgzifw,8183
55
57
  invar/shell/commands/mutate.py,sha256=GwemiO6LlbGCBEQsBFnzZuKhF-wIMEl79GAMnKUWc8U,5765
56
58
  invar/shell/commands/perception.py,sha256=TyH_HpqyKkmE3-zcU4YyBG8ghwJaSFeRC-OQMVBDTbQ,3837
57
59
  invar/shell/commands/sync_self.py,sha256=nmqBry7V2_enKwy2zzHg8UoedZNicLe3yKDhjmBeZ68,3880
58
- invar/shell/commands/template_sync.py,sha256=g-IV4X1TGFVIypw9RBToexX7ZCSaCsD9yz-A0Sm-OmM,12155
59
- invar/shell/commands/test.py,sha256=DKnlSbUydKq6skHLLKhZGg42qTAKtiLxrTU3oyFDmAo,4189
60
+ invar/shell/commands/template_sync.py,sha256=wVZ-UvJ1wpN2UBcWMfbei0n46XHYx-zRbMA2oX6FSi4,13723
61
+ invar/shell/commands/test.py,sha256=goMf-ovvzEyWQMheq4YlJ-mwK5-w3lDj0cq0IA_1-_c,4205
60
62
  invar/shell/commands/update.py,sha256=0V5F8vxQ6PHPHPVYDmxdRD7xXeQEFypiJMYpY5ryiek,1349
61
63
  invar/shell/prove/__init__.py,sha256=ZqlbmyMFJf6yAle8634jFuPRv8wNvHps8loMlOJyf8A,240
62
64
  invar/shell/prove/accept.py,sha256=cnY_6jzU1EBnpLF8-zWUWcXiSXtCwxPsXEYXsSVPG38,3717
63
65
  invar/shell/prove/cache.py,sha256=jbNdrvfLjvK7S0iqugErqeabb4YIbQuwIlcSRyCKbcg,4105
64
66
  invar/shell/prove/crosshair.py,sha256=4Z_iIYBlkp-I6FqSYZa89wWB09V4Ouw2PduYhTn6rfw,16525
65
67
  invar/shell/prove/hypothesis.py,sha256=QUclOOUg_VB6wbmHw8O2EPiL5qBOeBRqQeM04AVuLw0,9880
66
- invar/templates/CLAUDE.md.template,sha256=W8o6M-wasCMg-7Ef2-RloDqvSKGS_9KUsy8DVbbUwDo,3719
68
+ invar/templates/CLAUDE.md.template,sha256=p2xFzbZ8NluumH9c03GkAQaqSOvgrG5SqyKU9qXz2HY,4498
67
69
  invar/templates/__init__.py,sha256=cb3ht8KPK5oBn5oG6HsTznujmo9WriJ_P--fVxJwycc,45
68
70
  invar/templates/aider.conf.yml.template,sha256=4xzSs3BXzFJvwdhnWbmzSY0yCbfx5oxqnV8ZjehqHBg,853
69
- invar/templates/context.md.template,sha256=p1-iHl32Z30-FocJa7slcmoA7gtQrUrMO7cE_u5MrSo,2073
71
+ invar/templates/context.md.template,sha256=FKyI1ghpqcf4wftyv9-auIFHor8Nm8lETN45Ja-L8Og,2386
70
72
  invar/templates/cursorrules.template,sha256=N6AiEJRJHGkHm2tswh3PnZ_07ozeyQQI8iEOGK5Aqoc,1023
71
- invar/templates/manifest.toml,sha256=5JxaY9nl9hK5d1qWc2OJEGID6bFSX_Dp39lc5kRoIXk,4252
73
+ invar/templates/manifest.toml,sha256=cEe7yEOOeaLmOF-PrwZXxiPGjHhsSJYkWBKRHDmSbac,4268
72
74
  invar/templates/pre-commit-config.yaml.template,sha256=2qWY3E8iDUqi85jE_X7y0atE88YOlL5IZ93wkjCgQGo,1737
73
75
  invar/templates/proposal.md.template,sha256=UP7SpQ7gk8jVlHGLQCSQ5c-kCj1DBQEz8M-vEStK77I,1573
74
76
  invar/templates/commands/audit.md,sha256=eXBySlQrVyk054vYQWAZYzj-HgT2QXhpzziw6GlIeGM,4112
75
77
  invar/templates/commands/guard.md,sha256=PyeAKfrmlXsgbrTDypQqXmTDKK1JHKhHEQrHqftA7X0,1177
76
- invar/templates/config/CLAUDE.md.jinja,sha256=bowI-vhIHJvTCL20L4dwFtPODvkTWTllH2TRRVUf-cg,6295
77
- invar/templates/config/context.md.jinja,sha256=sEQc-9jBqPpovlbnHSHcH7rwXVChfqDtUbYFTanStJI,2284
78
+ invar/templates/config/CLAUDE.md.jinja,sha256=tdGkWHkx4Xn7d02QQX0J_LN1p13VsvrUNYI_nLYanRE,6766
79
+ invar/templates/config/context.md.jinja,sha256=eyjNwvtSyDCImOw6up4eqfE_ylYWv2HCHMQ1M1qJtGQ,2563
78
80
  invar/templates/config/pre-commit.yaml.jinja,sha256=Qflmii8hngHciSgfa8mIlg3-E3D4b0xflm0-Q-cWcCc,1752
79
81
  invar/templates/examples/README.md,sha256=xMcJZ1KEcfLJi5Ope_4FIbqDWKK3mRleAgllvgeNT6I,572
80
82
  invar/templates/examples/conftest.py,sha256=uKA4NR7nyZWeSzY0URdZtw5zCcJpU32jNcaSKrI1Mxc,152
81
83
  invar/templates/examples/contracts.py,sha256=uqJ6Y1GADo246MjFKoLY-_2E74cfBQsLO4vTqYcR81c,3241
82
84
  invar/templates/examples/core_shell.py,sha256=ckor-7ZoaF7n8gVjnIO0CXlBjKGcVwmOGSDJbaXCSrM,4247
83
85
  invar/templates/examples/workflow.md,sha256=jAopzQH1xE9_leJFdav4oj1AkI46-a2q4L8RQCkDknw,2334
84
- invar/templates/protocol/INVAR.md,sha256=5u4q5PTVHHnJzRVEzfp4rXAfTHajIUNioRB4CQAs4JM,6662
85
- invar/templates/skills/develop/SKILL.md.jinja,sha256=A0Hnx9FlBfPXdk2Mswx0zOnDZbgszI3u5MvLVd2rlM4,9544
86
- invar/templates/skills/investigate/SKILL.md.jinja,sha256=vY6Hri5Nsy9C0JsLWU64NUitrPnBx49NtG0d4cg_FgI,3058
87
- invar/templates/skills/propose/SKILL.md.jinja,sha256=b_cw_EiAneSGSOMTJWu_j9UwIlW7h-xab39uQgFb5wY,2734
88
- invar/templates/skills/review/SKILL.md.jinja,sha256=hkLs5BHlzKNat4BdXNfgB3-3Bvz7C6gFEQJq-0hQHSk,3679
89
- invar_tools-1.3.0.dist-info/METADATA,sha256=Gwg9kdiPndJzHV5168zGSGKXw9O1IXvIEbIgCashDjQ,11656
90
- invar_tools-1.3.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
91
- invar_tools-1.3.0.dist-info/entry_points.txt,sha256=xjkp8_Kipb6KJR6VNfkAEqiOpvrwUnwUG53cegBA6pQ,57
92
- invar_tools-1.3.0.dist-info/licenses/LICENSE,sha256=qeFksp4H4kfTgQxPCIu3OdagXyiZcgBlVfsQ6M5oFyk,10767
93
- invar_tools-1.3.0.dist-info/licenses/LICENSE-GPL,sha256=IvZfC6ZbP7CLjytoHVzvpDZpD-Z3R_qa1GdMdWlWQ6Q,35157
94
- invar_tools-1.3.0.dist-info/licenses/NOTICE,sha256=joEyMyFhFY8Vd8tTJ-a3SirI0m2Sd0WjzqYt3sdcglc,2561
95
- invar_tools-1.3.0.dist-info/RECORD,,
86
+ invar/templates/hooks/PostToolUse.sh.jinja,sha256=H-lzVaEMvlr0uoO2LxrGNpWrBtyUkHmYrhtWmCqdAjI,2967
87
+ invar/templates/hooks/PreToolUse.sh.jinja,sha256=D39PaT1eFSjz_Av16xK1atoBZbhLI8tLp8L12zkG-3k,2334
88
+ invar/templates/hooks/Stop.sh.jinja,sha256=3S6lLeAGIu5aPQVRz4jjFS9AfjCD9DdS_jagmkw-x8Q,960
89
+ invar/templates/hooks/UserPromptSubmit.sh.jinja,sha256=eAQqQ-XdOCyhLpF5_1r1z7C-Ej9GQ5Isqbu_2LAtsno,2302
90
+ invar/templates/hooks/__init__.py,sha256=RnnMoQA-8eqbr8Y_1Vu9B8h5vAz4C-vmo8wgdcGYrz0,43
91
+ invar/templates/protocol/INVAR.md,sha256=Yjwvs0PK9sDUtNExXtS2g7nRV2LcUV22Xa0fY_K-_-0,9940
92
+ invar/templates/skills/develop/SKILL.md.jinja,sha256=AYlvhOnHW-EbuLnt8KwVweoKuV1p4v-6NJxFKrSyl_w,9230
93
+ invar/templates/skills/investigate/SKILL.md.jinja,sha256=bOLdLMH5WUVBYOo4NpsfyvI6xx7I1lCNr_X-8bMe_kg,2744
94
+ invar/templates/skills/propose/SKILL.md.jinja,sha256=_iDLYN6-cfzA8n0_8sv-Dnpm1xq9IIpcDyM10mU2WUA,2420
95
+ invar/templates/skills/review/SKILL.md.jinja,sha256=UDzhdjjzXKeR4olM6S2xHkw_Z-uznaBb9467O2_EOhY,5367
96
+ invar_tools-1.3.1.dist-info/METADATA,sha256=7Yux2a8jcfnHW5E5zC84TAwM9DS--CZ-YPn8yx1yzLI,11656
97
+ invar_tools-1.3.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
98
+ invar_tools-1.3.1.dist-info/entry_points.txt,sha256=xjkp8_Kipb6KJR6VNfkAEqiOpvrwUnwUG53cegBA6pQ,57
99
+ invar_tools-1.3.1.dist-info/licenses/LICENSE,sha256=qeFksp4H4kfTgQxPCIu3OdagXyiZcgBlVfsQ6M5oFyk,10767
100
+ invar_tools-1.3.1.dist-info/licenses/LICENSE-GPL,sha256=IvZfC6ZbP7CLjytoHVzvpDZpD-Z3R_qa1GdMdWlWQ6Q,35157
101
+ invar_tools-1.3.1.dist-info/licenses/NOTICE,sha256=joEyMyFhFY8Vd8tTJ-a3SirI0m2Sd0WjzqYt3sdcglc,2561
102
+ invar_tools-1.3.1.dist-info/RECORD,,