@soederpop/luca 0.0.23 → 0.0.26

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.
Files changed (67) hide show
  1. package/AGENTS.md +1 -1
  2. package/CLAUDE.md +6 -1
  3. package/assistants/codingAssistant/hooks.ts +0 -1
  4. package/assistants/lucaExpert/CORE.md +37 -0
  5. package/assistants/lucaExpert/hooks.ts +9 -0
  6. package/assistants/lucaExpert/tools.ts +177 -0
  7. package/commands/build-bootstrap.ts +41 -1
  8. package/docs/TABLE-OF-CONTENTS.md +0 -1
  9. package/docs/apis/clients/rest.md +5 -5
  10. package/docs/apis/features/agi/assistant.md +1 -1
  11. package/docs/apis/features/agi/conversation-history.md +6 -7
  12. package/docs/apis/features/agi/conversation.md +1 -1
  13. package/docs/apis/features/agi/semantic-search.md +1 -1
  14. package/docs/bootstrap/CLAUDE.md +1 -1
  15. package/docs/bootstrap/SKILL.md +7 -3
  16. package/docs/bootstrap/templates/luca-cli.ts +5 -0
  17. package/docs/mcp/readme.md +1 -1
  18. package/docs/tutorials/00-bootstrap.md +18 -0
  19. package/package.json +2 -2
  20. package/scripts/stamp-build.sh +12 -0
  21. package/scripts/test-docs-reader.ts +10 -0
  22. package/src/agi/container.server.ts +8 -5
  23. package/src/agi/features/assistant.ts +210 -55
  24. package/src/agi/features/assistants-manager.ts +138 -66
  25. package/src/agi/features/conversation.ts +46 -14
  26. package/src/agi/features/docs-reader.ts +166 -0
  27. package/src/agi/features/openapi.ts +1 -1
  28. package/src/agi/features/skills-library.ts +257 -313
  29. package/src/bootstrap/generated.ts +8163 -6
  30. package/src/cli/build-info.ts +4 -0
  31. package/src/cli/cli.ts +2 -1
  32. package/src/command.ts +75 -0
  33. package/src/commands/bootstrap.ts +16 -1
  34. package/src/commands/describe.ts +29 -1089
  35. package/src/commands/eval.ts +6 -1
  36. package/src/commands/sandbox-mcp.ts +17 -7
  37. package/src/container-describer.ts +1098 -0
  38. package/src/container.ts +11 -0
  39. package/src/helper.ts +56 -2
  40. package/src/introspection/generated.agi.ts +1684 -799
  41. package/src/introspection/generated.node.ts +964 -572
  42. package/src/introspection/generated.web.ts +9 -1
  43. package/src/node/container.ts +1 -1
  44. package/src/node/features/content-db.ts +268 -13
  45. package/src/node/features/fs.ts +18 -0
  46. package/src/node/features/git.ts +90 -0
  47. package/src/node/features/grep.ts +1 -1
  48. package/src/node/features/proc.ts +1 -0
  49. package/src/node/features/tts.ts +1 -1
  50. package/src/node/features/vm.ts +48 -0
  51. package/src/scaffolds/generated.ts +2 -2
  52. package/src/server.ts +40 -0
  53. package/src/servers/express.ts +2 -0
  54. package/src/servers/mcp.ts +1 -0
  55. package/src/servers/socket.ts +2 -0
  56. package/assistants/architect/CORE.md +0 -3
  57. package/assistants/architect/hooks.ts +0 -3
  58. package/assistants/architect/tools.ts +0 -10
  59. package/docs/apis/features/agi/skills-library.md +0 -234
  60. package/docs/reports/assistant-bugs.md +0 -38
  61. package/docs/reports/attach-pattern-usage.md +0 -18
  62. package/docs/reports/code-audit-results.md +0 -391
  63. package/docs/reports/console-hmr-design.md +0 -170
  64. package/docs/reports/helper-semantic-search.md +0 -72
  65. package/docs/reports/introspection-audit-tasks.md +0 -378
  66. package/docs/reports/luca-mcp-improvements.md +0 -128
  67. package/test-integration/skills-library.test.ts +0 -157
@@ -0,0 +1,4 @@
1
+ // Generated at compile time — do not edit manually
2
+ export const BUILD_SHA = '4f7677c'
3
+ export const BUILD_BRANCH = 'main'
4
+ export const BUILD_DATE = '2026-03-22T20:57:24Z'
package/src/cli/cli.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  #!/usr/bin/env bun
2
2
  // @ts-ignore — bun resolves JSON imports at bundle time
3
3
  import pkg from '../../package.json'
4
+ import { BUILD_SHA, BUILD_BRANCH, BUILD_DATE } from './build-info'
4
5
 
5
6
  // Fast-path flags that don't need the container
6
7
  const args = process.argv.slice(2)
7
8
  if (args.includes('--version') || args.includes('-v')) {
8
- console.log(`luca v${pkg.version}`)
9
+ console.log(`luca v${pkg.version} (${BUILD_BRANCH}@${BUILD_SHA}) built ${BUILD_DATE}`)
9
10
  console.log(` npm: https://www.npmjs.com/package/@soederpop/luca`)
10
11
  console.log(` git: https://github.com/soederpop/luca`)
11
12
  process.exit(0)
package/src/command.ts CHANGED
@@ -266,6 +266,81 @@ export class CommandsRegistry extends Registry<Command<any>> {
266
266
  override scope = 'commands'
267
267
  override baseClass = Command as any
268
268
 
269
+ /**
270
+ * Convert all registered commands into a `{ schemas, handlers }` object
271
+ * compatible with `assistant.use()`.
272
+ *
273
+ * Each command becomes a tool whose parameters come from the command's
274
+ * `argsSchema` (with internal CLI fields stripped) and whose handler
275
+ * dispatches the command headlessly, returning `{ exitCode, stdout, stderr }`.
276
+ *
277
+ * @param container - The container used to instantiate and dispatch commands
278
+ * @param options - Optional filter/transform options
279
+ * @param options.include - Only include these command names (default: all)
280
+ * @param options.exclude - Exclude these command names (default: none)
281
+ * @param options.prefix - Prefix tool names (e.g. 'luca_' → 'luca_eval')
282
+ */
283
+ toTools(
284
+ container: Container<any> & CommandsInterface,
285
+ options?: { include?: string[], exclude?: string[], prefix?: string },
286
+ ): { schemas: Record<string, z.ZodType>, handlers: Record<string, Function> } {
287
+ const schemas: Record<string, z.ZodType> = {}
288
+ const handlers: Record<string, Function> = {}
289
+ const prefix = options?.prefix ?? ''
290
+ const includeSet = options?.include ? new Set(options.include) : null
291
+ const excludeSet = new Set(options?.exclude ?? [])
292
+
293
+ // Internal fields inherited from HelperOptionsSchema / CommandOptionsSchema
294
+ const internalFields = ['_', 'dispatchSource', 'name', '_cacheKey']
295
+
296
+ for (const name of this.available) {
297
+ if (excludeSet.has(name)) continue
298
+ if (includeSet && !includeSet.has(name)) continue
299
+
300
+ const Cmd = this.lookup(name) as typeof Command
301
+ const rawSchema = Cmd.argsSchema
302
+ const description = Cmd.commandDescription || Cmd.description || name
303
+
304
+ // Build a clean schema by stripping internal CLI fields from the argsSchema.
305
+ // If the schema is a ZodObject we can use .omit(), otherwise create a
306
+ // virtual passthrough schema so the tool still flows through.
307
+ let toolSchema: z.ZodType
308
+ try {
309
+ const shape = typeof (rawSchema as any)?._def?.shape === 'function'
310
+ ? (rawSchema as any)._def.shape()
311
+ : (rawSchema as any)?._def?.shape
312
+
313
+ if (shape) {
314
+ // Build a new object schema omitting internal fields
315
+ const cleanShape: Record<string, z.ZodType> = {}
316
+ for (const [key, val] of Object.entries(shape)) {
317
+ if (internalFields.includes(key)) continue
318
+ cleanShape[key] = val as z.ZodType
319
+ }
320
+
321
+ toolSchema = Object.keys(cleanShape).length > 0
322
+ ? z.object(cleanShape).describe(description)
323
+ : z.object({}).describe(description)
324
+ } else {
325
+ // Not a ZodObject — wrap as passthrough
326
+ toolSchema = z.object({}).describe(description)
327
+ }
328
+ } catch {
329
+ toolSchema = z.object({}).describe(description)
330
+ }
331
+
332
+ const toolName = `${prefix}${name}`
333
+ schemas[toolName] = toolSchema
334
+ handlers[toolName] = async (args: Record<string, any>) => {
335
+ const cmd = container.command(name as any)
336
+ const result = await cmd.dispatch(args ?? {}, 'headless')
337
+ return result ?? { exitCode: 0, stdout: '', stderr: '' }
338
+ }
339
+ }
340
+
341
+ return { schemas, handlers }
342
+ }
343
+
269
344
  /**
270
345
  * Internal: register a command from a handler function.
271
346
  * Used by built-in commands. External commands should use the module export pattern.
@@ -2,7 +2,7 @@ import { z } from 'zod'
2
2
  import { commands } from '../command.js'
3
3
  import { CommandOptionsSchema } from '../schemas/base.js'
4
4
  import type { ContainerContext } from '../container.js'
5
- import { bootstrapFiles, bootstrapTemplates } from '../bootstrap/generated.js'
5
+ import { bootstrapFiles, bootstrapTemplates, bootstrapExamples, bootstrapTutorials } from '../bootstrap/generated.js'
6
6
  import { apiDocs } from './save-api-docs.js'
7
7
  import { generateScaffold } from '../scaffolds/template.js'
8
8
 
@@ -52,6 +52,21 @@ async function bootstrap(options: z.infer<typeof argsSchema>, context: Container
52
52
  const apiDocsPath = container.paths.resolve(skillDir, 'references', 'api-docs')
53
53
  await apiDocs({ _: [], outputPath: apiDocsPath }, context)
54
54
 
55
+ // ── 3b. examples and tutorials ─────────────────────────────────
56
+ const examplesDir = container.paths.resolve(skillDir, 'references', 'examples')
57
+ await fs.ensureFolder(examplesDir)
58
+ for (const [filename, content] of Object.entries(bootstrapExamples)) {
59
+ await fs.writeFileAsync(container.paths.resolve(examplesDir, filename), content)
60
+ }
61
+ ui.print.cyan(` Writing ${Object.keys(bootstrapExamples).length} example docs...`)
62
+
63
+ const tutorialsDir = container.paths.resolve(skillDir, 'references', 'tutorials')
64
+ await fs.ensureFolder(tutorialsDir)
65
+ for (const [filename, content] of Object.entries(bootstrapTutorials)) {
66
+ await fs.writeFileAsync(container.paths.resolve(tutorialsDir, filename), content)
67
+ }
68
+ ui.print.cyan(` Writing ${Object.keys(bootstrapTutorials).length} tutorial docs...`)
69
+
55
70
  // ── 4. docs/ folder ────────────────────────────────────────────
56
71
  await fs.ensureFolder(mkPath('docs'))
57
72
  await writeFile(fs, ui, mkPath('docs', 'models.ts'), bootstrapTemplates['docs-models'] || '', 'docs/models.ts')