python-jcli 0.1.0__tar.gz → 1.0.1__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 (84) hide show
  1. {python_jcli-0.1.0 → python_jcli-1.0.1}/PKG-INFO +57 -12
  2. {python_jcli-0.1.0 → python_jcli-1.0.1}/README.md +55 -11
  3. python_jcli-1.0.1/jcli/__init__.py +1 -0
  4. python_jcli-1.0.1/jcli/cli.py +593 -0
  5. python_jcli-1.0.1/jcli/cli_helpers.py +21 -0
  6. {python_jcli-0.1.0 → python_jcli-1.0.1}/jcli/skills/jcli/SKILL.md +15 -2
  7. python_jcli-1.0.1/jcli/skills/jcli/auth/SKILL.md +86 -0
  8. python_jcli-1.0.1/jcli/skills/jcli/build/SKILL.md +123 -0
  9. {python_jcli-0.1.0 → python_jcli-1.0.1}/jcli/skills/jcli/credential/SKILL.md +14 -5
  10. {python_jcli-0.1.0 → python_jcli-1.0.1}/jcli/skills/jcli/job/SKILL.md +20 -4
  11. {python_jcli-0.1.0 → python_jcli-1.0.1}/jcli/skills/jcli/node/SKILL.md +4 -2
  12. {python_jcli-0.1.0 → python_jcli-1.0.1}/jcli/skills/jcli/pipeline/SKILL.md +3 -3
  13. {python_jcli-0.1.0 → python_jcli-1.0.1}/jcli/skills/jcli/plugin/SKILL.md +3 -0
  14. {python_jcli-0.1.0 → python_jcli-1.0.1}/jcli/skills/jcli/system/SKILL.md +15 -2
  15. {python_jcli-0.1.0 → python_jcli-1.0.1}/jcli/skills/jcli/view/SKILL.md +4 -3
  16. python_jcli-1.0.1/jcli/specs/_auth.yaml +15 -0
  17. python_jcli-0.1.0/jcli/plugins/skills.py → python_jcli-1.0.1/jcli/specs/plugins/jcli_commands.py +124 -63
  18. python_jcli-1.0.1/jcli/specs/plugins/jenkins_auth.py +75 -0
  19. python_jcli-1.0.1/jcli/specs/plugins/jenkins_methods.py +332 -0
  20. python_jcli-1.0.1/jcli/specs/plugins/jenkins_pipeline_validate.py +51 -0
  21. python_jcli-1.0.1/jcli/specs/plugins/jenkins_plugin.py +77 -0
  22. python_jcli-1.0.1/jcli/specs/plugins/jenkins_system.py +137 -0
  23. python_jcli-1.0.1/jcli/specs/resources/build.yaml +160 -0
  24. python_jcli-1.0.1/jcli/specs/resources/credential.yaml +97 -0
  25. python_jcli-1.0.1/jcli/specs/resources/job.yaml +184 -0
  26. python_jcli-1.0.1/jcli/specs/resources/node.yaml +69 -0
  27. python_jcli-1.0.1/jcli/specs/resources/pipeline.yaml +62 -0
  28. python_jcli-1.0.1/jcli/specs/resources/plugin.yaml +65 -0
  29. python_jcli-1.0.1/jcli/specs/resources/system.yaml +72 -0
  30. python_jcli-1.0.1/jcli/specs/resources/view.yaml +75 -0
  31. {python_jcli-0.1.0 → python_jcli-1.0.1}/pyproject.toml +3 -2
  32. {python_jcli-0.1.0 → python_jcli-1.0.1}/python_jcli.egg-info/PKG-INFO +57 -12
  33. {python_jcli-0.1.0 → python_jcli-1.0.1}/python_jcli.egg-info/SOURCES.txt +21 -30
  34. {python_jcli-0.1.0 → python_jcli-1.0.1}/python_jcli.egg-info/requires.txt +1 -0
  35. python_jcli-1.0.1/tests/test_build_log.py +197 -0
  36. {python_jcli-0.1.0 → python_jcli-1.0.1}/tests/test_cli.py +39 -11
  37. {python_jcli-0.1.0 → python_jcli-1.0.1}/tests/test_client.py +11 -1
  38. python_jcli-1.0.1/tests/test_cliyard_spike.py +71 -0
  39. {python_jcli-0.1.0 → python_jcli-1.0.1}/tests/test_config.py +9 -1
  40. {python_jcli-0.1.0 → python_jcli-1.0.1}/tests/test_exceptions.py +7 -1
  41. python_jcli-1.0.1/tests/test_replay.py +250 -0
  42. {python_jcli-0.1.0 → python_jcli-1.0.1}/tests/test_skills.py +91 -31
  43. python_jcli-0.1.0/jcli/__init__.py +0 -1
  44. python_jcli-0.1.0/jcli/cli.py +0 -79
  45. python_jcli-0.1.0/jcli/cli_helpers.py +0 -58
  46. python_jcli-0.1.0/jcli/plugins/__init__.py +0 -28
  47. python_jcli-0.1.0/jcli/plugins/build.py +0 -197
  48. python_jcli-0.1.0/jcli/plugins/config.py +0 -268
  49. python_jcli-0.1.0/jcli/plugins/credential.py +0 -210
  50. python_jcli-0.1.0/jcli/plugins/job.py +0 -425
  51. python_jcli-0.1.0/jcli/plugins/node.py +0 -134
  52. python_jcli-0.1.0/jcli/plugins/pipeline.py +0 -108
  53. python_jcli-0.1.0/jcli/plugins/plugin.py +0 -173
  54. python_jcli-0.1.0/jcli/plugins/system.py +0 -173
  55. python_jcli-0.1.0/jcli/plugins/view.py +0 -148
  56. python_jcli-0.1.0/jcli/sdk/build.py +0 -182
  57. python_jcli-0.1.0/jcli/sdk/credential.py +0 -143
  58. python_jcli-0.1.0/jcli/sdk/job.py +0 -191
  59. python_jcli-0.1.0/jcli/sdk/job_templates.py +0 -128
  60. python_jcli-0.1.0/jcli/sdk/node.py +0 -139
  61. python_jcli-0.1.0/jcli/sdk/pipeline.py +0 -121
  62. python_jcli-0.1.0/jcli/sdk/plugin.py +0 -155
  63. python_jcli-0.1.0/jcli/sdk/system.py +0 -202
  64. python_jcli-0.1.0/jcli/sdk/view.py +0 -94
  65. python_jcli-0.1.0/jcli/skills/jcli/config/SKILL.md +0 -81
  66. python_jcli-0.1.0/tests/test_build.py +0 -915
  67. python_jcli-0.1.0/tests/test_credential.py +0 -774
  68. python_jcli-0.1.0/tests/test_job.py +0 -1375
  69. python_jcli-0.1.0/tests/test_node.py +0 -420
  70. python_jcli-0.1.0/tests/test_pipeline.py +0 -544
  71. python_jcli-0.1.0/tests/test_plugin.py +0 -822
  72. python_jcli-0.1.0/tests/test_system.py +0 -877
  73. python_jcli-0.1.0/tests/test_view.py +0 -679
  74. {python_jcli-0.1.0 → python_jcli-1.0.1}/jcli/__main__.py +0 -0
  75. {python_jcli-0.1.0 → python_jcli-1.0.1}/jcli/sdk/__init__.py +0 -0
  76. {python_jcli-0.1.0 → python_jcli-1.0.1}/jcli/sdk/client.py +0 -0
  77. {python_jcli-0.1.0 → python_jcli-1.0.1}/jcli/sdk/config.py +0 -0
  78. {python_jcli-0.1.0 → python_jcli-1.0.1}/jcli/sdk/exceptions.py +0 -0
  79. {python_jcli-0.1.0 → python_jcli-1.0.1}/jcli/sdk/output/__init__.py +0 -0
  80. {python_jcli-0.1.0 → python_jcli-1.0.1}/jcli/sdk/output/formatter.py +0 -0
  81. {python_jcli-0.1.0 → python_jcli-1.0.1}/python_jcli.egg-info/dependency_links.txt +0 -0
  82. {python_jcli-0.1.0 → python_jcli-1.0.1}/python_jcli.egg-info/entry_points.txt +0 -0
  83. {python_jcli-0.1.0 → python_jcli-1.0.1}/python_jcli.egg-info/top_level.txt +0 -0
  84. {python_jcli-0.1.0 → python_jcli-1.0.1}/setup.cfg +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.1
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,38 @@ 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 `jcli/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
+ jcli/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
+ jcli_commands.py Skills + completion commands
51
+ jenkins_auth.py Basic + crumb authentication
52
+ jenkins_methods.py Build trigger/replay, node create
53
+ jenkins_pipeline_validate.py Jenkinsfile validation
54
+ jenkins_plugin.py Plugin install/uninstall/update-center
55
+ jenkins_system.py Groovy script, quiet-down, restart
56
+ ```
57
+
58
+ 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
59
 
31
60
  ## Requirements
32
61
 
@@ -147,6 +176,21 @@ Every command accepts these global flags before the subcommand:
147
176
  -s, --server TEXT Jenkins server URL
148
177
  ```
149
178
 
179
+ ### auth — Manage authentication profiles
180
+
181
+ Profiles are stored in `~/.jcli/config.yaml` (token shown masked).
182
+
183
+ ```
184
+ jcli auth add -n NAME -u USER -p TOKEN -e URL Add (or update) a profile
185
+ jcli auth add -n NAME ... --default ... and make it active
186
+ jcli auth status List profiles (tokens masked)
187
+ jcli auth use NAME Switch the active profile
188
+ jcli auth rm NAME Remove a profile
189
+ jcli auth rm --all Remove all profiles (reset template)
190
+ jcli auth set NAME FIELD VALUE Set url/username/api_token/description
191
+ jcli auth show [NAME] Show a profile's details (default: active)
192
+ ```
193
+
150
194
  ### job — Manage Jenkins jobs
151
195
 
152
196
  ```
@@ -166,6 +210,9 @@ jcli job delete JOB_NAME Delete a job
166
210
  jcli build list JOB_NAME List recent builds for a job
167
211
  jcli build get JOB_NAME BUILD_NUMBER Show details for a specific build
168
212
  jcli build trigger JOB_NAME Trigger a new build
213
+ jcli build rebuild JOB_NAME BUILD_NUMBER Rebuild reusing previous parameters
214
+ jcli build rebuild JOB_NAME BUILD_NUMBER --set KEY=VAL ... and override values (repeatable)
215
+ jcli build replay JOB_NAME BUILD_NUMBER JENKINSFILE Replay a build with a custom Jenkinsfile
169
216
  jcli build log JOB_NAME BUILD_NUMBER Show console log for a build
170
217
  jcli build stop JOB_NAME BUILD_NUMBER Stop a running build
171
218
  jcli build queue Show the current build queue
@@ -268,23 +315,20 @@ pytest --cov=jcli --cov-report=term-missing
268
315
 
269
316
  ```
270
317
  jcli/
271
- cli.py Main CLI entry point (Click group)
318
+ cli.py Entry point: builds the Click CLI from cliyard YAML specs
319
+ cli_helpers.py Output-formatter helper used by the cliyard command plugins
272
320
  __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
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
+ skills/ Bundled skill documentation
328
+ specs/ cliyard YAML specs (command definitions)
329
+ _auth.yaml Auth chain: basic + crumb plugins
330
+ resources/ One YAML per Jenkins domain (job, build, node, ...)
331
+ plugins/ Python method plugins for non-trivial logic
288
332
  tests/ pytest test suite
289
333
  ```
290
334
 
@@ -293,6 +337,7 @@ tests/ pytest test suite
293
337
  | Package | Purpose |
294
338
  |-----------------|-----------------------------|
295
339
  | click >= 8.1.0 | CLI framework |
340
+ | cliyard >= 0.6.0 | Spec-driven CLI engine (YAML command generation) |
296
341
  | requests ~= 2.31 | HTTP client |
297
342
  | pyyaml ~= 6.0.1 | YAML config parsing |
298
343
  | rich >= 13.7.1 | Terminal formatting (tables) |
@@ -7,10 +7,38 @@ 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 `jcli/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
+ jcli/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
+ jcli_commands.py Skills + completion commands
34
+ jenkins_auth.py Basic + crumb authentication
35
+ jenkins_methods.py Build trigger/replay, node create
36
+ jenkins_pipeline_validate.py Jenkinsfile validation
37
+ jenkins_plugin.py Plugin install/uninstall/update-center
38
+ jenkins_system.py Groovy script, quiet-down, restart
39
+ ```
40
+
41
+ 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
42
 
15
43
  ## Requirements
16
44
 
@@ -131,6 +159,21 @@ Every command accepts these global flags before the subcommand:
131
159
  -s, --server TEXT Jenkins server URL
132
160
  ```
133
161
 
162
+ ### auth — Manage authentication profiles
163
+
164
+ Profiles are stored in `~/.jcli/config.yaml` (token shown masked).
165
+
166
+ ```
167
+ jcli auth add -n NAME -u USER -p TOKEN -e URL Add (or update) a profile
168
+ jcli auth add -n NAME ... --default ... and make it active
169
+ jcli auth status List profiles (tokens masked)
170
+ jcli auth use NAME Switch the active profile
171
+ jcli auth rm NAME Remove a profile
172
+ jcli auth rm --all Remove all profiles (reset template)
173
+ jcli auth set NAME FIELD VALUE Set url/username/api_token/description
174
+ jcli auth show [NAME] Show a profile's details (default: active)
175
+ ```
176
+
134
177
  ### job — Manage Jenkins jobs
135
178
 
136
179
  ```
@@ -150,6 +193,9 @@ jcli job delete JOB_NAME Delete a job
150
193
  jcli build list JOB_NAME List recent builds for a job
151
194
  jcli build get JOB_NAME BUILD_NUMBER Show details for a specific build
152
195
  jcli build trigger JOB_NAME Trigger a new build
196
+ jcli build rebuild JOB_NAME BUILD_NUMBER Rebuild reusing previous parameters
197
+ jcli build rebuild JOB_NAME BUILD_NUMBER --set KEY=VAL ... and override values (repeatable)
198
+ jcli build replay JOB_NAME BUILD_NUMBER JENKINSFILE Replay a build with a custom Jenkinsfile
153
199
  jcli build log JOB_NAME BUILD_NUMBER Show console log for a build
154
200
  jcli build stop JOB_NAME BUILD_NUMBER Stop a running build
155
201
  jcli build queue Show the current build queue
@@ -252,23 +298,20 @@ pytest --cov=jcli --cov-report=term-missing
252
298
 
253
299
  ```
254
300
  jcli/
255
- cli.py Main CLI entry point (Click group)
301
+ cli.py Entry point: builds the Click CLI from cliyard YAML specs
302
+ cli_helpers.py Output-formatter helper used by the cliyard command plugins
256
303
  __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
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
+ skills/ Bundled skill documentation
311
+ specs/ cliyard YAML specs (command definitions)
312
+ _auth.yaml Auth chain: basic + crumb plugins
313
+ resources/ One YAML per Jenkins domain (job, build, node, ...)
314
+ plugins/ Python method plugins for non-trivial logic
272
315
  tests/ pytest test suite
273
316
  ```
274
317
 
@@ -277,6 +320,7 @@ tests/ pytest test suite
277
320
  | Package | Purpose |
278
321
  |-----------------|-----------------------------|
279
322
  | click >= 8.1.0 | CLI framework |
323
+ | cliyard >= 0.6.0 | Spec-driven CLI engine (YAML command generation) |
280
324
  | requests ~= 2.31 | HTTP client |
281
325
  | pyyaml ~= 6.0.1 | YAML config parsing |
282
326
  | rich >= 13.7.1 | Terminal formatting (tables) |
@@ -0,0 +1 @@
1
+ __version__ = "1.0.1"