@mainsoft/agent-cms 0.0.0-stage → 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/CHANGELOG.md +54 -0
- package/LICENSE +21 -0
- package/README.md +359 -2
- package/TODO.md +178 -0
- package/UPGRADE-0.6.md +236 -0
- package/dist/agent.cjs +250 -0
- package/dist/agent.d.cts +88 -0
- package/dist/agent.d.ts +88 -0
- package/dist/agent.js +24 -0
- package/dist/ai.cjs +555 -0
- package/dist/ai.d.cts +48 -0
- package/dist/ai.d.ts +48 -0
- package/dist/ai.js +73 -0
- package/dist/bin.js +1556 -0
- package/dist/chunk-2NTK7H4W.js +10 -0
- package/dist/chunk-52NUUZC7.js +1446 -0
- package/dist/chunk-6K5ZTGHQ.js +30 -0
- package/dist/chunk-AKN7SUXU.js +281 -0
- package/dist/chunk-CRDW6Q72.js +188 -0
- package/dist/chunk-DD56PTZ4.js +78 -0
- package/dist/chunk-DOADAH4L.js +52 -0
- package/dist/chunk-EXV6JNLY.js +251 -0
- package/dist/chunk-IGL2V6US.js +324 -0
- package/dist/chunk-IW3D4I7Q.js +317 -0
- package/dist/chunk-OQ55GEF3.js +6 -0
- package/dist/chunk-QC2M4NZY.js +158 -0
- package/dist/chunk-QQV6VLYJ.js +204 -0
- package/dist/chunk-T66ZKBHF.js +25 -0
- package/dist/chunk-VICZ76TR.js +118 -0
- package/dist/chunk-Y63XQS2J.js +6 -0
- package/dist/cli.cjs +1596 -0
- package/dist/cli.d.cts +89 -0
- package/dist/cli.d.ts +89 -0
- package/dist/cli.js +534 -0
- package/dist/client.cjs +185 -0
- package/dist/client.d.cts +228 -0
- package/dist/client.d.ts +228 -0
- package/dist/client.js +13 -0
- package/dist/cms-BPp01z-8.d.ts +411 -0
- package/dist/cms-D6D89-qZ.d.cts +411 -0
- package/dist/config.cjs +61 -0
- package/dist/config.d.cts +36 -0
- package/dist/config.d.ts +36 -0
- package/dist/config.js +11 -0
- package/dist/diff.cjs +316 -0
- package/dist/diff.d.cts +122 -0
- package/dist/diff.d.ts +122 -0
- package/dist/diff.js +29 -0
- package/dist/drizzle-repo-B1rt7r4j.d.ts +90 -0
- package/dist/drizzle-repo-Cn-kL2FK.d.cts +90 -0
- package/dist/errors.cjs +193 -0
- package/dist/errors.d.cts +109 -0
- package/dist/errors.d.ts +109 -0
- package/dist/errors.js +16 -0
- package/dist/frontmatter.cjs +103 -0
- package/dist/frontmatter.d.cts +32 -0
- package/dist/frontmatter.d.ts +32 -0
- package/dist/frontmatter.js +9 -0
- package/dist/http.cjs +1105 -0
- package/dist/http.d.cts +75 -0
- package/dist/http.d.ts +75 -0
- package/dist/http.js +321 -0
- package/dist/index.cjs +3066 -0
- package/dist/index.d.cts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +263 -0
- package/dist/markdown.cjs +220 -0
- package/dist/markdown.d.cts +88 -0
- package/dist/markdown.d.ts +88 -0
- package/dist/markdown.js +23 -0
- package/dist/mcp.cjs +652 -0
- package/dist/mcp.d.cts +43 -0
- package/dist/mcp.d.ts +43 -0
- package/dist/mcp.js +26 -0
- package/dist/messages/en.cjs +76 -0
- package/dist/messages/en.d.cts +7 -0
- package/dist/messages/en.d.ts +7 -0
- package/dist/messages/en.js +7 -0
- package/dist/messages/ko.cjs +76 -0
- package/dist/messages/ko.d.cts +7 -0
- package/dist/messages/ko.d.ts +7 -0
- package/dist/messages/ko.js +53 -0
- package/dist/registry/cms-audit.json +25 -0
- package/dist/registry/cms-command.json +23 -0
- package/dist/registry/cms-doc-editor.json +36 -0
- package/dist/registry/cms-doc-list.json +29 -0
- package/dist/registry/cms-empty.json +22 -0
- package/dist/registry/cms-keys.json +29 -0
- package/dist/registry/cms-lib.json +33 -0
- package/dist/registry/cms-merge.json +26 -0
- package/dist/registry/cms-shell.json +22 -0
- package/dist/registry/cms-versions.json +26 -0
- package/dist/registry/registry.json +255 -0
- package/dist/repo-BWI2Pkrv.d.ts +162 -0
- package/dist/repo-CeDxUxO6.d.cts +162 -0
- package/dist/tables.cjs +356 -0
- package/dist/tables.d.cts +3515 -0
- package/dist/tables.d.ts +3515 -0
- package/dist/tables.js +35 -0
- package/dist/tools.cjs +420 -0
- package/dist/tools.d.cts +27 -0
- package/dist/tools.d.ts +27 -0
- package/dist/tools.js +18 -0
- package/dist/types.cjs +226 -0
- package/dist/types.d.cts +286 -0
- package/dist/types.d.ts +286 -0
- package/dist/types.js +28 -0
- package/package.json +277 -4
package/dist/cli.d.cts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { D as DoctorReport } from './drizzle-repo-Cn-kL2FK.cjs';
|
|
2
|
+
import { cmsTables } from './tables.cjs';
|
|
3
|
+
import 'drizzle-orm/pg-core';
|
|
4
|
+
import './repo-CeDxUxO6.cjs';
|
|
5
|
+
import './types.cjs';
|
|
6
|
+
import 'zod';
|
|
7
|
+
import './errors.cjs';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The copy-in admin screens: reading the registry (built JSON in
|
|
11
|
+
* `dist/registry`, or the `registry/` sources in this repo), and copying
|
|
12
|
+
* items into an app with `agent-cms add` (with `--diff` and `--update`).
|
|
13
|
+
*
|
|
14
|
+
* Node only (used by the CLI and the build script).
|
|
15
|
+
*/
|
|
16
|
+
interface RegistryFile {
|
|
17
|
+
path: string;
|
|
18
|
+
type: string;
|
|
19
|
+
/** Present in built item JSON. */
|
|
20
|
+
content?: string;
|
|
21
|
+
target?: string;
|
|
22
|
+
}
|
|
23
|
+
interface RegistryItem {
|
|
24
|
+
name: string;
|
|
25
|
+
type: string;
|
|
26
|
+
title?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
dependencies?: string[];
|
|
29
|
+
registryDependencies?: string[];
|
|
30
|
+
files: RegistryFile[];
|
|
31
|
+
}
|
|
32
|
+
interface Registry {
|
|
33
|
+
name: string;
|
|
34
|
+
homepage?: string;
|
|
35
|
+
items: RegistryItem[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* `agent-cms` CLI.
|
|
40
|
+
*
|
|
41
|
+
* In the app (local, no key needed):
|
|
42
|
+
* agent-cms init [--yes] config, API route, schema re-export, .env lines
|
|
43
|
+
* agent-cms doctor database check (tables, columns, schema version, data)
|
|
44
|
+
* agent-cms migrate check | print | apply
|
|
45
|
+
* check: what is missing and the SQL to add it (exit 1 when behind)
|
|
46
|
+
* print: the full idempotent DDL; apply: run it
|
|
47
|
+
* agent-cms add <item...> [--diff | --update] [--yes] [--overwrite] [--dir path]
|
|
48
|
+
* copy admin screens into the app (see `agent-cms add --list`)
|
|
49
|
+
*
|
|
50
|
+
* Against a running app, with an API key (same operations as the MCP tools):
|
|
51
|
+
* agent-cms tools | collections
|
|
52
|
+
* agent-cms list <collection> [--drafts]
|
|
53
|
+
* agent-cms get <collection> <slug> [--draft]
|
|
54
|
+
* agent-cms search <query> [--collections a,b]
|
|
55
|
+
* agent-cms put <collection> <file.md> [--publish] [--note "why"] [--expected-version N] [--force]
|
|
56
|
+
* create, or update with --expected-version (the version you read with `get --draft`),
|
|
57
|
+
* so an edit someone made since is never overwritten. Frontmatter: see frontmatter.ts.
|
|
58
|
+
* agent-cms patch <collection> <slug> <ops.json> [--expected-version N] [--dry-run]
|
|
59
|
+
* agent-cms publish <collection> <slug>
|
|
60
|
+
* agent-cms call <tool> '<json args>'
|
|
61
|
+
*
|
|
62
|
+
* Env: AGENT_CMS_URL (https://app/api/cms) and AGENT_CMS_KEY (sgk_…), or
|
|
63
|
+
* `--env <file>` with those two lines. Output is JSON.
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
interface CliIo {
|
|
67
|
+
env?: Record<string, string | undefined>;
|
|
68
|
+
fetch?: typeof fetch;
|
|
69
|
+
readFile?: (path: string) => string;
|
|
70
|
+
out?: (line: string) => void;
|
|
71
|
+
err?: (line: string) => void;
|
|
72
|
+
/** Working directory for local commands. Default process.cwd(). */
|
|
73
|
+
cwd?: string;
|
|
74
|
+
/** Registry to use for `add` (tests). Default: the one shipped in the package. */
|
|
75
|
+
registry?: Registry;
|
|
76
|
+
/** Database for `doctor` / `migrate` (tests). Default: `db()` from agent-cms.config.ts. */
|
|
77
|
+
db?: any;
|
|
78
|
+
/** Run a command (for `add --yes`). */
|
|
79
|
+
run?: (cmd: string, args: string[], cwd: string) => number;
|
|
80
|
+
}
|
|
81
|
+
declare function parseEnvFile(text: string): Record<string, string>;
|
|
82
|
+
declare function runCli(argv: string[], io?: CliIo): Promise<number>;
|
|
83
|
+
/** SQL that brings this database to the current schema, or null when it is current. */
|
|
84
|
+
declare function migrationSql(r: DoctorReport, tables: ReturnType<typeof cmsTables>): {
|
|
85
|
+
sql: string;
|
|
86
|
+
steps: string[];
|
|
87
|
+
} | null;
|
|
88
|
+
|
|
89
|
+
export { type CliIo, migrationSql, parseEnvFile, runCli };
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { D as DoctorReport } from './drizzle-repo-B1rt7r4j.js';
|
|
2
|
+
import { cmsTables } from './tables.js';
|
|
3
|
+
import 'drizzle-orm/pg-core';
|
|
4
|
+
import './repo-BWI2Pkrv.js';
|
|
5
|
+
import './types.js';
|
|
6
|
+
import 'zod';
|
|
7
|
+
import './errors.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The copy-in admin screens: reading the registry (built JSON in
|
|
11
|
+
* `dist/registry`, or the `registry/` sources in this repo), and copying
|
|
12
|
+
* items into an app with `agent-cms add` (with `--diff` and `--update`).
|
|
13
|
+
*
|
|
14
|
+
* Node only (used by the CLI and the build script).
|
|
15
|
+
*/
|
|
16
|
+
interface RegistryFile {
|
|
17
|
+
path: string;
|
|
18
|
+
type: string;
|
|
19
|
+
/** Present in built item JSON. */
|
|
20
|
+
content?: string;
|
|
21
|
+
target?: string;
|
|
22
|
+
}
|
|
23
|
+
interface RegistryItem {
|
|
24
|
+
name: string;
|
|
25
|
+
type: string;
|
|
26
|
+
title?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
dependencies?: string[];
|
|
29
|
+
registryDependencies?: string[];
|
|
30
|
+
files: RegistryFile[];
|
|
31
|
+
}
|
|
32
|
+
interface Registry {
|
|
33
|
+
name: string;
|
|
34
|
+
homepage?: string;
|
|
35
|
+
items: RegistryItem[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* `agent-cms` CLI.
|
|
40
|
+
*
|
|
41
|
+
* In the app (local, no key needed):
|
|
42
|
+
* agent-cms init [--yes] config, API route, schema re-export, .env lines
|
|
43
|
+
* agent-cms doctor database check (tables, columns, schema version, data)
|
|
44
|
+
* agent-cms migrate check | print | apply
|
|
45
|
+
* check: what is missing and the SQL to add it (exit 1 when behind)
|
|
46
|
+
* print: the full idempotent DDL; apply: run it
|
|
47
|
+
* agent-cms add <item...> [--diff | --update] [--yes] [--overwrite] [--dir path]
|
|
48
|
+
* copy admin screens into the app (see `agent-cms add --list`)
|
|
49
|
+
*
|
|
50
|
+
* Against a running app, with an API key (same operations as the MCP tools):
|
|
51
|
+
* agent-cms tools | collections
|
|
52
|
+
* agent-cms list <collection> [--drafts]
|
|
53
|
+
* agent-cms get <collection> <slug> [--draft]
|
|
54
|
+
* agent-cms search <query> [--collections a,b]
|
|
55
|
+
* agent-cms put <collection> <file.md> [--publish] [--note "why"] [--expected-version N] [--force]
|
|
56
|
+
* create, or update with --expected-version (the version you read with `get --draft`),
|
|
57
|
+
* so an edit someone made since is never overwritten. Frontmatter: see frontmatter.ts.
|
|
58
|
+
* agent-cms patch <collection> <slug> <ops.json> [--expected-version N] [--dry-run]
|
|
59
|
+
* agent-cms publish <collection> <slug>
|
|
60
|
+
* agent-cms call <tool> '<json args>'
|
|
61
|
+
*
|
|
62
|
+
* Env: AGENT_CMS_URL (https://app/api/cms) and AGENT_CMS_KEY (sgk_…), or
|
|
63
|
+
* `--env <file>` with those two lines. Output is JSON.
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
interface CliIo {
|
|
67
|
+
env?: Record<string, string | undefined>;
|
|
68
|
+
fetch?: typeof fetch;
|
|
69
|
+
readFile?: (path: string) => string;
|
|
70
|
+
out?: (line: string) => void;
|
|
71
|
+
err?: (line: string) => void;
|
|
72
|
+
/** Working directory for local commands. Default process.cwd(). */
|
|
73
|
+
cwd?: string;
|
|
74
|
+
/** Registry to use for `add` (tests). Default: the one shipped in the package. */
|
|
75
|
+
registry?: Registry;
|
|
76
|
+
/** Database for `doctor` / `migrate` (tests). Default: `db()` from agent-cms.config.ts. */
|
|
77
|
+
db?: any;
|
|
78
|
+
/** Run a command (for `add --yes`). */
|
|
79
|
+
run?: (cmd: string, args: string[], cwd: string) => number;
|
|
80
|
+
}
|
|
81
|
+
declare function parseEnvFile(text: string): Record<string, string>;
|
|
82
|
+
declare function runCli(argv: string[], io?: CliIo): Promise<number>;
|
|
83
|
+
/** SQL that brings this database to the current schema, or null when it is current. */
|
|
84
|
+
declare function migrationSql(r: DoctorReport, tables: ReturnType<typeof cmsTables>): {
|
|
85
|
+
sql: string;
|
|
86
|
+
steps: string[];
|
|
87
|
+
} | null;
|
|
88
|
+
|
|
89
|
+
export { type CliIo, migrationSql, parseEnvFile, runCli };
|