glirastes 0.3.0 → 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 +86 -0
- package/README.md +154 -9
- package/codegen/package.json +5 -0
- package/dist/cjs/codegen/asset-sync.d.ts +20 -0
- package/dist/cjs/codegen/asset-sync.js +28 -0
- package/dist/cjs/codegen/coverage.d.ts +66 -0
- package/dist/cjs/codegen/coverage.js +408 -0
- package/dist/cjs/codegen/endpoint-scanner.d.ts +16 -0
- package/dist/cjs/codegen/endpoint-scanner.js +197 -0
- package/dist/cjs/codegen/format.d.ts +17 -0
- package/dist/cjs/codegen/format.js +34 -0
- package/dist/cjs/codegen/fs-utils.d.ts +45 -0
- package/dist/cjs/codegen/fs-utils.js +165 -0
- package/dist/cjs/codegen/index.d.ts +13 -0
- package/dist/cjs/codegen/index.js +33 -0
- package/dist/cjs/codegen/mcp-generator.d.ts +50 -0
- package/dist/cjs/codegen/mcp-generator.js +803 -0
- package/dist/cjs/codegen/module-generator.d.ts +11 -0
- package/dist/cjs/codegen/module-generator.js +353 -0
- package/dist/cjs/codegen/nestjs-scanner.d.ts +43 -0
- package/dist/cjs/codegen/nestjs-scanner.js +241 -0
- package/dist/cjs/codegen/output-recommender.d.ts +23 -0
- package/dist/cjs/codegen/output-recommender.js +33 -0
- package/dist/cjs/codegen/scaffolder.d.ts +36 -0
- package/dist/cjs/codegen/scaffolder.js +262 -0
- package/dist/cjs/codegen/skill-generator.d.ts +49 -0
- package/dist/cjs/codegen/skill-generator.js +967 -0
- package/dist/cjs/codegen/types.d.ts +52 -0
- package/dist/cjs/codegen/types.js +16 -0
- package/dist/cjs/codegen/ui-scanner.d.ts +24 -0
- package/dist/cjs/codegen/ui-scanner.js +202 -0
- package/dist/cjs/codegen/validator.d.ts +35 -0
- package/dist/cjs/codegen/validator.js +292 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +23 -0
- package/dist/cjs/openapi/index.d.ts +78 -0
- package/dist/cjs/openapi/index.js +347 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/react/audio-worklet-processor.d.ts +16 -0
- package/dist/cjs/react/audio-worklet-processor.js +27 -0
- package/dist/cjs/react/bridges/rest-session-bridge.d.ts +113 -0
- package/dist/cjs/react/bridges/rest-session-bridge.js +209 -0
- package/dist/cjs/react/components/ai-chat-panel.d.ts +12 -0
- package/dist/cjs/react/components/ai-chat-panel.js +67 -0
- package/dist/cjs/react/components/ai-trigger-button.d.ts +2 -0
- package/dist/cjs/react/components/ai-trigger-button.js +239 -0
- package/dist/cjs/react/components/approval-card.d.ts +9 -0
- package/dist/cjs/react/components/approval-card.js +24 -0
- package/dist/cjs/react/components/bulk-approval-card.d.ts +9 -0
- package/dist/cjs/react/components/bulk-approval-card.js +36 -0
- package/dist/cjs/react/components/chat-input.d.ts +10 -0
- package/dist/cjs/react/components/chat-input.js +60 -0
- package/dist/cjs/react/components/chat-window.d.ts +2 -0
- package/dist/cjs/react/components/chat-window.js +134 -0
- package/dist/cjs/react/components/confirm-dialog.d.ts +32 -0
- package/dist/cjs/react/components/confirm-dialog.js +48 -0
- package/dist/cjs/react/components/floating-chat-ui.d.ts +90 -0
- package/dist/cjs/react/components/floating-chat-ui.js +163 -0
- package/dist/cjs/react/components/mention-chip.d.ts +16 -0
- package/dist/cjs/react/components/mention-chip.js +42 -0
- package/dist/cjs/react/components/mention-input.d.ts +8 -0
- package/dist/cjs/react/components/mention-input.js +117 -0
- package/dist/cjs/react/components/message-bubble.d.ts +11 -0
- package/dist/cjs/react/components/message-bubble.js +171 -0
- package/dist/cjs/react/components/message-list.d.ts +8 -0
- package/dist/cjs/react/components/message-list.js +52 -0
- package/dist/cjs/react/components/pipeline-timeline.d.ts +7 -0
- package/dist/cjs/react/components/pipeline-timeline.js +72 -0
- package/dist/cjs/react/components/recording-bar.d.ts +2 -0
- package/dist/cjs/react/components/recording-bar.js +81 -0
- package/dist/cjs/react/components/recording-controls.d.ts +18 -0
- package/dist/cjs/react/components/recording-controls.js +38 -0
- package/dist/cjs/react/components/rich-mention-input.d.ts +2 -0
- package/dist/cjs/react/components/rich-mention-input.js +571 -0
- package/dist/cjs/react/components/session-switcher.d.ts +14 -0
- package/dist/cjs/react/components/session-switcher.js +133 -0
- package/dist/cjs/react/components/suggestion-bar.d.ts +9 -0
- package/dist/cjs/react/components/suggestion-bar.js +47 -0
- package/dist/cjs/react/components/suggestion-chip.d.ts +9 -0
- package/dist/cjs/react/components/suggestion-chip.js +14 -0
- package/dist/cjs/react/components/voice-input-addon.d.ts +13 -0
- package/dist/cjs/react/components/voice-input-addon.js +31 -0
- package/dist/cjs/react/components/voice-input-button.d.ts +2 -0
- package/dist/cjs/react/components/voice-input-button.js +55 -0
- package/dist/cjs/react/components/wavesurfer-loader.d.ts +5 -0
- package/dist/cjs/react/components/wavesurfer-loader.js +36 -0
- package/dist/cjs/react/hooks/use-ai-chat.d.ts +22 -0
- package/dist/cjs/react/hooks/use-ai-chat.js +51 -0
- package/dist/cjs/react/hooks/use-approvals.d.ts +23 -0
- package/dist/cjs/react/hooks/use-approvals.js +63 -0
- package/dist/cjs/react/hooks/use-deepgram-transcription.d.ts +2 -0
- package/dist/cjs/react/hooks/use-deepgram-transcription.js +329 -0
- package/dist/cjs/react/hooks/use-drag-resize-panel.d.ts +48 -0
- package/dist/cjs/react/hooks/use-drag-resize-panel.js +308 -0
- package/dist/cjs/react/hooks/use-draggable-position.d.ts +25 -0
- package/dist/cjs/react/hooks/use-draggable-position.js +134 -0
- package/dist/cjs/react/hooks/use-keyboard-shortcut.d.ts +20 -0
- package/dist/cjs/react/hooks/use-keyboard-shortcut.js +93 -0
- package/dist/cjs/react/hooks/use-mentions.d.ts +23 -0
- package/dist/cjs/react/hooks/use-mentions.js +42 -0
- package/dist/cjs/react/hooks/use-suggestions.d.ts +22 -0
- package/dist/cjs/react/hooks/use-suggestions.js +39 -0
- package/dist/cjs/react/index.d.ts +43 -0
- package/dist/cjs/react/index.js +111 -0
- package/dist/cjs/react/provider/ai-chat-provider.d.ts +45 -0
- package/dist/cjs/react/provider/ai-chat-provider.js +1024 -0
- package/dist/cjs/react/provider/chat-context.d.ts +84 -0
- package/dist/cjs/react/provider/chat-context.js +13 -0
- package/dist/cjs/react/template.d.ts +84 -0
- package/dist/cjs/react/template.js +90 -0
- package/dist/cjs/react/themes.d.ts +24 -0
- package/dist/cjs/react/themes.js +273 -0
- package/dist/cjs/react/transports/langgraph/index.d.ts +2 -0
- package/dist/cjs/react/transports/langgraph/index.js +8 -0
- package/dist/cjs/react/transports/langgraph/langgraph-ai-chat.d.ts +62 -0
- package/dist/cjs/react/transports/langgraph/langgraph-ai-chat.js +94 -0
- package/dist/cjs/react/transports/langgraph.d.ts +71 -0
- package/dist/cjs/react/transports/langgraph.js +369 -0
- package/dist/cjs/react/transports/vercel/index.d.ts +2 -0
- package/dist/cjs/react/transports/vercel/index.js +8 -0
- package/dist/cjs/react/transports/vercel/vercel-ai-chat.d.ts +49 -0
- package/dist/cjs/react/transports/vercel/vercel-ai-chat.js +81 -0
- package/dist/cjs/react/transports/vercel.d.ts +30 -0
- package/dist/cjs/react/transports/vercel.js +69 -0
- package/dist/cjs/react/types.d.ts +760 -0
- package/dist/cjs/react/types.js +2 -0
- package/dist/cjs/react/ui.d.ts +73 -0
- package/dist/cjs/react/ui.js +183 -0
- package/dist/cjs/react/utils/create-approval-description.d.ts +53 -0
- package/dist/cjs/react/utils/create-approval-description.js +122 -0
- package/dist/cjs/react/utils/create-tool-result-handler.d.ts +90 -0
- package/dist/cjs/react/utils/create-tool-result-handler.js +168 -0
- package/dist/cjs/react/utils/mention-markup.d.ts +13 -0
- package/dist/cjs/react/utils/mention-markup.js +117 -0
- package/dist/cjs/react/utils/merge-pipeline-steps.d.ts +19 -0
- package/dist/cjs/react/utils/merge-pipeline-steps.js +81 -0
- package/dist/cjs/react/utils/sanitize-stored-messages.d.ts +23 -0
- package/dist/cjs/react/utils/sanitize-stored-messages.js +52 -0
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat-auth.guard.d.ts +10 -0
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat-auth.guard.js +42 -0
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat-module-options.interface.d.ts +32 -0
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat-module-options.interface.js +4 -0
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat.controller.d.ts +11 -0
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat.controller.js +80 -0
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat.module.d.ts +9 -0
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat.module.js +119 -0
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat.service.d.ts +13 -0
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat.service.js +131 -0
- package/dist/cjs/server/adapters/nestjs/chat/dto/ai-chat-request.dto.d.ts +7 -0
- package/dist/cjs/server/adapters/nestjs/chat/dto/ai-chat-request.dto.js +52 -0
- package/dist/cjs/server/adapters/nestjs/chat/dto/chat-message-part.dto.d.ts +19 -0
- package/dist/cjs/server/adapters/nestjs/chat/dto/chat-message-part.dto.js +108 -0
- package/dist/cjs/server/adapters/nestjs/chat/dto/chat-message.dto.d.ts +8 -0
- package/dist/cjs/server/adapters/nestjs/chat/dto/chat-message.dto.js +59 -0
- package/dist/cjs/server/adapters/nestjs/chat/dto/index.d.ts +3 -0
- package/dist/cjs/server/adapters/nestjs/chat/dto/index.js +9 -0
- package/dist/cjs/server/adapters/nestjs/chat/index.d.ts +3 -0
- package/dist/cjs/server/adapters/nestjs/chat/index.js +9 -0
- package/dist/cjs/server/adapters/nestjs/chat/speech-stream.gateway.d.ts +4 -0
- package/dist/cjs/server/adapters/nestjs/chat/speech-stream.gateway.js +73 -0
- package/dist/cjs/server/adapters/nestjs/chat/ws-loader.d.ts +5 -0
- package/dist/cjs/server/adapters/nestjs/chat/ws-loader.js +72 -0
- package/dist/cjs/server/adapters/nestjs/decorators/ai-module.decorator.d.ts +6 -0
- package/dist/cjs/server/adapters/nestjs/decorators/ai-module.decorator.js +13 -0
- package/dist/cjs/server/adapters/nestjs/decorators/ai-param.decorator.d.ts +5 -0
- package/dist/cjs/server/adapters/nestjs/decorators/ai-param.decorator.js +15 -0
- package/dist/cjs/server/adapters/nestjs/decorators/ai-tool.decorator.d.ts +6 -0
- package/dist/cjs/server/adapters/nestjs/decorators/ai-tool.decorator.js +22 -0
- package/dist/cjs/server/adapters/nestjs/decorators/constants.d.ts +4 -0
- package/dist/cjs/server/adapters/nestjs/decorators/constants.js +7 -0
- package/dist/cjs/server/adapters/nestjs/index.d.ts +14 -0
- package/dist/cjs/server/adapters/nestjs/index.js +42 -0
- package/dist/cjs/server/adapters/nestjs/metadata.d.ts +39 -0
- package/dist/cjs/server/adapters/nestjs/metadata.js +36 -0
- package/dist/cjs/server/adapters/nestjs/module/ai-tools-explorer.service.d.ts +36 -0
- package/dist/cjs/server/adapters/nestjs/module/ai-tools-explorer.service.js +159 -0
- package/dist/cjs/server/adapters/nestjs/module/ai-tools.module.d.ts +37 -0
- package/dist/cjs/server/adapters/nestjs/module/ai-tools.module.js +44 -0
- package/dist/cjs/server/adapters/nestjs/module/ai-tools.service.d.ts +28 -0
- package/dist/cjs/server/adapters/nestjs/module/ai-tools.service.js +41 -0
- package/dist/cjs/server/adapters/nestjs/scanner/nestjs-scanner.d.ts +16 -0
- package/dist/cjs/server/adapters/nestjs/scanner/nestjs-scanner.js +117 -0
- package/dist/cjs/server/adapters/nestjs/scanner/schema-builder.d.ts +26 -0
- package/dist/cjs/server/adapters/nestjs/scanner/schema-builder.js +259 -0
- package/dist/cjs/server/adapters/nestjs/swagger.d.ts +7 -0
- package/dist/cjs/server/adapters/nestjs/swagger.js +39 -0
- package/dist/cjs/server/adapters/nextjs/context-helpers.d.ts +22 -0
- package/dist/cjs/server/adapters/nextjs/context-helpers.js +60 -0
- package/dist/cjs/server/adapters/nextjs/create-ai-chat-handler.d.ts +94 -0
- package/dist/cjs/server/adapters/nextjs/create-ai-chat-handler.js +965 -0
- package/dist/cjs/server/adapters/nextjs/filter-fallback-error.d.ts +11 -0
- package/dist/cjs/server/adapters/nextjs/filter-fallback-error.js +41 -0
- package/dist/cjs/server/adapters/nextjs/index.d.ts +8 -0
- package/dist/cjs/server/adapters/nextjs/index.js +22 -0
- package/dist/cjs/server/adapters/nextjs/prepare-model-messages.d.ts +58 -0
- package/dist/cjs/server/adapters/nextjs/prepare-model-messages.js +114 -0
- package/dist/cjs/server/adapters/nextjs/sanitize-model-messages.d.ts +64 -0
- package/dist/cjs/server/adapters/nextjs/sanitize-model-messages.js +489 -0
- package/dist/cjs/server/adapters/nextjs/server-action-helper.d.ts +7 -0
- package/dist/cjs/server/adapters/nextjs/server-action-helper.js +40 -0
- package/dist/cjs/server/adapters/nextjs/types.d.ts +246 -0
- package/dist/cjs/server/adapters/nextjs/types.js +2 -0
- package/dist/cjs/server/adapters/nextjs/with-ai-tool.d.ts +9 -0
- package/dist/cjs/server/adapters/nextjs/with-ai-tool.js +12 -0
- package/dist/cjs/server/core/followup-tool.d.ts +9 -0
- package/dist/cjs/server/core/followup-tool.js +82 -0
- package/dist/cjs/server/core/index.d.ts +139 -0
- package/dist/cjs/server/core/index.js +818 -0
- package/dist/cjs/server/core/intent-classifier.d.ts +94 -0
- package/dist/cjs/server/core/intent-classifier.js +324 -0
- package/dist/cjs/server/core/model-selector.d.ts +12 -0
- package/dist/cjs/server/core/model-selector.js +48 -0
- package/dist/cjs/server/core/module-router.d.ts +14 -0
- package/dist/cjs/server/core/module-router.js +110 -0
- package/dist/cjs/server/core/zod-compact.d.ts +18 -0
- package/dist/cjs/server/core/zod-compact.js +129 -0
- package/dist/cjs/server/index.d.ts +6 -0
- package/dist/cjs/server/index.js +28 -0
- package/dist/cjs/server/lancer/cache.d.ts +9 -0
- package/dist/cjs/server/lancer/cache.js +33 -0
- package/dist/cjs/server/lancer/client.d.ts +2 -0
- package/dist/cjs/server/lancer/client.js +279 -0
- package/dist/cjs/server/lancer/errors.d.ts +13 -0
- package/dist/cjs/server/lancer/errors.js +21 -0
- package/dist/cjs/server/lancer/index.d.ts +3 -0
- package/dist/cjs/server/lancer/index.js +7 -0
- package/dist/cjs/server/lancer/telemetry-buffer.d.ts +15 -0
- package/dist/cjs/server/lancer/telemetry-buffer.js +64 -0
- package/dist/cjs/server/lancer/types.d.ts +201 -0
- package/dist/cjs/server/lancer/types.js +5 -0
- package/dist/cjs/server/pii-shield/aegis-detector.d.ts +26 -0
- package/dist/cjs/server/pii-shield/aegis-detector.js +26 -0
- package/dist/cjs/server/pii-shield/create-pii-shield.d.ts +2 -0
- package/dist/cjs/server/pii-shield/create-pii-shield.js +191 -0
- package/dist/cjs/server/pii-shield/deep-walk.d.ts +1 -0
- package/dist/cjs/server/pii-shield/deep-walk.js +19 -0
- package/dist/cjs/server/pii-shield/fake-data.d.ts +5 -0
- package/dist/cjs/server/pii-shield/fake-data.js +170 -0
- package/dist/cjs/server/pii-shield/index.d.ts +4 -0
- package/dist/cjs/server/pii-shield/index.js +9 -0
- package/dist/cjs/server/pii-shield/leakage.d.ts +1 -0
- package/dist/cjs/server/pii-shield/leakage.js +15 -0
- package/dist/cjs/server/pii-shield/session-mapping.d.ts +12 -0
- package/dist/cjs/server/pii-shield/session-mapping.js +70 -0
- package/dist/cjs/server/pipeline.d.ts +26 -0
- package/dist/cjs/server/pipeline.js +127 -0
- package/dist/cjs/server/testing/approvals.d.ts +11 -0
- package/dist/cjs/server/testing/approvals.js +41 -0
- package/dist/cjs/server/testing/combination.d.ts +3 -0
- package/dist/cjs/server/testing/combination.js +83 -0
- package/dist/cjs/server/testing/create-test-suite.d.ts +29 -0
- package/dist/cjs/server/testing/create-test-suite.js +81 -0
- package/dist/cjs/server/testing/edge-cases.d.ts +8 -0
- package/dist/cjs/server/testing/edge-cases.js +277 -0
- package/dist/cjs/server/testing/guardrails.d.ts +14 -0
- package/dist/cjs/server/testing/guardrails.js +152 -0
- package/dist/cjs/server/testing/helpers.d.ts +14 -0
- package/dist/cjs/server/testing/helpers.js +119 -0
- package/dist/cjs/server/testing/index.d.ts +12 -0
- package/dist/cjs/server/testing/index.js +37 -0
- package/dist/cjs/server/testing/mock-executor.d.ts +8 -0
- package/dist/cjs/server/testing/mock-executor.js +40 -0
- package/dist/cjs/server/testing/regression.d.ts +7 -0
- package/dist/cjs/server/testing/regression.js +27 -0
- package/dist/cjs/server/testing/routing.d.ts +12 -0
- package/dist/cjs/server/testing/routing.js +63 -0
- package/dist/cjs/server/testing/schema-consistency.d.ts +6 -0
- package/dist/cjs/server/testing/schema-consistency.js +56 -0
- package/dist/cjs/server/testing/smoke.d.ts +11 -0
- package/dist/cjs/server/testing/smoke.js +64 -0
- package/dist/cjs/server/testing/types.d.ts +156 -0
- package/dist/cjs/server/testing/types.js +2 -0
- package/dist/cjs/types.d.ts +696 -0
- package/dist/cjs/types.js +91 -0
- package/dist/cli/commands/install-skills.d.ts +17 -0
- package/dist/cli/commands/install-skills.js +185 -0
- package/dist/cli/commands/install-skills.js.map +1 -0
- package/dist/cli/index.js +25 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/react/components/ai-trigger-button.js +4 -6
- package/dist/react/components/ai-trigger-button.js.map +1 -1
- package/dist/react/components/recording-bar.js +4 -6
- package/dist/react/components/recording-bar.js.map +1 -1
- package/dist/react/components/wavesurfer-loader.d.ts +5 -0
- package/dist/react/components/wavesurfer-loader.js +34 -0
- package/dist/react/components/wavesurfer-loader.js.map +1 -0
- package/dist/server/adapters/nestjs/chat/ai-chat.module.d.ts +1 -1
- package/dist/server/adapters/nestjs/chat/ai-chat.module.js +3 -2
- package/dist/server/adapters/nestjs/chat/ai-chat.module.js.map +1 -1
- package/dist/server/adapters/nestjs/chat/speech-stream.gateway.d.ts +1 -1
- package/dist/server/adapters/nestjs/chat/speech-stream.gateway.js +10 -8
- package/dist/server/adapters/nestjs/chat/speech-stream.gateway.js.map +1 -1
- package/dist/server/adapters/nestjs/chat/ws-loader.d.ts +5 -0
- package/dist/server/adapters/nestjs/chat/ws-loader.js +37 -0
- package/dist/server/adapters/nestjs/chat/ws-loader.js.map +1 -0
- package/openapi/package.json +5 -0
- package/package.json +59 -16
- package/react/langgraph/package.json +5 -0
- package/react/package.json +5 -0
- package/react/vercel/package.json +5 -0
- package/server/nestjs/package.json +5 -0
- package/server/nextjs/package.json +5 -0
- package/server/package.json +5 -0
- package/server/testing/package.json +5 -0
- package/skills/README.md +107 -0
- package/skills/building-glirastes-chat-ui/SKILL.md +378 -0
- package/skills/integrating-glirastes-nestjs/SKILL.md +346 -0
- package/skills/integrating-glirastes-nextjs/SKILL.md +312 -0
- package/skills/integrating-glirastes-nextjs-with-nestjs-backend/SKILL.md +359 -0
- package/skills/maintaining-glirastes-tools/SKILL.md +467 -0
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: maintaining-glirastes-tools
|
|
3
|
+
description: Authoring and maintaining Glirastes AI tool definitions, modules, and the codegen pipeline. Use when defining ai-tool.ts files, refining tool descriptions, configuring intent modules, declaring UI patterns, validating coverage, or wiring CI gates.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
tags:
|
|
6
|
+
- glirastes
|
|
7
|
+
- ai-tools
|
|
8
|
+
- codegen
|
|
9
|
+
- cli
|
|
10
|
+
triggers:
|
|
11
|
+
- defineEndpointTool
|
|
12
|
+
- defineUiTool
|
|
13
|
+
- ai-tool.ts
|
|
14
|
+
- ai-ui-tool.ts
|
|
15
|
+
- tool definition
|
|
16
|
+
- module-meta
|
|
17
|
+
- intent module
|
|
18
|
+
- uiPattern
|
|
19
|
+
- generate-tools
|
|
20
|
+
- validate-tools
|
|
21
|
+
- coverage
|
|
22
|
+
- scaffold ai-tool
|
|
23
|
+
- tool authoring
|
|
24
|
+
- tool description
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
# Maintaining Glirastes AI Tools
|
|
28
|
+
|
|
29
|
+
> **Framework wiring lives elsewhere:**
|
|
30
|
+
> - [integrating-glirastes-nextjs](../integrating-glirastes-nextjs/SKILL.md) — chat route + widget on Next.js
|
|
31
|
+
> - [integrating-glirastes-nestjs](../integrating-glirastes-nestjs/SKILL.md) — `@AiTool` decorators + `AiChatModule`
|
|
32
|
+
> - [building-glirastes-chat-ui](../building-glirastes-chat-ui/SKILL.md) — chat UI customization
|
|
33
|
+
|
|
34
|
+
## Two flavors of tool
|
|
35
|
+
|
|
36
|
+
A **tool** is something the AI can do. Glirastes ships two definitions; ~95% of real apps need only these two.
|
|
37
|
+
|
|
38
|
+
### Endpoint Tool — calls your backend
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { z } from 'zod';
|
|
42
|
+
import { defineEndpointTool } from 'glirastes';
|
|
43
|
+
|
|
44
|
+
export const aiTool = defineEndpointTool({
|
|
45
|
+
id: 'tasks.list', // unique dot-notation id
|
|
46
|
+
toolName: 'list_tasks', // unique snake_case name (what the LLM sees)
|
|
47
|
+
module: 'task_query', // intent module — controls routing & model tier
|
|
48
|
+
sharedWith: ['task_mutation'], // also available to these modules
|
|
49
|
+
description: `List tasks with an optional status filter.
|
|
50
|
+
WHEN to call: user asks to see tasks, or you need a task ID for a follow-up tool.
|
|
51
|
+
RETURNS: array of { id, title, status }.`,
|
|
52
|
+
method: 'GET',
|
|
53
|
+
path: '/api/tasks',
|
|
54
|
+
inputSchema: z.object({
|
|
55
|
+
status: z.enum(['open', 'done']).optional(),
|
|
56
|
+
}),
|
|
57
|
+
// outputSchema: z.array(...) — optional, helps the SDK validate responses
|
|
58
|
+
uiPattern: {
|
|
59
|
+
type: 'filter-and-navigate',
|
|
60
|
+
target: 'tasks',
|
|
61
|
+
filterMapping: { status: 'status' },
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### UI Tool — fires a frontend action without an API call
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
import { z } from 'zod';
|
|
70
|
+
import { defineUiTool } from 'glirastes';
|
|
71
|
+
|
|
72
|
+
export const openSettings = defineUiTool({
|
|
73
|
+
id: 'settings.open',
|
|
74
|
+
toolName: 'open_settings',
|
|
75
|
+
module: 'navigation',
|
|
76
|
+
description: 'Open the settings dialog for the current user.',
|
|
77
|
+
inputSchema: z.object({}),
|
|
78
|
+
uiAction: {
|
|
79
|
+
type: 'run-client-action',
|
|
80
|
+
actionId: 'settings.open',
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
UI tools never round-trip to the server; the result is a `uiAction` payload that the frontend's `UiActionBus` dispatches to a registered `useAiClientAction(...)` handler.
|
|
86
|
+
|
|
87
|
+
## Description anatomy — what the LLM actually reads
|
|
88
|
+
|
|
89
|
+
The description is the **only** signal the LLM has for *when* to call the tool. Treat it as a prompt fragment, not a docstring:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
description: `<one-line summary>.
|
|
93
|
+
WHEN to call: <concrete trigger phrasing the user might use>.
|
|
94
|
+
WHAT it returns: <shape>.
|
|
95
|
+
DO NOT: <common LLM mistakes — invented IDs, premature mutations, etc.>.`
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Real-world examples that drove down hallucinations:
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
description: `Create a new task.
|
|
102
|
+
IMPORTANT: confirm the title with the user FIRST.
|
|
103
|
+
DO NOT INVENT IDs — call list_users / list_groups to resolve names.`
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
description: `List tasks with an optional status filter.
|
|
108
|
+
WHEN to call: user asks to see, browse, or filter tasks; or you need a task ID for another tool.
|
|
109
|
+
RETURNS: array of { id, title, status, assigneeId }.`
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Input schema — Zod, with `.describe()`
|
|
113
|
+
|
|
114
|
+
Every input field should have `.describe()` — the LLM uses it as field-level docs:
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
inputSchema: z.object({
|
|
118
|
+
search: z.string().optional().describe('free-text search over title and description'),
|
|
119
|
+
status: z.enum(['open', 'done']).optional().describe('filter by lifecycle status'),
|
|
120
|
+
assigneeId: z.string().uuid().optional().describe('user UUID — never invent, look up via find_user'),
|
|
121
|
+
}),
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Path params (`:id` in the route): if the route is `/api/tasks/:id`, include `id` in the input schema. The SDK substitutes it into the URL at call time. (NestJS decorator mode auto-extracts these from `@Param()` — see [integrating-glirastes-nestjs](../integrating-glirastes-nestjs/SKILL.md).)
|
|
125
|
+
|
|
126
|
+
## Approval flow
|
|
127
|
+
|
|
128
|
+
`needsApproval` controls whether mutations show an approval card before executing:
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
needsApproval: true, // always require approval
|
|
132
|
+
needsApproval: false, // never require approval
|
|
133
|
+
needsApproval: (input, ctx) => input.amount > 1000, // dynamic
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Defaults** (when `needsApproval` is omitted):
|
|
137
|
+
- `GET` → `false`
|
|
138
|
+
- `POST` / `PATCH` / `PUT` / `DELETE` → `true`
|
|
139
|
+
|
|
140
|
+
So mutations get approval cards by default; you only specify when you want to override.
|
|
141
|
+
|
|
142
|
+
## UI Patterns — declarative reactions
|
|
143
|
+
|
|
144
|
+
After a tool runs, what should the UI do? Glirastes ships 5 patterns. Use them instead of writing custom dispatch code:
|
|
145
|
+
|
|
146
|
+
| Pattern | Use case | Example |
|
|
147
|
+
|---|---|---|
|
|
148
|
+
| `filter-and-navigate` | GET tools that map a filter to a page URL | `{ type: 'filter-and-navigate', target: 'tasks', filterMapping: { status: 'status' } }` |
|
|
149
|
+
| `open-detail` | After lookup or creation, open a detail view | `{ type: 'open-detail', entity: 'task', idField: 'taskId' }` |
|
|
150
|
+
| `open-dialog` | Open a modal (create / edit) | `{ type: 'open-dialog', dialog: 'create-task' }` |
|
|
151
|
+
| `refresh` | Refresh a region after mutation | `{ type: 'refresh', target: 'tasks' }` |
|
|
152
|
+
| `toast` | Show a notification | `{ type: 'toast', message: '$message', variant: 'success' }` |
|
|
153
|
+
|
|
154
|
+
Patterns support `$variable` placeholders that interpolate from the **response** body (`$id`, `$message`) or from the **input** (`$status`).
|
|
155
|
+
|
|
156
|
+
### Compound patterns
|
|
157
|
+
|
|
158
|
+
Pass an array for multiple effects (toast + refresh after a mutation):
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
uiPattern: [
|
|
162
|
+
{ type: 'toast', message: '$message', variant: 'success' },
|
|
163
|
+
{ type: 'refresh', target: 'tasks' },
|
|
164
|
+
],
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Each entry is processed sequentially. Patterns with unmet `condition` fields are skipped — others still fire.
|
|
168
|
+
|
|
169
|
+
### Manual `uiActionOnSuccess` (escape hatch)
|
|
170
|
+
|
|
171
|
+
When no built-in pattern fits, emit a raw action:
|
|
172
|
+
|
|
173
|
+
```ts
|
|
174
|
+
uiActionOnSuccess: {
|
|
175
|
+
type: 'run-client-action',
|
|
176
|
+
actionId: 'tasks.celebrate',
|
|
177
|
+
payload: { taskId: '$id' },
|
|
178
|
+
},
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Frontend handler (anywhere a relevant component mounts):
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
import { useAiClientAction } from 'glirastes/react';
|
|
185
|
+
|
|
186
|
+
useAiClientAction('tasks.celebrate', (payload) => {
|
|
187
|
+
fireConfetti();
|
|
188
|
+
});
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Priority** when multiple are present: response `uiAction` field > `uiPattern` > `uiActionOnSuccess`.
|
|
192
|
+
|
|
193
|
+
## Module definitions (intent routing)
|
|
194
|
+
|
|
195
|
+
> Module-based routing is a **Pro feature** — it requires `GLIRASTES_API_KEY` and a `lancer` client (intent classification via the Glirastes platform). Without it, all tools are exposed to the LLM on every request (free-tier mode). Module definitions are still useful pre-Pro: you author them upfront, they activate when you flip the env var.
|
|
196
|
+
|
|
197
|
+
Modules group tools by intent. Define them in `src/lib/ai/module-meta.ts`:
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
import type { ModuleMeta } from 'glirastes';
|
|
201
|
+
|
|
202
|
+
export const moduleMeta: Record<string, ModuleMeta> = {
|
|
203
|
+
task_query: {
|
|
204
|
+
classification: {
|
|
205
|
+
hint: 'User asks to view, list, or filter tasks (NOT create/modify).',
|
|
206
|
+
examples: ['show me open tasks', 'what is done?', 'filter by status'],
|
|
207
|
+
},
|
|
208
|
+
execution: {
|
|
209
|
+
maxSteps: 2, // LLM tool-call rounds for this module
|
|
210
|
+
contextWindow: 12, // messages sent to the LLM
|
|
211
|
+
modelTier: 'fast', // fast | standard | powerful
|
|
212
|
+
},
|
|
213
|
+
systemPrompt: `Focus: list and filter tasks.
|
|
214
|
+
For filter requests use list_tasks with appropriate status.`,
|
|
215
|
+
},
|
|
216
|
+
task_mutation: {
|
|
217
|
+
classification: {
|
|
218
|
+
hint: 'User asks to create, update, delete, or assign tasks.',
|
|
219
|
+
examples: ['create a task', 'mark as done', 'assign to Alice'],
|
|
220
|
+
},
|
|
221
|
+
execution: { maxSteps: 4, contextWindow: 16, modelTier: 'standard' },
|
|
222
|
+
systemPrompt: `Focus: mutate tasks.
|
|
223
|
+
NEVER invent IDs — use list_tasks / find_user first.`,
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
**Field cheat-sheet:**
|
|
229
|
+
- `classification.hint` + `examples` → auto-generate the intent classifier prompt
|
|
230
|
+
- `execution.modelTier` → which model tier handles the request (`fast` ≈ gpt-4o-mini, `standard` ≈ Sonnet, `powerful` ≈ Opus)
|
|
231
|
+
- `execution.maxSteps` → cap LLM tool-call rounds (cost control)
|
|
232
|
+
- `systemPrompt` → appended to the system prompt for this module only
|
|
233
|
+
|
|
234
|
+
### Related modules (medium-confidence routing)
|
|
235
|
+
|
|
236
|
+
When the intent classifier is uncertain (confidence 0.7–0.85), the router can include tools from related modules:
|
|
237
|
+
|
|
238
|
+
```ts
|
|
239
|
+
const moduleMeta: Record<string, ModuleMeta> = {
|
|
240
|
+
task_query: { /* ... */, related: ['task_mutation'] },
|
|
241
|
+
task_mutation: { /* ... */, related: ['task_query'] },
|
|
242
|
+
};
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Codegen pipeline — required for Next.js, not for NestJS
|
|
246
|
+
|
|
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.
|
|
252
|
+
|
|
253
|
+
### Recommended `package.json` scripts
|
|
254
|
+
|
|
255
|
+
```json
|
|
256
|
+
{
|
|
257
|
+
"scripts": {
|
|
258
|
+
"predev": "glirastes generate-tools --quiet",
|
|
259
|
+
"prebuild": "glirastes generate-tools --quiet",
|
|
260
|
+
"ai:scaffold": "glirastes scaffold",
|
|
261
|
+
"ai:generate": "glirastes generate-tools",
|
|
262
|
+
"ai:coverage": "glirastes coverage",
|
|
263
|
+
"ai:coverage:ci": "glirastes coverage --ci",
|
|
264
|
+
"ai:validate": "glirastes validate-tools",
|
|
265
|
+
"ai:validate:ci": "glirastes validate-tools --ci",
|
|
266
|
+
"ai:test": "glirastes test"
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
The `predev` / `prebuild` hooks regenerate the registry on every dev start and CI build — the generated files become source-of-truth.
|
|
272
|
+
|
|
273
|
+
### Output
|
|
274
|
+
|
|
275
|
+
After `glirastes generate-tools`:
|
|
276
|
+
|
|
277
|
+
```
|
|
278
|
+
src/generated/ai-tools/
|
|
279
|
+
├── endpoint.generated.ts # exports `endpointToolRegistry`
|
|
280
|
+
├── ui.generated.ts # exports `uiToolRegistry`
|
|
281
|
+
├── modules.generated.ts # exports `toolsByModule`, `moduleTypes`, `relatedModules`,
|
|
282
|
+
│ # `IntentType`, `IntentSchema`, `buildIntentModule`,
|
|
283
|
+
│ # and (with --meta) `INTENT_MODULES`, `CLASSIFICATION_PROMPT`
|
|
284
|
+
└── action-ids.generated.ts # union of action IDs (for type-safe useAiClientAction)
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Import in your chat route:
|
|
288
|
+
|
|
289
|
+
```ts
|
|
290
|
+
import { endpointToolRegistry } from '@/generated/ai-tools/endpoint.generated';
|
|
291
|
+
import { uiToolRegistry } from '@/generated/ai-tools/ui.generated';
|
|
292
|
+
|
|
293
|
+
const tools = { ...endpointToolRegistry, ...uiToolRegistry };
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Module bridge file (when using intent routing)
|
|
297
|
+
|
|
298
|
+
The codegen produces raw module data (`toolsByModule`, `moduleTypes`). The pipeline (`createAiPipeline` / `createAiTestSuite`) consumes a `ModuleDefinition[]` shape. Author a thin bridge file that joins your `module-meta.ts` with the generated metadata:
|
|
299
|
+
|
|
300
|
+
```ts
|
|
301
|
+
// src/lib/ai/module-definitions.ts
|
|
302
|
+
import type { ModuleDefinition } from 'glirastes';
|
|
303
|
+
import {
|
|
304
|
+
toolsByModule,
|
|
305
|
+
moduleTypes,
|
|
306
|
+
relatedModules,
|
|
307
|
+
type IntentType,
|
|
308
|
+
} from '@/generated/ai-tools/modules.generated';
|
|
309
|
+
import { moduleMeta } from '@/lib/ai/module-meta';
|
|
310
|
+
|
|
311
|
+
function buildModuleDefinition(type: IntentType): ModuleDefinition {
|
|
312
|
+
const meta = moduleMeta[type];
|
|
313
|
+
return {
|
|
314
|
+
id: type,
|
|
315
|
+
name: type.split('_').map((w) => w[0].toUpperCase() + w.slice(1)).join(' '),
|
|
316
|
+
description: meta.classification.hint,
|
|
317
|
+
tools: [...toolsByModule[type]],
|
|
318
|
+
executionDefaults: {
|
|
319
|
+
contextWindow: meta.execution.contextWindow,
|
|
320
|
+
modelTier: meta.execution.modelTier,
|
|
321
|
+
},
|
|
322
|
+
classification: meta.classification,
|
|
323
|
+
systemPrompt: meta.systemPrompt,
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export const modules: ModuleDefinition[] = moduleTypes.map(buildModuleDefinition);
|
|
328
|
+
export { relatedModules };
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
The chat handler and the test suite both import `modules` from this file.
|
|
332
|
+
|
|
333
|
+
### Module metadata flag
|
|
334
|
+
|
|
335
|
+
If your `module-meta.ts` lives at a non-default path:
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
glirastes generate-tools --meta @/lib/ai/module-meta
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
`@/...` resolves to your TS path alias.
|
|
342
|
+
|
|
343
|
+
## All CLI commands
|
|
344
|
+
|
|
345
|
+
| Command | Purpose | Common flags |
|
|
346
|
+
|---|---|---|
|
|
347
|
+
| `glirastes scaffold --route <file>` | Bootstrap `ai-tool.ts` next to a `route.ts` from method, path params, body fields | `--dry-run`, `--force`, `--root <dir>` |
|
|
348
|
+
| `glirastes generate-tools` | Run all generators (endpoint + UI + modules + action IDs) | `--meta <import-path>`, `--quiet` |
|
|
349
|
+
| `glirastes generate-endpoint-tools` | Endpoint registry only | `--quiet` |
|
|
350
|
+
| `glirastes generate-ui-tools` | UI tool registry + action IDs | `--quiet` |
|
|
351
|
+
| `glirastes generate-modules` | Module/intent registry only | `--meta <import-path>` |
|
|
352
|
+
| `glirastes generate-auto` | Auto-detect repo layout, choose generator + skill/MCP output | — |
|
|
353
|
+
| `glirastes generate <openapi.yaml>` | Generate endpoint tools from an OpenAPI spec (good for legacy backends) | `--out <file>` |
|
|
354
|
+
| `glirastes validate <openapi.yaml>` | Validate `x-ai` extensions in an OpenAPI spec | `--ci` |
|
|
355
|
+
| `glirastes validate-tools` | Validate naming, duplicates, missing approvals, path mismatches | `--ci`, `--fix`, `--quiet` |
|
|
356
|
+
| `glirastes coverage` | Routes without `ai-tool.ts`, orphan handlers, unhandled action IDs | `--ci`, `--quiet` |
|
|
357
|
+
| `glirastes test` | Scaffold an AI behaviour test file (Vitest, no LLM call) | `--output <file>`, `--force`, `--dry-run` |
|
|
358
|
+
| `glirastes install-skills` | Install the bundled agent skills (this directory) into a target like `.claude/skills` | `--target <dir>`, `--stack nextjs\|nestjs\|nextjs+nestjs\|all`, `--symlink`, `--force`, `--dry-run` |
|
|
359
|
+
| `glirastes generate-skills` | Export the registry as Claude Code / Codex skill files (so *agents* can call your tools) | `--app-name`, `--base-url`, `--auth bearer\|api-key\|oauth2\|cookie`, `--token-env`, `--format markdown\|json\|both`, `--output-dir`, `--sync`, `--remote` |
|
|
360
|
+
| `glirastes generate-mcp-server` | Export the registry as a standalone MCP server project | `--app-name`, `--base-url`, `--auth ...` |
|
|
361
|
+
| `glirastes check-upgrade` | Compare current code against SDK release notes; flag breaking changes | `--from-version <ver>` |
|
|
362
|
+
| `glirastes sync` | Upload tool schemas to the Glirastes platform (Pro registry) | `--api-key` (or `GLIRASTES_API_KEY` env), `--url` |
|
|
363
|
+
|
|
364
|
+
### CLI flag deep-dive
|
|
365
|
+
|
|
366
|
+
| Flag | Effect |
|
|
367
|
+
|---|---|
|
|
368
|
+
| `--quiet` | One-line output — ideal for `predev`/`prebuild` hooks |
|
|
369
|
+
| `--ci` | Exit code 1 on any issue — for CI pipelines |
|
|
370
|
+
| `--fix` | On `validate-tools`, prints quick-fix scaffold commands per missing tool |
|
|
371
|
+
| `--dry-run` | On `scaffold` / `test`, preview generated code without writing |
|
|
372
|
+
| `--force` | On `scaffold` / `test`, overwrite existing file |
|
|
373
|
+
| `--meta <path>` | Path to `module-meta.ts` (uses TS path aliases like `@/lib/ai/module-meta`) |
|
|
374
|
+
| `--app-name` (skills/mcp) | Name for the skill or MCP server |
|
|
375
|
+
| `--base-url` (skills/mcp) | Backend base URL the agent should call |
|
|
376
|
+
| `--auth bearer` (skills/mcp) | Auth strategy. `bearer` reads token from env var (default `API_TOKEN`); `api-key` uses an API key header; `oauth2` adds OAuth flow scaffolding; `cookie` uses session cookies |
|
|
377
|
+
| `--token-env <NAME>` | For bearer auth, the env var the agent reads the token from |
|
|
378
|
+
| `--sync` (skills) | Upload to Glirastes platform after generating |
|
|
379
|
+
| `--remote` (skills) | `--sync` + trigger remote regeneration on the platform |
|
|
380
|
+
|
|
381
|
+
### Coverage report — what it catches
|
|
382
|
+
|
|
383
|
+
| Section | Catches |
|
|
384
|
+
|---|---|
|
|
385
|
+
| **Uncovered Routes** | `route.ts` without an `ai-tool.ts` next to it (with `glirastes scaffold` suggestion) |
|
|
386
|
+
| **Uncovered Components** | Component directory without an `ai-ui-tool.ts` |
|
|
387
|
+
| **Missing Handlers** | UI tool defines `actionId` X, but no `useAiClientAction('X')` found in `.tsx` files |
|
|
388
|
+
| **Orphan Handlers** | `useAiClientAction('X')` exists, but no UI tool defines `actionId: 'X'` |
|
|
389
|
+
|
|
390
|
+
### Validation report — severities
|
|
391
|
+
|
|
392
|
+
- **Errors** (block CI with `--ci`): orphaned `ai-tool.ts` without a `route.ts`, missing exports, malformed Zod schemas
|
|
393
|
+
- **Warnings**: routes without an `ai-tool.ts` (with scaffold suggestion), path mismatches between `path` and route filesystem location
|
|
394
|
+
- **Info**: tools without a `module` field (with module-assignment hint)
|
|
395
|
+
|
|
396
|
+
Add `--fix` to get a consolidated quick-fix block at the bottom.
|
|
397
|
+
|
|
398
|
+
### Excluding routes from coverage
|
|
399
|
+
|
|
400
|
+
Skip a route from coverage and validation:
|
|
401
|
+
|
|
402
|
+
- File-level: `// @ai-ignore` at the top of `route.ts`
|
|
403
|
+
- Directory-level: a `.ai-ignore` file in any directory excludes the entire subtree
|
|
404
|
+
|
|
405
|
+
## Testing — deterministic, no LLM
|
|
406
|
+
|
|
407
|
+
`glirastes test` scaffolds a Vitest test file using `glirastes/server/testing`:
|
|
408
|
+
|
|
409
|
+
```ts
|
|
410
|
+
import { createAiTestSuite } from 'glirastes/server/testing';
|
|
411
|
+
import { modules } from '@/lib/ai/module-definitions';
|
|
412
|
+
import { endpointToolRegistry } from '@/generated/ai-tools/endpoint.generated';
|
|
413
|
+
import { uiToolRegistry } from '@/generated/ai-tools/ui.generated';
|
|
414
|
+
|
|
415
|
+
const suite = createAiTestSuite({
|
|
416
|
+
tools: { ...endpointToolRegistry, ...uiToolRegistry },
|
|
417
|
+
modules,
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
suite.smokeTest(); // module completeness, naming, no duplicates
|
|
421
|
+
suite.guardrailsTest(); // injection, length, sanitization
|
|
422
|
+
suite.approvalTest(); // POST/DELETE → needsApproval:true (default)
|
|
423
|
+
suite.routingTest([
|
|
424
|
+
{ input: 'show tasks', expectModule: 'task_query', expectTools: ['list_tasks'] },
|
|
425
|
+
{ input: 'create a task: review PR', expectModule: 'task_mutation' },
|
|
426
|
+
]);
|
|
427
|
+
|
|
428
|
+
// Low-level: simulate the pipeline directly
|
|
429
|
+
const result = await suite.simulatePipeline('list my tasks', {
|
|
430
|
+
intent: 'task_query', confidence: 0.95,
|
|
431
|
+
});
|
|
432
|
+
expect(result.tools).toContain('list_tasks');
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
**When to update tests:**
|
|
436
|
+
- New tool → add a routing case
|
|
437
|
+
- Tool moved to a different module → update `expectModule`
|
|
438
|
+
- Tool renamed → update `expectTools`
|
|
439
|
+
- New mutation → confirm `needsApproval: true`
|
|
440
|
+
- New module → add smoke + routing cases
|
|
441
|
+
|
|
442
|
+
## Naming conventions
|
|
443
|
+
|
|
444
|
+
| Field | Format | Example |
|
|
445
|
+
|---|---|---|
|
|
446
|
+
| `id` | dot-notation, `<resource>.<action>` | `tasks.list`, `tasks.bulk.update`, `users.search` |
|
|
447
|
+
| `toolName` | snake_case | `list_tasks`, `bulk_update_tasks`, `find_user` |
|
|
448
|
+
| `module` | snake_case noun phrase | `task_query`, `task_mutation`, `navigation` |
|
|
449
|
+
| `actionId` (UI) | dot-notation, `<entity>.<action>` | `task-details.open`, `tasks.refresh` |
|
|
450
|
+
|
|
451
|
+
Both `id` and `toolName` must be unique across the whole registry — `glirastes validate-tools` enforces this.
|
|
452
|
+
|
|
453
|
+
## After every change — run the validation chain
|
|
454
|
+
|
|
455
|
+
1. `npm run ai:generate` — regenerate registries
|
|
456
|
+
2. `npm run ai:validate` — naming, duplicates, missing approvals, path mismatches
|
|
457
|
+
3. `npm run ai:coverage` — routes without ai-tool.ts, orphan handlers
|
|
458
|
+
4. `npm run ai:test` (if you have behaviour tests)
|
|
459
|
+
5. `npm run build` — final type-check + Next.js / NestJS build
|
|
460
|
+
|
|
461
|
+
CI: add `ai:coverage:ci` and `ai:validate:ci` as required steps.
|
|
462
|
+
|
|
463
|
+
## What this skill does NOT cover
|
|
464
|
+
|
|
465
|
+
- **Framework wiring** (chat route, decorators, `AiChatModule`) — see [integrating-glirastes-nextjs](../integrating-glirastes-nextjs/SKILL.md) or [integrating-glirastes-nestjs](../integrating-glirastes-nestjs/SKILL.md)
|
|
466
|
+
- **Chat UI customization** (theming, mentions, voice, approval cards) — see [building-glirastes-chat-ui](../building-glirastes-chat-ui/SKILL.md)
|
|
467
|
+
- **Glirastes platform deep-dive** (PII Shield via `createPiiShield`, intent routing via `createLancer`, custom guardrails, service degradation) — opt in via `GLIRASTES_API_KEY`; documented separately at [docs.chainmatics.de](https://chainmatics.de)
|