kozou 0.0.2 → 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 +202 -21
- package/README.md +96 -17
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +52 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/dev.d.ts +5 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +21 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/inspect.d.ts +10 -0
- package/dist/commands/inspect.d.ts.map +1 -0
- package/dist/commands/inspect.js +47 -0
- package/dist/commands/inspect.js.map +1 -0
- package/dist/commands/mcp.d.ts +8 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +29 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/config.d.ts +178 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +154 -0
- package/dist/config.js.map +1 -0
- package/dist/create-kozou.d.ts +3 -0
- package/dist/create-kozou.d.ts.map +1 -0
- package/dist/create-kozou.js +27 -0
- package/dist/create-kozou.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/scaffold.d.ts +11 -0
- package/dist/scaffold.d.ts.map +1 -0
- package/dist/scaffold.js +54 -0
- package/dist/scaffold.js.map +1 -0
- package/dist/templates/docker-compose.yml +63 -0
- package/dist/templates/env.example +11 -0
- package/dist/templates/kozou.config.yaml +29 -0
- package/dist/templates/migrations/0001_init.sql +25 -0
- package/dist/templates/ui-hints.yaml +26 -0
- package/package.json +44 -21
package/LICENSE
CHANGED
|
@@ -1,21 +1,202 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,30 +1,109 @@
|
|
|
1
1
|
# kozou
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
CLI entry point for [Kozou](https://kozou.org): scaffolding,
|
|
4
|
+
schema introspection, and MCP server hand-off. See *Kozou v0.1
|
|
5
|
+
design spec* §9 for the command surface.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
## Install
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
```bash
|
|
10
|
+
# Global, so the bin entries are on PATH
|
|
11
|
+
npm install -g kozou
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
# Or use npx without installing
|
|
14
|
+
npx kozou inspect --help
|
|
10
15
|
|
|
11
|
-
|
|
16
|
+
# `create-kozou` is a secondary bin shipped by the `kozou` package
|
|
17
|
+
# (not a standalone npm package), so npx needs `-p kozou` to find
|
|
18
|
+
# it on a machine that has not installed kozou globally yet.
|
|
19
|
+
npx -p kozou create-kozou my-project
|
|
20
|
+
```
|
|
12
21
|
|
|
13
|
-
|
|
14
|
-
- v0.2: TypeScript type emitter
|
|
15
|
-
- v0.3: MCP context emitter
|
|
16
|
-
- v0.4: admin UI scaffolder
|
|
17
|
-
- v0.5: GraphQL endpoint emitter
|
|
18
|
-
- v0.6: documentation emitter
|
|
22
|
+
The package publishes through `./dist/`. `bin` exposes two entries:
|
|
19
23
|
|
|
20
|
-
|
|
24
|
+
- `kozou` - the main multi-command CLI (`inspect` / `mcp` / `dev`)
|
|
25
|
+
- `create-kozou` - scaffolds a project directory with
|
|
26
|
+
`docker-compose.yml`, `kozou.config.yaml`, `ui-hints.yaml`,
|
|
27
|
+
`env.example`, and a starter migration
|
|
21
28
|
|
|
22
|
-
|
|
29
|
+
## Commands
|
|
23
30
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
### `kozou inspect`
|
|
32
|
+
|
|
33
|
+
Introspects the configured PostgreSQL database and emits a Schema
|
|
34
|
+
Context to stdout (or `--output <path>`):
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
DATABASE_URL=postgres://kozou:kozou@localhost:5432/kozou \
|
|
38
|
+
kozou inspect --format yaml > schema.yaml
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### `kozou mcp --stdio`
|
|
42
|
+
|
|
43
|
+
Starts an MCP server over stdio so Claude Code / other AI agents
|
|
44
|
+
can call the introspect / describe-table tools:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
DATABASE_URL=postgres://kozou:kozou@localhost:5432/kozou \
|
|
48
|
+
npx kozou mcp --stdio
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The `${DATABASE_URL}` placeholder inside the bundled
|
|
52
|
+
`kozou.config.yaml` template is what consumes that env var; the
|
|
53
|
+
CLI does not honor `KOZOU_DATABASE_URL` directly (an alias is on
|
|
54
|
+
the v0.1.1 roadmap). HTTP transport (`--http`) is also reserved
|
|
55
|
+
for v0.1.1.
|
|
56
|
+
|
|
57
|
+
### `kozou dev`
|
|
58
|
+
|
|
59
|
+
Reserved for v0.1.1. In v0.1.0 the command prints a hand-off
|
|
60
|
+
message listing the subcommands available today
|
|
61
|
+
(`kozou mcp --stdio`, `kozou inspect`) and exits. In v0.1.1 it
|
|
62
|
+
will spawn the bundled `@kozou/svelte-ui` Admin UI + an MCP HTTP
|
|
63
|
+
server.
|
|
64
|
+
|
|
65
|
+
### `create-kozou <dir>`
|
|
66
|
+
|
|
67
|
+
Scaffolds a project directory at `<dir>` from the templates
|
|
68
|
+
bundled in `dist/templates/`:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npx -p kozou create-kozou my-project
|
|
72
|
+
cd my-project
|
|
73
|
+
cp .env.example .env
|
|
74
|
+
docker compose up
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The generated `docker-compose.yml` brings up PostgreSQL + PostgREST.
|
|
78
|
+
The `kozou` service block (which would host the Admin UI + MCP HTTP
|
|
79
|
+
server) is commented out in v0.1.0; it gets reactivated in v0.1.1
|
|
80
|
+
once `kozou dev` ships as a real implementation rather than a
|
|
81
|
+
hand-off placeholder.
|
|
82
|
+
|
|
83
|
+
## Configuration
|
|
84
|
+
|
|
85
|
+
`kozou.config.yaml` (template in `dist/templates/`) drives every
|
|
86
|
+
command:
|
|
87
|
+
|
|
88
|
+
```yaml
|
|
89
|
+
database:
|
|
90
|
+
url: ${DATABASE_URL}
|
|
91
|
+
schemas: [public]
|
|
92
|
+
|
|
93
|
+
adapter:
|
|
94
|
+
type: postgrest
|
|
95
|
+
url: ${KOZOU_ADAPTER_URL:-http://postgrest:3000}
|
|
96
|
+
|
|
97
|
+
uiHints:
|
|
98
|
+
path: ./ui-hints.yaml
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The full schema also accepts `server.ui.{port,host}`,
|
|
102
|
+
`server.mcp.http.{port,host}`, `server.mcp.stdio`, and
|
|
103
|
+
`cache.ttlMs` overrides; defaults match the template that
|
|
104
|
+
`create-kozou` writes. `${VAR}` and `${VAR:-default}` are
|
|
105
|
+
expanded from the process environment at load time.
|
|
27
106
|
|
|
28
107
|
## License
|
|
29
108
|
|
|
30
|
-
|
|
109
|
+
Apache 2.0. See [LICENSE](../../LICENSE) at the repository root.
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// `kozou` CLI entry point. Wires up the sub-commands defined in
|
|
3
|
+
// Kozou v0.1 design spec §9.1 via commander.
|
|
4
|
+
import { Command } from 'commander';
|
|
5
|
+
import { inspectCommand } from './commands/inspect.js';
|
|
6
|
+
import { mcpCommand } from './commands/mcp.js';
|
|
7
|
+
import { devCommand } from './commands/dev.js';
|
|
8
|
+
import { PACKAGE_VERSION } from './index.js';
|
|
9
|
+
const program = new Command()
|
|
10
|
+
.name('kozou')
|
|
11
|
+
.description('PostgreSQL compiler. One source, many faithful forms. (Kozou v0.1 design spec §9)')
|
|
12
|
+
.version(PACKAGE_VERSION);
|
|
13
|
+
program
|
|
14
|
+
.command('inspect')
|
|
15
|
+
.description('Dump the Schema Context as JSON or YAML.')
|
|
16
|
+
.option('--format <fmt>', 'output format: json | yaml', 'json')
|
|
17
|
+
.option('--output <path>', 'output file (- for stdout)', '-')
|
|
18
|
+
.option('--config <path>', 'path to kozou.config.yaml')
|
|
19
|
+
.action(async (flags) => {
|
|
20
|
+
await inspectCommand({
|
|
21
|
+
format: flags.format,
|
|
22
|
+
output: flags.output,
|
|
23
|
+
config: flags.config,
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
program
|
|
27
|
+
.command('mcp')
|
|
28
|
+
.description('Run the MCP server (stdio in v0.1; HTTP in v0.1.1).')
|
|
29
|
+
.option('--stdio', 'use stdio transport (default)')
|
|
30
|
+
.option('--http', 'use HTTP transport (scheduled for v0.1.1)')
|
|
31
|
+
.option('--port <n>', 'HTTP port', (raw) => parseInt(raw, 10))
|
|
32
|
+
.option('--config <path>', 'path to kozou.config.yaml')
|
|
33
|
+
.action(async (flags) => {
|
|
34
|
+
await mcpCommand({
|
|
35
|
+
stdio: flags.stdio,
|
|
36
|
+
http: flags.http,
|
|
37
|
+
port: flags.port,
|
|
38
|
+
config: flags.config,
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
program
|
|
42
|
+
.command('dev')
|
|
43
|
+
.description('Run the bundled Admin UI + MCP HTTP dev server (v0.1.1).')
|
|
44
|
+
.option('--config <path>', 'path to kozou.config.yaml')
|
|
45
|
+
.action(async (flags) => {
|
|
46
|
+
await devCommand({ config: flags.config });
|
|
47
|
+
});
|
|
48
|
+
program.parseAsync(process.argv).catch((err) => {
|
|
49
|
+
process.stderr.write(`${err instanceof Error ? err.message : String(err)}\n`);
|
|
50
|
+
process.exit(1);
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,gEAAgE;AAChE,6CAA6C;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAmB7C,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE;KAC1B,IAAI,CAAC,OAAO,CAAC;KACb,WAAW,CACV,mFAAmF,CACpF;KACA,OAAO,CAAC,eAAe,CAAC,CAAC;AAE5B,OAAO;KACJ,OAAO,CAAC,SAAS,CAAC;KAClB,WAAW,CAAC,0CAA0C,CAAC;KACvD,MAAM,CAAC,gBAAgB,EAAE,4BAA4B,EAAE,MAAM,CAAC;KAC9D,MAAM,CAAC,iBAAiB,EAAE,4BAA4B,EAAE,GAAG,CAAC;KAC5D,MAAM,CAAC,iBAAiB,EAAE,2BAA2B,CAAC;KACtD,MAAM,CAAC,KAA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,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAeF,wBAAsB,UAAU,CAAC,KAAK,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAEtE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// `kozou dev` command implementation.
|
|
2
|
+
//
|
|
3
|
+
// In v0.1 this is a deliberate stub: the Admin UI (`@kozou/svelte-ui`) is
|
|
4
|
+
// scheduled for v0.1.1 per the Kozou v0.1 design spec §16.1.1 B, so there is nothing for the
|
|
5
|
+
// dev server to host yet. Until the UI lands, we print a hand-off message
|
|
6
|
+
// pointing adopters at `kozou mcp --stdio` for AI agent access.
|
|
7
|
+
const DEV_HANDOFF_MESSAGE = 'kozou dev: the bundled Admin UI is scheduled for v0.1.1.\n' +
|
|
8
|
+
' See Kozou v0.1 design spec §16.1.1 B for the roadmap and §8 for the\n' +
|
|
9
|
+
' @kozou/svelte-ui specification.\n' +
|
|
10
|
+
'\n' +
|
|
11
|
+
' Available today:\n' +
|
|
12
|
+
' kozou mcp --stdio Run the MCP server for AI agent access.\n' +
|
|
13
|
+
' kozou inspect Dump the Schema Context as JSON or YAML.\n';
|
|
14
|
+
// The leading underscore on `_opts` flags this as a deliberately ignored
|
|
15
|
+
// parameter (eslint argsIgnorePattern: ^_). The full DevOptions shape is
|
|
16
|
+
// kept in the signature so it matches the v0.1.1 implementation that
|
|
17
|
+
// will actually consume the config.
|
|
18
|
+
export async function devCommand(_opts = {}) {
|
|
19
|
+
process.stderr.write(DEV_HANDOFF_MESSAGE);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=dev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,EAAE;AACF,0EAA0E;AAC1E,6FAA6F;AAC7F,0EAA0E;AAC1E,gEAAgE;AAMhE,MAAM,mBAAmB,GACvB,4DAA4D;IAC5D,yEAAyE;IACzE,qCAAqC;IACrC,IAAI;IACJ,sBAAsB;IACtB,mEAAmE;IACnE,oEAAoE,CAAC;AAEvE,yEAAyE;AACzE,yEAAyE;AACzE,qEAAqE;AACrE,oCAAoC;AACpC,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,QAAoB,EAAE;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type InspectOptions = {
|
|
2
|
+
/** Output format. Default: 'json'. */
|
|
3
|
+
format?: 'json' | 'yaml';
|
|
4
|
+
/** Output destination. '-' = stdout (default), otherwise a file path. */
|
|
5
|
+
output?: string;
|
|
6
|
+
/** Path to kozou.config.yaml. Default: ./kozou.config.yaml. */
|
|
7
|
+
config?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function inspectCommand(opts?: InspectOptions): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=inspect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/commands/inspect.ts"],"names":[],"mappings":"AAkBA,MAAM,MAAM,cAAc,GAAG;IAC3B,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAsB,cAAc,CAAC,IAAI,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkC7E"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// `kozou inspect` command implementation.
|
|
2
|
+
//
|
|
3
|
+
// Pipeline:
|
|
4
|
+
// 1. Load the kozou.config.yaml (or fall back to defaults).
|
|
5
|
+
// 2. Introspect the target Postgres schema (@kozou/introspect).
|
|
6
|
+
// 3. Optionally load UI hints (@kozou/core.loadUIHints).
|
|
7
|
+
// 4. Build a SchemaContext (@kozou/core.buildSchemaContext).
|
|
8
|
+
// 5. Serialize to JSON or YAML and write to stdout or a file.
|
|
9
|
+
//
|
|
10
|
+
// See Kozou v0.1 design spec §9.1.
|
|
11
|
+
import { writeFile } from 'node:fs/promises';
|
|
12
|
+
import { stringify as stringifyYAML } from 'yaml';
|
|
13
|
+
import { buildSchemaContext, loadUIHints } from '@kozou/core';
|
|
14
|
+
import { introspect } from '@kozou/introspect';
|
|
15
|
+
import { loadConfig } from '../config.js';
|
|
16
|
+
export async function inspectCommand(opts = {}) {
|
|
17
|
+
const format = opts.format ?? 'json';
|
|
18
|
+
const output = opts.output ?? '-';
|
|
19
|
+
if (format !== 'json' && format !== 'yaml') {
|
|
20
|
+
throw new Error(`kozou inspect: invalid --format "${format}" (expected "json" or "yaml")`);
|
|
21
|
+
}
|
|
22
|
+
const config = await loadConfig({ path: opts.config });
|
|
23
|
+
const raw = await introspect({
|
|
24
|
+
connection: config.database.url,
|
|
25
|
+
schemas: config.database.schemas,
|
|
26
|
+
});
|
|
27
|
+
let uiHints;
|
|
28
|
+
if (config.uiHints.path !== null && config.uiHints.path !== '') {
|
|
29
|
+
try {
|
|
30
|
+
uiHints = await loadUIHints(config.uiHints.path);
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
// UI hints are optional; warn but continue without them.
|
|
34
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
35
|
+
process.stderr.write(`[kozou inspect] could not load UI hints: ${message}\n`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const ctx = await buildSchemaContext({ raw, uiHints });
|
|
39
|
+
const serialized = format === 'yaml' ? stringifyYAML(ctx) : JSON.stringify(ctx, null, 2);
|
|
40
|
+
const payload = serialized.endsWith('\n') ? serialized : serialized + '\n';
|
|
41
|
+
if (output === '-') {
|
|
42
|
+
process.stdout.write(payload);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
await writeFile(output, payload, 'utf8');
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=inspect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect.js","sourceRoot":"","sources":["../../src/commands/inspect.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,EAAE;AACF,YAAY;AACZ,8DAA8D;AAC9D,kEAAkE;AAClE,2DAA2D;AAC3D,+DAA+D;AAC/D,gEAAgE;AAChE,EAAE;AACF,mCAAmC;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAW1C,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAAuB,EAAE;IAC5D,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC;IACrC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,GAAG,CAAC;IAClC,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,oCAAoC,MAAM,+BAA+B,CAAC,CAAC;IAC7F,CAAC;IAED,M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,OAAO,CAAC,CAAC;QAC9B,OAAO;IACT,CAAC;IACD,MAAM,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAOF,wBAAsB,UAAU,CAAC,IAAI,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBrE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// `kozou mcp` command implementation.
|
|
2
|
+
//
|
|
3
|
+
// --stdio: spins up the @kozou/mcp server with a stdio transport, reading
|
|
4
|
+
// connection details from kozou.config.yaml / environment.
|
|
5
|
+
// --http: deferred to v0.1.1 per the Kozou v0.1 design spec §16.1.1 B.
|
|
6
|
+
// Prints a hand-off note to stderr and exits cleanly.
|
|
7
|
+
//
|
|
8
|
+
// See Kozou v0.1 design spec §9.1 and §7.
|
|
9
|
+
import { SchemaCache, startStdioServer } from '@kozou/mcp';
|
|
10
|
+
import { loadConfig } from '../config.js';
|
|
11
|
+
const HTTP_HANDOFF_MESSAGE = 'kozou mcp --http: HTTP transport is scheduled for v0.1.1.\n' +
|
|
12
|
+
' See Kozou v0.1 design spec §16.1.1 B for the roadmap.\n' +
|
|
13
|
+
' Use --stdio for now (the default).\n';
|
|
14
|
+
export async function mcpCommand(opts = {}) {
|
|
15
|
+
// --http is deferred to v0.1.1 (HTTP transport not yet implemented in
|
|
16
|
+
// the underlying @kozou/mcp package).
|
|
17
|
+
if (opts.http === true) {
|
|
18
|
+
process.stderr.write(HTTP_HANDOFF_MESSAGE);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const config = await loadConfig({ path: opts.config });
|
|
22
|
+
const cache = new SchemaCache({
|
|
23
|
+
connection: config.database.url,
|
|
24
|
+
schemas: config.database.schemas,
|
|
25
|
+
ttlMs: config.cache.ttlMs,
|
|
26
|
+
});
|
|
27
|
+
await startStdioServer(cache, { logPrefix: '[kozou mcp]' });
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=mcp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,EAAE;AACF,0EAA0E;AAC1E,6DAA6D;AAC7D,uEAAuE;AACvE,wDAAwD;AACxD,EAAE;AACF,0CAA0C;AAE1C,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAS1C,MAAM,oBAAoB,GACxB,6DAA6D;IAC7D,2DAA2D;IAC3D,wCAAwC,CAAC;AAE3C,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAAmB,EAAE;IACpD,sEAAsE;IACtE,sCAAsC;IACtC,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QACvB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;QAC3C,OAAO;IACT,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAEvD,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC;QAC5B,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG;QAC/B,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO;QAChC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK;KAC1B,CAAC,CAAC;IAEH,MAAM,gBAAgB,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC;AAC9D,CAAC"}
|