feat(instantsearch-cli): bootstrap instantsearch-cli#7009
Draft
sarahdayan wants to merge 31 commits into
Draft
Conversation
Captures the resting model (widget + experience, provider internal), POC scope (React plain + Next App Router + JS bundled, `search` template, six widgets), command surface, generated file philosophy, manifests, introspection strategy, agent interface (`--json`/`--yes`), distribution, use cases, and locked/deferred decisions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Reframes the POC design doc into a PRD — problem and solution from the user's perspective, user stories, module architecture, and test scope — with a live two-flavor recording as the acceptance gate. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Ships the tracer-bullet slice of the InstantSearch CLI for React + TS/JS: detector, manifest, generator, introspector, JSON reporter, and a commander bin wired through `init`. Non-interactive `--yes --json` mode is covered end-to-end; interactive prompts arrive with phase 2. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Extends the InstantSearch CLI POC with the `add experience <name> --template search` command for React plain + TypeScript. Emits a provider and the three structural widgets (SearchBox, Pagination, ClearRefinements) with no index introspection, plus the per-experience `instantsearch.config.json`. Updates the root manifest's `experiences` array and returns a `nextSteps` block with import hints + mounting guidance so agents can finish wiring the layout. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Extend the Introspector with three beats (records / facets / replicas) fronting the full Algolia failure taxonomy, add schema-driven widgets (Hits, RefinementList, SortBy) to the Generator, and expand `--template search` to the full six-widget experience wired to `introspectRecords` for pre-flight validation. Flag-driven path only; interactive prompt fallbacks are documented as deferred in the plan. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Audit retroactively — the non-deferred criteria were all verifiable via the existing unit tests + bin. Leaves "interactive creds prompt" (phase 1) and "live Vite host render" (phase 2) unchecked; both are explicitly deferred to downstream phases via the existing scope notes.
Branch provider and Hits generators on `manifest.typescript` so projects without a `tsconfig.json` receive `.jsx` files with no type imports, annotations, or generics. Other widgets already emitted TS/JS-compatible JSX, so only two functions needed conditional snippets. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…phase 5) Detector now returns `framework: 'nextjs'` when `react-instantsearch-nextjs` is installed alongside an `app/` directory, and errors with `unsupported_framework` when both `app/` and `pages/` are present unless `--framework nextjs` is passed. Generator emits a `'use client'` provider importing `InstantSearchNext` for that framework; widget files are unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Covers the JS flavor path: detector recognizes instantsearch.js-only projects, init writes flavor: "js", and add-experience emits a provider that orchestrates addWidgets/start plus six widget factories taking a container selector. Generator dispatch is flavor-keyed via a sources table; schema validation is shared between React and JS paths. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Introduces incremental `add widget <widget> --experience <name>`, including auto-materializing the experience when it doesn't exist yet (`--index` required in --yes mode, else `index_required`), and auto-suffixing repeated RefinementList widgets by their facet attribute. Any command that would overwrite a previously generated file now fails fast with `file_conflict` before touching disk. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Extract a shared next-steps builder so add widget also emits nextSteps.imports + mountingGuidance on success. Under --json, silence stderr and map commander parse errors (unknown option/command, missing argument) to our own failure taxonomy so agents don't couple to commander's internal code strings. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…widget Wire inquirer-based interactive prompts behind a testable Prompter abstraction so all three CLI commands work without --yes/--json flags. Covers: credential entry, flavor/framework confirmation, index name, schema-driven widget attributes (hits title/image, facet attribute, replicas), and all five failure-variant fallbacks (index_not_found with re-prompt from listed indices, index_empty with manual schema entry, index_has_no_facets with manual attribute, settings_forbidden with manual replicas, no_replicas with skip-SortBy offer). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
When no InstantSearch package is found, the CLI now infers the right flavor from project dependencies (next → react+nextjs, react → react, neither → js) and installs the packages automatically instead of failing. In interactive mode, the user confirms before install. Adds a new installer module with package manager detection (yarn/npm/pnpm from lockfile) and uses execFileSync to avoid shell injection. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reserve raw JSON for --json mode (agent consumption) and render a readable summary with file list and next-steps guidance for humans. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The CLI now generates an index file that composes the provider and all widgets into a single entry point, so users only need to import and render one component (React) or add container divs (JS). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Allow callers to specify which widgets to generate, so they can omit SortBy (or any other widget) without needing to satisfy its schema flags. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Lets agents and users discover attributes, facets, and replicas in a single call instead of trial-and-error with add experience flags. Returns partial results with warnings when some introspections fail. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Document the new introspect command and --widgets flag on add experience. Fix manifestUpdated type (string, not boolean) and add missing error codes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…flict Error messages now include recovery guidance so users know what to do next without consulting docs. The file_conflict hint is scoped to add-experience (not the shared write-files utility) since the recovery path differs per caller. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The search template now generates one RefinementList file per facet attribute (e.g. RefinementListBrand.tsx, RefinementListCategory.tsx) instead of a single RefinementList.tsx. The interactive prompt uses multi-select for facet attributes, and --refinement-list-attribute accepts comma-separated values. Also renames --search-key to --search-api-key for consistency with Algolia terminology, fixes a schema merge bug in add-widget where new refinementList entries would overwrite existing ones, and updates the skill to instruct agents to check --help before running commands. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…get skipping Instead of requiring callers to list which widgets they want (which agents misused by listing all of them), the CLI now automatically skips schema-driven widgets when their required flags are omitted. Omit --sort-by-replicas to skip SortBy, omit --refinement-list-attribute to skip RefinementList. Hits still requires --hits-title. Introduces a widget registry with per-widget generators and schema checks, a coverage test that verifies every react-instantsearch widget is either supported or explicitly marked unsupported, and inlines the former instantsearch-shared types into the CLI package. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Split CLI runtime concerns into focused helpers, add reportable manifest validation, harden generated code escaping, and preflight init file conflicts before package installation.
…atures rename Replace `add experience` and `add widget` with a single `add` command inspired by shadcn's CLI. `add search` scaffolds a composite feature, `add refinement-list search` adds a widget to an existing feature. - Rename manifest key from `experiences` to `features` - Generate a shared `AlgoliaProvider` at init (no indexName) - Features use `<Index>` wrapper instead of per-feature provider - Remove SearchBox from search template (preparing for autocomplete) - Remove per-feature provider.tsx generation - Update README, skill, and all tests Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The search template now generates an autocomplete component alongside the search feature widgets. The autocomplete uses EXPERIMENTAL_Autocomplete from react-instantsearch, wired to the feature's index with a default item template based on the hits schema. If an autocomplete already exists (e.g., from a previous add search), it is left untouched. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Security | 88 critical 11 high |
🟢 Metrics 636 complexity · 142 duplication
Metric Results Complexity 636 Duplication 142
TIP This summary will be updated as you push new changes.
More templates
algoliasearch-helper
instantsearch-ui-components
instantsearch.css
instantsearch.js
react-instantsearch
react-instantsearch-core
react-instantsearch-nextjs
react-instantsearch-router-nextjs
vue-instantsearch
commit: |
- Add InstantSearch CLI pitch document for internal stakeholders - Add skill distribution plan (node_modules + GitHub fallback) - Update agent skill: Autocomplete replaces SearchBox, preserve <Index> wrapper, don't start dev server, use classNames where available Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Drop instantsearch.config.json — it tracked widget lists and schema that drifted from hand-edited code. Move indexName to the feature entry in the root instantsearch.json manifest, which is the only piece the CLI actually needs when adding widgets to existing features. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…erated features Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…complete Defaults to autocomplete (current behavior). Pass --input searchbox to include a SearchBox widget instead and skip autocomplete generation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
This is a POC, do not review.