Skip to content

Commit be47d13

Browse files
queeliusclaude
andcommitted
Add MkDocs documentation and GitHub Pages deployment
Documentation structure: - Getting Started: Installation, Quick Start - User Guide: Terminal, Python API, Commands Reference - Architecture: Overview, Content Addressing - API Reference: DagShell, FileSystem GitHub Actions workflow for automatic deployment to GitHub Pages. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent adead4e commit be47d13

13 files changed

Lines changed: 1441 additions & 0 deletions

File tree

.github/workflows/docs.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Deploy Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.11'
28+
29+
- name: Install dependencies
30+
run: |
31+
pip install mkdocs mkdocs-material
32+
33+
- name: Build documentation
34+
run: mkdocs build
35+
36+
- name: Upload artifact
37+
uses: actions/upload-pages-artifact@v3
38+
with:
39+
path: ./site
40+
41+
deploy:
42+
environment:
43+
name: github-pages
44+
url: ${{ steps.deployment.outputs.page_url }}
45+
runs-on: ubuntu-latest
46+
needs: build
47+
steps:
48+
- name: Deploy to GitHub Pages
49+
id: deployment
50+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,4 @@ test_results.txt
9090

9191
# Backup files
9292
Initial version
93+
site/

docs/api/dagshell.md

Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
# DagShell API
2+
3+
The `DagShell` class provides the main interface for interacting with the virtual filesystem.
4+
5+
## Constructor
6+
7+
```python
8+
from dagshell.dagshell_fluent import DagShell
9+
10+
shell = DagShell(fs=None)
11+
```
12+
13+
**Parameters:**
14+
15+
- `fs` - Optional FileSystem instance. Creates new one if not provided.
16+
17+
## Navigation
18+
19+
### cd(path)
20+
21+
Change current directory.
22+
23+
```python
24+
shell.cd("/home/user")
25+
shell.cd("..")
26+
shell.cd("-") # Previous directory
27+
```
28+
29+
### pwd()
30+
31+
Return current working directory.
32+
33+
```python
34+
result = shell.pwd()
35+
print(result.text) # /home/user
36+
```
37+
38+
### pushd(path), popd(), dirs()
39+
40+
Directory stack operations.
41+
42+
```python
43+
shell.pushd("/tmp")
44+
shell.popd()
45+
result = shell.dirs()
46+
```
47+
48+
## File Operations
49+
50+
### cat(*paths)
51+
52+
Display file contents.
53+
54+
```python
55+
result = shell.cat("/etc/passwd")
56+
result = shell.cat("file1.txt", "file2.txt")
57+
```
58+
59+
### head(n, *paths), tail(n, *paths)
60+
61+
Display first/last n lines.
62+
63+
```python
64+
result = shell.head(10, "/var/log/messages")
65+
result = shell.tail(20, "/var/log/messages")
66+
```
67+
68+
### touch(path)
69+
70+
Create empty file or update timestamp.
71+
72+
```python
73+
shell.touch("/newfile.txt")
74+
```
75+
76+
### cp(src, dst), mv(src, dst), rm(path, recursive=False)
77+
78+
Copy, move, remove files.
79+
80+
```python
81+
shell.cp("/src.txt", "/dst.txt")
82+
shell.mv("/old.txt", "/new.txt")
83+
shell.rm("/file.txt")
84+
shell.rm("/dir", recursive=True)
85+
```
86+
87+
### mkdir(path, parents=False)
88+
89+
Create directory.
90+
91+
```python
92+
shell.mkdir("/newdir")
93+
shell.mkdir("/path/to/dir", parents=True)
94+
```
95+
96+
### ls(path=None, all=False, long=False)
97+
98+
List directory contents.
99+
100+
```python
101+
result = shell.ls()
102+
result = shell.ls("/home", all=True, long=True)
103+
```
104+
105+
## Text Processing
106+
107+
### echo(*args, n=False)
108+
109+
Display text.
110+
111+
```python
112+
result = shell.echo("Hello", "World")
113+
shell.echo("no newline", n=True)
114+
```
115+
116+
### grep(pattern, *files, ignore_case=False, invert=False)
117+
118+
Search for patterns.
119+
120+
```python
121+
shell.cat("/file.txt")
122+
result = shell.grep("pattern")
123+
124+
# Or directly
125+
result = shell.grep("pattern", "/file.txt", ignore_case=True)
126+
```
127+
128+
### sort(*files, reverse=False, numeric=False, unique=False)
129+
130+
Sort lines.
131+
132+
```python
133+
result = shell.sort("/data.txt", numeric=True)
134+
```
135+
136+
### uniq(*files, count=False)
137+
138+
Remove duplicate lines.
139+
140+
```python
141+
result = shell.uniq("/data.txt", count=True)
142+
```
143+
144+
### wc(*files, lines=False, words=False, chars=False)
145+
146+
Count lines, words, characters.
147+
148+
```python
149+
result = shell.wc("/file.txt")
150+
result = shell.wc("/file.txt", lines=True)
151+
```
152+
153+
### cut(*files, delimiter='\t', fields=None)
154+
155+
Extract fields.
156+
157+
```python
158+
result = shell.cut("/data.csv", delimiter=",", fields="1,3")
159+
```
160+
161+
### tr(set1, set2='', delete=False)
162+
163+
Translate characters.
164+
165+
```python
166+
shell.cat("/file.txt")
167+
result = shell.tr("a-z", "A-Z")
168+
result = shell.tr("0-9", "", delete=True)
169+
```
170+
171+
### diff(file1, file2, unified=False)
172+
173+
Compare files.
174+
175+
```python
176+
result = shell.diff("/file1.txt", "/file2.txt")
177+
result = shell.diff("/old.py", "/new.py", unified=True)
178+
```
179+
180+
## Links
181+
182+
### ln(target, link, symbolic=False)
183+
184+
Create links.
185+
186+
```python
187+
shell.ln("/target.txt", "/hardlink.txt")
188+
shell.ln("/target.txt", "/symlink.txt", symbolic=True)
189+
```
190+
191+
### readlink(path)
192+
193+
Read symbolic link target.
194+
195+
```python
196+
result = shell.readlink("/symlink.txt")
197+
```
198+
199+
## Permissions
200+
201+
### chmod(mode, path)
202+
203+
Change file mode.
204+
205+
```python
206+
shell.chmod("755", "/script.sh")
207+
shell.chmod("u+x", "/script.sh")
208+
shell.chmod("go-w", "/file.txt")
209+
```
210+
211+
### chown(owner, path)
212+
213+
Change ownership.
214+
215+
```python
216+
shell.chown("user", "/file.txt")
217+
shell.chown("user:group", "/file.txt")
218+
```
219+
220+
### stat(path)
221+
222+
Get file information.
223+
224+
```python
225+
result = shell.stat("/file.txt")
226+
```
227+
228+
## Persistence
229+
230+
### save(filename)
231+
232+
Save filesystem to JSON.
233+
234+
```python
235+
shell.save("backup.json")
236+
```
237+
238+
### load(filename)
239+
240+
Load filesystem from JSON.
241+
242+
```python
243+
shell.load("backup.json")
244+
```
245+
246+
## Output Redirection
247+
248+
CommandResult supports output redirection:
249+
250+
```python
251+
# Write to file
252+
shell.echo("content").out("/file.txt")
253+
254+
# Append to file
255+
shell.echo("more").append("/file.txt")
256+
```

0 commit comments

Comments
 (0)