python-jcli 0.1.0__tar.gz → 1.0.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 (67) hide show
  1. {python_jcli-0.1.0 → python_jcli-1.0.0}/PKG-INFO +56 -12
  2. {python_jcli-0.1.0 → python_jcli-1.0.0}/README.md +54 -11
  3. python_jcli-1.0.0/jcli/__init__.py +1 -0
  4. python_jcli-1.0.0/jcli/cli.py +573 -0
  5. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/plugins/skills.py +60 -17
  6. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/skills/jcli/SKILL.md +15 -2
  7. python_jcli-1.0.0/jcli/skills/jcli/auth/SKILL.md +86 -0
  8. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/skills/jcli/credential/SKILL.md +14 -5
  9. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/skills/jcli/job/SKILL.md +20 -4
  10. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/skills/jcli/node/SKILL.md +4 -2
  11. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/skills/jcli/pipeline/SKILL.md +3 -3
  12. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/skills/jcli/plugin/SKILL.md +3 -0
  13. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/skills/jcli/system/SKILL.md +15 -2
  14. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/skills/jcli/view/SKILL.md +4 -3
  15. {python_jcli-0.1.0 → python_jcli-1.0.0}/pyproject.toml +3 -2
  16. {python_jcli-0.1.0 → python_jcli-1.0.0}/python_jcli.egg-info/PKG-INFO +56 -12
  17. {python_jcli-0.1.0 → python_jcli-1.0.0}/python_jcli.egg-info/SOURCES.txt +3 -1
  18. {python_jcli-0.1.0 → python_jcli-1.0.0}/python_jcli.egg-info/requires.txt +1 -0
  19. {python_jcli-0.1.0 → python_jcli-1.0.0}/tests/test_cli.py +39 -11
  20. {python_jcli-0.1.0 → python_jcli-1.0.0}/tests/test_client.py +11 -1
  21. python_jcli-1.0.0/tests/test_cliyard_spike.py +71 -0
  22. {python_jcli-0.1.0 → python_jcli-1.0.0}/tests/test_config.py +9 -1
  23. {python_jcli-0.1.0 → python_jcli-1.0.0}/tests/test_exceptions.py +7 -1
  24. {python_jcli-0.1.0 → python_jcli-1.0.0}/tests/test_plugin.py +3 -1
  25. python_jcli-1.0.0/tests/test_replay.py +250 -0
  26. {python_jcli-0.1.0 → python_jcli-1.0.0}/tests/test_skills.py +73 -22
  27. python_jcli-0.1.0/jcli/__init__.py +0 -1
  28. python_jcli-0.1.0/jcli/cli.py +0 -79
  29. python_jcli-0.1.0/jcli/skills/jcli/config/SKILL.md +0 -81
  30. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/__main__.py +0 -0
  31. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/cli_helpers.py +0 -0
  32. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/plugins/__init__.py +0 -0
  33. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/plugins/build.py +0 -0
  34. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/plugins/config.py +0 -0
  35. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/plugins/credential.py +0 -0
  36. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/plugins/job.py +0 -0
  37. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/plugins/node.py +0 -0
  38. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/plugins/pipeline.py +0 -0
  39. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/plugins/plugin.py +0 -0
  40. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/plugins/system.py +0 -0
  41. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/plugins/view.py +0 -0
  42. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/sdk/__init__.py +0 -0
  43. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/sdk/build.py +0 -0
  44. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/sdk/client.py +0 -0
  45. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/sdk/config.py +0 -0
  46. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/sdk/credential.py +0 -0
  47. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/sdk/exceptions.py +0 -0
  48. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/sdk/job.py +0 -0
  49. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/sdk/job_templates.py +0 -0
  50. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/sdk/node.py +0 -0
  51. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/sdk/output/__init__.py +0 -0
  52. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/sdk/output/formatter.py +0 -0
  53. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/sdk/pipeline.py +0 -0
  54. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/sdk/plugin.py +0 -0
  55. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/sdk/system.py +0 -0
  56. {python_jcli-0.1.0 → python_jcli-1.0.0}/jcli/sdk/view.py +0 -0
  57. {python_jcli-0.1.0 → python_jcli-1.0.0}/python_jcli.egg-info/dependency_links.txt +0 -0
  58. {python_jcli-0.1.0 → python_jcli-1.0.0}/python_jcli.egg-info/entry_points.txt +0 -0
  59. {python_jcli-0.1.0 → python_jcli-1.0.0}/python_jcli.egg-info/top_level.txt +0 -0
  60. {python_jcli-0.1.0 → python_jcli-1.0.0}/setup.cfg +0 -0
  61. {python_jcli-0.1.0 → python_jcli-1.0.0}/tests/test_build.py +0 -0
  62. {python_jcli-0.1.0 → python_jcli-1.0.0}/tests/test_credential.py +0 -0
  63. {python_jcli-0.1.0 → python_jcli-1.0.0}/tests/test_job.py +0 -0
  64. {python_jcli-0.1.0 → python_jcli-1.0.0}/tests/test_node.py +0 -0
  65. {python_jcli-0.1.0 → python_jcli-1.0.0}/tests/test_pipeline.py +0 -0
  66. {python_jcli-0.1.0 → python_jcli-1.0.0}/tests/test_system.py +0 -0
  67. {python_jcli-0.1.0 → python_jcli-1.0.0}/tests/test_view.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-jcli
3
- Version: 0.1.0
3
+ Version: 1.0.0
4
4
  Summary: Python Jenkins CLI tool
5
5
  License: MIT
6
6
  Requires-Python: >=3.10
@@ -9,6 +9,7 @@ Requires-Dist: click>=8.1.0
9
9
  Requires-Dist: requests~=2.31.0
10
10
  Requires-Dist: pyyaml~=6.0.1
11
11
  Requires-Dist: rich>=13.7.1
12
+ Requires-Dist: cliyard>=0.6.0
12
13
  Provides-Extra: dev
13
14
  Requires-Dist: pytest>=7.0; extra == "dev"
14
15
  Requires-Dist: pytest-cov>=4.0; extra == "dev"
@@ -23,10 +24,37 @@ A command-line tool for managing Jenkins servers. jcli wraps the Jenkins REST AP
23
24
  ## Features
24
25
 
25
26
  - **8 command modules** covering jobs, builds, nodes, plugins, credentials, pipelines, views, and system management
27
+ - **Spec-driven CLI**: commands are declared as cliyard YAML specs in `specs/` and generated at runtime, no hand-written Click groups
26
28
  - **Multiple output formats**: human-readable tables (default, via Rich), JSON, and YAML
27
29
  - **Multi-profile support** via `~/.jcli/config.yaml` with environment variable overrides
28
30
  - **Automatic CSRF (Crumb) handling** for Jenkins servers with CSRF protection enabled
29
- - **Built with Click and Rich** for a polished terminal experience
31
+ - **Built on cliyard and Rich** for a polished, maintainable terminal experience
32
+
33
+ ## Architecture
34
+
35
+ jcli 2.0 is driven by [cliyard](https://pypi.org/project/cliyard/) YAML specs instead of hand-written Click command groups. At startup, `jcli/cli.py` locates the spec directory (`JCLI_SPEC_DIR` env var > package-local `specs/` > repo-root `specs/`) and calls `cliyard.runtime.create_cli()` to build the whole command tree. Commands stay declarative: adding or changing a command is an edit to a YAML file, not Python plumbing.
36
+
37
+ ```
38
+ specs/
39
+ _auth.yaml Server auth chain (basic auth + crumb, as cliyard plugins)
40
+ resources/ One YAML spec per Jenkins domain
41
+ job.yaml job list/get/create/config/copy/enable/disable/delete
42
+ build.yaml build list/get/trigger/replay/log/stop/queue
43
+ node.yaml node list/get/delete/toggle
44
+ plugin.yaml plugin list/get/install/uninstall
45
+ credential.yaml credential list/get/create/delete
46
+ pipeline.yaml pipeline stages/log/pending/validate
47
+ view.yaml view list/get/create/delete
48
+ system.yaml system info/load/quiet-down/restart/script
49
+ plugins/ Python method plugins for non-trivial logic
50
+ jenkins_auth.py Basic + crumb authentication
51
+ jenkins_methods.py Build trigger/replay, node create
52
+ jenkins_pipeline_validate.py Jenkinsfile validation
53
+ jenkins_plugin.py Plugin install/uninstall/update-center
54
+ jenkins_system.py Groovy script, quiet-down, restart
55
+ ```
56
+
57
+ A resource spec maps a command name to either a plain HTTP call (method, path, params, output mapping) or a `plugin:` reference. The auth chain in `_auth.yaml` injects `Authorization` and crumb headers into every request.
30
58
 
31
59
  ## Requirements
32
60
 
@@ -147,6 +175,21 @@ Every command accepts these global flags before the subcommand:
147
175
  -s, --server TEXT Jenkins server URL
148
176
  ```
149
177
 
178
+ ### auth — Manage authentication profiles
179
+
180
+ Profiles are stored in `~/.jcli/config.yaml` (token shown masked).
181
+
182
+ ```
183
+ jcli auth add -n NAME -u USER -p TOKEN -e URL Add (or update) a profile
184
+ jcli auth add -n NAME ... --default ... and make it active
185
+ jcli auth status List profiles (tokens masked)
186
+ jcli auth use NAME Switch the active profile
187
+ jcli auth rm NAME Remove a profile
188
+ jcli auth rm --all Remove all profiles (reset template)
189
+ jcli auth set NAME FIELD VALUE Set url/username/api_token/description
190
+ jcli auth show [NAME] Show a profile's details (default: active)
191
+ ```
192
+
150
193
  ### job — Manage Jenkins jobs
151
194
 
152
195
  ```
@@ -166,6 +209,9 @@ jcli job delete JOB_NAME Delete a job
166
209
  jcli build list JOB_NAME List recent builds for a job
167
210
  jcli build get JOB_NAME BUILD_NUMBER Show details for a specific build
168
211
  jcli build trigger JOB_NAME Trigger a new build
212
+ jcli build rebuild JOB_NAME BUILD_NUMBER Rebuild reusing previous parameters
213
+ jcli build rebuild JOB_NAME BUILD_NUMBER --set KEY=VAL ... and override values (repeatable)
214
+ jcli build replay JOB_NAME BUILD_NUMBER JENKINSFILE Replay a build with a custom Jenkinsfile
169
215
  jcli build log JOB_NAME BUILD_NUMBER Show console log for a build
170
216
  jcli build stop JOB_NAME BUILD_NUMBER Stop a running build
171
217
  jcli build queue Show the current build queue
@@ -268,23 +314,20 @@ pytest --cov=jcli --cov-report=term-missing
268
314
 
269
315
  ```
270
316
  jcli/
271
- cli.py Main CLI entry point (Click group)
317
+ cli.py Entry point: builds the Click CLI from cliyard YAML specs
318
+ cli_helpers.py Global option injection and profile/format plumbing
272
319
  __init__.py Version
273
- plugins/ Command modules (one per Jenkins domain)
274
- job.py
275
- build.py
276
- node.py
277
- plugin.py
278
- credential.py
279
- pipeline.py
280
- view.py
281
- system.py
320
+ plugins/ Legacy hand-written command modules (kept for SDK compatibility)
282
321
  sdk/ Shared libraries
283
322
  client.py Jenkins REST API client (HTTP, auth, crumb)
284
323
  config.py Configuration management (YAML, env vars)
285
324
  output/
286
325
  formatter.py Table/JSON/YAML output formatting
287
326
  exceptions.py Typed exceptions
327
+ specs/ cliyard YAML specs (command definitions)
328
+ _auth.yaml Auth chain: basic + crumb plugins
329
+ resources/ One YAML per Jenkins domain (job, build, node, ...)
330
+ plugins/ Python method plugins for non-trivial logic
288
331
  tests/ pytest test suite
289
332
  ```
290
333
 
@@ -293,6 +336,7 @@ tests/ pytest test suite
293
336
  | Package | Purpose |
294
337
  |-----------------|-----------------------------|
295
338
  | click >= 8.1.0 | CLI framework |
339
+ | cliyard >= 0.6.0 | Spec-driven CLI engine (YAML command generation) |
296
340
  | requests ~= 2.31 | HTTP client |
297
341
  | pyyaml ~= 6.0.1 | YAML config parsing |
298
342
  | rich >= 13.7.1 | Terminal formatting (tables) |
@@ -7,10 +7,37 @@ A command-line tool for managing Jenkins servers. jcli wraps the Jenkins REST AP
7
7
  ## Features
8
8
 
9
9
  - **8 command modules** covering jobs, builds, nodes, plugins, credentials, pipelines, views, and system management
10
+ - **Spec-driven CLI**: commands are declared as cliyard YAML specs in `specs/` and generated at runtime, no hand-written Click groups
10
11
  - **Multiple output formats**: human-readable tables (default, via Rich), JSON, and YAML
11
12
  - **Multi-profile support** via `~/.jcli/config.yaml` with environment variable overrides
12
13
  - **Automatic CSRF (Crumb) handling** for Jenkins servers with CSRF protection enabled
13
- - **Built with Click and Rich** for a polished terminal experience
14
+ - **Built on cliyard and Rich** for a polished, maintainable terminal experience
15
+
16
+ ## Architecture
17
+
18
+ jcli 2.0 is driven by [cliyard](https://pypi.org/project/cliyard/) YAML specs instead of hand-written Click command groups. At startup, `jcli/cli.py` locates the spec directory (`JCLI_SPEC_DIR` env var > package-local `specs/` > repo-root `specs/`) and calls `cliyard.runtime.create_cli()` to build the whole command tree. Commands stay declarative: adding or changing a command is an edit to a YAML file, not Python plumbing.
19
+
20
+ ```
21
+ specs/
22
+ _auth.yaml Server auth chain (basic auth + crumb, as cliyard plugins)
23
+ resources/ One YAML spec per Jenkins domain
24
+ job.yaml job list/get/create/config/copy/enable/disable/delete
25
+ build.yaml build list/get/trigger/replay/log/stop/queue
26
+ node.yaml node list/get/delete/toggle
27
+ plugin.yaml plugin list/get/install/uninstall
28
+ credential.yaml credential list/get/create/delete
29
+ pipeline.yaml pipeline stages/log/pending/validate
30
+ view.yaml view list/get/create/delete
31
+ system.yaml system info/load/quiet-down/restart/script
32
+ plugins/ Python method plugins for non-trivial logic
33
+ jenkins_auth.py Basic + crumb authentication
34
+ jenkins_methods.py Build trigger/replay, node create
35
+ jenkins_pipeline_validate.py Jenkinsfile validation
36
+ jenkins_plugin.py Plugin install/uninstall/update-center
37
+ jenkins_system.py Groovy script, quiet-down, restart
38
+ ```
39
+
40
+ A resource spec maps a command name to either a plain HTTP call (method, path, params, output mapping) or a `plugin:` reference. The auth chain in `_auth.yaml` injects `Authorization` and crumb headers into every request.
14
41
 
15
42
  ## Requirements
16
43
 
@@ -131,6 +158,21 @@ Every command accepts these global flags before the subcommand:
131
158
  -s, --server TEXT Jenkins server URL
132
159
  ```
133
160
 
161
+ ### auth — Manage authentication profiles
162
+
163
+ Profiles are stored in `~/.jcli/config.yaml` (token shown masked).
164
+
165
+ ```
166
+ jcli auth add -n NAME -u USER -p TOKEN -e URL Add (or update) a profile
167
+ jcli auth add -n NAME ... --default ... and make it active
168
+ jcli auth status List profiles (tokens masked)
169
+ jcli auth use NAME Switch the active profile
170
+ jcli auth rm NAME Remove a profile
171
+ jcli auth rm --all Remove all profiles (reset template)
172
+ jcli auth set NAME FIELD VALUE Set url/username/api_token/description
173
+ jcli auth show [NAME] Show a profile's details (default: active)
174
+ ```
175
+
134
176
  ### job — Manage Jenkins jobs
135
177
 
136
178
  ```
@@ -150,6 +192,9 @@ jcli job delete JOB_NAME Delete a job
150
192
  jcli build list JOB_NAME List recent builds for a job
151
193
  jcli build get JOB_NAME BUILD_NUMBER Show details for a specific build
152
194
  jcli build trigger JOB_NAME Trigger a new build
195
+ jcli build rebuild JOB_NAME BUILD_NUMBER Rebuild reusing previous parameters
196
+ jcli build rebuild JOB_NAME BUILD_NUMBER --set KEY=VAL ... and override values (repeatable)
197
+ jcli build replay JOB_NAME BUILD_NUMBER JENKINSFILE Replay a build with a custom Jenkinsfile
153
198
  jcli build log JOB_NAME BUILD_NUMBER Show console log for a build
154
199
  jcli build stop JOB_NAME BUILD_NUMBER Stop a running build
155
200
  jcli build queue Show the current build queue
@@ -252,23 +297,20 @@ pytest --cov=jcli --cov-report=term-missing
252
297
 
253
298
  ```
254
299
  jcli/
255
- cli.py Main CLI entry point (Click group)
300
+ cli.py Entry point: builds the Click CLI from cliyard YAML specs
301
+ cli_helpers.py Global option injection and profile/format plumbing
256
302
  __init__.py Version
257
- plugins/ Command modules (one per Jenkins domain)
258
- job.py
259
- build.py
260
- node.py
261
- plugin.py
262
- credential.py
263
- pipeline.py
264
- view.py
265
- system.py
303
+ plugins/ Legacy hand-written command modules (kept for SDK compatibility)
266
304
  sdk/ Shared libraries
267
305
  client.py Jenkins REST API client (HTTP, auth, crumb)
268
306
  config.py Configuration management (YAML, env vars)
269
307
  output/
270
308
  formatter.py Table/JSON/YAML output formatting
271
309
  exceptions.py Typed exceptions
310
+ specs/ cliyard YAML specs (command definitions)
311
+ _auth.yaml Auth chain: basic + crumb plugins
312
+ resources/ One YAML per Jenkins domain (job, build, node, ...)
313
+ plugins/ Python method plugins for non-trivial logic
272
314
  tests/ pytest test suite
273
315
  ```
274
316
 
@@ -277,6 +319,7 @@ tests/ pytest test suite
277
319
  | Package | Purpose |
278
320
  |-----------------|-----------------------------|
279
321
  | click >= 8.1.0 | CLI framework |
322
+ | cliyard >= 0.6.0 | Spec-driven CLI engine (YAML command generation) |
280
323
  | requests ~= 2.31 | HTTP client |
281
324
  | pyyaml ~= 6.0.1 | YAML config parsing |
282
325
  | rich >= 13.7.1 | Terminal formatting (tables) |
@@ -0,0 +1 @@
1
+ __version__ = "1.0.0"