@soederpop/luca 0.0.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/CLAUDE.md +71 -0
- package/README.md +78 -0
- package/bun.lock +2928 -0
- package/bunfig.toml +3 -0
- package/commands/audit-docs.ts +740 -0
- package/commands/build-scaffolds.ts +154 -0
- package/commands/generate-api-docs.ts +114 -0
- package/commands/update-introspection.ts +67 -0
- package/docs/CLI.md +335 -0
- package/docs/README.md +88 -0
- package/docs/TABLE-OF-CONTENTS.md +157 -0
- package/docs/apis/clients/elevenlabs.md +84 -0
- package/docs/apis/clients/graph.md +56 -0
- package/docs/apis/clients/openai.md +69 -0
- package/docs/apis/clients/rest.md +41 -0
- package/docs/apis/clients/websocket.md +107 -0
- package/docs/apis/features/agi/assistant.md +471 -0
- package/docs/apis/features/agi/assistants-manager.md +154 -0
- package/docs/apis/features/agi/claude-code.md +602 -0
- package/docs/apis/features/agi/conversation-history.md +352 -0
- package/docs/apis/features/agi/conversation.md +333 -0
- package/docs/apis/features/agi/docs-reader.md +121 -0
- package/docs/apis/features/agi/openai-codex.md +318 -0
- package/docs/apis/features/agi/openapi.md +138 -0
- package/docs/apis/features/agi/semantic-search.md +387 -0
- package/docs/apis/features/agi/skills-library.md +216 -0
- package/docs/apis/features/node/container-link.md +133 -0
- package/docs/apis/features/node/content-db.md +313 -0
- package/docs/apis/features/node/disk-cache.md +379 -0
- package/docs/apis/features/node/dns.md +651 -0
- package/docs/apis/features/node/docker.md +705 -0
- package/docs/apis/features/node/downloader.md +81 -0
- package/docs/apis/features/node/esbuild.md +59 -0
- package/docs/apis/features/node/file-manager.md +182 -0
- package/docs/apis/features/node/fs.md +581 -0
- package/docs/apis/features/node/git.md +330 -0
- package/docs/apis/features/node/google-auth.md +174 -0
- package/docs/apis/features/node/google-calendar.md +187 -0
- package/docs/apis/features/node/google-docs.md +151 -0
- package/docs/apis/features/node/google-drive.md +225 -0
- package/docs/apis/features/node/google-sheets.md +179 -0
- package/docs/apis/features/node/grep.md +290 -0
- package/docs/apis/features/node/helpers.md +135 -0
- package/docs/apis/features/node/ink.md +334 -0
- package/docs/apis/features/node/ipc-socket.md +260 -0
- package/docs/apis/features/node/json-tree.md +86 -0
- package/docs/apis/features/node/launcher-app-command-listener.md +145 -0
- package/docs/apis/features/node/networking.md +281 -0
- package/docs/apis/features/node/nlp.md +133 -0
- package/docs/apis/features/node/opener.md +97 -0
- package/docs/apis/features/node/os.md +118 -0
- package/docs/apis/features/node/package-finder.md +402 -0
- package/docs/apis/features/node/postgres.md +212 -0
- package/docs/apis/features/node/proc.md +430 -0
- package/docs/apis/features/node/process-manager.md +210 -0
- package/docs/apis/features/node/python.md +278 -0
- package/docs/apis/features/node/repl.md +88 -0
- package/docs/apis/features/node/runpod.md +673 -0
- package/docs/apis/features/node/secure-shell.md +169 -0
- package/docs/apis/features/node/semantic-search.md +401 -0
- package/docs/apis/features/node/sqlite.md +211 -0
- package/docs/apis/features/node/telegram.md +254 -0
- package/docs/apis/features/node/tts.md +118 -0
- package/docs/apis/features/node/ui.md +703 -0
- package/docs/apis/features/node/vault.md +64 -0
- package/docs/apis/features/node/vm.md +84 -0
- package/docs/apis/features/node/window-manager.md +337 -0
- package/docs/apis/features/node/yaml-tree.md +85 -0
- package/docs/apis/features/node/yaml.md +176 -0
- package/docs/apis/features/web/asset-loader.md +47 -0
- package/docs/apis/features/web/container-link.md +133 -0
- package/docs/apis/features/web/esbuild.md +59 -0
- package/docs/apis/features/web/helpers.md +135 -0
- package/docs/apis/features/web/network.md +30 -0
- package/docs/apis/features/web/speech.md +55 -0
- package/docs/apis/features/web/vault.md +64 -0
- package/docs/apis/features/web/vm.md +84 -0
- package/docs/apis/features/web/voice.md +67 -0
- package/docs/apis/servers/express.md +127 -0
- package/docs/apis/servers/mcp.md +213 -0
- package/docs/apis/servers/websocket.md +99 -0
- package/docs/documentation-audit.md +134 -0
- package/docs/examples/content-db.md +77 -0
- package/docs/examples/disk-cache.md +83 -0
- package/docs/examples/docker.md +101 -0
- package/docs/examples/downloader.md +70 -0
- package/docs/examples/esbuild.md +80 -0
- package/docs/examples/file-manager.md +82 -0
- package/docs/examples/fs.md +83 -0
- package/docs/examples/git.md +85 -0
- package/docs/examples/google-auth.md +88 -0
- package/docs/examples/google-calendar.md +94 -0
- package/docs/examples/google-docs.md +82 -0
- package/docs/examples/google-drive.md +96 -0
- package/docs/examples/google-sheets.md +95 -0
- package/docs/examples/grep.md +85 -0
- package/docs/examples/ink-blocks.md +75 -0
- package/docs/examples/ink-renderer.md +41 -0
- package/docs/examples/ink.md +103 -0
- package/docs/examples/ipc-socket.md +103 -0
- package/docs/examples/json-tree.md +91 -0
- package/docs/examples/launcher-app-command-listener.md +120 -0
- package/docs/examples/networking.md +58 -0
- package/docs/examples/nlp.md +91 -0
- package/docs/examples/opener.md +78 -0
- package/docs/examples/os.md +72 -0
- package/docs/examples/package-finder.md +89 -0
- package/docs/examples/port-exposer.md +89 -0
- package/docs/examples/postgres.md +91 -0
- package/docs/examples/proc.md +81 -0
- package/docs/examples/process-manager.md +79 -0
- package/docs/examples/python.md +91 -0
- package/docs/examples/repl.md +93 -0
- package/docs/examples/runpod.md +119 -0
- package/docs/examples/secure-shell.md +92 -0
- package/docs/examples/sqlite.md +86 -0
- package/docs/examples/telegram.md +77 -0
- package/docs/examples/tts.md +86 -0
- package/docs/examples/ui.md +80 -0
- package/docs/examples/vault.md +70 -0
- package/docs/examples/vm.md +86 -0
- package/docs/examples/window-manager.md +125 -0
- package/docs/examples/yaml-tree.md +93 -0
- package/docs/examples/yaml.md +104 -0
- package/docs/ideas/class-registration-refactor-possibilities.md +197 -0
- package/docs/ideas/container-use-api.md +9 -0
- package/docs/ideas/easy-auth-for-express-servers-and-luca-serve.md +0 -0
- package/docs/ideas/feature-stacks.md +22 -0
- package/docs/ideas/luca-cli-self-sufficiency-demo.md +23 -0
- package/docs/ideas/mcp-design.md +9 -0
- package/docs/ideas/web-container-debugging-feature.md +13 -0
- package/docs/introspection-audit.md +49 -0
- package/docs/introspection.md +154 -0
- package/docs/mcp/readme.md +162 -0
- package/docs/models.ts +38 -0
- package/docs/philosophy.md +85 -0
- package/docs/principles.md +7 -0
- package/docs/prompts/audit-codebase-for-failures-to-use-the-container.md +34 -0
- package/docs/prompts/mcp-test-easy-command.md +27 -0
- package/docs/reports/assistant-bugs.md +38 -0
- package/docs/reports/attach-pattern-usage.md +18 -0
- package/docs/reports/code-audit-results.md +391 -0
- package/docs/reports/introspection-audit-tasks.md +378 -0
- package/docs/reports/luca-mcp-improvements.md +128 -0
- package/docs/scaffolds/client.md +140 -0
- package/docs/scaffolds/command.md +106 -0
- package/docs/scaffolds/endpoint.md +176 -0
- package/docs/scaffolds/feature.md +148 -0
- package/docs/scaffolds/server.md +187 -0
- package/docs/tasks/web-container-helper-discovery.md +71 -0
- package/docs/todos.md +1 -0
- package/docs/tutorials/01-getting-started.md +106 -0
- package/docs/tutorials/02-container.md +210 -0
- package/docs/tutorials/03-scripts.md +194 -0
- package/docs/tutorials/04-features-overview.md +196 -0
- package/docs/tutorials/05-state-and-events.md +171 -0
- package/docs/tutorials/06-servers.md +157 -0
- package/docs/tutorials/07-endpoints.md +198 -0
- package/docs/tutorials/08-commands.md +171 -0
- package/docs/tutorials/09-clients.md +162 -0
- package/docs/tutorials/10-creating-features.md +198 -0
- package/docs/tutorials/11-contentbase.md +191 -0
- package/docs/tutorials/12-assistants.md +215 -0
- package/docs/tutorials/13-introspection.md +147 -0
- package/docs/tutorials/14-type-system.md +174 -0
- package/docs/tutorials/15-project-patterns.md +222 -0
- package/docs/tutorials/16-google-features.md +534 -0
- package/docs/tutorials/17-tui-blocks.md +530 -0
- package/docs/tutorials/18-semantic-search.md +334 -0
- package/index.ts +1 -0
- package/luca.console.ts +9 -0
- package/main.py +6 -0
- package/package.json +154 -0
- package/pyproject.toml +7 -0
- package/scripts/animations/chrome-glitch.ts +55 -0
- package/scripts/animations/index.ts +16 -0
- package/scripts/animations/neon-pulse.ts +64 -0
- package/scripts/animations/types.ts +6 -0
- package/scripts/build-web.ts +28 -0
- package/scripts/examples/ask-luca-expert.ts +42 -0
- package/scripts/examples/assistant-questions.ts +12 -0
- package/scripts/examples/excalidraw-expert.ts +75 -0
- package/scripts/examples/expert-chat.ts +0 -0
- package/scripts/examples/file-manager.ts +14 -0
- package/scripts/examples/ideas.ts +12 -0
- package/scripts/examples/interactive-chat.ts +20 -0
- package/scripts/examples/openai-tool-calls.ts +113 -0
- package/scripts/examples/opening-a-web-browser.ts +5 -0
- package/scripts/examples/telegram-bot.ts +79 -0
- package/scripts/examples/telegram-ink-ui.ts +302 -0
- package/scripts/examples/using-assistant-with-mcp.ts +560 -0
- package/scripts/examples/using-claude-code.ts +10 -0
- package/scripts/examples/using-contentdb.ts +35 -0
- package/scripts/examples/using-conversations.ts +35 -0
- package/scripts/examples/using-disk-cache.ts +10 -0
- package/scripts/examples/using-docker-shell.ts +75 -0
- package/scripts/examples/using-elevenlabs.ts +25 -0
- package/scripts/examples/using-google-calendar.ts +57 -0
- package/scripts/examples/using-google-docs.ts +74 -0
- package/scripts/examples/using-google-drive.ts +74 -0
- package/scripts/examples/using-google-sheets.ts +89 -0
- package/scripts/examples/using-nlp.ts +55 -0
- package/scripts/examples/using-ollama.ts +10 -0
- package/scripts/examples/using-openai-codex.ts +23 -0
- package/scripts/examples/using-postgres.ts +55 -0
- package/scripts/examples/using-runpod.ts +32 -0
- package/scripts/examples/using-tts.ts +40 -0
- package/scripts/examples/vm-loading-esm-modules.ts +16 -0
- package/scripts/scaffold.ts +391 -0
- package/scripts/scratch.ts +15 -0
- package/scripts/test-command-listener.ts +123 -0
- package/scripts/test-window-manager-lifecycle.ts +86 -0
- package/scripts/test-window-manager.ts +43 -0
- package/scripts/update-introspection-data.ts +58 -0
- package/src/agi/README.md +14 -0
- package/src/agi/container.server.ts +114 -0
- package/src/agi/endpoints/ask.ts +60 -0
- package/src/agi/endpoints/conversations/[id].ts +45 -0
- package/src/agi/endpoints/conversations.ts +31 -0
- package/src/agi/endpoints/experts.ts +37 -0
- package/src/agi/features/assistant.ts +767 -0
- package/src/agi/features/assistants-manager.ts +260 -0
- package/src/agi/features/claude-code.ts +1111 -0
- package/src/agi/features/conversation-history.ts +497 -0
- package/src/agi/features/conversation.ts +799 -0
- package/src/agi/features/openai-codex.ts +631 -0
- package/src/agi/features/openapi.ts +438 -0
- package/src/agi/features/skills-library.ts +425 -0
- package/src/agi/index.ts +6 -0
- package/src/agi/lib/token-counter.ts +122 -0
- package/src/browser.ts +25 -0
- package/src/bus.ts +100 -0
- package/src/cli/cli.ts +70 -0
- package/src/client.ts +461 -0
- package/src/clients/civitai/index.ts +541 -0
- package/src/clients/client-template.ts +41 -0
- package/src/clients/comfyui/index.ts +597 -0
- package/src/clients/elevenlabs/index.ts +291 -0
- package/src/clients/openai/index.ts +451 -0
- package/src/clients/supabase/index.ts +366 -0
- package/src/command.ts +164 -0
- package/src/commands/chat.ts +182 -0
- package/src/commands/console.ts +192 -0
- package/src/commands/describe.ts +433 -0
- package/src/commands/eval.ts +116 -0
- package/src/commands/help.ts +214 -0
- package/src/commands/index.ts +14 -0
- package/src/commands/mcp.ts +64 -0
- package/src/commands/prompt.ts +807 -0
- package/src/commands/run.ts +257 -0
- package/src/commands/sandbox-mcp.ts +439 -0
- package/src/commands/scaffold.ts +79 -0
- package/src/commands/serve.ts +172 -0
- package/src/container.ts +781 -0
- package/src/endpoint.ts +340 -0
- package/src/feature.ts +75 -0
- package/src/hash-object.ts +97 -0
- package/src/helper.ts +543 -0
- package/src/introspection/generated.agi.ts +23388 -0
- package/src/introspection/generated.node.ts +18899 -0
- package/src/introspection/generated.web.ts +2021 -0
- package/src/introspection/index.ts +256 -0
- package/src/introspection/scan.ts +912 -0
- package/src/node/container.ts +354 -0
- package/src/node/feature.ts +13 -0
- package/src/node/features/container-link.ts +558 -0
- package/src/node/features/content-db.ts +475 -0
- package/src/node/features/disk-cache.ts +382 -0
- package/src/node/features/dns.ts +655 -0
- package/src/node/features/docker.ts +912 -0
- package/src/node/features/downloader.ts +92 -0
- package/src/node/features/esbuild.ts +68 -0
- package/src/node/features/file-manager.ts +357 -0
- package/src/node/features/fs.ts +534 -0
- package/src/node/features/git.ts +492 -0
- package/src/node/features/google-auth.ts +502 -0
- package/src/node/features/google-calendar.ts +300 -0
- package/src/node/features/google-docs.ts +404 -0
- package/src/node/features/google-drive.ts +339 -0
- package/src/node/features/google-sheets.ts +279 -0
- package/src/node/features/grep.ts +406 -0
- package/src/node/features/helpers.ts +374 -0
- package/src/node/features/ink.ts +490 -0
- package/src/node/features/ipc-socket.ts +459 -0
- package/src/node/features/json-tree.ts +188 -0
- package/src/node/features/launcher-app-command-listener.ts +388 -0
- package/src/node/features/networking.ts +925 -0
- package/src/node/features/nlp.ts +211 -0
- package/src/node/features/opener.ts +166 -0
- package/src/node/features/os.ts +157 -0
- package/src/node/features/package-finder.ts +539 -0
- package/src/node/features/port-exposer.ts +342 -0
- package/src/node/features/postgres.ts +273 -0
- package/src/node/features/proc.ts +502 -0
- package/src/node/features/process-manager.ts +542 -0
- package/src/node/features/python.ts +444 -0
- package/src/node/features/repl.ts +194 -0
- package/src/node/features/runpod.ts +802 -0
- package/src/node/features/secure-shell.ts +248 -0
- package/src/node/features/semantic-search.ts +924 -0
- package/src/node/features/sqlite.ts +289 -0
- package/src/node/features/telegram.ts +342 -0
- package/src/node/features/tts.ts +184 -0
- package/src/node/features/ui.ts +857 -0
- package/src/node/features/vault.ts +164 -0
- package/src/node/features/vm.ts +312 -0
- package/src/node/features/window-manager.ts +804 -0
- package/src/node/features/yaml-tree.ts +149 -0
- package/src/node/features/yaml.ts +132 -0
- package/src/node.ts +70 -0
- package/src/react/index.ts +175 -0
- package/src/registry.ts +199 -0
- package/src/scaffolds/generated.ts +1613 -0
- package/src/scaffolds/template.ts +37 -0
- package/src/schemas/base.ts +255 -0
- package/src/server.ts +135 -0
- package/src/servers/express.ts +209 -0
- package/src/servers/mcp.ts +805 -0
- package/src/servers/socket.ts +120 -0
- package/src/state.ts +101 -0
- package/src/web/clients/socket.ts +82 -0
- package/src/web/container.ts +74 -0
- package/src/web/extension.ts +30 -0
- package/src/web/feature.ts +12 -0
- package/src/web/features/asset-loader.ts +64 -0
- package/src/web/features/container-link.ts +385 -0
- package/src/web/features/esbuild.ts +79 -0
- package/src/web/features/helpers.ts +267 -0
- package/src/web/features/network.ts +61 -0
- package/src/web/features/speech.ts +87 -0
- package/src/web/features/vault.ts +189 -0
- package/src/web/features/vm.ts +78 -0
- package/src/web/features/voice-recognition.ts +129 -0
- package/src/web/shims/isomorphic-vm.ts +149 -0
- package/test/bus.test.ts +134 -0
- package/test/clients-servers.test.ts +216 -0
- package/test/container-link.test.ts +274 -0
- package/test/features.test.ts +160 -0
- package/test/integration.test.ts +787 -0
- package/test/node-container.test.ts +121 -0
- package/test/rate-limit.test.ts +272 -0
- package/test/semantic-search.test.ts +550 -0
- package/test/state.test.ts +121 -0
- package/test-integration/assistant.test.ts +138 -0
- package/test-integration/assistants-manager.test.ts +123 -0
- package/test-integration/claude-code.test.ts +98 -0
- package/test-integration/conversation-history.test.ts +205 -0
- package/test-integration/conversation.test.ts +137 -0
- package/test-integration/elevenlabs.test.ts +55 -0
- package/test-integration/google-services.test.ts +80 -0
- package/test-integration/helpers.ts +89 -0
- package/test-integration/openai-codex.test.ts +93 -0
- package/test-integration/runpod.test.ts +58 -0
- package/test-integration/server-endpoints.test.ts +97 -0
- package/test-integration/skills-library.test.ts +157 -0
- package/test-integration/telegram.test.ts +46 -0
- package/tsconfig.json +58 -0
- package/uv.lock +8 -0
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
# Introspection Audit Results
|
|
2
|
+
|
|
3
|
+
This audit evaluates whether the `introspectAsText()` output for each feature is sufficient for an LLM (or developer) to understand the feature's purpose and build working code with it.
|
|
4
|
+
|
|
5
|
+
Generated by running `luca describe <feature>` for each feature after regenerating introspection data.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
### [diskCache](src/node/features/disk-cache.ts)
|
|
10
|
+
|
|
11
|
+
File-backed key-value cache built on top of the cacache library (the same store that powers npm). Suitable for persisting arbitrary data including very large blobs when necessary, with optional encryption support.
|
|
12
|
+
|
|
13
|
+
- Securely store and retrieve encrypted secrets across processes using the vault-backed cache
|
|
14
|
+
- Cache large file blobs (images, models, API responses) with `set`/`get`/`has`/`ensure` for deduplication
|
|
15
|
+
- Query and manage cached keys (`ls`, `copy`, `move`, `rm`, `clearAll`)
|
|
16
|
+
- Save cached content directly to disk files with `saveFile`, supporting base64 decoding
|
|
17
|
+
|
|
18
|
+
### [contentDb](src/node/features/content-db.ts)
|
|
19
|
+
|
|
20
|
+
ContentDb feature provides a database-like interface for working with collections of markdown/YAML files on disk. Each file is a "document" with frontmatter metadata and body content, organized into typed collections. Powered by the Contentbase library.
|
|
21
|
+
|
|
22
|
+
- Load a folder of markdown files as a queryable collection with typed schemas
|
|
23
|
+
- Create, update, and delete content documents with automatic frontmatter management
|
|
24
|
+
- Query documents by metadata fields (e.g. find all posts with `status: draft`)
|
|
25
|
+
- Watch content directories for changes and react to file updates
|
|
26
|
+
|
|
27
|
+
### [downloader](src/node/features/downloader.ts)
|
|
28
|
+
|
|
29
|
+
The Downloader feature downloads files from the internet. It supports downloading files from URLs and saving them to the local file system.
|
|
30
|
+
|
|
31
|
+
- Download files from URLs to local paths
|
|
32
|
+
- Batch download multiple files in parallel
|
|
33
|
+
- Resume interrupted downloads with range request support
|
|
34
|
+
- Download with progress tracking and event callbacks
|
|
35
|
+
|
|
36
|
+
### [esbuild](src/node/features/esbuild.ts)
|
|
37
|
+
|
|
38
|
+
The Esbuild feature provides a bundling and transpilation interface for JavaScript/TypeScript projects via esbuild. Useful for building single-file bundles, compiling TypeScript, and transforming code.
|
|
39
|
+
|
|
40
|
+
- Bundle a TypeScript project into a single distributable file
|
|
41
|
+
- Transpile modern JS/TS for compatibility with older runtimes
|
|
42
|
+
- Build CLI tools as self-contained executables
|
|
43
|
+
- Watch mode for development builds with automatic recompilation
|
|
44
|
+
|
|
45
|
+
### [fileManager](src/node/features/file-manager.ts)
|
|
46
|
+
|
|
47
|
+
The FileManager feature creates a database-like index of all of the files in the project, and provides metadata about these files, and also provides a way to watch for changes to the files.
|
|
48
|
+
|
|
49
|
+
- Scan a project directory and build a searchable index of all files with metadata
|
|
50
|
+
- Match files against glob patterns (e.g. find all `*.ts` files, all `*.test.*` files)
|
|
51
|
+
- Watch the file system for real-time change notifications (create, modify, delete)
|
|
52
|
+
- Get file metadata (path, extension, size) for project analysis
|
|
53
|
+
|
|
54
|
+
### [fs](src/node/features/fs.ts)
|
|
55
|
+
|
|
56
|
+
File system utilities for reading, writing, and managing files. Wraps Node.js fs operations with convenience methods and path resolution relative to the container's working directory.
|
|
57
|
+
|
|
58
|
+
- Read and write files with automatic path resolution from the container's cwd
|
|
59
|
+
- Check file existence, create directories, and manage file system operations
|
|
60
|
+
- Copy, move, and delete files and directories
|
|
61
|
+
- Read directory contents and walk directory trees
|
|
62
|
+
|
|
63
|
+
### [git](src/node/features/git.ts)
|
|
64
|
+
|
|
65
|
+
The Git feature provides utilities for interacting with Git repositories. Allows you to check repository status, list files, get branch information, and access Git metadata for projects within a Git repository.
|
|
66
|
+
|
|
67
|
+
- List tracked/modified/untracked files using `lsFiles` with flexible filter options
|
|
68
|
+
- Get recent commit history with `getLatestChanges` and per-file commit logs with `fileLog`
|
|
69
|
+
- Diff files between branches, commits, or tags with colorized terminal output
|
|
70
|
+
- Query branch name, SHA, repo root, and whether the current directory is a git repo
|
|
71
|
+
|
|
72
|
+
### [grep](src/node/features/grep.ts)
|
|
73
|
+
|
|
74
|
+
The Grep feature provides utilities for searching file contents using ripgrep (rg) or grep. Returns structured results as arrays of `{ file, line, column, content }` objects with paths relative to the container cwd.
|
|
75
|
+
|
|
76
|
+
- Search for patterns across files with structured results (`search`)
|
|
77
|
+
- Find import/require statements for a module (`imports`)
|
|
78
|
+
- Find function, class, and variable definitions by name (`definitions`)
|
|
79
|
+
- Find all TODO/FIXME/HACK comments in the codebase (`todos`)
|
|
80
|
+
|
|
81
|
+
### [ipcSocket](src/node/features/ipc-socket.ts)
|
|
82
|
+
|
|
83
|
+
IPC feature providing robust inter-process communication via Unix domain sockets. Supports both server and client modes with JSON message serialization, broadcast messaging, and automatic socket cleanup.
|
|
84
|
+
|
|
85
|
+
- Stand up a local IPC server on a Unix socket for multi-process coordination
|
|
86
|
+
- Connect as a client to an existing IPC server and exchange JSON messages
|
|
87
|
+
- Broadcast messages to all connected clients simultaneously
|
|
88
|
+
- Coordinate between a parent process and multiple worker processes
|
|
89
|
+
|
|
90
|
+
### [jsonTree](src/node/features/json-tree.ts)
|
|
91
|
+
|
|
92
|
+
Recursively loads JSON files from a directory structure and builds a hierarchical tree representation. Automatically processes file paths to create a nested object structure where file paths become camelCased property paths.
|
|
93
|
+
|
|
94
|
+
- Load a directory of JSON config files into a single queryable tree object
|
|
95
|
+
- Merge multiple JSON data sources into a unified hierarchical structure
|
|
96
|
+
- Access nested configuration values using dot-notation property paths
|
|
97
|
+
- Build runtime configuration from a file-based config directory structure
|
|
98
|
+
|
|
99
|
+
### [networking](src/node/features/networking.ts)
|
|
100
|
+
|
|
101
|
+
The Networking feature provides utilities for network-related operations including port detection and availability checking.
|
|
102
|
+
|
|
103
|
+
- Find the next available port starting from a given number (`findOpenPort`)
|
|
104
|
+
- Check if a specific port is in use before binding a server (`isPortOpen`)
|
|
105
|
+
- Dynamically allocate ports for dev servers to avoid conflicts
|
|
106
|
+
- Validate port availability before configuring service endpoints
|
|
107
|
+
|
|
108
|
+
### [os](src/node/features/os.ts)
|
|
109
|
+
|
|
110
|
+
Operating system utilities providing information about the current platform, CPU, memory, and environment.
|
|
111
|
+
|
|
112
|
+
- Query current platform details (OS, arch, CPU count, memory)
|
|
113
|
+
- Detect the runtime environment (macOS, Linux, Windows)
|
|
114
|
+
- Get system-level info for adaptive behavior in scripts
|
|
115
|
+
- Check available system resources before spawning heavy processes
|
|
116
|
+
|
|
117
|
+
### [packageFinder](src/node/features/package-finder.ts)
|
|
118
|
+
|
|
119
|
+
Discovers and indexes package.json files across a monorepo or project tree. Provides structured access to package metadata including names, versions, dependencies, and scripts.
|
|
120
|
+
|
|
121
|
+
- Discover all packages in a monorepo and index their metadata
|
|
122
|
+
- Query package dependencies and dev-dependencies across the workspace
|
|
123
|
+
- Find which packages define a specific npm script
|
|
124
|
+
- Map package names to their file system paths for tooling integration
|
|
125
|
+
|
|
126
|
+
### [portExposer](src/node/features/port-exposer.ts)
|
|
127
|
+
|
|
128
|
+
**NOTE**: This seems to be wrong. ngrok is what is used not cloudflare.
|
|
129
|
+
|
|
130
|
+
Expose local ports to the internet via Cloudflare Tunnel (`cloudflared`). Creates temporary public URLs for local development servers, webhook testing, and demos.
|
|
131
|
+
|
|
132
|
+
- Expose a local dev server to the internet for webhook testing or demos
|
|
133
|
+
- Create temporary public URLs for sharing work-in-progress with teammates
|
|
134
|
+
- Set up tunnels for services like Telegram webhook mode that require public HTTPS
|
|
135
|
+
- Programmatically manage tunnel lifecycle (start, stop, get URL)
|
|
136
|
+
|
|
137
|
+
### [python](src/node/features/python.ts)
|
|
138
|
+
|
|
139
|
+
Python integration feature for running Python scripts, managing virtual environments, and calling Python functions from TypeScript.
|
|
140
|
+
|
|
141
|
+
- Run Python scripts from TypeScript with captured stdout/stderr
|
|
142
|
+
- Create and manage Python virtual environments with pip package installation
|
|
143
|
+
- Execute Python code inline and capture results
|
|
144
|
+
- Bridge Python and TypeScript for ML/AI workflows that need Python libraries
|
|
145
|
+
|
|
146
|
+
### [proc](src/node/features/proc.ts)
|
|
147
|
+
|
|
148
|
+
Process execution feature for running shell commands and capturing output. Provides both fire-and-forget execution (`exec`) and output-capturing execution (`execAndCapture`, `spawnAndCapture`).
|
|
149
|
+
|
|
150
|
+
- Run shell commands and capture stdout/stderr with `execAndCapture`
|
|
151
|
+
- Execute commands fire-and-forget style for side effects with `exec`
|
|
152
|
+
- Spawn processes with fine-grained control over stdio streams
|
|
153
|
+
- Run commands in specific directories with custom environment variables
|
|
154
|
+
|
|
155
|
+
### [repl](src/node/features/repl.ts)
|
|
156
|
+
|
|
157
|
+
REPL feature — provides an interactive read-eval-print loop with tab completion and history. Launches a REPL session that evaluates JavaScript/TypeScript expressions in a sandboxed VM context populated with the container and its helpers.
|
|
158
|
+
|
|
159
|
+
- Drop into an interactive REPL with full access to the container and all features
|
|
160
|
+
- Explore the container's API interactively with tab completion for property access
|
|
161
|
+
- Persist command history across sessions for rapid prototyping
|
|
162
|
+
- Inject custom variables into the REPL context for debugging
|
|
163
|
+
|
|
164
|
+
### [ui](src/node/features/ui.ts)
|
|
165
|
+
|
|
166
|
+
Terminal UI toolkit featuring ASCII art banners, color gradients, interactive wizards (prompts), and text formatting utilities. Powered by chalk, figlet, and inquirer.
|
|
167
|
+
|
|
168
|
+
- Create styled ASCII art banners with color gradients for CLI tool branding
|
|
169
|
+
- Build interactive setup wizards with multi-type prompts (input, list, confirm, checkbox)
|
|
170
|
+
- Apply horizontal/vertical color gradients to terminal text and ASCII art
|
|
171
|
+
- Open content in the user's `$EDITOR` for interactive editing (code, config, markdown)
|
|
172
|
+
|
|
173
|
+
### [vault](src/node/features/vault.ts)
|
|
174
|
+
|
|
175
|
+
The Vault feature provides encryption and decryption capabilities using AES-256-GCM. Manages secret keys and provides a simple interface for cryptographic operations.
|
|
176
|
+
|
|
177
|
+
- Encrypt sensitive data (API keys, tokens) before storing to disk or cache
|
|
178
|
+
- Decrypt previously encrypted payloads when needed at runtime
|
|
179
|
+
- Generate and manage encryption secret keys
|
|
180
|
+
- Pair with diskCache for an encrypted key-value store
|
|
181
|
+
|
|
182
|
+
### [vm](src/node/features/vm.ts)
|
|
183
|
+
|
|
184
|
+
The VM feature provides Node.js virtual machine capabilities for executing JavaScript code in isolated contexts. Wraps Node.js's built-in `vm` module for secure sandboxed execution.
|
|
185
|
+
|
|
186
|
+
- Execute untrusted or dynamic JavaScript code in a sandboxed context
|
|
187
|
+
- Run code with custom variables injected into the execution context
|
|
188
|
+
- Load JavaScript/TypeScript modules into isolated VM contexts with `loadModule`
|
|
189
|
+
- Create reusable compiled scripts for repeated execution with different inputs
|
|
190
|
+
|
|
191
|
+
### [yamlTree](src/node/features/yaml-tree.ts)
|
|
192
|
+
|
|
193
|
+
Recursively loads YAML files from a directory structure and builds a hierarchical tree representation. Supports both `.yml` and `.yaml` extensions with automatic camelCase path conversion.
|
|
194
|
+
|
|
195
|
+
- Load a directory of YAML config files into a single queryable tree object
|
|
196
|
+
- Build hierarchical configuration from nested YAML file structures
|
|
197
|
+
- Access configuration values using dot-notation paths derived from file paths
|
|
198
|
+
- Hot-reload configuration by re-running `loadTree` when files change
|
|
199
|
+
|
|
200
|
+
### [yaml](src/node/features/yaml.ts)
|
|
201
|
+
|
|
202
|
+
YAML parsing and serialization utilities. Wraps the js-yaml library to provide convenient `parse` and `dump` methods for converting between YAML strings and JavaScript objects.
|
|
203
|
+
|
|
204
|
+
- Parse YAML strings into JavaScript objects
|
|
205
|
+
- Serialize JavaScript objects into YAML strings
|
|
206
|
+
- Convert between YAML and JSON formats
|
|
207
|
+
- Read and parse YAML configuration files
|
|
208
|
+
|
|
209
|
+
### [docker](src/node/features/docker.ts)
|
|
210
|
+
|
|
211
|
+
Docker container management feature for building, running, and managing Docker containers programmatically. Supports image management, container lifecycle, volume mounts, shell sessions inside containers, and Dockerfile generation.
|
|
212
|
+
|
|
213
|
+
- Build Docker images from Dockerfiles and manage the image lifecycle
|
|
214
|
+
- Run containers with port mapping, volume mounts, and environment variables
|
|
215
|
+
- Open interactive shell sessions inside running containers with `createShell`
|
|
216
|
+
- Execute commands inside running containers and capture output
|
|
217
|
+
|
|
218
|
+
### [runpod](src/node/features/runpod.ts)
|
|
219
|
+
|
|
220
|
+
RunPod feature — manage GPU cloud pods, templates, volumes, and SSH connections via the RunPod REST API. Provides a complete interface for provisioning and managing RunPod GPU instances.
|
|
221
|
+
|
|
222
|
+
- Provision GPU pods from templates for ML training or inference workloads
|
|
223
|
+
- Manage network storage volumes for persistent data across pod lifecycles
|
|
224
|
+
- SSH into running pods and transfer files using the integrated SecureShell feature
|
|
225
|
+
- Poll pod readiness and automate the full pod lifecycle (create, wait, use, destroy)
|
|
226
|
+
|
|
227
|
+
### [secureShell](src/node/features/secure-shell.ts)
|
|
228
|
+
|
|
229
|
+
SSH client feature for remote command execution and file transfer. Wraps ssh2 to provide a high-level interface for connecting to remote servers, running commands, and transferring files.
|
|
230
|
+
|
|
231
|
+
- Execute commands on remote servers over SSH and capture output
|
|
232
|
+
- Upload and download files to/from remote servers via SFTP
|
|
233
|
+
- Test SSH connectivity before running remote operations
|
|
234
|
+
- Automate deployment scripts that run commands on production servers
|
|
235
|
+
|
|
236
|
+
### [tmux](src/node/features/tmux.ts)
|
|
237
|
+
|
|
238
|
+
Terminal multiplexer feature that wraps tmux to provide programmatic control over terminal panes. Allows scripts to split the terminal into multiple panes, run commands in each pane with process handles, and collapse everything back when done.
|
|
239
|
+
|
|
240
|
+
- Split the terminal into multiple panes and run parallel commands visually
|
|
241
|
+
- Monitor long-running processes (tests, builds, servers) in separate panes
|
|
242
|
+
- Programmatically send keystrokes and capture pane output
|
|
243
|
+
- Build dashboards that display multiple process outputs simultaneously
|
|
244
|
+
|
|
245
|
+
### [ink](src/node/features/ink.ts)
|
|
246
|
+
|
|
247
|
+
React-powered Terminal UI via Ink. Exposes the Ink library (React for CLIs) so any feature or script can build rich terminal user interfaces using React components rendered directly in the terminal.
|
|
248
|
+
|
|
249
|
+
- Build interactive CLI applications with React components (Box, Text, Spacer)
|
|
250
|
+
- Create real-time updating terminal UIs for monitoring and dashboards
|
|
251
|
+
- Use React hooks (useState, useEffect, useInput) for terminal interactivity
|
|
252
|
+
- Render animated spinners, progress bars, and tables in the terminal
|
|
253
|
+
|
|
254
|
+
### [telegram](src/node/features/telegram.ts)
|
|
255
|
+
|
|
256
|
+
Telegram bot feature powered by grammY. Supports both long-polling and webhook modes. Exposes the grammY Bot instance directly for full API access while bridging events to Luca's event bus.
|
|
257
|
+
|
|
258
|
+
- Create a Telegram bot that responds to commands and messages
|
|
259
|
+
- Run the bot in long-polling mode for development or webhook mode for production
|
|
260
|
+
- Register command handlers and grammY middleware for message processing
|
|
261
|
+
- Bridge Telegram events to the container's event bus for integration with other features
|
|
262
|
+
|
|
263
|
+
### [opener](src/node/features/opener.ts)
|
|
264
|
+
|
|
265
|
+
Opens files, URLs, desktop applications, and code editors. HTTP/HTTPS URLs open in Chrome, desktop apps launch by name, and VS Code/Cursor can open to a specific path.
|
|
266
|
+
|
|
267
|
+
- Open URLs in Chrome from scripts or automation workflows
|
|
268
|
+
- Launch desktop applications by name (Slack, Finder, Safari)
|
|
269
|
+
- Open project directories in VS Code or Cursor from the command line
|
|
270
|
+
- Open files with the system default handler (images in Preview, etc.)
|
|
271
|
+
|
|
272
|
+
### [postgres](src/node/features/postgres.ts)
|
|
273
|
+
|
|
274
|
+
Postgres feature for safe SQL execution through Bun's native SQL client. Supports parameterized queries, tagged-template SQL, and connection lifecycle management.
|
|
275
|
+
|
|
276
|
+
- Execute parameterized SELECT queries and get typed result rows
|
|
277
|
+
- Run INSERT/UPDATE/DELETE statements with row count feedback
|
|
278
|
+
- Use tagged template literals for safe SQL interpolation (prevents injection)
|
|
279
|
+
- Manage connection lifecycle with events for monitoring query activity
|
|
280
|
+
|
|
281
|
+
### [sqlite](src/node/features/sqlite.ts)
|
|
282
|
+
|
|
283
|
+
SQLite feature for safe SQL execution through Bun's native sqlite binding. Supports parameterized queries, tagged-template SQL, and in-memory databases.
|
|
284
|
+
|
|
285
|
+
- Create and query local SQLite databases for embedded data storage
|
|
286
|
+
- Use tagged template literals for safe SQL interpolation (prevents injection)
|
|
287
|
+
- Run in-memory databases for testing and ephemeral data processing
|
|
288
|
+
- Execute DDL and DML statements with change tracking and row count feedback
|
|
289
|
+
|
|
290
|
+
### [googleAuth](src/node/features/google-auth.ts)
|
|
291
|
+
|
|
292
|
+
Google OAuth2 authentication feature. Manages OAuth2 token lifecycle including authorization URL generation, token exchange, automatic refresh, and persistent token storage via diskCache.
|
|
293
|
+
|
|
294
|
+
- Authenticate with Google APIs using OAuth2 with automatic token refresh
|
|
295
|
+
- Generate authorization URLs for the OAuth2 consent flow
|
|
296
|
+
- Persist and restore OAuth2 tokens across process restarts via diskCache
|
|
297
|
+
- Provide authenticated API clients to other Google features (Drive, Sheets, Docs)
|
|
298
|
+
|
|
299
|
+
### [googleDrive](src/node/features/google-drive.ts)
|
|
300
|
+
|
|
301
|
+
Google Drive feature for file and folder management. Supports listing, searching, creating folders, uploading, downloading, and deleting files via the Drive API.
|
|
302
|
+
|
|
303
|
+
- List and search files in Google Drive by name, type, or folder
|
|
304
|
+
- Upload local files to Google Drive with metadata
|
|
305
|
+
- Download files from Google Drive to local disk
|
|
306
|
+
- Create folders and manage Drive file hierarchy programmatically
|
|
307
|
+
|
|
308
|
+
### [googleSheets](src/node/features/google-sheets.ts)
|
|
309
|
+
|
|
310
|
+
Google Sheets feature for reading and writing spreadsheet data. Provides a high-level interface for cell/range operations, row appending, sheet management, and batch updates.
|
|
311
|
+
|
|
312
|
+
- Read and write cell ranges in Google Sheets programmatically
|
|
313
|
+
- Append rows of data to spreadsheets for logging or data collection
|
|
314
|
+
- Create new sheets and manage spreadsheet structure
|
|
315
|
+
- Batch-update multiple ranges in a single API call for performance
|
|
316
|
+
|
|
317
|
+
### [googleCalendar](src/node/features/google-calendar.ts)
|
|
318
|
+
|
|
319
|
+
Google Calendar feature for reading and managing calendar events. Supports listing calendars, querying events by time range, creating/updating/deleting events, and freetext search.
|
|
320
|
+
|
|
321
|
+
- List calendars and query today's or upcoming events
|
|
322
|
+
- Create, update, and delete calendar events programmatically
|
|
323
|
+
- Search events by freetext query across summaries and descriptions
|
|
324
|
+
- Build calendar-aware automation (e.g. daily briefings, scheduling bots)
|
|
325
|
+
|
|
326
|
+
### [googleDocs](src/node/features/google-docs.ts)
|
|
327
|
+
|
|
328
|
+
Google Docs feature for reading documents and converting them to Markdown. Handles headings, text formatting, links, lists, tables, and images.
|
|
329
|
+
|
|
330
|
+
- Read Google Docs and convert to Markdown for local processing
|
|
331
|
+
- Extract plain text from documents for NLP or search indexing
|
|
332
|
+
- Save Google Docs as local Markdown files for documentation workflows
|
|
333
|
+
- List and search Google Docs in Drive for programmatic access
|
|
334
|
+
|
|
335
|
+
### [windowManager](src/node/features/window-manager.ts)
|
|
336
|
+
|
|
337
|
+
Native window control via LucaVoiceLauncher IPC. Communicates over a Unix domain socket using NDJSON to spawn, navigate, focus, close, eval JavaScript in, and screenshot native browser windows.
|
|
338
|
+
|
|
339
|
+
- Spawn native browser windows with configurable chrome (decorations, transparency, always-on-top)
|
|
340
|
+
- Navigate, focus, close, and evaluate JavaScript in managed windows
|
|
341
|
+
- Capture screenshots and record video from window contents
|
|
342
|
+
- Spawn native terminal windows running commands with ANSI support
|
|
343
|
+
|
|
344
|
+
### [launcherAppCommandListener](src/node/features/launcher-app-command-listener.ts)
|
|
345
|
+
|
|
346
|
+
IPC transport for commands from the LucaVoiceLauncher app. Listens on a Unix domain socket for the native macOS launcher app to connect and dispatches voice/hotkey/text commands as `CommandHandle` events.
|
|
347
|
+
|
|
348
|
+
- Listen for voice commands from the native macOS launcher app
|
|
349
|
+
- Acknowledge, track progress, and finish command processing via the handle API
|
|
350
|
+
- Bridge voice/hotkey input to container feature actions
|
|
351
|
+
- Build voice-controlled automation workflows
|
|
352
|
+
|
|
353
|
+
### [nlp](src/node/features/nlp.ts)
|
|
354
|
+
|
|
355
|
+
Natural language processing utilities combining compromise (verb normalization, POS patterns) and wink-nlp (high-accuracy POS tagging, NER). Three levels of detail: `parse`, `analyze`, `understand`.
|
|
356
|
+
|
|
357
|
+
- Parse voice commands into structured intent/target/subject for command dispatch
|
|
358
|
+
- Extract named entities (people, times, places) from natural language input
|
|
359
|
+
- Normalize verb forms to infinitives for consistent intent matching
|
|
360
|
+
- Combine POS tagging with intent parsing for full utterance understanding
|
|
361
|
+
|
|
362
|
+
### [processManager](src/node/features/process-manager.ts)
|
|
363
|
+
|
|
364
|
+
Manages long-running child processes with tracking, events, and automatic cleanup. Unlike `proc`, returns a SpawnHandler immediately with its own state, events, and lifecycle methods.
|
|
365
|
+
|
|
366
|
+
- Spawn and track multiple long-running processes (servers, watchers, build tools)
|
|
367
|
+
- Monitor process stdout/stderr in real-time via event handlers
|
|
368
|
+
- Tag processes for easy lookup and management (`getByTag`)
|
|
369
|
+
- Automatically kill all tracked processes on parent exit for clean shutdown
|
|
370
|
+
|
|
371
|
+
### [tts](src/node/features/tts.ts)
|
|
372
|
+
|
|
373
|
+
TTS feature — synthesizes text to audio files via RunPod's Chatterbox Turbo endpoint. Supports 20 preset voices and voice cloning via a reference audio URL.
|
|
374
|
+
|
|
375
|
+
- Generate speech audio files from text using 20 preset voices
|
|
376
|
+
- Clone a custom voice by providing a reference audio URL
|
|
377
|
+
- Save generated audio in WAV, FLAC, or OGG formats
|
|
378
|
+
- Build voice-enabled applications and voice command feedback systems
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
tags:
|
|
3
|
+
- mcp
|
|
4
|
+
- testing
|
|
5
|
+
- scaffolding
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Problem
|
|
9
|
+
|
|
10
|
+
The luca MCP server (`luca sandbox-mcp`) had 5 introspection tools that Claude Code rarely used. When given tasks in luca projects, Claude Code would default to vanilla Node.js patterns — importing `fs`, `path`, installing npm packages — instead of using the container. The MCP wasn't teaching Claude Code *how* to work in the luca ecosystem.
|
|
11
|
+
|
|
12
|
+
The root cause: tool descriptions were informational but not prescriptive. They described what the tools do, but didn't tell Claude Code *when* to use them or *what workflow to follow*.
|
|
13
|
+
|
|
14
|
+
## What We Changed
|
|
15
|
+
|
|
16
|
+
### New MCP Tools
|
|
17
|
+
|
|
18
|
+
| Tool | Purpose | Why It Matters |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| `read_me` | Returns the behavioral contract — import rules, capability map, workflow | Gives Claude Code the "rules of the road" at session start. Verbose description tells it to call this BEFORE writing code. |
|
|
21
|
+
| `find_capability` | Returns full catalog of all features/clients/servers with descriptions | Single call that shows everything the container provides. Prevents the "I don't know what's available so I'll use npm" failure mode. |
|
|
22
|
+
| `scaffold` | Generates convention-correct boilerplate for any helper type | Eliminates guessing at patterns. Output includes schemas, JSDoc, module augmentation, registration — all the pieces Claude Code would otherwise get wrong. |
|
|
23
|
+
|
|
24
|
+
### Improved Existing Tools
|
|
25
|
+
|
|
26
|
+
- **`eval`**: Added "Use this to prototype and test container API calls before writing them into files" to the description
|
|
27
|
+
- **`describe_helper`**: Added "This is the API documentation — there is no other documentation available" to make it the authoritative source
|
|
28
|
+
- **`inspect_helper_instance`**: Added "Use this to inspect a live, running instance" to distinguish from static docs
|
|
29
|
+
|
|
30
|
+
### Scaffold System
|
|
31
|
+
|
|
32
|
+
Created `docs/scaffolds/` with tutorial+template markdown files for each helper type:
|
|
33
|
+
- `feature.md`, `client.md`, `server.md`, `command.md`, `endpoint.md`
|
|
34
|
+
|
|
35
|
+
Each scaffold:
|
|
36
|
+
- Explains WHY each section exists (for human learning)
|
|
37
|
+
- Uses `{{PascalName}}`, `{{camelName}}`, `{{description}}` template variables
|
|
38
|
+
- Includes a "Complete Example" that becomes the scaffold output
|
|
39
|
+
- Lists conventions and common mistakes
|
|
40
|
+
|
|
41
|
+
Build pipeline: `luca build-scaffolds` reads the markdown, extracts code blocks, generates `src/scaffolds/generated.ts`. This is imported by `sandbox-mcp.ts` and baked into the binary.
|
|
42
|
+
|
|
43
|
+
### z Re-export
|
|
44
|
+
|
|
45
|
+
Added `export { z } from 'zod'` to `src/node.ts` so consumer code can write `import { z } from '@soederpop/luca'` without needing zod installed.
|
|
46
|
+
|
|
47
|
+
### CLI Command
|
|
48
|
+
|
|
49
|
+
`luca scaffold <type> <name>` also available from the terminal, not just the MCP. Supports `--output` to write directly to a file and `--tutorial` to show the full teaching doc.
|
|
50
|
+
|
|
51
|
+
## Design Principles
|
|
52
|
+
|
|
53
|
+
1. **Prescriptive over informational** — Tool descriptions tell Claude Code exactly when and why to call each tool, not just what it returns
|
|
54
|
+
2. **One call to orient** — `read_me` + `find_capability` in two calls gives a complete picture. No need to explore incrementally.
|
|
55
|
+
3. **Correct by construction** — `scaffold` output is valid, convention-following code. The LLM fills in implementation, not boilerplate.
|
|
56
|
+
4. **Source of truth in markdown** — Scaffold templates live in `docs/scaffolds/*.md` as human-readable tutorials. The build script extracts code. One source, two consumers.
|
|
57
|
+
|
|
58
|
+
## Testing Approach
|
|
59
|
+
|
|
60
|
+
### Test Harness
|
|
61
|
+
|
|
62
|
+
Located in `playground/mcp-test/`. Simulates a consumer project:
|
|
63
|
+
- `.mcp.json` pointing at `luca sandbox-mcp`
|
|
64
|
+
- Minimal `CLAUDE.md` saying "this is a luca project, use the MCP"
|
|
65
|
+
- No luca source to read — the MCP is the only interface
|
|
66
|
+
|
|
67
|
+
### Challenges (Progressive Difficulty)
|
|
68
|
+
|
|
69
|
+
| # | Challenge | What It Tests |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| 01 | Build a `greet` command | Basic: Does it use the command pattern? Correct imports? |
|
|
72
|
+
| 02 | Build a `stopwatch` feature | Medium: Schemas, state, events, JSDoc, module augmentation |
|
|
73
|
+
| 03 | Build a todo REST API with endpoints | Hard: File-based routing, Zod validation, endpoint conventions |
|
|
74
|
+
| 04 | Build a REST client + command that uses it | Expert: Client pattern, cross-helper composition |
|
|
75
|
+
|
|
76
|
+
### Workflow
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
# 1. Run a challenge (Claude Code session in the test folder)
|
|
80
|
+
luca run-test --challenge 01-easy-command --clean
|
|
81
|
+
|
|
82
|
+
# 2. Review the output (separate Claude Code session grades it)
|
|
83
|
+
luca run-test --challenge 01-easy-command --review
|
|
84
|
+
|
|
85
|
+
# 3. Read the review
|
|
86
|
+
cat output/review-01-easy-command.md
|
|
87
|
+
|
|
88
|
+
# 4. Apply MCP improvements based on findings
|
|
89
|
+
# Edit docs/mcp/readme.md, docs/scaffolds/*.md, or tool descriptions
|
|
90
|
+
|
|
91
|
+
# 5. Rebuild scaffolds
|
|
92
|
+
luca build-scaffolds
|
|
93
|
+
|
|
94
|
+
# 6. Re-run the same challenge to see if improvements helped
|
|
95
|
+
luca run-test --challenge 01-easy-command --clean
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Grading Criteria
|
|
99
|
+
|
|
100
|
+
Each review evaluates:
|
|
101
|
+
- **Import compliance** — Only `@soederpop/luca` imports, no Node builtins, no npm
|
|
102
|
+
- **Pattern compliance** — Correct base class, schemas, static properties, registration
|
|
103
|
+
- **Convention compliance** — `.describe()` on Zod fields, JSDoc, naming conventions
|
|
104
|
+
- **MCP tool usage** — Did it call `read_me` first? Use `scaffold`? Use `find_capability`?
|
|
105
|
+
|
|
106
|
+
### Success Criteria
|
|
107
|
+
|
|
108
|
+
The MCP is "done" when:
|
|
109
|
+
1. All four challenges pass import + pattern compliance on the first run
|
|
110
|
+
2. Claude Code calls `read_me` and at least one discovery tool before writing code
|
|
111
|
+
3. The generated code could be copy-pasted into any luca project and work
|
|
112
|
+
|
|
113
|
+
## Files Created/Modified
|
|
114
|
+
|
|
115
|
+
### New files
|
|
116
|
+
- `docs/mcp/readme.md` — Behavioral contract
|
|
117
|
+
- `docs/scaffolds/{feature,client,server,command,endpoint}.md` — Scaffold templates
|
|
118
|
+
- `commands/build-scaffolds.ts` — Build script
|
|
119
|
+
- `src/scaffolds/generated.ts` — Generated template data
|
|
120
|
+
- `src/scaffolds/template.ts` — Shared template helpers
|
|
121
|
+
- `src/commands/scaffold.ts` — CLI scaffold command
|
|
122
|
+
- `playground/mcp-test/` — End-to-end test harness
|
|
123
|
+
|
|
124
|
+
### Modified files
|
|
125
|
+
- `src/commands/sandbox-mcp.ts` — Added 3 tools, improved descriptions
|
|
126
|
+
- `src/commands/index.ts` — Registered scaffold command
|
|
127
|
+
- `src/node.ts` — Added z re-export
|
|
128
|
+
- `package.json` — Added build:scaffolds to pipeline
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Building a Client
|
|
2
|
+
|
|
3
|
+
A client is a container-managed connection to an external service. Clients handle network communication — HTTP APIs, WebSocket connections, GraphQL endpoints. They extend `RestClient` (for HTTP), `WebSocketClient` (for WS), or the base `Client` class.
|
|
4
|
+
|
|
5
|
+
When to build a client:
|
|
6
|
+
- You need to talk to an external API or service
|
|
7
|
+
- You want connection management, error handling, and observability for free
|
|
8
|
+
- You're wrapping an API so the rest of the codebase uses `container.client('name')`
|
|
9
|
+
|
|
10
|
+
## Imports
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { z } from 'zod'
|
|
14
|
+
import { Client, clients, RestClient } from '@soederpop/luca/client'
|
|
15
|
+
import { ClientStateSchema, ClientOptionsSchema, ClientEventsSchema } from '@soederpop/luca'
|
|
16
|
+
import type { ContainerContext } from '@soederpop/luca'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Use `RestClient` for HTTP APIs (most common). It gives you `get`, `post`, `put`, `patch`, `delete` methods that handle JSON, headers, and error wrapping.
|
|
20
|
+
|
|
21
|
+
## Schemas
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
export const {{PascalName}}StateSchema = ClientStateSchema.extend({
|
|
25
|
+
// Add your state fields here.
|
|
26
|
+
// Example: authenticated: z.boolean().default(false).describe('Whether API auth is configured'),
|
|
27
|
+
})
|
|
28
|
+
export type {{PascalName}}State = z.infer<typeof {{PascalName}}StateSchema>
|
|
29
|
+
|
|
30
|
+
export const {{PascalName}}OptionsSchema = ClientOptionsSchema.extend({
|
|
31
|
+
// Add constructor options here.
|
|
32
|
+
// Example: apiKey: z.string().optional().describe('API key for authentication'),
|
|
33
|
+
})
|
|
34
|
+
export type {{PascalName}}Options = z.infer<typeof {{PascalName}}OptionsSchema>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Class
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
/**
|
|
41
|
+
* {{description}}
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const {{camelName}} = container.client('{{camelName}}')
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @extends RestClient
|
|
49
|
+
*/
|
|
50
|
+
export class {{PascalName}} extends RestClient<{{PascalName}}State, {{PascalName}}Options> {
|
|
51
|
+
static override shortcut = 'clients.{{camelName}}' as const
|
|
52
|
+
static override stateSchema = {{PascalName}}StateSchema
|
|
53
|
+
static override optionsSchema = {{PascalName}}OptionsSchema
|
|
54
|
+
static override description = '{{description}}'
|
|
55
|
+
|
|
56
|
+
constructor(options: {{PascalName}}Options, context: ContainerContext) {
|
|
57
|
+
options = {
|
|
58
|
+
...options,
|
|
59
|
+
baseURL: options.baseURL || 'https://api.example.com',
|
|
60
|
+
}
|
|
61
|
+
super(options, context)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Add API methods here. Each wraps an endpoint.
|
|
65
|
+
// Example:
|
|
66
|
+
// async listItems(): Promise<Item[]> {
|
|
67
|
+
// return this.get('/items')
|
|
68
|
+
// }
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Module Augmentation
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
declare module '@soederpop/luca/client' {
|
|
76
|
+
interface AvailableClients {
|
|
77
|
+
{{camelName}}: typeof {{PascalName}}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Registration
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
export default clients.register('{{camelName}}', {{PascalName}})
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Complete Example
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
import { z } from 'zod'
|
|
92
|
+
import { clients, RestClient } from '@soederpop/luca/client'
|
|
93
|
+
import { ClientStateSchema, ClientOptionsSchema } from '@soederpop/luca'
|
|
94
|
+
import type { ContainerContext } from '@soederpop/luca'
|
|
95
|
+
|
|
96
|
+
declare module '@soederpop/luca/client' {
|
|
97
|
+
interface AvailableClients {
|
|
98
|
+
{{camelName}}: typeof {{PascalName}}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export const {{PascalName}}StateSchema = ClientStateSchema.extend({})
|
|
103
|
+
export type {{PascalName}}State = z.infer<typeof {{PascalName}}StateSchema>
|
|
104
|
+
|
|
105
|
+
export const {{PascalName}}OptionsSchema = ClientOptionsSchema.extend({
|
|
106
|
+
baseURL: z.string().default('https://api.example.com').describe('API base URL'),
|
|
107
|
+
})
|
|
108
|
+
export type {{PascalName}}Options = z.infer<typeof {{PascalName}}OptionsSchema>
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* {{description}}
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```typescript
|
|
115
|
+
* const {{camelName}} = container.client('{{camelName}}')
|
|
116
|
+
* ```
|
|
117
|
+
*
|
|
118
|
+
* @extends RestClient
|
|
119
|
+
*/
|
|
120
|
+
export class {{PascalName}} extends RestClient<{{PascalName}}State, {{PascalName}}Options> {
|
|
121
|
+
static override shortcut = 'clients.{{camelName}}' as const
|
|
122
|
+
static override stateSchema = {{PascalName}}StateSchema
|
|
123
|
+
static override optionsSchema = {{PascalName}}OptionsSchema
|
|
124
|
+
static override description = '{{description}}'
|
|
125
|
+
|
|
126
|
+
constructor(options: {{PascalName}}Options, context: ContainerContext) {
|
|
127
|
+
super({ ...options, baseURL: options.baseURL }, context)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export default clients.register('{{camelName}}', {{PascalName}})
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Conventions
|
|
135
|
+
|
|
136
|
+
- **Extend RestClient for HTTP**: It gives you typed HTTP methods. Only use base `Client` if you need a non-HTTP protocol.
|
|
137
|
+
- **Set baseURL in constructor**: Override options to hardcode or default the API base URL.
|
|
138
|
+
- **Wrap endpoints as methods**: Each API endpoint gets a method. Keep them thin — just map to HTTP calls.
|
|
139
|
+
- **JSDoc everything**: Every public method needs `@param`, `@returns`, `@example`.
|
|
140
|
+
- **Auth in options**: Pass API keys, tokens via options schema. Check them in the constructor or a setup method.
|