glirastes 0.3.1 → 0.3.2

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/CHANGELOG.md CHANGED
@@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.2] - 2026-04-29
11
+
12
+ ### Changed
13
+
14
+ - Documentation pass that makes the **CLI codegen step explicit as a
15
+ required part of the Next.js setup** for any non-trivial app. The
16
+ earlier framing implied codegen was only "for scaling up" — in
17
+ practice the manual `endpointToolsToRegistry([…])` import list breaks
18
+ down past a handful of tools, and codegen is the canonical wiring.
19
+ - README quickstart Step 4 now points readers at the codegen workflow
20
+ immediately after the demo manual-import example.
21
+ - The "Scaling up" section is renamed to **"Scaling up — required
22
+ codegen workflow for Next.js"** and explicitly states NestJS users
23
+ skip it (runtime DI scan handles aggregation).
24
+ - The `integrating-glirastes-nextjs` and `maintaining-glirastes-tools`
25
+ skills mirror the same framing so coding agents pick the codegen
26
+ path by default for non-trivial apps.
27
+ - Forward-looking note in README and skills: a `buildToolRegistry`
28
+ helper based on `import.meta.glob` / `require.context` is planned
29
+ for **0.4.0** and will let Next.js consumers skip the codegen step.
30
+
31
+ No code changes — patch-level docs release.
32
+
10
33
  ## [0.3.1] - 2026-04-28
11
34
 
12
35
  ### Added
package/README.md CHANGED
@@ -14,7 +14,7 @@
14
14
  <a href="#core-concepts"><strong>Concepts</strong></a> ·
15
15
  <a href="#examples"><strong>Examples</strong></a> ·
16
16
  <a href="#advanced"><strong>Advanced</strong></a> ·
17
- <a href="#scaling-up--codegen-workflow"><strong>Scaling up</strong></a> ·
17
+ <a href="#scaling-up--required-codegen-workflow-for-nextjs"><strong>Scaling up</strong></a> ·
18
18
  <a href="#cli"><strong>CLI</strong></a> ·
19
19
  <a href="#agent-skills"><strong>Skills</strong></a>
20
20
  </p>
@@ -246,6 +246,10 @@ const registry = endpointToolsToRegistry(scan.tools);
246
246
 
247
247
  Done. AI chat is live, streaming, and your `list_tasks` tool is callable. Add more tools the same way — pick the style that matches your stack. See [NestJS with decorators](#nestjs-with-decorators) below for DTOs, `@AiParam`, and multi-controller scanning.
248
248
 
249
+ > **One more step for Next.js once you have more than a handful of tools.** The manual `endpointToolsToRegistry([listTasks, …])` import list above stops scaling around 5–10 tools. Today's required pattern: write each tool in a co-located `*.ai-tool.ts` file and run the CLI codegen as a `predev` / `prebuild` hook to aggregate them into a generated registry your chat route imports. See [Scaling up — required codegen workflow for Next.js](#scaling-up--required-codegen-workflow-for-nextjs) below for the full setup. **NestJS users skip this entirely** — the runtime decorator scan handles aggregation automatically.
250
+ >
251
+ > *Coming in 0.4.0:* a `buildToolRegistry` helper backed by `import.meta.glob` / `require.context` that drops the codegen step for Next.js too. Track at [chainmatics/glirastes#issues](https://github.com/chainmatics/glirastes/issues).
252
+
249
253
  ### Setup notes
250
254
 
251
255
  #### tsconfig — modern is best, legacy still works
@@ -772,9 +776,13 @@ The voice button streams audio to your backend, which proxies it to a speech-to-
772
776
 
773
777
  <br/>
774
778
 
775
- ## Scaling up — codegen workflow
779
+ ## Scaling up — required codegen workflow for Next.js
776
780
 
777
- Hand-importing 50 tool definitions into your chat route doesn't scale. The CLI generates a registry from co-located `*.ai-tool.ts` files so you can stay co-located while still wiring everything centrally.
781
+ Hand-importing every tool definition into your chat route doesn't scale past a handful. **In Glirastes 0.3.x the canonical pattern for Next.js consumers is to run the CLI codegen as a build hook** — it generates a registry from co-located `*.ai-tool.ts` files. The chat route imports the generated registry instead of maintaining a manual import list.
782
+
783
+ > NestJS users **skip this section entirely.** `AiChatModule.forRoot()` discovers `@AiTool`-decorated controllers at runtime via the NestJS `DiscoveryService` — no codegen step is ever needed.
784
+ >
785
+ > **Coming in 0.4.0:** a `buildToolRegistry` helper based on `import.meta.glob` / `require.context` will let Next.js consumers skip the codegen step too. Until then the steps below are required for any non-trivial Next.js app.
778
786
 
779
787
  ### 1. Bootstrap a tool from an existing route
780
788
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glirastes",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Official Chainmatics SDK for building AI-powered chat, tools, and agent systems. Part of the Glirastes platform.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -129,7 +129,7 @@ Edit `description` (the LLM reads this to decide when to call the tool), refine
129
129
 
130
130
  Two paths depending on tool count:
131
131
 
132
- ### Few tools — manual import
132
+ ### Few tools (≤5) — manual import
133
133
 
134
134
  ```ts
135
135
  // src/app/api/chat/route.ts
@@ -145,9 +145,11 @@ export const POST = createAiChatHandler({
145
145
  });
146
146
  ```
147
147
 
148
- ### Many tools — codegen pipeline
148
+ OK as a starting point. The moment you go past a handful of tools, switch to the codegen pipeline below — manual maintenance of the import list breaks down fast.
149
149
 
150
- Add to `package.json`:
150
+ ### Production: codegen pipeline (required for non-trivial apps)
151
+
152
+ In Glirastes 0.3.x **the canonical Next.js setup is to wire the codegen as a build hook**. Add to `package.json`:
151
153
 
152
154
  ```json
153
155
  {
@@ -163,6 +165,10 @@ Add to `package.json`:
163
165
  }
164
166
  ```
165
167
 
168
+ The `predev` and `prebuild` hooks regenerate the registry on every dev server start and CI build, so the generated files stay in sync with your `*.ai-tool.ts` source-of-truth. Without these hooks the chat route imports would point at stale generated output.
169
+
170
+ > **Coming in 0.4.0:** `buildToolRegistry` based on `import.meta.glob` / `require.context` will let you skip the codegen step and the build hook entirely. Until then, the codegen pipeline is the supported pattern for any non-trivial Next.js app.
171
+
166
172
  Then import the generated registry instead of individual tools:
167
173
 
168
174
  ```ts
@@ -242,9 +242,13 @@ const moduleMeta: Record<string, ModuleMeta> = {
242
242
  };
243
243
  ```
244
244
 
245
- ## Codegen pipeline — scale to 50+ tools
245
+ ## Codegen pipeline — required for Next.js, not for NestJS
246
246
 
247
- Hand-importing every tool into the chat route doesn't scale. The CLI generates a registry from co-located `ai-tool.ts` files.
247
+ Hand-importing every tool into the chat route doesn't scale past a handful. In Glirastes 0.3.x **Next.js consumers run the CLI codegen as a build hook** — the generated registry is the canonical wiring, the manual import list shown in the quickstart is only OK for tiny demos.
248
+
249
+ > **NestJS users skip this entire section.** `AiChatModule.forRoot()` discovers `@AiTool`-decorated controllers at runtime via the NestJS `DiscoveryService`. There is no codegen step at all on the NestJS path — runtime DI scan is the equivalent.
250
+ >
251
+ > **Coming in 0.4.0:** a `buildToolRegistry` helper backed by `import.meta.glob` / `require.context` will let Next.js consumers also skip the codegen step. Until then the steps below describe the supported pattern.
248
252
 
249
253
  ### Recommended `package.json` scripts
250
254