Skip to content

feat: add CompositionClient to cli and bump SDK to v4.38.0#215

Open
ben-kalmus wants to merge 1 commit intoalgolia:mainfrom
ben-kalmus:feat/compositions
Open

feat: add CompositionClient to cli and bump SDK to v4.38.0#215
ben-kalmus wants to merge 1 commit intoalgolia:mainfrom
ben-kalmus:feat/compositions

Conversation

@ben-kalmus
Copy link
Copy Markdown

@ben-kalmus ben-kalmus commented May 8, 2026

Summary

  • Adds a new compositions command group to the Algolia CLI covering the full management lifecycle for Algolia Compositions (https://www.algolia.com/doc/rest-api/composition/).

  • This also bumps the Algolia Go SDK from v4.35.0 to v4.38.0 to pick up the composition package.

Commands added

Composition management:

algolia compositions list
algolia compositions get <composition-id>
algolia compositions upsert <composition-id> --file body.json
algolia compositions delete <composition-id>
algolia compositions search <composition-id> <query>

Composition rule management:

algolia compositions rules list <composition-id>
algolia compositions rules get <composition-id> <rule-id>
algolia compositions rules upsert <composition-id> <rule-id> --file rule.json
algolia compositions rules delete <composition-id> <rule-id>

Design notes

  • All write operations (upsert, delete) always wait for the task to reach published status before returning. There is no --wait flag unlike indices command group.
  • Delete commands prompt for confirmation unless --confirm/-y is passed.
  • ACLs are enforced: read commands require search, write commands require editSettings.

Changes

  • go.mod / go.sum: Bump algoliasearch-client-go/v4 to v4.38.0
  • pkg/cmdutil/factory.go: Add CompositionClient field
  • pkg/cmd/factory/default.go: Implement compositionClient() factory function
  • pkg/cmd/root/root.go: Register NewCompositionsCmd
  • pkg/cmd/compositions/: New command group

Tests

Each command has a unit test file covering:

  • Happy path with exact JSON output assertion
  • Missing required argument(s) - verifies descriptive error message
  • For upsert commands: missing --file flag, invalid JSON input
  • For delete commands: confirmation required

End to end test script:
e2e/testscripts/compositions/compositions.txtar

@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 8, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 134 complexity · 151 duplication

Metric Results
Complexity 134
Duplication 151

View in Codacy

TIP This summary will be updated as you push new changes.

@ben-kalmus ben-kalmus force-pushed the feat/compositions branch from 5e25461 to 9c9f982 Compare May 8, 2026 13:33
@ben-kalmus ben-kalmus marked this pull request as ready for review May 8, 2026 13:34
@ben-kalmus ben-kalmus force-pushed the feat/compositions branch from 9c9f982 to 34d611e Compare May 8, 2026 15:48
@ben-kalmus ben-kalmus force-pushed the feat/compositions branch from 34d611e to 44670b1 Compare May 8, 2026 16:02
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.

1 participant