Clojure CLI entrypoint for AI features.
Called by the Babashka scripts/ai.clj script: clojure -M -m wagoe.ai.shell.cli-entry <subcommand> [args]
Subcommands: scaffold-ai <description> -- NL module scaffolding explain [--file path] [--stdin] -- error explainer gen-tests <source-file> -- test generator sql <description> -- SQL copilot docs --module <path> --type <type> -- documentation wizard
Clojure CLI entrypoint for AI features. Called by the Babashka scripts/ai.clj script: clojure -M -m wagoe.ai.shell.cli-entry <subcommand> [args] Subcommands: scaffold-ai <description> -- NL module scaffolding explain [--file path] [--stdin] -- error explainer gen-tests <source-file> -- test generator sql <description> -- SQL copilot docs --module <path> --type <type> -- documentation wizard
(explain-provider-error result service)(explain-provider-error result service env)Turn a provider's error result into something actionable.
Takes the service alongside the result. :configured? is set where the
service is built — the only place that knows whether the user chose a
provider — and every other basis for that judgement has been wrong:
:provider keyword misreported Ollama configured in
resources/conf/<env>/config.edn, which is a supported pathOnly the env fallback with no variable set is unconfigured. Anything else —
an env var, or :wagoe/ai-service in config — is a deliberate choice, and
telling that user to configure a provider sends them to the wrong fix.
env is a parameter so the arms are testable. Reading System/getenv inside
made the assertions depend on whether the developer happened to have
OLLAMA_URL exported — the ambient-environment fault this function explains.
Returns the original message when it has nothing better to say: replacing an unrecognised one with a friendlier guess would hide it.
Turn a provider's error result into something actionable. Takes the service alongside the result. `:configured?` is set where the service is built — the only place that knows whether the user chose a provider — and every other basis for that judgement has been wrong: - environment variables alone misreported a configured OPENAI_BASE_URL pointing at a local endpoint that was down - the `:provider` keyword misreported Ollama configured in resources/conf/<env>/config.edn, which is a supported path Only the env fallback with no variable set is unconfigured. Anything else — an env var, or `:wagoe/ai-service` in config — is a deliberate choice, and telling that user to configure a provider sends them to the wrong fix. `env` is a parameter so the arms are testable. Reading `System/getenv` inside made the assertions depend on whether the developer happened to have OLLAMA_URL exported — the ambient-environment fault this function explains. Returns the original message when it has nothing better to say: replacing an unrecognised one with a friendlier guess would hide it.
(parse-or-exit! args opts usage)Parse args against opts, or print the errors and exit 1.
Every subcommand destructured parse-opts as {:keys [options arguments]}
and never read :errors, so tools.cli collected unknown options and invalid
values and they were discarded. A typo one keystroke from a real flag —
--fil for --file — was dropped, its value became a positional argument
nothing reads, and the command failed complaining about missing input
(BOU-279). The message pointed away from the mistake, which was on the same
line.
Public so a test can drive it. Returns the parsed map; -main exits.
Parse `args` against `opts`, or print the errors and exit 1.
Every subcommand destructured `parse-opts` as `{:keys [options arguments]}`
and never read `:errors`, so tools.cli collected unknown options and invalid
values and they were discarded. A typo one keystroke from a real flag —
`--fil` for `--file` — was dropped, its value became a positional argument
nothing reads, and the command failed complaining about missing input
(BOU-279). The message pointed away from the mistake, which was on the same
line.
Public so a test can drive it. Returns the parsed map; `-main` exits.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |