blitz-cli 0.3.0__tar.gz → 0.5.0__tar.gz
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.
- blitz_cli-0.5.0/PKG-INFO +95 -0
- blitz_cli-0.5.0/README.md +84 -0
- blitz_cli-0.5.0/blitz_cli/__init__.py +33 -0
- blitz_cli-0.5.0/blitz_cli/_activity.py +705 -0
- {blitz_cli-0.3.0 → blitz_cli-0.5.0}/blitz_cli/_client.py +84 -38
- blitz_cli-0.5.0/blitz_cli/_codeassist.py +260 -0
- blitz_cli-0.5.0/blitz_cli/_dataset.py +106 -0
- blitz_cli-0.5.0/blitz_cli/_local.py +251 -0
- blitz_cli-0.5.0/blitz_cli/_make.py +31 -0
- blitz_cli-0.5.0/blitz_cli/_redact.py +117 -0
- blitz_cli-0.5.0/blitz_cli/_release.py +396 -0
- blitz_cli-0.5.0/blitz_cli/_scaffold.py +167 -0
- {blitz_cli-0.3.0 → blitz_cli-0.5.0}/blitz_cli/_scan/__init__.py +6 -0
- {blitz_cli-0.3.0 → blitz_cli-0.5.0}/blitz_cli/_scan/_js.py +5 -2
- {blitz_cli-0.3.0 → blitz_cli-0.5.0}/blitz_cli/_scan/_models.py +6 -0
- {blitz_cli-0.3.0 → blitz_cli-0.5.0}/blitz_cli/_scan/_python.py +4 -1
- {blitz_cli-0.3.0 → blitz_cli-0.5.0}/blitz_cli/_scan/_report.py +19 -10
- blitz_cli-0.5.0/blitz_cli/_skill.py +59 -0
- blitz_cli-0.5.0/blitz_cli/_sync.py +129 -0
- blitz_cli-0.5.0/blitz_cli/_toml.py +63 -0
- blitz_cli-0.5.0/blitz_cli/_traces.py +194 -0
- blitz_cli-0.5.0/blitz_cli/cli.py +862 -0
- blitz_cli-0.5.0/blitz_cli/skills/blitz-fix-teacher/SKILL.md +180 -0
- blitz_cli-0.5.0/blitz_cli/skills/blitz-instrument/SKILL.md +167 -0
- blitz_cli-0.5.0/blitz_cli/skills/blitz-setup-training/SKILL.md +164 -0
- blitz_cli-0.5.0/blitz_cli/skills/blitz-simulate-traces/SKILL.md +148 -0
- blitz_cli-0.5.0/blitz_cli/templates/Dockerfile.tmpl +23 -0
- blitz_cli-0.5.0/blitz_cli/templates/Makefile.tmpl +79 -0
- blitz_cli-0.5.0/blitz_cli/templates/README.md.tmpl +84 -0
- blitz_cli-0.5.0/blitz_cli/templates/codeassist_Dockerfile.tmpl +21 -0
- blitz_cli-0.5.0/blitz_cli/templates/codeassist_Dockerfile.train.tmpl +17 -0
- blitz_cli-0.5.0/blitz_cli/templates/codeassist_Makefile.tmpl +74 -0
- blitz_cli-0.5.0/blitz_cli/templates/codeassist_README.md.tmpl +91 -0
- blitz_cli-0.5.0/blitz_cli/templates/codeassist_dockerignore.tmpl +9 -0
- blitz_cli-0.5.0/blitz_cli/templates/codeassist_requirements.txt.tmpl +4 -0
- blitz_cli-0.5.0/blitz_cli/templates/codeassist_requirements_train.txt.tmpl +15 -0
- blitz_cli-0.5.0/blitz_cli/templates/codeassist_train.py.tmpl +187 -0
- blitz_cli-0.5.0/blitz_cli/templates/dockerignore.tmpl +9 -0
- {blitz_cli-0.3.0 → blitz_cli-0.5.0}/blitz_cli/templates/requirements.txt.tmpl +6 -1
- blitz_cli-0.5.0/blitz_cli/templates/serve.py.tmpl +125 -0
- blitz_cli-0.5.0/blitz_cli/templates/train.py.tmpl +182 -0
- blitz_cli-0.5.0/blitz_cli/templates/watch.py.tmpl +46 -0
- blitz_cli-0.5.0/pyproject.toml +33 -0
- blitz_cli-0.5.0/tests/test_activity.py +615 -0
- blitz_cli-0.5.0/tests/test_cli.py +79 -0
- blitz_cli-0.5.0/tests/test_codeassist.py +350 -0
- blitz_cli-0.5.0/tests/test_local.py +350 -0
- blitz_cli-0.5.0/tests/test_make.py +46 -0
- blitz_cli-0.5.0/tests/test_redact.py +181 -0
- blitz_cli-0.5.0/tests/test_release.py +315 -0
- blitz_cli-0.5.0/tests/test_scaffold.py +274 -0
- blitz_cli-0.5.0/tests/test_serve.py +140 -0
- blitz_cli-0.5.0/tests/test_sync.py +72 -0
- blitz_cli-0.5.0/tests/test_toml.py +122 -0
- blitz_cli-0.5.0/tests/test_traces.py +98 -0
- blitz_cli-0.3.0/PKG-INFO +0 -36
- blitz_cli-0.3.0/README.md +0 -27
- blitz_cli-0.3.0/blitz_cli/__init__.py +0 -26
- blitz_cli-0.3.0/blitz_cli/_scaffold.py +0 -111
- blitz_cli-0.3.0/blitz_cli/_skill.py +0 -42
- blitz_cli-0.3.0/blitz_cli/cli.py +0 -383
- blitz_cli-0.3.0/blitz_cli/skills/onboard-to-blitz/SKILL.md +0 -140
- blitz_cli-0.3.0/blitz_cli/templates/Dockerfile.tmpl +0 -16
- blitz_cli-0.3.0/blitz_cli/templates/Makefile.tmpl +0 -33
- blitz_cli-0.3.0/blitz_cli/templates/README.md.tmpl +0 -36
- blitz_cli-0.3.0/blitz_cli/templates/dockerignore.tmpl +0 -4
- blitz_cli-0.3.0/blitz_cli/templates/eval.py.tmpl +0 -105
- blitz_cli-0.3.0/blitz_cli/templates/train.py.tmpl +0 -184
- blitz_cli-0.3.0/pyproject.toml +0 -26
- blitz_cli-0.3.0/tests/test_scaffold.py +0 -80
- {blitz_cli-0.3.0 → blitz_cli-0.5.0}/.github/workflows/homebrew.yml +0 -0
- {blitz_cli-0.3.0 → blitz_cli-0.5.0}/.github/workflows/publish.yml +0 -0
- {blitz_cli-0.3.0 → blitz_cli-0.5.0}/.gitignore +0 -0
- {blitz_cli-0.3.0 → blitz_cli-0.5.0}/LICENSE +0 -0
- {blitz_cli-0.3.0 → blitz_cli-0.5.0}/blitz_cli/_scan/_classify.py +0 -0
- {blitz_cli-0.3.0 → blitz_cli-0.5.0}/blitz_cli/_scan/_walk.py +0 -0
- {blitz_cli-0.3.0 → blitz_cli-0.5.0}/blitz_cli/skills/__init__.py +0 -0
- {blitz_cli-0.3.0 → blitz_cli-0.5.0}/blitz_cli/templates/__init__.py +0 -0
- {blitz_cli-0.3.0 → blitz_cli-0.5.0}/tests/test_scan.py +0 -0
blitz_cli-0.5.0/PKG-INFO
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: blitz-cli
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: Developer CLI for Blitz: local-first tracing/init, codebase instrumentation scan, and scaffolds for both a QLoRA workflow trainer and a coding-agent session-to-fine-tuning-corpus watcher.
|
|
5
|
+
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Requires-Dist: rich>=13
|
|
9
|
+
Requires-Dist: tomlkit>=0.12
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# blitz-cli
|
|
13
|
+
|
|
14
|
+
Developer CLI for [Blitz](https://github.com/sparepartslabs/blitz-sdk-py). Pull a
|
|
15
|
+
workflow's locally captured traces as a fine-tuning dataset, scaffold a
|
|
16
|
+
self-contained, runnable QLoRA training container, and (optionally) release the
|
|
17
|
+
trained adapter for Blitz to deploy and host.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install blitz-cli
|
|
21
|
+
|
|
22
|
+
blitz scaffold -w mechanic-assistant -o ./train
|
|
23
|
+
blitz config set -w mechanic-assistant --base <hf-model-id> --params-b <N> --seq-len <N>
|
|
24
|
+
|
|
25
|
+
cd train
|
|
26
|
+
make build && make train
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`blitz scaffold` writes `./train` with `data/dataset.jsonl` and a `Dockerfile` +
|
|
30
|
+
`train.py` + `Makefile`. Bring your own NVIDIA GPU. Both commands are fully
|
|
31
|
+
local/offline — no project id or API key needed; the training config lives in
|
|
32
|
+
a repo-root `blitz.toml`.
|
|
33
|
+
|
|
34
|
+
This package is stdlib + the Blitz HTTP API, plus `rich` (for `blitz traces`'
|
|
35
|
+
and `blitz activity`'s table/tree rendering) and `tomlkit` (for reading/writing
|
|
36
|
+
`blitz.toml`). The heavy ML stack (torch / transformers / trl / peft) is
|
|
37
|
+
pinned only in the *generated* project's `requirements.txt`, installed inside
|
|
38
|
+
the training image.
|
|
39
|
+
|
|
40
|
+
### Release: deploy to production
|
|
41
|
+
|
|
42
|
+
Once a local training run has produced `./train/adapter`, `blitz release`
|
|
43
|
+
registers the run with Blitz, uploads the adapter to S3, and triggers Blitz's
|
|
44
|
+
own deploy pipeline (a vLLM-served endpoint with native multi-LoRA serving, so
|
|
45
|
+
one base-model image is reused across releases), then reports the smoke test
|
|
46
|
+
result. No Modal account, token, or dependency needed on your machine — Blitz
|
|
47
|
+
owns the deploy, opaque to you:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
export BLITZ_API_KEY=blz_... # a read-scoped project key
|
|
51
|
+
blitz release -w mechanic-assistant -p proj_abc
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`--idle-timeout` controls how long the deployed container stays warm after
|
|
55
|
+
its last request before scaling to zero — the lever for
|
|
56
|
+
trading off cold-start latency against idle GPU cost.
|
|
57
|
+
|
|
58
|
+
### Reading captured traces
|
|
59
|
+
|
|
60
|
+
`blitz.init()` always writes spans to a local SQLite file (`.blitz/traces.db`
|
|
61
|
+
by default — override with `BLITZ_LOCAL_DIR`, or a repo-root `blitz.toml`'s
|
|
62
|
+
`[capture] local_dir`). Read them back with:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
blitz traces list
|
|
66
|
+
blitz traces show <trace_id>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
No project id or API key needed.
|
|
70
|
+
|
|
71
|
+
### Replaying coding-agent session activity
|
|
72
|
+
|
|
73
|
+
`blitz activity` reads your local coding agent's own session transcripts
|
|
74
|
+
(`~/.claude/projects`, unrelated to Blitz's captured traces above) for the
|
|
75
|
+
current repo and replays each prompt you sent alongside the actions taken to
|
|
76
|
+
resolve it (tool calls, sub-agents) and the final response:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
blitz activity --list # sessions for this repo, most recent first
|
|
80
|
+
blitz activity # the most recent session's timeline
|
|
81
|
+
blitz activity <session-id-prefix> # a specific session
|
|
82
|
+
blitz activity --full # untruncated prompts/responses/tool I/O in the terminal
|
|
83
|
+
blitz activity --html report.html # also write a self-contained HTML report
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The terminal view is compact by default (truncated prompt/response/tool I/O)
|
|
87
|
+
for a quick glance; pass `--full` for the untruncated text there too. The
|
|
88
|
+
HTML report always includes each action's full tool input/output, collapsed
|
|
89
|
+
per action so it stays scannable. Each turn also shows its raw token usage
|
|
90
|
+
(input/output/cache tokens and model), and where a pre-edit backup was kept
|
|
91
|
+
(`~/.claude/file-history`), an `Edit`/`Write` action shows a real diff of what
|
|
92
|
+
changed — reconstructed from the action's own recorded input, so it reflects
|
|
93
|
+
that turn's change even if the file has since drifted further.
|
|
94
|
+
|
|
95
|
+
No project id or API key needed; this only reads local session data.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# blitz-cli
|
|
2
|
+
|
|
3
|
+
Developer CLI for [Blitz](https://github.com/sparepartslabs/blitz-sdk-py). Pull a
|
|
4
|
+
workflow's locally captured traces as a fine-tuning dataset, scaffold a
|
|
5
|
+
self-contained, runnable QLoRA training container, and (optionally) release the
|
|
6
|
+
trained adapter for Blitz to deploy and host.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pip install blitz-cli
|
|
10
|
+
|
|
11
|
+
blitz scaffold -w mechanic-assistant -o ./train
|
|
12
|
+
blitz config set -w mechanic-assistant --base <hf-model-id> --params-b <N> --seq-len <N>
|
|
13
|
+
|
|
14
|
+
cd train
|
|
15
|
+
make build && make train
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`blitz scaffold` writes `./train` with `data/dataset.jsonl` and a `Dockerfile` +
|
|
19
|
+
`train.py` + `Makefile`. Bring your own NVIDIA GPU. Both commands are fully
|
|
20
|
+
local/offline — no project id or API key needed; the training config lives in
|
|
21
|
+
a repo-root `blitz.toml`.
|
|
22
|
+
|
|
23
|
+
This package is stdlib + the Blitz HTTP API, plus `rich` (for `blitz traces`'
|
|
24
|
+
and `blitz activity`'s table/tree rendering) and `tomlkit` (for reading/writing
|
|
25
|
+
`blitz.toml`). The heavy ML stack (torch / transformers / trl / peft) is
|
|
26
|
+
pinned only in the *generated* project's `requirements.txt`, installed inside
|
|
27
|
+
the training image.
|
|
28
|
+
|
|
29
|
+
### Release: deploy to production
|
|
30
|
+
|
|
31
|
+
Once a local training run has produced `./train/adapter`, `blitz release`
|
|
32
|
+
registers the run with Blitz, uploads the adapter to S3, and triggers Blitz's
|
|
33
|
+
own deploy pipeline (a vLLM-served endpoint with native multi-LoRA serving, so
|
|
34
|
+
one base-model image is reused across releases), then reports the smoke test
|
|
35
|
+
result. No Modal account, token, or dependency needed on your machine — Blitz
|
|
36
|
+
owns the deploy, opaque to you:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
export BLITZ_API_KEY=blz_... # a read-scoped project key
|
|
40
|
+
blitz release -w mechanic-assistant -p proj_abc
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`--idle-timeout` controls how long the deployed container stays warm after
|
|
44
|
+
its last request before scaling to zero — the lever for
|
|
45
|
+
trading off cold-start latency against idle GPU cost.
|
|
46
|
+
|
|
47
|
+
### Reading captured traces
|
|
48
|
+
|
|
49
|
+
`blitz.init()` always writes spans to a local SQLite file (`.blitz/traces.db`
|
|
50
|
+
by default — override with `BLITZ_LOCAL_DIR`, or a repo-root `blitz.toml`'s
|
|
51
|
+
`[capture] local_dir`). Read them back with:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
blitz traces list
|
|
55
|
+
blitz traces show <trace_id>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
No project id or API key needed.
|
|
59
|
+
|
|
60
|
+
### Replaying coding-agent session activity
|
|
61
|
+
|
|
62
|
+
`blitz activity` reads your local coding agent's own session transcripts
|
|
63
|
+
(`~/.claude/projects`, unrelated to Blitz's captured traces above) for the
|
|
64
|
+
current repo and replays each prompt you sent alongside the actions taken to
|
|
65
|
+
resolve it (tool calls, sub-agents) and the final response:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
blitz activity --list # sessions for this repo, most recent first
|
|
69
|
+
blitz activity # the most recent session's timeline
|
|
70
|
+
blitz activity <session-id-prefix> # a specific session
|
|
71
|
+
blitz activity --full # untruncated prompts/responses/tool I/O in the terminal
|
|
72
|
+
blitz activity --html report.html # also write a self-contained HTML report
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The terminal view is compact by default (truncated prompt/response/tool I/O)
|
|
76
|
+
for a quick glance; pass `--full` for the untruncated text there too. The
|
|
77
|
+
HTML report always includes each action's full tool input/output, collapsed
|
|
78
|
+
per action so it stays scannable. Each turn also shows its raw token usage
|
|
79
|
+
(input/output/cache tokens and model), and where a pre-edit backup was kept
|
|
80
|
+
(`~/.claude/file-history`), an `Edit`/`Write` action shows a real diff of what
|
|
81
|
+
changed — reconstructed from the action's own recorded input, so it reflects
|
|
82
|
+
that turn's change even if the file has since drifted further.
|
|
83
|
+
|
|
84
|
+
No project id or API key needed; this only reads local session data.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""blitz-cli — instrument a codebase for Blitz and scaffold a QLoRA trainer.
|
|
2
|
+
|
|
3
|
+
Commands:
|
|
4
|
+
|
|
5
|
+
- ``blitz init`` — write a repo-root ``blitz.toml`` (project/local_dir/environment/
|
|
6
|
+
service_name) and stub the local trace store. Infers the project id from the git
|
|
7
|
+
remote. No endpoint or API key needed; traces are always captured locally.
|
|
8
|
+
|
|
9
|
+
- ``blitz scan [path]`` — statically walk a codebase and report each AI/LLM
|
|
10
|
+
call's Blitz instrumentation posture (unsupported provider / no blitz.init() /
|
|
11
|
+
traced-but-unnamed / instrumented), with copy-paste fixes. Offline, no API key.
|
|
12
|
+
|
|
13
|
+
- ``blitz traces list`` / ``blitz traces show <trace_id>`` — inspect captured
|
|
14
|
+
traces from the local SQLite store.
|
|
15
|
+
|
|
16
|
+
- ``blitz activity [session] [--list] [--html report.html]`` — replay a
|
|
17
|
+
Claude Code session for this repo: each prompt you sent, the actions taken
|
|
18
|
+
to resolve it (tool calls, sub-agents), and the final response. Reads
|
|
19
|
+
``~/.claude/projects`` directly; unrelated to Blitz's own captured traces.
|
|
20
|
+
|
|
21
|
+
- ``blitz skill install`` — drop the Blitz Claude Code skills (``blitz-instrument``,
|
|
22
|
+
``blitz-fix-teacher``) into the repo's ``.claude/skills`` so Claude can run the
|
|
23
|
+
instrumentation and teacher-hardening playbooks.
|
|
24
|
+
|
|
25
|
+
- ``blitz scaffold -p <project> -w <workflow> -o ./train`` — download a
|
|
26
|
+
workflow's SFT dataset, then emit a self-contained, runnable training project
|
|
27
|
+
(Dockerfile + train.py). Authenticates with a read-scoped Blitz API key
|
|
28
|
+
(``BLITZ_API_KEY``).
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
__all__ = ["__version__"]
|
|
32
|
+
|
|
33
|
+
__version__ = "0.5.0"
|