crypts-and-commits 0.2.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.
Files changed (68) hide show
  1. cac/__init__.py +0 -0
  2. cac/cli/__init__.py +0 -0
  3. cac/cli/app.py +33 -0
  4. cac/cli/bootstrap.py +114 -0
  5. cac/cli/campaign.py +225 -0
  6. cac/cli/common.py +34 -0
  7. cac/cli/docs.py +51 -0
  8. cac/cli/encounter.py +385 -0
  9. cac/cli/index.py +91 -0
  10. cac/cli/lore.py +230 -0
  11. cac/cli/prime.py +107 -0
  12. cac/cli/region.py +163 -0
  13. cac/cli/world.py +65 -0
  14. cac/core/__init__.py +0 -0
  15. cac/core/bootstrap.py +184 -0
  16. cac/core/budget.py +75 -0
  17. cac/core/campaign.py +393 -0
  18. cac/core/config.py +58 -0
  19. cac/core/docs.py +70 -0
  20. cac/core/encounter.py +595 -0
  21. cac/core/frontmatter_utils.py +100 -0
  22. cac/core/git_utils.py +28 -0
  23. cac/core/lore.py +185 -0
  24. cac/core/paths.py +44 -0
  25. cac/core/prime.py +97 -0
  26. cac/core/region.py +198 -0
  27. cac/core/search_index.py +409 -0
  28. cac/core/skills.py +32 -0
  29. cac/core/templates/__init__.py +5 -0
  30. cac/core/templates/codex/__init__.py +1 -0
  31. cac/core/templates/codex/sourcebook_guard.py +41 -0
  32. cac/core/templates/docs/__init__.py +0 -0
  33. cac/core/templates/docs/migration-guide.md +88 -0
  34. cac/core/templates/docs/workflow.md +544 -0
  35. cac/core/templates/skills/__init__.py +0 -0
  36. cac/core/templates/skills/claude/__init__.py +0 -0
  37. cac/core/templates/skills/claude/campaign_manager/SKILL.md +173 -0
  38. cac/core/templates/skills/claude/campaign_manager/__init__.py +0 -0
  39. cac/core/templates/skills/claude/world_manager/SKILL.md +84 -0
  40. cac/core/templates/skills/claude/world_manager/__init__.py +0 -0
  41. cac/core/templates/skills/codex/__init__.py +0 -0
  42. cac/core/templates/skills/codex/campaign_manager/SKILL.md +176 -0
  43. cac/core/templates/skills/codex/campaign_manager/__init__.py +0 -0
  44. cac/core/templates/skills/codex/world_manager/SKILL.md +87 -0
  45. cac/core/templates/skills/codex/world_manager/__init__.py +0 -0
  46. cac/core/templates/sourcebook/__init__.py +0 -0
  47. cac/core/templates/sourcebook/campaign.md +9 -0
  48. cac/core/templates/sourcebook/encounter.md +27 -0
  49. cac/core/templates/sourcebook/encounter_unscripted.md +19 -0
  50. cac/core/templates/sourcebook/lore.md +10 -0
  51. cac/core/templates/sourcebook/region.md +8 -0
  52. cac/core/templates/sourcebook/world.md +8 -0
  53. cac/core/world.py +126 -0
  54. cac/mcp/__init__.py +0 -0
  55. cac/mcp/campaign.py +99 -0
  56. cac/mcp/docs.py +29 -0
  57. cac/mcp/encounter.py +154 -0
  58. cac/mcp/index.py +57 -0
  59. cac/mcp/instance.py +3 -0
  60. cac/mcp/lore.py +103 -0
  61. cac/mcp/prime.py +45 -0
  62. cac/mcp/region.py +69 -0
  63. cac/mcp/server.py +12 -0
  64. cac/mcp/world.py +27 -0
  65. crypts_and_commits-0.2.0.dist-info/METADATA +44 -0
  66. crypts_and_commits-0.2.0.dist-info/RECORD +68 -0
  67. crypts_and_commits-0.2.0.dist-info/WHEEL +4 -0
  68. crypts_and_commits-0.2.0.dist-info/entry_points.txt +6 -0
cac/__init__.py ADDED
File without changes
cac/cli/__init__.py ADDED
File without changes
cac/cli/app.py ADDED
@@ -0,0 +1,33 @@
1
+ import typer
2
+
3
+ from cac.cli.bootstrap import app as bootstrap_app
4
+ from cac.cli.campaign import app as campaign_app
5
+ from cac.cli.common import configure_output_encoding
6
+ from cac.cli.docs import app as docs_app
7
+ from cac.cli.encounter import app as encounter_app
8
+ from cac.cli.index import app as index_app
9
+ from cac.cli.lore import app as lore_app
10
+ from cac.cli.prime import app as prime_app
11
+ from cac.cli.region import app as region_app
12
+ from cac.cli.world import app as world_app
13
+
14
+ app = typer.Typer(
15
+ name="cac",
16
+ help="Crypts and Commits CLI.",
17
+ context_settings={"help_option_names": ["-h", "--help"]},
18
+ )
19
+ app.add_typer(bootstrap_app, name="bootstrap")
20
+ app.add_typer(campaign_app, name="campaign")
21
+ app.add_typer(docs_app, name="docs")
22
+ app.add_typer(encounter_app, name="encounter")
23
+ app.add_typer(index_app, name="index")
24
+ app.add_typer(lore_app, name="lore")
25
+ app.add_typer(prime_app, name="prime")
26
+ app.add_typer(region_app, name="region")
27
+ app.add_typer(world_app, name="world")
28
+
29
+
30
+ @app.callback()
31
+ def main() -> None:
32
+ """Crypts and Commits - a Coding Assistant Continuity Framework."""
33
+ configure_output_encoding()
cac/cli/bootstrap.py ADDED
@@ -0,0 +1,114 @@
1
+ from pathlib import Path
2
+
3
+ import typer
4
+ from rich.console import Console, Group
5
+ from rich.panel import Panel
6
+ from rich.text import Text
7
+
8
+ from cac.cli.common import fail
9
+ from cac.core import bootstrap as bootstrap_core
10
+ from cac.core import skills as skills_core
11
+ from cac.core import world as world_core
12
+ from cac.core.git_utils import GitIdentityError
13
+
14
+ TITLE = "Crypts And Commits"
15
+ SUBTITLE = "A Code Assistant Continuity Framework"
16
+
17
+ app = typer.Typer(help="Bootstrap a repository for Crypts and Commits.")
18
+ console = Console()
19
+
20
+
21
+ @app.command()
22
+ def init() -> None:
23
+ """Create the .sourcebook directory and world file in the current repository."""
24
+ _show_splash()
25
+ root = Path.cwd()
26
+
27
+ sourcebook_dir, sourcebook_created = bootstrap_core.initialize(root)
28
+ _report(sourcebook_dir, sourcebook_created)
29
+
30
+ try:
31
+ world_path, world_created = world_core.initialize_world(root)
32
+ except GitIdentityError as exc:
33
+ fail(console, str(exc))
34
+ _report(world_path, world_created)
35
+ if not world_created:
36
+ _report_schema_version(world_core.check_schema_version(root))
37
+
38
+ mcp_config_path, mcp_config_changed = bootstrap_core.initialize_mcp_config(root)
39
+ _report_mcp_config(mcp_config_path, mcp_config_changed)
40
+
41
+ claude_settings_path, claude_settings_changed = bootstrap_core.initialize_claude_settings(root)
42
+ _report_claude_settings(claude_settings_path, claude_settings_changed)
43
+
44
+ codex_config_path, codex_config_changed = bootstrap_core.initialize_codex_config(root)
45
+ _report_codex_config(codex_config_path, codex_config_changed)
46
+
47
+ codex_hook_path, codex_hook_changed = bootstrap_core.initialize_codex_guard_hook(root)
48
+ _report_codex_guard_hook(codex_hook_path, codex_hook_changed)
49
+
50
+ for skill_path, skill_changed in skills_core.deploy_skills(root):
51
+ _report_skill(skill_path, skill_changed)
52
+
53
+
54
+ def _report(path: Path, created: bool) -> None:
55
+ if created:
56
+ console.print(f"Created [bold green]{path}[/bold green]")
57
+ else:
58
+ console.print(f"[bold yellow]{path}[/bold yellow] already exists")
59
+
60
+
61
+ def _report_schema_version(status: world_core.SchemaVersionStatus) -> None:
62
+ if status.outcome == world_core.SCHEMA_VERSION_OUTCOME_BEHIND:
63
+ console.print(
64
+ f"[bold red]This sourcebook is on schema version {status.stored}[/bold red], behind the "
65
+ f"current version {status.current}. Ask your coding assistant to use the [bold]world-manager[/bold] "
66
+ 'skill to migrate it - it consults the migration-guide doc (docs_get("migration-guide") / '
67
+ "cac docs get migration-guide) for the exact steps."
68
+ )
69
+ elif status.outcome == world_core.SCHEMA_VERSION_OUTCOME_AHEAD:
70
+ console.print(
71
+ f"[bold red]This sourcebook is on schema version {status.stored}[/bold red], ahead of the "
72
+ f"installed cac's version {status.current}. Upgrade your installed cac package."
73
+ )
74
+
75
+
76
+ def _report_mcp_config(path: Path, changed: bool) -> None:
77
+ if changed:
78
+ console.print(f"Registered the crypts-and-commits MCP server in [bold green]{path}[/bold green]")
79
+ else:
80
+ console.print(f"[bold yellow]{path}[/bold yellow] already registers the crypts-and-commits MCP server")
81
+
82
+
83
+ def _report_claude_settings(path: Path, changed: bool) -> None:
84
+ if changed:
85
+ console.print(f"Updated permissions in [bold green]{path}[/bold green]")
86
+ else:
87
+ console.print(f"[bold yellow]{path}[/bold yellow] already has the required permissions")
88
+
89
+
90
+ def _report_codex_config(path: Path, changed: bool) -> None:
91
+ if changed:
92
+ console.print(f"Registered the crypts-and-commits MCP server in [bold green]{path}[/bold green]")
93
+ else:
94
+ console.print(f"[bold yellow]{path}[/bold yellow] already registers the crypts-and-commits MCP server")
95
+
96
+
97
+ def _report_codex_guard_hook(path: Path, changed: bool) -> None:
98
+ if changed:
99
+ console.print(f"Deployed Codex sourcebook guard hook in [bold green]{path}[/bold green]")
100
+ else:
101
+ console.print(f"[bold yellow]{path}[/bold yellow] already has the current Codex sourcebook guard hook")
102
+
103
+
104
+ def _report_skill(path: Path, changed: bool) -> None:
105
+ if changed:
106
+ console.print(f"Deployed [bold green]{path}[/bold green]")
107
+ else:
108
+ console.print(f"[bold yellow]{path}[/bold yellow] already up to date")
109
+
110
+
111
+ def _show_splash() -> None:
112
+ title = Text(TITLE, style="bold magenta", justify="center")
113
+ subtitle = Text(SUBTITLE, style="italic cyan", justify="center")
114
+ console.print(Panel(Group(title, subtitle), border_style="magenta", padding=(1, 4)))
cac/cli/campaign.py ADDED
@@ -0,0 +1,225 @@
1
+ import typer
2
+ from rich.console import Console
3
+
4
+ from cac.cli.common import edit_markdown, fail
5
+ from cac.core import budget as budget_core
6
+ from cac.core import campaign as campaign_core
7
+ from cac.core.git_utils import GitIdentityError
8
+ from cac.core.paths import resolve_project_root
9
+
10
+ app = typer.Typer(
11
+ help=(
12
+ "Manage campaign entries - long-running initiatives on the project, similar to an "
13
+ "'Epic' in Jira-style work tracking. A campaign is expected to require many "
14
+ "encounters, completed over time, before it is considered complete. Examples "
15
+ "include 'Create the MVP', 'Add Payment Processing', or a version increment. A "
16
+ "campaign moves through a fixed lifecycle: 'draft' (just created) -> 'open' (via "
17
+ "'open'; only one campaign may be open at a time) -> 'paused' (via 'pause') or back "
18
+ "to 'open' again -> 'completed' (via 'complete', from 'open' or 'paused'). It may "
19
+ "instead be 'abandoned' (via 'abandon') from 'draft', 'open', or 'paused' - but not "
20
+ "once 'completed'. 'pause', 'complete', and 'abandon' all fail while the campaign "
21
+ "still has an open encounter. 'complete' and 'abandon' each require a --message - a "
22
+ "postmortem recorded as a dated, attributed log entry on the campaign body. Once "
23
+ "'completed' or 'abandoned', the campaign's body is locked: 'update' fails, since the "
24
+ "postmortem is meant to be that campaign's closing record. Once a campaign and every one "
25
+ "of its encounters are 'completed'/'abandoned', it may be 'archive'd - moved into "
26
+ ".sourcebook/archive/, out of the way of active work, without changing its status."
27
+ )
28
+ )
29
+ console = Console()
30
+
31
+
32
+ @app.command("get")
33
+ def get_campaign(
34
+ name: str = typer.Argument(..., help="Campaign name to show."),
35
+ ) -> None:
36
+ """Show a campaign file's frontmatter and body."""
37
+ try:
38
+ metadata, body = campaign_core.read_metadata(resolve_project_root(), name)
39
+ except campaign_core.CampaignNotFoundError as exc:
40
+ fail(console, str(exc))
41
+
42
+ for key, value in metadata.items():
43
+ console.print(f"[bold]{key}[/bold]: {value}")
44
+ console.print()
45
+ body = budget_core.truncate_body(body, campaign_core.campaign_path(resolve_project_root(), name))
46
+ console.print(body, markup=False, soft_wrap=True)
47
+
48
+
49
+ @app.command("list")
50
+ def list_campaigns(
51
+ cursor: str | None = typer.Option(None, "--cursor", help="Resume from a previous page's cursor."),
52
+ ) -> None:
53
+ """List the campaign files in .sourcebook/campaigns, with their current status, paged under
54
+ the response budget."""
55
+ entries = campaign_core.list_campaigns_with_status(resolve_project_root())
56
+ if not entries:
57
+ console.print("No campaign files found.")
58
+ return
59
+
60
+ try:
61
+ page = budget_core.paginate(entries, cursor, render=lambda entry: f"{entry[0]} ({entry[1]})")
62
+ except budget_core.InvalidCursorError as exc:
63
+ fail(console, str(exc))
64
+
65
+ for name, status in page.items:
66
+ console.print(f"{name} ({status})")
67
+ if page.next_cursor is not None:
68
+ console.print(f"[dim]More results - pass --cursor {page.next_cursor} to continue.[/dim]")
69
+
70
+
71
+ @app.command("create")
72
+ def create_campaign(
73
+ name: str = typer.Argument(..., help="Campaign name (letters, numbers, underscores, hyphens, periods)."),
74
+ body: str | None = typer.Option(None, "--body", "-b", help="Markdown body. Opens an editor if omitted."),
75
+ ) -> None:
76
+ """Create a new campaign file."""
77
+ content = body if body is not None else edit_markdown(campaign_core.template_body())
78
+
79
+ try:
80
+ path = campaign_core.create_campaign(resolve_project_root(), name, content)
81
+ except (campaign_core.InvalidCampaignNameError, campaign_core.CampaignAlreadyExistsError, GitIdentityError) as exc:
82
+ fail(console, str(exc))
83
+
84
+ console.print(f"Created [bold green]{path}[/bold green]")
85
+
86
+
87
+ @app.command("update")
88
+ def update_campaign(
89
+ name: str = typer.Argument(..., help="Campaign name to update."),
90
+ body: str | None = typer.Option(None, "--body", "-b", help="Markdown body. Opens an editor if omitted."),
91
+ ) -> None:
92
+ """Update an existing campaign file's body. Fails once the campaign is 'completed' or
93
+ 'abandoned' - its body is locked once its postmortem is recorded."""
94
+ try:
95
+ current = campaign_core.read_campaign(resolve_project_root(), name)
96
+ except campaign_core.CampaignNotFoundError as exc:
97
+ fail(console, str(exc))
98
+
99
+ content = body if body is not None else edit_markdown(current.body)
100
+ try:
101
+ path = campaign_core.update_campaign(resolve_project_root(), name, content)
102
+ except (campaign_core.CampaignNotMutableError, GitIdentityError) as exc:
103
+ fail(console, str(exc))
104
+
105
+ console.print(f"Updated [bold green]{path}[/bold green]")
106
+
107
+
108
+ @app.command("delete")
109
+ def delete_campaign(
110
+ name: str = typer.Argument(..., help="Campaign name to delete."),
111
+ yes: bool = typer.Option(False, "--yes", "-y", help="Skip the confirmation prompt."),
112
+ ) -> None:
113
+ """Delete a campaign file."""
114
+ if not yes:
115
+ typer.confirm(f"Delete campaign {name!r}?", abort=True)
116
+
117
+ try:
118
+ path = campaign_core.delete_campaign(resolve_project_root(), name)
119
+ except campaign_core.CampaignNotFoundError as exc:
120
+ fail(console, str(exc))
121
+
122
+ console.print(f"Deleted [bold green]{path}[/bold green]")
123
+
124
+
125
+ @app.command("open")
126
+ def open_campaign(
127
+ name: str = typer.Argument(..., help="Campaign name to open."),
128
+ ) -> None:
129
+ """Move a campaign from 'draft' or 'paused' to 'open'. Only one campaign may be open at a
130
+ time."""
131
+ try:
132
+ campaign_core.open_campaign(resolve_project_root(), name)
133
+ except (
134
+ campaign_core.CampaignNotFoundError,
135
+ campaign_core.InvalidCampaignTransitionError,
136
+ campaign_core.AnotherCampaignOpenError,
137
+ GitIdentityError,
138
+ ) as exc:
139
+ fail(console, str(exc))
140
+
141
+ console.print(f"Opened [bold]{name}[/bold].")
142
+
143
+
144
+ @app.command("pause")
145
+ def pause_campaign(
146
+ name: str = typer.Argument(..., help="Campaign name to pause."),
147
+ ) -> None:
148
+ """Move a campaign from 'open' to 'paused'. Fails if it has an open encounter."""
149
+ try:
150
+ campaign_core.pause_campaign(resolve_project_root(), name)
151
+ except (
152
+ campaign_core.CampaignNotFoundError,
153
+ campaign_core.InvalidCampaignTransitionError,
154
+ campaign_core.CampaignHasOpenEncountersError,
155
+ GitIdentityError,
156
+ ) as exc:
157
+ fail(console, str(exc))
158
+
159
+ console.print(f"Paused [bold]{name}[/bold].")
160
+
161
+
162
+ @app.command("complete")
163
+ def complete_campaign(
164
+ name: str = typer.Argument(..., help="Campaign name to complete."),
165
+ message: str = typer.Option(..., "--message", "-m", help="Postmortem for this campaign. Required."),
166
+ ) -> None:
167
+ """Move a campaign from 'open' or 'paused' to 'completed'. Fails if it has an open encounter.
168
+ The required message is recorded as the campaign's postmortem and its body is locked
169
+ thereafter."""
170
+ try:
171
+ campaign_core.complete_campaign(resolve_project_root(), name, message)
172
+ except (
173
+ campaign_core.CampaignNotFoundError,
174
+ campaign_core.InvalidCampaignTransitionError,
175
+ campaign_core.CampaignHasOpenEncountersError,
176
+ campaign_core.CampaignMessageRequiredError,
177
+ GitIdentityError,
178
+ ) as exc:
179
+ fail(console, str(exc))
180
+
181
+ console.print(f"Completed [bold]{name}[/bold].")
182
+
183
+
184
+ @app.command("abandon")
185
+ def abandon_campaign(
186
+ name: str = typer.Argument(..., help="Campaign name to abandon."),
187
+ message: str = typer.Option(..., "--message", "-m", help="Postmortem for this campaign. Required."),
188
+ ) -> None:
189
+ """Move a campaign from 'draft', 'open', or 'paused' to 'abandoned'. Fails if it has an open
190
+ encounter. The required message is recorded as the campaign's postmortem and its body is
191
+ locked thereafter."""
192
+ try:
193
+ campaign_core.abandon_campaign(resolve_project_root(), name, message)
194
+ except (
195
+ campaign_core.CampaignNotFoundError,
196
+ campaign_core.InvalidCampaignTransitionError,
197
+ campaign_core.CampaignHasOpenEncountersError,
198
+ campaign_core.CampaignMessageRequiredError,
199
+ GitIdentityError,
200
+ ) as exc:
201
+ fail(console, str(exc))
202
+
203
+ console.print(f"Abandoned [bold]{name}[/bold].")
204
+
205
+
206
+ @app.command("archive")
207
+ def archive_campaign(
208
+ name: str = typer.Argument(..., help="Campaign name to archive."),
209
+ ) -> None:
210
+ """Archive a campaign and all its encounters. The campaign must already be 'completed' or
211
+ 'abandoned', and every one of its encounters must also be 'completed' or 'abandoned'. Moves the
212
+ campaign and its encounters into .sourcebook/archive/, mirroring their live layout, and sets
213
+ archived: true on each - status is preserved, not replaced."""
214
+ try:
215
+ campaign, archived_encounters = campaign_core.archive_campaign(resolve_project_root(), name)
216
+ except (
217
+ campaign_core.CampaignNotFoundError,
218
+ campaign_core.CampaignNotTerminalError,
219
+ campaign_core.CampaignAlreadyArchivedError,
220
+ campaign_core.CampaignHasUnfinishedEncountersError,
221
+ GitIdentityError,
222
+ ) as exc:
223
+ fail(console, str(exc))
224
+
225
+ console.print(f"Archived [bold]{campaign.name}[/bold] and {len(archived_encounters)} encounter(s).")
cac/cli/common.py ADDED
@@ -0,0 +1,34 @@
1
+ import sys
2
+ from typing import NoReturn
3
+
4
+ import click
5
+ import typer
6
+ from rich.console import Console
7
+
8
+
9
+ def configure_output_encoding() -> None:
10
+ """Force UTF-8 on the process stdout/stderr streams.
11
+
12
+ On Windows the interpreter's stdout/stderr default to the legacy code page
13
+ (cp1252), so ``rich`` fails with ``UnicodeEncodeError`` when printing stored
14
+ content that contains characters outside that page (arrows, dashes, smart
15
+ quotes, ...). Reconfiguring the streams to UTF-8 makes correct display
16
+ independent of the caller's environment.
17
+
18
+ Streams that do not support ``reconfigure`` (e.g. test-capture buffers or
19
+ some redirected streams that are not ``TextIOWrapper``) are left untouched.
20
+ """
21
+ for stream in (sys.stdout, sys.stderr):
22
+ reconfigure = getattr(stream, "reconfigure", None)
23
+ if reconfigure is not None:
24
+ reconfigure(encoding="utf-8", errors="backslashreplace")
25
+
26
+
27
+ def edit_markdown(initial: str) -> str:
28
+ edited = click.edit(initial, extension=".txt")
29
+ return edited if edited is not None else initial
30
+
31
+
32
+ def fail(console: Console, message: str) -> NoReturn:
33
+ console.print(f"[bold red]{message}[/bold red]")
34
+ raise typer.Exit(code=1)
cac/cli/docs.py ADDED
@@ -0,0 +1,51 @@
1
+ import typer
2
+ from rich.console import Console
3
+
4
+ from cac.cli.common import fail
5
+ from cac.core import budget as budget_core
6
+ from cac.core import docs as docs_core
7
+ from cac.core.config import DOCS_RESPONSE_BUDGET
8
+
9
+ app = typer.Typer(
10
+ help=(
11
+ "Read the framework's packaged reference docs - guide documents shipped with cac "
12
+ "(e.g. the Workflow Reference Guide), distinct from .sourcebook content. Read-only."
13
+ )
14
+ )
15
+ console = Console()
16
+
17
+
18
+ @app.command("list")
19
+ def list_docs(
20
+ cursor: str | None = typer.Option(None, "--cursor", help="Resume from a previous page's cursor."),
21
+ ) -> None:
22
+ """List registered docs as name + summary pairs, paged under the response budget."""
23
+ items = [{"name": name, "summary": summary} for name, summary in docs_core.list_docs()]
24
+ if not items:
25
+ console.print("No docs registered.")
26
+ return
27
+
28
+ try:
29
+ page = budget_core.paginate(items, cursor, render=lambda item: item["name"] + item["summary"])
30
+ except budget_core.InvalidCursorError as exc:
31
+ fail(console, str(exc))
32
+
33
+ for item in page.items:
34
+ console.print(f"[bold]{item['name']}[/bold]: ", end="")
35
+ console.print(item["summary"], markup=False)
36
+ if page.next_cursor is not None:
37
+ console.print(f"[dim]More results - pass --cursor {page.next_cursor} to continue.[/dim]")
38
+
39
+
40
+ @app.command("get")
41
+ def get_doc(
42
+ name: str = typer.Argument(..., help="Doc name to show."),
43
+ ) -> None:
44
+ """Show a registered doc's full body."""
45
+ try:
46
+ body = docs_core.read_doc(name)
47
+ except docs_core.DocNotFoundError as exc:
48
+ fail(console, str(exc))
49
+
50
+ body = budget_core.truncate_body(body, docs_core.doc_source_path(name), budget=DOCS_RESPONSE_BUDGET)
51
+ console.print(body, markup=False, soft_wrap=True)