Skip to content

Commit 79f1d9f

Browse files
authored
Merge pull request #6 from algolia/fix/algolia-cli-validated-against-real-cli
fix: validate algolia-cli skill against real CLI
2 parents 9265e81 + 3d14683 commit 79f1d9f

File tree

5 files changed

+538
-21
lines changed

5 files changed

+538
-21
lines changed

skills/algolia-cli/SKILL.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ Run `/algolia-cli:setup` to install the CLI and configure a profile, or follow [
8585
|----------------------------|---------------------------------------------------------------------|
8686
| Browse all records | `algolia objects browse <index>` |
8787
| Browse specific attributes | `algolia objects browse <index> --attributesToRetrieve title,price` |
88-
| Import records from file | `algolia objects import <index> -F data.ndjson -y` |
89-
| Import from stdin | `cat data.ndjson \| algolia objects import <index> -F - -y` |
88+
| Import records from file | `algolia objects import <index> -F data.ndjson` |
89+
| Import from stdin | `cat data.ndjson \| algolia objects import <index> -F -` |
9090
| Delete by IDs | `algolia objects delete <index> --object-ids id1,id2 -y` |
9191
| Delete by filter | `algolia objects delete <index> --filters "type:obsolete" -y` |
92-
| Partial update | `algolia objects update <index> -F updates.ndjson -y` |
92+
| Partial update | `algolia objects update <index> -F updates.ndjson` |
9393

9494
### Settings
9595

@@ -132,7 +132,7 @@ Choosing the right synonym type matters for search quality:
132132

133133
## Key Conventions
134134

135-
1. **Always use non-interactive mode.** Every command that writes, deletes, or modifies data needs `-y` (or `--confirm`) to skip confirmation prompts. This includes `objects import`, `objects delete`, `objects update`, `indices delete/clear/copy/move`, `rules import/delete`, `synonyms import/delete`, and `apikeys delete`. Without `-y`, the CLI will hang waiting for user input.
135+
1. **Always use non-interactive mode.** Destructive commands need `-y` (or `--confirm`) to skip confirmation prompts. This includes `objects delete`, `indices delete/clear/copy/move`, `rules import/delete`, `synonyms delete`, and `apikeys delete`. Without `-y`, the CLI will hang waiting for user input. Note: `objects import`, `objects update`, and `synonyms import` do **not** have a `-y` flag — they run non-interactively by default.
136136
2. **ndjson format.** `objects browse`, `objects import`, `rules browse/import`, and `synonyms browse/import` use newline-delimited JSON (one JSON object per line), **not** JSON arrays.
137137
3. **Profile flag.** Use `-p <profile>` to target a non-default profile. Omit it to use the default.
138138
4. **Credential precedence.** Environment variables override all other configuration. The resolution order is: **env vars** > **CLI flags** (`--application-id`, `--api-key`) > **profile config file** > **default profile**. Supported env vars: `ALGOLIA_APPLICATION_ID`, `ALGOLIA_API_KEY`, `ALGOLIA_ADMIN_API_KEY`, `ALGOLIA_SEARCH_HOSTS`, `ALGOLIA_CRAWLER_USER_ID`, `ALGOLIA_CRAWLER_API_KEY`. If env vars are set, `--profile`/`-p` is ignored for those credentials.
@@ -145,7 +145,7 @@ Choosing the right synonym type matters for search quality:
145145
### Migrate records between indices (with field filtering)
146146
```bash
147147
algolia objects browse SOURCE --attributesToRetrieve objectID,title,price \
148-
| algolia objects import DEST -F - -y -w
148+
| algolia objects import DEST -F - -w
149149
```
150150

151151
### Full index backup
@@ -159,10 +159,10 @@ Note: settings use `.json` (standard JSON), everything else uses `.ndjson` (newl
159159

160160
### Restore from backup
161161
```bash
162-
algolia objects import MY_INDEX -F my_index_records.ndjson -y -w
163-
algolia settings import MY_INDEX -F my_index_settings.json -y -w
162+
algolia objects import MY_INDEX -F my_index_records.ndjson -w
163+
algolia settings import MY_INDEX -F my_index_settings.json -w
164164
algolia rules import MY_INDEX -F my_index_rules.ndjson -c -y -w
165-
algolia synonyms import MY_INDEX -F my_index_synonyms.ndjson -r -y -w
165+
algolia synonyms import MY_INDEX -F my_index_synonyms.ndjson -r -w
166166
```
167167

168168
## Direct Invocation

skills/algolia-cli/evals/EVAL_RESULTS.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ The skill was evaluated across 3 realistic user scenarios, comparing **with-skil
2626
| Uses `--attributesToRetrieve` for field selection | FAIL | PASS | PASS |
2727
| Pipes browse to import with `-F -` | FAIL | PASS | PASS |
2828
| Uses `--attributesForFaceting` for category facet | PASS | PASS | PASS |
29-
| Includes `-y` flag on write commands | FAIL | FAIL | PASS |
29+
| Does NOT use `-y` on `objects import`/`settings set` (unsupported) | PASS | PASS | PASS |
3030
| Uses `-w` flag to sequence import before settings | FAIL | PASS | PASS |
3131

32-
**Key finding:** Without the skill, Claude exported all fields and filtered with `jq` instead of using `--attributesToRetrieve`. It also used intermediate files instead of piping. The v1→v2 improvement fixed the missing `-y` flag by adding it to the quick reference tables.
32+
**Key finding:** Without the skill, Claude exported all fields and filtered with `jq` instead of using `--attributesToRetrieve`. It also used intermediate files instead of piping. Note: `objects import` and `settings set` do not support `-y` — they run non-interactively by default.
3333

3434
### Eval 2: Synonyms and Rules
3535

@@ -66,7 +66,7 @@ The skill was evaluated across 3 realistic user scenarios, comparing **with-skil
6666
The biggest areas where the skill outperforms general knowledge:
6767

6868
1. **ndjson format awareness** — Knowing which commands use newline-delimited JSON vs standard JSON
69-
2. **Non-interactive flags**Consistently using `-y` to prevent CLI hangs
69+
2. **Non-interactive flags**Knowing which commands need `-y` (destructive ops like `delete`, `clear`, `copy`, `move`, `rules import`) and which don't (`objects import`, `objects update`, `synonyms import`)
7070
3. **Piping patterns** — Using `-F -` for stdin instead of intermediate files
7171
4. **Synonym type selection** — Choosing `oneWaySynonym` vs `synonym` based on user intent
7272
5. **Correct CLI commands** — Preventing hallucinated commands like `algolia rules save --rule`
@@ -86,7 +86,7 @@ Low recall is a systemic limitation — Claude is confident enough in its Algoli
8686

8787
## Improvements Made (v1 → v2)
8888

89-
1. **Added `-y` flag** to all write commands in quick reference tables
89+
1. **Corrected `-y` flag usage** — only on commands that actually support it (destructive operations), removed from `objects import`/`objects update`
9090
2. **New Synonym Type Guide** with decision rules for `synonym` vs `oneWaySynonym`
9191
3. **Expanded non-interactive convention** listing every command that needs `-y`
9292
4. **New Common Workflows section** (migrate, backup, restore patterns)

skills/algolia-cli/evals/evals.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"Uses 'algolia objects browse' with --attributesToRetrieve to select only title, price, and category",
1111
"Pipes the browse output to 'algolia objects import' using -F - for stdin",
1212
"Uses 'algolia settings set' with --attributesForFaceting to add 'category' as a facet",
13-
"Includes -y flag on commands that require confirmation",
13+
"Does NOT include -y flag on 'objects import' or 'settings set' (these commands do not support it)",
1414
"Uses -w (wait) flag on import before running the settings command, or chains them appropriately"
1515
]
1616
},

0 commit comments

Comments
 (0)