@cloudgrid-io/mcp 0.11.2 → 0.13.0

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 (98) hide show
  1. package/package.json +2 -1
  2. package/src/corpus/capability-map.md +40 -6
  3. package/src/corpus/examples/ai-app/index.md +237 -0
  4. package/src/corpus/examples/api-service/index.md +190 -0
  5. package/src/corpus/examples/crm/index.md +273 -0
  6. package/src/corpus/examples/kanban/index.md +256 -0
  7. package/src/corpus/templates/admin-dashboard/README.md +75 -0
  8. package/src/corpus/templates/admin-dashboard/cloudgrid.yaml +15 -0
  9. package/src/corpus/templates/admin-dashboard/index.md +78 -0
  10. package/src/corpus/templates/admin-dashboard/services/web/app/api/orders/route.js +64 -0
  11. package/src/corpus/templates/admin-dashboard/services/web/app/api/users/route.js +63 -0
  12. package/src/corpus/templates/admin-dashboard/services/web/app/layout.js +39 -0
  13. package/src/corpus/templates/admin-dashboard/services/web/app/page.js +73 -0
  14. package/src/corpus/templates/admin-dashboard/services/web/app/resource-table.js +94 -0
  15. package/src/corpus/templates/admin-dashboard/services/web/lib/db.js +32 -0
  16. package/src/corpus/templates/admin-dashboard/services/web/package.json +16 -0
  17. package/src/corpus/templates/ai-app/README.md +95 -0
  18. package/src/corpus/templates/ai-app/cloudgrid.yaml +20 -0
  19. package/src/corpus/templates/ai-app/index.md +269 -0
  20. package/src/corpus/templates/ai-app/services/web/app/api/chat/route.js +51 -0
  21. package/src/corpus/templates/ai-app/services/web/app/chat.js +60 -0
  22. package/src/corpus/templates/ai-app/services/web/app/layout.js +36 -0
  23. package/src/corpus/templates/ai-app/services/web/app/page.js +25 -0
  24. package/src/corpus/templates/ai-app/services/web/lib/db.js +32 -0
  25. package/src/corpus/templates/ai-app/services/web/package.json +17 -0
  26. package/src/corpus/templates/api-docs/README.md +28 -0
  27. package/src/corpus/templates/api-docs/cloudgrid.yaml +10 -0
  28. package/src/corpus/templates/api-docs/index.html +136 -0
  29. package/src/corpus/templates/api-docs/index.md +30 -0
  30. package/src/corpus/templates/api-service/README.md +87 -0
  31. package/src/corpus/templates/api-service/cloudgrid.yaml +18 -0
  32. package/src/corpus/templates/api-service/index.md +225 -0
  33. package/src/corpus/templates/api-service/services/api/package.json +13 -0
  34. package/src/corpus/templates/api-service/services/api/src/index.js +132 -0
  35. package/src/corpus/templates/changelog/README.md +27 -0
  36. package/src/corpus/templates/changelog/cloudgrid.yaml +10 -0
  37. package/src/corpus/templates/changelog/index.html +80 -0
  38. package/src/corpus/templates/changelog/index.md +30 -0
  39. package/src/corpus/templates/crm/README.md +72 -0
  40. package/src/corpus/templates/crm/cloudgrid.yaml +15 -0
  41. package/src/corpus/templates/crm/index.md +68 -0
  42. package/src/corpus/templates/crm/services/web/app/api/contacts/route.js +80 -0
  43. package/src/corpus/templates/crm/services/web/app/contact-manager.js +102 -0
  44. package/src/corpus/templates/crm/services/web/app/layout.js +35 -0
  45. package/src/corpus/templates/crm/services/web/app/page.js +34 -0
  46. package/src/corpus/templates/crm/services/web/lib/db.js +32 -0
  47. package/src/corpus/templates/crm/services/web/package.json +16 -0
  48. package/src/corpus/templates/docs-site/README.md +28 -0
  49. package/src/corpus/templates/docs-site/cloudgrid.yaml +10 -0
  50. package/src/corpus/templates/docs-site/index.html +122 -0
  51. package/src/corpus/templates/docs-site/index.md +30 -0
  52. package/src/corpus/templates/kanban/README.md +72 -0
  53. package/src/corpus/templates/kanban/cloudgrid.yaml +15 -0
  54. package/src/corpus/templates/kanban/index.md +68 -0
  55. package/src/corpus/templates/kanban/services/web/app/api/cards/route.js +70 -0
  56. package/src/corpus/templates/kanban/services/web/app/board.js +93 -0
  57. package/src/corpus/templates/kanban/services/web/app/layout.js +37 -0
  58. package/src/corpus/templates/kanban/services/web/app/page.js +32 -0
  59. package/src/corpus/templates/kanban/services/web/lib/db.js +32 -0
  60. package/src/corpus/templates/kanban/services/web/package.json +16 -0
  61. package/src/corpus/templates/portfolio/README.md +29 -0
  62. package/src/corpus/templates/portfolio/cloudgrid.yaml +10 -0
  63. package/src/corpus/templates/portfolio/index.html +126 -0
  64. package/src/corpus/templates/portfolio/index.md +30 -0
  65. package/src/corpus/templates/saas-marketing/README.md +30 -0
  66. package/src/corpus/templates/saas-marketing/cloudgrid.yaml +10 -0
  67. package/src/corpus/templates/saas-marketing/index.html +212 -0
  68. package/src/corpus/templates/saas-marketing/index.md +30 -0
  69. package/src/corpus/templates/status-page/README.md +28 -0
  70. package/src/corpus/templates/status-page/cloudgrid.yaml +10 -0
  71. package/src/corpus/templates/status-page/index.html +117 -0
  72. package/src/corpus/templates/status-page/index.md +30 -0
  73. package/src/corpus/templates/task-manager/README.md +72 -0
  74. package/src/corpus/templates/task-manager/cloudgrid.yaml +15 -0
  75. package/src/corpus/templates/task-manager/index.md +68 -0
  76. package/src/corpus/templates/task-manager/services/web/app/api/tasks/route.js +77 -0
  77. package/src/corpus/templates/task-manager/services/web/app/layout.js +39 -0
  78. package/src/corpus/templates/task-manager/services/web/app/page.js +33 -0
  79. package/src/corpus/templates/task-manager/services/web/app/task-list.js +110 -0
  80. package/src/corpus/templates/task-manager/services/web/lib/db.js +32 -0
  81. package/src/corpus/templates/task-manager/services/web/package.json +16 -0
  82. package/src/corpus/templates/waitlist/README.md +38 -0
  83. package/src/corpus/templates/waitlist/cloudgrid.yaml +10 -0
  84. package/src/corpus/templates/waitlist/index.html +69 -0
  85. package/src/corpus/templates/waitlist/index.md +41 -0
  86. package/src/corpus/workflows/admin-dashboard.md +102 -0
  87. package/src/corpus/workflows/ai-app.md +136 -0
  88. package/src/corpus/workflows/api-docs.md +36 -0
  89. package/src/corpus/workflows/api-service.md +118 -0
  90. package/src/corpus/workflows/changelog.md +33 -0
  91. package/src/corpus/workflows/crm.md +101 -0
  92. package/src/corpus/workflows/docs-site.md +35 -0
  93. package/src/corpus/workflows/kanban.md +102 -0
  94. package/src/corpus/workflows/portfolio.md +35 -0
  95. package/src/corpus/workflows/saas-marketing.md +37 -0
  96. package/src/corpus/workflows/status-page.md +35 -0
  97. package/src/corpus/workflows/task-manager.md +101 -0
  98. package/src/corpus/workflows/waitlist.md +42 -0
@@ -0,0 +1,136 @@
1
+ ---
2
+ name: ai-app
3
+ when: chatbot, AI assistant, Q&A bot, conversational app, support bot, ask-me-anything, an app that talks to an LLM / generates text with AI. Needs AI + a database → runtime → local edition.
4
+ needs: ai, database
5
+ deploy: runtime
6
+ editions: local
7
+ capabilities_note: AI chatbot — needs ai (the grid AI gateway) + a database (Mongo) for chat history. Next.js App Router app. Uses @cloudgrid-io/ai createClient().chat() with zero-config in-grid identity auth (no API key). Runtime app, async build, local edition only. Declare `needs: { ai: true, database: true }`. (RAG over your own docs needs `needs: { vector: pgvector }` — not yet available, platform issue #1545.)
8
+ summary: Build an AI chatbot on the grid — a Next.js app that calls @cloudgrid-io/ai createClient().chat({messages}) (zero-config in-grid auth, no key) and persists the conversation to grid-shared Mongo. Edition-gate first, scaffold, put the app under services/web/, declare needs:{ai:true,database:true}, read DATABASE_MONGODB_URL lazily, deploy async, poll to a live URL.
9
+ ---
10
+
11
+ # Workflow: ai-app
12
+
13
+ The user wants an app that **talks to an LLM** — a chatbot, an AI assistant, a
14
+ Q&A/support bot, an ask-me-anything. It calls the grid's AI gateway to generate
15
+ replies and **remembers the conversation** in the grid-shared Mongo. So it needs
16
+ two capabilities: `ai` (the gateway) and `database` (chat history). That makes it
17
+ a **runtime app**, not a static page.
18
+
19
+ Follow this recipe. Be honest that a runtime deploy is async and needs the local
20
+ edition.
21
+
22
+ ## 1. Edition check FIRST (hard gate)
23
+
24
+ An AI chatbot is a built + deployed container. It requires the **local edition**
25
+ (Claude Desktop / Claude Code) or the CLI, because the grid must run the CLI and
26
+ folder-plug your project.
27
+
28
+ - **Hosted edition (Claude Web / hosted MCP):** you CANNOT build a runtime app —
29
+ hosted is inline-only and can only publish static pages. Tell the user plainly:
30
+ "An AI chatbot needs the local edition (Claude Desktop/Code) or the CloudGrid
31
+ CLI; the hosted edition can only publish static pages." STOP the runtime path
32
+ here.
33
+ - **Local edition:** continue.
34
+
35
+ ## 2. Auth + grid
36
+
37
+ Persistent apps are owned entities.
38
+ 1. Ensure signed in: `gridctl_login_status`; if not, `gridctl_login`.
39
+ 2. A grid is required. Respect the grid picker: if the user has more than one
40
+ grid, ask which to use; do not assume a target.
41
+
42
+ ## 3. Scaffold
43
+
44
+ `gridctl_init` an app `<name>`. `init` creates the entity + `.cloudgrid/link.json`
45
+ and writes a `cloudgrid.yaml` with an EMPTY `services: {}`. `plug` needs a linked
46
+ directory, so run `init` FIRST.
47
+
48
+ You then do two things: (a) write the app under **`services/web/`**, and (b) fill
49
+ in `cloudgrid.yaml` to the shape below (`services.web` type `nextjs` + `needs: {
50
+ ai: true, database: true }`).
51
+
52
+ ## 4. Wire the AI gateway + Mongo
53
+
54
+ 1. Set `cloudgrid.yaml` to declare the `web` service and the capabilities it
55
+ needs. **App code MUST live under `services/<name>/`** — `path:` is the URL
56
+ mount, NOT the filesystem path. A service named `web` → the CLI looks for
57
+ `services/web/`; files at the repo root fail with
58
+ `Error: Service directory not found: …/services/web`.
59
+ ```yaml
60
+ name: my-chatbot
61
+ services:
62
+ web:
63
+ type: nextjs
64
+ path: /
65
+ needs:
66
+ ai: true
67
+ database: true
68
+ # For retrieval-augmented (RAG) over your own docs, add `needs: { vector:
69
+ # pgvector }` once platform issue #1545 ships — not yet available.
70
+ ```
71
+ **Declare `needs: { ai: true, database: true }`** — the canonical shape. The
72
+ deployer wires the AI gateway (in-grid identity) and provisions Mongo,
73
+ injecting `DATABASE_MONGODB_URL` (plus the legacy `MONGODB_URL` alias) at
74
+ dev-time and runtime. `requires:` is the deprecated v1 alias; don't author new
75
+ yaml with it, and never set `needs:` and `requires:` together (the validator
76
+ rejects it).
77
+ 2. Fetch the template for the chat wiring:
78
+ `gridctl_fetch("template", "ai-app")`. It is a minimal Next.js App Router chat
79
+ app under `services/web/`: a chat page, an API route
80
+ (`app/api/chat/route.js`, `export const dynamic = "force-dynamic"`) that reads
81
+ the user message, calls the AI gateway, persists the exchange to Mongo, and
82
+ returns the reply.
83
+ 3. **Call the AI gateway with `@cloudgrid-io/ai`** — zero config, no API key:
84
+ ```js
85
+ import { createClient } from "@cloudgrid-io/ai";
86
+ const client = createClient(); // zero-arg, no key
87
+ const r = await client.chat({ messages: [{ role: "user", content: text }] });
88
+ const reply = r.text ?? r.content; // reply text
89
+ ```
90
+ The SDK auto-detects the in-grid identity — **do NOT set an API key.** It only
91
+ works inside a deployed grid app (or under `grid dev`).
92
+ 4. **Persist the exchange to Mongo** — read `process.env.DATABASE_MONGODB_URL`
93
+ (falling back to the legacy `process.env.MONGODB_URL`) **lazily inside the
94
+ getter, never at module top level**, or `next build` fails (the module is
95
+ imported for route analysis before the grid injects the var). Store the user
96
+ message and the assistant reply so the conversation survives refresh. Never
97
+ hardcode a connection string; never commit a secret.
98
+ - (Optional) fetch `gridctl_fetch("example", "ai-app")` for a richer filled
99
+ reference (a themed assistant) to imitate.
100
+
101
+ ## 5. (Optional) Run locally
102
+
103
+ Mention that the user can `grid dev` to run locally — the AI gateway and Mongo
104
+ are wired in dev too — and send a test message before deploying. Don't require it.
105
+
106
+ ## 6. Config
107
+
108
+ - Extra API keys / secrets (only if the app needs its own) → `gridctl_secrets`.
109
+ - Non-secret config → `gridctl_env`.
110
+ - Do **NOT** set the DB connection var yourself (`DATABASE_MONGODB_URL` / legacy
111
+ `MONGODB_URL`) and do **NOT** set an AI key — the grid injects the DB var and
112
+ the AI SDK auto-detects the in-grid identity.
113
+
114
+ ## 7. Deploy (async)
115
+
116
+ Deploy the folder with `gridctl_plug`. A **runtime deploy is ASYNC**: the first
117
+ response is `status: "building"` with a `poll_url` / entity, NOT a live URL yet.
118
+ - Poll `gridctl_status` (or the returned poll_url) until the entity is live.
119
+ - Surface a liveness signal while it builds — never a bare silent wait.
120
+ - Only once it is live, return the deployed URL (the app URL, NOT the build/log
121
+ link).
122
+
123
+ ## 8. Return the live URL + iterate
124
+
125
+ Give the user the live chatbot URL — that is the deliverable. To iterate, re-plug
126
+ the SAME entity (`target_entity_id`) so it updates the same URL.
127
+
128
+ ## Note on RAG / retrieval
129
+
130
+ If the user wants the bot to answer over **their own documents** (retrieval-
131
+ augmented generation), that needs a vector store (`needs: { vector: pgvector }`).
132
+ That path is **not yet available** — platform issue #1545. Ship the plain
133
+ chatbot now; add retrieval once the vector need is unblocked.
134
+
135
+ Keep it honest: async build, local-edition only, AI auth and DB credentials
136
+ provided by the grid.
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: api-docs
3
+ when: API documentation, API reference, endpoint docs, REST API docs, method/params/response reference. For prose developer guides or a knowledge base, use docs-site instead.
4
+ needs: none
5
+ deploy: inspiration
6
+ editions: all
7
+ capabilities_note: static — no infrastructure. Publishes as an inspiration (instant, works on hosted) via gridctl_drop.
8
+ summary: Fetch the api-docs template, fill it with the user's endpoints, deploy it, and return the live share URL.
9
+ ---
10
+
11
+ # Workflow: api-docs
12
+
13
+ Detect the intent ("build me API docs / a REST API reference for X") and follow
14
+ this recipe. For prose guides or a general docs site, use `docs-site`; use this
15
+ one when the content is an endpoint reference. Do not ask setup questions first;
16
+ use sensible defaults and build.
17
+
18
+ 1. **Fetch the template.** Call `gridctl_fetch("template", "api-docs")` to load
19
+ the self-contained HTML API reference (sidebar endpoint list, method badges,
20
+ params tables, request/response code blocks, client-side filter).
21
+ 2. **Fill the template.** Replace the placeholders with the user's content:
22
+ - The API name, base URL, and auth note.
23
+ - One section per endpoint: method badge (GET/POST/PUT/DELETE), path,
24
+ description, a params table, and request/response example blocks.
25
+ - The sidebar links jump to each endpoint anchor; keep ids matching.
26
+ - The code blocks are plain `<pre><code>` — no external highlighter or CDN.
27
+ - Keep it a single self-contained HTML file. Do not add external scripts,
28
+ stylesheets, fonts, or large embedded media.
29
+ 3. **Deploy.** Deploy the filled HTML:
30
+ - Hosted MCP edition: call the drop tool with the HTML.
31
+ - Local MCP / CLI edition: write the HTML to a file and run `gridctl plug`.
32
+ It is an inspiration and deploys synchronously, so you get a URL right away.
33
+ 4. **Return the live share URL.** For revisions, re-deploy with the entity id
34
+ from the first deploy — it updates the same share URL.
35
+
36
+ Keep the whole flow tight: fetch, fill, deploy, share.
@@ -0,0 +1,118 @@
1
+ ---
2
+ name: api-service
3
+ when: REST API, backend for X, API endpoint(s), CRUD API, JSON API, webhook receiver, a backend/service that stores data and isn't a full web UI. Needs a database → runtime → local edition.
4
+ needs: database
5
+ deploy: runtime
6
+ editions: local
7
+ capabilities_note: persistent backend service — needs a database (Mongo). A plain Node HTTP service (type: node), not a web UI. Runtime app, async build, local edition only. Declare the canonical `needs: { database: true }`; the deployer injects DATABASE_MONGODB_URL (+legacy MONGODB_URL).
8
+ summary: Build a real REST/JSON API on the grid — a Node HTTP service backed by grid-shared Mongo. Edition-gate first, scaffold, put the service under services/api/, read process.env.DATABASE_MONGODB_URL (legacy MONGODB_URL fallback) lazily, declare needs:{database:true} (not requires:), deploy async, poll to a live URL.
9
+ ---
10
+
11
+ # Workflow: api-service
12
+
13
+ The user wants a **backend API**, not a full web UI — a REST/JSON service with
14
+ endpoints, a resource it stores and returns (a `/items` CRUD API, a webhook
15
+ receiver, a small backend for another app). It **saves data**, so it is a
16
+ **runtime app** backed by the grid's shared Mongo. This is the plain-service
17
+ sibling of `app-with-data`: no Next.js, no pages — just a Node HTTP server
18
+ speaking JSON.
19
+
20
+ Follow this recipe. Be honest that a runtime deploy is async (not instant like a
21
+ static drop) and that it needs the local edition.
22
+
23
+ ## 1. Edition check FIRST (hard gate)
24
+
25
+ An API service is a built + deployed container. It requires the **local
26
+ edition** (Claude Desktop / Claude Code) or the CLI, because the grid must run
27
+ the CLI and folder-plug your project.
28
+
29
+ - **Hosted edition (Claude Web / hosted MCP):** you CANNOT build a runtime
30
+ service — hosted is inline-only and can only publish static pages. Tell the
31
+ user plainly: "An API service needs the local edition (Claude Desktop/Code) or
32
+ the CloudGrid CLI; the hosted edition can only publish static pages." STOP the
33
+ runtime path here (there is no useful static fallback for a backend API).
34
+ - **Local edition:** continue.
35
+
36
+ ## 2. Auth + grid
37
+
38
+ Persistent services are owned entities.
39
+ 1. Ensure signed in: `gridctl_login_status`; if not, `gridctl_login`.
40
+ 2. A grid is required. Respect the grid picker: if the user has more than one
41
+ grid, ask which to use; do not assume a target.
42
+
43
+ ## 3. Scaffold
44
+
45
+ `gridctl_init` an app `<name>`. `init` creates the entity + `.cloudgrid/link.json`
46
+ and writes a `cloudgrid.yaml` with an EMPTY `services: {}`. `plug` needs a linked
47
+ directory, so run `init` FIRST.
48
+
49
+ You then do two things: (a) write the service under **`services/api/`**, and (b)
50
+ fill in `cloudgrid.yaml` to the shape below (`services.api` type `node` + `needs:
51
+ { database: true }`).
52
+
53
+ ## 4. Add the datastore + wire Mongo
54
+
55
+ 1. Set `cloudgrid.yaml` to declare the `api` service and the store it needs.
56
+ **Service code MUST live under `services/<name>/`** — `path:` is the URL
57
+ mount, NOT the filesystem path. A service named `api` → the CLI looks for
58
+ `services/api/`; files at the repo root fail with
59
+ `Error: Service directory not found: …/services/api`.
60
+ ```yaml
61
+ name: my-api
62
+ services:
63
+ api:
64
+ type: node
65
+ path: /
66
+ needs:
67
+ database: true
68
+ ```
69
+ **Declare the datastore with `needs: { database: true }`** — this is the
70
+ canonical shape. The deployer provisions Mongo and injects
71
+ `DATABASE_MONGODB_URL` (plus the legacy `MONGODB_URL` alias) at dev-time and
72
+ runtime. `requires:` is the deprecated v1 alias; don't author new yaml with
73
+ it, and never set `needs:` and `requires:` together (the validator rejects it).
74
+ 2. Fetch the template for the server + Mongo shape:
75
+ `gridctl_fetch("template", "api-service")`. It is a minimal Node `http`
76
+ server under `services/api/`: it listens on `process.env.PORT || 8080` and
77
+ serves a small REST resource (`/items` GET list / POST create / DELETE by id)
78
+ backed by Mongo.
79
+ 3. Adapt it to the user's API (rename the resource, change the fields, add
80
+ routes). **Read the database from `process.env.DATABASE_MONGODB_URL`** (falling
81
+ back to the legacy `process.env.MONGODB_URL`) — the grid injects those env
82
+ vars at dev-time and runtime. Never hardcode a connection string; never commit
83
+ a secret.
84
+ - **Read the connection string LAZILY inside the request handler / a getter —
85
+ never at module top level, or node startup crashes** before the grid has
86
+ injected the var.
87
+ - Return clear JSON errors (`{ "error": "…" }`) with the right status codes.
88
+ - (Optional) fetch `gridctl_fetch("example", "api-service")` for a slightly
89
+ richer filled reference to imitate.
90
+
91
+ ## 5. (Optional) Run locally
92
+
93
+ Mention that the user can `grid dev` to run locally against the injected Mongo
94
+ and hit the endpoints before deploying. Don't require it.
95
+
96
+ ## 6. Config
97
+
98
+ - API keys / secrets → `gridctl_secrets`.
99
+ - Non-secret config → `gridctl_env`.
100
+ - Do **NOT** set the DB connection vars yourself (`DATABASE_MONGODB_URL`, or the
101
+ legacy `MONGODB_URL` alias) — the grid injects them.
102
+
103
+ ## 7. Deploy (async)
104
+
105
+ Deploy the folder with `gridctl_plug`. A **runtime deploy is ASYNC**: the first
106
+ response is `status: "building"` with a `poll_url` / entity, NOT a live URL yet.
107
+ - Poll `gridctl_status` (or the returned poll_url) until the entity is live.
108
+ - Surface a liveness signal while it builds — never a bare silent wait.
109
+ - Only once it is live, return the deployed URL (the API base URL, NOT the
110
+ build/log link).
111
+
112
+ ## 8. Return the live URL + iterate
113
+
114
+ Give the user the live API URL — that is the deliverable. Point out the endpoints
115
+ (e.g. `GET /items`, `POST /items`). To iterate, re-plug the SAME entity
116
+ (`target_entity_id`) so it updates the same URL.
117
+
118
+ Keep it honest: async build, local-edition only, credentials injected by the grid.
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: changelog
3
+ when: changelog, release notes, what's new, product updates page, version history. Reverse-chronological entries with added/fixed/changed/removed tags.
4
+ needs: none
5
+ deploy: inspiration
6
+ editions: all
7
+ capabilities_note: static — no infrastructure. Publishes as an inspiration (instant, works on hosted) via gridctl_drop.
8
+ summary: Fetch the changelog template, fill it with the user's release entries, deploy it, and return the live share URL.
9
+ ---
10
+
11
+ # Workflow: changelog
12
+
13
+ Detect the intent ("build me a changelog / release notes page for X") and follow
14
+ this recipe. Do not ask setup questions first; use sensible defaults and build.
15
+
16
+ 1. **Fetch the template.** Call `gridctl_fetch("template", "changelog")` to load
17
+ the self-contained HTML changelog (reverse-chronological versioned entries with
18
+ tagged change items).
19
+ 2. **Fill the template.** Replace the placeholders with the user's content:
20
+ - The product name and a short intro line.
21
+ - One entry per release, newest first: version, date, and a list of changes.
22
+ - Each change item carries a tag — set its class to `added`, `fixed`,
23
+ `changed`, or `removed`.
24
+ - Keep it a single self-contained HTML file. Do not add external scripts,
25
+ stylesheets, fonts, or large embedded media.
26
+ 3. **Deploy.** Deploy the filled HTML:
27
+ - Hosted MCP edition: call the drop tool with the HTML.
28
+ - Local MCP / CLI edition: write the HTML to a file and run `gridctl plug`.
29
+ It is an inspiration and deploys synchronously, so you get a URL right away.
30
+ 4. **Return the live share URL.** For revisions, re-deploy with the entity id
31
+ from the first deploy — it updates the same share URL.
32
+
33
+ Keep the whole flow tight: fetch, fill, deploy, share.
@@ -0,0 +1,101 @@
1
+ ---
2
+ name: crm
3
+ when: CRM, contacts, leads, sales pipeline, customer manager, deal tracker — a persistent app that stores and manages contacts/leads/customers by stage. Needs a database → runtime → local edition.
4
+ needs: database
5
+ deploy: runtime
6
+ editions: local
7
+ capabilities_note: persistent — needs a database (Mongo). Runtime app, async build, local edition only. Declare the canonical `needs: { database: true }`; the deployer injects DATABASE_MONGODB_URL (+legacy MONGODB_URL).
8
+ summary: Build a persistent Next.js + Mongo CRM on the grid — a `contacts` collection (name, email, company, stage, note) with add / restage / delete. Edition-gate first, scaffold, put the app under services/web/, wire process.env.DATABASE_MONGODB_URL (legacy MONGODB_URL fallback) lazily, declare needs:{database:true} (not requires:), deploy async, poll to a live URL.
9
+ ---
10
+
11
+ # Workflow: crm
12
+
13
+ The user wants a contact manager / sales pipeline that **remembers** its
14
+ contacts — a CRM whose records survive refresh and are shared across sessions.
15
+ That is a **runtime app** backed by the grid's shared Mongo, not a static page.
16
+ It is the same proven shape as `app-with-data`, with a `contacts` domain
17
+ (name, email, company, stage of lead/qualified/customer, note) and a table view
18
+ with per-row stage changes.
19
+
20
+ Follow this recipe. Be honest that a runtime deploy is async (not instant like a
21
+ static drop) and that it needs the local edition.
22
+
23
+ ## 1. Edition check FIRST (hard gate)
24
+
25
+ A persistent app is a built + deployed container. It requires the **local
26
+ edition** (Claude Desktop / Claude Code) or the CLI.
27
+
28
+ - **Hosted edition (Claude Web / hosted MCP):** you CANNOT build a runtime app —
29
+ hosted is inline-only and can only publish static pages. Tell the user
30
+ plainly, offer a **static version** instead, and STOP the runtime path here.
31
+ - **Local edition:** continue.
32
+
33
+ ## 2. Auth + grid
34
+
35
+ 1. Ensure signed in: `gridctl_login_status`; if not, `gridctl_login`.
36
+ 2. A grid is required. Respect the grid picker: if the user has more than one
37
+ grid, ask which to use; do not assume a target.
38
+
39
+ ## 3. Scaffold
40
+
41
+ `gridctl_init` an app `<name>`. `init` creates the entity + `.cloudgrid/link.json`
42
+ and writes a `cloudgrid.yaml` with an EMPTY `services: {}`. `plug` needs a linked
43
+ directory, so run `init` FIRST. Then (a) write the app under **`services/web/`**,
44
+ and (b) fill `cloudgrid.yaml` to the shape below (`services.web` + `needs:
45
+ { database: true }`).
46
+
47
+ ## 4. Add the datastore + wire Mongo
48
+
49
+ 1. Set `cloudgrid.yaml`. **App code MUST live under `services/<name>/`** —
50
+ `path:` is the URL mount, NOT the filesystem path.
51
+ ```yaml
52
+ name: my-crm
53
+ services:
54
+ web:
55
+ type: nextjs
56
+ path: /
57
+ needs:
58
+ database: true
59
+ ```
60
+ **Declare the datastore with `needs: { database: true }`** — the canonical
61
+ shape. The deployer provisions Mongo and injects `DATABASE_MONGODB_URL` (plus
62
+ the legacy `MONGODB_URL` alias). `requires:` is the deprecated v1 alias; don't
63
+ author new yaml with it, and never set `needs:` and `requires:` together (the
64
+ validator rejects it).
65
+ 2. Fetch the template for the Mongo wiring + CRUD shape:
66
+ `gridctl_fetch("template", "crm")`. It is a minimal, real Next.js +
67
+ `mongodb`-driver contact manager under `services/web/`: a lazy client in
68
+ `services/web/lib/db.js`, an App-Router GET/POST/PATCH/DELETE route on a
69
+ `contacts` collection, a server-component page, and a client table.
70
+ 3. Adapt it (rename the collection, change fields, adjust the UI). **Read the DB
71
+ from `process.env.DATABASE_MONGODB_URL`** (legacy `process.env.MONGODB_URL`
72
+ fallback) — the grid injects it at dev-time and runtime.
73
+ - **Put the DB connection behind a lazy getter — never read the connection
74
+ string at module top level, or `next build` fails.**
75
+ - (Optional) fetch `gridctl_fetch("example", "crm")` for a richer filled
76
+ reference to imitate.
77
+
78
+ ## 5. (Optional) Run locally
79
+
80
+ Mention that the user can `grid dev` to run locally against the injected Mongo
81
+ before deploying. Don't require it.
82
+
83
+ ## 6. Config
84
+
85
+ - API keys / secrets → `gridctl_secrets`. Non-secret config → `gridctl_env`.
86
+ - Do **NOT** set the DB connection vars yourself (`DATABASE_MONGODB_URL` or the
87
+ legacy `MONGODB_URL`) — the grid injects them.
88
+
89
+ ## 7. Deploy (async)
90
+
91
+ Deploy the folder with `gridctl_plug`. A **runtime deploy is ASYNC**: the first
92
+ response is `status: "building"`, NOT a live URL yet.
93
+ - Poll `gridctl_status` (or the returned poll_url) until the entity is live.
94
+ - Surface a liveness signal while it builds — never a bare silent wait.
95
+ - Only once it is live, return the deployed app URL (NOT the build/log link).
96
+
97
+ ## 8. Return the live URL + iterate
98
+
99
+ Give the user the live app URL — that is the deliverable. To iterate, re-plug the
100
+ SAME entity so it updates the same URL. Keep it honest: async build, local-edition
101
+ only, credentials injected by the grid.
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: docs-site
3
+ when: documentation site, docs, developer docs, guide, manual, knowledge base, help center (static, content baked in). For an interactive API endpoint reference, use api-docs instead.
4
+ needs: none
5
+ deploy: inspiration
6
+ editions: all
7
+ capabilities_note: static — no infrastructure, content baked into the page. Publishes as an inspiration (instant, works on hosted) via gridctl_drop.
8
+ summary: Fetch the docs-site template, fill it with the user's documentation, deploy it, and return the live share URL.
9
+ ---
10
+
11
+ # Workflow: docs-site
12
+
13
+ Detect the intent ("build me a docs site / documentation for X") and follow this
14
+ recipe. For a REST API endpoint reference specifically, use `api-docs`. Do not
15
+ ask setup questions first; use sensible defaults and build.
16
+
17
+ 1. **Fetch the template.** Call `gridctl_fetch("template", "docs-site")` to load
18
+ the self-contained HTML docs layout (sidebar nav, content column, code blocks,
19
+ client-side search box).
20
+ 2. **Fill the template.** Replace the placeholders with the user's content:
21
+ - The project/doc name and the sidebar section links.
22
+ - One content section per topic (heading + prose + optional code block). Keep
23
+ each section id matching its sidebar anchor.
24
+ - The code blocks are plain `<pre><code>` — no external highlighter or CDN.
25
+ - Leave the inline search script as-is; it filters the sidebar client-side.
26
+ - Keep it a single self-contained HTML file. Do not add external scripts,
27
+ stylesheets, fonts, or large embedded media.
28
+ 3. **Deploy.** Deploy the filled HTML:
29
+ - Hosted MCP edition: call the drop tool with the HTML.
30
+ - Local MCP / CLI edition: write the HTML to a file and run `gridctl plug`.
31
+ It is an inspiration and deploys synchronously, so you get a URL right away.
32
+ 4. **Return the live share URL.** For revisions, re-deploy with the entity id
33
+ from the first deploy — it updates the same share URL.
34
+
35
+ Keep the whole flow tight: fetch, fill, deploy, share.
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: kanban
3
+ when: kanban board, task board, trello-style board, workflow columns — a persistent board whose cards move between columns and stick across refresh. Needs a database → runtime → local edition.
4
+ needs: database
5
+ deploy: runtime
6
+ editions: local
7
+ capabilities_note: persistent — needs a database (Mongo). Runtime app, async build, local edition only. Declare the canonical `needs: { database: true }`; the deployer injects DATABASE_MONGODB_URL (+legacy MONGODB_URL).
8
+ summary: Build a persistent Next.js + Mongo kanban board on the grid — a `cards` collection (title, column, order) with three columns and move-between-columns + add/delete. Edition-gate first, scaffold, put the app under services/web/, wire process.env.DATABASE_MONGODB_URL (legacy MONGODB_URL fallback) lazily, declare needs:{database:true} (not requires:), deploy async, poll to a live URL.
9
+ ---
10
+
11
+ # Workflow: kanban
12
+
13
+ The user wants a kanban / trello-style board that **remembers** its cards — cards
14
+ that move between columns and survive refresh, shared across sessions. That is a
15
+ **runtime app** backed by the grid's shared Mongo, not a static page. It is the
16
+ same proven shape as `app-with-data`, with a `cards` domain (title, column of
17
+ todo/doing/done, order) and three columns with move-between-columns.
18
+
19
+ Follow this recipe. Be honest that a runtime deploy is async (not instant like a
20
+ static drop) and that it needs the local edition.
21
+
22
+ ## 1. Edition check FIRST (hard gate)
23
+
24
+ A persistent app is a built + deployed container. It requires the **local
25
+ edition** (Claude Desktop / Claude Code) or the CLI.
26
+
27
+ - **Hosted edition (Claude Web / hosted MCP):** you CANNOT build a runtime app —
28
+ hosted is inline-only and can only publish static pages. Tell the user
29
+ plainly, offer a **static version** instead, and STOP the runtime path here.
30
+ - **Local edition:** continue.
31
+
32
+ ## 2. Auth + grid
33
+
34
+ 1. Ensure signed in: `gridctl_login_status`; if not, `gridctl_login`.
35
+ 2. A grid is required. Respect the grid picker: if the user has more than one
36
+ grid, ask which to use; do not assume a target.
37
+
38
+ ## 3. Scaffold
39
+
40
+ `gridctl_init` an app `<name>`. `init` creates the entity + `.cloudgrid/link.json`
41
+ and writes a `cloudgrid.yaml` with an EMPTY `services: {}`. `plug` needs a linked
42
+ directory, so run `init` FIRST. Then (a) write the app under **`services/web/`**,
43
+ and (b) fill `cloudgrid.yaml` to the shape below (`services.web` + `needs:
44
+ { database: true }`).
45
+
46
+ ## 4. Add the datastore + wire Mongo
47
+
48
+ 1. Set `cloudgrid.yaml`. **App code MUST live under `services/<name>/`** —
49
+ `path:` is the URL mount, NOT the filesystem path.
50
+ ```yaml
51
+ name: my-board
52
+ services:
53
+ web:
54
+ type: nextjs
55
+ path: /
56
+ needs:
57
+ database: true
58
+ ```
59
+ **Declare the datastore with `needs: { database: true }`** — the canonical
60
+ shape. The deployer provisions Mongo and injects `DATABASE_MONGODB_URL` (plus
61
+ the legacy `MONGODB_URL` alias). `requires:` is the deprecated v1 alias; don't
62
+ author new yaml with it, and never set `needs:` and `requires:` together (the
63
+ validator rejects it).
64
+ 2. Fetch the template for the Mongo wiring + CRUD shape:
65
+ `gridctl_fetch("template", "kanban")`. It is a minimal, real Next.js +
66
+ `mongodb`-driver board under `services/web/`: a lazy client in
67
+ `services/web/lib/db.js`, an App-Router GET/POST/PATCH/DELETE route on a
68
+ `cards` collection (PATCH moves a card between columns), a server-component
69
+ page, and a client board.
70
+ 3. Adapt it (rename the collection, change the columns/fields, adjust the UI).
71
+ **Read the DB from `process.env.DATABASE_MONGODB_URL`** (legacy
72
+ `process.env.MONGODB_URL` fallback) — the grid injects it at dev-time and
73
+ runtime.
74
+ - **Put the DB connection behind a lazy getter — never read the connection
75
+ string at module top level, or `next build` fails.**
76
+ - (Optional) fetch `gridctl_fetch("example", "kanban")` for a richer filled
77
+ reference to imitate.
78
+
79
+ ## 5. (Optional) Run locally
80
+
81
+ Mention that the user can `grid dev` to run locally against the injected Mongo
82
+ before deploying. Don't require it.
83
+
84
+ ## 6. Config
85
+
86
+ - API keys / secrets → `gridctl_secrets`. Non-secret config → `gridctl_env`.
87
+ - Do **NOT** set the DB connection vars yourself (`DATABASE_MONGODB_URL` or the
88
+ legacy `MONGODB_URL`) — the grid injects them.
89
+
90
+ ## 7. Deploy (async)
91
+
92
+ Deploy the folder with `gridctl_plug`. A **runtime deploy is ASYNC**: the first
93
+ response is `status: "building"`, NOT a live URL yet.
94
+ - Poll `gridctl_status` (or the returned poll_url) until the entity is live.
95
+ - Surface a liveness signal while it builds — never a bare silent wait.
96
+ - Only once it is live, return the deployed app URL (NOT the build/log link).
97
+
98
+ ## 8. Return the live URL + iterate
99
+
100
+ Give the user the live app URL — that is the deliverable. To iterate, re-plug the
101
+ SAME entity so it updates the same URL. Keep it honest: async build, local-edition
102
+ only, credentials injected by the grid.
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: portfolio
3
+ when: portfolio, personal site, freelancer site, my work, showcase, resume site, developer/designer portfolio with a projects grid, about, skills, and contact. For a plain single-section link-in-bio, landing-page also works.
4
+ needs: none
5
+ deploy: inspiration
6
+ editions: all
7
+ capabilities_note: static — no infrastructure. Publishes as an inspiration (instant, works on hosted) via gridctl_drop.
8
+ summary: Fetch the portfolio template, fill it with the user's projects and bio, deploy it, and return the live share URL.
9
+ ---
10
+
11
+ # Workflow: portfolio
12
+
13
+ Detect the intent ("build me a portfolio / personal site to show my work") and
14
+ follow this recipe. Reach for this over `landing-page` when the request is about
15
+ showcasing projects with an about, skills, and contact. Do not ask setup
16
+ questions first; use sensible defaults and build.
17
+
18
+ 1. **Fetch the template.** Call `gridctl_fetch("template", "portfolio")` to load
19
+ the self-contained HTML portfolio (hero, about, skills, projects grid,
20
+ contact).
21
+ 2. **Fill the template.** Replace the placeholders with the user's content:
22
+ - The person's name, role/title, and short intro.
23
+ - The about paragraph and the skills (one pill each).
24
+ - One card per project: title, short description, tags, optional link.
25
+ - The contact links (email as a `mailto:`, plus optional profile links).
26
+ - Keep it a single self-contained HTML file. Do not add external scripts,
27
+ stylesheets, fonts, or large embedded media.
28
+ 3. **Deploy.** Deploy the filled HTML:
29
+ - Hosted MCP edition: call the drop tool with the HTML.
30
+ - Local MCP / CLI edition: write the HTML to a file and run `gridctl plug`.
31
+ It is an inspiration and deploys synchronously, so you get a URL right away.
32
+ 4. **Return the live share URL.** For revisions, re-deploy with the entity id
33
+ from the first deploy — it updates the same share URL.
34
+
35
+ Keep the whole flow tight: fetch, fill, deploy, share.
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: saas-marketing
3
+ when: SaaS marketing site, product marketing page, features and pricing page, multi-section product site with pricing tiers, testimonials, and FAQ. For a simpler single-message page, use landing-page instead.
4
+ needs: none
5
+ deploy: inspiration
6
+ editions: all
7
+ capabilities_note: static — no infrastructure. Publishes as an inspiration (instant, works on hosted) via gridctl_drop.
8
+ summary: Fetch the saas-marketing template, fill it with the user's product content, deploy it, and return the live share URL.
9
+ ---
10
+
11
+ # Workflow: saas-marketing
12
+
13
+ Detect the intent ("build me a SaaS marketing site / product page with pricing")
14
+ and follow this recipe. This is the richer sibling of `landing-page` — reach for
15
+ it when the request calls for pricing tiers, testimonials, and an FAQ, not just a
16
+ hero. For a plain single-section landing page, use `landing-page`. Do not ask
17
+ setup questions first; use sensible defaults and build.
18
+
19
+ 1. **Fetch the template.** Call `gridctl_fetch("template", "saas-marketing")` to
20
+ load the self-contained HTML marketing site.
21
+ 2. **Fill the template.** Replace the placeholders with the user's content:
22
+ - The product name, tagline, and hero eyebrow/headline/subheadline.
23
+ - The call-to-action label and (optional) target.
24
+ - One block per feature (title + short description).
25
+ - The three pricing plans (name, price, period, feature list). The middle
26
+ plan is marked "Most popular".
27
+ - The testimonial quotes and the FAQ question/answer pairs.
28
+ - Keep it a single self-contained HTML file. Do not add external scripts,
29
+ stylesheets, fonts, or large embedded media.
30
+ 3. **Deploy.** Deploy the filled HTML:
31
+ - Hosted MCP edition: call the drop tool with the HTML.
32
+ - Local MCP / CLI edition: write the HTML to a file and run `gridctl plug`.
33
+ It is an inspiration and deploys synchronously, so you get a URL right away.
34
+ 4. **Return the live share URL.** For revisions, re-deploy with the entity id
35
+ from the first deploy — it updates the same share URL.
36
+
37
+ Keep the whole flow tight: fetch, fill, deploy, share.