Skip to content

feat!: add formatter content types - #223

Merged
moshloop merged 2 commits into
mainfrom
chore/oipa-sync-20261022
Oct 27, 2026
Merged

moshloop merged 2 commits into
mainfrom
chore/oipa-sync-20261022

Conversation

@moshloop

@moshloop moshloop commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

What

  • Custom formatters can declare a media type with WithContentType, which HTTP responses use as Content-Type
  • Binary content types skip ANSI stripping, so PDFs are served byte for byte
  • Optional-id actions publish the id as an optional query positional instead of a body field
  • MCP tool calls route named positionals to args as HTTP does; an action's own id flag keeps its name
  • Markdown tables render row details as numbered footnote notes linked from the row
  • Tasks no longer initialize progress to 0/100, so tasks that never report progress show no count or bar
  • Request bodies that set the positional under two keys are rejected, instead of merging in random map order

Why

  • Removes the phantom id from generated OpenAPI bodies and tool inputs

Notes

  • Breaking: optional-id collection actions no longer declare id in the request body schema. Send it as ?id= instead.

Summary by CodeRabbit

  • New Features
    • Stack traces now render in Markdown and styled HTML, with clearer frame locations and source-line information.
    • Plain Markdown tables now link rows with details to numbered notes below the table.
    • Custom formatters can declare a content type, which is reflected in HTTP responses.
  • Improvements
    • Positional arguments and optional action IDs are handled consistently across command, API, and tool inputs; conflicting positional values are rejected.
    • Tailwind color styling supports more color formats, while unrecognized colors no longer produce styling.
    • Command aliases that conflict with sibling commands are omitted.
    • Tasks without reported progress no longer display a misleading progress count or bar.
  • Documentation
    • Clarified how optional action IDs are provided in HTTP routes.

…il-safe copies

Claude-Session-Id: 0a7b91db-2ce6-42a8-af78-b6db2cc134d2
…ery positionals

Custom formatters can declare a media type with WithContentType. HTTP responses use it as Content-Type, and binary types skip ANSI stripping so PDFs are served byte for byte.
Optional-id actions now publish their id as an optional query positional instead of a body field. This removes the phantom id from generated OpenAPI bodies and tool inputs.
MCP tool calls route named positionals to args as HTTP does, and an action's own id flag keeps the name.
Markdown tables render row details as numbered footnote notes linked from the row.
Tasks no longer initialize progress to 0/100, so tasks that never report progress show no count or bar.
A request body that sets the positional under two keys is now rejected instead of merging in random map order.
BREAKING CHANGE: optional-id collection actions no longer declare `id` in the request body schema; send it as ?id= instead.
@moshloop
moshloop enabled auto-merge (rebase) October 27, 2026 04:48
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Walkthrough

The PR updates positional argument handling, custom formatter content types, HTML and stack-trace rendering, Markdown table details, entity command aliases, task progress defaults, and a repository ignore rule.

Changes

Positional argument handling

Layer / File(s) Summary
Optional ID conversion and contract
rpc/converter.go, rpc/completion_lookup_test.go, rpc/openapi_test.go, docs/site/src/content/docs/reference/http-routes.md
Optional IDs are exposed as query positionals, omitted from body schemas, and suppressed when a same-named flag exists. Documentation and tests reflect this behavior.
Positional request execution
rpc/executor.go, rpc/executor_operation.go, rpc/positional_param_ginkgo_test.go
Request execution identifies positional fields through the exported helper and rejects multiple positional fields in a JSON body. Tests cover optional ID delivery, conflicts, and action flags.
Tool positional argument mapping
aichat/tools_clicky.go, aichat/tools_clicky_args_ginkgo_test.go, mcp/server.go, mcp/split_args_ginkgo_test.go
Aichat and MCP argument mapping now uses operation positional metadata. Tests check positional values, generic args, and remaining flags.

HTML and stack-trace rendering

Layer / File(s) Summary
Tailwind color and inline style rendering
api/tailwind/css_color.go, api/tailwind/tailwind.go, api/html_inline.go, api/tailwind/tailwind_test.go, api/text_test.go
Tailwind color resolution recognizes semantic colors and CSS literals. HTML rendering maps supported utilities to inline styles. Tests cover recognized and unknown color tokens.
Stack-trace renderers
api/stacktrace.go, api/stacktrace_markdown.go, api/stacktrace_test.go
Stack-trace HTML, text, and Markdown rendering share frame and source-line helpers. Unknown source line numbers use blank gutters, and Markdown fences adapt to content. Tests check rendered output and styling.

Markdown table details

Layer / File(s) Summary
Row links and detail notes
api/markdown_table_plain.go, api/markdown_table_plain_test.go
Rows with details receive superscript links and numbered headings with generated anchors. Tests cover rows with and without details.

Custom formatter content types

Layer / File(s) Summary
Content type registration and classification
formatters/custom.go, format.go
Formatter registration accepts options and stores an optional content type. Helpers expose the type and classify it as binary or textual.
Response content type handling
formatters/manager_context.go, rpc/response_format.go, rpc/response_format_content_type_ginkgo_test.go
Response formatting uses a custom formatter's declared content type, with JSON as the fallback. Tests check the response type and body.

Entity CLI aliases

Layer / File(s) Summary
Sibling-name alias filtering
entity/entity_cli.go, entity/inspect_alias_spec_test.go
The entity CLI generator removes aliases that collide with child command names. A test checks resolution of an explicit inspect action.

Task progress rendering

Layer / File(s) Summary
Unreported progress output
task/manager.go, task/progress_render_ginkgo_test.go
Task creation leaves progress fields at their zero values. A test checks that a completed task without reported progress has no 0/100 count or progress bar.

Repository ignore rule

Layer / File(s) Summary
Ignore root-level .new
.gitignore
The root-level .new path is added to the ignore rules.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant RPCExecutor
  participant RPCOperation
  participant Action
  Client->>RPCExecutor: Submit query or body values
  RPCExecutor->>RPCOperation: Check positional parameter metadata
  RPCExecutor->>Action: Invoke with extracted positional value
Loading

Suggested reviewers: flanksource

Priority: Not assessed

Change: Feature

Merge Risk: Moderate · up to c8e25

Generated tools cannot expose optional IDs, and some binary formatter output may be altered. Resolve these material issues before merging; the remaining findings affect narrower output and argument-handling cases.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Gavel summary

Source Pass Fail Skip Duration
lint: oxlint 0 1 0 168ms
lint: tsc 2 1 0 4.6s
lint: betterleaks 0 0 1 -
lint: golangci-lint 1 0 0 2m7s
lint: react-doctor 1 0 0 5.5s

Totals: 4 passed · 2 failed · 1 skipped · 2m17s

Failing linters

oxlint — 3 violation(s)

  • /home/runner/work/clicky/clicky/examples/enitity/webapp/src/LinkExamplesPage.tsx:217 — Empty fallbacks in spreads are unnecessary (oxlint)
  • /home/runner/work/clicky/clicky/examples/enitity/webapp/src/api.ts:53 — Empty fallbacks in spreads are unnecessary (oxlint)
  • /home/runner/work/clicky/clicky/examples/enitity/webapp/src/api.ts:133 — Empty fallbacks in spreads are unnecessary (oxlint)

tsc — error

tsc wrapper failed: exit status 1
Stderr:
gavel-tsc: cannot load 'typescript' from /home/runner/work/clicky/clicky/task/ui/node_modules. Install it with your package manager (e.g. `npm i -D typescript`).

View full results

@github-actions

Copy link
Copy Markdown
Contributor

Gavel summary

Source Pass Fail Skip Duration
aichat 24 0 0 2ms
api 326 0 0 22ms
cache 28 0 0 138ms
celfilter 14 0 9 14ms
clicky 126 0 0 1m22s
clirender 18 0 0 937.963µs
enitity 1 0 0 5.6s
entity 171 0 0 147ms
entitydemo 2 0 0 1ms
excel 12 0 0 53ms
exec 144 0 1 10.9s
extensions 1 0 0 99.896µs
filter 10 0 3 602.175µs
flags 40 0 0 3ms
formatters 79 0 0 8ms
github.com/flanksource/clicky 28 0 0 3.0s
github.com/flanksource/clicky/api 258 0 0 250ms
github.com/flanksource/clicky/api/tailwind 434 0 0 10ms
github.com/flanksource/clicky/api/wasmtest 1 0 0 160ms
github.com/flanksource/clicky/cmd/clicky 4 0 0 20ms
github.com/flanksource/clicky/docs 19 0 0 10ms
github.com/flanksource/clicky/entity 153 0 0 -
github.com/flanksource/clicky/examples/enitity/internal/entitydemo 7 0 0 -
github.com/flanksource/clicky/exec 3 0 0 400ms
github.com/flanksource/clicky/flags 53 0 0 -
github.com/flanksource/clicky/formatters 77 0 1 20ms
github.com/flanksource/clicky/formatters/http 38 0 0 -
github.com/flanksource/clicky/formatters/tests 201 0 1 20ms
github.com/flanksource/clicky/internal/gumchoose 2 0 0 -
github.com/flanksource/clicky/lint 13 0 0 -
github.com/flanksource/clicky/markdown 10 0 0 80ms
github.com/flanksource/clicky/mcp 102 0 0 3.0s
github.com/flanksource/clicky/middleware 31 0 0 -
github.com/flanksource/clicky/prompt 15 0 0 10ms
github.com/flanksource/clicky/route 12 0 0 -
github.com/flanksource/clicky/rpc 378 0 1 10ms
github.com/flanksource/clicky/rpc/http 8 0 0 10ms
github.com/flanksource/clicky/task 168 0 0 21.9s
github.com/flanksource/clicky/valkey 1 0 0 340ms
gomplatefilter 2 0 0 6ms
http 5 0 0 228.456µs
lint 16 0 0 15.9s
markdown 4 0 0 59ms
mcp 4 0 0 4ms
metrics 7 0 0 1ms
middleware 38 0 0 3ms
process 44 0 0 1.8s
rpc 53 0 0 1.9s
schemaform 61 0 0 1.7s
sse 74 0 0 1.8s
task 95 0 0 5.8s
tests 11 0 47 8ms
text 78 0 0 305ms
urlfetch 4 0 0 1ms
valkey 46 0 0 331ms

Totals: 3554 passed · 0 failed · 63 skipped · 2m38s

View full results

@moshloop
moshloop merged commit 6197ffc into main Oct 27, 2026
16 of 18 checks passed
@moshloop
moshloop deleted the chore/oipa-sync-20261022 branch October 27, 2026 04:55
@flankbot

Copy link
Copy Markdown

🎉 This PR is included in version 1.21.84

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants