Skip to content

Commit 1b96ac0

Browse files
metaistclaude
andcommitted
docs: improve documentation coverage (closes #119)
- Add tabbed content support for OS-specific instructions - Add shell completions section to getting-started.md - Document --compile-bytecode and --output-format in bundling.md - Fix outdated bytecode compilation statement in limitations.md - Add -R alias for --recursive in cli.md - Add JSON output section to fs-commands.md Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 56de246 commit 1b96ac0

File tree

6 files changed

+105
-15
lines changed

6 files changed

+105
-15
lines changed

docs/bundling.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,35 @@ uvx cosmofy bundle --python-url https://example.com/custom-python
8282

8383
Or set `COSMOFY_PYTHON_URL` environment variable.
8484

85+
## Bytecode Compilation
86+
87+
Compile Python files to bytecode (`.pyc`) for faster startup:
88+
89+
```bash
90+
uvx cosmofy bundle --compile-bytecode
91+
```
92+
93+
This uses the Cosmopolitan Python in the bundle to compile `.py` files. The trade-off is slightly larger bundle size for faster initial import times.
94+
95+
## Output Format
96+
97+
Get structured JSON output instead of text:
98+
99+
```bash
100+
uvx cosmofy bundle --output-format json
101+
```
102+
103+
The JSON output includes paths to all generated bundles:
104+
105+
```json
106+
{
107+
"entry_points": ["dist/my_command"],
108+
"scripts": []
109+
}
110+
```
111+
112+
This is useful for scripting and CI/CD pipelines.
113+
85114
## Dry Run
86115

87116
See what would happen without making changes:

docs/cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ Arguments:
387387
388388
Options:
389389
-f, --force ignore nonexistent files
390-
-r, --recursive recursively remove directories
390+
-r, -R, --recursive recursively remove directories
391391
392392
Global options:
393393
-h, --help show this help message

docs/fs-commands.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,23 @@ uvx cosmofy fs args my_bundle '-m my_module'
125125
```
126126

127127
See [.args File](args-file.md) for more details.
128+
129+
## JSON Output
130+
131+
All `fs` commands support `--output-format json` for structured output:
132+
133+
```bash
134+
# List files as JSON
135+
uvx cosmofy fs ls my_bundle --output-format json
136+
137+
# Get file contents as JSON
138+
uvx cosmofy fs cat my_bundle .args --output-format json
139+
140+
# Track what was added
141+
uvx cosmofy fs add my_bundle file.py --output-format json
142+
143+
# Track what was removed
144+
uvx cosmofy fs rm my_bundle old.py --output-format json
145+
```
146+
147+
This is useful for scripting and parsing results programmatically.

docs/getting-started.md

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,55 @@ pip install cosmofy
3030

3131
You can also download the `cosmofy` binary directly.
3232

33-
**macOS / Linux:**
33+
=== "macOS / Linux"
3434

35-
```bash
36-
dest=~/.local/bin/cosmofy
37-
curl -sSz $dest -o $dest -L https://github.com/metaist/cosmofy/releases/latest/download/cosmofy
38-
chmod +x $dest
39-
```
35+
```bash
36+
dest=~/.local/bin/cosmofy
37+
curl -sSz $dest -o $dest -L https://github.com/metaist/cosmofy/releases/latest/download/cosmofy
38+
chmod +x $dest
39+
```
4040

41-
**Windows:**
41+
=== "Windows"
4242

43-
```powershell
44-
$dest = "$env:LOCALAPPDATA\cosmofy\cosmofy.exe"
45-
New-Item -ItemType Directory -Force -Path (Split-Path $dest)
46-
Invoke-WebRequest -Uri "https://github.com/metaist/cosmofy/releases/latest/download/cosmofy" -OutFile $dest
47-
```
43+
```powershell
44+
$dest = "$env:LOCALAPPDATA\cosmofy\cosmofy.exe"
45+
New-Item -ItemType Directory -Force -Path (Split-Path $dest)
46+
Invoke-WebRequest -Uri "https://github.com/metaist/cosmofy/releases/latest/download/cosmofy" -OutFile $dest
47+
```
48+
49+
### Shell Completions
50+
51+
Enable tab completion for your shell:
52+
53+
=== "Bash"
54+
55+
Add to `~/.bashrc`:
56+
57+
```bash
58+
eval "$(cosmofy completions bash)"
59+
```
60+
61+
=== "Zsh"
62+
63+
Add to `~/.zshrc`:
64+
65+
```zsh
66+
eval "$(cosmofy completions zsh)"
67+
```
68+
69+
Or save to your fpath:
70+
71+
```zsh
72+
cosmofy completions zsh > ~/.zfunc/_cosmofy
73+
```
74+
75+
=== "Fish"
76+
77+
Save to completions directory:
78+
79+
```fish
80+
cosmofy completions fish > ~/.config/fish/completions/cosmofy.fish
81+
```
4882

4983
## Quick Example
5084

docs/limitations.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ Custom Python versions are not currently supported. See [#44](https://github.com
2626

2727
## Bytecode Compilation
2828

29-
Automatic Python bytecode compilation (`.pyc` files) is currently disabled.
29+
Bytecode compilation (`.pyc` files) is available but not enabled by default. Use `--compile-bytecode` to enable it:
3030

31-
See [#41](https://github.com/metaist/cosmofy/issues/41).
31+
```bash
32+
uvx cosmofy bundle --compile-bytecode
33+
```
34+
35+
This trades slightly larger bundle size for faster import times.
3236

3337
## Platform-Specific Features
3438

mkdocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ theme:
3030
- search.suggest
3131
- search.highlight
3232
- content.code.copy
33+
- content.tabs.link
3334

3435
nav:
3536
- Home: index.md
@@ -48,6 +49,8 @@ markdown_extensions:
4849
- pymdownx.highlight:
4950
anchor_linenums: true
5051
- pymdownx.inlinehilite
52+
- pymdownx.tabbed:
53+
alternate_style: true
5154
- toc:
5255
permalink: true
5356

0 commit comments

Comments
 (0)