@vpxa/aikit 0.1.71 → 0.1.73

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.
@@ -257,6 +257,17 @@ Before every tool call, verify:
257
257
  | \`session-handoff\` | Context filling up, session ending, or major milestone |
258
258
  | \`lesson-learned\` | After completing work — extract engineering principles |
259
259
  | \`docs\` | During \`_docs-sync\` epilogue — living documentation convention, templates, change-to-doc mapping |
260
+ | \`repo-access\` | **IMMEDIATELY** when YOU or any subagent get auth failures from \`web_fetch\`, \`http\`, or git commands (401, 403, 404, SSO redirect, login HTML, "Permission denied"). NEVER declare a repo "inaccessible" without first loading this skill and walking the Strategy Ladder |
261
+
262
+ ## Repo Access — HARD RULE
263
+
264
+ **If \`web_fetch\` or \`http\` returns 401, 403, 404, SSO redirect, login page HTML, or any auth-like failure for a repository or code URL:**
265
+ 1. **STOP** — do NOT declare the repo "inaccessible" or "behind SSO"
266
+ 2. **Load the \`repo-access\` skill** and follow its Strategy Ladder
267
+ 3. **Walk all 5 steps** before concluding access is impossible
268
+ 4. **Include \`repo-access\` in subagent prompts** when delegating tasks that touch the same repo
269
+
270
+ This applies to YOU (the Orchestrator) when you use \`web_fetch\`/\`http\` directly, not just subagents.
260
271
 
261
272
  **When dispatching subagents**, include relevant skill names in the prompt so subagents know which skills to load (e.g., "Load the \`react\` and \`typescript\` skills for this task").
262
273
 
@@ -394,7 +405,8 @@ When subagents complete, their visual outputs (from \`present\`) are NOT visible
394
405
  | \`requirements-clarity\` | When requirements are vague or complex (>2 days) — score 0-100 before committing to a plan |
395
406
  | \`c4-architecture\` | When the plan involves architectural changes — generate C4 diagrams |
396
407
  | \`adr-skill\` | When the plan involves non-trivial technical decisions — create executable ADRs |
397
- | \`session-handoff\` | When context window is filling up, planning session ending, or major milestone completed |`,
408
+ | \`session-handoff\` | When context window is filling up, planning session ending, or major milestone completed |
409
+ | \`repo-access\` | When the plan involves accessing private, enterprise, or self-hosted repositories |`,
398
410
 
399
411
  Implementer: `**Read \`AGENTS.md\`** in the workspace root for project conventions and AI Kit protocol.
400
412
 
@@ -133,4 +133,15 @@ export const PLUGINS = {
133
133
  source: 'scaffold/general/skills/docs/SKILL.md',
134
134
  required: true,
135
135
  },
136
+
137
+ 'repo-access': {
138
+ description:
139
+ 'Progressive repository access recovery for private and enterprise git repos — strategy ladder from HTTPS to SSH to CLI OAuth to PAT to local clone',
140
+ source: 'scaffold/general/skills/repo-access/SKILL.md',
141
+ required: true,
142
+ sidecars: [
143
+ 'scaffold/general/skills/repo-access/references/platform-matrix.md',
144
+ 'scaffold/general/skills/repo-access/references/error-patterns.md',
145
+ ],
146
+ },
136
147
  };
@@ -274,6 +274,17 @@ Before every tool call, verify:
274
274
  | `session-handoff` | Context filling up, session ending, or major milestone |
275
275
  | `lesson-learned` | After completing work — extract engineering principles |
276
276
  | `docs` | During `_docs-sync` epilogue — living documentation convention, templates, change-to-doc mapping |
277
+ | `repo-access` | **IMMEDIATELY** when YOU or any subagent get auth failures from `web_fetch`, `http`, or git commands (401, 403, 404, SSO redirect, login HTML, "Permission denied"). NEVER declare a repo "inaccessible" without first loading this skill and walking the Strategy Ladder |
278
+
279
+ ## Repo Access — HARD RULE
280
+
281
+ **If `web_fetch` or `http` returns 401, 403, 404, SSO redirect, login page HTML, or any auth-like failure for a repository or code URL:**
282
+ 1. **STOP** — do NOT declare the repo "inaccessible" or "behind SSO"
283
+ 2. **Load the `repo-access` skill** and follow its Strategy Ladder
284
+ 3. **Walk all 5 steps** before concluding access is impossible
285
+ 4. **Include `repo-access` in subagent prompts** when delegating tasks that touch the same repo
286
+
287
+ This applies to YOU (the Orchestrator) when you use `web_fetch`/`http` directly, not just subagents.
277
288
 
278
289
  **When dispatching subagents**, include relevant skill names in the prompt so subagents know which skills to load (e.g., "Load the `react` and `typescript` skills for this task").
279
290
 
@@ -105,6 +105,7 @@ When subagents complete, their visual outputs (from `present`) are NOT visible t
105
105
  | `c4-architecture` | When the plan involves architectural changes — generate C4 diagrams |
106
106
  | `adr-skill` | When the plan involves non-trivial technical decisions — create executable ADRs |
107
107
  | `session-handoff` | When context window is filling up, planning session ending, or major milestone completed |
108
+ | `repo-access` | When the plan involves accessing private, enterprise, or self-hosted repositories |
108
109
 
109
110
  # Code Agent — Shared Base Instructions
110
111
 
@@ -29,6 +29,12 @@ Local-first AI developer toolkit — 82 MCP tools for search, analysis, context
29
29
  - You need code complexity metrics or a git changelog
30
30
  - You want to save and reuse code snippets across sessions
31
31
 
32
+ ## Skills Reference
33
+
34
+ | Context | Skill | Load when |
35
+ |---------|-------|----------|
36
+ | Repository access recovery | `repo-access` | When encountering git auth failures, accessing private/enterprise repos, or when `web_fetch`/`http` returns auth errors on repository URLs. |
37
+
32
38
  ## Architecture
33
39
 
34
40
  10-package monorepo published as a single npm package:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: c4-architecture
3
- description: Generate architecture documentation using C4 model diagrams. Supports two output formats: Mermaid (md) for documentation and HTML/SVG for presentations. Use when asked to create architecture diagrams, document system architecture, visualize software structure, create C4 diagrams, or generate context/container/component/deployment diagrams.
3
+ description: "Generate architecture documentation using C4 model diagrams. Supports two output formats: Mermaid (md) for documentation and HTML/SVG for presentations. Use when asked to create architecture diagrams, document system architecture, visualize software structure, create C4 diagrams, or generate context/container/component/deployment diagrams."
4
4
  metadata:
5
5
  category: cross-cutting
6
6
  domain: general
@@ -0,0 +1,178 @@
1
+ ---
2
+ name: repo-access
3
+ description: "Progressive repository access recovery for private and enterprise git repositories. Triggered when: (1) git clone/fetch/pull fails with auth errors (401, 403, 404, Permission denied), (2) web_fetch or http tool returns auth failure on repository URLs, (3) user mentions private repo, enterprise repo, or internal repo, (4) user asks to access code from GitHub Enterprise, GitLab Self-Managed, Bitbucket Server, Azure DevOps. Guides through 5-step progressive strategy: anonymous HTTPS, SSH keys, CLI OAuth, PAT, local clone fallback."
4
+ metadata:
5
+ category: cross-cutting
6
+ domain: general
7
+ applicability: on-demand
8
+ inputs: [git-error, repository-url, platform-context]
9
+ outputs: [authenticated-access, recovery-instructions]
10
+ requires: []
11
+ relatedSkills: [aikit]
12
+ argument-hint: "Repository URL or error message"
13
+ ---
14
+
15
+ # Repository Access Recovery
16
+
17
+ Progressively recover repository access for private, enterprise, and internal git hosts without leaking credentials.
18
+
19
+ ## When to Activate
20
+
21
+ ### Reactive triggers
22
+
23
+ - `git clone`, `git fetch`, or `git pull` fails with `401`, `403`, `404`, `Authentication failed`, or `Permission denied (publickey)`.
24
+ - `http` diagnostics against a repo endpoint show auth failure or ambiguous private-repo responses.
25
+ - `web_fetch` returns login page HTML, SSO redirect, "Sign in", "Page not found", or empty/truncated content for a repo URL.
26
+ - Any tool output contains "behind SSO", "SSO required", "SAML", "requires authentication", or similar auth-gate language about a repository.
27
+ - A repository URL works in a browser for the user but fails from agent tools or terminal commands.
28
+ - **You are about to declare a repo "inaccessible" or "unreachable"** — STOP and activate this skill first.
29
+
30
+ ### Proactive triggers
31
+
32
+ - The user says the repo is private, enterprise, self-managed, internal, or SSO-protected.
33
+ - The repo is hosted on GitHub Enterprise, GitLab Self-Managed, Bitbucket Server/Data Center, Azure DevOps, Gitea, or another custom git host.
34
+ - The environment may need browser sign-in, SSH agent setup, or token-based recovery before any code access can work.
35
+
36
+ ## When NOT to Activate
37
+
38
+ - Public repositories that already clone or read successfully over HTTPS.
39
+ - Local-only repositories where no remote auth is involved.
40
+ - Problems caused by branch protection, merge conflicts, or rate limiting rather than repository access.
41
+
42
+ ## Step 0: Platform Detection & Capability Gate
43
+
44
+ Detect platform from the URL, then decide what recovery options are possible in this environment.
45
+
46
+ | URL pattern | Platform |
47
+ | --- | --- |
48
+ | `github.com`, or any GHE host (e.g. `ghe.*`, `github.*`, custom domain) | GitHub / GitHub Enterprise |
49
+ | `gitlab.com`, `gitlab.<corp-host>` | GitLab / GitLab Self-Managed |
50
+ | `bitbucket.org`, `bitbucket.<corp-host>` | Bitbucket Cloud / Server |
51
+ | `dev.azure.com`, `visualstudio.com`, `/_git/` | Azure DevOps |
52
+ | anything else with git over HTTPS/SSH | Unknown — ask the user which platform before assuming generic Git |
53
+
54
+ - Capability gate: has terminal, has browser, or conversation-only.
55
+ - If terminal is unavailable, skip directly to PAT guidance or local clone fallback.
56
+ - If browser is unavailable, prefer SSH or pre-created credentials over CLI OAuth.
57
+ - If only the `http` tool is available (no terminal, no CLI): use PAT + authenticated API reads (see "Web-Based Code Access" below). This is the zero-dependency path — no `gh`, `glab`, or `az` installation needed.
58
+
59
+ For platform-specific details, read `references/platform-matrix.md`.
60
+
61
+ ## Strategy Ladder
62
+
63
+ ### Step 1: Try HTTPS Anonymous Access
64
+
65
+ - Goal: prove the repo is public or already reachable without extra auth.
66
+ - What to do: normalize the remote to an HTTPS URL and run `git ls-remote https://...`. If it succeeds, use HTTPS and stop. If it fails with auth-like errors, continue instead of assuming the repo is missing.
67
+ - Verify: `git ls-remote <url>`; SUCCESS -> stop, FAIL -> Step 2.
68
+
69
+ ### Step 2: Check Existing SSH Keys
70
+
71
+ - Goal: reuse working SSH credentials before asking for new secrets.
72
+ - What to do: inspect `~/.ssh/` for key files, run `ssh-add -l`, then test host auth with `ssh -T git@{host}`. If SSH works, switch the remote to the SSH URL and continue with that transport.
73
+ - Verify: `git ls-remote <ssh-url>`; SUCCESS -> stop, FAIL -> Step 3.
74
+
75
+ ### Step 3: Platform CLI OAuth
76
+
77
+ - Goal: use the platform's interactive login flow with stored credentials.
78
+ - What to do: check whether the matching CLI exists, for example `which gh`, `which glab`, or `which az` (or platform equivalent). If installed, run `{cli} auth login` and let it complete browser or device OAuth, then retry git access.
79
+ - **If the CLI is not installed**: do NOT try `npx` — platform CLIs (`gh`, `glab`, `az`) are native binaries, not npm packages. Skip straight to Step 4 (PAT). For file-read-only tasks, the `http` tool with a PAT header is a zero-dependency alternative to any CLI.
80
+ - Verify: `git ls-remote <url>`; SUCCESS -> stop, FAIL -> Step 4.
81
+
82
+ ### Step 4: Personal Access Token
83
+
84
+ - Goal: recover access when SSH and CLI OAuth are unavailable or blocked.
85
+ - What to do: ask the user to create a PAT or app password at the platform-specific URL with minimum read scopes only. Have the user provide it through an env var or credential helper, then configure git credentials without embedding the token in the remote URL.
86
+ - Verify: `git ls-remote <url>`; SUCCESS -> stop, FAIL -> Step 5.
87
+
88
+ ### Step 5: Local Clone Fallback
89
+
90
+ - Goal: unblock work when remote auth cannot be completed from the current environment.
91
+ - What to do: ask the user to clone the repository on their machine using their normal workflow, then provide the local filesystem path. Use the local checkout as the source of truth for code access.
92
+ - Verify: local repo exists and `git rev-parse --show-toplevel` succeeds; SUCCESS -> stop.
93
+
94
+ ## Security Rules (HARD GATE)
95
+
96
+ - NEVER include a PAT in a git URL; it leaks into shell history, process lists, logs, and config.
97
+ - NEVER repeat a user's token value in chat output, summaries, examples, or when relaying tool output that may contain credentials.
98
+ - Use env vars, credential helpers, or platform login tools for token delivery.
99
+ - Recommend minimum scopes only: read-only repo scopes, not broad write/admin scopes.
100
+ - Prefer ephemeral credentials, OAuth/device flows, or short-lived tokens over long-lived PATs.
101
+ - When guiding PAT creation, recommend the shortest feasible expiry (7–30 days for task-specific work).
102
+
103
+ ## After Access Is Established
104
+
105
+ - Remind the user to revoke single-use PATs once the task is complete.
106
+ - If credentials were stored via a credential helper, note that they persist until manually removed or the token expires.
107
+
108
+ ## Web-Based Code Access (web_fetch / http)
109
+
110
+ Agents often use `web_fetch` or `http` to read individual files without a full clone. These requests fail silently on private repos — GitHub returns `404` or login HTML, not an auth error.
111
+
112
+ ### Common URL Patterns That Fail on Private Repos
113
+
114
+ | URL Pattern | Platform | What Happens |
115
+ |---|---|---|
116
+ | `raw.githubusercontent.com/{owner}/{repo}/{ref}/{path}` | GitHub | `404` — no auth header accepted |
117
+ | `github.com/{owner}/{repo}/blob/{ref}/{path}` | GitHub web view | `200` with login HTML, not code |
118
+ | `api.github.com/repos/{owner}/{repo}/contents/{path}` | GitHub API | `404` (the GitHub 404 trap) |
119
+ | `<ghe-host>/{owner}/{repo}/*` (any GHE URL) | GitHub Enterprise | `200` with SAML SSO redirect page — body contains "Initiating SAML single sign-on" and redirect to `login.microsoftonline.com` or other IdP |
120
+ | `gitlab.com/{owner}/{repo}/-/raw/{ref}/{path}` | GitLab | `401` or login redirect |
121
+ | `dev.azure.com/{org}/{project}/_apis/git/repositories/{repo}/items` | Azure DevOps | `401` or `203` non-authoritative |
122
+
123
+ ### SAML SSO Detection (CRITICAL)
124
+
125
+ GHE instances with SAML SSO return `200 OK` with an HTML body that is NOT the requested content. **This is the most common false-"inaccessible" scenario.** Detect it by checking `web_fetch` output for ANY of these strings:
126
+
127
+ - `Initiating SAML single sign-on`
128
+ - `login.microsoftonline.com` (Azure AD / Entra ID)
129
+ - `You are being redirected to your identity provider`
130
+ - `/login?return_to=`
131
+ - `SAMLRequest=`
132
+ - `RelayState=`
133
+
134
+ If ANY of these appear → the repo exists and is accessible, it just needs authentication. This is NOT "inaccessible" — follow the Strategy Ladder.
135
+
136
+ ### Recovery: Authenticated API Reads
137
+
138
+ When `web_fetch` fails on a private repo URL, switch to authenticated `http` calls:
139
+
140
+ 1. **Ensure auth is established first** — walk the Strategy Ladder (Steps 1-4) to get working credentials.
141
+ 2. **Use the platform API with auth headers**, not raw/web URLs:
142
+
143
+ | Platform | Authenticated file-read endpoint | Auth header |
144
+ |---|---|---|
145
+ | GitHub / GHE | `http GET https://api.github.com/repos/{owner}/{repo}/contents/{path}?ref={branch}` | `Authorization: token <PAT>` or use `gh api` |
146
+ | GitLab | `http GET https://gitlab.com/api/v4/projects/{id}/repository/files/{path}/raw?ref={branch}` | `PRIVATE-TOKEN: <PAT>` |
147
+ | Azure DevOps | `http GET https://dev.azure.com/{org}/{project}/_apis/git/repositories/{repo}/items?path={path}&api-version=7.0` | `Authorization: Basic <base64(:PAT)>` |
148
+ | Bitbucket | `http GET https://api.bitbucket.org/2.0/repositories/{owner}/{repo}/src/{ref}/{path}` | `Authorization: Bearer <token>` |
149
+
150
+ 3. **Prefer `http` over `web_fetch`** for private repos — `http` sends proper headers and returns machine-readable JSON; `web_fetch` gets HTML login pages.
151
+ 4. **For bulk reads**, prefer `git clone --depth 1` over many individual API calls — it's faster and avoids rate limits.
152
+ 5. **NEVER embed tokens in URLs** — use auth headers via the `http` tool or `gh api` CLI wrapper.
153
+
154
+ ### Quick Decision: Clone vs API Read
155
+
156
+ | Situation | Preferred method |
157
+ |---|---|
158
+ | Need 1-3 specific files | Authenticated API via `http` |
159
+ | Need to browse/search the repo | `git clone --depth 1` (shallow) |
160
+ | Need file history or blame | `git clone` |
161
+ | No terminal available | Authenticated API via `http` with PAT |
162
+ | Rate-limited on API | `git clone --depth 1` |
163
+
164
+ ## Tool Routing
165
+
166
+ | Tool | Use |
167
+ | --- | --- |
168
+ | `git_context` | Check local repo state and confirm a clone or fallback checkout is usable |
169
+ | `http` | Probe platform APIs for auth diagnostics AND read file contents from private repos with auth headers |
170
+ | `web_fetch` | Only for public repos or after confirming access works; unreliable for private repos (returns HTML, not code) |
171
+ | `web_search` | Find current platform-specific auth documentation when the host is unusual or self-managed |
172
+ | Terminal | Run git commands, SSH tests, CLI auth flows, and credential-helper setup |
173
+
174
+ For detailed error patterns, read `references/error-patterns.md`.
175
+
176
+ ## CRITICAL: The GitHub 404 Trap
177
+
178
+ GitHub commonly returns `404 Not Found` for private repositories when the caller is unauthenticated or under-authenticated. NEVER conclude that a GitHub repository does not exist from a `404` alone. Treat that response as an authentication signal first, then walk the ladder before declaring the repo missing.
@@ -0,0 +1,116 @@
1
+ # Repo Access Error Patterns
2
+
3
+ Use this reference to distinguish missing repositories from authentication and policy failures when probing Git hosts.
4
+
5
+ ## HTTP Status Code Matrix
6
+
7
+ | Platform | No auth (private repo) | Wrong credentials | Rate limited | SSO required |
8
+ |---|---|---|---|---|
9
+ | GitHub REST API | `404` (TRAP!) | `401` -> `403` | `403` + rate limit body | `403` + `X-GitHub-SSO` header |
10
+ | GitHub Web | HTML "Page not found" or login redirect | Login redirect | - | - |
11
+ | GitLab | `401` | `401` | `429` | `401` (PAT mandatory) |
12
+ | Bitbucket | `403` | `403` | `429` | `403` |
13
+ | Azure DevOps | `401` | `401` | - | `401` |
14
+
15
+ ## CRITICAL: The GitHub 404 Trap
16
+
17
+ GitHub deliberately returns `404`, not `401`, for private repositories accessed without authentication.
18
+ This is by design to avoid leaking whether a repository exists.
19
+
20
+ - Never conclude a GitHub repository does not exist from an unauthenticated `404`.
21
+ - `GET https://api.github.com/repos/{owner}/{repo}` without auth returns `404` for both "repo truly missing" and "repo exists but is private".
22
+ - The only reliable disambiguation is an authenticated probe.
23
+ - If the same request still returns `404` with valid auth, the repository is truly missing.
24
+
25
+ Probe order:
26
+
27
+ 1. Try the authenticated API request first.
28
+ 2. If it returns `200`, access works.
29
+ 3. If it returns `404` without auth context, treat it as ambiguous and recover.
30
+ 4. If it returns `404` with known-good auth, treat the repo as missing.
31
+
32
+ ## Git CLI Stderr Patterns
33
+
34
+ | Error Text Pattern | Platform | Diagnosis | Action |
35
+ |---|---|---|---|
36
+ | `remote: Repository not found.` | GitHub | Auth failure, not proof the repo is missing | Try auth strategies |
37
+ | `git@github.com: Permission denied (publickey).` | GitHub | SSH key not recognized | Check SSH keys, try HTTPS |
38
+ | `remote: HTTP Basic: Access denied.` | GitLab | Auth failure, 2FA likely | Use PAT; password auth is blocked with 2FA |
39
+ | `error: The requested URL returned error: 403` | Bitbucket | Auth failure | Try app password |
40
+ | `TF401019: The Git repository with name or identifier X does not exist` | Azure DevOps | Auth failure or missing repo | Try PAT with Code:Read scope |
41
+ | `fatal: Authentication failed for 'https://...'` | Any (HTTPS) | General auth failure | Escalate through the strategy ladder |
42
+ | `Permission denied (publickey).` | Any (SSH) | SSH key not recognized | Check `~/.ssh/`, run `ssh-add`, try HTTPS |
43
+ | `fatal: Could not read from remote repository.` | Any (SSH) | SSH access denied | Verify the SSH key is added to the platform |
44
+ | `unable to access '...': SSL certificate problem` | Any | Self-signed or enterprise CA issue | Ask about local cert config; skip to local clone if needed |
45
+
46
+ Treat these stderr strings as direct signals from tool output. Do not reinterpret GitHub's `Repository not found` as a clean existence check.
47
+
48
+ ## web_fetch / http Tool Detection
49
+
50
+ - `web_fetch` against a private GitHub repo URL often returns HTML with "Page not found" or a login page.
51
+ - GitHub web responses can be `200` with a 404-looking body, so `web_fetch` is unreliable for auth diagnosis.
52
+ - `http` against the platform API gives machine-readable bodies and real status codes, so use it for probes.
53
+ - For `web_fetch` on `github.com`, inspect the body for `Page not found`, `Sign in`, or `/login` links. If present, assume private or auth-gated access and trigger recovery.
54
+
55
+ Recommended diagnostic probe:
56
+
57
+ ```text
58
+ http GET https://api.github.com/repos/{owner}/{repo}
59
+ -> 404 + no auth header -> might be private
60
+ -> 401 -> explicit auth failure
61
+ -> 200 -> repo is public, access works
62
+ ```
63
+
64
+ ## Edge Cases
65
+
66
+ | Edge Case | Signal | Response |
67
+ |---|---|---|
68
+ | GitHub.com SAML SSO | `403` + `X-GitHub-SSO: required; url=...` | PAT needs SSO authorization for the org |
69
+ | GHE SAML SSO (web_fetch) | `200` + body contains `Initiating SAML single sign-on`, redirect to `login.microsoftonline.com` or other IdP | Repo EXISTS and is auth-gated. NOT inaccessible. Use PAT + `http` with auth headers, or `gh auth login --hostname <host>` |
70
+ | GHE SAML SSO (http) | `302` redirect to `/login?return_to=...` or IdP URL | Same — repo exists, needs auth. Walk the Strategy Ladder |
71
+ | GHE SAML SSO (git CLI) | `fatal: Authentication failed` or credential prompt | `gh auth login --hostname <host>` or PAT via credential helper |
72
+
73
+ ## SAML SSO — Detailed Pattern
74
+
75
+ GitHub Enterprise instances commonly use SAML SSO via Azure AD (Entra ID), Okta, or other IdPs. When `web_fetch` hits a GHE URL without auth:
76
+
77
+ 1. GHE returns `200 OK` (not 401/403!) with an HTML page
78
+ 2. The HTML contains `Initiating SAML single sign-on` and a redirect URL to the IdP
79
+ 3. The redirect URL includes `SAMLRequest=`, `RelayState=`, and often `login.microsoftonline.com`
80
+ 4. The agent sees HTML content and may conclude the repo is "inaccessible" or "behind SSO"
81
+
82
+ **Detection strings** (check `web_fetch` output for ANY of these):
83
+ ```
84
+ Initiating SAML single sign-on
85
+ login.microsoftonline.com
86
+ You are being redirected to your identity provider
87
+ /login?return_to=
88
+ SAMLRequest=
89
+ RelayState=
90
+ ```
91
+
92
+ **Correct response:** The repo exists. The `web_fetch` path will never work for SSO-protected GHE. Switch to:
93
+ - `gh auth login --hostname <ghe-host>` (if `gh` CLI available)
94
+ - PAT + `http` with `Authorization: token <PAT>` against `<ghe-host>/api/v3/repos/{owner}/{repo}/contents/{path}`
95
+ - Ask user for local clone if no token can be obtained
96
+ | GitLab 2FA enabled | `401` on password auth | PAT is mandatory; 2FA blocks password auth |
97
+ | Expired token | `401` after providing a valid-looking PAT | Generate a new token and check expiry |
98
+ | GitHub rate limit | `403` + body contains `rate limit` | Not an auth failure; wait or authenticate for a higher limit |
99
+ | IP allowlisting | `403` + body mentions IP or org policies | Cannot be fixed programmatically; skip to local clone (Step 5) |
100
+ | Fine-grained PAT scope | `403` + `insufficient scope` | Switch to a classic PAT for org repos |
101
+ | SSH key not in agent | `Permission denied (publickey)` + key file exists | Run `ssh-add ~/.ssh/id_ed25519` |
102
+ | Wrong SSH username | `Permission denied` | Use `git@host`, not `username@host` |
103
+ | Deploy key conflict | `key is already in use` | Use a user SSH key or PAT instead |
104
+
105
+ ## Escalation Decision Rules
106
+
107
+ - Retry the same step for transient failures such as DNS failure, timeout, or `5xx` responses.
108
+ - Escalate to the next strategy step for `401`, `403`, `404`, `Permission denied`, `Authentication failed`, or `Access denied`.
109
+ - Skip directly to Step 5 (local clone) for IP allowlisting, enterprise SSL certificate issues, or org policy blocks.
110
+
111
+ Default interpretation order:
112
+
113
+ 1. Prefer API probes over web page fetches.
114
+ 2. Treat GitHub `404` as ambiguous until valid auth disproves privacy.
115
+ 3. Treat SSH `publickey` errors as key-distribution failures, not repo absence.
116
+ 4. Separate rate limits and org policy blocks from authentication failures before escalating.
@@ -0,0 +1,142 @@
1
+ # Platform Matrix
2
+
3
+ Use this reference when a repository URL reveals the hosting platform and the skill needs platform-specific authentication or cloning guidance. Prefer platform CLI login flows or OS-backed credential helpers over raw PAT handling.
4
+
5
+ ## Platform Detection
6
+
7
+ | URL Pattern | Platform | CLI Tool (optional) | Auth Command | No-CLI Alternative |
8
+ |---|---|---|---|---|
9
+ | `github.com` | GitHub | `gh` | `gh auth login` | PAT + `http` with `Authorization: token <PAT>` |
10
+ | Any custom domain (e.g. `ghe.corp.com`, `github.corp.com`) | GitHub Enterprise | `gh` | `gh auth login --hostname <host>` | PAT + `http` against `<host>/api/v3` |
11
+ | `gitlab.com` | GitLab | `glab` | `glab auth login` | PAT + `http` with `PRIVATE-TOKEN` header |
12
+ | Self-hosted GitLab | GitLab Self-Managed | `glab` | `glab auth login --hostname <host>` | PAT + `http` with `PRIVATE-TOKEN` header |
13
+ | `bitbucket.org` | Bitbucket Cloud | None | N/A | App password + `http` with `Authorization: Bearer` |
14
+ | `dev.azure.com` or `*.visualstudio.com` | Azure DevOps | `az` + GCM | `az login` | PAT + `http` with Basic auth |
15
+ | Gitea instances | Gitea | `tea` (optional) | `tea login add` | PAT + `http` with `Authorization: token` |
16
+ | Unknown or custom domain | Ask user which platform | N/A | N/A | Probe `http` or ask before assuming generic Git |
17
+
18
+ > **Note:** Platform CLIs (`gh`, `glab`, `az`, `tea`) are native binaries, not npm packages. Do NOT use `npx` to install them — it will fail or install unrelated/unofficial packages. When the CLI is unavailable, use the No-CLI Alternative column.
19
+
20
+ ## GitHub / GitHub Enterprise
21
+
22
+ - CLI: `gh auth login` uses a browser or device code flow and can open the browser automatically.
23
+ - GitHub Enterprise CLI: `gh auth login --hostname <host>`.
24
+ - PAT creation: `https://github.com/settings/tokens` for classic tokens.
25
+ - PAT creation: `https://github.com/settings/personal-access-tokens` for fine-grained tokens.
26
+ - Minimum scopes: `repo` for classic PATs (NOTE: `repo` grants read and write — prefer fine-grained PATs with `Contents: Read` for read-only access).
27
+ - Minimum scopes: `Contents: Read` for fine-grained PATs.
28
+ - SSH: `git@github.com:owner/repo.git`.
29
+ - Credential helper: `gh auth setup-git` configures Git to use the GitHub credential flow.
30
+ - Note: Fine-grained PATs may not cover organization-level access or every repo path; classic PATs are still required for some org repos.
31
+ - SAML SSO: PATs often require explicit org authorization from `https://github.com/settings/tokens` after creation.
32
+ - Enterprise note: PAT URLs and token policy can vary by host; reuse the same auth pattern with the enterprise hostname and instance settings pages.
33
+ - Enterprise detection: GHE instances use fully custom domains (e.g. `ghe.coxautoinc.com`, `github.acme.com`). If unsure, probe `https://<host>/api/v3` — a GitHub Enterprise instance returns a JSON response with `installed_version`. Use `gh auth login --hostname <host>` with any custom GHE domain.
34
+
35
+ ## GitLab / GitLab Self-Managed
36
+
37
+ - CLI: `glab auth login` uses a browser-backed OAuth flow.
38
+ - Self-managed CLI: `glab auth login --hostname <host>`.
39
+ - PAT creation: `https://gitlab.com/-/user_settings/personal_access_tokens`.
40
+ - Minimum scopes: `read_repository`.
41
+ - SSH: `git@gitlab.com:owner/repo.git`.
42
+ - Credential helper: `glab auth setup-git` configures Git credential handling.
43
+ - Note: If 2FA is enabled, username/password Git auth is blocked; a PAT is mandatory for HTTPS auth.
44
+ - Self-managed note: PAT URL is typically `https://<host>/-/user_settings/personal_access_tokens` unless the instance customizes settings paths.
45
+
46
+ ## Bitbucket Cloud
47
+
48
+ - CLI: No official first-party CLI OAuth flow for repo auth.
49
+ - PAT/App Password creation: `https://bitbucket.org/{workspace}/settings/app-passwords`.
50
+ - Minimum permissions: `Repositories: Read`.
51
+ - SSH: `git@bitbucket.org:owner/repo.git`.
52
+ - Note: Bitbucket Cloud uses App Passwords rather than standard PAT terminology.
53
+ - Note: HTTPS auth requires both the Bitbucket username and the app password, delivered through a credential helper or `GIT_ASKPASS` script — never embedded in the clone URL.
54
+
55
+ ## Azure DevOps
56
+
57
+ - CLI: `az login` authenticates to Microsoft Entra ID; Git Credential Manager then handles Git credentials automatically.
58
+ - PAT-based auth remains the fallback when Entra ID or GCM is unavailable.
59
+ - PAT creation: `https://dev.azure.com/{org}/_usersSettings/tokens`.
60
+ - Minimum scopes: `Code: Read`.
61
+ - SSH: `git@ssh.dev.azure.com:v3/{org}/{project}/{repo}`.
62
+ - Note: Microsoft Entra ID tokens are generally preferred over PATs in enterprise environments.
63
+ - Credential helper: Git Credential Manager via `git-credential-manager configure`.
64
+ - Legacy host note: Azure DevOps may also appear under `*.visualstudio.com` URLs.
65
+
66
+ ## Gitea / Forgejo
67
+
68
+ - CLI: `tea login add` is available but optional and not universally installed.
69
+ - PAT creation: `https://{host}/user/settings/applications`.
70
+ - Minimum scopes: `repo`.
71
+ - SSH: `git@{host}:owner/repo.git`.
72
+ - Note: Forgejo commonly mirrors the same applications-token path and PAT model as Gitea.
73
+ - Note: Some self-hosted instances rename scopes or disable API token creation, so confirm the instance policy if `repo` is rejected.
74
+
75
+ ## Generic Git (Self-Hosted)
76
+
77
+ - Platform CLI: None assumed.
78
+ - Auth path: Prefer SSH keys first, then PAT if the host documents HTTPS token auth.
79
+ - PAT creation: Ask the user for the platform's PAT or application-token settings URL.
80
+ - SSH: Use the host's documented SSH remote format; do not assume GitHub-style shortcuts if the server advertises a different pattern.
81
+
82
+ ## API File-Read Endpoints (for web-based code access)
83
+
84
+ When agents need to read individual files without cloning, use these authenticated API endpoints.
85
+
86
+ ### GitHub / GitHub Enterprise
87
+
88
+ ```text
89
+ # Read file contents (returns JSON with base64 content)
90
+ GET https://api.github.com/repos/{owner}/{repo}/contents/{path}?ref={branch}
91
+ Authorization: token <PAT>
92
+
93
+ # GHE: replace api.github.com with <ghe-host>/api/v3
94
+ GET https://<ghe-host>/api/v3/repos/{owner}/{repo}/contents/{path}?ref={branch}
95
+
96
+ # Or use gh CLI (auto-authenticated):
97
+ gh api repos/{owner}/{repo}/contents/{path}?ref={branch} --jq '.content' | base64 -d
98
+ ```
99
+
100
+ ### GitLab / GitLab Self-Managed
101
+
102
+ ```text
103
+ # URL-encode the file path (/ becomes %2F)
104
+ GET https://gitlab.com/api/v4/projects/{project-id}/repository/files/{url-encoded-path}/raw?ref={branch}
105
+ PRIVATE-TOKEN: <PAT>
106
+
107
+ # Or use project path instead of ID:
108
+ GET https://gitlab.com/api/v4/projects/{url-encoded-namespace%2Fproject}/repository/files/{url-encoded-path}/raw?ref={branch}
109
+ ```
110
+
111
+ ### Azure DevOps
112
+
113
+ ```text
114
+ GET https://dev.azure.com/{org}/{project}/_apis/git/repositories/{repo}/items?path={path}&api-version=7.0
115
+ Authorization: Basic {base64(:PAT)}
116
+ ```
117
+
118
+ ### Bitbucket Cloud
119
+
120
+ ```text
121
+ GET https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/src/{commit-or-branch}/{path}
122
+ Authorization: Bearer <app-password-or-token>
123
+ ```
124
+ - Note: Self-hosted products often customize auth policy, token names, and minimum scopes.
125
+
126
+ ## Safe Credential Delivery Patterns
127
+
128
+ | Method | Command | Safety |
129
+ |---|---|---|
130
+ | Platform CLI | `gh auth login` / `glab auth login` | Best — handles credential storage |
131
+ | Git Credential Manager | `git credential-manager configure` | Good — OS keychain storage |
132
+ | Environment variable | `GH_TOKEN=xxx gh repo clone ...` | OK — ephemeral; safer than URL tokens but visible to same-user processes |
133
+ | Git askpass | `GIT_ASKPASS=script git clone ...` | OK — no shell history exposure |
134
+ | Inline in URL | `git clone https://token@host/...` | FORBIDDEN — leaks in history/logs |
135
+
136
+ ## Operational Notes
137
+
138
+ - Prefer SSH when the user already has working keys and the host advertises a stable SSH remote format.
139
+ - Prefer platform CLI login for GitHub and GitLab because it also wires Git credential storage.
140
+ - Prefer Git Credential Manager for Azure DevOps and other HTTPS-heavy enterprise setups.
141
+ - When recommending PAT creation, always suggest setting a short expiry (7-30 days for task-specific work). Prefer fine-grained or short-lived tokens.
142
+ - Never recommend pasting tokens inline into clone URLs, scripts checked into the repo, or long-lived shell profiles.
@@ -1 +0,0 @@
1
- const e=`aikit`,t={type:`stdio`,command:`npx`,args:[`-y`,`@vpxa/aikit`,`serve`]},n=[`aikit`,`brainstorming`,`multi-agents-development`,`session-handoff`,`requirements-clarity`,`lesson-learned`,`c4-architecture`,`adr-skill`,`present`,`frontend-design`,`react`,`typescript`,`docs`],r=[`aikit-basic`,`aikit-advanced`,`_epilogue`],i={"chat.agentFilesLocations":{"~/.claude/agents":!1},"github.copilot.chat.copilotMemory.enabled":!0,"chat.customAgentInSubagent.enabled":!0,"chat.useNestedAgentsMdFiles":!0,"chat.useAgentSkills":!0,"github.copilot.chat.switchAgent.enabled":!0,"workbench.browser.enableChatTools":!0,"chat.mcp.apps.enabled":!0,"chat.instructionsFilesLocations":{"~/.copilot/instructions":!0,".github/instructions":!0}};export{i as a,n as i,t as n,e as r,r as t};