aicms 0.0.0-stage → 0.5.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/ARCHITECTURE.md +467 -0
- package/LICENSE +21 -0
- package/README.md +200 -2
- package/README.uk.md +201 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +722 -0
- package/dist/config-edit.d.ts +18 -0
- package/dist/config-edit.js +201 -0
- package/dist/config.d.ts +55 -0
- package/dist/config.js +32 -0
- package/dist/edge.d.ts +22 -0
- package/dist/edge.js +56 -0
- package/dist/gates/a2a.d.ts +45 -0
- package/dist/gates/a2a.js +126 -0
- package/dist/gates/discovery.d.ts +36 -0
- package/dist/gates/discovery.js +54 -0
- package/dist/gates/events.d.ts +14 -0
- package/dist/gates/events.js +86 -0
- package/dist/gates/graphql.d.ts +41 -0
- package/dist/gates/graphql.js +226 -0
- package/dist/gates/mcp.d.ts +8 -0
- package/dist/gates/mcp.js +60 -0
- package/dist/gates/openapi.d.ts +56 -0
- package/dist/gates/openapi.js +61 -0
- package/dist/gates/rest.d.ts +21 -0
- package/dist/gates/rest.js +263 -0
- package/dist/gates/studio.d.ts +21 -0
- package/dist/gates/studio.js +107 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +19 -0
- package/dist/kernel/action.d.ts +49 -0
- package/dist/kernel/action.js +22 -0
- package/dist/kernel/briefs.d.ts +161 -0
- package/dist/kernel/briefs.js +197 -0
- package/dist/kernel/changesets.d.ts +367 -0
- package/dist/kernel/changesets.js +765 -0
- package/dist/kernel/cms.d.ts +127 -0
- package/dist/kernel/cms.js +419 -0
- package/dist/kernel/core-actions.d.ts +5 -0
- package/dist/kernel/core-actions.js +487 -0
- package/dist/kernel/errors.d.ts +14 -0
- package/dist/kernel/errors.js +25 -0
- package/dist/kernel/install.d.ts +32 -0
- package/dist/kernel/install.js +34 -0
- package/dist/kernel/model-actions.d.ts +5 -0
- package/dist/kernel/model-actions.js +126 -0
- package/dist/kernel/modules.d.ts +221 -0
- package/dist/kernel/modules.js +207 -0
- package/dist/kernel/policy.d.ts +42 -0
- package/dist/kernel/policy.js +47 -0
- package/dist/load.d.ts +10 -0
- package/dist/load.js +63 -0
- package/dist/modules/catalog.d.ts +15 -0
- package/dist/modules/catalog.js +21 -0
- package/dist/modules/commerce.d.ts +67 -0
- package/dist/modules/commerce.js +260 -0
- package/dist/modules/git-sync.d.ts +20 -0
- package/dist/modules/git-sync.js +187 -0
- package/dist/modules/i18n.d.ts +6 -0
- package/dist/modules/i18n.js +168 -0
- package/dist/modules/index.d.ts +9 -0
- package/dist/modules/index.js +10 -0
- package/dist/modules/lint.d.ts +22 -0
- package/dist/modules/lint.js +126 -0
- package/dist/modules/media.d.ts +52 -0
- package/dist/modules/media.js +319 -0
- package/dist/modules/payments.d.ts +19 -0
- package/dist/modules/payments.js +110 -0
- package/dist/modules/search.d.ts +27 -0
- package/dist/modules/search.js +81 -0
- package/dist/modules/seo.d.ts +34 -0
- package/dist/modules/seo.js +189 -0
- package/dist/modules/text.d.ts +10 -0
- package/dist/modules/text.js +42 -0
- package/dist/node.d.ts +7 -0
- package/dist/node.js +11 -0
- package/dist/registry.d.ts +57 -0
- package/dist/registry.js +110 -0
- package/dist/schema/fields.d.ts +100 -0
- package/dist/schema/fields.js +134 -0
- package/dist/schema/markdown.d.ts +7 -0
- package/dist/schema/markdown.js +168 -0
- package/dist/schema/model.d.ts +44 -0
- package/dist/schema/model.js +104 -0
- package/dist/schema/slug.d.ts +2 -0
- package/dist/schema/slug.js +40 -0
- package/dist/store/d1.d.ts +30 -0
- package/dist/store/d1.js +27 -0
- package/dist/store/postgres.d.ts +164 -0
- package/dist/store/postgres.js +552 -0
- package/dist/store/sql.d.ts +135 -0
- package/dist/store/sql.js +530 -0
- package/dist/store/sqlite.d.ts +14 -0
- package/dist/store/sqlite.js +60 -0
- package/dist/store/types.d.ts +226 -0
- package/dist/store/types.js +21 -0
- package/dist/studio/assets/geologica-cyrillic-ext-wght-normal-C8B9Chlh.woff2 +0 -0
- package/dist/studio/assets/geologica-cyrillic-wght-normal-DbeVG3Ps.woff2 +0 -0
- package/dist/studio/assets/geologica-greek-wght-normal-DPM5d9ub.woff2 +0 -0
- package/dist/studio/assets/geologica-latin-ext-wght-normal-DZyYlgcm.woff2 +0 -0
- package/dist/studio/assets/geologica-latin-wght-normal-BBL8hQxZ.woff2 +0 -0
- package/dist/studio/assets/geologica-vietnamese-wght-normal-DcI17N1q.woff2 +0 -0
- package/dist/studio/assets/index-3dJ0YHxb.js +22 -0
- package/dist/studio/assets/index-DuyGLFw4.css +1 -0
- package/dist/studio/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/studio/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/studio/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/studio/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/studio/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/studio/assets/unbounded-cyrillic-wght-normal-C627f1f8.woff2 +0 -0
- package/dist/studio/assets/unbounded-latin-ext-wght-normal-D6H-S6MW.woff2 +0 -0
- package/dist/studio/assets/unbounded-latin-wght-normal-D5afBTBx.woff2 +0 -0
- package/dist/studio/assets/unbounded-vietnamese-wght-normal-rat7GD3o.woff2 +0 -0
- package/dist/studio/index.html +21 -0
- package/dist/typegen.d.ts +7 -0
- package/dist/typegen.js +55 -0
- package/package.json +88 -4
package/README.md
CHANGED
|
@@ -1,3 +1,201 @@
|
|
|
1
|
-
#
|
|
1
|
+
# AICMS
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**The CMS for AI agents.** Describe a model once and get REST, MCP tools, an admin and types. Agents draft, people decide.
|
|
4
|
+
|
|
5
|
+
[Website](https://malkovych.github.io/aicms/) · [Architecture](ARCHITECTURE.md) · [Українською](README.uk.md)
|
|
6
|
+
|
|
7
|
+
> Status: phase 4 works. People hand agents work as briefs; every change passes content checks before a person sees it; approved changes can wait for their publish time; Studio has a ⌘K palette. Underneath: the kernel, Studio, modules and adapters from phases 0–2, and from phase 3 Postgres and Cloudflare Workers, live presence, a module registry, A2A and commerce.
|
|
8
|
+
|
|
9
|
+
## Why
|
|
10
|
+
|
|
11
|
+
WordPress was built for people clicking through an admin. Agents need explicit schemas, typed tools, permission boundaries and a safe way to propose changes. AICMS is built around those needs:
|
|
12
|
+
|
|
13
|
+
- **One schema, every interface.** A model in `models/post.ts` becomes REST endpoints, MCP tools, validation, OpenAPI, `llms.txt`, Studio forms and TypeScript types.
|
|
14
|
+
- **Agents never write to production directly.** Their changes go into a changeset, pass checks and wait for review. Every action is logged, and any change can be rolled back.
|
|
15
|
+
- **Field-level permissions.** An agent with `post:update.seo` only sees the `seo` field in its tool schema.
|
|
16
|
+
- **Markdown in, blocks out.** Agents write Markdown; AICMS stores structured blocks.
|
|
17
|
+
- **Modules like Lego.** A module is one folder with one manifest that declares what it provides and requires.
|
|
18
|
+
|
|
19
|
+
## A whole site in two files
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
// models/post.ts
|
|
23
|
+
import { defineModel, field } from "aicms"
|
|
24
|
+
|
|
25
|
+
export default defineModel({
|
|
26
|
+
name: "post",
|
|
27
|
+
fields: {
|
|
28
|
+
title: field.text({ required: true }),
|
|
29
|
+
slug: field.slug({ from: "title" }),
|
|
30
|
+
body: field.blocks(["paragraph", "heading", "image", "quote", "cta"]),
|
|
31
|
+
},
|
|
32
|
+
agent: { guide: "Short sentences, friendly expert tone", can: ["create", "update"] },
|
|
33
|
+
})
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
// aicms.config.ts
|
|
38
|
+
import { defineConfig, sqlite } from "aicms"
|
|
39
|
+
|
|
40
|
+
export default defineConfig({
|
|
41
|
+
db: sqlite(".aicms/data.db"),
|
|
42
|
+
public: ["post:read"],
|
|
43
|
+
agents: { writer: { scopes: ["post:draft"], review: "human" } },
|
|
44
|
+
})
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Quick start
|
|
48
|
+
|
|
49
|
+
Requires Node.js 22.13 or newer (AICMS uses the built-in `node:sqlite`).
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm create aicms@latest my-site
|
|
53
|
+
cd my-site
|
|
54
|
+
npm run dev # Studio, REST, MCP and events on :4321
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`create-aicms` installs `aicms` and writes `aicms.config.ts`, two example models, `.mcp.json` and `AGENTS.md`. `dev` prints a one-time Studio sign-in link. Open it, and Studio keeps you signed in for 30 days. `npx aicms login` makes a new link at any time.
|
|
58
|
+
|
|
59
|
+
Coding agents that read `.mcp.json` (Claude Code, Cursor) get the site's tools as the `writer` agent when you open the folder, over stdio, with no token. Any other agent runs the same server with `npx aicms mcp --agent writer`. To connect over HTTP, issue a token:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npx aicms agent create writer # prints a token once
|
|
63
|
+
claude mcp add --transport http aicms http://localhost:4321/mcp --header "Authorization: Bearer <token>"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Whatever the agent submits appears in Studio's Inbox with a before/after diff. You can also review from the terminal:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npx aicms changes
|
|
70
|
+
npx aicms merge <changeset-id>
|
|
71
|
+
npx aicms reject <changeset-id> --comment "Shorter title, please"
|
|
72
|
+
npx aicms revert <changeset-id> # undo something already published
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
From source instead: `git clone https://github.com/malkovych/aicms && cd aicms && npm install && npm run build`, then `node ../../dist/cli.js dev` in `examples/blog`.
|
|
76
|
+
|
|
77
|
+
## Briefs, checks and schedules
|
|
78
|
+
|
|
79
|
+
People hand agents work as **briefs**: "Write a post about the spring menu, publish Friday at 9:00". An agent finds its briefs with `cms_briefs`, asks a person when it's stuck (`cms_brief_update` with a question), and answers with changes: `cms_submit({ brief })`. Merging closes the brief; a rejection comes back as a note.
|
|
80
|
+
|
|
81
|
+
Every change passes **checks** before a person sees it: schema, conflicts, and the checks modules bring. `lint` stops a draft that still says "[insert price]" and flags "delve"; `seo` flags a missing description. Errors go back to the agent, warnings go to the reviewer, and a warning sends even an `auto` agent's change to a person. `cms_check` runs them before submitting.
|
|
82
|
+
|
|
83
|
+
Approve now or **schedule** it: "Schedule for Fri 09:00" in the Inbox when the agent asked for a time, or `cms_merge({ id, at })`. `aicms dev` publishes on time; on Cloudflare a cron trigger does.
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
agents: {
|
|
87
|
+
writer: { scopes: ["post:draft", "tag:draft"], review: "human" },
|
|
88
|
+
tidy: { scopes: ["tag:draft"], review: { auto: ["tag:update.name"] } }, // renames publish themselves, nothing else does
|
|
89
|
+
planner: { scopes: ["post:read", "briefs:write"] }, // writes briefs for the others
|
|
90
|
+
},
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
aicms brief "Write about the spring menu" --agent writer --at 2026-12-04T09:00
|
|
95
|
+
aicms briefs
|
|
96
|
+
aicms merge <changeset-id> --at 2026-12-04T09:00
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Modules
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
aicms add lint # content checks: placeholders block, filler phrases and missing alt text warn
|
|
103
|
+
aicms add seo # scores entries, sitemap.xml and robots.txt
|
|
104
|
+
aicms add search # ranked full-text search in any language
|
|
105
|
+
aicms add media # media library with uploads, image sizes and alt text
|
|
106
|
+
aicms add i18n # translations across locales
|
|
107
|
+
aicms add git-sync # content as Markdown files; edits come back for review
|
|
108
|
+
aicms add commerce # products, orders, checkout (pulls in manual-payments; or add stripe)
|
|
109
|
+
aicms search reviews # find modules in the registry
|
|
110
|
+
aicms modules # what is installed and what each module may do
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
A module is one file: what it provides and requires, its models, Actions, hooks and routes. `aicms module new reviews` scaffolds one. Before anything is installed you see its permissions; an agent can propose a module (`cms_propose_module`), and a person installs it from the Inbox.
|
|
114
|
+
|
|
115
|
+
## Where it runs
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
db: sqlite(".aicms/data.db") // default, built into Node
|
|
119
|
+
db: postgres({ url: process.env.DATABASE_URL }) // npm install pg
|
|
120
|
+
db: d1("DB") // Cloudflare Workers, see examples/edge
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
On Cloudflare, one Worker serves everything: `export default createWorker(config)` from `aicms/edge`, with media in R2 and Studio from Workers Assets. See [examples/edge](examples/edge).
|
|
124
|
+
|
|
125
|
+
## Studio
|
|
126
|
+
|
|
127
|
+
Studio is the admin for people, served at `/studio/`:
|
|
128
|
+
|
|
129
|
+
- **Inbox:** agents' changesets with a word-level diff and check warnings. Approve, schedule, request changes (the comment goes back to the agent) or close. Undo a published changeset in one click.
|
|
130
|
+
- **Briefs:** write work for agents, follow it, answer their questions.
|
|
131
|
+
- **Content:** forms generated from your models, a Markdown editor with preview, and every entry's history with one-click restore.
|
|
132
|
+
- **Agents:** scopes, review mode, budget use and pending work; issue or revoke tokens.
|
|
133
|
+
- **Media** and **Modules:** the media library, module manifests and one-click install; SEO and translation panels beside each entry.
|
|
134
|
+
- **Activity:** every action by people and agents, live.
|
|
135
|
+
- **Presence:** who else is on an entry, people and agents, and a warning when someone's draft would conflict.
|
|
136
|
+
- **⌘K:** jump to any page or entry, start a new entry or brief.
|
|
137
|
+
|
|
138
|
+
English and Ukrainian, light and dark themes, works on a phone.
|
|
139
|
+
|
|
140
|
+
## Clients and frameworks
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
// any JavaScript runtime
|
|
144
|
+
import { createClient } from "@aicms/client"
|
|
145
|
+
import type { Schema } from "./aicms-types" // npx aicms types --out aicms-types.ts
|
|
146
|
+
|
|
147
|
+
const cms = createClient<Schema>({ url: "http://localhost:4321", token })
|
|
148
|
+
const post = await cms.post.get({ slug: "welcome-to-aicms" }) // typed
|
|
149
|
+
for await (const e of cms.events()) console.log(e.event) // live
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
# Python, standard library only
|
|
154
|
+
from aicms import Client
|
|
155
|
+
cms = Client("http://localhost:4321", token="aicms_...")
|
|
156
|
+
cms.post.draft(title="Hello from Python", body="Markdown **works**")
|
|
157
|
+
cms.submit(note="First post")
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
| Package | What it is |
|
|
161
|
+
|---|---|
|
|
162
|
+
| [`@aicms/client`](packages/client) | Typed client, live events and safe `blocksToHtml`, no dependencies |
|
|
163
|
+
| [`@aicms/next`](packages/next) | Reads cached with per-model tags, revalidation from webhooks, `<Blocks />` |
|
|
164
|
+
| [`@aicms/nuxt`](packages/nuxt) | Nuxt module: `useAicms`, `useAicmsData`, a webhook that clears Nitro's page cache |
|
|
165
|
+
| [`@aicms/sveltekit`](packages/sveltekit) | Load helpers with `depends`, cache headers, live updates on publish |
|
|
166
|
+
| [`@aicms/astro`](packages/astro) | Content Layer loader with pre-rendered blocks |
|
|
167
|
+
| [`aicms` (Python)](sdk/python) | Python client, standard library only |
|
|
168
|
+
|
|
169
|
+
## What's in the repository
|
|
170
|
+
|
|
171
|
+
| Piece | Where |
|
|
172
|
+
|---|---|
|
|
173
|
+
| Field builders, models, Markdown ↔ blocks, slugs | `src/schema/` |
|
|
174
|
+
| Action Bus, policies, changesets, checks, schedules, briefs, rollback, module SDK, live feed | `src/kernel/` |
|
|
175
|
+
| Official modules: seo, search, media, i18n, git-sync, lint, commerce, payments | `src/modules/` |
|
|
176
|
+
| Stores: SQLite (node:sqlite or D1) and Postgres | `src/store/` |
|
|
177
|
+
| REST, OpenAPI, GraphQL, A2A, discovery, MCP, SSE, module routes, Studio | `src/gates/` |
|
|
178
|
+
| Cloudflare Workers entry, module registry | `src/edge.ts`, `src/registry.ts` |
|
|
179
|
+
| CLI, `aicms types`, config edits for `aicms add` | `src/cli.ts`, `src/typegen.ts`, `src/config-edit.ts` |
|
|
180
|
+
| Studio (React + Framer Motion, shipped prebuilt in `dist/studio`) | `studio/` |
|
|
181
|
+
| TypeScript client and framework adapters | `packages/` |
|
|
182
|
+
| Python client | `sdk/python/` |
|
|
183
|
+
| `create-aicms`, release scripts and the package smoke test | `packages/create-aicms/`, `scripts/` |
|
|
184
|
+
|
|
185
|
+
## Development
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
npm test # kernel, gates, SDK and adapters (node:test, no build step)
|
|
189
|
+
npm run test:pg # the same suite on Postgres (PGlite, in-process)
|
|
190
|
+
npm run test:python # Python client
|
|
191
|
+
npm run typecheck
|
|
192
|
+
npm run build # dist/ for the CLI, the packages and Studio
|
|
193
|
+
npm run test:package # pack the packages, scaffold a site from the tarballs, drive it
|
|
194
|
+
npm run studio # Studio dev server on :5173, proxied to a running `aicms dev`
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Releases: `node scripts/version.mjs 0.6.0` sets the version everywhere; pushing the tag `v0.6.0` publishes to npm and PyPI from GitHub Actions.
|
|
198
|
+
|
|
199
|
+
## License
|
|
200
|
+
|
|
201
|
+
[MIT](LICENSE). AICMS is free for any use, including commercial: build sites, products and services on it without asking or paying. If the project ever needs funding, it will come from donations, never from a paid edition.
|
package/README.uk.md
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# AICMS
|
|
2
|
+
|
|
3
|
+
**CMS для AI-агентів.** Опиши модель один раз і отримаєш REST, MCP-інструменти, адмінку й типи. Агенти пропонують, люди вирішують.
|
|
4
|
+
|
|
5
|
+
[Сайт](https://malkovych.github.io/aicms/uk/) · [Архітектура](ARCHITECTURE.uk.md) · [English](README.md)
|
|
6
|
+
|
|
7
|
+
> Статус: фаза 4 працює. Люди дають агентам завдання брифами; кожна зміна проходить перевірки контенту, перш ніж її побачить людина; схвалені зміни можуть чекати свого часу публікації; у Studio є палітра ⌘K. Під цим: ядро, Studio, модулі й адаптери з фаз 0–2, а з фази 3 — Postgres і Cloudflare Workers, присутність наживо, реєстр модулів, A2A і commerce.
|
|
8
|
+
|
|
9
|
+
## Навіщо
|
|
10
|
+
|
|
11
|
+
WordPress створювали для людей, які клацають адмінку. Агентам потрібні явні схеми, типізовані інструменти, межі прав і безпечний спосіб пропонувати зміни. AICMS побудована навколо цього:
|
|
12
|
+
|
|
13
|
+
- **Одна схема, усі інтерфейси.** Модель у `models/post.ts` стає REST-ендпоінтами, MCP-інструментами, валідацією, OpenAPI, `llms.txt`, формами в Studio і типами TypeScript.
|
|
14
|
+
- **Агент не пише в прод напряму.** Його зміни йдуть у changeset, проходять перевірки й чекають рев'ю. Кожна дія потрапляє в журнал, будь-яку зміну можна відкотити.
|
|
15
|
+
- **Права до поля.** Агент зі scope `post:update.seo` бачить у схемі інструмента лише поле `seo`.
|
|
16
|
+
- **Markdown на вході, блоки в базі.** Агент пише Markdown, AICMS зберігає структуровані блоки.
|
|
17
|
+
- **Модулі як Lego.** Модуль — одна папка з одним маніфестом, який каже, що модуль дає і що йому потрібно.
|
|
18
|
+
|
|
19
|
+
## Цілий сайт у двох файлах
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
// models/post.ts
|
|
23
|
+
import { defineModel, field } from "aicms"
|
|
24
|
+
|
|
25
|
+
export default defineModel({
|
|
26
|
+
name: "post",
|
|
27
|
+
fields: {
|
|
28
|
+
title: field.text({ required: true }),
|
|
29
|
+
slug: field.slug({ from: "title" }),
|
|
30
|
+
body: field.blocks(["paragraph", "heading", "image", "quote", "cta"]),
|
|
31
|
+
},
|
|
32
|
+
agent: { guide: "Короткі речення, дружній експертний тон", can: ["create", "update"] },
|
|
33
|
+
})
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
// aicms.config.ts
|
|
38
|
+
import { defineConfig, sqlite } from "aicms"
|
|
39
|
+
|
|
40
|
+
export default defineConfig({
|
|
41
|
+
db: sqlite(".aicms/data.db"),
|
|
42
|
+
public: ["post:read"],
|
|
43
|
+
agents: { writer: { scopes: ["post:draft"], review: "human" } },
|
|
44
|
+
})
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Швидкий старт
|
|
48
|
+
|
|
49
|
+
Потрібен Node.js 22.13 або новіший (AICMS використовує вбудований `node:sqlite`).
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm create aicms@latest my-site
|
|
53
|
+
cd my-site
|
|
54
|
+
npm run dev # Studio, REST, MCP і події на :4321
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`create-aicms` встановлює `aicms` і створює `aicms.config.ts`, дві моделі для прикладу, `.mcp.json` та `AGENTS.md`. `dev` показує одноразове посилання для входу в Studio. Відкрий його, і Studio триматиме вхід 30 днів. `npx aicms login` дає нове посилання будь-коли.
|
|
58
|
+
|
|
59
|
+
Агенти для коду, що читають `.mcp.json` (Claude Code, Cursor), отримують інструменти сайту як агент `writer`, щойно відкриєш папку: через stdio, без токена. Будь-який інший агент запускає той самий сервер командою `npx aicms mcp --agent writer`. Щоб підключитися через HTTP, видай токен:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npx aicms agent create writer # покаже токен один раз
|
|
63
|
+
claude mcp add --transport http aicms http://localhost:4321/mcp --header "Authorization: Bearer <token>"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Усе, що агент надішле, з'явиться у «Вхідних» Studio з diff «було / стало». Рев'ю можна робити й у терміналі:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npx aicms changes
|
|
70
|
+
npx aicms merge <changeset-id>
|
|
71
|
+
npx aicms reject <changeset-id> --comment "Коротший заголовок, будь ласка"
|
|
72
|
+
npx aicms revert <changeset-id> # скасувати вже опубліковане
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Або з вихідного коду: `git clone https://github.com/malkovych/aicms && cd aicms && npm install && npm run build`, а потім `node ../../dist/cli.js dev` у `examples/blog`.
|
|
76
|
+
|
|
77
|
+
## Брифи, перевірки й розклад
|
|
78
|
+
|
|
79
|
+
Люди дають агентам завдання **брифами**: «Напиши пост про весняне меню, опублікуй у п'ятницю о 9:00». Агент бачить свої брифи через `cms_briefs`, питає людину, коли застряг (`cms_brief_update` із питанням), і відповідає змінами: `cms_submit({ brief })`. Злиття закриває бриф, а відмова повертається нотаткою.
|
|
80
|
+
|
|
81
|
+
Кожна зміна проходить **перевірки**, перш ніж її побачить людина: схема, конфлікти й перевірки, які приносять модулі. `lint` зупиняє чернетку, де досі написано «[insert price]», і позначає «delve»; `seo` нагадує про відсутній опис. Помилки повертаються агенту, попередження йдуть рев'юеру, і попередження віддає людині навіть зміну агента з `auto`. `cms_check` запускає їх до сабміту.
|
|
82
|
+
|
|
83
|
+
Схвали зараз або **заплануй**: «Запланувати на Пт 09:00» у «Вхідних», якщо агент попросив час, або `cms_merge({ id, at })`. `aicms dev` публікує вчасно; на Cloudflare це робить cron trigger.
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
agents: {
|
|
87
|
+
writer: { scopes: ["post:draft", "tag:draft"], review: "human" },
|
|
88
|
+
tidy: { scopes: ["tag:draft"], review: { auto: ["tag:update.name"] } }, // перейменування публікуються самі, решта ні
|
|
89
|
+
planner: { scopes: ["post:read", "briefs:write"] }, // пише брифи для інших
|
|
90
|
+
},
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
aicms brief "Напиши про весняне меню" --agent writer --at 2026-12-04T09:00
|
|
95
|
+
aicms briefs
|
|
96
|
+
aicms merge <changeset-id> --at 2026-12-04T09:00
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Модулі
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
aicms add lint # перевірки контенту: заглушки блокують, слова-паразити й відсутній alt попереджають
|
|
103
|
+
aicms add seo # оцінка записів, sitemap.xml і robots.txt
|
|
104
|
+
aicms add search # пошук будь-якою мовою з ранжуванням
|
|
105
|
+
aicms add media # медіатека із завантаженням, розмірами зображень і alt-текстом
|
|
106
|
+
aicms add i18n # переклади між мовами
|
|
107
|
+
aicms add git-sync # контент як Markdown-файли; правки повертаються на рев'ю
|
|
108
|
+
aicms add commerce # товари, замовлення, checkout (підтягне manual-payments; або додай stripe)
|
|
109
|
+
aicms search reviews # пошук модулів у реєстрі
|
|
110
|
+
aicms modules # що встановлено і що кожному модулю дозволено
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Модуль — один файл: що він дає й потребує, його моделі, Actions, хуки й маршрути. `aicms module new reviews` створює заготовку. Перед встановленням видно права модуля; агент може запропонувати модуль (`cms_propose_module`), а встановлює людина з «Вхідних».
|
|
114
|
+
|
|
115
|
+
## Де працює
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
db: sqlite(".aicms/data.db") // за замовчуванням, вбудований у Node
|
|
119
|
+
db: postgres({ url: process.env.DATABASE_URL }) // npm install pg
|
|
120
|
+
db: d1("DB") // Cloudflare Workers, див. examples/edge
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
На Cloudflare усе роздає один Worker: `export default createWorker(config)` з `aicms/edge`, медіа в R2, Studio з Workers Assets. Див. [examples/edge](examples/edge).
|
|
124
|
+
|
|
125
|
+
## Studio
|
|
126
|
+
|
|
127
|
+
Studio — адмінка для людей за адресою `/studio/`:
|
|
128
|
+
|
|
129
|
+
- **Вхідні:** changesets від агентів із diff до слова й попередженнями перевірок. Схвалити, запланувати, попросити правки (коментар іде агенту) або закрити. Опублікований changeset скасовується одним кліком.
|
|
130
|
+
- **Брифи:** завдання для агентів, їхній стан і відповіді на питання агентів.
|
|
131
|
+
- **Контент:** форми, згенеровані з моделей, Markdown-редактор із переглядом, історія кожного запису й відновлення версії одним кліком.
|
|
132
|
+
- **Агенти:** scopes, режим рев'ю, використання бюджету, незавершена робота; видача й відкликання токенів.
|
|
133
|
+
- **Медіа** і **Модулі:** медіатека, маніфести модулів і встановлення одним кліком; панелі SEO й перекладів біля кожного запису.
|
|
134
|
+
- **Журнал:** кожна дія людей і агентів наживо.
|
|
135
|
+
- **Присутність:** хто ще працює із записом, люди й агенти, і попередження, коли чиясь чернетка створить конфлікт.
|
|
136
|
+
- **⌘K:** перейти на будь-яку сторінку чи запис, створити запис або бриф.
|
|
137
|
+
|
|
138
|
+
Англійська й українська, світла й темна теми, працює на телефоні.
|
|
139
|
+
|
|
140
|
+
## Клієнти й фреймворки
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
// будь-який JavaScript-рантайм
|
|
144
|
+
import { createClient } from "@aicms/client"
|
|
145
|
+
import type { Schema } from "./aicms-types" // npx aicms types --out aicms-types.ts
|
|
146
|
+
|
|
147
|
+
const cms = createClient<Schema>({ url: "http://localhost:4321", token })
|
|
148
|
+
const post = await cms.post.get({ slug: "welcome-to-aicms" }) // з типами
|
|
149
|
+
for await (const e of cms.events()) console.log(e.event) // наживо
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
# Python, лише стандартна бібліотека
|
|
154
|
+
from aicms import Client
|
|
155
|
+
cms = Client("http://localhost:4321", token="aicms_...")
|
|
156
|
+
cms.post.draft(title="Привіт із Python", body="Markdown **працює**")
|
|
157
|
+
cms.submit(note="Перший пост")
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
| Пакет | Що це |
|
|
161
|
+
|---|---|
|
|
162
|
+
| [`@aicms/client`](packages/client) | Типізований клієнт, події наживо й безпечний `blocksToHtml`, без залежностей |
|
|
163
|
+
| [`@aicms/next`](packages/next) | Читання з кешем і тегами на модель, ревалідація з вебхуків, `<Blocks />` |
|
|
164
|
+
| [`@aicms/nuxt`](packages/nuxt) | Nuxt-модуль: `useAicms`, `useAicmsData`, вебхук, що чистить кеш сторінок Nitro |
|
|
165
|
+
| [`@aicms/sveltekit`](packages/sveltekit) | Load-хелпери з `depends`, заголовки кешу, оновлення наживо після публікації |
|
|
166
|
+
| [`@aicms/astro`](packages/astro) | Content Layer loader з готовим HTML блоків |
|
|
167
|
+
| [`aicms` (Python)](sdk/python) | Клієнт для Python лише на стандартній бібліотеці |
|
|
168
|
+
|
|
169
|
+
## Що в репозиторії
|
|
170
|
+
|
|
171
|
+
| Частина | Де |
|
|
172
|
+
|---|---|
|
|
173
|
+
| Поля, моделі, Markdown ↔ блоки, slugs | `src/schema/` |
|
|
174
|
+
| Action Bus, політики, changesets, перевірки, розклад, брифи, відкат, SDK модулів, стрічка подій | `src/kernel/` |
|
|
175
|
+
| Офіційні модулі: seo, search, media, i18n, git-sync, lint, commerce, оплата | `src/modules/` |
|
|
176
|
+
| Сховища: SQLite (node:sqlite або D1) і Postgres | `src/store/` |
|
|
177
|
+
| REST, OpenAPI, GraphQL, A2A, discovery, MCP, SSE, маршрути модулів, Studio | `src/gates/` |
|
|
178
|
+
| Вхід для Cloudflare Workers, реєстр модулів | `src/edge.ts`, `src/registry.ts` |
|
|
179
|
+
| CLI, `aicms types`, правки конфігу для `aicms add` | `src/cli.ts`, `src/typegen.ts`, `src/config-edit.ts` |
|
|
180
|
+
| Studio (React + Framer Motion, готова збірка лежить у `dist/studio`) | `studio/` |
|
|
181
|
+
| TypeScript-клієнт і адаптери фреймворків | `packages/` |
|
|
182
|
+
| Клієнт для Python | `sdk/python/` |
|
|
183
|
+
| `create-aicms`, скрипти релізу й смоук-тест пакетів | `packages/create-aicms/`, `scripts/` |
|
|
184
|
+
|
|
185
|
+
## Розробка
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
npm test # ядро, входи, SDK і адаптери (node:test, без збірки)
|
|
189
|
+
npm run test:pg # той самий набір на Postgres (PGlite у процесі)
|
|
190
|
+
npm run test:python # клієнт для Python
|
|
191
|
+
npm run typecheck
|
|
192
|
+
npm run build # dist/ для CLI, пакетів і Studio
|
|
193
|
+
npm run test:package # зібрати пакети, створити сайт з архівів і прогнати його
|
|
194
|
+
npm run studio # dev-сервер Studio на :5173, проксі до запущеного `aicms dev`
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Релізи: `node scripts/version.mjs 0.6.0` ставить версію всюди; пуш тегу `v0.6.0` публікує пакети в npm і PyPI з GitHub Actions.
|
|
198
|
+
|
|
199
|
+
## Ліцензія
|
|
200
|
+
|
|
201
|
+
[MIT](LICENSE). AICMS безкоштовна для будь-якого використання, зокрема комерційного: будуй на ній сайти, продукти й сервіси без дозволів і оплати. Якщо проєкту колись знадобиться фінансування, воно буде через донати, а не через платну версію.
|
package/dist/cli.d.ts
ADDED