Repository navigation
feat(cli): service install --dry-run/--from-checkout, port refusal, --json on service actions, serve --quiet (CLI contract SPEC §1, §3) - #24
Merged
Conversation
…-json on service actions, serve --quiet (CLI contract SPEC §1, §3) Ported from paddock#996 (0e2b624). A reinstall keeps the unit's port, host and data dir; identifyManagers tells Managers from Paddock by /api/busy's counts.run; the npx refusal suggests npm i -g rather than npm link. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
Real-use QA (packed tarball, throwaway prefix and HOME, the stand-in
|
| What | Result |
|---|---|
service install --dry-run --port P |
exit 0; the unit on stdout, Nothing was written on stderr; no ~/.config, no ~/.managers afterwards |
… --dry-run --json |
one document { ok, action, dryRun, unit, contents }; still nothing written |
install from the worktree's own dist/cli/managers.js (a checkout) |
exit 1, the refusal names the checkout, npm i -g @edspencer/managers and --from-checkout; --dry-run refused too |
--from-checkout --dry-run from the checkout |
exit 0; ExecStart runs the checkout |
a fake Paddock on the port (/api/health ok, /api/busy without counts.run) |
exit 1, port P is held by something that isn't Managers; with --json, ok:false and that error; nothing written |
| a raw TCP listener on the port | exit 1, same refusal |
service install --port P --json |
exit 0; ok, installed, running, answering: true, port: P, runningVersion: 0.4.0; prose on stderr |
service install --json with no flags |
exit 0; Keeping: managers serve --port P; the unit still says --port P; a new pid |
service stop/start/restart --json |
each exit 0, one document; running is false after stop and true after start and restart |
service uninstall --json, then stop --json |
0 with installed:false; then exit 4 with error: "not installed" |
serve -q under pm |
stdout is exactly Managers 0.4.0: http://127.0.0.1:5202; /api/health answers |
service start --dry-run, update --dry-run, service status --from-checkout, serve --from-checkout, busy --quiet, service install -q, service logs --json, serve --json, config eject --json |
each exits 2 with <flag> applies to … only |
Conformance (local): npx cli-conformance --dir dist-npm --config cli-contract.json: 17 passed, 0 failed, 3 skipped. The skips are update-not-writable (this box runs as root) and the real-service pair, which CI runs.
Merged
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.
CLI contract SPEC 1.0, §1 and §3: the
service installmusts Managers was missing, and the shoulds that came with them. Ported from Paddock #996 (0e2b624) by applying Paddock's own diff to Managers' near-identicalpackages/server/src/cli/, then renaming.What's in it
service installrefuses a checkout (or annpm link), exit 1, unless you give--from-checkout. A checkout is a package root not under anynode_modules(underNodeModules, whichupdatealready uses). The npx refusal and--helpused to suggestnpm link -w packages/server && managers service install, which this refusal now catches, so they saynpm i -g @edspencer/managersinstead.service installrefuses a port something else holds, exit 1, instead of writing a unit that crash-loops. A Managers on the port is fine (a reinstall), and so is the unit's own running service.identifyManagers(inservice/ready.ts) tells Managers apart by/api/busy'scounts.run, which only Managers has. That means a Paddock on the port counts as something else.--refresh.service install --dry-runprints the unit on stdout, says where it would go on stderr, and writes nothing, not even folders. It also works with--refreshand--json.--jsononinstall,uninstall,start,stop,restart: one document,{ ok, action, error?, …status }, and all prose on stderr. Exit codes don't change.serve --quiet/-qprints onlyManagers <version>: <url>.--dry-run,--from-checkout,--quiet, and--jsononserve,service logsandconfig eject.scripts/service-real.mjsgains Paddock's steps: dry-run,install --json,doctor --offline --json, and a flagless reinstall that keeps the port and replaces the process.test/unit/cli-service-shoulds.test.tsis ported, plus twoidentifyManagerstests (Managers vs. Paddock).--help(both usages),README.md,NPM-README.mdandUPDATING.md.Left out on purpose:
doctor.tsrefactor, which movedisListening/identifyintoready.ts. Managers' doctor is its own implementation with injected probes, and doesn't need it.launchd.ts/systemd.tsfirst-install cleanup. Managers already has it (cli-contract#7, from F3).runtime-file.tsre-copy. That is managers#23's, and this branch takes it when CLI contract 1.0: no linger line when loginctl can't answer; reference headers name 1.0 #23 merges.Testing
npm run typecheckpasses.vitestpasses: unit 2681/2681, integration 556/556.HOME. The rig had batch drive mode with the opt-in, no Claude/API tokens, and noHOST/PORT/NODE_ENV(checked in/proc/<pid>/environ). Service runs went through the repo's stand-insystemctl(scripts/standin-systemctl.mjs), because this box has no systemd. Results are in the comment below.UI unaffected: CLI only.
🤖 Generated with Claude Code