@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.
Files changed (108) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/LICENSE +21 -0
  3. package/README.md +359 -2
  4. package/TODO.md +178 -0
  5. package/UPGRADE-0.6.md +236 -0
  6. package/dist/agent.cjs +250 -0
  7. package/dist/agent.d.cts +88 -0
  8. package/dist/agent.d.ts +88 -0
  9. package/dist/agent.js +24 -0
  10. package/dist/ai.cjs +555 -0
  11. package/dist/ai.d.cts +48 -0
  12. package/dist/ai.d.ts +48 -0
  13. package/dist/ai.js +73 -0
  14. package/dist/bin.js +1556 -0
  15. package/dist/chunk-2NTK7H4W.js +10 -0
  16. package/dist/chunk-52NUUZC7.js +1446 -0
  17. package/dist/chunk-6K5ZTGHQ.js +30 -0
  18. package/dist/chunk-AKN7SUXU.js +281 -0
  19. package/dist/chunk-CRDW6Q72.js +188 -0
  20. package/dist/chunk-DD56PTZ4.js +78 -0
  21. package/dist/chunk-DOADAH4L.js +52 -0
  22. package/dist/chunk-EXV6JNLY.js +251 -0
  23. package/dist/chunk-IGL2V6US.js +324 -0
  24. package/dist/chunk-IW3D4I7Q.js +317 -0
  25. package/dist/chunk-OQ55GEF3.js +6 -0
  26. package/dist/chunk-QC2M4NZY.js +158 -0
  27. package/dist/chunk-QQV6VLYJ.js +204 -0
  28. package/dist/chunk-T66ZKBHF.js +25 -0
  29. package/dist/chunk-VICZ76TR.js +118 -0
  30. package/dist/chunk-Y63XQS2J.js +6 -0
  31. package/dist/cli.cjs +1596 -0
  32. package/dist/cli.d.cts +89 -0
  33. package/dist/cli.d.ts +89 -0
  34. package/dist/cli.js +534 -0
  35. package/dist/client.cjs +185 -0
  36. package/dist/client.d.cts +228 -0
  37. package/dist/client.d.ts +228 -0
  38. package/dist/client.js +13 -0
  39. package/dist/cms-BPp01z-8.d.ts +411 -0
  40. package/dist/cms-D6D89-qZ.d.cts +411 -0
  41. package/dist/config.cjs +61 -0
  42. package/dist/config.d.cts +36 -0
  43. package/dist/config.d.ts +36 -0
  44. package/dist/config.js +11 -0
  45. package/dist/diff.cjs +316 -0
  46. package/dist/diff.d.cts +122 -0
  47. package/dist/diff.d.ts +122 -0
  48. package/dist/diff.js +29 -0
  49. package/dist/drizzle-repo-B1rt7r4j.d.ts +90 -0
  50. package/dist/drizzle-repo-Cn-kL2FK.d.cts +90 -0
  51. package/dist/errors.cjs +193 -0
  52. package/dist/errors.d.cts +109 -0
  53. package/dist/errors.d.ts +109 -0
  54. package/dist/errors.js +16 -0
  55. package/dist/frontmatter.cjs +103 -0
  56. package/dist/frontmatter.d.cts +32 -0
  57. package/dist/frontmatter.d.ts +32 -0
  58. package/dist/frontmatter.js +9 -0
  59. package/dist/http.cjs +1105 -0
  60. package/dist/http.d.cts +75 -0
  61. package/dist/http.d.ts +75 -0
  62. package/dist/http.js +321 -0
  63. package/dist/index.cjs +3066 -0
  64. package/dist/index.d.cts +19 -0
  65. package/dist/index.d.ts +19 -0
  66. package/dist/index.js +263 -0
  67. package/dist/markdown.cjs +220 -0
  68. package/dist/markdown.d.cts +88 -0
  69. package/dist/markdown.d.ts +88 -0
  70. package/dist/markdown.js +23 -0
  71. package/dist/mcp.cjs +652 -0
  72. package/dist/mcp.d.cts +43 -0
  73. package/dist/mcp.d.ts +43 -0
  74. package/dist/mcp.js +26 -0
  75. package/dist/messages/en.cjs +76 -0
  76. package/dist/messages/en.d.cts +7 -0
  77. package/dist/messages/en.d.ts +7 -0
  78. package/dist/messages/en.js +7 -0
  79. package/dist/messages/ko.cjs +76 -0
  80. package/dist/messages/ko.d.cts +7 -0
  81. package/dist/messages/ko.d.ts +7 -0
  82. package/dist/messages/ko.js +53 -0
  83. package/dist/registry/cms-audit.json +25 -0
  84. package/dist/registry/cms-command.json +23 -0
  85. package/dist/registry/cms-doc-editor.json +36 -0
  86. package/dist/registry/cms-doc-list.json +29 -0
  87. package/dist/registry/cms-empty.json +22 -0
  88. package/dist/registry/cms-keys.json +29 -0
  89. package/dist/registry/cms-lib.json +33 -0
  90. package/dist/registry/cms-merge.json +26 -0
  91. package/dist/registry/cms-shell.json +22 -0
  92. package/dist/registry/cms-versions.json +26 -0
  93. package/dist/registry/registry.json +255 -0
  94. package/dist/repo-BWI2Pkrv.d.ts +162 -0
  95. package/dist/repo-CeDxUxO6.d.cts +162 -0
  96. package/dist/tables.cjs +356 -0
  97. package/dist/tables.d.cts +3515 -0
  98. package/dist/tables.d.ts +3515 -0
  99. package/dist/tables.js +35 -0
  100. package/dist/tools.cjs +420 -0
  101. package/dist/tools.d.cts +27 -0
  102. package/dist/tools.d.ts +27 -0
  103. package/dist/tools.js +18 -0
  104. package/dist/types.cjs +226 -0
  105. package/dist/types.d.cts +286 -0
  106. package/dist/types.d.ts +286 -0
  107. package/dist/types.js +28 -0
  108. 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 };