Skip to content

Commit 8601c70

Browse files
Copilotewega
andcommitted
Sync docs from main: add --username, BasicAuth docs to configure-connection.md and AGENTS.md auth field groups
Co-authored-by: ewega <26189114+ewega@users.noreply.github.com>
1 parent e17bc32 commit 8601c70

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

.github/copilot-instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ When performing a code review on this repository:
8080
- Confirm imports follow stdlib → external → internal ordering
8181
- Flag any hardcoded plugin names outside `connectionRegistry`
8282
- Verify `doGet[T]`/`doPost[T]` generics are used instead of raw HTTP calls
83+
- Check that new plugin-specific flags are registered in `ConnectionFlags`/`ScopeFlags` on the `ConnectionDef` for dynamic validation
8384
- Check terminal output follows spacing rules from `terminal-output.instructions.md`
8485
- Verify new commands have test files alongside them
8586
- Ensure README command reference table is updated for new/renamed commands

AGENTS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ gh devlake
6060
### Plugin System
6161
Plugins are defined via `ConnectionDef` structs in `cmd/connection_types.go`. Each entry declares the plugin slug, endpoint, rate limits, prompt labels, PAT resolution keys, and scope handler. To add a new DevOps tool, add a `ConnectionDef` to `connectionRegistry` — token resolution, org prompts, and connection creation all derive from these fields automatically. See the `devlake-dev-integration` skill for full details.
6262

63+
Key `ConnectionDef` field groups:
64+
- **Identity & endpoints**: `Plugin`, `DisplayName`, `Endpoint`, `Available`
65+
- **Org/enterprise**: `NeedsOrg`, `NeedsEnterprise`, `NeedsOrgOrEnt`, `OrgPrompt`, `EnterprisePrompt`
66+
- **Auth**: `AuthMethod` (default `"AccessToken"`; set `"BasicAuth"` for Jenkins/Bitbucket/Jira), `NeedsUsername`, `UsernamePrompt`, `UsernameEnvVars`, `UsernameEnvFileKeys`
67+
- **Token/PAT**: `TokenPrompt`, `EnvVarNames`, `EnvFileKeys`, `RequiredScopes`, `ScopeHint`
68+
- **Scope metadata**: `ScopeIDField` (JSON field name for scope IDs, e.g. `"githubId"`, `"id"`), `HasRepoScopes` (true when scopes carry a FullName tracked as repos), `ScopeFunc`
69+
- **Dynamic flag validation**: `ConnectionFlags`, `ScopeFlags` — slices of `FlagDef` that declare which plugin-specific flags apply. At runtime, `warnIrrelevantFlags()` warns when a user passes a flag that doesn't apply to the selected plugin, and `printContextualFlagHelp()` shows applicable flags in interactive mode.
70+
6371
**One plugin per invocation.** Flag-based commands target a single `--plugin`. Interactive mode walks through plugins sequentially.
6472

6573
### Design Principles

docs/configure-connection.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ Aliases: `connections`
2828
| `--name` | `Plugin - org` | Connection display name |
2929
| `--endpoint` | `https://api.github.com/` | API endpoint (use for GitHub Enterprise Server) |
3030
| `--proxy` | | HTTP proxy URL |
31-
| `--token` | | GitHub PAT (highest priority source) |
31+
| `--token` | | GitHub PAT (highest priority source). For BasicAuth plugins (Jenkins, Bitbucket, Jira), this is the password. |
32+
| `--username` | | Username for BasicAuth plugins (Jenkins, Bitbucket, Jira). Not used by GitHub or Copilot. |
3233
| `--env-file` | `.devlake.env` | Path to env file containing PAT |
3334
| `--skip-cleanup` | `false` | Don't delete `.devlake.env` after setup |
3435

@@ -50,6 +51,17 @@ For each plugin, the CLI resolves the PAT in this order (see [token-handling.md]
5051
3. Plugin-specific environment variable (same key names, from shell environment)
5152
4. Interactive masked prompt (terminal fallback)
5253

54+
### Username Resolution (BasicAuth plugins)
55+
56+
For plugins that use BasicAuth (e.g. Jenkins, Bitbucket, Jira), the `--username` flag is resolved in this order:
57+
58+
1. `--username` flag
59+
2. `.devlake.env` file — checked for plugin-specific keys (e.g. `JENKINS_USERNAME`)
60+
3. Plugin-specific environment variable (from shell environment)
61+
4. Interactive prompt (terminal fallback)
62+
63+
When `--username` is provided for a plugin that uses AccessToken auth (like GitHub or Copilot), the CLI prints a warning that the flag is not applicable.
64+
5365
### What It Does
5466

5567
1. Auto-discovers DevLake instance (state file → localhost ports → `--url`)
@@ -81,6 +93,9 @@ gh devlake configure connection --plugin github --org my-org \
8193
# With proxy
8294
gh devlake configure connection --plugin github --org my-org --proxy http://proxy:8080
8395

96+
# BasicAuth plugin (e.g. Jenkins)
97+
gh devlake configure connection --plugin jenkins --username admin --token mypassword
98+
8499
# Interactive (no --plugin — prompts for everything)
85100
gh devlake configure connection
86101
```

0 commit comments

Comments
 (0)