create-agntcms-app 0.3.1 → 0.3.4
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/dist/index.mjs +1 -1
- package/dist/template/_gitignore +2 -9
- package/dist/template/app/api/agntcms/[...path]/route.dev.ts +5 -15
- package/dist/template/app/api/agntcms/_shared.ts +1 -24
- package/dist/template/package.json +1 -1
- package/package.json +2 -2
- package/dist/template/app/api/agntcms/forms/submit/route.ts +0 -17
package/dist/index.mjs
CHANGED
package/dist/template/_gitignore
CHANGED
|
@@ -49,15 +49,8 @@ Thumbs.db
|
|
|
49
49
|
.claude/settings.local.json
|
|
50
50
|
|
|
51
51
|
# agntcms — content state
|
|
52
|
-
# Form submissions are user data — not source content. Gitignore by default
|
|
53
|
-
# per ARCHITECTURE.md §4 and §6.5.
|
|
54
|
-
content/submissions/*
|
|
55
|
-
# Keep the sentinel file so the directory exists on a fresh clone, preventing
|
|
56
|
-
# the FS adapter from failing when it tries to list a non-existent directory.
|
|
57
|
-
!content/submissions/.gitkeep
|
|
58
|
-
|
|
59
52
|
# Drafts are transient editor state — written by the dev server on every
|
|
60
|
-
# preview-mode edit.
|
|
61
|
-
#
|
|
53
|
+
# preview-mode edit. Ignore the directory's contents but keep the sentinel
|
|
54
|
+
# so the FS adapter can list it on a fresh clone.
|
|
62
55
|
content/drafts/*
|
|
63
56
|
!content/drafts/.gitkeep
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
// FROZEN — do not edit. Framework file managed by agntcms.
|
|
2
2
|
//
|
|
3
3
|
// Single catch-all dispatcher for every admin/agent endpoint under
|
|
4
|
-
// /api/agntcms
|
|
5
|
-
//
|
|
4
|
+
// /api/agntcms/*. All admin and agent endpoints are dev-only: this file
|
|
5
|
+
// carries the .dev.ts suffix so withagntcms() excludes it from production
|
|
6
|
+
// builds via the pageExtensions hook.
|
|
6
7
|
//
|
|
7
8
|
// Before v0.3 the template carried ~30 thin proxy files, one per endpoint.
|
|
8
9
|
// A new endpoint in the framework required users to copy the new file into
|
|
9
10
|
// their frozen zone. With this catch-all the routing table lives inside
|
|
10
11
|
// @agntcms/next/handlers (dispatcher.ts) and new endpoints flow to users
|
|
11
12
|
// through a regular `pnpm up @agntcms/next`. See ARCHITECTURE.md §3.
|
|
12
|
-
//
|
|
13
|
-
// Next.js .dev.ts extension: withagntcms() strips .dev.ts routes from the
|
|
14
|
-
// pageExtensions list so this file is never compiled into a production build.
|
|
15
|
-
// That is what keeps the admin surface dev-only.
|
|
16
13
|
|
|
17
14
|
import { createagntcmsRouteHandler } from '@agntcms/next/handlers'
|
|
18
15
|
import config from '@/agntcms/config'
|
|
19
16
|
import {
|
|
20
17
|
contentAdapter,
|
|
21
18
|
assetAdapter,
|
|
22
|
-
submissionAdapter,
|
|
23
19
|
runtime,
|
|
24
20
|
taskStore,
|
|
25
21
|
bridge,
|
|
@@ -27,8 +23,8 @@ import {
|
|
|
27
23
|
} from '../_shared'
|
|
28
24
|
|
|
29
25
|
// Pre-compute section-derived maps once at module evaluation time.
|
|
30
|
-
// These are needed by the global
|
|
31
|
-
//
|
|
26
|
+
// These are needed by the global handler; building them here avoids
|
|
27
|
+
// repeating the map construction inside per-request paths.
|
|
32
28
|
const allowedTypes = new Set(config.sections.map((s) => s.name))
|
|
33
29
|
const sectionDefaults = new Map(config.sections.map((s) => [s.name, s.defaults]))
|
|
34
30
|
|
|
@@ -40,10 +36,4 @@ export const { GET, POST, PUT, DELETE } = createagntcmsRouteHandler({
|
|
|
40
36
|
preview: { tokenStore: previewTokenStore },
|
|
41
37
|
events: { taskStore },
|
|
42
38
|
mcp: { bridge, taskStore },
|
|
43
|
-
template: { sectionDefaults, templates: config.templates },
|
|
44
|
-
formsList: {
|
|
45
|
-
forms: config.forms,
|
|
46
|
-
adapter: submissionAdapter.info,
|
|
47
|
-
},
|
|
48
|
-
formsRead: { submissionAdapter, knownForms: new Set(config.forms.map((f) => f.name)) },
|
|
49
39
|
})
|
|
@@ -26,38 +26,15 @@
|
|
|
26
26
|
// globalThis outlives any individual module evaluation in the same process.
|
|
27
27
|
// contentAdapter and runtime are stateless closures — they don't need this.
|
|
28
28
|
|
|
29
|
-
import { createRuntime
|
|
29
|
+
import { createRuntime } from '@agntcms/next/server'
|
|
30
30
|
import { createAgentBridge, createTaskStore, createPreviewTokenStore } from '@agntcms/next/handlers'
|
|
31
31
|
import config from '@/agntcms/config'
|
|
32
32
|
|
|
33
33
|
export const contentAdapter = config.contentAdapter
|
|
34
34
|
export const assetAdapter = config.assetAdapter
|
|
35
|
-
export const submissionAdapter = config.submissionAdapter
|
|
36
35
|
|
|
37
|
-
// Build the form registry once from the registered definitions. The registry
|
|
38
|
-
// is stable across requests: `defineConfig` runs once at module-evaluation
|
|
39
|
-
// time and the definitions array never changes at runtime.
|
|
40
|
-
const formRegistry = buildFormRegistry(config.forms)
|
|
41
|
-
|
|
42
|
-
// Runtime wired with forms + submission adapter so `submitForm` works.
|
|
43
|
-
// The existing handlers that don't use forms (page, draft, global, etc.)
|
|
44
|
-
// share this same runtime — the forms wiring adds no overhead for those paths.
|
|
45
36
|
export const runtime = createRuntime({
|
|
46
37
|
contentAdapter,
|
|
47
|
-
forms: formRegistry,
|
|
48
|
-
submissionAdapter,
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
// In-memory rate limiter for the forms submit endpoint. One limiter per
|
|
52
|
-
// process — the globalThis pattern below ensures it survives HMR exactly
|
|
53
|
-
// the same way as the task store and bridge do.
|
|
54
|
-
const g2 = globalThis as unknown as {
|
|
55
|
-
__agntcms_rateLimit?: ReturnType<typeof createRateLimit>
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export const rateLimit = g2.__agntcms_rateLimit ??= createRateLimit({
|
|
59
|
-
perWindow: config.submissionRateLimit.perMinute,
|
|
60
|
-
windowMs: 60_000,
|
|
61
38
|
})
|
|
62
39
|
|
|
63
40
|
// Persist stateful singletons across Next.js HMR re-evaluations in dev mode.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-agntcms-app",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "create-agntcms-app: scaffold a new agntcms project from the canonical template",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"commander": "^12.1.0",
|
|
19
|
-
"@agntcms/skills": "0.3.
|
|
19
|
+
"@agntcms/skills": "0.3.4"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"tsup": "^8.3.5",
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// FROZEN — do not edit. Framework file managed by agntcms.
|
|
2
|
-
//
|
|
3
|
-
// Accepts form submissions from <Form definition={...} /> client components.
|
|
4
|
-
// Validates the payload against the registered form schema, applies the
|
|
5
|
-
// honeypot suppression check, enforces the per-IP-per-form rate limit, and
|
|
6
|
-
// stores the submission via the configured SubmissionStorageAdapter.
|
|
7
|
-
//
|
|
8
|
-
// See ARCHITECTURE.md §6.5 for the full submission pipeline.
|
|
9
|
-
|
|
10
|
-
import { createSubmitFormHandler } from '@agntcms/next/handlers'
|
|
11
|
-
import { runtime, rateLimit } from '../../_shared'
|
|
12
|
-
|
|
13
|
-
const handle = createSubmitFormHandler({ runtime, rateLimit })
|
|
14
|
-
|
|
15
|
-
export async function POST(req: Request): Promise<Response> {
|
|
16
|
-
return handle(req)
|
|
17
|
-
}
|