Skip to content

feat: single-process server and pena CLI - #2

Merged
mshddev merged 4 commits into
mainfrom
cli
Sep 7, 2026
Merged

mshddev merged 4 commits into
mainfrom
cli

Conversation

@mshddev

@mshddev mshddev commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Server serves the built web app. One Node process on port 8788 handles the review UI and the API. @fastify/static on PENA_WEB_DIR (default apps/web/dist) with an SPA fallback for /, /collections, /collections/:slug, /archive, /docs/:slug; JSON 404 for /api/* and missing files; API-only mode when the web build is absent.
  • pena CLI (apps/cli, no third-party runtime deps): server start|stop|status, asset upload, collection list|create|rename|delete, doc list|show|publish|rename|move|archive|unarchive|versions|restore, feedback show|wait|watch, skill install. doc publish uploads referenced local images into a staged copy and resolves ETag preconditions itself; --etag, --create, and --feedback-match remain explicit. Exit codes: 0 ok, 1 server/network, 2 usage, 3 precondition failed, 4 wait timeout. server stop only signals a pid it started and can prove is a Pena server.
  • Skill rewritten on the CLI (202 lines, down from 349). The curl and node script instructions are gone; pena skill install copies it. Review URLs move from 5173 to 8788.
  • Root bin so pnpm link --global exposes pena; pnpm pena ... works without linking. pnpm dev stays the two-process dev mode.

Test plan

  • pnpm build && pnpm typecheck && pnpm test on Node 24: server 114, web 71, cli 55 tests pass
  • End-to-end sweep of every command against a server on a spare port, including image rewrite (fenced reference untouched, source file unchanged), feedback watch event line, --feedback-match stale (exit 3) vs fresh, skill install, stop leaves no listener
  • Chrome: direct load and reload of /docs/<slug> on the single port renders the app and Mermaid; all requests same-origin; comment submitted in the UI arrives via pena feedback show and pena feedback watch

After merging

Run pnpm build && pnpm link --global (needs pnpm setup once) and pena skill install. The old pnpm dev server on 8788 must be stopped before pena server start.

🤖 Generated with Claude Code

mshddev and others added 4 commits September 6, 2026 11:37
Register @fastify/static on PENA_WEB_DIR (default apps/web/dist) with an SPA
fallback for extension-less GET/HEAD paths, JSON 404s for /api/* and missing
files, and API-only mode when the web build is absent.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Zero-dependency CLI over the Pena API: server start/stop/status with a
detached process and ownership-checked pidfile, asset upload, collection and
doc operations, feedback show/wait/watch, and skill install. doc publish
uploads referenced local images into a staged copy and resolves ETag
preconditions; exit codes 2/3/4 distinguish usage errors, precondition
failures, and wait timeouts. The feedback watch test moves here from the
server package.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The skill drives pena commands instead of curl and node scripts; the scripts
are removed. README documents build, link, server start, and skill install.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… and scanner

- server start --foreground fails on a signal death instead of exiting 0
- server start honours PENA_WEB_DIR in its web build precondition
- server stop tolerates a pid that exits between check and signal, and gives
  up after the SIGKILL deadline instead of spinning
- feedback wait aborts with exit 1 if the server does not answer within the
  requested timeout plus a grace period
- the image scanner skips indented code blocks, but not indented list content
- -h works after the command words
- non-EPIPE output errors are reported instead of thrown from the listener
- docs: the no-link fallback is pnpm --silent pena so --json stays parseable

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@mshddev
mshddev merged commit 7a0f7c9 into main Sep 7, 2026
1 check passed
@mshddev
mshddev deleted the cli branch September 7, 2026 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant