@agent-cms/agentcms 0.0.0-stage → 0.1.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/LICENSE +143 -0
- package/README.md +1119 -2
- package/changelog.json +20 -0
- package/dist/admin/admin-files.json +48 -0
- package/dist/admin/assets/CodeEditor-DcFzGUt8.js +24 -0
- package/dist/admin/assets/flexweg-logo-CdtuqAFA.png +0 -0
- package/dist/admin/assets/index-CLZ1gQZl.js +5460 -0
- package/dist/admin/assets/index-DMcGogR2.css +1 -0
- package/dist/admin/assets/sql-wasm-C1U8OeUW.wasm +0 -0
- package/dist/admin/assets/sql-wasm-CYl3LXH_.js +2 -0
- package/dist/admin/assets/sql-wasm-V5jTDcrT.js +1 -0
- package/dist/admin/config.js +11 -0
- package/dist/admin/external.default.json +72 -0
- package/dist/admin/index.html +116 -0
- package/dist/admin/plugins/core-seo/bundle.js +55 -0
- package/dist/admin/plugins/core-seo/manifest.json +7 -0
- package/dist/admin/plugins/flexweg-archives/bundle.js +1414 -0
- package/dist/admin/plugins/flexweg-archives/manifest.json +7 -0
- package/dist/admin/plugins/flexweg-multilang/bundle.js +1187 -0
- package/dist/admin/plugins/flexweg-multilang/manifest.json +7 -0
- package/dist/admin/plugins/flexweg-rss/bundle.js +1354 -0
- package/dist/admin/plugins/flexweg-rss/manifest.json +7 -0
- package/dist/admin/plugins/flexweg-search/bundle.js +1243 -0
- package/dist/admin/plugins/flexweg-search/manifest.json +7 -0
- package/dist/admin/plugins/flexweg-sitemaps/bundle.js +1293 -0
- package/dist/admin/plugins/flexweg-sitemaps/manifest.json +7 -0
- package/dist/admin/runtime/cms-runtime.js +164 -0
- package/dist/admin/runtime/react-dom-client.js +13 -0
- package/dist/admin/runtime/react-dom.js +16 -0
- package/dist/admin/runtime/react-i18next.js +21 -0
- package/dist/admin/runtime/react-jsx-runtime.js +17 -0
- package/dist/admin/runtime/react.js +55 -0
- package/dist/admin/themes/corporate/bundle.js +14465 -0
- package/dist/admin/themes/corporate/manifest.json +7 -0
- package/dist/admin/themes/corporate/theme.css +2 -0
- package/dist/admin/themes/magazine/bundle.js +10229 -0
- package/dist/admin/themes/magazine/manifest.json +7 -0
- package/dist/admin/themes/magazine/theme.css +2 -0
- package/dist/admin/themes/marketplace-core/bundle.js +11213 -0
- package/dist/admin/themes/marketplace-core/manifest.json +7 -0
- package/dist/admin/themes/marketplace-core/theme.css +1613 -0
- package/dist/admin/themes/portfolio/bundle.js +9195 -0
- package/dist/admin/themes/portfolio/manifest.json +7 -0
- package/dist/admin/themes/portfolio/theme.css +2 -0
- package/dist/admin/themes/storefront/bundle.js +13172 -0
- package/dist/admin/themes/storefront/manifest.json +7 -0
- package/dist/admin/themes/storefront/theme.css +2 -0
- package/dist/agent/agentcms.mjs +1711 -0
- package/dist/agent/chunks/hosting-D_uj-Mt1.mjs +117 -0
- package/dist/agent/chunks/index-CrvEoyi0.mjs +3608 -0
- package/dist/agent/chunks/install-DkCCcKAO.mjs +577 -0
- package/dist/agent/chunks/plan-EYKegfhp.mjs +245 -0
- package/dist/agent/chunks/registry-lkfb_E9O.mjs +53517 -0
- package/dist/agent/chunks/siteAdd-BqcYt8nu.mjs +118 -0
- package/dist/agent/chunks/sql-wasm-GjJDiefO.mjs +10 -0
- package/dist/agent/chunks/sqljs-DjSCStJ0.mjs +20 -0
- package/dist/agent/vendor/sql-wasm.cjs +188 -0
- package/dist/theme-assets/corporate-menu.js +266 -0
- package/dist/theme-assets/corporate-posts.js +571 -0
- package/dist/theme-assets/corporate.css +2 -0
- package/dist/theme-assets/default-menu.js +266 -0
- package/dist/theme-assets/default-posts.js +378 -0
- package/dist/theme-assets/default.css +1 -0
- package/dist/theme-assets/magazine-menu.js +227 -0
- package/dist/theme-assets/magazine-posts.js +361 -0
- package/dist/theme-assets/magazine.css +2 -0
- package/dist/theme-assets/portfolio-filters.js +104 -0
- package/dist/theme-assets/portfolio-menu.js +240 -0
- package/dist/theme-assets/portfolio-posts.js +358 -0
- package/dist/theme-assets/portfolio.css +2 -0
- package/dist/theme-assets/storefront-catalog.js +504 -0
- package/dist/theme-assets/storefront-menu.js +239 -0
- package/dist/theme-assets/storefront-posts.js +404 -0
- package/dist/theme-assets/storefront.css +2 -0
- package/dist/version.json +9 -0
- package/package.json +101 -4
- package/plugin/.claude-plugin/plugin.json +16 -0
- package/plugin/skills/agentcms-install/SKILL.md +110 -0
- package/plugin/skills/agentcms-install/references/cloudflare.md +15 -0
- package/plugin/skills/agentcms-install/references/flexweg.md +11 -0
- package/plugin/skills/agentcms-install/references/github.md +67 -0
- package/plugin/skills/agentcms-install/references/gitlab.md +15 -0
- package/plugin/skills/agentcms-install/references/s3.md +81 -0
- package/plugin/skills/agentcms-manage/SKILL.md +92 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { createRequire as __acmsRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __acmsPath } from "node:url";
|
|
3
|
+
import { dirname as __acmsDirname } from "node:path";
|
|
4
|
+
const require2 = __acmsRequire(import.meta.url);
|
|
5
|
+
const __filename = __acmsPath(import.meta.url);
|
|
6
|
+
const __dirname = __acmsDirname(__filename);
|
|
7
|
+
import { F as resolveGitPagesToken, y as splitSecrets, G as missingFields } from "./registry-lkfb_E9O.mjs";
|
|
8
|
+
import { c as createRemoteGitTransport } from "./index-CrvEoyi0.mjs";
|
|
9
|
+
import { v as validateAlias, c as findDataBackend, a as parseAccount, r as requireCredential, e as getCredential, C as CliError, h as findHosting } from "../agentcms.mjs";
|
|
10
|
+
const gitHost = (host) => (connectorId, s) => connectorId === "git-pages" && (s.host ?? "github-pages") === host;
|
|
11
|
+
const HOSTING_OPTIONS = [
|
|
12
|
+
{
|
|
13
|
+
id: "flexweg",
|
|
14
|
+
connectorId: "flexweg",
|
|
15
|
+
preset: {},
|
|
16
|
+
hiddenFields: [],
|
|
17
|
+
matches: (c) => c === "flexweg"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: "github-pages",
|
|
21
|
+
connectorId: "git-pages",
|
|
22
|
+
preset: { host: "github-pages", provider: "github", branch: "main" },
|
|
23
|
+
hiddenFields: ["host", "provider"],
|
|
24
|
+
matches: gitHost("github-pages")
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "cloudflare-pages",
|
|
28
|
+
connectorId: "git-pages",
|
|
29
|
+
preset: { host: "cloudflare-pages", provider: "github", branch: "main" },
|
|
30
|
+
hiddenFields: ["host"],
|
|
31
|
+
matches: gitHost("cloudflare-pages")
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "gitlab-pages",
|
|
35
|
+
connectorId: "git-pages",
|
|
36
|
+
preset: { host: "gitlab-pages", provider: "gitlab", branch: "main", dir: "public" },
|
|
37
|
+
hiddenFields: ["host", "provider"],
|
|
38
|
+
matches: gitHost("gitlab-pages")
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "git-other",
|
|
42
|
+
connectorId: "git-pages",
|
|
43
|
+
preset: { host: "other", provider: "github", branch: "main" },
|
|
44
|
+
hiddenFields: ["host"],
|
|
45
|
+
matches: gitHost("other")
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "s3",
|
|
49
|
+
connectorId: "s3",
|
|
50
|
+
preset: { region: "auto" },
|
|
51
|
+
hiddenFields: [],
|
|
52
|
+
matches: (c) => c === "s3"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "own-server",
|
|
56
|
+
connectorId: "php-bridge",
|
|
57
|
+
preset: {},
|
|
58
|
+
hiddenFields: [],
|
|
59
|
+
matches: (c) => c === "php-bridge"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "local-folder",
|
|
63
|
+
connectorId: "local-folder",
|
|
64
|
+
preset: {},
|
|
65
|
+
hiddenFields: [],
|
|
66
|
+
matches: (c) => c === "local-folder"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "zip",
|
|
70
|
+
connectorId: "browser-mirror",
|
|
71
|
+
preset: {},
|
|
72
|
+
hiddenFields: [],
|
|
73
|
+
matches: (c) => c === "browser-mirror"
|
|
74
|
+
}
|
|
75
|
+
];
|
|
76
|
+
const SQLITE_DATA_BRANCH = "agentcms-data";
|
|
77
|
+
function defaultSqliteLocation(target) {
|
|
78
|
+
if (target.connectorId !== "git-pages") return target;
|
|
79
|
+
const settings = Object.fromEntries(Object.entries(target.settings).filter(([k]) => k !== "siteUrl" && k !== "dir"));
|
|
80
|
+
return { connectorId: "git-pages", settings: { ...settings, host: "other", dir: "", branch: SQLITE_DATA_BRANCH } };
|
|
81
|
+
}
|
|
82
|
+
async function ensurePublishBranch(target) {
|
|
83
|
+
if (target.connectorId !== "git-pages") return;
|
|
84
|
+
const s = target.settings;
|
|
85
|
+
const token = resolveGitPagesToken(s);
|
|
86
|
+
const transport = createRemoteGitTransport(
|
|
87
|
+
s.provider === "gitlab" ? { provider: "gitlab", project: s.project ?? "", branch: s.branch, token, apiBaseUrl: s.apiBaseUrl } : { provider: "github", owner: s.owner ?? "", repo: s.repo ?? "", branch: s.branch, token, apiBaseUrl: s.apiBaseUrl }
|
|
88
|
+
);
|
|
89
|
+
if (await transport.headSha()) return;
|
|
90
|
+
await transport.commit([{ type: "put", path: ".gitkeep", content: "" }], { message: "Initialize site — AgentCMS" });
|
|
91
|
+
}
|
|
92
|
+
const SQLITE_PATH_RE = /^[\w./-]+\.(sqlite|db)$/i;
|
|
93
|
+
const SECRET_SETTING_KEYS = ["token", "apiKey", "accessKeyId", "secretAccessKey", "passphrase"];
|
|
94
|
+
function fail(message, hint) {
|
|
95
|
+
throw new CliError("invalid-plan", message, hint ?? "Run `agentcms options --json` for the expected fields.", 2);
|
|
96
|
+
}
|
|
97
|
+
function str(v) {
|
|
98
|
+
return typeof v === "string" ? v.trim() : "";
|
|
99
|
+
}
|
|
100
|
+
function cleanFolder(folder) {
|
|
101
|
+
return folder.trim().replace(/^\/+|\/+$/g, "");
|
|
102
|
+
}
|
|
103
|
+
function buildTarget(spec, field, opts) {
|
|
104
|
+
const type = str(spec?.type);
|
|
105
|
+
const hostingSpec = findHosting(type);
|
|
106
|
+
if (!hostingSpec) fail(`Unknown ${field}.type "${type}".`);
|
|
107
|
+
if (!hostingSpec.cli) fail(`${field} "${type}" can't be set up from the CLI.`, hostingSpec.notes.join(" "));
|
|
108
|
+
const option = HOSTING_OPTIONS.find((o) => o.id === type);
|
|
109
|
+
let account = str(spec.credential);
|
|
110
|
+
if (!account && hostingSpec.connectorId === "git-pages" && opts.reuseGitAccount) {
|
|
111
|
+
const provider = option.preset.provider ?? "github";
|
|
112
|
+
if (parseAccount(opts.reuseGitAccount).type === provider) account = opts.reuseGitAccount;
|
|
113
|
+
}
|
|
114
|
+
if (!account) fail(`${field}.credential is required (${hostingSpec.credentialTypes.join(" / ")} account).`);
|
|
115
|
+
const credType = parseAccount(account).type;
|
|
116
|
+
if (!hostingSpec.credentialTypes.includes(credType)) {
|
|
117
|
+
fail(`${field}.credential must be a ${hostingSpec.credentialTypes.join(" / ")} account, got ${credType}.`);
|
|
118
|
+
}
|
|
119
|
+
const settings = { ...option.preset };
|
|
120
|
+
for (const [k, v] of Object.entries(spec.settings ?? {})) {
|
|
121
|
+
if (v === void 0 || v === null) continue;
|
|
122
|
+
if (SECRET_SETTING_KEYS.includes(k)) fail(`${field}.settings.${k} must not be in the plan — store it with \`agentcms credentials set\`.`);
|
|
123
|
+
settings[k] = typeof v === "string" ? v.trim() : v;
|
|
124
|
+
}
|
|
125
|
+
if (typeof settings.siteUrl === "string") settings.siteUrl = settings.siteUrl.replace(/\/+$/, "");
|
|
126
|
+
if (opts.requireSiteUrl && !/^https?:\/\/[^/]+/.test(str(settings.siteUrl))) fail(`${field}.settings.siteUrl must be an http(s) URL.`);
|
|
127
|
+
Object.assign(settings, requireCredential(account).values);
|
|
128
|
+
const missing = missingFields(hostingSpec.connectorId, settings, opts.requireSiteUrl ? [] : ["siteUrl"]);
|
|
129
|
+
if (missing.length) fail(`Missing ${field} settings: ${missing.join(", ")}.`);
|
|
130
|
+
return { target: { connectorId: hostingSpec.connectorId, settings }, account, type };
|
|
131
|
+
}
|
|
132
|
+
function resolvePlan(plan2) {
|
|
133
|
+
if (!plan2 || typeof plan2 !== "object") fail("The plan must be a JSON object.");
|
|
134
|
+
const alias = validateAlias(str(plan2.alias));
|
|
135
|
+
const backendSpec = findDataBackend(str(plan2.data?.backend));
|
|
136
|
+
if (!backendSpec) fail(`Unknown data backend "${plan2.data?.backend}".`);
|
|
137
|
+
if (!backendSpec.cli) fail(`Data backend "${backendSpec.id}" can't be set up from the CLI.`, backendSpec.notes.join(" "));
|
|
138
|
+
const credentials = {};
|
|
139
|
+
let gitToken;
|
|
140
|
+
let gitCfg;
|
|
141
|
+
if (plan2.data.backend === "markdown-git") {
|
|
142
|
+
const g = plan2.data.git ?? {};
|
|
143
|
+
const provider = g.provider;
|
|
144
|
+
if (provider !== "github" && provider !== "gitlab") fail('data.git.provider must be "github" or "gitlab".');
|
|
145
|
+
if (provider === "github" && (!str(g.owner) || !str(g.repo))) fail("data.git.owner and data.git.repo are required for GitHub.");
|
|
146
|
+
if (provider === "gitlab" && !str(g.project)) fail("data.git.project is required for GitLab.");
|
|
147
|
+
const account = str(plan2.data.credential);
|
|
148
|
+
if (!account) fail("data.credential is required (e.g. github:my-login).");
|
|
149
|
+
if (parseAccount(account).type !== provider) fail(`data.credential must be a ${provider} account.`);
|
|
150
|
+
gitToken = requireCredential(account).values.token;
|
|
151
|
+
credentials.data = account;
|
|
152
|
+
gitCfg = {
|
|
153
|
+
provider,
|
|
154
|
+
owner: provider === "github" ? str(g.owner) : void 0,
|
|
155
|
+
repo: provider === "github" ? str(g.repo) : void 0,
|
|
156
|
+
project: provider === "gitlab" ? str(g.project) : void 0,
|
|
157
|
+
branch: str(g.branch) || "main",
|
|
158
|
+
contentDir: cleanFolder(str(g.contentDir)),
|
|
159
|
+
apiBaseUrl: str(g.apiBaseUrl) || void 0
|
|
160
|
+
};
|
|
161
|
+
} else if (!SQLITE_PATH_RE.test(str(plan2.data.path))) {
|
|
162
|
+
fail("data.path must be a relative file path ending in .sqlite or .db, e.g. data/site.sqlite.");
|
|
163
|
+
}
|
|
164
|
+
const hosting = buildTarget(plan2.hosting, "hosting", { reuseGitAccount: credentials.data, requireSiteUrl: true });
|
|
165
|
+
credentials.hosting = hosting.account;
|
|
166
|
+
const target = hosting.target;
|
|
167
|
+
const siteUrl = str(target.settings.siteUrl);
|
|
168
|
+
const publicView = (t) => ({
|
|
169
|
+
connectorId: t.connectorId,
|
|
170
|
+
settings: Object.fromEntries(Object.entries(splitSecrets(t.settings).clean).filter(([k]) => k !== "accessKeyId"))
|
|
171
|
+
});
|
|
172
|
+
let runtime;
|
|
173
|
+
let sqliteSecrets;
|
|
174
|
+
let dataLocation;
|
|
175
|
+
let dataLocationType;
|
|
176
|
+
let passphraseAccount;
|
|
177
|
+
let passphrase;
|
|
178
|
+
if (gitCfg) {
|
|
179
|
+
runtime = { backend: "markdown-git", git: gitCfg };
|
|
180
|
+
} else {
|
|
181
|
+
const data = plan2.data;
|
|
182
|
+
if (data.location) {
|
|
183
|
+
const loc = buildTarget(data.location, "data.location", { requireSiteUrl: false });
|
|
184
|
+
dataLocation = loc.target;
|
|
185
|
+
dataLocationType = loc.type;
|
|
186
|
+
credentials.data = loc.account;
|
|
187
|
+
} else {
|
|
188
|
+
dataLocation = defaultSqliteLocation(target);
|
|
189
|
+
dataLocationType = dataLocation === target ? hosting.type : `${hosting.type}, branch ${SQLITE_DATA_BRANCH}`;
|
|
190
|
+
}
|
|
191
|
+
if (data.encryption !== false) {
|
|
192
|
+
passphraseAccount = str(data.encryption?.credential) || `passphrase:${alias}`;
|
|
193
|
+
if (parseAccount(passphraseAccount).type !== "passphrase") fail("data.encryption.credential must be a passphrase account.");
|
|
194
|
+
const stored = getCredential(passphraseAccount)?.values.passphrase;
|
|
195
|
+
if (!stored && data.encryption?.credential) requireCredential(passphraseAccount);
|
|
196
|
+
passphrase = stored;
|
|
197
|
+
credentials.passphrase = passphraseAccount;
|
|
198
|
+
}
|
|
199
|
+
const split = splitSecrets(dataLocation.settings);
|
|
200
|
+
sqliteSecrets = split.secrets ?? {};
|
|
201
|
+
const locationSettings = Object.fromEntries(Object.entries(split.clean).filter(([k]) => k !== "siteUrl"));
|
|
202
|
+
runtime = {
|
|
203
|
+
backend: "sqlite-file",
|
|
204
|
+
sqlite: {
|
|
205
|
+
connectorId: dataLocation.connectorId,
|
|
206
|
+
settings: dataLocation === target ? split.clean : locationSettings,
|
|
207
|
+
path: str(data.path).replace(/^\/+/, ""),
|
|
208
|
+
...passphraseAccount ? { encrypted: true } : {}
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
let adminFolder = "admin";
|
|
213
|
+
if (plan2.admin === false) adminFolder = null;
|
|
214
|
+
else if (plan2.admin && typeof plan2.admin === "object") {
|
|
215
|
+
adminFolder = cleanFolder(str(plan2.admin.folder));
|
|
216
|
+
if (!/^[\w.-]+(\/[\w.-]+)*$/.test(adminFolder)) fail("admin.folder must be a relative folder name, e.g. admin.");
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
alias,
|
|
220
|
+
backend: runtime.backend,
|
|
221
|
+
runtime,
|
|
222
|
+
gitToken,
|
|
223
|
+
sqliteSecrets,
|
|
224
|
+
passphraseAccount,
|
|
225
|
+
passphrase,
|
|
226
|
+
dataLocation,
|
|
227
|
+
dataLocationType,
|
|
228
|
+
target,
|
|
229
|
+
publicTarget: publicView(target),
|
|
230
|
+
hostingType: hosting.type,
|
|
231
|
+
credentials,
|
|
232
|
+
adminFolder,
|
|
233
|
+
siteUrl
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
const plan = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
237
|
+
__proto__: null,
|
|
238
|
+
cleanFolder,
|
|
239
|
+
resolvePlan
|
|
240
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
241
|
+
export {
|
|
242
|
+
cleanFolder as c,
|
|
243
|
+
ensurePublishBranch as e,
|
|
244
|
+
plan as p
|
|
245
|
+
};
|