|
| 1 | +# attune-help |
| 2 | + |
| 3 | +Lightweight help runtime with progressive depth and |
| 4 | +audience adaptation. Read project help templates |
| 5 | +generated by [attune-ai](https://pypi.org/project/attune-ai/). |
| 6 | + |
| 7 | +## Install |
| 8 | + |
| 9 | +```bash |
| 10 | +pip install attune-help |
| 11 | +``` |
| 12 | + |
| 13 | +## Quick Start |
| 14 | + |
| 15 | +```python |
| 16 | +from attune_help import HelpEngine |
| 17 | + |
| 18 | +engine = HelpEngine(template_dir=".help/templates") |
| 19 | + |
| 20 | +# Progressive depth: concept -> task -> reference |
| 21 | +print(engine.lookup("security-audit")) # concept |
| 22 | +print(engine.lookup("security-audit")) # task |
| 23 | +print(engine.lookup("security-audit")) # reference |
| 24 | +``` |
| 25 | + |
| 26 | +## How It Works |
| 27 | + |
| 28 | +Each topic has three depth levels: |
| 29 | + |
| 30 | +| Level | Type | What you get | |
| 31 | +|-------|------|-------------| |
| 32 | +| 0 | Concept | What is it? When to use it? | |
| 33 | +| 1 | Task | Step-by-step how-to | |
| 34 | +| 2 | Reference | Full detail, edge cases | |
| 35 | + |
| 36 | +Repeated lookups on the same topic auto-advance. |
| 37 | +A new topic resets to concept. |
| 38 | + |
| 39 | +## Renderers |
| 40 | + |
| 41 | +```python |
| 42 | +# Plain text (default) |
| 43 | +engine = HelpEngine(renderer="plain") |
| 44 | + |
| 45 | +# Rich terminal output (requires `pip install attune-help[rich]`) |
| 46 | +engine = HelpEngine(renderer="cli") |
| 47 | + |
| 48 | +# Claude Code inline format |
| 49 | +engine = HelpEngine(renderer="claude_code") |
| 50 | + |
| 51 | +# Auto-detect environment |
| 52 | +engine = HelpEngine(renderer="auto") |
| 53 | +``` |
| 54 | + |
| 55 | +## Template Directory |
| 56 | + |
| 57 | +Templates are markdown files with YAML frontmatter: |
| 58 | + |
| 59 | +``` |
| 60 | +.help/templates/ |
| 61 | + security/ |
| 62 | + concept.md |
| 63 | + task.md |
| 64 | + reference.md |
| 65 | + api/ |
| 66 | + concept.md |
| 67 | + task.md |
| 68 | + reference.md |
| 69 | +``` |
| 70 | + |
| 71 | +Generate templates with |
| 72 | +[attune-ai](https://pypi.org/project/attune-ai/): |
| 73 | + |
| 74 | +```bash |
| 75 | +pip install attune-ai |
| 76 | +# Then in Claude Code: |
| 77 | +/coach init |
| 78 | +``` |
| 79 | + |
| 80 | +Or create them manually — any markdown file with |
| 81 | +`feature`, `depth`, and `source_hash` frontmatter |
| 82 | +fields works. |
| 83 | + |
| 84 | +## Demo Templates |
| 85 | + |
| 86 | +The package includes a demo feature showing the |
| 87 | +progressive depth format: |
| 88 | + |
| 89 | +```python |
| 90 | +from attune_help import get_demo_path |
| 91 | + |
| 92 | +# Copy to your project |
| 93 | +import shutil |
| 94 | +shutil.copytree( |
| 95 | + get_demo_path() / "security-audit", |
| 96 | + ".help/templates/security-audit", |
| 97 | +) |
| 98 | +``` |
| 99 | + |
| 100 | +The `security-audit/` demo contains `concept.md`, |
| 101 | +`task.md`, and `reference.md` — the three depth |
| 102 | +levels that `/coach init` generates for each feature. |
| 103 | + |
| 104 | +## API |
| 105 | + |
| 106 | +### `HelpEngine` |
| 107 | + |
| 108 | +```python |
| 109 | +HelpEngine( |
| 110 | + template_dir=None, # Override template path |
| 111 | + storage=None, # Session storage backend |
| 112 | + renderer="plain", # Output renderer |
| 113 | + user_id="default", # Session tracking ID |
| 114 | +) |
| 115 | +``` |
| 116 | + |
| 117 | +**Methods:** |
| 118 | + |
| 119 | +- `lookup(topic)` — Progressive depth lookup |
| 120 | +- `get(template_id)` — Direct template access |
| 121 | +- `lookup_raw(topic)` — Returns `PopulatedTemplate` |
| 122 | + dataclass |
| 123 | +- `get_summary(skill)` — One-line skill summary |
| 124 | +- `precursor_warnings(file_path)` — File-aware |
| 125 | + warnings |
| 126 | + |
| 127 | +### `SessionStorage` Protocol |
| 128 | + |
| 129 | +Implement custom storage backends: |
| 130 | + |
| 131 | +```python |
| 132 | +from attune_help import SessionStorage |
| 133 | + |
| 134 | +class RedisStorage(SessionStorage): |
| 135 | + def load(self, user_id: str) -> dict: ... |
| 136 | + def save(self, user_id: str, state: dict) -> None: ... |
| 137 | +``` |
| 138 | + |
| 139 | +## License |
| 140 | + |
| 141 | +Apache 2.0 |
0 commit comments