@mapomodule/mcp 1.0.0-beta.3 → 1.0.0-experimental.1

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 (50) hide show
  1. package/README.md +26 -24
  2. package/dist/build.mjs +66 -4
  3. package/dist/cli.mjs +8 -1
  4. package/dist/knowledge/api.json +1 -1
  5. package/dist/knowledge/docs.json +1 -1
  6. package/dist/module.json +1 -1
  7. package/dist/runtime/core/ai-setup/catalog.d.ts +0 -0
  8. package/dist/runtime/core/ai-setup/catalog.js +411 -0
  9. package/dist/runtime/core/ai-setup/index.d.ts +0 -0
  10. package/dist/runtime/core/ai-setup/index.js +20 -0
  11. package/dist/runtime/core/ai-setup/plan.d.ts +0 -0
  12. package/dist/runtime/core/ai-setup/plan.js +640 -0
  13. package/dist/runtime/core/ai-setup/questions.d.ts +0 -0
  14. package/dist/runtime/core/ai-setup/questions.js +237 -0
  15. package/dist/runtime/core/indexer.js +10 -3
  16. package/dist/runtime/core/instructions.js +3 -2
  17. package/dist/runtime/core/prompts.js +25 -1
  18. package/dist/runtime/core/recipes.js +388 -3
  19. package/dist/runtime/core/search.js +2 -1
  20. package/dist/runtime/core/tools/ai.d.ts +0 -0
  21. package/dist/runtime/core/tools/ai.js +125 -0
  22. package/dist/runtime/core/tools/api.js +7 -1
  23. package/dist/runtime/mcp/handlers/mapo/prompts/ai-setup.js +3 -0
  24. package/dist/runtime/mcp/handlers/mapo/tools/ai-setup.js +3 -0
  25. package/package.json +1 -1
  26. package/src/__tests__/aiSetup.test.ts +330 -0
  27. package/src/__tests__/cli.test.ts +1 -0
  28. package/src/__tests__/composables.test.ts +95 -0
  29. package/src/__tests__/indexer.test.ts +19 -0
  30. package/src/__tests__/knowledge.test.ts +48 -0
  31. package/src/__tests__/overview.test.ts +11 -0
  32. package/src/__tests__/recipes.test.ts +67 -0
  33. package/src/__tests__/search.test.ts +16 -0
  34. package/src/__tests__/tools.test.ts +27 -1
  35. package/src/build/extract-components.ts +33 -5
  36. package/src/build/extract-composables.ts +65 -2
  37. package/src/cli.ts +8 -1
  38. package/src/runtime/core/ai-setup/catalog.ts +475 -0
  39. package/src/runtime/core/ai-setup/index.ts +29 -0
  40. package/src/runtime/core/ai-setup/plan.ts +706 -0
  41. package/src/runtime/core/ai-setup/questions.ts +290 -0
  42. package/src/runtime/core/indexer.ts +16 -4
  43. package/src/runtime/core/instructions.ts +3 -2
  44. package/src/runtime/core/prompts.ts +28 -0
  45. package/src/runtime/core/recipes.ts +408 -3
  46. package/src/runtime/core/search.ts +4 -1
  47. package/src/runtime/core/tools/ai.ts +209 -0
  48. package/src/runtime/core/tools/api.ts +8 -0
  49. package/src/runtime/mcp/handlers/mapo/prompts/ai-setup.ts +4 -0
  50. package/src/runtime/mcp/handlers/mapo/tools/ai-setup.ts +4 -0
@@ -82,6 +82,12 @@ interface ComponentApiArgs {
82
82
  include?: Array<"props" | "events" | "slots" | "exposed">;
83
83
  }
84
84
 
85
+ /** What an app needs before it has the components of an opt-in package. */
86
+ const OPT_IN_PACKAGES: Record<string, string> = {
87
+ "@mapomodule/ai":
88
+ "Experimental and opt-in: it exists only in an app that sets `mapo.ai` (the meta-module then installs `@mapomodule/ai`).",
89
+ };
90
+
85
91
  function renderComponent(
86
92
  component: ComponentApi,
87
93
  include?: ComponentApiArgs["include"],
@@ -99,9 +105,11 @@ function renderComponent(
99
105
  sections.push(renderMembers("Exposed", component.exposed));
100
106
  }
101
107
 
108
+ const optIn = OPT_IN_PACKAGES[component.pkg];
102
109
  return (
103
110
  `# ${component.name}\n` +
104
111
  `package: \`${component.pkg}\` · source: \`${component.file}\`\n` +
112
+ (optIn ? `\n${optIn}\n` : "") +
105
113
  (component.description ? `\n${component.description}\n` : "") +
106
114
  `\n${sections.join("\n")}` +
107
115
  renderDocs(component.docs)
@@ -0,0 +1,4 @@
1
+ import { aiSetupPrompt } from "../../../../core/prompts.js";
2
+ import { toMcpPrompt } from "../../../../nitro/to-mcp-prompt.js";
3
+
4
+ export default toMcpPrompt(aiSetupPrompt);
@@ -0,0 +1,4 @@
1
+ import { aiSetupTool } from "../../../../core/tools/ai.js";
2
+ import { toMcpTool } from "../../../../nitro/to-mcp-tool.js";
3
+
4
+ export default toMcpTool(aiSetupTool);