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.
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-07-28 21:15:42 -05:00
1 parent 2ff3181198
commit 0a65de2303
34 files changed
+1924 -33

No files matched your search

@@ -0,0 +1,43 @@
package io.floci.cli.commands.oci;
import io.floci.cli.commands.CompletionCommand;
import io.floci.cli.commands.oci.config.OciConfigCommand;
import io.floci.cli.commands.oci.snapshot.OciSnapshotCommand;
import picocli.CommandLine;
import picocli.CommandLine.*;
@Command(
name = "oci",
description = "Manage the Floci OCI emulator (floci-oci)%n%n" +
" floci oci start — launch the container%n" +
" floci oci stop — stop the container%n" +
" floci oci status — show health and version%n" +
" floci oci doctor — diagnose environment issues%n" +
" floci oci env — print OCI environment variables%n" +
" floci oci setup — create a local OCI CLI profile (key + ~/.oci/config)%n",
mixinStandardHelpOptions = true,
subcommands = {
OciStartCommand.class,
OciStopCommand.class,
OciRestartCommand.class,
OciStatusCommand.class,
OciLogsCommand.class,
OciWaitCommand.class,
OciVersionCommand.class,
OciServicesCommand.class,
OciDoctorCommand.class,
OciEnvCommand.class,
OciSetupCommand.class,
OciConfigCommand.class,
OciSnapshotCommand.class,
CompletionCommand.class,
HelpCommand.class
}
)
public class OciCommand implements Runnable {
@Override
public void run() {
new CommandLine(this).usage(System.out);
}
}