Liking cljdoc? Tell your friends :D

wagoe.ai.shell.cli-entry

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
raw docstring

-mainclj

(-main & raw-args)
source

admin-entity-optsclj

source

cmd-admin-entityclj

(cmd-admin-entity args)
source

cmd-docsclj

(cmd-docs args)
source

cmd-explainclj

(cmd-explain args)
source

cmd-gen-testsclj

(cmd-gen-tests args)
source

cmd-scaffold-aiclj

(cmd-scaffold-ai args)
source

cmd-setup-parseclj

(cmd-setup-parse args)
source

cmd-sqlclj

(cmd-sql args)
source

docs-optsclj

source

explain-optsclj

source

explain-provider-errorclj

(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:

  • 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.

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.
sourceraw docstring

gen-tests-optsclj

source

help-textclj

source

parse-or-exit!clj

(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.
sourceraw docstring

scaffold-ai-optsclj

source

setup-parse-optsclj

source

sql-optsclj

source

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close