Repository navigation
feat(cli): add nano package init for a pinned example scaffold (#84) - #95
Merged
Merged
Conversation
AetherAI3
force-pushed
the
claude/nano84-package-init
branch
2 times, most recently
from
November 8, 2026 03:11
bd8f428 to
55240f4
Compare
Specifies init --directory before any implementation: new or empty destination only, refuse overwrite and symlinks with exit 2, no parent creation or search, fixed LF template whose pins are computed from the template bytes, atomic placement, and a scaffold that check/build/test accept. Refs #84, #67 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Writes one fixed five-file package (entry, one pure helper module, manifest, lock, cases) only into a destination that does not exist or is an empty directory. Non-empty directories, files and symlinks/junctions are refused with exit 2 before any write; a missing parent is exit 3. Pins are computed from the template bytes in memory, never by reading or rewriting an existing project. New destinations are staged in a temporary sibling and renamed into place; empty destinations get exclusive creates with removal on failure, so a failed init leaves no partial scaffold. Refs #84, #67 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review findings on nano package init: - a file opened and partly written before a failure was left behind; _write_new_file now removes its own file on any write failure; - an OSError from the destination check (e.g. unreadable directory) escaped as a traceback; it is now an I/O diagnostic, exit 3; - the destination is re-checked before every file, so a swap to a link mid-write is refused (exit 3) instead of writing through it; the remaining local race is documented; - a staging directory that cleanup cannot remove is reported on stderr; - tests now cover open-then-fail and a real Windows junction. Refs #84 Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI (self-hosted, py3.11) caught test_nothing_in_nano_imports_dynamically flagging getattr(stat, ...). Use the documented Win32 FILE_ATTRIBUTE_REPARSE_POINT literal instead; behaviour is unchanged. Refs #84 Co-Authored-By: Claude Opus 5.5 <[email protected]>
AetherAI3
force-pushed
the
claude/nano84-package-init
branch
from
November 8, 2026 04:26
55240f4 to
80593f3
Compare
This was referenced Nov 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Optional follow-up slice named in #84:
nano package init --directory PATH. It creates one minimal, already-pinned example package, only in a new or empty destination, so a user can runcheck,buildandtestright away. The contract was frozen indocs/package-cli.md(commit1883bb5) before any code.What changed
nano/cli/package_init.py(new): a fixed template of five LF files:agent.nano,rules.nano(one pure helper),nano.json,nano.lock,cases.json(one positive and one negative case). Lock pins come from the template bytes in memory. Nothing existing is read, discovered, repinned or rewritten.xb) creates, and anything already created is removed if a later write fails.nano/cli/package.py: dispatch and parser entry only.main.pyepilog, RFC 0066 (fmtremains deferred).Evidence (base main
27e8a5f8d502f2c25cfa2b899de62871a63edc86, head2f9767f3194f7ce3b08fbbdf89ae4a6daf5992e5)RED:
tests/test_package_init.py10 failed / 1 passed (the pass is the trivial missing-argument exit 2), then GREEN at 11/11 on the first implementation. Negative controls:Byte-identical scaffolds across runs and from another working directory (relative
--directory).check,buildandtest --jsonaccept the scaffold, and its two cases produce different intents (EXECUTE vs PAUSE).Focused + adjacent suite (init, package_cli, package_cases, package_test_cli, cli, package, compiler_diagnostics, conformance, acceptance_parity, examples, docs):
The failure is the pre-existing py≥3.12
test_metadata_depth_is_positioned, which fix(package): enforce metadata depth before JSON decoding #94 fixes; I'll rebase after it lands.check_contribution --all: 55 ready.Held-out: wheel sha256
9c3d549d…443a, installed--no-deps --no-indexinto a fresh Python 3.10.0 venv (no quantum extras), run outside the repo:initexits 0, and a repeatinitinto the same directory exits 2;checkpackageHash issha256:16bfedd0…2b66, identical to the in-repo scaffold;testis 2/2;Merge plan: merge only on green CI for the exact head on the self-hosted runner, after rebasing onto #94. The repo owner authorized merging this PR in-session.
Refs #84, #67
🤖 Generated with Claude Code