keystonectl 0.1.0__tar.gz

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 (62) hide show
  1. keystonectl-0.1.0/.gitignore +23 -0
  2. keystonectl-0.1.0/CHANGELOG.md +44 -0
  3. keystonectl-0.1.0/LICENSE +202 -0
  4. keystonectl-0.1.0/PKG-INFO +167 -0
  5. keystonectl-0.1.0/README.md +135 -0
  6. keystonectl-0.1.0/pyproject.toml +77 -0
  7. keystonectl-0.1.0/src/keystonectl/__init__.py +3 -0
  8. keystonectl-0.1.0/src/keystonectl/__main__.py +8 -0
  9. keystonectl-0.1.0/src/keystonectl/answers.py +335 -0
  10. keystonectl-0.1.0/src/keystonectl/bundles.py +556 -0
  11. keystonectl-0.1.0/src/keystonectl/catalog.py +345 -0
  12. keystonectl-0.1.0/src/keystonectl/check.py +527 -0
  13. keystonectl-0.1.0/src/keystonectl/cli.py +779 -0
  14. keystonectl-0.1.0/src/keystonectl/compat.py +205 -0
  15. keystonectl-0.1.0/src/keystonectl/compose_gen.py +32 -0
  16. keystonectl-0.1.0/src/keystonectl/envfiles.py +136 -0
  17. keystonectl-0.1.0/src/keystonectl/errors.py +951 -0
  18. keystonectl-0.1.0/src/keystonectl/fetch.py +187 -0
  19. keystonectl-0.1.0/src/keystonectl/generate/__init__.py +1 -0
  20. keystonectl-0.1.0/src/keystonectl/generate/checks.py +219 -0
  21. keystonectl-0.1.0/src/keystonectl/generate/compose.py +287 -0
  22. keystonectl-0.1.0/src/keystonectl/generate/docker.py +221 -0
  23. keystonectl-0.1.0/src/keystonectl/generate/files.py +33 -0
  24. keystonectl-0.1.0/src/keystonectl/generate/install.py +1791 -0
  25. keystonectl-0.1.0/src/keystonectl/generate/namespace.py +54 -0
  26. keystonectl-0.1.0/src/keystonectl/generate/packages_file.py +97 -0
  27. keystonectl-0.1.0/src/keystonectl/generate/placement.py +203 -0
  28. keystonectl-0.1.0/src/keystonectl/generate/registry.py +126 -0
  29. keystonectl-0.1.0/src/keystonectl/generate/status.py +273 -0
  30. keystonectl-0.1.0/src/keystonectl/generate/tokens.py +9 -0
  31. keystonectl-0.1.0/src/keystonectl/generate/validators.py +70 -0
  32. keystonectl-0.1.0/src/keystonectl/keystone_mcp_rules.py +118 -0
  33. keystonectl-0.1.0/src/keystonectl/layout.py +1770 -0
  34. keystonectl-0.1.0/src/keystonectl/lifecycle.py +1233 -0
  35. keystonectl-0.1.0/src/keystonectl/lint.py +227 -0
  36. keystonectl-0.1.0/src/keystonectl/lock.py +257 -0
  37. keystonectl-0.1.0/src/keystonectl/manifest.py +871 -0
  38. keystonectl-0.1.0/src/keystonectl/nginx/.gitkeep +0 -0
  39. keystonectl-0.1.0/src/keystonectl/nginx/__init__.py +1 -0
  40. keystonectl-0.1.0/src/keystonectl/nginx/service-https.conf.template +48 -0
  41. keystonectl-0.1.0/src/keystonectl/nginx/service.conf.template +28 -0
  42. keystonectl-0.1.0/src/keystonectl/output.py +123 -0
  43. keystonectl-0.1.0/src/keystonectl/plan.py +821 -0
  44. keystonectl-0.1.0/src/keystonectl/public.py +1328 -0
  45. keystonectl-0.1.0/src/keystonectl/py.typed +0 -0
  46. keystonectl-0.1.0/src/keystonectl/remote.py +985 -0
  47. keystonectl-0.1.0/src/keystonectl/resources/__init__.py +22 -0
  48. keystonectl-0.1.0/src/keystonectl/resources/binding.py +1747 -0
  49. keystonectl-0.1.0/src/keystonectl/resources/deployer.py +22 -0
  50. keystonectl-0.1.0/src/keystonectl/resources/interfaces.py +75 -0
  51. keystonectl-0.1.0/src/keystonectl/resources/network.py +54 -0
  52. keystonectl-0.1.0/src/keystonectl/resources/postgres_probe.py +831 -0
  53. keystonectl-0.1.0/src/keystonectl/resources/provision.py +287 -0
  54. keystonectl-0.1.0/src/keystonectl/resources/s3_probe.py +775 -0
  55. keystonectl-0.1.0/src/keystonectl/runner.py +109 -0
  56. keystonectl-0.1.0/src/keystonectl/schemas/catalog-v1.json +234 -0
  57. keystonectl-0.1.0/src/keystonectl/schemas/lock-v1.json +385 -0
  58. keystonectl-0.1.0/src/keystonectl/schemas/output.schema.json +92 -0
  59. keystonectl-0.1.0/src/keystonectl/schemas/service-package-v1.json +670 -0
  60. keystonectl-0.1.0/src/keystonectl/schemas/sources-v1.json +76 -0
  61. keystonectl-0.1.0/src/keystonectl/sources.py +777 -0
  62. keystonectl-0.1.0/src/keystonectl/tls.py +470 -0
@@ -0,0 +1,23 @@
1
+ internal/
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .venv/
6
+ venv/
7
+ dist/
8
+ build/
9
+ .pytest_cache/
10
+ .mypy_cache/
11
+ .ruff_cache/
12
+ .coverage
13
+ .coverage.*
14
+ htmlcov/
15
+ *.log
16
+ e2e-*.jsonl
17
+ e2e-diagnostics/
18
+ .env
19
+ .env.*
20
+ !.env.example
21
+ .DS_Store
22
+ .idea/
23
+ .vscode/
@@ -0,0 +1,44 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0] - 2026-10-14
10
+
11
+ ### Added
12
+
13
+ - Chat skill in `skills/keystonectl/` for installing, upgrading, and removing services.
14
+ - Guide for service authors: `docs/packaging-a-service.md`.
15
+ - CLI skeleton: `init`, `lint`, `check`, `plan`/`apply`, lock file, catalog sources, JSON output.
16
+ - Resource binding for `s3/v1` and `postgres/v1` with probes.
17
+ - Published on PyPI as `keystonectl`; tags `vX.Y.Z` publish through trusted publishing.
18
+ - Public paths: loopback port, nginx vhost, certificate lifecycle, and `service remove`, `upgrade`, `rollback`, `eject`, and `adopt`.
19
+ - Release gate verifies that the default catalog ref exists.
20
+ - `SECURITY.md`.
21
+ - Unexpected errors are reported as `internal_error` in JSON.
22
+
23
+ ### Changed
24
+
25
+ - catalog spec explains tag versus commit pinning.
26
+ - ADR 0005 and generation.md describe `check` as reporting, `apply` and `upgrade` as stopping.
27
+ - Error hints no longer mention a `--local` flag; `package_ambiguous` names the `source/name` form with an example.
28
+ - README links are absolute for PyPI.
29
+ - ADR 0001 lists the core internals keystonectl depends on.
30
+ - `docs/packaging-a-service.md`: the file-mcp example no longer calls the published image digest a placeholder; it now points authors at copying their own registry's digest.
31
+ - Corrected five docs that had drifted from the code: resource binding question reuse (`docs/resources.md`), Postgres provider promises (`docs/spec/resources/postgres-v1.md`), the keystone-deploy `mcp/` layout example (`docs/spec/deployment-layout.md`), the public DNS check (`docs/public-paths.md`), and `keystone-resources` cross-package reachability (`docs/spec/service-package.md`, `docs/packaging-a-service.md`).
32
+ - ADR 0004 no longer mentions a `--local` flag.
33
+ - `tag_not_found` names the source, the ref, and the URL.
34
+ - e2e: vm profile requires --keystonectl until 0.1.0 is on PyPI; certbot re-issue checked by serial.
35
+ - Skill handles `recommended_policy` from `bundle install`.
36
+ - Taking over an nginx site asks every time and restores every disabled site on remove.
37
+ - e2e pins keystone-deploy at the release/catalog commit that drops the managed-mode text from `.env.example`.
38
+
39
+ ### Fixed
40
+
41
+ - test: consumer secret comparison after a failed probe
42
+ - State-changing commands hold the lock for their whole run; a second process gets `busy`.
43
+ - Catalog and package fetches no longer fail with EXDEV when /tmp is a different file system.
44
+ - Fetching into a deployment root that has never run `init` now creates `.keystonectl/` itself with mode 700 and the promised `.gitignore`, instead of leaving it with a default, wider mode.
@@ -0,0 +1,202 @@
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 2026 Alexey Klochkov
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.
@@ -0,0 +1,167 @@
1
+ Metadata-Version: 2.5
2
+ Name: keystonectl
3
+ Version: 0.1.0
4
+ Summary: Install and check services behind a Keystone MCP gateway: package lint, deployment check, plan/apply
5
+ Project-URL: Homepage, https://github.com/keystone-codes/keystonectl
6
+ Project-URL: Repository, https://github.com/keystone-codes/keystonectl
7
+ Project-URL: Issues, https://github.com/keystone-codes/keystonectl/issues
8
+ Project-URL: Changelog, https://github.com/keystone-codes/keystonectl/blob/main/CHANGELOG.md
9
+ Project-URL: Documentation, https://github.com/keystone-codes/keystonectl/tree/main/docs
10
+ Author: Keystone Codes
11
+ License-Expression: Apache-2.0
12
+ License-File: LICENSE
13
+ Keywords: docker-compose,gateway,installer,keystone,mcp
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Environment :: Console
16
+ Classifier: Intended Audience :: System Administrators
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: System :: Installation/Setup
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.11
25
+ Requires-Dist: boto3>=1.34
26
+ Requires-Dist: httpx>=0.27
27
+ Requires-Dist: jsonschema>=4.18
28
+ Requires-Dist: packaging>=24
29
+ Requires-Dist: psycopg[binary]>=3.2
30
+ Requires-Dist: pyyaml>=6
31
+ Description-Content-Type: text/markdown
32
+
33
+ # keystonectl
34
+
35
+ keystonectl installs MCP services behind a Keystone MCP gateway from a catalog, checks service
36
+ packages and deployments, and gives agents a plan/apply interface.
37
+
38
+ - **Service manifest** — authors and operators share one package description (`keystone-service.yaml`).
39
+ - **Check before run** — `lint` and `check` validate packages and layout without starting containers.
40
+ - **Generate and lifecycle** — `init`, `service plan`/`apply`, lock file, and compose fragments for the gateway.
41
+
42
+ keystonectl does **not** install keystone-mcp itself and does **not** edit RBAC policy files.
43
+
44
+ ## What keystonectl writes
45
+
46
+ `service apply` writes the package compose fragment, env files, `docker-compose.packages.yml` (the second `-f`), the upstream registry, the catalog snapshot, and the gateway names in `.env`. It does not edit `packages/<name>.override.yml` or the operator's `docker-compose.yml`. See [docs/generation.md](https://github.com/keystone-codes/keystonectl/blob/main/docs/generation.md).
47
+
48
+ ## Install
49
+
50
+ Preferred:
51
+
52
+ ```bash
53
+ uv tool install keystonectl
54
+ ```
55
+
56
+ Alternatives:
57
+
58
+ ```bash
59
+ pipx install keystonectl
60
+ uvx keystonectl --version
61
+ ```
62
+
63
+ ## Quick start
64
+
65
+ ```bash
66
+ keystonectl init --adopt <deployment-dir>
67
+ keystonectl --root <deployment-dir> catalog list
68
+ keystonectl --root <deployment-dir> bundle install minimal
69
+ keystonectl --root <deployment-dir> service status
70
+ ```
71
+
72
+ Without `sources.yaml` the default catalog `keystone-codes` is used at tag `v1.0.0`.
73
+
74
+ Every command, its questions, and its error ids are in [docs/commands.md](https://github.com/keystone-codes/keystonectl/blob/main/docs/commands.md).
75
+
76
+ A service you run yourself is not a package. `keystonectl service add-remote` records its URL, namespace, and filters, and writes a mode 600 handoff file for the team that runs it. keystonectl does not generate compose for that service.
77
+
78
+ ## Run from a checkout
79
+
80
+ ```bash
81
+ uv run keystonectl --version
82
+ uv run keystonectl init <directory>
83
+ uv run keystonectl init --adopt <directory>
84
+ uv run keystonectl lint <manifest-or-directory>
85
+ uv run keystonectl --root <directory> check
86
+ uv run keystonectl --root <directory> catalog list
87
+ uv run keystonectl --root <directory> service plan <package>
88
+ uv run keystonectl --root <directory> service apply <package>
89
+ ```
90
+
91
+ `service install` is another name for `service apply`. `package lint` is another name for `lint`.
92
+
93
+ ## Install through chat
94
+
95
+ Agents install services by following [`skills/keystonectl/`](https://github.com/keystone-codes/keystonectl/blob/main/skills/keystonectl/SKILL.md). Copy that directory into the agent's skills directory on the host where keystone-mcp runs. The skill ships in the repository, not in the wheel: copy `skills/keystonectl/` from a checkout or a release archive.
96
+
97
+ The agent runs `keystonectl` with `--json`, asks one question at a time, and takes a secret only as a path to a mode 600 file. It does not run Docker, edit compose files, or edit the RBAC policy. Recommended roles are handed to the `keystone-policy-admin` skill from keystone-mcp 0.5.0, which applies them after an administrator confirms, also for bundles. Without that skill, the agent shows the same `{role, allow}` list and the policy path for the administrator to apply.
98
+
99
+ ## JSON
100
+
101
+ Pass `--json` for one JSON document on stdout. The document matches `src/keystonectl/schemas/output.schema.json`.
102
+ `--json` does not prompt. Secrets read during the run are replaced with `***`.
103
+
104
+ Exit codes are the same for text and JSON:
105
+
106
+ | Code | Meaning |
107
+ |---|---|
108
+ | 0 | Done. Warnings are allowed. |
109
+ | 1 | The command was used incorrectly. |
110
+ | 2 | An answer is missing. Nothing was changed. |
111
+ | 3 | A rule failed, or something outside keystonectl failed. `retryable` is true only for this code. |
112
+
113
+ ## Answers
114
+
115
+ Non-secret answers can be given with `--set KEY=VALUE` or the environment.
116
+ The name of a per-service answer is `KEYSTONE_SETUP_SERVICE_<PKG>_<SUFFIX>`,
117
+ with the package name in upper case and `-` turned into `_`.
118
+ A secret is only a path to a mode 600 file. The variable name ends in `_FILE`.
119
+ `--set` refuses secret variables.
120
+
121
+ Lookup order: `--set`, the environment, the answer stored in the lock, then the manifest default.
122
+
123
+ ## Files
124
+
125
+ | Path | Role |
126
+ |---|---|
127
+ | `services.lock.yaml` | What is installed. Not committed. |
128
+ | `sources.yaml` | Catalog sources. Absent means the default keystone-codes catalog. |
129
+ | `keystonectl/upstreams.yaml` | Upstream registry read by keystone-mcp. |
130
+ | `keystonectl/catalog-snapshot.yaml` | Catalog snapshot read by keystone-mcp. |
131
+ | `.keystonectl/` | Cache of catalogs and packages. |
132
+
133
+ Start the stack with both compose files, for example:
134
+
135
+ ```bash
136
+ docker compose -f docker-compose.yml -f docker-compose.packages.yml up -d
137
+ ```
138
+
139
+ `init --adopt` prints that command. Without the second file, keystone-mcp does not see the registry, the snapshot, or the service network.
140
+
141
+ ## Documentation
142
+
143
+ - Packaging your own service: [docs/packaging-a-service.md](https://github.com/keystone-codes/keystonectl/blob/main/docs/packaging-a-service.md)
144
+ - [Service package spec](https://github.com/keystone-codes/keystonectl/blob/main/docs/spec/service-package.md)
145
+ - [Catalog spec](https://github.com/keystone-codes/keystonectl/blob/main/docs/spec/catalog.md)
146
+ - [S3 resource interface](https://github.com/keystone-codes/keystonectl/blob/main/docs/spec/resources/s3-v1.md)
147
+ - [Postgres resource interface](https://github.com/keystone-codes/keystonectl/blob/main/docs/spec/resources/postgres-v1.md)
148
+ - [Deployment layout](https://github.com/keystone-codes/keystonectl/blob/main/docs/spec/deployment-layout.md)
149
+ - [Architecture decisions](https://github.com/keystone-codes/keystonectl/blob/main/docs/adr/README.md)
150
+ - [CLI reference](https://github.com/keystone-codes/keystonectl/blob/main/docs/cli.md)
151
+ - [Environment variables](https://github.com/keystone-codes/keystonectl/blob/main/docs/resources.md)
152
+
153
+ Why things are the way they are: [ADR 0006](https://github.com/keystone-codes/keystonectl/blob/main/docs/adr/0006-keystonectl-is-a-separate-product.md).
154
+
155
+ ## Verification
156
+
157
+ `scripts/e2e.sh` runs the release checks against a real keystone-mcp: the open example and the keystone-deploy MCP layout. Flags, scenarios, and how to read the JSONL report are in [scripts/e2e/README.md](https://github.com/keystone-codes/keystonectl/blob/main/scripts/e2e/README.md). The manual VM and stand protocol, with an empty result column until someone runs it, is [docs/release-checklist.md](https://github.com/keystone-codes/keystonectl/blob/main/docs/release-checklist.md).
158
+
159
+ ## Compatibility
160
+
161
+ The `keystonectl` version is independent of keystone-mcp. Service packages declare supported
162
+ keystone-mcp versions in `compat.keystone_mcp`; `keystonectl check` validates them against your
163
+ deployment.
164
+
165
+ ## License
166
+
167
+ Apache-2.0 — see [LICENSE](https://github.com/keystone-codes/keystonectl/blob/main/LICENSE).
@@ -0,0 +1,135 @@
1
+ # keystonectl
2
+
3
+ keystonectl installs MCP services behind a Keystone MCP gateway from a catalog, checks service
4
+ packages and deployments, and gives agents a plan/apply interface.
5
+
6
+ - **Service manifest** — authors and operators share one package description (`keystone-service.yaml`).
7
+ - **Check before run** — `lint` and `check` validate packages and layout without starting containers.
8
+ - **Generate and lifecycle** — `init`, `service plan`/`apply`, lock file, and compose fragments for the gateway.
9
+
10
+ keystonectl does **not** install keystone-mcp itself and does **not** edit RBAC policy files.
11
+
12
+ ## What keystonectl writes
13
+
14
+ `service apply` writes the package compose fragment, env files, `docker-compose.packages.yml` (the second `-f`), the upstream registry, the catalog snapshot, and the gateway names in `.env`. It does not edit `packages/<name>.override.yml` or the operator's `docker-compose.yml`. See [docs/generation.md](https://github.com/keystone-codes/keystonectl/blob/main/docs/generation.md).
15
+
16
+ ## Install
17
+
18
+ Preferred:
19
+
20
+ ```bash
21
+ uv tool install keystonectl
22
+ ```
23
+
24
+ Alternatives:
25
+
26
+ ```bash
27
+ pipx install keystonectl
28
+ uvx keystonectl --version
29
+ ```
30
+
31
+ ## Quick start
32
+
33
+ ```bash
34
+ keystonectl init --adopt <deployment-dir>
35
+ keystonectl --root <deployment-dir> catalog list
36
+ keystonectl --root <deployment-dir> bundle install minimal
37
+ keystonectl --root <deployment-dir> service status
38
+ ```
39
+
40
+ Without `sources.yaml` the default catalog `keystone-codes` is used at tag `v1.0.0`.
41
+
42
+ Every command, its questions, and its error ids are in [docs/commands.md](https://github.com/keystone-codes/keystonectl/blob/main/docs/commands.md).
43
+
44
+ A service you run yourself is not a package. `keystonectl service add-remote` records its URL, namespace, and filters, and writes a mode 600 handoff file for the team that runs it. keystonectl does not generate compose for that service.
45
+
46
+ ## Run from a checkout
47
+
48
+ ```bash
49
+ uv run keystonectl --version
50
+ uv run keystonectl init <directory>
51
+ uv run keystonectl init --adopt <directory>
52
+ uv run keystonectl lint <manifest-or-directory>
53
+ uv run keystonectl --root <directory> check
54
+ uv run keystonectl --root <directory> catalog list
55
+ uv run keystonectl --root <directory> service plan <package>
56
+ uv run keystonectl --root <directory> service apply <package>
57
+ ```
58
+
59
+ `service install` is another name for `service apply`. `package lint` is another name for `lint`.
60
+
61
+ ## Install through chat
62
+
63
+ Agents install services by following [`skills/keystonectl/`](https://github.com/keystone-codes/keystonectl/blob/main/skills/keystonectl/SKILL.md). Copy that directory into the agent's skills directory on the host where keystone-mcp runs. The skill ships in the repository, not in the wheel: copy `skills/keystonectl/` from a checkout or a release archive.
64
+
65
+ The agent runs `keystonectl` with `--json`, asks one question at a time, and takes a secret only as a path to a mode 600 file. It does not run Docker, edit compose files, or edit the RBAC policy. Recommended roles are handed to the `keystone-policy-admin` skill from keystone-mcp 0.5.0, which applies them after an administrator confirms, also for bundles. Without that skill, the agent shows the same `{role, allow}` list and the policy path for the administrator to apply.
66
+
67
+ ## JSON
68
+
69
+ Pass `--json` for one JSON document on stdout. The document matches `src/keystonectl/schemas/output.schema.json`.
70
+ `--json` does not prompt. Secrets read during the run are replaced with `***`.
71
+
72
+ Exit codes are the same for text and JSON:
73
+
74
+ | Code | Meaning |
75
+ |---|---|
76
+ | 0 | Done. Warnings are allowed. |
77
+ | 1 | The command was used incorrectly. |
78
+ | 2 | An answer is missing. Nothing was changed. |
79
+ | 3 | A rule failed, or something outside keystonectl failed. `retryable` is true only for this code. |
80
+
81
+ ## Answers
82
+
83
+ Non-secret answers can be given with `--set KEY=VALUE` or the environment.
84
+ The name of a per-service answer is `KEYSTONE_SETUP_SERVICE_<PKG>_<SUFFIX>`,
85
+ with the package name in upper case and `-` turned into `_`.
86
+ A secret is only a path to a mode 600 file. The variable name ends in `_FILE`.
87
+ `--set` refuses secret variables.
88
+
89
+ Lookup order: `--set`, the environment, the answer stored in the lock, then the manifest default.
90
+
91
+ ## Files
92
+
93
+ | Path | Role |
94
+ |---|---|
95
+ | `services.lock.yaml` | What is installed. Not committed. |
96
+ | `sources.yaml` | Catalog sources. Absent means the default keystone-codes catalog. |
97
+ | `keystonectl/upstreams.yaml` | Upstream registry read by keystone-mcp. |
98
+ | `keystonectl/catalog-snapshot.yaml` | Catalog snapshot read by keystone-mcp. |
99
+ | `.keystonectl/` | Cache of catalogs and packages. |
100
+
101
+ Start the stack with both compose files, for example:
102
+
103
+ ```bash
104
+ docker compose -f docker-compose.yml -f docker-compose.packages.yml up -d
105
+ ```
106
+
107
+ `init --adopt` prints that command. Without the second file, keystone-mcp does not see the registry, the snapshot, or the service network.
108
+
109
+ ## Documentation
110
+
111
+ - Packaging your own service: [docs/packaging-a-service.md](https://github.com/keystone-codes/keystonectl/blob/main/docs/packaging-a-service.md)
112
+ - [Service package spec](https://github.com/keystone-codes/keystonectl/blob/main/docs/spec/service-package.md)
113
+ - [Catalog spec](https://github.com/keystone-codes/keystonectl/blob/main/docs/spec/catalog.md)
114
+ - [S3 resource interface](https://github.com/keystone-codes/keystonectl/blob/main/docs/spec/resources/s3-v1.md)
115
+ - [Postgres resource interface](https://github.com/keystone-codes/keystonectl/blob/main/docs/spec/resources/postgres-v1.md)
116
+ - [Deployment layout](https://github.com/keystone-codes/keystonectl/blob/main/docs/spec/deployment-layout.md)
117
+ - [Architecture decisions](https://github.com/keystone-codes/keystonectl/blob/main/docs/adr/README.md)
118
+ - [CLI reference](https://github.com/keystone-codes/keystonectl/blob/main/docs/cli.md)
119
+ - [Environment variables](https://github.com/keystone-codes/keystonectl/blob/main/docs/resources.md)
120
+
121
+ Why things are the way they are: [ADR 0006](https://github.com/keystone-codes/keystonectl/blob/main/docs/adr/0006-keystonectl-is-a-separate-product.md).
122
+
123
+ ## Verification
124
+
125
+ `scripts/e2e.sh` runs the release checks against a real keystone-mcp: the open example and the keystone-deploy MCP layout. Flags, scenarios, and how to read the JSONL report are in [scripts/e2e/README.md](https://github.com/keystone-codes/keystonectl/blob/main/scripts/e2e/README.md). The manual VM and stand protocol, with an empty result column until someone runs it, is [docs/release-checklist.md](https://github.com/keystone-codes/keystonectl/blob/main/docs/release-checklist.md).
126
+
127
+ ## Compatibility
128
+
129
+ The `keystonectl` version is independent of keystone-mcp. Service packages declare supported
130
+ keystone-mcp versions in `compat.keystone_mcp`; `keystonectl check` validates them against your
131
+ deployment.
132
+
133
+ ## License
134
+
135
+ Apache-2.0 — see [LICENSE](https://github.com/keystone-codes/keystonectl/blob/main/LICENSE).
@@ -0,0 +1,77 @@
1
+ [project]
2
+ name = "keystonectl"
3
+ version = "0.1.0"
4
+ description = "Install and check services behind a Keystone MCP gateway: package lint, deployment check, plan/apply"
5
+ readme = "README.md"
6
+ license = "Apache-2.0"
7
+ license-files = ["LICENSE"]
8
+ requires-python = ">=3.11"
9
+ authors = [{ name = "Keystone Codes" }]
10
+ keywords = ["mcp", "keystone", "installer", "docker-compose", "gateway"]
11
+ classifiers = [
12
+ "Development Status :: 3 - Alpha",
13
+ "Environment :: Console",
14
+ "Intended Audience :: System Administrators",
15
+ "Operating System :: POSIX :: Linux",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Programming Language :: Python :: 3.13",
20
+ "Topic :: System :: Installation/Setup",
21
+ "Typing :: Typed",
22
+ ]
23
+ dependencies = [
24
+ "pyyaml>=6",
25
+ "jsonschema>=4.18",
26
+ "boto3>=1.34",
27
+ "httpx>=0.27",
28
+ "psycopg[binary]>=3.2",
29
+ "packaging>=24",
30
+ ]
31
+
32
+ [project.scripts]
33
+ keystonectl = "keystonectl.cli:main"
34
+
35
+ [project.urls]
36
+ Homepage = "https://github.com/keystone-codes/keystonectl"
37
+ Repository = "https://github.com/keystone-codes/keystonectl"
38
+ Issues = "https://github.com/keystone-codes/keystonectl/issues"
39
+ Changelog = "https://github.com/keystone-codes/keystonectl/blob/main/CHANGELOG.md"
40
+ Documentation = "https://github.com/keystone-codes/keystonectl/tree/main/docs"
41
+
42
+ [dependency-groups]
43
+ dev = [
44
+ "pytest>=8",
45
+ "ruff",
46
+ "pyyaml>=6",
47
+ ]
48
+
49
+
50
+ [build-system]
51
+ requires = ["hatchling>=1.27"]
52
+ build-backend = "hatchling.build"
53
+
54
+ [tool.hatch.build.targets.wheel]
55
+ packages = ["src/keystonectl"]
56
+
57
+ [tool.hatch.build.targets.wheel.force-include]
58
+ "src/keystonectl/nginx/service.conf.template" = "keystonectl/nginx/service.conf.template"
59
+ "src/keystonectl/nginx/service-https.conf.template" = "keystonectl/nginx/service-https.conf.template"
60
+
61
+ [tool.hatch.build.targets.sdist]
62
+ only-include = ["src/keystonectl", "README.md", "LICENSE", "CHANGELOG.md", "pyproject.toml"]
63
+
64
+ [tool.ruff]
65
+ line-length = 100
66
+ target-version = "py311"
67
+
68
+ [tool.ruff.lint.per-file-ignores]
69
+ "src/keystonectl/resources/*_probe.py" = ["BLE001", "S110"]
70
+ "tests/support/fake_pg.py" = ["PYI034", "PYI036"]
71
+
72
+ [tool.pytest.ini_options]
73
+ pythonpath = ["."]
74
+ testpaths = ["tests"]
75
+ markers = [
76
+ "integration: needs Docker",
77
+ ]
@@ -0,0 +1,3 @@
1
+ """Install and check services behind a Keystone MCP gateway."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,8 @@
1
+ """python -m keystonectl"""
2
+
3
+ import sys
4
+
5
+ from keystonectl.cli import main
6
+
7
+ if __name__ == "__main__":
8
+ sys.exit(main())