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

+6 -1
View File
@@ -4,6 +4,7 @@ import io.floci.cli.commands.*;
import io.floci.cli.commands.aws.AwsCommand;
import io.floci.cli.commands.az.AzCommand;
import io.floci.cli.commands.gcp.GcpCommand;
import io.floci.cli.commands.oci.OciCommand;
import io.floci.cli.commands.config.ConfigCommand;
import io.floci.cli.commands.snapshot.SnapshotCommand;
import io.floci.cli.config.GlobalConfigStore;
@@ -23,6 +24,7 @@ import picocli.CommandLine.*;
" floci aws — explicit AWS emulator commands%n" +
" floci az — Azure emulator commands%n" +
" floci gcp — GCP emulator commands%n" +
" floci oci — OCI emulator commands%n" +
" floci update — Update the CLI to the latest release",
mixinStandardHelpOptions = true,
versionProvider = FlociCli.VersionProvider.class,
@@ -43,6 +45,7 @@ import picocli.CommandLine.*;
AwsCommand.class,
AzCommand.class,
GcpCommand.class,
OciCommand.class,
HelpCommand.class,
UpdateCommand.class,
}
@@ -81,6 +84,8 @@ public class FlociCli implements Runnable {
effectiveArgs = prepend("az", args);
} else if ("gcp".equals(defaultProduct)) {
effectiveArgs = prepend("gcp", args);
} else if ("oci".equals(defaultProduct)) {
effectiveArgs = prepend("oci", args);
}
}
@@ -115,7 +120,7 @@ public class FlociCli implements Runnable {
private static boolean isExplicitProduct(String[] args) {
for (String arg : args) {
if (arg.startsWith("-")) continue;
return "aws".equals(arg) || "az".equals(arg) || "gcp".equals(arg)
return "aws".equals(arg) || "az".equals(arg) || "gcp".equals(arg) || "oci".equals(arg)
|| "config".equals(arg) || "completion".equals(arg) || "help".equals(arg)
|| "update".equals(arg);
}