@algolia/wizard 0.8.0-rc.62.50 → 0.8.0-rc.63.52

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
@@ -907,7 +907,7 @@ var accessItems = [
907
907
  {
908
908
  tag: "READ",
909
909
  title: "Project files",
910
- description: "reads your dependency manifests (package.json, pyproject.toml, Gemfile\u2026), configs & source to detect your stack. Read-only; nothing is uploaded."
910
+ description: "reads your dependency manifests (package.json, pyproject.toml, Gemfile, go.mod\u2026), configs & source to detect your stack. Read-only; nothing is uploaded."
911
911
  },
912
912
  {
913
913
  tag: "WRITE",
@@ -2206,6 +2206,7 @@ function shellQuote(value) {
2206
2206
  // src/lib/languages.ts
2207
2207
  var ENTRYPOINT_TOKEN = "{entrypoint}";
2208
2208
  var INGEST_DIR = ".algolia-wizard";
2209
+ var VISIBLE_INGEST_DIR = "algolia-wizard";
2209
2210
  var PY_VENV = `${INGEST_DIR}/.venv`;
2210
2211
  var PY_VENV_PYTHON = `${PY_VENV}/bin/python`;
2211
2212
  var PY_REQUIREMENTS = `${INGEST_DIR}/requirements.txt`;
@@ -2396,6 +2397,38 @@ var LANGUAGE_PROFILES = {
2396
2397
  verification: [],
2397
2398
  envReadInstruction: "Read them from `getenv('NAME')`.",
2398
2399
  skipDirs: ["vendor", "node_modules"]
2400
+ },
2401
+ go: {
2402
+ id: "go",
2403
+ displayName: "Go",
2404
+ aliases: ["go", "golang"],
2405
+ manifests: ["go.mod"],
2406
+ packageManagers: [
2407
+ {
2408
+ id: "gomod",
2409
+ // Imports in the generated file are the declaration; `go mod tidy`
2410
+ // resolves and fetches them — which only works because the script lives
2411
+ // outside INGEST_DIR (see VISIBLE_INGEST_DIR).
2412
+ dependency: { mode: "code-imports" },
2413
+ installSteps: [{ argv: ["go", "mod", "tidy"] }],
2414
+ ingest: {
2415
+ kind: "auto",
2416
+ argv: ["go", "run", ENTRYPOINT_TOKEN],
2417
+ entrypointExtensions: [".go"]
2418
+ }
2419
+ }
2420
+ ],
2421
+ sdk: {
2422
+ packageName: "github.com/algolia/algoliasearch-client-go/v4",
2423
+ versionPin: "v4",
2424
+ docKey: "go"
2425
+ },
2426
+ ingestEntrypointExample: `${VISIBLE_INGEST_DIR}/ingest.go`,
2427
+ verification: [
2428
+ { label: "go vet", argv: ["go", "vet", "./..."], requiresFile: "go.mod" }
2429
+ ],
2430
+ envReadInstruction: "Read them from `os.Getenv`.",
2431
+ skipDirs: ["vendor", "bin"]
2399
2432
  }
2400
2433
  };
2401
2434
  var DEFAULT_LANGUAGE_ID = "javascript";
@@ -3078,7 +3111,7 @@ var detectLanguageSchema = z16.object({
3078
3111
  var detectLanguage = () => runAgent({
3079
3112
  instructions: [
3080
3113
  "Analyze the codebase and determine the programming languages and frameworks used",
3081
- "Start from the dependency manifests: package.json, pyproject.toml, requirements.txt, Gemfile, composer.json.",
3114
+ "Start from the dependency manifests: package.json, pyproject.toml, requirements.txt, Gemfile, composer.json, go.mod.",
3082
3115
  "List the language that owns the backend/data code first \u2014 that is the one an ingestion script will be written in.",
3083
3116
  "If a superset language is found, exclude the subset language. TS-over-JS.",
3084
3117
  "If a meta-framework is used, exclude the framework. Next-over-React.",
@@ -3131,7 +3164,7 @@ var MODE_CONFIG = {
3131
3164
  "Analyze the codebase to find the data entities (models) that should be ingested into Algolia.",
3132
3165
  "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).",
3133
3166
  "Inspect the source of each entity to extract real field names for attributes \u2014 do not guess or leave attributes empty.",
3134
- "Entities live wherever the stack keeps them: TypeScript interfaces or a Prisma schema, Django models.py, Rails app/models, Laravel Eloquent models, Pydantic models.",
3167
+ "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.",
3135
3168
  "Prefer domain models (e.g. Document, Product, User) over framework or infrastructure types.",
3136
3169
  "Use as few tools as possible, but do not guess. If you cannot find any entities, return an empty array.",
3137
3170
  "Ignore directories that may be related to testing, like `/fixtures`, `/tests`, etc",
@@ -3154,7 +3187,7 @@ var MODE_CONFIG = {
3154
3187
  verification: {
3155
3188
  instructions: [
3156
3189
  "Analyze the codebase to determine which code-quality tools are available to validate changes.",
3157
- "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).",
3190
+ "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.",
3158
3191
  'Return the tool names as an array, e.g. ["eslint", "prettier", "tsc"] or ["ruff", "mypy"].',
3159
3192
  "Use as few tools as possible, but do not guess. If you cannot find any, return an empty array.",
3160
3193
  "Ignore directories that may be related to testing, like `/fixtures`, `/tests`, etc",
@@ -3182,7 +3215,7 @@ async function runAnalysis(mode, extraInstructions = []) {
3182
3215
  // package.json
3183
3216
  var package_default = {
3184
3217
  name: "@algolia/wizard",
3185
- version: "0.8.0-rc.62.50",
3218
+ version: "0.8.0-rc.63.52",
3186
3219
  description: "Magically implement Algolia functionality in your codebase",
3187
3220
  type: "module",
3188
3221
  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.8.0-rc.62.50",
3
+ "version": "0.8.0-rc.63.52",
4
4
  "description": "Magically implement Algolia functionality in your codebase",
5
5
  "type": "module",
6
6
  "engines": {