[create] v1 API conformance: site:search + site:export - #29
Merged
Conversation
- 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>
Contributor
There was a problem hiding this comment.
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:searchto sendq,fields, andpage.limitquery params for/v1/searchand clarify interactive prompt text. - Add
htmlas a supportedsite:exportformat 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 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 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 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
hax site:searchnow 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/searchendpoint. The--search-selector/--search-mode/--search-case-sensitiveCLI flags are kept defined (to avoid a breaking interface change) but no longer forwarded.hax site:exportnow supports thehtmlformat (added tovalidExportFormatsanddownloadFormats). Forzip/markdown/skeletonformats (which return a JSON descriptor, not a file), the CLI now logs that the output is a descriptor withdata.export.hrefpointing at the real download.hax.1) example updated from the misleading selector-mode syntax to v1fields/limitsyntax.Validation
node --checkon changed files → OKhax 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=2hax site:export --export-format html --to-file /tmp/x.html→ valid 10.8KB HTML filehax 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