aidev-jcli
Skill0 starsChanged 12 days agoMITView on GitHub
Use when an AI agent needs to trigger or watch a Jenkins build, deploy a service, check build status, tail a build log, cancel a build, or discover jobs/parameters — across configured Jenkins instances. Covers the service-centric model, the configurable deploy flow, the JSON envelope, and target-based discovery.
In this repository7 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- aidev-dbcliSkill
- aidev-httpcliSkill
- aidev-logcliSkill
- aidev-tcliSkill
- use-aidevSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 136
Every invocation (including rejected ones) appends to ~/.aidev-clis/audit/<YYYYMMDD>.jsonl (30-day auto-prune).
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
jcli
jcli gives an AI agent controlled, audited access to trigger and watch Jenkins
builds, and deploy. It speaks only the Jenkins REST API; the CLI injects an API
token you never see and returns a minimal JSON envelope. It is decoupled from
kubectl — the post-build action is an operator-configured flow, not hardcoded.
jcli deploy <service> [--target n] [--group g] [--param k=v ...] [--no-wait] [--timeout d] [--job <name>]
jcli build <service> [--target n] [--group g] [--param k=v ...] [--wait] [--job <name>]
jcli status <service> [--target n] [--group g] [--build N] [--job <name>]
jcli log <service> [--target n] [--group g] [--build N] [-f] [--output json|raw] [--job <name>]
jcli cancel <service> [--target n] [--group g] [--build N] [--job <name>]
jcli jobs [--target n] [--sync] # discovery: list jobs (local cache; --sync refreshes)
jcli params <service> [--target n] [--group g] [--job <name>] # discovery: a job's parameter defs
jcli doctor [--target n] # connectivity + token auth
jcli targets # configured Jenkins instances--group selects which group (stack) to resolve the service within; omit it
when the env has one group (or the service resolves unambiguously across groups).
log returns the JSON envelope by default, which is what an agent wants — don't
pass --output. log --output raw prints raw console text (for humans).
Everything is service-centric (you type the short name)
You always pass a short <service> (e.g. orders); jcli resolves it to the real
Jenkins job via the env's templates (job_overrides exact > job_templates
longest-prefix > job_template catch-all > bare name — folder paths supported).
Never type the full team/job/... path. --job <name> is an escape hatch to
target a raw job that doesn't fit the templates.
Each target has one or more groups (stacks), and resolution happens within a
group. With one group it's automatic. With several, jcli checks the synced jobs
cache. An unsynced cache returns GROUP_REQUIRED, no match returns
SERVICE_UNKNOWN, and multiple matches return GROUP_AMBIGUOUS. Pass --group
to select explicitly. --job bypasses service routing. For deploy, the job path
must identify one group or you must also pass --group.
Output contract (parse this)
- Finite verbs → one envelope:
{"data": <payload>}or{"error":{"code","message"}}. log -f→ NDJSON, one object per line:{"type":"record","data":{"message":...}}… then{"type":"end","count":N}.log -fends when Jenkins reports no more console data. You can interrupt it earlier.doctor→ a flat staged-check array{"data":[{"name","ok","detail"},...]}(config→auth); exit non-zero if a stage fails — the one case where a non-zero exit carriesdata, noterror. (See docs/OUTPUT-CONTRACT.md.)- Exit codes: 0 ok / 1 general / 2 config / 3 auth / 4 timeout / 5 remote.
Discover before you act (you can't guess names)
jcli doctor --target uat # is Jenkins reachable + my token valid?
jcli jobs --target uat # what services/jobs exist (reads the local cache)
jcli jobs --target uat --sync # refresh the cache from Jenkins (recursive folder walk)
jcli params orders --target uat # what params does this job take (name/type/default/choices)jobs reads ~/.aidev-clis/cache/jcli/<target>/jobs.json (offline, fast); --sync
re-walks Jenkins. Reactive/Active-Choices params are NOT resolved (static only).
Build vs deploy — pick deliberately
build <service>triggers the resolved job and (with--wait) blocks until it finishes (non-SUCCESS → exit 5). No post-build steps. Use for a plain build.deploy <service>runs the configured flow: build → wait → extract values from the console → run the operator'ssteps(e.g.kubectl set image). This deploys for real — confirm intent before running it. With nosteps:configured it just emits the extracted values.- You supply only
--param k=v(and the service). You cannot author or change the deploy commands —stepsare operator config,argv[0]is allowlisted (kubectl/ssh/helm/docker/bash). Tokens are${...}(a build branch is--param branch=x→${branch}). --no-waittriggers and returns the build number without waiting.
jcli build orders --target uat --param branch=main --wait
jcli deploy orders --target uat --param branch=main # build → extract → steps
jcli status orders --target uat # last build result
jcli log orders --target uat -f # stream the console
jcli cancel orders --target uat # abort a running buildInfer the target first
jcli targets is a safe local read (name + description, no backend call). Prefer an
explicit user target or the release/UAT context; if several fit or the user is vague,
confirm once before triggering a build.
Config (see docs/cli-jcli.md for the full schema)
# ~/.aidev-clis/jcli.yaml
targets:
uat:
adapter: jenkins
base_url: https://jenkins.example.com
credential: jenkins.uat # {"user","api_token"} JSON (0600), never seen by the AI
# insecure_skip_verify: true # internal Jenkins with self-signed TLS
groups: # REQUIRED: ≥1 group (stack). --group picks one.
backend: # resolution + deploy live INSIDE a group
job_template: "${service}-uat" # service → job; or job_templates (prefix) / job_overrides (exact)
deploy: # optional flow
extract: { tag: 'registry/uat/${service}:(\d{14})' }
steps:
- [kubectl, -n, uat, set, image, "deploy/${service}", "${service}=registry/uat/${service}:${tag}"]job_template / job_templates / job_overrides / deploy / vars are all
inside a group — an env with no groups: fails to load (CONFIG_INVALID).
The credential's own Jenkins scope (which jobs the token may trigger) is the real boundary; jcli keeps the token out of its output and audit.
The bundled jcli.yaml is a reference template — copy it to ~/.aidev-clis/jcli.yaml
and fill in your targets/credentials (real configs never leave the machine). You
can offer to write it for the user from this sample.
For the shared ~/.aidev-clis layout, the credentials model, and from-zero setup
steps, see the use-aidev skill.
Don't use jcli for
- Reading logs from running pods — use
logcli kubectl.jcli logis the Jenkins build console, not pod logs. - Arbitrary cluster ops — jcli only does build/read/cancel/deploy; deploy
stepsare operator-fixed, not agent-authored.
Audit
Every invocation (including rejected ones) appends to ~/.aidev-clis/audit/<YYYYMMDD>.jsonl
(30-day auto-prune). Side-effecting verbs (build/deploy/cancel) write a started line
before dispatch and a terminal line after, sharing an id. Credentials are never written.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

