Commit Graph
15 Commits
Author SHA1 Message Date
Hector Ventura ac52515471 docs(skill): publish the floci agent skill for the CLI and the four emulators (#69)
* docs(skill): publish the floci agent skill for the CLI and the four emulators

skills/floci/ teaches an AI agent to run, wire up and troubleshoot the AWS,
GCP, Azure and OCI emulators through floci-cli, docker run or Docker Compose.

- SKILL.md with the lifecycle, the hard rules (fake credentials only, verify
  the endpoint, name the tree, parse -o json) and one reference per cloud.
- references/docs.md sends the agent to the published documentation of each
  emulator instead of copying coverage lists that go stale.
- references/docker.md and assets/compose/ give docker run equivalents of
  'floci <tree> start' and a ready Compose template per cloud, plus one with
  all four on a network.
- scripts/install-floci.sh and scripts/ensure-running.sh.
- .claude-plugin/marketplace.json publishes it as a Claude Code plugin and the
  root plugin.json as a Kiro power (Agent Plugins format).
- SkillDocsTest checks every floci command and flag the skill quotes against
  the real command tree, its links, its frontmatter and both manifests.
- README: an "AI agents" section with the install commands, a Privacy section
  on what the CLI and the skill send over the network, and support links.
- AGENTS.md: a command, flag, env output or exit code change updates the
  skill in the same change.

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

* docs(skill): bind published ports to loopback and make the helper fail safely

Addresses the review of #69.

- The Compose templates and the docker run examples publish the emulator on
  127.0.0.1. The emulators accept fake credentials, so a plain 4566:4566
  exposed local resources to the network. docker.md says when to drop it and
  that 'floci <tree> start' still publishes on every interface.
- ensure-running.sh no longer replaces a stopped container: it exits 3 and
  leaves it alone unless FLOCI_REPLACE_STOPPED=1, because start removes the
  container and, without a profile, its settings.
- The documented call is now 'exports="$(...)" && eval "$exports"'. The
  one-step eval succeeded when the helper failed, so later commands ran with
  missing or stale wiring.
- The templates say that container name, namespace and network name are per
  project and change together.
- docker.md lists the network settings to copy into the multi-cloud file
  when an app reaches child containers by name.
- ci.md installs into a user-writable directory instead of assuming
  /usr/local/bin or sudo.
- SkillDocsTest now reads commands inside assignments and across continued
  lines, with a test that a wrong flag is found in each form. The helper's
  own status and env calls were not being checked.

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

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-12 20:27:02 -05:00
Hector Ventura 97eaa5e820 docs: add an exit-code table and generated --help snapshots (#63)
* docs: add an exit-code table and generated --help snapshots

README gains the exit codes scripts can rely on, per command. docs/help holds the --help text of every command in every tree, and HelpSnapshotTest fails when the files and the commands drift apart.

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

* docs: say which rejected values exit 1 and pin the documented exit codes with a test

The table promised 2 for every unusable value, but three commands report a rejected value with 1. The wording is narrowed, the three are named, and ExitCodeTableTest pins the rows that need neither Docker nor a server.

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

* test: keep the exit-code test off the developer's saved profiles

The profile commands build their own store under the home directory, so the test now runs with a temporary home.

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

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-11 09:23:29 -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 030d468fd3 test: add an opt-in integration suite against the real emulator images (#44)
mvn test -Pintegration drives start, wait, status, env and stop for all four products through the CLI's own command tree, plus two AWS instances side by side, each container uniquely named on a free port and removed afterwards. Tests tagged integration are excluded from the default build. A new Integration workflow runs the suite on main, weekly and on demand.
2026-10-09 22:11:00 -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 bc59dff8c3 refactor(profile): read the parse's profile snapshot in restart and config show (#34) 2026-10-08 22:25:23 -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 3c4118ff1a perf(native): build smaller binaries with -Os and enforce a size budget (#28) 2026-10-08 21:28:53 -05:00
Hector Ventura 3159a653b4 docs: stop telling contributors to hand-edit CHANGELOG.md (#24)
* docs: stop telling contributors to hand-edit CHANGELOG.md

AGENTS.md and the PR template both asked for an entry under [Unreleased],
which changelog-guard.yml hard-fails and CONTRIBUTING.md forbids. Both lines
predate the semantic-release cutover in #20.

AGENTS.md now states the generated-file rule and points at the changelog-edit
escape hatch; the template drops the checkbox and says on the Conventional
Commits line why no hand edit is needed.

* docs: say which commit types actually produce a changelog entry

The previous wording claimed every Conventional Commit message is the changelog
entry. The commit gate accepts eleven types, but .releaserc.json runs
commit-analyzer with no releaseRules and no preset, so only feat, fix, perf and
breaking changes release. Two commits landed between 0.2.1 and 0.2.2, a fix and
a docs, and only the fix appears in the 0.2.2 section.

Corrected in all four places the claim lived: AGENTS.md, the PR template,
CONTRIBUTING.md, and the changelogTitle in .releaserc.json.

CHANGELOG.md changes with .releaserc.json on purpose and must stay byte
identical to it. @semantic-release/changelog strips the configured title from
the existing file only when the file starts with it, so changing one without
the other would leave the old header in the body and prepend the new one,
shipping a duplicated header on the next release. That is what the
changelog-edit label exists for.

Reported by Greptile on #24 and verified before acting.

* docs(ci): correct the same changelog claim in the guard's own error message

My first pass grepped only *.md and *.json, so it missed the two copies inside
changelog-guard.yml: the header comment and the ::error:: text a contributor
actually sees when the guard fires. A repo-wide grep now returns nothing.
2026-09-13 19:54:49 -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 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
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