plgt 0.1.0b1__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 (101) hide show
  1. plgt-0.1.0b1/LICENSE +201 -0
  2. plgt-0.1.0b1/PKG-INFO +99 -0
  3. plgt-0.1.0b1/README.md +61 -0
  4. plgt-0.1.0b1/plgt/__init__.py +0 -0
  5. plgt-0.1.0b1/plgt/__main__.py +145 -0
  6. plgt-0.1.0b1/plgt/build/config.yaml +11 -0
  7. plgt-0.1.0b1/plgt/clients/__init__.py +0 -0
  8. plgt-0.1.0b1/plgt/clients/extension_client.py +321 -0
  9. plgt-0.1.0b1/plgt/clients/lifecycle_command_client.py +600 -0
  10. plgt-0.1.0b1/plgt/clients/publish_client.py +244 -0
  11. plgt-0.1.0b1/plgt/clients/registry_client.py +319 -0
  12. plgt-0.1.0b1/plgt/clients/secrets_client.py +301 -0
  13. plgt-0.1.0b1/plgt/clients/workspace_packages_client.py +147 -0
  14. plgt-0.1.0b1/plgt/cmd/__init__.py +0 -0
  15. plgt-0.1.0b1/plgt/cmd/auth.py +157 -0
  16. plgt-0.1.0b1/plgt/cmd/configure.py +134 -0
  17. plgt-0.1.0b1/plgt/cmd/extensions.py +358 -0
  18. plgt-0.1.0b1/plgt/cmd/format.py +237 -0
  19. plgt-0.1.0b1/plgt/cmd/init.py +457 -0
  20. plgt-0.1.0b1/plgt/cmd/lifecycle.py +1276 -0
  21. plgt-0.1.0b1/plgt/cmd/lsp.py +40 -0
  22. plgt-0.1.0b1/plgt/cmd/migration.py +199 -0
  23. plgt-0.1.0b1/plgt/cmd/publish.py +466 -0
  24. plgt-0.1.0b1/plgt/cmd/schema.py +229 -0
  25. plgt-0.1.0b1/plgt/cmd/secrets.py +277 -0
  26. plgt-0.1.0b1/plgt/cmd/ui.py +79 -0
  27. plgt-0.1.0b1/plgt/cmd/validate.py +279 -0
  28. plgt-0.1.0b1/plgt/core/__init__.py +12 -0
  29. plgt-0.1.0b1/plgt/core/_cache.py +58 -0
  30. plgt-0.1.0b1/plgt/core/_config.py +231 -0
  31. plgt-0.1.0b1/plgt/core/crypto.py +204 -0
  32. plgt-0.1.0b1/plgt/core/decorators.py +66 -0
  33. plgt-0.1.0b1/plgt/core/discovery.py +205 -0
  34. plgt-0.1.0b1/plgt/core/exceptions.py +55 -0
  35. plgt-0.1.0b1/plgt/core/logs.py +79 -0
  36. plgt-0.1.0b1/plgt/core/oauth/__init__.py +10 -0
  37. plgt-0.1.0b1/plgt/core/oauth/client.py +323 -0
  38. plgt-0.1.0b1/plgt/core/oauth/errors.py +12 -0
  39. plgt-0.1.0b1/plgt/core/oauth/server.py +107 -0
  40. plgt-0.1.0b1/plgt/core/oauth/utils.py +52 -0
  41. plgt-0.1.0b1/plgt/core/sessions.py +281 -0
  42. plgt-0.1.0b1/plgt/core/settings.py +176 -0
  43. plgt-0.1.0b1/plgt/core/utils.py +20 -0
  44. plgt-0.1.0b1/plgt/editors/__init__.py +8 -0
  45. plgt-0.1.0b1/plgt/editors/vscode/__init__.py +6 -0
  46. plgt-0.1.0b1/plgt/generated/__init__.py +0 -0
  47. plgt-0.1.0b1/plgt/models/__init__.py +0 -0
  48. plgt-0.1.0b1/plgt/models/build_types.py +109 -0
  49. plgt-0.1.0b1/plgt/models/install.py +57 -0
  50. plgt-0.1.0b1/plgt/models/lifecycle_command.py +85 -0
  51. plgt-0.1.0b1/plgt/models/secret.py +26 -0
  52. plgt-0.1.0b1/plgt/services/__init__.py +0 -0
  53. plgt-0.1.0b1/plgt/services/archive_service.py +286 -0
  54. plgt-0.1.0b1/plgt/services/artifact_service.py +274 -0
  55. plgt-0.1.0b1/plgt/services/bindings.py +755 -0
  56. plgt-0.1.0b1/plgt/services/build_progress.py +90 -0
  57. plgt-0.1.0b1/plgt/services/build_service.py +637 -0
  58. plgt-0.1.0b1/plgt/services/command_monitor.py +190 -0
  59. plgt-0.1.0b1/plgt/services/deps_install_service.py +946 -0
  60. plgt-0.1.0b1/plgt/services/deps_lockfile.py +232 -0
  61. plgt-0.1.0b1/plgt/services/diagnostics.py +467 -0
  62. plgt-0.1.0b1/plgt/services/formatter/__init__.py +23 -0
  63. plgt-0.1.0b1/plgt/services/formatter/lexer.py +664 -0
  64. plgt-0.1.0b1/plgt/services/formatter/sparql.py +1464 -0
  65. plgt-0.1.0b1/plgt/services/formatter/turtle.py +672 -0
  66. plgt-0.1.0b1/plgt/services/install_service.py +599 -0
  67. plgt-0.1.0b1/plgt/services/json_dsl_parser.py +475 -0
  68. plgt-0.1.0b1/plgt/services/lsp_server.py +911 -0
  69. plgt-0.1.0b1/plgt/services/rdf_operations.py +203 -0
  70. plgt-0.1.0b1/plgt/services/schema_service.py +254 -0
  71. plgt-0.1.0b1/plgt/services/script_expander.py +335 -0
  72. plgt-0.1.0b1/plgt/services/shapes/__init__.py +0 -0
  73. plgt-0.1.0b1/plgt/services/shapes/quality.ttl +68 -0
  74. plgt-0.1.0b1/plgt/services/template_service.py +28 -0
  75. plgt-0.1.0b1/plgt/services/ui_build_service.py +206 -0
  76. plgt-0.1.0b1/plgt/services/validation_pipeline.py +1610 -0
  77. plgt-0.1.0b1/plgt/services/validation_report.py +112 -0
  78. plgt-0.1.0b1/plgt/templates/CLAUDE.md.j2 +590 -0
  79. plgt-0.1.0b1/plgt/templates/__init__.py +0 -0
  80. plgt-0.1.0b1/plgt/templates/components.ttl.j2 +20 -0
  81. plgt-0.1.0b1/plgt/templates/copilot-instructions.md.j2 +83 -0
  82. plgt-0.1.0b1/plgt/templates/cursorrules.j2 +86 -0
  83. plgt-0.1.0b1/plgt/templates/gitignore.j2 +13 -0
  84. plgt-0.1.0b1/plgt/templates/matrix.ttl.j2 +10 -0
  85. plgt-0.1.0b1/plgt/templates/ontology.ttl.j2 +15 -0
  86. plgt-0.1.0b1/plgt/templates/poliglot.yml.j2 +24 -0
  87. plgt-0.1.0b1/plgt/templates/shapes.ttl.j2 +16 -0
  88. plgt-0.1.0b1/plgt/utils/__init__.py +1 -0
  89. plgt-0.1.0b1/plgt/utils/lifecycle.py +26 -0
  90. plgt-0.1.0b1/plgt/utils/naming.py +47 -0
  91. plgt-0.1.0b1/plgt/utils/retry.py +100 -0
  92. plgt-0.1.0b1/plgt/utils/version_range.py +204 -0
  93. plgt-0.1.0b1/plgt/utils/workspace_mode.py +43 -0
  94. plgt-0.1.0b1/plgt.egg-info/PKG-INFO +99 -0
  95. plgt-0.1.0b1/plgt.egg-info/SOURCES.txt +99 -0
  96. plgt-0.1.0b1/plgt.egg-info/dependency_links.txt +1 -0
  97. plgt-0.1.0b1/plgt.egg-info/entry_points.txt +2 -0
  98. plgt-0.1.0b1/plgt.egg-info/requires.txt +18 -0
  99. plgt-0.1.0b1/plgt.egg-info/top_level.txt +1 -0
  100. plgt-0.1.0b1/pyproject.toml +85 -0
  101. plgt-0.1.0b1/setup.cfg +4 -0
plgt-0.1.0b1/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Poliglot Inc.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
plgt-0.1.0b1/PKG-INFO ADDED
@@ -0,0 +1,99 @@
1
+ Metadata-Version: 2.4
2
+ Name: plgt
3
+ Version: 0.1.0b1
4
+ Summary: Poliglot developer CLI
5
+ Author: Poliglot Inc.
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Documentation, https://poliglot.io/develop/tools/cli
8
+ Project-URL: Homepage, https://poliglot.io
9
+ Project-URL: Repository, https://github.com/poliglot-io/plgt-cli
10
+ Project-URL: Issues, https://github.com/poliglot-io/plgt-cli/issues
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Topic :: Software Development :: Build Tools
16
+ Requires-Python: <3.13,>=3.12
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: appdirs>=1.4.4
20
+ Requires-Dist: click>=8.1.0
21
+ Requires-Dist: jinja2>=3.1.0
22
+ Requires-Dist: oauthlib>=3.2.2
23
+ Requires-Dist: owlrl>=7.1.3
24
+ Requires-Dist: pynacl>=1.5.0
25
+ Requires-Dist: pygls>=2.0.0
26
+ Requires-Dist: pyshacl>=0.30.1
27
+ Requires-Dist: python-dotenv>=1.1.0
28
+ Requires-Dist: pyyaml>=6.0.0
29
+ Requires-Dist: rdflib>=7.1.1
30
+ Requires-Dist: ruamel.yaml>=0.18.0
31
+ Requires-Dist: requests>=2.32.3
32
+ Requires-Dist: semver>=3.0.0
33
+ Requires-Dist: rich>=13.9.4
34
+ Requires-Dist: sseclient-py>=1.8.0
35
+ Requires-Dist: typer>=0.15.1
36
+ Requires-Dist: validators>=0.34.0
37
+ Dynamic: license-file
38
+
39
+ # plgt
40
+
41
+ The authoring CLI for the [Poliglot](https://poliglot.io) platform — a knowledge-graph operating system where domain models are first-class and applications are built by composing data matrices.
42
+
43
+ Use `plgt` to scaffold a workspace, declare matrices (the RDF specifications that describe your domain), install matrix packages from the public registry, validate them locally, and ship them to a Poliglot workspace.
44
+
45
+ Status: **alpha**. The Poliglot platform is in private beta; the CLI surface is stable enough to use day-to-day, but commands may evolve before 1.0.
46
+
47
+ ## Installation
48
+
49
+ ```bash
50
+ pip install plgt
51
+ ```
52
+
53
+ Requires Python 3.12.x. [`uv`](https://docs.astral.sh/uv/) is the recommended install path:
54
+
55
+ ```bash
56
+ uv tool install plgt
57
+ ```
58
+
59
+ ## Usage
60
+
61
+ ```bash
62
+ plgt --help
63
+
64
+ plgt version # Show version
65
+ plgt init # Initialize a new workspace
66
+ plgt auth login # Authenticate via OAuth
67
+ plgt configure # Configure workspace settings
68
+ plgt lifecycle # Manage matrix lifecycle
69
+ plgt extension # Manage extensions
70
+ plgt secrets # Manage secrets
71
+ plgt ui # UI tooling (delegates to poliglot-ui)
72
+ ```
73
+
74
+ ## Development
75
+
76
+ Requires [uv](https://docs.astral.sh/uv/) and Python 3.12.
77
+
78
+ ```bash
79
+ uv sync # install deps
80
+ uv run pytest # tests (unit + integration; integration needs a live platform)
81
+ uv run pytest --ignore=test/integration # unit only
82
+ uv run ruff check # lint
83
+ uv run ruff format # format
84
+ ```
85
+
86
+ ## Documentation
87
+
88
+ - CLI reference: <https://poliglot.io/docs/cli>
89
+ - Full docs: <https://poliglot.io/docs>
90
+
91
+ ## Contributing
92
+
93
+ See [CONTRIBUTING.md](CONTRIBUTING.md). All contributors must sign the [Poliglot Contributor License Agreement](https://poliglot.io/cla) before their first PR is merged.
94
+
95
+ Bugs and feature requests go through GitHub Issues; security issues use [private security advisories](https://github.com/poliglot-io/plgt-cli/security/advisories/new) — see [SECURITY.md](SECURITY.md).
96
+
97
+ ## License
98
+
99
+ [Apache License 2.0](LICENSE) · © Poliglot Inc.
plgt-0.1.0b1/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # plgt
2
+
3
+ The authoring CLI for the [Poliglot](https://poliglot.io) platform — a knowledge-graph operating system where domain models are first-class and applications are built by composing data matrices.
4
+
5
+ Use `plgt` to scaffold a workspace, declare matrices (the RDF specifications that describe your domain), install matrix packages from the public registry, validate them locally, and ship them to a Poliglot workspace.
6
+
7
+ Status: **alpha**. The Poliglot platform is in private beta; the CLI surface is stable enough to use day-to-day, but commands may evolve before 1.0.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ pip install plgt
13
+ ```
14
+
15
+ Requires Python 3.12.x. [`uv`](https://docs.astral.sh/uv/) is the recommended install path:
16
+
17
+ ```bash
18
+ uv tool install plgt
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```bash
24
+ plgt --help
25
+
26
+ plgt version # Show version
27
+ plgt init # Initialize a new workspace
28
+ plgt auth login # Authenticate via OAuth
29
+ plgt configure # Configure workspace settings
30
+ plgt lifecycle # Manage matrix lifecycle
31
+ plgt extension # Manage extensions
32
+ plgt secrets # Manage secrets
33
+ plgt ui # UI tooling (delegates to poliglot-ui)
34
+ ```
35
+
36
+ ## Development
37
+
38
+ Requires [uv](https://docs.astral.sh/uv/) and Python 3.12.
39
+
40
+ ```bash
41
+ uv sync # install deps
42
+ uv run pytest # tests (unit + integration; integration needs a live platform)
43
+ uv run pytest --ignore=test/integration # unit only
44
+ uv run ruff check # lint
45
+ uv run ruff format # format
46
+ ```
47
+
48
+ ## Documentation
49
+
50
+ - CLI reference: <https://poliglot.io/docs/cli>
51
+ - Full docs: <https://poliglot.io/docs>
52
+
53
+ ## Contributing
54
+
55
+ See [CONTRIBUTING.md](CONTRIBUTING.md). All contributors must sign the [Poliglot Contributor License Agreement](https://poliglot.io/cla) before their first PR is merged.
56
+
57
+ Bugs and feature requests go through GitHub Issues; security issues use [private security advisories](https://github.com/poliglot-io/plgt-cli/security/advisories/new) — see [SECURITY.md](SECURITY.md).
58
+
59
+ ## License
60
+
61
+ [Apache License 2.0](LICENSE) · © Poliglot Inc.
File without changes
@@ -0,0 +1,145 @@
1
+ import logging
2
+ import sys
3
+ from importlib.metadata import PackageNotFoundError
4
+ from importlib.metadata import version as _pkg_version
5
+
6
+ import typer
7
+ from rich.logging import RichHandler
8
+
9
+ from plgt.cmd.auth import app as auth_app
10
+ from plgt.cmd.configure import app as config_app
11
+ from plgt.cmd.extensions import app as extensions_app
12
+ from plgt.cmd.format import app as format_app
13
+ from plgt.cmd.init import init_command
14
+ from plgt.cmd.lifecycle import app
15
+ from plgt.cmd.lsp import lsp_command
16
+ from plgt.cmd.migration import app as migration_app
17
+ from plgt.cmd.publish import app as publish_app
18
+ from plgt.cmd.schema import app as schema_app
19
+ from plgt.cmd.secrets import app as secrets_app
20
+ from plgt.cmd.ui import app as ui_app
21
+ from plgt.cmd.validate import app as validate_app
22
+ from plgt.core import settings
23
+ from plgt.core.exceptions import CLIError
24
+ from plgt.core.logs import console, setup_file_logging
25
+
26
+ logger = logging.getLogger(settings.APP_AUTHOR)
27
+
28
+
29
+ @app.command()
30
+ def version():
31
+ """Returns the currently installed version."""
32
+
33
+ try:
34
+ v = _pkg_version("plgt")
35
+ except PackageNotFoundError:
36
+ v = "dev"
37
+ logger.info(f"plgt/{v}")
38
+
39
+
40
+ @app.callback()
41
+ def configure_logging(
42
+ debug: bool = typer.Option(False, "--debug", help="Enable debug logging."),
43
+ trace: bool = typer.Option(
44
+ False,
45
+ "--trace",
46
+ help="Enable tracebacks in error messages.",
47
+ ),
48
+ ):
49
+ # Set log level: DEBUG shows all logs, INFO for normal operation
50
+ log_level = logging.DEBUG if debug else logging.INFO
51
+
52
+ if debug:
53
+ # Use plain StreamHandler for debug mode - Rich doesn't work well from threads
54
+ handler = logging.StreamHandler(sys.stdout)
55
+ handler.setFormatter(logging.Formatter("%(message)s"))
56
+ handlers = [handler]
57
+ else:
58
+ rich_handler = RichHandler(
59
+ markup=True,
60
+ rich_tracebacks=trace,
61
+ show_level=False,
62
+ show_path=False,
63
+ show_time=False,
64
+ console=console,
65
+ )
66
+ # Console only shows INFO+ in non-debug mode (file handler gets DEBUG)
67
+ rich_handler.setLevel(logging.INFO)
68
+ handlers = [rich_handler]
69
+
70
+ logging.basicConfig(
71
+ format="%(message)s",
72
+ level=log_level,
73
+ handlers=handlers,
74
+ )
75
+
76
+ logging.getLogger().handlers = handlers
77
+
78
+ # Always set up file logging AFTER handlers are configured
79
+ # This adds the file handler to root logger
80
+ setup_file_logging(debug=debug)
81
+
82
+ # Silence noisy third-party libraries regardless of debug mode
83
+ noisy_loggers = [
84
+ "markdown_it",
85
+ "urllib3",
86
+ "asyncio",
87
+ "httpx",
88
+ "httpcore",
89
+ ]
90
+ for name in noisy_loggers:
91
+ logging.getLogger(name).setLevel(logging.WARNING)
92
+
93
+ if not debug:
94
+ # In non-debug mode, set root to WARNING but keep file logging at DEBUG
95
+ # Console handlers only show WARNING+, file gets everything
96
+ logging.getLogger().setLevel(logging.DEBUG) # Allow DEBUG to file
97
+
98
+ # Enable plgt app loggers at INFO level for console
99
+ for prefix in ["plgt", settings.APP_AUTHOR]:
100
+ logging.getLogger(prefix).setLevel(logging.DEBUG)
101
+
102
+
103
+ # CLI configuration
104
+ app.add_typer(config_app, name="configure")
105
+ app.add_typer(auth_app, name="auth")
106
+ app.add_typer(extensions_app, name="extension")
107
+ app.command(name="lsp")(lsp_command)
108
+ app.add_typer(migration_app, name="migration")
109
+ app.add_typer(schema_app, name="schema")
110
+ app.add_typer(secrets_app, name="secrets")
111
+ app.add_typer(ui_app, name="ui")
112
+ app.add_typer(validate_app, name="validate")
113
+ app.add_typer(format_app, name="format")
114
+ # Registry mutations live at the top level for ergonomics: `plgt publish`,
115
+ # `plgt yank`, `plgt unyank`. No publish-namespace prefix because these are
116
+ # user-facing verbs, not noun-grouped commands.
117
+ for command in publish_app.registered_commands:
118
+ app.registered_commands.append(command)
119
+ app.command(name="init")(init_command)
120
+
121
+
122
+ def main():
123
+ """Main entry point for the CLI.
124
+
125
+ CLIError subclasses (auth, validation, service, resource-not-found, …)
126
+ are user-facing and print a friendly single-line message — never a
127
+ stack trace — and exit with the error's declared exit_code. Pass
128
+ ``--trace`` to surface the underlying traceback when debugging.
129
+ Anything else is genuinely unexpected; we let typer's default
130
+ handler print it.
131
+ """
132
+ trace_enabled = "--trace" in sys.argv
133
+ try:
134
+ app()
135
+ except CLIError as e:
136
+ if trace_enabled:
137
+ raise
138
+ from plgt.core.logs import console as _console
139
+
140
+ _console.print(f"[red]error:[/red] {e}")
141
+ sys.exit(e.exit_code)
142
+
143
+
144
+ if __name__ == "__main__":
145
+ main()
@@ -0,0 +1,11 @@
1
+ # Internal CLI configuration template
2
+ # This file is processed at build time with environment-specific values
3
+
4
+ platform:
5
+ base_url: "https://matrix.poliglot.io"
6
+
7
+ oauth:
8
+ client_id: ""
9
+
10
+ uikit:
11
+ command: ["npx", "-p", "@poliglot-io/uikit", "poliglot-ui"]
File without changes