dap-cli 0.4.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.
Files changed (33) hide show
  1. dap_cli-0.4.0/.gitignore +94 -0
  2. dap_cli-0.4.0/PKG-INFO +186 -0
  3. dap_cli-0.4.0/README.md +166 -0
  4. dap_cli-0.4.0/hatch_build.py +32 -0
  5. dap_cli-0.4.0/pyproject.toml +73 -0
  6. dap_cli-0.4.0/src/dap_cli/__init__.py +1 -0
  7. dap_cli-0.4.0/src/dap_cli/__main__.py +116 -0
  8. dap_cli-0.4.0/src/dap_cli/_dashboard/.gitkeep +5 -0
  9. dap_cli-0.4.0/src/dap_cli/_dashboard/BUNDLE_INFO.txt +3 -0
  10. dap_cli-0.4.0/src/dap_cli/_dashboard/package.json +87 -0
  11. dap_cli-0.4.0/src/dap_cli/_dashboard/server.js +38 -0
  12. dap_cli-0.4.0/src/dap_cli/_demo/example.pipeline-bundle.json +66 -0
  13. dap_cli-0.4.0/src/dap_cli/_demo/examplepipe/__init__.py +6 -0
  14. dap_cli-0.4.0/src/dap_cli/_demo/examplepipe/gates.py +16 -0
  15. dap_cli-0.4.0/src/dap_cli/_demo/examplepipe/nodes.py +34 -0
  16. dap_cli-0.4.0/src/dap_cli/bootstrap.py +300 -0
  17. dap_cli-0.4.0/src/dap_cli/commands/__init__.py +0 -0
  18. dap_cli-0.4.0/src/dap_cli/commands/cortex.py +1021 -0
  19. dap_cli-0.4.0/src/dap_cli/commands/demo.py +213 -0
  20. dap_cli-0.4.0/src/dap_cli/commands/init.py +183 -0
  21. dap_cli-0.4.0/src/dap_cli/commands/pipeline.py +303 -0
  22. dap_cli-0.4.0/src/dap_cli/commands/project.py +170 -0
  23. dap_cli-0.4.0/src/dap_cli/commands/start.py +124 -0
  24. dap_cli-0.4.0/src/dap_cli/commands/status.py +136 -0
  25. dap_cli-0.4.0/src/dap_cli/commands/stop.py +35 -0
  26. dap_cli-0.4.0/src/dap_cli/dashboard.py +99 -0
  27. dap_cli-0.4.0/src/dap_cli/http_utils.py +71 -0
  28. dap_cli-0.4.0/src/dap_cli/hub_export.py +960 -0
  29. dap_cli-0.4.0/src/dap_cli/hub_names.py +377 -0
  30. dap_cli-0.4.0/src/dap_cli/hub_runner.py +522 -0
  31. dap_cli-0.4.0/src/dap_cli/paths.py +27 -0
  32. dap_cli-0.4.0/src/dap_cli/process.py +130 -0
  33. dap_cli-0.4.0/src/dap_cli/py.typed +0 -0
@@ -0,0 +1,94 @@
1
+ # --- Python ---
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ .venv/
8
+ venv/
9
+ env/
10
+ *.egg-info/
11
+ *.egg
12
+ dist/
13
+ build/
14
+ .eggs/
15
+ pip-log.txt
16
+ pip-delete-this-directory.txt
17
+
18
+ # uv
19
+ .uv-cache/
20
+
21
+ # Type checkers / linters
22
+ .mypy_cache/
23
+ .ruff_cache/
24
+ .pyright/
25
+ .pytype/
26
+
27
+ # pytest / coverage
28
+ .pytest_cache/
29
+ .coverage
30
+ .coverage.*
31
+ htmlcov/
32
+ .tox/
33
+ .nox/
34
+ coverage.xml
35
+ *.cover
36
+
37
+ # --- Node (dashboard) ---
38
+ node_modules/
39
+ .pnpm-store/
40
+ .next/
41
+ out/
42
+ *.tsbuildinfo
43
+ .turbo/
44
+
45
+ # --- Environment ---
46
+ .env
47
+ .env.local
48
+ .env.*.local
49
+
50
+ # --- DAP local state ---
51
+ .dap/
52
+ *.db
53
+ *.db-journal
54
+ *.db-wal
55
+ *.db-shm
56
+
57
+ # --- Logs ---
58
+ logs/
59
+ *.log
60
+ npm-debug.log*
61
+ pnpm-debug.log*
62
+
63
+ # --- IDE / Agents ---
64
+ .vscode/
65
+ .idea/
66
+ *.swp
67
+ *.swo
68
+ .claude/
69
+
70
+ # --- OS ---
71
+ .DS_Store
72
+ Thumbs.db
73
+
74
+ # --- Cache ---
75
+ .cache/
76
+ .eslintcache
77
+
78
+ # --- Built artefacts ---
79
+ # Dashboard bundle staged into the dap-cli wheel by
80
+ # scripts/build-dashboard-bundle.sh — regenerated on demand from
81
+ # apps/dashboard/.next. The ``.gitkeep`` is retained so hatchling's
82
+ # ``force-include`` always finds the directory; dev wheels built
83
+ # without running the bundle script ship an effectively-empty
84
+ # ``_dashboard/`` and ``dap start`` falls back to "dashboard not
85
+ # bundled".
86
+ apps/cli/src/dap_cli/_dashboard/*
87
+ !apps/cli/src/dap_cli/_dashboard/.gitkeep
88
+ .mcp.json
89
+
90
+ # --- Playwright (e2e) ---
91
+ e2e/.auth/
92
+ e2e/test-results/
93
+ e2e/playwright-report/
94
+ .gstack/
dap_cli-0.4.0/PKG-INFO ADDED
@@ -0,0 +1,186 @@
1
+ Metadata-Version: 2.5
2
+ Name: dap-cli
3
+ Version: 0.4.0
4
+ Summary: DAP CLI launcher (dap init / start / stop / status)
5
+ Project-URL: Homepage, https://github.com/lagowski/dap
6
+ Project-URL: Repository, https://github.com/lagowski/dap
7
+ Project-URL: Issues, https://github.com/lagowski/dap/issues
8
+ Project-URL: Author — Rafał Łagowski, https://www.linkedin.com/in/rafallagowski/
9
+ Project-URL: Author — Daniel Łagowski, https://www.linkedin.com/in/daniellagowski/
10
+ Author: Rafał Łagowski, Daniel Łagowski
11
+ License: MIT
12
+ Requires-Python: >=3.13
13
+ Requires-Dist: dap-engine<0.5,>=0.4
14
+ Requires-Dist: httpx>=0.27.2
15
+ Requires-Dist: psutil>=6.1.0
16
+ Requires-Dist: rich>=13.9.2
17
+ Requires-Dist: typer>=0.27.1
18
+ Requires-Dist: uvicorn[standard]>=0.52.1
19
+ Description-Content-Type: text/markdown
20
+
21
+ # dap-cli
22
+
23
+ The command-line launcher for [DAP](https://github.com/lagowski/dap)
24
+ (Deterministic Agent Pipeline). Installs as a single binary that
25
+ spawns both the engine and the Next.js dashboard, with all five
26
+ first-party packages (`dap-engine`, `dap-schemas`, `dap-runtimes`,
27
+ `dap-prompt-dsl`, and this CLI) pulled in as dependencies.
28
+
29
+ For most installations, `dap-cli` is the only package you install
30
+ directly — everything else arrives transitively.
31
+
32
+ ## Installation
33
+
34
+ The recommended path is `pipx`, which installs the CLI in an
35
+ isolated virtualenv but exposes the `dap` binary on `PATH`:
36
+
37
+ ```bash
38
+ pipx install dap-cli
39
+ ```
40
+
41
+ Standard `pip --user` works too:
42
+
43
+ ```bash
44
+ pip install --user dap-cli
45
+ ```
46
+
47
+ After install:
48
+
49
+ ```bash
50
+ dap --version # → 0.3.0
51
+ dap --help # subcommand list
52
+ ```
53
+
54
+ The wheel ships with the Next.js dashboard pre-built — `dap start`
55
+ spawns it inline when Node is available on `PATH`; otherwise it
56
+ falls back to engine-only mode (the CLI prints a hint).
57
+
58
+ ## Commands
59
+
60
+ | Command | Purpose |
61
+ |---|---|
62
+ | `dap --version` | Print the installed version |
63
+ | `dap --help` | List subcommands |
64
+ | `dap init` | Initialise `./.dap/` and bootstrap the admin user |
65
+ | `dap start` | Spawn engine (127.0.0.1:7333) + dashboard (127.0.0.1:7332) |
66
+ | `dap stop` | Stop the running engine + dashboard cleanly |
67
+ | `dap status` | Show project state: admin bootstrap, engine PID/uptime, runtime adapter health |
68
+
69
+ ### `dap init`
70
+
71
+ Creates `./.dap/` with `config.json`, `state.db` (SQLite), and the
72
+ admin bootstrap. Three credential modes:
73
+
74
+ ```bash
75
+ # 1. Flag-driven (password lands in shell history — local dev).
76
+ dap init --admin-email=you@example.com --admin-password=hunter12345
77
+
78
+ # 2. Stdin (kubectl-style — automation-friendly).
79
+ echo 'hunter12345' | dap init --admin-email=you@example.com --admin-password-stdin
80
+
81
+ # 3. Interactive (getpass + confirmation, no echo).
82
+ dap init --admin-email=you@example.com
83
+ ```
84
+
85
+ Empty password in interactive mode triggers a random 22-character
86
+ generation, printed exactly once. Re-running with `--force` is
87
+ idempotent — an existing email gets promoted to admin; the password
88
+ is rotated only when `--admin-password=...` is supplied explicitly.
89
+
90
+ `DAP_DB_PATH` is honored — useful when bootstrapping inside the
91
+ Docker container (where compose sets `DAP_DB_PATH=/data/state.db`).
92
+
93
+ ### `dap start`
94
+
95
+ Starts both processes in parallel under the current shell. The
96
+ engine runs in-process (so its uvicorn logs print directly to
97
+ stdout/stderr), and the dashboard is spawned as a subprocess whose
98
+ stdout/stderr is inherited unchanged — both streams interleave on
99
+ your terminal without an extra prefix. Ctrl-C tears the whole stack
100
+ down cleanly.
101
+
102
+ (The `./scripts/dev` wrapper used during source-checkout development
103
+ *does* prefix lines with `[engine]` / `[dashboard]`. The packaged
104
+ `dap start` does not — keeping the install-from-PyPI binary simple.)
105
+
106
+ Flags:
107
+
108
+ | Flag | Default | Description |
109
+ |---|---|---|
110
+ | `--engine-host` | `127.0.0.1` | Engine bind address |
111
+ | `--engine-port` | `7333` | Engine port |
112
+ | `--dashboard-port` | `7332` | Dashboard port |
113
+ | `--no-dashboard` | off | Run engine-only even if Node is present |
114
+
115
+ ### `dap status`
116
+
117
+ Reports the current state without modifying anything:
118
+
119
+ ```text
120
+ ✓ admin bootstrap: you@example.com (2026-05-13T10:00:00+00:00)
121
+ ● engine: running PID 12345 port 7333 uptime 3h12m
122
+
123
+ Runtime adapters
124
+ ├─ api-call ✓ healthy
125
+ ├─ bash ✓ healthy
126
+ ├─ claude-code ✓ healthy
127
+ ├─ codex ✗ codex not found on PATH
128
+ └─ ...
129
+ ```
130
+
131
+ Useful in CI / health probes — exits non-zero if anything is
132
+ broken.
133
+
134
+ ## Quick start
135
+
136
+ ```bash
137
+ # 1. Install.
138
+ pipx install dap-cli
139
+
140
+ # 2. Initialise.
141
+ dap init --admin-email=you@example.com
142
+
143
+ # 3. Run.
144
+ dap start
145
+ # Browser: http://localhost:7332 (dashboard)
146
+ # http://localhost:7333 (engine API + /docs)
147
+
148
+ # 4. Stop when done.
149
+ dap stop
150
+ ```
151
+
152
+ See [`docs/quick-start.md`](https://github.com/lagowski/dap/blob/main/docs/quick-start.md)
153
+ for the full decision tree (laptop vs VPS, SQLite vs Postgres,
154
+ Docker vs no-Docker) and the per-path walkthroughs.
155
+
156
+ ## Running from a source checkout
157
+
158
+ If you're developing DAP itself or want to run against an
159
+ unreleased commit:
160
+
161
+ ```bash
162
+ git clone https://github.com/lagowski/dap.git
163
+ cd dap
164
+ ./scripts/setup
165
+ ./scripts/dev
166
+ ```
167
+
168
+ The `scripts/dev` wrapper brings engine + dashboard up in one
169
+ terminal with hot reload on both sides.
170
+
171
+ ## Compatibility
172
+
173
+ - Python 3.13+
174
+ - Node 22+ (optional — required only for the bundled dashboard;
175
+ engine works without it)
176
+
177
+ ## See also
178
+
179
+ - [DAP project README](https://github.com/lagowski/dap) — architecture overview.
180
+ - [`docs/quick-start.md`](https://github.com/lagowski/dap/blob/main/docs/quick-start.md) — install + first-pipeline tutorial.
181
+ - [`docs/self-hosting.md`](https://github.com/lagowski/dap/blob/main/docs/self-hosting.md) — production deployment + reverse-proxy hardening.
182
+ - [`docs/admin-guide.md`](https://github.com/lagowski/dap/blob/main/docs/admin-guide.md) — operator manual for `/admin/*`.
183
+
184
+ ## License
185
+
186
+ See the [main repository](https://github.com/lagowski/dap) for licensing details.
@@ -0,0 +1,166 @@
1
+ # dap-cli
2
+
3
+ The command-line launcher for [DAP](https://github.com/lagowski/dap)
4
+ (Deterministic Agent Pipeline). Installs as a single binary that
5
+ spawns both the engine and the Next.js dashboard, with all five
6
+ first-party packages (`dap-engine`, `dap-schemas`, `dap-runtimes`,
7
+ `dap-prompt-dsl`, and this CLI) pulled in as dependencies.
8
+
9
+ For most installations, `dap-cli` is the only package you install
10
+ directly — everything else arrives transitively.
11
+
12
+ ## Installation
13
+
14
+ The recommended path is `pipx`, which installs the CLI in an
15
+ isolated virtualenv but exposes the `dap` binary on `PATH`:
16
+
17
+ ```bash
18
+ pipx install dap-cli
19
+ ```
20
+
21
+ Standard `pip --user` works too:
22
+
23
+ ```bash
24
+ pip install --user dap-cli
25
+ ```
26
+
27
+ After install:
28
+
29
+ ```bash
30
+ dap --version # → 0.3.0
31
+ dap --help # subcommand list
32
+ ```
33
+
34
+ The wheel ships with the Next.js dashboard pre-built — `dap start`
35
+ spawns it inline when Node is available on `PATH`; otherwise it
36
+ falls back to engine-only mode (the CLI prints a hint).
37
+
38
+ ## Commands
39
+
40
+ | Command | Purpose |
41
+ |---|---|
42
+ | `dap --version` | Print the installed version |
43
+ | `dap --help` | List subcommands |
44
+ | `dap init` | Initialise `./.dap/` and bootstrap the admin user |
45
+ | `dap start` | Spawn engine (127.0.0.1:7333) + dashboard (127.0.0.1:7332) |
46
+ | `dap stop` | Stop the running engine + dashboard cleanly |
47
+ | `dap status` | Show project state: admin bootstrap, engine PID/uptime, runtime adapter health |
48
+
49
+ ### `dap init`
50
+
51
+ Creates `./.dap/` with `config.json`, `state.db` (SQLite), and the
52
+ admin bootstrap. Three credential modes:
53
+
54
+ ```bash
55
+ # 1. Flag-driven (password lands in shell history — local dev).
56
+ dap init --admin-email=you@example.com --admin-password=hunter12345
57
+
58
+ # 2. Stdin (kubectl-style — automation-friendly).
59
+ echo 'hunter12345' | dap init --admin-email=you@example.com --admin-password-stdin
60
+
61
+ # 3. Interactive (getpass + confirmation, no echo).
62
+ dap init --admin-email=you@example.com
63
+ ```
64
+
65
+ Empty password in interactive mode triggers a random 22-character
66
+ generation, printed exactly once. Re-running with `--force` is
67
+ idempotent — an existing email gets promoted to admin; the password
68
+ is rotated only when `--admin-password=...` is supplied explicitly.
69
+
70
+ `DAP_DB_PATH` is honored — useful when bootstrapping inside the
71
+ Docker container (where compose sets `DAP_DB_PATH=/data/state.db`).
72
+
73
+ ### `dap start`
74
+
75
+ Starts both processes in parallel under the current shell. The
76
+ engine runs in-process (so its uvicorn logs print directly to
77
+ stdout/stderr), and the dashboard is spawned as a subprocess whose
78
+ stdout/stderr is inherited unchanged — both streams interleave on
79
+ your terminal without an extra prefix. Ctrl-C tears the whole stack
80
+ down cleanly.
81
+
82
+ (The `./scripts/dev` wrapper used during source-checkout development
83
+ *does* prefix lines with `[engine]` / `[dashboard]`. The packaged
84
+ `dap start` does not — keeping the install-from-PyPI binary simple.)
85
+
86
+ Flags:
87
+
88
+ | Flag | Default | Description |
89
+ |---|---|---|
90
+ | `--engine-host` | `127.0.0.1` | Engine bind address |
91
+ | `--engine-port` | `7333` | Engine port |
92
+ | `--dashboard-port` | `7332` | Dashboard port |
93
+ | `--no-dashboard` | off | Run engine-only even if Node is present |
94
+
95
+ ### `dap status`
96
+
97
+ Reports the current state without modifying anything:
98
+
99
+ ```text
100
+ ✓ admin bootstrap: you@example.com (2026-05-13T10:00:00+00:00)
101
+ ● engine: running PID 12345 port 7333 uptime 3h12m
102
+
103
+ Runtime adapters
104
+ ├─ api-call ✓ healthy
105
+ ├─ bash ✓ healthy
106
+ ├─ claude-code ✓ healthy
107
+ ├─ codex ✗ codex not found on PATH
108
+ └─ ...
109
+ ```
110
+
111
+ Useful in CI / health probes — exits non-zero if anything is
112
+ broken.
113
+
114
+ ## Quick start
115
+
116
+ ```bash
117
+ # 1. Install.
118
+ pipx install dap-cli
119
+
120
+ # 2. Initialise.
121
+ dap init --admin-email=you@example.com
122
+
123
+ # 3. Run.
124
+ dap start
125
+ # Browser: http://localhost:7332 (dashboard)
126
+ # http://localhost:7333 (engine API + /docs)
127
+
128
+ # 4. Stop when done.
129
+ dap stop
130
+ ```
131
+
132
+ See [`docs/quick-start.md`](https://github.com/lagowski/dap/blob/main/docs/quick-start.md)
133
+ for the full decision tree (laptop vs VPS, SQLite vs Postgres,
134
+ Docker vs no-Docker) and the per-path walkthroughs.
135
+
136
+ ## Running from a source checkout
137
+
138
+ If you're developing DAP itself or want to run against an
139
+ unreleased commit:
140
+
141
+ ```bash
142
+ git clone https://github.com/lagowski/dap.git
143
+ cd dap
144
+ ./scripts/setup
145
+ ./scripts/dev
146
+ ```
147
+
148
+ The `scripts/dev` wrapper brings engine + dashboard up in one
149
+ terminal with hot reload on both sides.
150
+
151
+ ## Compatibility
152
+
153
+ - Python 3.13+
154
+ - Node 22+ (optional — required only for the bundled dashboard;
155
+ engine works without it)
156
+
157
+ ## See also
158
+
159
+ - [DAP project README](https://github.com/lagowski/dap) — architecture overview.
160
+ - [`docs/quick-start.md`](https://github.com/lagowski/dap/blob/main/docs/quick-start.md) — install + first-pipeline tutorial.
161
+ - [`docs/self-hosting.md`](https://github.com/lagowski/dap/blob/main/docs/self-hosting.md) — production deployment + reverse-proxy hardening.
162
+ - [`docs/admin-guide.md`](https://github.com/lagowski/dap/blob/main/docs/admin-guide.md) — operator manual for `/admin/*`.
163
+
164
+ ## License
165
+
166
+ See the [main repository](https://github.com/lagowski/dap) for licensing details.
@@ -0,0 +1,32 @@
1
+ """Carry the ``dap demo`` example into the dap-cli wheel as ``dap_cli/_demo`` (#1042).
2
+
3
+ From a checkout the example lives at ``examples/python-func-pipeline``, outside
4
+ this project, so the wheel force-includes it from there. A wheel built from the
5
+ sdist finds it already under ``src/dap_cli/_demo`` (the sdist copies it in) and
6
+ needs nothing extra. A plain ``force-include`` can't express "if present": a
7
+ missing source is a hard build error.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ from pathlib import Path
13
+ from typing import Any
14
+
15
+ # hatchling exists only in the build environment, not in the dev venv.
16
+ from hatchling.builders.hooks.plugin.interface import ( # type: ignore[import-not-found]
17
+ BuildHookInterface,
18
+ )
19
+
20
+ EXAMPLE = Path(__file__).resolve().parents[2] / "examples" / "python-func-pipeline"
21
+
22
+
23
+ class DemoAssetsHook(BuildHookInterface): # type: ignore[misc]
24
+ def initialize(self, version: str, build_data: dict[str, Any]) -> None:
25
+ if (Path(self.root) / "src" / "dap_cli" / "_demo").is_dir() or not EXAMPLE.is_dir():
26
+ return
27
+ force = build_data["force_include"]
28
+ force[str(EXAMPLE / "example.pipeline-bundle.json")] = (
29
+ "dap_cli/_demo/example.pipeline-bundle.json"
30
+ )
31
+ for module in sorted((EXAMPLE / "examplepipe").glob("*.py")):
32
+ force[str(module)] = f"dap_cli/_demo/examplepipe/{module.name}"
@@ -0,0 +1,73 @@
1
+ [project]
2
+ name = "dap-cli"
3
+ version = "0.4.0"
4
+ description = "DAP CLI launcher (dap init / start / stop / status)"
5
+ readme = "README.md"
6
+ requires-python = ">=3.13"
7
+ license = { text = "MIT" }
8
+ authors = [
9
+ { name = "Rafał Łagowski" },
10
+ { name = "Daniel Łagowski" },
11
+ ]
12
+ dependencies = [
13
+ "dap-engine>=0.4,<0.5",
14
+ "typer>=0.27.1",
15
+ "rich>=13.9.2",
16
+ "uvicorn[standard]>=0.52.1",
17
+ "psutil>=6.1.0",
18
+ "httpx>=0.27.2",
19
+ ]
20
+
21
+ [project.urls]
22
+ Homepage = "https://github.com/lagowski/dap"
23
+ Repository = "https://github.com/lagowski/dap"
24
+ Issues = "https://github.com/lagowski/dap/issues"
25
+ "Author — Rafał Łagowski" = "https://www.linkedin.com/in/rafallagowski/"
26
+ "Author — Daniel Łagowski" = "https://www.linkedin.com/in/daniellagowski/"
27
+
28
+ [project.scripts]
29
+ dap = "dap_cli.__main__:app"
30
+
31
+ [build-system]
32
+ requires = ["hatchling"]
33
+ build-backend = "hatchling.build"
34
+
35
+ [tool.hatch.build.targets.wheel]
36
+ packages = ["src/dap_cli"]
37
+ # Exclude the bundle from the standard package collection so it's
38
+ # only carried by the ``force-include`` block below — otherwise
39
+ # hatchling adds the same paths twice and the wheel gets duplicate
40
+ # entries (UserWarning: Duplicate name).
41
+ exclude = [
42
+ "src/dap_cli/_dashboard",
43
+ "src/dap_cli/_dashboard/**",
44
+ ]
45
+
46
+ # Include the dashboard bundle (#302 sub-D2) when it's present.
47
+ # Built on demand by ``scripts/build-dashboard-bundle.sh`` —
48
+ # gitignored, so dev wheels built without running the script ship
49
+ # only the ``.gitkeep`` placeholder (``dap start`` falls back to a
50
+ # friendly "dashboard not bundled" message). The release pipeline
51
+ # (D3) always runs the bundler before ``uv build``.
52
+ [tool.hatch.build.targets.wheel.force-include]
53
+ "src/dap_cli/_dashboard" = "dap_cli/_dashboard"
54
+
55
+ # ``dap demo`` (#1042) ships examples/python-func-pipeline as dap_cli/_demo:
56
+ # hatch_build.py adds it from a checkout; a wheel built from the sdist gets it
57
+ # from the copy the sdist carries (below).
58
+ [tool.hatch.build.targets.wheel.hooks.custom]
59
+
60
+ # Same rule for the sdist so ``uv pip install dap-cli`` from a
61
+ # source distribution still has the bundle.
62
+ [tool.hatch.build.targets.sdist]
63
+ include = [
64
+ "src/dap_cli",
65
+ "README.md",
66
+ "hatch_build.py",
67
+ ]
68
+
69
+ [tool.hatch.build.targets.sdist.force-include]
70
+ "../../examples/python-func-pipeline/example.pipeline-bundle.json" = "src/dap_cli/_demo/example.pipeline-bundle.json"
71
+ "../../examples/python-func-pipeline/examplepipe/__init__.py" = "src/dap_cli/_demo/examplepipe/__init__.py"
72
+ "../../examples/python-func-pipeline/examplepipe/nodes.py" = "src/dap_cli/_demo/examplepipe/nodes.py"
73
+ "../../examples/python-func-pipeline/examplepipe/gates.py" = "src/dap_cli/_demo/examplepipe/gates.py"
@@ -0,0 +1 @@
1
+ __version__ = "0.4.0"
@@ -0,0 +1,116 @@
1
+ """Typer entrypoint — `dap` CLI."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import typer
6
+
7
+ from dap_cli import __version__
8
+ from dap_cli.commands.demo import demo_command
9
+ from dap_cli.commands.init import init_command
10
+ from dap_cli.commands.pipeline import pipeline_app
11
+ from dap_cli.commands.project import project_app
12
+ from dap_cli.commands.start import start_command
13
+ from dap_cli.commands.status import status_command
14
+ from dap_cli.commands.stop import stop_command
15
+ from dap_cli.paths import DEFAULT_DASHBOARD_PORT, DEFAULT_ENGINE_PORT
16
+
17
+ app = typer.Typer(
18
+ name="dap",
19
+ help="Deterministic Agent Pipeline — local launcher",
20
+ no_args_is_help=True,
21
+ add_completion=False,
22
+ )
23
+
24
+ app.add_typer(project_app, name="project")
25
+ app.add_typer(pipeline_app, name="pipeline")
26
+
27
+
28
+ def _version_callback(value: bool) -> None:
29
+ if value:
30
+ typer.echo(__version__)
31
+ raise typer.Exit()
32
+
33
+
34
+ @app.callback()
35
+ def root(
36
+ version: bool = typer.Option(
37
+ False,
38
+ "--version",
39
+ "-v",
40
+ callback=_version_callback,
41
+ is_eager=True,
42
+ help="Show version and exit",
43
+ ),
44
+ ) -> None:
45
+ """Deterministic Agent Pipeline — local launcher."""
46
+
47
+
48
+ @app.command("init")
49
+ def cmd_init(
50
+ force: bool = typer.Option(False, "--force", "-f", help="Overwrite existing .dap/"),
51
+ admin_email: str | None = typer.Option(
52
+ None,
53
+ "--admin-email",
54
+ help="Admin user email. Prompted interactively when omitted.",
55
+ ),
56
+ admin_password: str | None = typer.Option(
57
+ None,
58
+ "--admin-password",
59
+ help=(
60
+ "Admin password (lands in shell history — use for local dev only). "
61
+ "Prefer --admin-password-stdin in automation."
62
+ ),
63
+ ),
64
+ admin_password_stdin: bool = typer.Option(
65
+ False,
66
+ "--admin-password-stdin",
67
+ help="Read the admin password from stdin (kubectl-style).",
68
+ ),
69
+ ) -> None:
70
+ """Initialize DAP project + bootstrap admin user."""
71
+ init_command(
72
+ force=force,
73
+ admin_email=admin_email,
74
+ admin_password=admin_password,
75
+ admin_password_stdin=admin_password_stdin,
76
+ )
77
+
78
+
79
+ @app.command("start")
80
+ def cmd_start(
81
+ port: int = typer.Option(DEFAULT_DASHBOARD_PORT, "--port", "-p", help="Dashboard port"),
82
+ engine_port: int = typer.Option(DEFAULT_ENGINE_PORT, "--engine-port", help="Engine port"),
83
+ headless: bool = typer.Option(False, "--headless", help="Do not open browser"),
84
+ ) -> None:
85
+ """Start engine + dashboard, open browser."""
86
+ start_command(port=port, engine_port=engine_port, headless=headless)
87
+
88
+
89
+ @app.command("demo")
90
+ def cmd_demo(
91
+ no_dashboard: bool = typer.Option(
92
+ False,
93
+ "--no-dashboard",
94
+ help="Run end to end with the gate auto-approved, then exit",
95
+ ),
96
+ port: int = typer.Option(DEFAULT_DASHBOARD_PORT, "--port", "-p", help="Dashboard port"),
97
+ engine_port: int = typer.Option(DEFAULT_ENGINE_PORT, "--engine-port", help="Engine port"),
98
+ ) -> None:
99
+ """Run the example pipeline on a throwaway instance: no API key, login or network."""
100
+ demo_command(no_dashboard=no_dashboard, port=port, engine_port=engine_port)
101
+
102
+
103
+ @app.command("stop")
104
+ def cmd_stop() -> None:
105
+ """Stop running engine + dashboard."""
106
+ stop_command()
107
+
108
+
109
+ @app.command("status")
110
+ def cmd_status() -> None:
111
+ """Show DAP project status."""
112
+ status_command()
113
+
114
+
115
+ if __name__ == "__main__":
116
+ app()
@@ -0,0 +1,5 @@
1
+ # Placeholder so the directory always exists for hatchling's
2
+ # force-include. The dashboard bundle (server.js, .next/, etc.)
3
+ # is staged here on demand by scripts/build-dashboard-bundle.sh
4
+ # and is gitignored — see the gitignore entry for
5
+ # apps/cli/src/dap_cli/_dashboard/.
@@ -0,0 +1,3 @@
1
+ DAP dashboard bundle
2
+ Built at: 2026-11-28T18:19:27Z
3
+ Git SHA: 149045a