Skip to content

[create] v1 API conformance: site:search + site:export - #29

Merged
btopro merged 2 commits into
mainfrom
conformance/v1-normalization
Aug 6, 2026
Merged

[create] v1 API conformance: site:search + site:export#29
btopro merged 2 commits into
mainfrom
conformance/v1-normalization

Conversation

@btopro

@btopro btopro commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

Fixes the create CLI's usage of the haxcms-nodejs v1 API surface, addressing the High (B4) and Low (F5) findings from the conformance audit.

Changes

  • B4 (High): hax site:search now sends v1 params (q, fields, page.limit) instead of the v0-style params (search, searchField, searchLimit, searchCaseSensitive, searchSelector, searchMode) that always 400'd against the v1 /x/api/v1/search endpoint. The --search-selector/--search-mode/--search-case-sensitive CLI flags are kept defined (to avoid a breaking interface change) but no longer forwarded.
  • F5 (Low): hax site:export now supports the html format (added to validExportFormats and downloadFormats). For zip/markdown/skeleton formats (which return a JSON descriptor, not a file), the CLI now logs that the output is a descriptor with data.export.href pointing at the real download.
  • Man page (hax.1) example updated from the misleading selector-mode syntax to v1 fields/limit syntax.

Validation

  • node --check on changed files → OK
  • Smoke tests (ephemeral build, artifacts removed):
    • hax site:search --search "the" → 200, 7 results (was 400/no-op)
    • hax site:search --search "the" --search-field title,content --search-limit 2 → fields=[title,content], count=2
    • hax site:export --export-format html --to-file /tmp/x.html → valid 10.8KB HTML file
    • hax site:export --export-format markdown → prints descriptor with href + supportedFormats (incl. html)

Note

The v1 search backend has no selector/DOM-query mode — only case-insensitive text matching across fields. The CLI flags are retained to avoid breaking existing scripts but are no-ops against v1.

Related

Co-Authored-By: Oz oz-agent@warp.dev

btopro and others added 2 commits August 6, 2026 13:36
- site:search: sends v1 params (q, fields, page.limit) instead of v0-style
  (search, searchField, searchLimit, etc.); drops unsupported selector params
- site:export: adds html format; documents JSON descriptor for zip/md/skeleton
- Updates man page example to v1 fields/limit syntax

Refs: haxtheweb/issues conformance audit (site/system parity)

Co-Authored-By: Oz <oz-agent@warp.dev>
…search + site:export)

Co-Authored-By: Oz <oz-agent@warp.dev>
Copilot AI lite review requested due to automatic review settings August 6, 2026 18:02
@btopro
btopro merged commit d915d89 into main Aug 6, 2026
1 check failed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the CLI to align site:search with the v1 search API contract and expands site:export to support HTML exports.

Changes:

  • Update site:search to send q, fields, and page.limit query params for /v1/search and clarify interactive prompt text.
  • Add html as a supported site:export format and handle it as a direct download-to-disk response type.
  • Refresh manpage and CLI option help text to reflect the updated search/export behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/lib/programs/site.js Switches search to v1 parameter names/semantics and adds HTML export handling.
src/docs/hax.1 Updates site search examples to match v1 field-based searching.
src/create.js Updates --export-format help text to include html.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lib/programs/site.js
Comment on lines +1883 to +1890
// v1 search contract (GET /v1/search) requires `q` and supports
// `fields` (CSV of: title,slug,description,tags,content,id,location),
// `sort`, and `page.limit`/`page.offset` pagination. The legacy v0
// params (searchCaseSensitive, searchSelector, searchMode) have no
// v1 equivalent: v1 search is always case-insensitive and only does
// text matching across fields (no selector/DOM-query mode). The
// --search-selector / --search-mode CLI flags are kept to avoid a
// breaking interface change but are intentionally not forwarded.
Comment thread src/lib/programs/site.js
Comment on lines 1897 to 1899
if (commandRun.options.searchField) {
searchRouteParams.searchField = commandRun.options.searchField;
}
if (commandRun.options.searchCaseSensitive) {
searchRouteParams.searchCaseSensitive = true;
searchRouteParams.fields = commandRun.options.searchField;
}
Comment thread src/docs/hax.1
Comment on lines 375 to +379
.B hax site site:search --search "lesson"
Search site text content and metadata fields
.TP
.B hax site site:search --search "video-player[src]" --search-selector
Search site HTML content using selector mode
.B hax site site:search --search "lesson" --search-field title,tags --search-limit 10
Search site title and tags fields, limited to 10 matches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants