Skip to content

Commit 12869a8

Browse files
committed
Update documentation
1 parent bb037a3 commit 12869a8

File tree

18 files changed

+157
-62
lines changed

18 files changed

+157
-62
lines changed

.config/README.md.template

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ runbook run runbook-name.ipynb
3131

3232
# Background
3333

34-
### What is a Runbook?
34+
## What is a Runbook?
3535
A runbook is an executable document that combines:
3636
- Clear markdown documentation
3737
- Runnable code blocks
@@ -40,13 +40,13 @@ A runbook is an executable document that combines:
4040

4141
It's ideal for operations like encoding your Disaster Recovery Operations, spinning up a new cluster, or restoring from snapshots.
4242

43-
### When Should You Use This?
43+
## When Should You Use This?
4444
- ✅ When you need **semi-automated tools** with audit trails and safety checks
4545
- ✅ When you want **rapid iteration** on operational procedures with built-in rollback steps
4646
- ✅ When you need something more powerful than shell scripts but don't want to build a full application
4747
- ✅ When you want to make complex operations both **safe and repeatable**
4848

49-
### Runbook Best Practices
49+
## Runbook Best Practices
5050
1. Structure your runbooks with:
5151
- Clear purpose and summary
5252
- Step-by-step descriptions
@@ -72,7 +72,7 @@ It's ideal for operations like encoding your Disaster Recovery Operations, spinn
7272
1. Depending on auditing needs, you can either commit the "runs" folder to your repo or only keep the "binder" folder committed.
7373
1. In case of strict auditing needs, we recommend you add auditing of commands in the local SDK as well as in your cloud provider
7474

75-
## Installation
75+
# Installation
7676

7777
We recommend using [uv](https://docs.astral.sh/uv/) for installing runbook as a cli tool. If you already use pipx, you can use that instead.
7878

@@ -86,7 +86,7 @@ Or pin to a version
8686
uv tool install git+https://github.com/zph/runbook.git@$RUNBOOK_VERSION
8787
```
8888

89-
## CLI
89+
# CLI
9090

9191
```sh
9292
$RUNBOOK_HELP
@@ -136,7 +136,7 @@ For development we use the following tools:
136136
- [hermit](https://hermit.dev/) to manage developement tool dependencies (see .hermit/bin)
137137
- [uv](https://docs.astral.sh/uv/) python package manager and cli runner (see pyproject.toml)
138138

139-
Necessary deps can be seen in [pyproject.toml](pyproject.toml) and .hermit/bin
139+
Necessary deps can be seen in pyproject.toml and .hermit/bin
140140

141141
Use .hermit/bin/activate-hermit to activate the environment.
142142

README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ runbook run runbook-name.ipynb
3131

3232
# Background
3333

34-
### What is a Runbook?
34+
## What is a Runbook?
3535
A runbook is an executable document that combines:
3636
- Clear markdown documentation
3737
- Runnable code blocks
@@ -40,13 +40,13 @@ A runbook is an executable document that combines:
4040

4141
It's ideal for operations like encoding your Disaster Recovery Operations, spinning up a new cluster, or restoring from snapshots.
4242

43-
### When Should You Use This?
43+
## When Should You Use This?
4444
- ✅ When you need **semi-automated tools** with audit trails and safety checks
4545
- ✅ When you want **rapid iteration** on operational procedures with built-in rollback steps
4646
- ✅ When you need something more powerful than shell scripts but don't want to build a full application
4747
- ✅ When you want to make complex operations both **safe and repeatable**
4848

49-
### Runbook Best Practices
49+
## Runbook Best Practices
5050
1. Structure your runbooks with:
5151
- Clear purpose and summary
5252
- Step-by-step descriptions
@@ -72,7 +72,7 @@ It's ideal for operations like encoding your Disaster Recovery Operations, spinn
7272
1. Depending on auditing needs, you can either commit the "runs" folder to your repo or only keep the "binder" folder committed.
7373
1. In case of strict auditing needs, we recommend you add auditing of commands in the local SDK as well as in your cloud provider
7474

75-
## Installation
75+
# Installation
7676

7777
We recommend using [uv](https://docs.astral.sh/uv/) for installing runbook as a cli tool. If you already use pipx, you can use that instead.
7878

@@ -86,7 +86,7 @@ Or pin to a version
8686
uv tool install git+https://github.com/zph/runbook.git@1.0.0-rc2
8787
```
8888

89-
## CLI
89+
# CLI
9090

9191
```sh
9292
Usage: runbook [OPTIONS] COMMAND [ARGS]...
@@ -98,16 +98,16 @@ Options:
9898
--help Show this message and exit.
9999

100100
Commands:
101-
check Check language validity and formatting of a notebook.
102-
convert Convert an existing runbook to different format
103-
create Create a new runbook from [template]
104-
diff Diff two notebooks
101+
check Check the language validity and formatting of a runbook.
102+
convert Convert a runbook between different formats
103+
create Create a new runbook from a template
104+
diff Compare two runbooks and show their differences
105105
edit Edit an existing runbook
106106
init Initialize a folder as a runbook repository
107-
list list runbooks
107+
list List runbooks
108108
plan Prepares the runbook for execution by injecting parameters.
109109
review [Unimplemented] Entrypoint for reviewing runbook
110-
run Run a notebook
110+
run Run a runbook
111111
show Show runbook parameters and metadata
112112
version Display version information about runbook
113113
```
@@ -156,7 +156,7 @@ For development we use the following tools:
156156
- [hermit](https://hermit.dev/) to manage developement tool dependencies (see .hermit/bin)
157157
- [uv](https://docs.astral.sh/uv/) python package manager and cli runner (see pyproject.toml)
158158

159-
Necessary deps can be seen in [pyproject.toml](pyproject.toml) and .hermit/bin
159+
Necessary deps can be seen in pyproject.toml and .hermit/bin
160160

161161
Use .hermit/bin/activate-hermit to activate the environment.
162162

docs/README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ runbook run runbook-name.ipynb
3131

3232
# Background
3333

34-
### What is a Runbook?
34+
## What is a Runbook?
3535
A runbook is an executable document that combines:
3636
- Clear markdown documentation
3737
- Runnable code blocks
@@ -40,13 +40,13 @@ A runbook is an executable document that combines:
4040

4141
It's ideal for operations like encoding your Disaster Recovery Operations, spinning up a new cluster, or restoring from snapshots.
4242

43-
### When Should You Use This?
43+
## When Should You Use This?
4444
- ✅ When you need **semi-automated tools** with audit trails and safety checks
4545
- ✅ When you want **rapid iteration** on operational procedures with built-in rollback steps
4646
- ✅ When you need something more powerful than shell scripts but don't want to build a full application
4747
- ✅ When you want to make complex operations both **safe and repeatable**
4848

49-
### Runbook Best Practices
49+
## Runbook Best Practices
5050
1. Structure your runbooks with:
5151
- Clear purpose and summary
5252
- Step-by-step descriptions
@@ -72,7 +72,7 @@ It's ideal for operations like encoding your Disaster Recovery Operations, spinn
7272
1. Depending on auditing needs, you can either commit the "runs" folder to your repo or only keep the "binder" folder committed.
7373
1. In case of strict auditing needs, we recommend you add auditing of commands in the local SDK as well as in your cloud provider
7474

75-
## Installation
75+
# Installation
7676

7777
We recommend using [uv](https://docs.astral.sh/uv/) for installing runbook as a cli tool. If you already use pipx, you can use that instead.
7878

@@ -86,7 +86,7 @@ Or pin to a version
8686
uv tool install git+https://github.com/zph/runbook.git@1.0.0-rc2
8787
```
8888

89-
## CLI
89+
# CLI
9090

9191
```sh
9292
Usage: runbook [OPTIONS] COMMAND [ARGS]...
@@ -98,16 +98,16 @@ Options:
9898
--help Show this message and exit.
9999

100100
Commands:
101-
check Check language validity and formatting of a notebook.
102-
convert Convert an existing runbook to different format
103-
create Create a new runbook from [template]
104-
diff Diff two notebooks
101+
check Check the language validity and formatting of a runbook.
102+
convert Convert a runbook between different formats
103+
create Create a new runbook from a template
104+
diff Compare two runbooks and show their differences
105105
edit Edit an existing runbook
106106
init Initialize a folder as a runbook repository
107-
list list runbooks
107+
list List runbooks
108108
plan Prepares the runbook for execution by injecting parameters.
109109
review [Unimplemented] Entrypoint for reviewing runbook
110-
run Run a notebook
110+
run Run a runbook
111111
show Show runbook parameters and metadata
112112
version Display version information about runbook
113113
```
@@ -156,7 +156,7 @@ For development we use the following tools:
156156
- [hermit](https://hermit.dev/) to manage developement tool dependencies (see .hermit/bin)
157157
- [uv](https://docs.astral.sh/uv/) python package manager and cli runner (see pyproject.toml)
158158

159-
Necessary deps can be seen in [pyproject.toml](pyproject.toml) and .hermit/bin
159+
Necessary deps can be seen in pyproject.toml and .hermit/bin
160160

161161
Use .hermit/bin/activate-hermit to activate the environment.
162162

docs/_static/.gitkeep

Whitespace-only changes.

docs/_templates/.gitkeep

Whitespace-only changes.

docs/cli.rst

-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
Runbook CLI
77
=====================
88

9-
Add your content using ``reStructuredText`` syntax. See the
10-
`reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_
11-
documentation for details.
12-
13-
149
.. toctree::
1510
:maxdepth: 2
1611
:caption: Contents:

runbook/cli/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
create,
88
diff,
99
edit,
10-
export,
1110
init,
1211
list,
1312
plan,
@@ -47,7 +46,6 @@ def cli(ctx, cwd):
4746
cli.add_command(version)
4847
cli.add_command(list)
4948
cli.add_command(show)
50-
# cli.add_command(export)
5149
cli.name = "runbook"
5250
cli
5351

runbook/cli/commands/check.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,24 @@
2525
)
2626
@click.pass_context
2727
def check(ctx, filename, command):
28-
"""Check language validity and formatting of a notebook."""
28+
"""Check the language validity and formatting of a runbook.
29+
30+
This command validates the syntax and formatting of runbook cells based on the kernel
31+
specified in the notebook's metadata. By default:
32+
- For Python kernels: uses 'black' to check code formatting
33+
- For Deno kernels: uses 'deno check' to validate TypeScript/JavaScript
34+
35+
FILENAME: Path to the runbook file to check.
36+
37+
Options:
38+
--command, -c: Specify a custom validation command. Use {} as a placeholder for the
39+
filename (e.g., 'mycheck {} --strict'). This overrides the default
40+
checker for the kernel.
41+
42+
Exit codes:
43+
0: Check passed successfully
44+
Non-zero: Check failed, see error output for details
45+
"""
2946
full_path = path.abspath(filename)
3047
content = None
3148
with open(full_path, "r") as f:

runbook/cli/commands/convert.py

+21-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,27 @@
1717
)
1818
@click.pass_context
1919
def convert(ctx, filename, output):
20-
"""Convert an existing runbook to different format"""
20+
"""Convert a runbook between different formats
21+
22+
This command converts notebooks between various formats using jupytext.
23+
Supported conversions include:
24+
- .ipynb to .py (Python script)
25+
- .ipynb to .ts (Deno notebook)
26+
- .ipynb to .md (Markdown)
27+
- And other formats supported by jupytext
28+
29+
FILENAME: Path to the source notebook file to convert.
30+
OUTPUT: Destination path for the converted file. The format is determined
31+
by the file extension.
32+
33+
Examples:
34+
runbook convert notebook.ipynb script.py # Convert to Python script
35+
runbook convert notebook.ipynb notebook.ts # Convert to Deno notebook
36+
runbook convert notebook.ipynb notebook.md # Convert to Markdown
37+
38+
The conversion preserves cell metadata, notebook metadata, and execution outputs
39+
where applicable.
40+
"""
2141
# Must override argv because it's used in launch instance and there isn't a way
2242
# to pass via argument in ExtensionApp.lauch_instance
2343
# TODO:

runbook/cli/commands/create.py

+26-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
default="./runbooks/binder/_template-deno.ipynb",
1515
type=click.Path(exists=True, file_okay=True),
1616
callback=validate_template,
17+
help="Path to the template file to use",
1718
)
1819

1920
# TODO: switch to language and template defaulting to Deno
@@ -24,10 +25,34 @@
2425
envvar="LANGUAGE",
2526
default="deno",
2627
callback=validate_create_language,
28+
help="Language to use for the runbook",
2729
)
2830
@click.pass_context
2931
def create(ctx, filename, template, language):
30-
"""Create a new runbook from [template]"""
32+
"""Create a new runbook from a template
33+
34+
This command creates a new runbook using a specified template
35+
or language preset. The new runbook will be created in the runbooks/binder directory.
36+
37+
FILENAME: Name for the new runbook file (e.g., 'maintenance-task.ipynb').
38+
Should be a basename only, without directory path.
39+
40+
Options:
41+
--template, -t: Path to a custom template runbook to use as a base.
42+
Can be set via TEMPLATE environment variable.
43+
Default: ./runbooks/binder/_template-deno.ipynb
44+
45+
--language, -l: Shortcut to use a predefined language template.
46+
Can be set via LANGUAGE environment variable.
47+
Default: deno
48+
49+
Examples:
50+
runbook create maintenance-task.ipynb # Creates using default Deno template
51+
runbook create task.ipynb -l python # Creates using Python template
52+
runbook create task.ipynb -t custom-template.ipynb # Creates from custom template
53+
54+
The command will create the notebook and display the edit command to open it.
55+
"""
3156

3257
if language:
3358
template = language

runbook/cli/commands/diff.py

+17-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,23 @@
1818
)
1919
@click.pass_context
2020
def diff(ctx, notebook_1, notebook_2):
21-
"""Diff two notebooks"""
21+
"""Compare two runbooks and show their differences
22+
23+
This command uses nbdime to display a detailed comparison between two runbooks.
24+
25+
Arguments:
26+
NOTEBOOK_1: Path to the first runbook for comparison
27+
NOTEBOOK_2: Path to the second runbook for comparison
28+
29+
Examples:
30+
runbook diff notebook1.ipynb notebook2.ipynb # Compare two notebooks
31+
runbook diff original.ipynb modified.ipynb # Show changes between versions
32+
33+
The diff output will be displayed in a terminal-friendly format, with:
34+
- Added content in green
35+
- Removed content in red
36+
- Modified content showing both versions
37+
"""
2238
argv = [path.abspath(notebook_1), path.abspath(notebook_2)]
2339
from nbdime import nbdiffapp
2440

runbook/cli/commands/export.py

-8
This file was deleted.

runbook/cli/commands/init.py

+2
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@
1717
envvar="DIRECTORY",
1818
default="runbooks",
1919
type=click.Path(exists=False, dir_okay=True),
20+
help="Path to the runbook directory",
2021
)
2122
@click.option(
2223
"-s",
2324
"--skip-confirmation",
2425
envvar="SKIP_CONFIRMATION",
2526
default=False,
2627
type=click.BOOL,
28+
help="Skip confirmation prompt",
2729
)
2830
@click.pass_context
2931
def init(ctx, directory, skip_confirmation):

runbook/cli/commands/list.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
@click.command()
55
@click.pass_context
66
def list(ctx):
7-
"""list runbooks"""
7+
"""List runbooks"""
88
import glob
99

1010
from rich import print as rprint

0 commit comments

Comments
 (0)