Repository navigation
Closed
Labels
enhancementNew feature or request
Description
Part of epic #40. Depends on #1, #2, #3.
Goal
Add the actual user-facing CLI: flapi pack, flapi info,
flapi unpack. The flapi binary becomes its own packager — the same
artifact runs the server and builds new bundled binaries.
Scope
argparse subcommands
Today src/main.cpp:269-304 has a flat argparse setup with no
subcommands. This sub-issue introduces subcommands while preserving
the zero-subcommand "run the server" default for backwards
compatibility.
flapi pack --in <config-dir> --out <new-binary>
- Copy the running binary's bytes to
<new-binary>. - Strip any trailing ZIP from the copy first (re-pack idempotence
— spike lesson; do NOT touch the running binary). - Read the config tree via
LocalFileProvider. - Enforce the default secret exclude list:
*.env,secrets/*,*.pem,*.key→ exit non-zero with a clear
message if any input file matches. Override only via
--allow-secrets(testing). - Rewrite paths inside YAML to
embed://...where they reference
files inside the bundle, so the same YAML works both unpacked and
bundled. - Stamp entries with
SOURCE_DATE_EPOCH(fall back to 0), sort
deterministically. - Append the archive to
<new-binary>(Linux/Windows). macOS flows
into Offset parameter along with limit causes incorrect response #8's reserved-segment path.
flapi info
- Print EOCD offset, entry count, and entry list of the running
binary's bundle. Spike behaviour Minor auth configuration issues #4.
flapi unpack --to <dir>
- Dump entries to filesystem for debugging. Spike behaviour Offset parameter along with limit causes incorrect response #8.
Red tests
Catch2 unit tests (test/cpp/pack_test.cpp):
pack→inforound-trip lists the same entries as the input dir.*.envin input →packexits non-zero, no output file written.--allow-secretsoverrides the exclude list (for tests only).- YAML path rewriting: a YAML pointing to
./data/foo.csvbecomes
embed://data/foo.csvin the bundled copy.
Integration tests live in #6, but a minimal driver test here that
execs the built debug binary and verifies a fresh pack → unpack
round-trip is also acceptable.
Green criteria
- All red tests pass.
make integration-teststill green.- Backwards compatibility:
./flapi -c flapi.yaml(no subcommand)
still launches the server.
Files
- New:
src/pack.{hpp,cpp},test/cpp/pack_test.cpp - Modified:
src/main.cpp(subparser support, dispatch)
Notes
- macOS gets a different
packflow (reserved-segment overwrite +
codesign) in Offset parameter along with limit causes incorrect response #8. - The default secret exclude list comes from the spike's
no-secrets-in-bundle invariant. Documented for users in Feature Request: Support DuckDB Virtual File System for Configuration and SQL Files #10.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
feat: flapi pack / info / unpack subcommands
feat: flapi pack / info / unpack subcommands (#55)