lorewell 0.4.1__tar.gz → 0.4.2__tar.gz

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 (30) hide show
  1. {lorewell-0.4.1 → lorewell-0.4.2}/PKG-INFO +1 -1
  2. {lorewell-0.4.1 → lorewell-0.4.2}/lorewell.py +43 -6
  3. {lorewell-0.4.1 → lorewell-0.4.2}/LICENSE +0 -0
  4. {lorewell-0.4.1 → lorewell-0.4.2}/README.md +0 -0
  5. {lorewell-0.4.1 → lorewell-0.4.2}/docs/RUNBOOK.md +0 -0
  6. {lorewell-0.4.1 → lorewell-0.4.2}/packs/jq/cheatsheet.md +0 -0
  7. {lorewell-0.4.1 → lorewell-0.4.2}/packs/jq/examples.jsonl +0 -0
  8. {lorewell-0.4.1 → lorewell-0.4.2}/packs/jq/pack.json +0 -0
  9. {lorewell-0.4.1 → lorewell-0.4.2}/packs/jq/sections.jsonl +0 -0
  10. {lorewell-0.4.1 → lorewell-0.4.2}/packs/jq/skill.md +0 -0
  11. {lorewell-0.4.1 → lorewell-0.4.2}/packs/jq/symbols.jsonl +0 -0
  12. {lorewell-0.4.1 → lorewell-0.4.2}/packs/jq/tools.jsonl +0 -0
  13. {lorewell-0.4.1 → lorewell-0.4.2}/packs/peoplesoft-pia/cheatsheet.md +0 -0
  14. {lorewell-0.4.1 → lorewell-0.4.2}/packs/peoplesoft-pia/examples.jsonl +0 -0
  15. {lorewell-0.4.1 → lorewell-0.4.2}/packs/peoplesoft-pia/files/fixture/content.html +0 -0
  16. {lorewell-0.4.1 → lorewell-0.4.2}/packs/peoplesoft-pia/files/fixture/homepage.html +0 -0
  17. {lorewell-0.4.1 → lorewell-0.4.2}/packs/peoplesoft-pia/files/fixture/portal.html +0 -0
  18. {lorewell-0.4.1 → lorewell-0.4.2}/packs/peoplesoft-pia/files/fixture/signon.html +0 -0
  19. {lorewell-0.4.1 → lorewell-0.4.2}/packs/peoplesoft-pia/files/run_snippet.py +0 -0
  20. {lorewell-0.4.1 → lorewell-0.4.2}/packs/peoplesoft-pia/pack.json +0 -0
  21. {lorewell-0.4.1 → lorewell-0.4.2}/packs/peoplesoft-pia/sections.jsonl +0 -0
  22. {lorewell-0.4.1 → lorewell-0.4.2}/packs/peoplesoft-pia/skill.md +0 -0
  23. {lorewell-0.4.1 → lorewell-0.4.2}/packs/peoplesoft-pia/symbols.jsonl +0 -0
  24. {lorewell-0.4.1 → lorewell-0.4.2}/packs/peoplesoft-pia/tools.jsonl +0 -0
  25. {lorewell-0.4.1 → lorewell-0.4.2}/pyproject.toml +0 -0
  26. {lorewell-0.4.1 → lorewell-0.4.2}/tests/fake_model.py +0 -0
  27. {lorewell-0.4.1 → lorewell-0.4.2}/tests/fakeps.py +0 -0
  28. {lorewell-0.4.1 → lorewell-0.4.2}/tests/test_build.py +0 -0
  29. {lorewell-0.4.1 → lorewell-0.4.2}/tests/test_lorewell.py +0 -0
  30. {lorewell-0.4.1 → lorewell-0.4.2}/tests/test_workspace.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lorewell
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: Reference packs for languages and their tools, that an agent looks things up in instead of holding them in context: one SQLite file each, installed as a skill any skill-reading agent can use (designed for hobkin; Claude Code reads it as it is).
5
5
  Keywords: agent,llm,ai,skills,reference,documentation,rag,sqlite,mcp,hobkin,claude-code
6
6
  Author: Frank Lynam
@@ -49,7 +49,7 @@ Standard library only; Python 3.9+. See README.md for the pack source format.
49
49
 
50
50
  from __future__ import annotations
51
51
 
52
- __version__ = "0.4.1"
52
+ __version__ = "0.4.2"
53
53
 
54
54
  import argparse
55
55
  import base64
@@ -2548,12 +2548,49 @@ LOOKUPS = {"info": cmd_info, "cheatsheet": cmd_cheatsheet, "toc": cmd_toc, "sear
2548
2548
  "note": cmd_note, "notes": cmd_notes}
2549
2549
 
2550
2550
 
2551
+ class HelpFormat(argparse.RawDescriptionHelpFormatter):
2552
+ """--help laid out the way hobkin, lorewell, eaveswatch, atone and hearthboard all do it: a short usage line,
2553
+ then each command and option on one line with what it does (argparse's {a,b,c} list of choices left out)."""
2554
+
2555
+ def __init__(self, prog):
2556
+ super().__init__(prog, max_help_position=26, width=min(100, shutil.get_terminal_size((100, 24)).columns))
2557
+
2558
+ def _format_action(self, action):
2559
+ if isinstance(action, argparse._SubParsersAction):
2560
+ return "".join(self._format_action(a) for a in action._get_subactions())
2561
+ return super()._format_action(action)
2562
+
2563
+ @classmethod
2564
+ def everywhere(cls, parser, prog=None):
2565
+ """This layout for a parser and all its commands, at every level: commands shown as COMMAND, and listed
2566
+ under "commands" (or "arguments", where there are others too)."""
2567
+ parser.formatter_class = cls
2568
+ subs = [a for a in parser._positionals._group_actions if isinstance(a, argparse._SubParsersAction)]
2569
+ for action in subs:
2570
+ action.metavar = action.metavar or "COMMAND"
2571
+ for each in action.choices.values():
2572
+ cls.everywhere(each)
2573
+ if subs:
2574
+ parser._positionals.title = "commands" if len(subs) == len(parser._positionals._group_actions) else "arguments"
2575
+ return parser
2576
+
2577
+
2551
2578
  def parser() -> argparse.ArgumentParser:
2552
- ap = argparse.ArgumentParser(prog="lorewell" if Path(sys.argv[0]).name != "lore.py" else "lore.py",
2553
- description="Reference packs (lores) for languages and their tools.")
2554
- ap.add_argument("--version", action="version", version=f"lorewell {__version__}")
2579
+ prog = "lorewell" if Path(sys.argv[0]).name != "lore.py" else "lore.py"
2580
+ ap = argparse.ArgumentParser(
2581
+ prog=prog, usage=f"{prog} COMMAND [options]",
2582
+ description="lorewell: reference packs (lores) for languages and their tools, one SQLite file each: ranked\n"
2583
+ "search, symbols, checked examples and tool docs, installed as a skill any agent reads. And\n"
2584
+ "living lores, which agents write as they learn (hobkin's field lore is one).",
2585
+ epilog="examples:\n"
2586
+ f" {prog} install jq.lore.db a lore, as a skill for the agent here\n"
2587
+ f" {prog} --lore jq.lore.db search 'select by key' ranked hits\n"
2588
+ f" {prog} build mytool docs/ --base-url URL --model M\n"
2589
+ f" {prog} living field.lore.db topics what a living lore holds\n\n"
2590
+ f"{prog} COMMAND --help: that command's options. More: https://github.com/frank-lynam/lorewell")
2591
+ ap.add_argument("--version", action="version", version=f"lorewell {__version__}", help="show the version and exit")
2555
2592
  ap.add_argument("--lore", help="the .lore.db to read (default: $LORE, or the one beside lore.py)")
2556
- sub = ap.add_subparsers(dest="cmd")
2593
+ sub = ap.add_subparsers(dest="cmd", metavar="COMMAND", prog=prog)
2557
2594
  c = sub.add_parser("compile", help="compile a pack source folder into a lore")
2558
2595
  c.add_argument("src")
2559
2596
  c.add_argument("-o", "--out", help="where to write it (default: NAME.lore.db here)")
@@ -2678,7 +2715,7 @@ def parser() -> argparse.ArgumentParser:
2678
2715
  x.add_argument("days", type=float, nargs="?", default=90)
2679
2716
  x = lsub.add_parser("merge", help="bring another living lore in (newest wins, nothing lost)")
2680
2717
  x.add_argument("other")
2681
- return ap
2718
+ return HelpFormat.everywhere(ap)
2682
2719
 
2683
2720
 
2684
2721
  def cmd_ws(args) -> int:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes