Skip to content

Commit 29b0d65

Browse files
ihudakCopilot
andcommitted
feat: add 'dtmgd skills install' for AI agents + clarify context aliases
- Add dtmgd skills install/uninstall/status subcommands modeled after dtctl - Embed SKILL.md content via go:embed for ship-with-binary distribution - Move SKILL.md to skills/dtmgd/SKILL.md following agentskills.io layout - Support claude, copilot, cursor, junie, kiro, opencode + cross-client - Auto-detect target agent from env vars; --for to override; --global for user-wide - Clarify in README and SKILL.md that context names (prod, staging, ...) are user-defined aliases, not reserved keywords. Users can register any number of contexts with any names. - Fix .gitignore: anchor /dtmgd binary pattern so it stops matching skills/dtmgd/ - Add tests for skills installer package Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 5957540 commit 29b0d65

7 files changed

Lines changed: 862 additions & 19 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ releases/
77
*.dll
88
*.so
99
*.dylib
10-
dtmgd
10+
/dtmgd
1111

1212
# Test binary
1313
*.test

README.md

Lines changed: 81 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,13 @@ Make sure `$(go env GOPATH)/bin` is in your `$PATH`.
4040

4141
## Quick Start
4242

43+
`dtmgd` supports any number of named environments ("contexts"). The name you
44+
choose is just an alias — there are no reserved names. Pick whatever fits
45+
your setup: `prod`, `staging`, `dev`, `eu-prod`, `acme-tenant`, anything.
46+
4347
```bash
44-
# 1. Create a context pointing to your Managed cluster
48+
# 1. Create a context pointing to your Managed cluster.
49+
# Replace "prod" below with any alias you want for this environment.
4550
dtmgd config set-context prod \
4651
--host https://managed.company.com \
4752
--env-id abc12345 \
@@ -57,6 +62,11 @@ dtmgd get environments
5762
dtmgd get problems --status OPEN
5863
```
5964

65+
You can repeat step 1 as many times as needed to register additional
66+
environments — there is no limit on the number of contexts, and each can use
67+
any alias you choose. See [Multi-Environment Queries](#multi-environment-queries)
68+
for cross-context fan-out.
69+
6070
> **Note on token storage**: when an OS keyring (macOS Keychain, GNOME Keyring,
6171
> Windows Credential Manager) is available, the token is stored there and the
6272
> config file keeps only an empty placeholder. On headless Linux systems without
@@ -178,15 +188,21 @@ dtmgd query log-counts --entity 'type(SERVICE),tag("[Environment]BookStore")' --
178188
Query one, several, or all configured environments in a single command.
179189
Requests fan out in parallel and results are merged.
180190
191+
Context names (`prod`, `staging` below) are just user-defined aliases —
192+
substitute whatever names you used when configuring your contexts.
193+
181194
```bash
182-
# Query all environments
195+
# Query all configured environments
183196
dtmgd get problems --env ALL_ENVIRONMENTS -o json
184197
185-
# Query specific environments (semicolon-separated)
198+
# Query specific environments (semicolon-separated list of your context names)
186199
dtmgd get problems --env "prod;staging" -o json
187200
188-
# Single env result → unwrapped data
189-
# Multi env result → { "prod": {...}, "staging": {...} }
201+
# You can list any number of contexts:
202+
dtmgd get problems --env "eu-prod;us-prod;ap-prod;dev" -o json
203+
204+
# Single env result → unwrapped data
205+
# Multi env result → { "<context-1>": {...}, "<context-2>": {...} }
190206
```
191207

192208
The `--env` flag works with all `get`, `describe`, and `query` commands.
@@ -215,6 +231,44 @@ Errors are also wrapped:
215231

216232
Force it on with `-A` / `--agent`, or disable auto-detection with `--no-agent`.
217233

234+
### Install the dtmgd Skill for Your AI Agent
235+
236+
`dtmgd` ships with an embedded skill file (`SKILL.md`) that teaches your AI
237+
coding assistant how to use the CLI effectively — including command patterns,
238+
output formats, and gotchas specific to Dynatrace Managed Classic.
239+
240+
Install it with one command — the target agent is auto-detected from your
241+
environment, or you can pick it explicitly:
242+
243+
```bash
244+
# Auto-detect the current AI agent and install
245+
dtmgd skills install
246+
247+
# Install for a specific agent (claude, copilot, cursor, junie, kiro, opencode)
248+
dtmgd skills install --for claude
249+
250+
# Install user-wide (instead of project-local)
251+
dtmgd skills install --for claude --global
252+
253+
# Install to the cross-client shared directory (agentskills.io convention)
254+
# — picked up automatically by any compatible agent
255+
dtmgd skills install --cross-client
256+
257+
# List all supported agents and their install paths
258+
dtmgd skills install --list
259+
260+
# Check what's installed across all agents
261+
dtmgd skills status
262+
263+
# Remove the skill
264+
dtmgd skills uninstall --for claude
265+
```
266+
267+
Skill files are installed as a directory following the
268+
[agentskills.io](https://agentskills.io) standard:
269+
`<agent-config>/skills/dtmgd/SKILL.md`. Use `--force` to overwrite an
270+
existing installation.
271+
218272
## Pagination
219273

220274
All list commands (`get problems`, `get entities`, etc.) automatically follow
@@ -245,22 +299,40 @@ Both relative and absolute times are accepted:
245299

246300
## Configuration File Format
247301

302+
Context names (`production`, `staging`, etc.) and token names (`prod-token`)
303+
are user-chosen aliases. There are no reserved names — pick whatever fits
304+
your environments. You can register as many contexts as you need.
305+
248306
```yaml
249307
apiVersion: dtmgd.io/v1
250308
kind: Config
251-
current-context: production
309+
current-context: production # any context name from the list below
252310
contexts:
253-
- name: production
311+
- name: production # ← user-defined alias
254312
context:
255313
host: https://managed.company.com # Managed cluster base URL
256314
env-id: abc12345 # Environment ID
257-
token-ref: prod-token
315+
token-ref: prod-token # reference into tokens list
258316
description: Production environment
259317
http-proxy: http://proxy.corp:8080 # optional HTTP proxy
260318
https-proxy: http://proxy.corp:8080 # optional HTTPS proxy
319+
- name: staging # ← another user-defined alias; add as many as needed
320+
context:
321+
host: https://managed-staging.company.com
322+
env-id: def67890
323+
token-ref: staging-token
324+
- name: eu-prod # ← any name you want
325+
context:
326+
host: https://managed-eu.company.com
327+
env-id: xyz12345
328+
token-ref: eu-prod-token
261329
tokens:
262-
- name: prod-token
330+
- name: prod-token # ← matches token-ref above
263331
token: "" # empty when stored in OS keyring
332+
- name: staging-token
333+
token: ""
334+
- name: eu-prod-token
335+
token: ""
264336
preferences:
265337
output: table
266338
```

0 commit comments

Comments
 (0)