Commit Graph
21 Commits
Author SHA1 Message Date
Hector Ventura a9edb57aa6 fix(update): follow symlinked installs, pick arm64 under Rosetta and tell a failed check from a pending update (#56)
* fix(update): follow symlinked installs, pick arm64 under Rosetta and tell a failed check from a pending update

floci update replaces the real binary behind a symlink, moves an x86_64 build on Apple Silicon to the arm64 build, refuses a --version that is not a release version, and accepts upper-case checksums. --check now exits 2 when the check itself fails (1 still means an update is available) and on Windows points at the installer instead of 'floci update'. A failed background update check is recorded too, so the next command does not retry it and wait at exit.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* fix(update): record a check attempt before the request and bound the Rosetta probe

The update check marks its attempt before asking GitHub, so a command that exits while the request is still waiting does not start it again on every run; an attempt is retried after an hour rather than a day and never overwrites a result another process just stored. The sysctl probe waits with its limit before reading. Adds a test for updating through a symlink.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-10 22:08:57 -05:00
Hector Ventura fa306b38a6 feat(reset): add floci reset to delete every resource in a running emulator (#55)
* feat(reset): add floci reset to delete every resource in a running emulator

floci reset (and floci gcp/az/oci reset) calls the emulator's state reset endpoint, so a test run can start clean without restarting the container. It asks for confirmation on a terminal; --yes skips the prompt and is required when there is no terminal. A server without the endpoint (floci-az today) gets a 'not available' message.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* feat(reset): never guess which server to reset

A typed --endpoint is used as given instead of being replaced by a local container's port, and a container the user selected has to be found running: a missing or stopped one resets nothing rather than falling back to the default instance. The confirmation goes through a seam, with tests for every answer.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* feat(reset): stop when a selected container publishes no port for the emulator

A selected container that is running without a matching published port has nothing to be found by, and the configured endpoint may be another instance.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* feat(reset): find a selected instance by the emulator's port, not the configured host port

A profile for an instance on its own host port names that port in its endpoint, while the container still listens on the emulator's; reset matched the wrong one and refused such instances.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-10 22:07:41 -05:00
Hector Ventura 1a7e84cd23 fix(cli): remove doctor --fix and services --mode, which did nothing (#53)
doctor --fix only hid the hint text and services --mode filtered nothing, because the server does not report service modes. Both flags are removed rather than kept as promises; doctor's summary now points at the Fix line under each failed check. services --mode can return once the server exposes service metadata (BL-065).

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-10 21:38:43 -05:00
Hector Ventura 7ecc895baa fix(docker): time-limit docker calls and pass names after -- (#47)
* fix(docker): time-limit docker calls and pass names after --

Non-streaming docker calls are killed after 30 s (docker run after 10 minutes, stop after its own timeout plus 30 s) with a message naming the stalled command; any abnormal exit kills the process, streaming calls included; container and image names are passed after -- so a name starting with '-' is never read as a flag.

* fix(docker): time-limit the daemon probe and let stop --timeout -1 wait indefinitely

The doctor's daemon probe and the install probe now share the time limit and cleanup of every other docker call. A negative stop timeout is docker's wait-indefinitely (checked against Docker 29.8.2), so that call is no longer cut off after 29 seconds. Adds tests for the probe, both stop cases and interrupted streaming calls.
2026-10-10 16:28:45 -05:00
Hector Ventura 8feff771ac docs(readme): remove the Scoop install instructions (#42) 2026-10-08 23:39:13 -05:00
Hector Ventura 2dd2e7fa25 docs: adopt the Floci family README layout and a no-dash writing rule (#40) 2026-10-08 23:15:52 -05:00
Hector Ventura 9b340934ae docs(readme): fix the command tables and the profile field table (#39) 2026-10-08 23:12:44 -05:00
Hector Ventura 22668a1200 feat(profile): warn when a profile sets a key floci does not read (#37) 2026-10-08 22:47:51 -05:00
Hector Ventura bf9ee4037b feat(start): give each instance its own Docker resource namespace and base URL (#31) 2026-10-08 21:44:17 -05:00
Hector Ventura 788eb470fb feat(config): create profiles for instances that run side by side (#30) 2026-10-08 21:34:15 -05:00
Hector Ventura 7b58a38c5a feat(az): configure the az CLI against floci-az with floci az setup (#29) 2026-10-08 21:29:02 -05:00
Hector Ventura 52c08ecec5 fix(profile): apply --profile to every command, not just config show (#23)
`--profile <name>` was declared on the shared GlobalOptions mixin but only
ConfigShowCommand ever read it. Every other command, `start` included, fell
through to the built-in defaults, so a profile's container, image, port,
persistDir and services were silently dropped.

The worst consequence was silent data loss: the `-v <dir>:/app/data` mount and
`FLOCI_STORAGE_MODE=persistent` were gated on the `--persist` flag alone, so a
profile with `persistDir` set produced neither. The image declares
`VOLUME /app/data`, so every start attached a fresh anonymous volume and the
server stayed in-memory.

A profile is now applied by a single picocli IDefaultValueProvider registered in
FlociCli.buildCommandLine(). Picocli consults it only for options the user did
not pass, and only after that command's arguments are processed, which gives the
documented precedence without per-command plumbing:

    command-line flag > --profile <name> > FLOCI_* env var > product default

Behaviour changes:

- An unknown, unreadable or invalid profile is now an error (exit 2) rather than
  a silent fall back to the defaults. `--help` still works with a bad profile.
- `restart --profile <name>` re-applies the profile's persistDir, image, port
  and services. It builds its StartCommand programmatically, so it carries the
  profile across by hand.
- `config show` merges instead of replacing, so an explicit --endpoint /
  --container / -o is no longer discarded when --profile resolves. It now also
  reports the profile's start-only fields.
- `config profile create` seeds the file from the tree it was run under;
  previously every tree wrote AWS values.
- Profile names are validated, closing a path traversal
  (`config profile delete ../../foo` resolved the raw name).
- Reads accept the `.yml` spelling that `config profile list` has always
  listed, and `list` backfills a missing `name:` from the file name.
- The readiness poll after `start` keeps the endpoint's host when swapping in
  the bound port, instead of always rewriting it to localhost.

Adds 64 tests, including the first coverage of ProfileStore.

Closes #22
2026-09-13 18:23:56 -05:00
Hector Ventura 6496795708 fix(env): single-quote exported values in every product tree (#19)
`floci az env` printed the semicolon-separated Azure connection string
unquoted, so `eval $(floci az env)` set only
AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=http and ran the
remaining segments as commands — `az` then reported "Invalid connection
string".

`floci env` and `floci gcp env` carried a byte-identical copy of the same
unquoted emitter (their values are `;`-free URLs today, so nobody hit it),
and the aws.cli.endpoint / az.cli.connection-string doctor checks suggested
export lines with the same flaw.

Extract the correct emitter that `floci oci env` already had into
io.floci.cli.output.ShellExport and use it everywhere: values are single
quoted with per-shell escaping for bash, fish, and PowerShell, so `;`, `$`,
backticks, and quotes can neither break nor inject through `eval`.

OciEnvFormatTest becomes ShellExportTest, keeping its four assertions and
adding the connection-string regression from the issue.

Closes #18
2026-08-26 22:12:29 -05:00
Hector Ventura 6dc8fc9df4 refactor!: unify the four product command trees behind ProductProfile (#16)
* refactor!: unify the four product command trees behind ProductProfile

Every shared command now has ONE implementation in commands/,
parameterized by ProductProfile (the single source of per-product
config: endpoint, container, image, env prefix, control prefix,
display name). The gcp/az/oci command classes become ~8-line shims
(GcpStartCommand extends StartCommand { super(ProductProfile.GCP); })
that carry only their per-product help description; the three
near-identical *GlobalOptions clones are deleted. Each product tree
drops from ~1,360 to ~530 lines and copy-drift becomes impossible.

Mechanics: per-product option defaults are constructor-set field
values rendered in help via ${DEFAULT-VALUE} (annotation defaults are
compile-time constants); commands pre-initialize their GlobalOptions
mixin with the profile (picocli uses a non-null mixin field instance
as-is). Verified against a captured baseline of 480 CLI outputs
(every --help x 5 trees, env/status/doctor JSON, exit codes, routing)
plus new pinning tests: ProductProfileTest, ProductTreesParsingTest,
DoctorCheckListTest, GlobalOptionsTest.

Behavior changes, all deliberate:
- snapshot commands in gcp/az/oci trees now perform the real
  /snapshots API calls with graceful degradation and exit 1 while the
  server lacks the endpoints (previously: note + exit 0)
- product logs/services gained --service/--mode, and services now
  resolves the endpoint from the container port mapping in all trees
- the AWS tree brands itself 'Floci AWS' in banners and help,
  matching the other products
- snapshot errors link the product issue tracker instead of TODO.md
- completion generates from spec.root() instead of a hardcoded
  FlociCli instance (output unchanged)

BREAKING CHANGE: 'floci gcp|az|oci snapshot export/import' (and bare
'floci snapshot ...' with a non-AWS default product) now exit 1
instead of 0 while server-side snapshot support is pending; CI
scripts relying on the silent success of stubbed snapshot commands
will fail.

* fix: snapshot save/load/list/delete resolve the container host port

Same port auto-detection status/services/wait use — a container started
with --port <n> is now reachable by the snapshot commands without an
explicit --endpoint. Applies to all four trees via the unified base
commands.
2026-07-28 21:45:52 -05:00
Hector Ventura 0a65de2303 feat(oci): add floci oci command group for the Floci OCI emulator (#15)
* feat(oci): add floci oci command group for the Floci OCI emulator

Adds the fourth product tree targeting floci-oci (port 4599, container
floci-oci, control prefix /_floci-oci, FLOCI_OCI_* env overrides):
start/stop/restart/status/logs/wait/version/services/doctor/env/config
plus stub snapshot commands, mirroring the GCP/Azure trees.

- 'floci oci env' exports OCI_CLI_ENDPOINT, FLOCI_OCI_ENDPOINT, and
  TF_VAR_CLIENT_HOST_OVERRIDES for the OCI CLI, the ocilocal wrapper,
  and the oracle/oci Terraform provider; also OCI_CLI_PROFILE=FLOCI
  when that profile exists.
- 'floci oci setup' generates an RSA-2048 API signing key with a real
  computed fingerprint and writes a throwaway [FLOCI] profile to
  ~/.oci/config (idempotent, never touches existing profiles) — the
  OCI CLI/SDKs refuse to run without them.
- FlociHttpClient now accepts both health 'services' shapes: the array
  reported by AWS/GCP/Azure servers and the {name: status} object
  reported by floci-oci.
- 'floci config default-product oci' routes bare commands to the tree.

* fix(oci): address review findings on env, services, and setup profile

- Single-quote 'oci env' exports with per-shell escaping (bash/fish/
  PowerShell) so endpoint values containing shell metacharacters cannot
  inject commands through the documented 'eval $(floci oci env)' flow.
- 'oci services' resolves the endpoint from the container port mapping
  like status/wait/env, so a container started with --port <n> is found
  without passing --endpoint.
- 'oci env' exports OCI_CLI_PROFILE for whichever profile 'oci setup'
  wrote (detected via its key_file marker) instead of only the
  hardcoded FLOCI name; DEFAULT is skipped as the CLI uses it
  implicitly.
2026-07-28 21:15:42 -05:00
Juan Diego López 2498ea05b2 Feature/notifier-update (#13)
* fix: align ContainerInfo fields with inspect format template

* feat(update): add self-update command with checksum verification

* fix(update): harden self-update checksum, cleanup, and exit code

* feat(update): notify when a new release is available

* fix(update): validate release tag, avoid pre-release downgrades, clarify empty-body error

* feat(update): notify when a new release is available

* fix(cli): exempt update from default-product routing
2026-07-11 12:29:15 -05:00
Hector Ventura a2f97ae820 docs: add AGENTS.md, CONTRIBUTING.md, PR template; document GCP and self-update (#14)
* docs: add AGENTS.md, CONTRIBUTING.md, PR template; document GCP and self-update

- AGENTS.md (tracked): canonical agent guidance — architecture incl. the
  three product trees table, doctor check structure per tree, native-image
  constraints, code style rules, updated scope rules (self-update now in
  scope, must never auto-run)
- CONTRIBUTING.md: build/test setup, Conventional Commits, hand-maintained
  Keep-a-Changelog policy, PR guidelines, tag-driven release process
- .github/pull_request_template.md: adapted from the server repo with a
  'product trees affected' checklist
- README: document the floci gcp command group (quick start, command
  reference, global flags, gcp env variables, CI usage), floci update,
  Java 25+ fat-JAR requirement; drop the unwired snapshot --message flag
  from examples
- CHANGELOG: backfill [Unreleased] with #12 (self-update) and #11
  (ContainerInfo field alignment); document these docs changes
- release.yml: release notes said the fat JAR needs Java 21+, but it is
  built with --release 25 — corrected to Java 25+

* docs(changelog): use standard Keep a Changelog headings for Unreleased

The Documentation section is not one of the six types defined by Keep a
Changelog 1.1.0. New docs (AGENTS.md, CONTRIBUTING.md, README GCP section)
move under Added; the incorrect Java 21+ runtime claim moves under Fixed.
2026-07-06 20:15:32 -05:00
Hector Ventura 6862c0dd81 feat: honor DOCKER_HOST for Docker daemon resolution (#4)
Resolve the Docker endpoint from DOCKER_HOST (with the legacy DOCKER_SOCK
override and an OS default fallback) so Podman, rootless setups, and remote
Docker contexts work without assuming /var/run/docker.sock.

start/az start/gcp start bind-mount the resolved unix socket or pass a remote
tcp:// daemon through via DOCKER_HOST; doctor's docker.socket check reports the
resolved endpoint. Adds DockerHostResolveTest and README documentation.

Closes #3
2026-06-10 17:19:44 -05:00
Hector Ventura 11883f5b67 fix: adding floci aws/az commands 2026-05-15 18:08:45 -05:00
Hector Ventura 1d7f9f81d0 fix: updating with latest floci changes 2026-05-15 02:34:27 -05:00
Hector Ventura aef1df595f chore: first commit 2026-05-12 17:10:46 -05:00