invar-tools 1.17.22__py3-none-any.whl → 1.17.23__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/shell/config.py CHANGED
@@ -366,34 +366,44 @@ def load_config(project_root: Path) -> Result[RuleConfig, str]:
366
366
  3. .invar/config.toml [guard]
367
367
  4. Built-in defaults
368
368
 
369
+ If pyproject.toml exists but has no [tool.invar.guard] section,
370
+ continues to check other sources (fallback behavior).
371
+
369
372
  Args:
370
373
  project_root: Path to project root directory
371
374
 
372
375
  Returns:
373
376
  Result containing RuleConfig or error message
374
377
  """
375
- find_result = _find_config_source(project_root)
376
- if isinstance(find_result, Failure):
377
- return find_result
378
- config_path, source = find_result.unwrap()
378
+ # Try each config source in priority order
379
+ sources_to_try: list[tuple[Path, ConfigSource]] = []
379
380
 
380
- if source == "default":
381
- return Success(RuleConfig())
381
+ pyproject = project_root / "pyproject.toml"
382
+ if pyproject.exists():
383
+ sources_to_try.append((pyproject, "pyproject"))
382
384
 
383
- assert config_path is not None # source != "default" guarantees path exists
384
- result = _read_toml(config_path)
385
+ invar_toml = project_root / "invar.toml"
386
+ if invar_toml.exists():
387
+ sources_to_try.append((invar_toml, "invar"))
385
388
 
386
- if isinstance(result, Failure):
387
- return result
389
+ invar_config = project_root / ".invar" / "config.toml"
390
+ if invar_config.exists():
391
+ sources_to_try.append((invar_config, "invar_dir"))
388
392
 
389
- data = result.unwrap()
390
- guard_config = extract_guard_section(data, source)
393
+ # Try each source, fallback if no guard config found
394
+ for config_path, source in sources_to_try:
395
+ result = _read_toml(config_path)
396
+ if isinstance(result, Failure):
397
+ continue # Skip unreadable files
398
+
399
+ data = result.unwrap()
400
+ guard_config = extract_guard_section(data, source)
391
401
 
392
- # For pyproject.toml, if no [tool.invar.guard] section, use defaults
393
- if source == "pyproject" and not guard_config:
394
- return Success(RuleConfig())
402
+ if guard_config: # Found valid guard config
403
+ return Success(parse_guard_config(guard_config))
395
404
 
396
- return Success(parse_guard_config(guard_config))
405
+ # No config found in any source, use defaults
406
+ return Success(RuleConfig())
397
407
 
398
408
 
399
409
  # Default paths for Core/Shell classification
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: invar-tools
3
- Version: 1.17.22
3
+ Version: 1.17.23
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
@@ -2657,7 +2657,7 @@ invar/node_tools/quick-check/cli.js,sha256=dwV3hdJleFQga2cKUn3PPfQDvvujhzKdjQcIv
2657
2657
  invar/node_tools/ts-analyzer/cli.js,sha256=SvZ6HyjmobpP8NAZqXFiy8BwH_t5Hb17Ytar_18udaQ,4092887
2658
2658
  invar/shell/__init__.py,sha256=FFw1mNbh_97PeKPcHIqQpQ7mw-JoIvyLM1yOdxLw5uk,204
2659
2659
  invar/shell/claude_hooks.py,sha256=hV4DfG3cVng32f0Rxoo070tliVlYFC5v9slIWEbAD7E,18899
2660
- invar/shell/config.py,sha256=6N4AvhYPSUzd3YGXPIc8edF6Lp492W-cS8wwnHUJotI,18119
2660
+ invar/shell/config.py,sha256=Q8HI_bYz3mwKTAuG4JYjiXt0kXCdQdWZ0hZn3xy9r-M,18570
2661
2661
  invar/shell/contract_coverage.py,sha256=81OQkQqUVYUKytG5aiJyRK62gwh9UzbSG926vkvFTc8,12088
2662
2662
  invar/shell/coverage.py,sha256=m01o898IFIdBztEBQLwwL1Vt5PWrpUntO4lv4nWEkls,11344
2663
2663
  invar/shell/doc_tools.py,sha256=16gvo_ay9-_EK6lX16WkiRGg4OfTAKK_i0ucQkE7lbI,15149
@@ -2778,10 +2778,10 @@ invar/templates/skills/invar-reflect/template.md,sha256=Rr5hvbllvmd8jSLf_0ZjyKt6
2778
2778
  invar/templates/skills/investigate/SKILL.md.jinja,sha256=cp6TBEixBYh1rLeeHOR1yqEnFqv1NZYePORMnavLkQI,3231
2779
2779
  invar/templates/skills/propose/SKILL.md.jinja,sha256=6BuKiCqO1AEu3VtzMHy1QWGqr_xqG9eJlhbsKT4jev4,3463
2780
2780
  invar/templates/skills/review/SKILL.md.jinja,sha256=ET5mbdSe_eKgJbi2LbgFC-z1aviKcHOBw7J5Q28fr4U,14105
2781
- invar_tools-1.17.22.dist-info/METADATA,sha256=LcLYpawRN5vHSOQWJkxa1MH8TIMhTsROH0XBK1J5PCQ,28582
2782
- invar_tools-1.17.22.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
2783
- invar_tools-1.17.22.dist-info/entry_points.txt,sha256=RwH_EhqgtFPsnO6RcrwrAb70Zyfb8Mh6uUtztWnUxGk,102
2784
- invar_tools-1.17.22.dist-info/licenses/LICENSE,sha256=qeFksp4H4kfTgQxPCIu3OdagXyiZcgBlVfsQ6M5oFyk,10767
2785
- invar_tools-1.17.22.dist-info/licenses/LICENSE-GPL,sha256=IvZfC6ZbP7CLjytoHVzvpDZpD-Z3R_qa1GdMdWlWQ6Q,35157
2786
- invar_tools-1.17.22.dist-info/licenses/NOTICE,sha256=joEyMyFhFY8Vd8tTJ-a3SirI0m2Sd0WjzqYt3sdcglc,2561
2787
- invar_tools-1.17.22.dist-info/RECORD,,
2781
+ invar_tools-1.17.23.dist-info/METADATA,sha256=GEpstDi-UqTQlgkBB_WpmhT30NWcAkX3ULm9CxAklBc,28582
2782
+ invar_tools-1.17.23.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
2783
+ invar_tools-1.17.23.dist-info/entry_points.txt,sha256=RwH_EhqgtFPsnO6RcrwrAb70Zyfb8Mh6uUtztWnUxGk,102
2784
+ invar_tools-1.17.23.dist-info/licenses/LICENSE,sha256=qeFksp4H4kfTgQxPCIu3OdagXyiZcgBlVfsQ6M5oFyk,10767
2785
+ invar_tools-1.17.23.dist-info/licenses/LICENSE-GPL,sha256=IvZfC6ZbP7CLjytoHVzvpDZpD-Z3R_qa1GdMdWlWQ6Q,35157
2786
+ invar_tools-1.17.23.dist-info/licenses/NOTICE,sha256=joEyMyFhFY8Vd8tTJ-a3SirI0m2Sd0WjzqYt3sdcglc,2561
2787
+ invar_tools-1.17.23.dist-info/RECORD,,