pragmatiks-cli 0.9.3__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.
@@ -0,0 +1,201 @@
1
+ Metadata-Version: 2.3
2
+ Name: pragmatiks-cli
3
+ Version: 0.9.3
4
+ Summary: Command-line interface for Pragmatiks
5
+ Requires-Dist: typer>=0.15.3
6
+ Requires-Dist: pragmatiks-sdk>=0.6.0
7
+ Requires-Dist: pyyaml>=6.0.3
8
+ Requires-Dist: copier>=9.0.0
9
+ Requires-Dist: rich>=13.9.0
10
+ Requires-Python: >=3.13
11
+ Description-Content-Type: text/markdown
12
+
13
+ <p align="center">
14
+ <img src="assets/wordmark.png" alt="Pragma-OS" width="800">
15
+ </p>
16
+
17
+ # Pragma CLI
18
+
19
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/pragmatiks/pragma-cli)
20
+ [![PyPI version](https://img.shields.io/pypi/v/pragmatiks-cli.svg)](https://pypi.org/project/pragmatiks-cli/)
21
+ [![Python 3.13+](https://img.shields.io/badge/python-3.13+-blue.svg)](https://www.python.org/downloads/)
22
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
23
+ [![Code style: ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
24
+
25
+ **[Documentation](https://docs.pragmatiks.io/cli/overview)** | **[SDK](https://github.com/pragmatiks/pragma-sdk)** | **[Providers](https://github.com/pragmatiks/pragma-providers)**
26
+
27
+ Command-line interface for managing pragma-os resources.
28
+
29
+ ## Quick Start
30
+
31
+ ```bash
32
+ # Authenticate
33
+ pragma auth login
34
+
35
+ # Apply a resource
36
+ pragma resources apply bucket.yaml
37
+
38
+ # Check status
39
+ pragma resources get gcp/storage my-bucket
40
+ ```
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ pip install pragmatiks-cli
46
+ ```
47
+
48
+ Or with uv:
49
+
50
+ ```bash
51
+ uv add pragmatiks-cli
52
+ ```
53
+
54
+ Enable shell completion for intelligent command-line assistance:
55
+
56
+ ```bash
57
+ pragma --install-completion
58
+ ```
59
+
60
+ ## Features
61
+
62
+ - **Declarative Resources** - Apply, get, and delete resources with YAML manifests
63
+ - **Smart Completion** - Tab completion for providers, resources, and names
64
+ - **Provider Development** - Initialize, sync, and deploy custom providers
65
+ - **Multi-document Support** - Apply multiple resources from a single YAML file
66
+
67
+ ## Resource Management
68
+
69
+ ### Apply Resources
70
+
71
+ ```yaml
72
+ # bucket.yaml
73
+ provider: gcp
74
+ resource: storage
75
+ name: my-bucket
76
+ config:
77
+ location: US
78
+ storage_class: STANDARD
79
+ ```
80
+
81
+ ```bash
82
+ # Apply from file
83
+ pragma resources apply bucket.yaml
84
+
85
+ # Apply multiple files
86
+ pragma resources apply *.yaml
87
+
88
+ # Apply with pending flag to execute immediately
89
+ pragma resources apply --pending bucket.yaml
90
+ ```
91
+
92
+ ### List and Get Resources
93
+
94
+ ```bash
95
+ # List all resources
96
+ pragma resources list
97
+
98
+ # Filter by provider
99
+ pragma resources list --provider gcp
100
+
101
+ # Filter by resource type
102
+ pragma resources list --resource storage
103
+
104
+ # Get specific resource
105
+ pragma resources get gcp/storage my-bucket
106
+ ```
107
+
108
+ ### Delete Resources
109
+
110
+ ```bash
111
+ pragma resources delete gcp/storage my-bucket
112
+ ```
113
+
114
+ ## Provider Development
115
+
116
+ Build and deploy custom providers:
117
+
118
+ ```bash
119
+ # Initialize a new provider project
120
+ pragma provider init mycompany
121
+
122
+ # Sync resource schemas with the platform
123
+ pragma provider sync
124
+
125
+ # Build and deploy
126
+ pragma provider push --deploy
127
+ ```
128
+
129
+ ## Authentication
130
+
131
+ ```bash
132
+ # Login (opens browser)
133
+ pragma auth login
134
+
135
+ # Check current user
136
+ pragma auth whoami
137
+
138
+ # Logout
139
+ pragma auth logout
140
+ ```
141
+
142
+ ## Configuration
143
+
144
+ Set environment variables to configure the CLI:
145
+
146
+ ```bash
147
+ export PRAGMA_API_URL=https://api.pragmatiks.io
148
+ export PRAGMA_AUTH_TOKEN=sk_...
149
+ ```
150
+
151
+ ## Command Reference
152
+
153
+ ### Resources
154
+
155
+ | Command | Description |
156
+ |---------|-------------|
157
+ | `pragma resources list` | List resources with optional filters |
158
+ | `pragma resources get <provider/resource> <name>` | Get a specific resource |
159
+ | `pragma resources apply <file>` | Apply resources from YAML |
160
+ | `pragma resources delete <provider/resource> <name>` | Delete a resource |
161
+
162
+ ### Providers
163
+
164
+ | Command | Description |
165
+ |---------|-------------|
166
+ | `pragma provider init <name>` | Initialize a new provider project |
167
+ | `pragma provider sync` | Sync resource schemas with platform |
168
+ | `pragma provider push` | Build and push provider image |
169
+ | `pragma provider push --deploy` | Build, push, and deploy |
170
+
171
+ ### Authentication
172
+
173
+ | Command | Description |
174
+ |---------|-------------|
175
+ | `pragma auth login` | Authenticate with the platform |
176
+ | `pragma auth whoami` | Show current user |
177
+ | `pragma auth logout` | Clear credentials |
178
+
179
+ ### Operations
180
+
181
+ | Command | Description |
182
+ |---------|-------------|
183
+ | `pragma ops dead-letter list` | List failed events |
184
+ | `pragma ops dead-letter retry <id>` | Retry a failed event |
185
+
186
+ ## Development
187
+
188
+ ```bash
189
+ # Run tests
190
+ task cli:test
191
+
192
+ # Format code
193
+ task cli:format
194
+
195
+ # Type check and lint
196
+ task cli:check
197
+ ```
198
+
199
+ ## License
200
+
201
+ MIT
@@ -0,0 +1,189 @@
1
+ <p align="center">
2
+ <img src="assets/wordmark.png" alt="Pragma-OS" width="800">
3
+ </p>
4
+
5
+ # Pragma CLI
6
+
7
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/pragmatiks/pragma-cli)
8
+ [![PyPI version](https://img.shields.io/pypi/v/pragmatiks-cli.svg)](https://pypi.org/project/pragmatiks-cli/)
9
+ [![Python 3.13+](https://img.shields.io/badge/python-3.13+-blue.svg)](https://www.python.org/downloads/)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
11
+ [![Code style: ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
12
+
13
+ **[Documentation](https://docs.pragmatiks.io/cli/overview)** | **[SDK](https://github.com/pragmatiks/pragma-sdk)** | **[Providers](https://github.com/pragmatiks/pragma-providers)**
14
+
15
+ Command-line interface for managing pragma-os resources.
16
+
17
+ ## Quick Start
18
+
19
+ ```bash
20
+ # Authenticate
21
+ pragma auth login
22
+
23
+ # Apply a resource
24
+ pragma resources apply bucket.yaml
25
+
26
+ # Check status
27
+ pragma resources get gcp/storage my-bucket
28
+ ```
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ pip install pragmatiks-cli
34
+ ```
35
+
36
+ Or with uv:
37
+
38
+ ```bash
39
+ uv add pragmatiks-cli
40
+ ```
41
+
42
+ Enable shell completion for intelligent command-line assistance:
43
+
44
+ ```bash
45
+ pragma --install-completion
46
+ ```
47
+
48
+ ## Features
49
+
50
+ - **Declarative Resources** - Apply, get, and delete resources with YAML manifests
51
+ - **Smart Completion** - Tab completion for providers, resources, and names
52
+ - **Provider Development** - Initialize, sync, and deploy custom providers
53
+ - **Multi-document Support** - Apply multiple resources from a single YAML file
54
+
55
+ ## Resource Management
56
+
57
+ ### Apply Resources
58
+
59
+ ```yaml
60
+ # bucket.yaml
61
+ provider: gcp
62
+ resource: storage
63
+ name: my-bucket
64
+ config:
65
+ location: US
66
+ storage_class: STANDARD
67
+ ```
68
+
69
+ ```bash
70
+ # Apply from file
71
+ pragma resources apply bucket.yaml
72
+
73
+ # Apply multiple files
74
+ pragma resources apply *.yaml
75
+
76
+ # Apply with pending flag to execute immediately
77
+ pragma resources apply --pending bucket.yaml
78
+ ```
79
+
80
+ ### List and Get Resources
81
+
82
+ ```bash
83
+ # List all resources
84
+ pragma resources list
85
+
86
+ # Filter by provider
87
+ pragma resources list --provider gcp
88
+
89
+ # Filter by resource type
90
+ pragma resources list --resource storage
91
+
92
+ # Get specific resource
93
+ pragma resources get gcp/storage my-bucket
94
+ ```
95
+
96
+ ### Delete Resources
97
+
98
+ ```bash
99
+ pragma resources delete gcp/storage my-bucket
100
+ ```
101
+
102
+ ## Provider Development
103
+
104
+ Build and deploy custom providers:
105
+
106
+ ```bash
107
+ # Initialize a new provider project
108
+ pragma provider init mycompany
109
+
110
+ # Sync resource schemas with the platform
111
+ pragma provider sync
112
+
113
+ # Build and deploy
114
+ pragma provider push --deploy
115
+ ```
116
+
117
+ ## Authentication
118
+
119
+ ```bash
120
+ # Login (opens browser)
121
+ pragma auth login
122
+
123
+ # Check current user
124
+ pragma auth whoami
125
+
126
+ # Logout
127
+ pragma auth logout
128
+ ```
129
+
130
+ ## Configuration
131
+
132
+ Set environment variables to configure the CLI:
133
+
134
+ ```bash
135
+ export PRAGMA_API_URL=https://api.pragmatiks.io
136
+ export PRAGMA_AUTH_TOKEN=sk_...
137
+ ```
138
+
139
+ ## Command Reference
140
+
141
+ ### Resources
142
+
143
+ | Command | Description |
144
+ |---------|-------------|
145
+ | `pragma resources list` | List resources with optional filters |
146
+ | `pragma resources get <provider/resource> <name>` | Get a specific resource |
147
+ | `pragma resources apply <file>` | Apply resources from YAML |
148
+ | `pragma resources delete <provider/resource> <name>` | Delete a resource |
149
+
150
+ ### Providers
151
+
152
+ | Command | Description |
153
+ |---------|-------------|
154
+ | `pragma provider init <name>` | Initialize a new provider project |
155
+ | `pragma provider sync` | Sync resource schemas with platform |
156
+ | `pragma provider push` | Build and push provider image |
157
+ | `pragma provider push --deploy` | Build, push, and deploy |
158
+
159
+ ### Authentication
160
+
161
+ | Command | Description |
162
+ |---------|-------------|
163
+ | `pragma auth login` | Authenticate with the platform |
164
+ | `pragma auth whoami` | Show current user |
165
+ | `pragma auth logout` | Clear credentials |
166
+
167
+ ### Operations
168
+
169
+ | Command | Description |
170
+ |---------|-------------|
171
+ | `pragma ops dead-letter list` | List failed events |
172
+ | `pragma ops dead-letter retry <id>` | Retry a failed event |
173
+
174
+ ## Development
175
+
176
+ ```bash
177
+ # Run tests
178
+ task cli:test
179
+
180
+ # Format code
181
+ task cli:format
182
+
183
+ # Type check and lint
184
+ task cli:check
185
+ ```
186
+
187
+ ## License
188
+
189
+ MIT
@@ -0,0 +1,64 @@
1
+ [project]
2
+ name = "pragmatiks-cli"
3
+ version = "0.9.3"
4
+ description = "Command-line interface for Pragmatiks"
5
+ readme = "README.md"
6
+ requires-python = ">=3.13"
7
+ dependencies = [
8
+ "typer>=0.15.3",
9
+ "pragmatiks-sdk>=0.6.0",
10
+ "pyyaml>=6.0.3",
11
+ "copier>=9.0.0",
12
+ "rich>=13.9.0",
13
+ ]
14
+
15
+ [project.scripts]
16
+ pragma = "pragma_cli.main:app"
17
+
18
+ [tool.uv.sources]
19
+ # In workspace: resolved from local packages/sdk
20
+ # Standalone: falls back to PyPI (pragmatiks-sdk)
21
+ pragmatiks-sdk = { workspace = true }
22
+
23
+ [tool.ruff]
24
+ target-version = "py313"
25
+ line-length = 120
26
+
27
+ [tool.ruff.lint]
28
+ preview = true
29
+ select = ["E", "W", "F", "I", "UP", "D", "DOC", "PT"]
30
+
31
+ [tool.ruff.lint.pydocstyle]
32
+ convention = "google"
33
+
34
+ [tool.ruff.lint.isort]
35
+ lines-after-imports = 2
36
+ known-first-party = ["pragma_cli"]
37
+
38
+ [tool.ruff.lint.per-file-ignores]
39
+ "**/tests/**/*.py" = ["D100", "D101", "D102", "D103", "D104", "D107", "DOC"]
40
+
41
+ [tool.ruff.format]
42
+ preview = true
43
+
44
+ [tool.pytest.ini_options]
45
+ addopts = ["-v"]
46
+
47
+ [tool.commitizen]
48
+ name = "cz_conventional_commits"
49
+ version = "0.9.3"
50
+ version_files = ["pyproject.toml:^version"]
51
+ tag_format = "v$version"
52
+ update_changelog_on_bump = true
53
+ changelog_file = "CHANGELOG.md"
54
+
55
+ [dependency-groups]
56
+ test = ["pytest>=8.4.1", "pytest-cov>=7.0.0", "pytest-mock>=3.14.0"]
57
+ dev = ["commitizen>=4.11.0", "pre-commit>=4.0.0", "ruff>=0.11.0"]
58
+
59
+ [tool.uv.build-backend]
60
+ module-name = "pragma_cli"
61
+
62
+ [build-system]
63
+ requires = ["uv_build>=0.9.8"]
64
+ build-backend = "uv_build"
@@ -0,0 +1,32 @@
1
+ """CLI global client management."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pragma_sdk import PragmaClient
6
+
7
+
8
+ _client: PragmaClient | None = None
9
+
10
+
11
+ def get_client() -> PragmaClient:
12
+ """Get the initialized client.
13
+
14
+ Returns:
15
+ Initialized PragmaClient instance.
16
+
17
+ Raises:
18
+ RuntimeError: If client has not been initialized via main().
19
+ """
20
+ if _client is None:
21
+ raise RuntimeError("Client not initialized. This should not happen.")
22
+ return _client
23
+
24
+
25
+ def set_client(client: PragmaClient):
26
+ """Set the global client instance.
27
+
28
+ Args:
29
+ client: The PragmaClient instance to use globally
30
+ """
31
+ global _client
32
+ _client = client
@@ -0,0 +1 @@
1
+ """Commands package."""