Skip to content

feat: add portable local and remote page publishing - #4

Merged
suraciii merged 10 commits into
mainfrom
fix/customer-ready
Aug 13, 2026
Merged

feat: add portable local and remote page publishing#4
suraciii merged 10 commits into
mainfrom
fix/customer-ready

Conversation

@suraciii

@suraciii suraciii commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Install one pages binary from the module root with three commands: serve, publish, and generate-token.
  • Use one Destination input for Publish: a local path writes directly to a Public Root, while an absolute HTTP(S) URL uploads through serve and verifies the public URL. --dest is the short alias for --destination.
  • Add Default and Named Identities. The verified Token determines the remote Identity; local Publish accepts an optional --identity.
  • Store default configuration under the operating system user config directory, with explicit directory and file overrides. The program supports Linux, macOS, and Windows; deployment documentation remains Linux-specific.
  • Keep local and remote writes on the same staging, zip-validation, swap, and recovery path.
  • Update the README, user documentation, design specifications, and agent skill to use the current product language and runnable commands.

User-facing commands

Minimal local Publish uses the current directory as the Destination:

pages publish --file report.html --slug report

An explicit local Destination writes to that Public Root:

pages publish --file report.html --slug report --dest pages-public

Remote Publish uses an HTTP(S) Destination and an environment Token:

PAGES_UPLOAD_TOKEN='secret' pages publish \
  --file report.html --slug report --dest https://pages.example.com

Service administration uses the same Destination name:

pages generate-token
pages serve --dest /srv/pages/public

Implementation

  • Move command implementation behind a thin root entry point in internal/cli.
  • Resolve Destination with this precedence: flag, PAGES_DESTINATION, config, then current directory.
  • Use os.UserConfigDir for portable defaults while preserving --config-dir, --config, and --tokens-file overrides.
  • Inject filesystem, process, and HTTP capabilities so tests use only in-memory files and in-process HTTP fakes.
  • Provide real file locking on Linux, macOS, and Windows for Token updates.

Verification

  • make ci
  • go test -race ./...
  • Linux, macOS, and Windows builds
  • macOS and Windows test compilation
  • GitHub Actions ci / test passed on 0202c8bad214146cd8377926940a0e1a238a8041

All automated tests use an in-memory filesystem and injected HTTP transport. They do not access the host filesystem or network.

go install now points at the cmd/pages package, the path that actually
works. The root command answers --help and -h with usage on stdout and
exit 0, matching the subcommands.
The repository is one command, so the main package lives at the module
root like other single-command Go tools. go install
github.com/suraciii/pages@latest now works directly; the Dockerfile and
docs follow.
The root main.go is a thin stub calling cli.Run, so go install
github.com/suraciii/pages@latest works while the command implementation
stays organized in internal/cli, like hugo and other single-command
tools.
@suraciii suraciii changed the title fix: install path and root help fix: make pages customer-ready Aug 13, 2026
serve and generate-token now share /etc/pages/tokens.json by default. PAGES_TOKENS_FILE and --tokens-file remain explicit overrides. The customer docs use the short default-path commands, and the README heading uses TL;DR.
The README now gives the basic local path first, then the remote path with a minimal Caddyfile. Reference Caddy configurations set /srv/pages/public explicitly, and the generate-token grammar matches Go flag parsing.
@suraciii suraciii changed the title fix: make pages customer-ready feat: add portable local and remote page publishing Aug 13, 2026
@suraciii
suraciii merged commit 78a01e4 into main Aug 13, 2026
1 check passed
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