daedalus 0.1.0: scriptman spec update ported - categories, new listing format with colors, run_python_script child entry, daedalus_logging, daedalus.<folder> namespace imports; SPEC rewritten with stable item numbers
Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
---
|
||||
name: daedalus-agent-rules
|
||||
version: 1.0.0
|
||||
version: 1.1.0
|
||||
type: summary
|
||||
created: 2026-11-11
|
||||
updated: 2026-11-11
|
||||
updated: 2026-11-18
|
||||
tags: [agents, rules, scripts, cli]
|
||||
---
|
||||
|
||||
@@ -116,7 +116,8 @@ pip install -e . # daedalus command runs the checkout
|
||||
```text
|
||||
daedalus/
|
||||
├── bin/ # Launchers: daedalus (bash), daedalus.bat
|
||||
├── daedalus/ # CLI package: cli.py, registry.py, runners.py, tests/
|
||||
├── daedalus/ # CLI package: cli.py, registry.py, runners.py,
|
||||
│ # run_python_script.py, daedalus_logging/, tests/
|
||||
├── python/
|
||||
│ ├── src/<name>/ # One folder per Python script
|
||||
│ └── tests/ # pytest tests for python/src (and .ps1/.bat scripts)
|
||||
@@ -148,6 +149,9 @@ Before writing anything, know:
|
||||
- The type: Python, bash, PowerShell, or batch. Prefer Python when the
|
||||
script must run on both Windows and Linux.
|
||||
- A one-line description for `daedalus --list`.
|
||||
- The categories the script belongs to. The default is `general`; pick
|
||||
labels that say where the script fits (`media`, `linux`, ...). A label
|
||||
may never equal a script name.
|
||||
|
||||
Ask the user only when the name or the type cannot be inferred. Track the
|
||||
work with this checklist:
|
||||
@@ -157,6 +161,7 @@ work with this checklist:
|
||||
- [ ] Entry added to SCRIPTS in daedalus/registry.py
|
||||
- [ ] README row and usage section
|
||||
- [ ] Tests written and passing
|
||||
- [ ] daedalus.<folder> entry in pyproject.toml (Python scripts)
|
||||
- [ ] version bumped in pyproject.toml
|
||||
- [ ] python autotest.py passes
|
||||
- [ ] daedalus <name> --help works
|
||||
@@ -175,6 +180,7 @@ marked "test".
|
||||
| Name matches `^[a-z][a-z0-9_-]*$` | Registry test |
|
||||
| `path` is repo-relative with forward slashes | Registry test |
|
||||
| `description` is one non-empty line | Registry test |
|
||||
| `categories` are non-empty labels, none equal to a script name | Registry test |
|
||||
| File suffix has a runner (`.py`, `.sh`, `.ps1`, `.bat`) | Registry test |
|
||||
| A row for the name in the README "Available scripts" table | Registry test |
|
||||
| Own tests for the script's logic | Review, coverage |
|
||||
@@ -185,7 +191,7 @@ marked "test".
|
||||
|
||||
| Type | Location | Runner |
|
||||
| --- | --- | --- |
|
||||
| Python | `python/src/<name>/<name>.py` | Current Python, `python/src` on `PYTHONPATH` |
|
||||
| Python | `python/src/<name>/<name>.py` | `DAEDALUS_PYTHON` or current Python, via `run_python_script.py` |
|
||||
| bash | `bash/<name>.sh` | `DAEDALUS_BASH`, Git Bash, then `bash` |
|
||||
| PowerShell | `powershell/<name>.ps1` | `pwsh`, then `powershell` |
|
||||
| Batch | `batch/<name>.bat` | `cmd /c`, Windows only |
|
||||
@@ -242,7 +248,13 @@ if __name__ == "__main__":
|
||||
|
||||
- `prog="<name>"` makes `--help` show the daedalus command name.
|
||||
- Shared helpers go in their own package under `python/src/`; scripts
|
||||
import them directly because `python/src` is on `PYTHONPATH`.
|
||||
import them as `daedalus.<folder>` (SPEC section 10). The child gets
|
||||
`REPO_ROOT` on `PYTHONPATH`, so the import works in a checkout and an
|
||||
install alike.
|
||||
- Python scripts run through `run_python_script.py` and get the
|
||||
`daedalus_logging` setup (file `~/.daedalus/debug.log` + stderr,
|
||||
`DAEDALUS_LOGLEVEL`, `DAEDALUS_NO_LOGGING`) unless they configure
|
||||
logging themselves.
|
||||
- Standard library only. Lazy `%` logging. Type hints in every docstring.
|
||||
|
||||
bash template:
|
||||
@@ -290,16 +302,23 @@ sorted:
|
||||
"<name>": Script(
|
||||
path="python/src/<name>/<name>.py",
|
||||
description="<one line, same as README>",
|
||||
categories="<label>", # or a tuple; default is "general"
|
||||
),
|
||||
```
|
||||
|
||||
Do not edit `cli.py` or `runners.py`. The suffix picks the runner.
|
||||
|
||||
For a Python script, also add the folder to `pyproject.toml` as an
|
||||
installed package (SPEC section 9): entries `"daedalus.<folder>"` in
|
||||
`[tool.setuptools].packages` and
|
||||
`"daedalus.<folder>" = "python/src/<folder>"` in
|
||||
`[tool.setuptools.package-dir]`.
|
||||
|
||||
In `README.md`:
|
||||
|
||||
- Add a row to the "Available scripts" table, sorted by name:
|
||||
`` | `<name>` | Python | <description> | ``. The registry test looks
|
||||
for the exact text `` | `<name>` | ``.
|
||||
`` | `<name>` | Python | <categories> | <description> | ``. The
|
||||
registry test looks for the exact text `` | `<name>` | ``.
|
||||
- When the script takes arguments, add a `### <name>` section after the
|
||||
table: what it does, example `daedalus <name> ...` calls in a `bash`
|
||||
block, and an argument table. Follow the existing sections, if any.
|
||||
@@ -308,7 +327,7 @@ In `README.md`:
|
||||
|
||||
| Type | Test file | How |
|
||||
| --- | --- | --- |
|
||||
| Python | `python/tests/test_<name>.py` | `from <name> import <name>`, call functions and `main([...])` |
|
||||
| Python | `python/tests/test_<name>.py` | `from daedalus.<name> import <name>`, call functions and `main([...])` |
|
||||
| bash | `bash/tests/test_<name>.py` | `subprocess.run` with `runners.find_bash()`; skip when bash is missing |
|
||||
| PowerShell, batch | `python/tests/test_<name>.py` | `subprocess.run` via `runners.build_command`; skip when the interpreter or Windows is missing |
|
||||
|
||||
@@ -323,7 +342,7 @@ Python test skeleton:
|
||||
|
||||
<what the tests cover>.
|
||||
"""
|
||||
from <name> import <name>
|
||||
from daedalus.<name> import <name>
|
||||
|
||||
|
||||
def test_main_returns_zero():
|
||||
@@ -428,6 +447,9 @@ disable a check to make a run pass.
|
||||
- A script outside `python/src/`, `bash/`, `powershell/`, or `batch/`.
|
||||
- Registry `path` with backslashes or an absolute path.
|
||||
- A runner chosen by anything other than the file suffix.
|
||||
- A top-level import from `python/src` (use `daedalus.<folder>`;
|
||||
SPEC section 10).
|
||||
- A category label that equals a script name.
|
||||
- A script that only works through daedalus (imports from `daedalus`,
|
||||
reads `LIBRARY_ROOT`).
|
||||
- Tests that need another machine, the network, or an interactive terminal without a
|
||||
|
||||
Reference in New Issue
Block a user