makersclaw 0.5.2 → 0.7.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.
- package/README.md +73 -7
- package/package.json +3 -2
- package/r/annotate.json +4 -4
- package/r/approval-request.json +3 -3
- package/r/audio-player.json +3 -3
- package/r/auth-form.json +2 -2
- package/r/board.json +4 -4
- package/r/calendar-view.json +4 -4
- package/r/cart.json +3 -3
- package/r/chart.json +3 -3
- package/r/chat.json +3 -3
- package/r/code-editor.json +4 -4
- package/r/comment-box.json +4 -4
- package/r/contact-section.json +3 -3
- package/r/core.json +3 -3
- package/r/csv-import.json +4 -4
- package/r/data-table.json +3 -3
- package/r/diagram.json +3 -3
- package/r/doc-editor.json +4 -4
- package/r/doc-page.json +4 -4
- package/r/email-render.json +2 -2
- package/r/faq.json +2 -2
- package/r/file-upload.json +3 -3
- package/r/flow-canvas.json +4 -4
- package/r/footer.json +3 -3
- package/r/gantt.json +4 -4
- package/r/job-panel.json +3 -3
- package/r/json-editor.json +4 -4
- package/r/map.json +5 -5
- package/r/menubar.json +2 -2
- package/r/mind-map.json +4 -4
- package/r/navigation-menu.json +2 -2
- package/r/order-detail.json +2 -2
- package/r/org-chart.json +4 -4
- package/r/page-builder.json +6 -6
- package/r/payment-methods.json +2 -2
- package/r/pdf-document.json +2 -2
- package/r/pdf-viewer.json +6 -6
- package/r/product-detail.json +3 -3
- package/r/product-grid.json +4 -4
- package/r/record-form.json +3 -3
- package/r/record-notes.json +5 -5
- package/r/registry.json +121 -121
- package/r/search-dialog.json +3 -3
- package/r/settings-list.json +3 -3
- package/r/setup-checklist.json +3 -3
- package/r/share-dialog.json +3 -3
- package/r/sidebar.json +2 -2
- package/r/signature-pad.json +3 -3
- package/r/sketch-canvas.json +5 -5
- package/r/spreadsheet.json +3 -3
- package/r/stat-cards.json +4 -4
- package/r/task-list.json +4 -4
- package/r/task-model.json +3 -3
- package/r/testimonials.json +2 -2
- package/r/transaction-list.json +3 -3
- package/r/whiteboard.json +4 -4
- package/registry/blocks/annotate/README.md +14 -5
- package/registry/blocks/approval-request/README.md +15 -8
- package/registry/blocks/audio-player/README.md +17 -10
- package/registry/blocks/board/README.md +13 -9
- package/registry/blocks/board/board.jsx +1 -1
- package/registry/blocks/calendar-view/README.md +28 -4
- package/registry/blocks/cart/README.md +14 -10
- package/registry/blocks/chart/README.md +14 -7
- package/registry/blocks/chat/README.md +43 -13
- package/registry/blocks/code-editor/README.md +4 -0
- package/registry/blocks/code-editor/code-editor.jsx +1 -1
- package/registry/blocks/comment-box/README.md +20 -13
- package/registry/blocks/contact-section/README.md +7 -6
- package/registry/blocks/csv-import/README.md +34 -12
- package/registry/blocks/data-table/README.md +41 -8
- package/registry/blocks/diagram/diagram.jsx +1 -1
- package/registry/blocks/doc-editor/README.md +18 -6
- package/registry/blocks/doc-editor/doc-editor.jsx +1 -1
- package/registry/blocks/doc-page/README.md +16 -6
- package/registry/blocks/file-upload/README.md +7 -1
- package/registry/blocks/flow-canvas/README.md +16 -5
- package/registry/blocks/flow-canvas/flow-canvas.jsx +1 -1
- package/registry/blocks/footer/README.md +4 -2
- package/registry/blocks/gantt/README.md +18 -12
- package/registry/blocks/job-panel/README.md +1 -1
- package/registry/blocks/json-editor/README.md +16 -4
- package/registry/blocks/map/README.md +19 -3
- package/registry/blocks/map/map-view.jsx +1 -1
- package/registry/blocks/map/maplibre.js +1 -1
- package/registry/blocks/mind-map/README.md +16 -5
- package/registry/blocks/org-chart/README.md +10 -7
- package/registry/blocks/page-builder/README.md +13 -6
- package/registry/blocks/page-builder/page-builder.jsx +1 -1
- package/registry/blocks/page-builder/page-view.jsx +1 -1
- package/registry/blocks/page-builder/page.js +1 -1
- package/registry/blocks/pdf-viewer/README.md +22 -20
- package/registry/blocks/pdf-viewer/pdf-viewer.jsx +1 -1
- package/registry/blocks/pdf-viewer/pdfjs.js +1 -1
- package/registry/blocks/pdf-viewer/ssr-shim.js +1 -1
- package/registry/blocks/product-detail/README.md +13 -7
- package/registry/blocks/product-detail/demo.jsx +1 -1
- package/registry/blocks/product-grid/README.md +12 -10
- package/registry/blocks/record-form/README.md +26 -9
- package/registry/blocks/record-notes/README.md +42 -30
- package/registry/blocks/search-dialog/README.md +38 -7
- package/registry/blocks/settings-list/README.md +29 -17
- package/registry/blocks/setup-checklist/README.md +12 -14
- package/registry/blocks/share-dialog/README.md +1 -1
- package/registry/blocks/signature-pad/README.md +15 -4
- package/registry/blocks/sketch-canvas/README.md +13 -4
- package/registry/blocks/sketch-canvas/sketch-canvas.jsx +1 -1
- package/registry/blocks/sketch-canvas/ssr-shim.js +3 -3
- package/registry/blocks/spreadsheet/README.md +17 -8
- package/registry/blocks/stat-cards/README.md +17 -8
- package/registry/blocks/task-list/README.md +14 -11
- package/registry/blocks/task-model/README.md +3 -3
- package/registry/blocks/transaction-list/README.md +15 -7
- package/registry/blocks/whiteboard/README.md +19 -13
- package/src/cli.mjs +65 -9
- package/src/install.mjs +360 -21
- package/src/lockfile.mjs +468 -0
- package/src/pm.mjs +473 -0
- package/src/registry.mjs +125 -1
- package/templates/next/browser/app/auto-refresh.jsx +67 -0
- package/templates/next/browser/app/layout.jsx +94 -0
- package/templates/next/browser/app/page.jsx +60 -0
- package/templates/next/browser/app/s/[key]/page.jsx +95 -0
- package/templates/next/browser/lib/actions.js +16 -0
- package/templates/next/browser/lib/data.js +43 -0
- package/templates/next/files/README.md +818 -82
- package/templates/next/files/app/claw-alive/route.js +2 -2
- package/templates/next/files/app/frame.js +134 -9
- package/templates/next/files/app/layout.jsx +2 -2
- package/templates/next/files/check/run.mjs +1491 -53
- package/templates/next/files/components/ui/item.jsx +2 -2
- package/templates/next/files/components/ui/notice.jsx +1 -1
- package/templates/next/files/components/ui/separator.jsx +1 -1
- package/templates/next/files/lib/actions.js +171 -52
- package/templates/next/files/lib/brain-server.js +96 -0
- package/templates/next/files/lib/brain.js +413 -0
- package/templates/next/files/lib/claw.js +11 -0
- package/templates/next/files/lib/data.js +120 -30
- package/templates/next/files/lib/db.js +97 -17
- package/templates/next/files/lib/door.js +680 -0
- package/templates/next/files/next.config.mjs +85 -9
- package/templates/next/files/package.json +3 -3
- package/templates/next/files/{middleware.js → proxy.js} +13 -6
- package/templates/next/files/surfaces.js +3 -2
- package/templates/next/pnpm-lock.yaml +5870 -0
- package/templates/next/template.json +13 -6
- package/templates/next/files/schema.sql +0 -22
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
|
|
3
|
+
// The app's mode, from its manifest (makersclaw.json, beside this file).
|
|
4
|
+
// A browser app builds to files (output: "export"): the platform serves
|
|
5
|
+
// them, and its data door answers their reads and writes. A server app
|
|
6
|
+
// runs `next start`. Absent or unreadable is a server app, as every app
|
|
7
|
+
// before 0.7.0 is (none has a `mode`); only the exact word "browser"
|
|
8
|
+
// makes an export. `makersclaw mode` is what changes the key, never an
|
|
9
|
+
// edit here.
|
|
10
|
+
function mode() {
|
|
11
|
+
try {
|
|
12
|
+
const m = JSON.parse(readFileSync(new URL("./makersclaw.json", import.meta.url), "utf8"));
|
|
13
|
+
return m && m.mode === "browser" ? "browser" : "server";
|
|
14
|
+
} catch {
|
|
15
|
+
return "server";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const BROWSER = mode() === "browser";
|
|
19
|
+
|
|
1
20
|
// The dashboard reaches this app at /p/<label>/ through the workspace proxy,
|
|
2
21
|
// so every link and asset must carry that prefix. product_run sets
|
|
3
22
|
// CLAW_BASE_PATH at build AND start time; leave it unset to run at /.
|
|
@@ -7,8 +26,8 @@
|
|
|
7
26
|
// attribute app/layout.jsx renders is the runtime copy and is read first, so
|
|
8
27
|
// a start under a different prefix than the build still resolves.
|
|
9
28
|
//
|
|
10
|
-
// allowedOrigins is NOT optional here, and it is not yours to edit. Next
|
|
11
|
-
// refuses a Server Action whose `Origin` header disagrees with
|
|
29
|
+
// allowedOrigins is NOT optional here, and it is not yours to edit. Next
|
|
30
|
+
// (15 and 16) refuses a Server Action whose `Origin` header disagrees with
|
|
12
31
|
// `x-forwarded-host` — and in this stack they always disagree, because the
|
|
13
32
|
// sandbox ingress rewrites `x-forwarded-host` to its own vercel.run name
|
|
14
33
|
// while the browser is on the product host. Without this the app loads
|
|
@@ -17,25 +36,82 @@
|
|
|
17
36
|
// (src/lib/products.ts productAllowedOrigins): the product's own FQDN in
|
|
18
37
|
// production, the dashboard's dev origin under a path prefix. Hardcoding a
|
|
19
38
|
// localhost origin here ships an app that works in dev and refuses every
|
|
20
|
-
// write in production.
|
|
39
|
+
// write in production. A browser app has no Server Actions, so it takes
|
|
40
|
+
// none: its writes go to the platform's data door (lib/door.js).
|
|
21
41
|
const allowedOrigins = (process.env.CLAW_ALLOWED_ORIGINS || "")
|
|
22
42
|
.split(",")
|
|
23
43
|
.map((o) => o.trim())
|
|
24
44
|
.filter(Boolean);
|
|
25
45
|
|
|
46
|
+
// The same hosts, for `next dev` alone. Next 16 refuses a request for a
|
|
47
|
+
// dev resource (/_next/*, /__nextjs*: the HMR socket, the error overlay's
|
|
48
|
+
// lookups) whose Origin host is not localhost or listed here; Next 15 only
|
|
49
|
+
// warned. The preview's browser is on the product host, so without this
|
|
50
|
+
// every such request answers 403. Hostnames only: Next compares no port.
|
|
51
|
+
// Both modes: a browser app still previews on `next dev` while it is
|
|
52
|
+
// built, so CLAW_ALLOWED_ORIGINS stays its preview's rule.
|
|
53
|
+
const allowedDevOrigins = [
|
|
54
|
+
...new Set(
|
|
55
|
+
allowedOrigins
|
|
56
|
+
.map((o) => o.replace(/^[a-z][a-z0-9+.-]*:\/\//i, "").replace(/\/.*$/, "").replace(/:\d+$/, "").toLowerCase())
|
|
57
|
+
.filter(Boolean),
|
|
58
|
+
),
|
|
59
|
+
];
|
|
60
|
+
|
|
26
61
|
// `npm run check` builds into its own folder (CLAW_DIST_DIR=.next-check,
|
|
27
|
-
// check/run.mjs) so it never touches `.next
|
|
28
|
-
//
|
|
29
|
-
//
|
|
62
|
+
// check/run.mjs) so it never touches `.next`, which is not the check's:
|
|
63
|
+
// in a working copy it is the dev server's, and in a live app it holds
|
|
64
|
+
// the production build the platform made, serves and reads as its proof
|
|
65
|
+
// (.next/BUILD_ID). check/run.mjs says more.
|
|
66
|
+
//
|
|
67
|
+
// Under output: "export" a custom distDir is where the export goes, and
|
|
68
|
+
// the build then works in .next anyway (Next 16, build/index.js). So a
|
|
69
|
+
// browser app is built with the default: the build in .next, the files
|
|
70
|
+
// in out/, which is what the platform publishes. Its check builds in a
|
|
71
|
+
// copy of the app, never in the tree.
|
|
72
|
+
//
|
|
73
|
+
// CLAW_TURBOPACK_ROOT is set by `npm run check` alone, when it builds a
|
|
74
|
+
// copy of an app folder it cannot write (check/run.mjs buildSite). The
|
|
75
|
+
// copy's node_modules is a symlink back to the app's, and Turbopack (Next
|
|
76
|
+
// 16's bundler for build as well as dev) refuses a symlink that leaves its
|
|
77
|
+
// root: "Symlink [project]/node_modules is invalid, it points out of the
|
|
78
|
+
// filesystem root". The check names the nearest folder holding both.
|
|
79
|
+
// Unset, Turbopack finds the root itself.
|
|
80
|
+
const turbopackRoot = process.env.CLAW_TURBOPACK_ROOT || "";
|
|
81
|
+
|
|
82
|
+
// agentRules: false. Next 16's `next dev` writes AGENTS.md and CLAUDE.md
|
|
83
|
+
// into the app folder when it sees an AI agent in its environment
|
|
84
|
+
// (AI_AGENT, CLAUDECODE…), telling the agent to read Next's own docs.
|
|
85
|
+
// This app's agent brief is the platform's, beside the app, and the app
|
|
86
|
+
// folder holds only what the template and the app's own screens put there.
|
|
87
|
+
//
|
|
88
|
+
// mcpServer: false. Next 16's `next dev` also serves an MCP endpoint at
|
|
89
|
+
// /_next/mcp (the app's routes, logs and errors, the errors of every
|
|
90
|
+
// browser on the page, a route compile) and answers it before proxy.js
|
|
91
|
+
// runs, so no product token guards it. Off: the token check is meant to
|
|
92
|
+
// be the preview's only door. One more answers there that no setting
|
|
93
|
+
// turns off, the dev overlay's /__nextjs_attach-nodejs-inspector (it
|
|
94
|
+
// opens a Node debugger on loopback); only the platform can wall that
|
|
95
|
+
// (CHANGELOG, 0.6.0).
|
|
96
|
+
//
|
|
97
|
+
// Browser mode adds three: output "export" (every page a file); images
|
|
98
|
+
// unoptimized, a guard, since the export has no image server (nothing in
|
|
99
|
+
// the template uses next/image); and trailingSlash false, so a page is
|
|
100
|
+
// s/<key>.html, the file the platform's router looks for.
|
|
30
101
|
const nextConfig = {
|
|
31
102
|
basePath: process.env.CLAW_BASE_PATH || "",
|
|
32
103
|
distDir: process.env.CLAW_DIST_DIR || ".next",
|
|
33
104
|
env: {
|
|
34
105
|
CLAW_BASE_PATH: process.env.CLAW_BASE_PATH || "",
|
|
35
106
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
107
|
+
agentRules: false,
|
|
108
|
+
...(BROWSER ? { output: "export", images: { unoptimized: true }, trailingSlash: false } : {}),
|
|
109
|
+
...(allowedDevOrigins.length > 0 ? { allowedDevOrigins } : {}),
|
|
110
|
+
...(turbopackRoot ? { turbopack: { root: turbopackRoot }, outputFileTracingRoot: turbopackRoot } : {}),
|
|
111
|
+
experimental: {
|
|
112
|
+
mcpServer: false,
|
|
113
|
+
...(!BROWSER && allowedOrigins.length > 0 ? { serverActions: { allowedOrigins } } : {}),
|
|
114
|
+
},
|
|
39
115
|
};
|
|
40
116
|
|
|
41
117
|
export default nextConfig;
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@tailwindcss/postcss": "^4",
|
|
13
|
-
"next": "^
|
|
13
|
+
"next": "^16.3.7",
|
|
14
14
|
"pg": "^8.16.0",
|
|
15
|
-
"react": "^19.
|
|
16
|
-
"react-dom": "^19.
|
|
15
|
+
"react": "^19.3.0",
|
|
16
|
+
"react-dom": "^19.3.0",
|
|
17
17
|
"tailwindcss": "^4"
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { NextResponse } from "next/server";
|
|
2
2
|
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
3
|
+
// Next runs this before every request. Until 0.6.0 it was middleware.js
|
|
4
|
+
// (Next 15's name for it); Next 16 renamed the file and its export to
|
|
5
|
+
// `proxy`, and runs it on Node, never the edge runtime. A middleware.js
|
|
6
|
+
// beside this file fails the build, so `makersclaw update` removes the old
|
|
7
|
+
// one. Not to be confused with the product proxy, the Makersclaw dashboard
|
|
8
|
+
// door that sits in front of the whole app.
|
|
9
|
+
//
|
|
10
|
+
// The only door is that product proxy, which stamps this token on every
|
|
11
|
+
// request. The sandbox port itself is public, so without this check
|
|
12
|
+
// anyone with the URL could read the founder's data.
|
|
6
13
|
//
|
|
7
14
|
// It also tells the server which surface a request is for: /s/<key> becomes
|
|
8
15
|
// the x-claw-surface request header, so lib/data.js and lib/actions.js can
|
|
@@ -13,12 +20,12 @@ import { NextResponse } from "next/server";
|
|
|
13
20
|
// the desk, and the product proxy carries it as the x-claw-theme header
|
|
14
21
|
// on every later request (the browser's cookies never reach the app).
|
|
15
22
|
// ?theme= on any URL wins for that request and sets the claw_theme cookie
|
|
16
|
-
// too, so the app keeps its theme when run without the proxy
|
|
17
|
-
// `next dev`). app/layout.jsx reads header, then cookie, onto
|
|
23
|
+
// too, so the app keeps its theme when run without the product proxy
|
|
24
|
+
// (local `next dev`). app/layout.jsx reads header, then cookie, onto
|
|
18
25
|
// <html data-theme>.
|
|
19
26
|
const THEMES = new Set(["light", "dark"]);
|
|
20
27
|
|
|
21
|
-
export function
|
|
28
|
+
export function proxy(request) {
|
|
22
29
|
const expected = process.env.CLAW_PRODUCT_TOKEN;
|
|
23
30
|
if (expected && request.headers.get("x-claw-product-token") !== expected) {
|
|
24
31
|
return new NextResponse("Open this app from your Makersclaw dashboard.", {
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* label what the nav shows
|
|
8
8
|
* kind optional, free text, one or two words for the checklist
|
|
9
9
|
* ("board", "inbox", "report") — not an enum, nothing keys on it
|
|
10
|
-
* source the table the surface reads, when it reads one
|
|
10
|
+
* source the table the surface reads, when it reads one: its bare name
|
|
11
|
+
* ("investors"), which the app's own schema answers
|
|
11
12
|
* home true on the one surface / opens; otherwise the first entry
|
|
12
13
|
* component the surface's component. LEAVE IT OUT while the surface is
|
|
13
14
|
* still planned: the nav shows it as planned and its page says
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
// A domain surface, once built, looks like this:
|
|
28
29
|
//
|
|
29
30
|
// import Investors from "./surfaces/investors";
|
|
30
|
-
// { key: "investors", label: "Investors", kind: "board", source: "
|
|
31
|
+
// { key: "investors", label: "Investors", kind: "board", source: "investors", home: true, component: Investors },
|
|
31
32
|
|
|
32
33
|
const surfaces = [];
|
|
33
34
|
|