@algolia/wizard 0.9.0-rc.77.67 → 0.9.0-rc.78.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -1003,7 +1003,7 @@ var accessItems = [
1003
1003
  {
1004
1004
  tag: "READ",
1005
1005
  title: "Project files",
1006
- description: "reads your dependency manifests (package.json, pyproject.toml, Gemfile\u2026), configs & source to detect your stack. Read-only; nothing is uploaded."
1006
+ description: "reads your dependency manifests (package.json, pyproject.toml, Gemfile, go.mod\u2026), configs & source to detect your stack. Read-only; nothing is uploaded."
1007
1007
  },
1008
1008
  {
1009
1009
  tag: "WRITE",
@@ -2266,6 +2266,7 @@ function shellQuote(value) {
2266
2266
  // src/lib/languages.ts
2267
2267
  var ENTRYPOINT_TOKEN = "{entrypoint}";
2268
2268
  var INGEST_DIR = ".algolia-wizard";
2269
+ var VISIBLE_INGEST_DIR = "algolia-wizard";
2269
2270
  var PY_VENV = `${INGEST_DIR}/.venv`;
2270
2271
  var PY_VENV_PYTHON = `${PY_VENV}/bin/python`;
2271
2272
  var PY_REQUIREMENTS = `${INGEST_DIR}/requirements.txt`;
@@ -2456,6 +2457,38 @@ var LANGUAGE_PROFILES = {
2456
2457
  verification: [],
2457
2458
  envReadInstruction: "Read them from `getenv('NAME')`.",
2458
2459
  skipDirs: ["vendor", "node_modules"]
2460
+ },
2461
+ go: {
2462
+ id: "go",
2463
+ displayName: "Go",
2464
+ aliases: ["go", "golang"],
2465
+ manifests: ["go.mod"],
2466
+ packageManagers: [
2467
+ {
2468
+ id: "gomod",
2469
+ // Imports in the generated file are the declaration; `go mod tidy`
2470
+ // resolves and fetches them — which only works because the script lives
2471
+ // outside INGEST_DIR (see VISIBLE_INGEST_DIR).
2472
+ dependency: { mode: "code-imports" },
2473
+ installSteps: [{ argv: ["go", "mod", "tidy"] }],
2474
+ ingest: {
2475
+ kind: "auto",
2476
+ argv: ["go", "run", ENTRYPOINT_TOKEN],
2477
+ entrypointExtensions: [".go"]
2478
+ }
2479
+ }
2480
+ ],
2481
+ sdk: {
2482
+ packageName: "github.com/algolia/algoliasearch-client-go/v4",
2483
+ versionPin: "v4",
2484
+ docKey: "go"
2485
+ },
2486
+ ingestEntrypointExample: `${VISIBLE_INGEST_DIR}/ingest.go`,
2487
+ verification: [
2488
+ { label: "go vet", argv: ["go", "vet", "./..."], requiresFile: "go.mod" }
2489
+ ],
2490
+ envReadInstruction: "Read them from `os.Getenv`.",
2491
+ skipDirs: ["vendor", "bin"]
2459
2492
  }
2460
2493
  };
2461
2494
  var DEFAULT_LANGUAGE_ID = "javascript";
@@ -3138,7 +3171,7 @@ var detectLanguageSchema = z16.object({
3138
3171
  var detectLanguage = () => runAgent({
3139
3172
  instructions: [
3140
3173
  "Analyze the codebase and determine the programming languages and frameworks used",
3141
- "Start from the dependency manifests: package.json, pyproject.toml, requirements.txt, Gemfile, composer.json.",
3174
+ "Start from the dependency manifests: package.json, pyproject.toml, requirements.txt, Gemfile, composer.json, go.mod.",
3142
3175
  "List the language that owns the backend/data code first \u2014 that is the one an ingestion script will be written in.",
3143
3176
  "If a superset language is found, exclude the subset language. TS-over-JS.",
3144
3177
  "If a meta-framework is used, exclude the framework. Next-over-React.",
@@ -3191,7 +3224,7 @@ var MODE_CONFIG = {
3191
3224
  "Analyze the codebase to find the data entities (models) that should be ingested into Algolia.",
3192
3225
  "For each entity, return its name, the file path(s) where it is defined, and its indexable attribute keys (the fields a user would search or filter on).",
3193
3226
  "Inspect the source of each entity to extract real field names for attributes \u2014 do not guess or leave attributes empty.",
3194
- "Entities live wherever the stack keeps them: TypeScript interfaces or a Prisma schema, Django models.py, Rails app/models, Laravel Eloquent models, Pydantic models.",
3227
+ "Entities live wherever the stack keeps them: TypeScript interfaces or a Prisma schema, Django models.py, Rails app/models, Laravel Eloquent models, Go structs, Pydantic models.",
3195
3228
  "Prefer domain models (e.g. Document, Product, User) over framework or infrastructure types.",
3196
3229
  "Use as few tools as possible, but do not guess. If you cannot find any entities, return an empty array.",
3197
3230
  "Ignore directories that may be related to testing, like `/fixtures`, `/tests`, etc",
@@ -3214,7 +3247,7 @@ var MODE_CONFIG = {
3214
3247
  verification: {
3215
3248
  instructions: [
3216
3249
  "Analyze the codebase to determine which code-quality tools are available to validate changes.",
3217
- "Look at the dependency manifest and config files for the project's languages: package.json scripts with tsconfig/eslint/prettier, pyproject.toml or setup.cfg (ruff, mypy, black), Gemfile with .rubocop.yml, composer.json scripts (phpstan, pint).",
3250
+ "Look at the dependency manifest and config files for the project's languages: package.json scripts with tsconfig/eslint/prettier, pyproject.toml or setup.cfg (ruff, mypy, black), Gemfile with .rubocop.yml, composer.json scripts (phpstan, pint), go.mod with a golangci-lint config.",
3218
3251
  'Return the tool names as an array, e.g. ["eslint", "prettier", "tsc"] or ["ruff", "mypy"].',
3219
3252
  "Use as few tools as possible, but do not guess. If you cannot find any, return an empty array.",
3220
3253
  "Ignore directories that may be related to testing, like `/fixtures`, `/tests`, etc",
@@ -3242,7 +3275,7 @@ async function runAnalysis(mode, extraInstructions = []) {
3242
3275
  // package.json
3243
3276
  var package_default = {
3244
3277
  name: "@algolia/wizard",
3245
- version: "0.9.0-rc.77.67",
3278
+ version: "0.9.0-rc.78.68",
3246
3279
  description: "Magically implement Algolia functionality in your codebase",
3247
3280
  type: "module",
3248
3281
  engines: {
@@ -19,6 +19,7 @@ Install the latest stable within the major; never pin an exact patch.
19
19
  | Python | `algoliasearch` | `>=4,<5` |
20
20
  | Ruby | `algolia` | `~> 3.0` |
21
21
  | PHP | `algolia/algoliasearch-client-php` | `^4` |
22
+ | Go | `github.com/algolia/algoliasearch-client-go/v4` | `v4` |
22
23
 
23
24
  ## Search UI
24
25
 
@@ -0,0 +1,62 @@
1
+ # Save records (algoliasearch-client-go v4)
2
+
3
+ Adds records to an index. Write op — use a **write key**, server-side only.
4
+
5
+ Imports are the dependency declaration; `go mod tidy` resolves
6
+ `github.com/algolia/algoliasearch-client-go/v4`. Standalone `package main` file,
7
+ run with `go run`. Nothing panics on its own — every call returns `(value, error)`.
8
+
9
+ ```go
10
+ package main
11
+
12
+ import (
13
+ "fmt"
14
+ "os"
15
+
16
+ "github.com/algolia/algoliasearch-client-go/v4/algolia/search"
17
+ )
18
+
19
+ func main() {
20
+ client, err := search.NewClient(os.Getenv("ALGOLIA_APPLICATION_ID"), os.Getenv("ALGOLIA_WRITE_API_KEY"))
21
+ if err != nil {
22
+ panic(err) // NewClient fails on an empty/invalid app ID or key
23
+ }
24
+
25
+ indexName := "products"
26
+ records := []map[string]any{{"objectID": "1", "name": "Hot 100"}}
27
+
28
+ if _, err := client.SaveObjects(indexName, records, search.WithWaitForTasks(true)); err != nil {
29
+ panic(err)
30
+ }
31
+
32
+ fmt.Printf("ALGOLIA_WIZARD_RECORD_COUNT=%d\n", len(records))
33
+ }
34
+ ```
35
+
36
+ ```go
37
+ func (c *APIClient) SaveObjects(
38
+ indexName string,
39
+ objects []map[string]any, // maps only, each with an "objectID"
40
+ opts ...ChunkedBatchOption, // search.WithWaitForTasks(bool), search.WithBatchSize(int) (default 1000)
41
+ ) ([]BatchResponse, error) // BatchResponse{ TaskID int64; ObjectIDs []string }
42
+ ```
43
+
44
+ One `BatchResponse` per batch of 1,000, not per record — `len(res)` is the batch count.
45
+
46
+ Read records from a JSON file:
47
+
48
+ ```go
49
+ import "encoding/json"
50
+
51
+ content, err := os.ReadFile("records.json")
52
+ if err != nil {
53
+ panic(err)
54
+ }
55
+ var records []map[string]any
56
+ if err := json.Unmarshal(content, &records); err != nil {
57
+ panic(err)
58
+ }
59
+ ```
60
+
61
+ After a successful ingest print `ALGOLIA_WIZARD_RECORD_COUNT=<n>` (n = records
62
+ read, not `len(res)`) as the last stdout line, trailing newline included.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algolia/wizard",
3
- "version": "0.9.0-rc.77.67",
3
+ "version": "0.9.0-rc.78.68",
4
4
  "description": "Magically implement Algolia functionality in your codebase",
5
5
  "type": "module",
6
6
  "engines": {