@agnamo/kirby
v0.3.1
Published
Zero-dependency CLI to scan, plan, wrap, duplicate, and validate local tools the way LDXV Kirby does.
Readme
@agnamo/kirby
Zero-dependency command line for the LDXV Kirby workflow: scan a directory, plan a wrapper, write that wrapper, duplicate a tree, and validate command names. It also plans adaptations through the legal gate and prints the Nopilot Kirby contract.
This package is not Obsidian Copilot. It does not read, copy, or transform the Copilot plugin bundle.
npm publish is not done in this session. Do not publish this package from this workspace pass.
Commands
kirby scan <source>
kirby plan <source> [--name <name>]
kirby wrap <source> [--name <name>] [--dry-run] [--out <dir>]
kirby duplicate <source> <destination> [--dry-run]
kirby validate <source> [--require-script <path>]
kirby adapt <file> [--rules <file-or-dir>] [--write] [--out <path>] [--dry-run]
kirby source <list|remove|realign|unavailable|available> [<id|owner/repo>]
kirby spec
kirby helpscan, plan, wrap, duplicate, validate, adapt, and source print JSON. spec and help print text.
scan
Walk <source>. Skip directories named .git, node_modules, .venv, venv, __pycache__, and .ldxv. Scripts are .py (python), .js / .mjs / .cjs (node), .ps1 (powershell), and .sh (shell). package.json marks npm. pyproject.toml or requirements.txt marks python.
plan
Non-mutating wrap plan. The plugin name is a safe slug of --name, or kirby-<folder>. Each command name is the file stem with underscores turned into hyphens. A stem collision throws.
wrap
--dry-run prints the plan and writes nothing. Otherwise --out is required. Writes ldxv-plugin.json and wrapper.py into an empty directory and refuses to clobber a directory that already contains files.
wrapper.py reads a JSON payload on stdin. arguments must be a list of strings. It spawns the selected script with that script's runtime and refuses a path outside the source directory.
duplicate
Copy <source> to <destination>, skipping the ignored directory names above. --dry-run does not create the destination. An existing destination is an error unless --dry-run is set.
validate
Reports normalized command-name collisions and missing --require-script paths. It does not throw. --require-script may be repeated. Exit 2 when the report is invalid.
adapt
Read <file>, load rules from --rules (a JSON file or a directory of JSON files) or from src/rules/*.json, and call planAdaptation. This command never fetches the network.
The default is a dry run: print the plan JSON and do not write. --dry-run forces that mode. --write writes the adapted text only when legal.pass is true. If the legal gate fails, nothing is written and the process exits 2. --out is the file to write; without it, --write replaces <file>.
spec
Prints exactly:
nopilot-kirby-1
scan
plan
wrap
duplicate
validate
adapt
source
spec
helphelp
Print command usage.
Exit codes
0success1usage error2validation or operational error
Requirements
Node.js 18 or newer. No runtime dependencies.
