@vpxa/aikit 0.1.307 → 0.1.309
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.
- package/package.json +1 -1
- package/packages/cli/dist/index.js +4 -4
- package/packages/cli/dist/{init-CyjUXjQw.js → init-VP9ig7OK.js} +1 -1
- package/packages/cli/dist/{templates-BQ1J4HzY.js → templates-WsJg6Pkc.js} +5 -5
- package/packages/server/dist/bin.js +1 -1
- package/packages/server/dist/index.js +1 -1
- package/packages/server/dist/repair-json-B6Q_HRoP.js +3 -0
- package/packages/server/dist/repair-json-D4mft_HA.js +4 -0
- package/packages/server/dist/{server-B_KbLM43.js → server-DZKWh8ZG.js} +176 -170
- package/packages/server/dist/{server-utMi-Qu3.js → server-RV1UYywi.js} +177 -169
- package/packages/server/dist/{server-http-B-TDT3t-.js → server-http-DeWcQphZ.js} +1 -1
- package/packages/server/dist/{server-http-BbuuthEP.js → server-http-Dk16rq4T.js} +1 -1
- package/packages/server/dist/server-stdio-Bx_Aa99F.js +1 -0
- package/packages/server/dist/server-stdio-CebgeeBc.js +2 -0
- package/packages/server/dist/{version-check-DSWaugPC.js → version-check-CdBHTxtt.js} +1 -1
- package/packages/server/dist/{version-check-6qDKknz4.js → version-check-CggUKvv8.js} +1 -1
- package/scaffold/INSTRUCTIONS.md +273 -0
- package/scaffold/dist/adapters/copilot.mjs +2 -9
- package/scaffold/dist/adapters/hermes-agent.mjs +2 -2
- package/scaffold/dist/adapters/hermes.mjs +8 -4
- package/scaffold/dist/adapters/hooks.mjs +1 -1
- package/scaffold/dist/adapters/intellij.mjs +7 -3
- package/scaffold/dist/adapters/skills.mjs +3 -1
- package/scaffold/dist/adapters/zed.mjs +6 -2
- package/scaffold/dist/definitions/agents.mjs +2 -2
- package/scaffold/dist/definitions/bodies.mjs +98 -369
- package/scaffold/dist/definitions/flows.mjs +6 -6
- package/scaffold/dist/definitions/prompts.mjs +12 -12
- package/scaffold/dist/definitions/protocols.mjs +117 -556
- package/scaffold/dist/definitions/skills/adr-skill.mjs +41 -197
- package/scaffold/dist/definitions/skills/aikit.mjs +52 -205
- package/scaffold/dist/definitions/skills/brainstorming.mjs +74 -112
- package/scaffold/dist/definitions/skills/browser-use.mjs +128 -184
- package/scaffold/dist/definitions/skills/c4-architecture.mjs +45 -106
- package/scaffold/dist/definitions/skills/docs.mjs +236 -380
- package/scaffold/dist/definitions/skills/frontend-design.mjs +96 -193
- package/scaffold/dist/definitions/skills/lesson-learned.mjs +57 -184
- package/scaffold/dist/definitions/skills/multi-agents-development.mjs +98 -408
- package/scaffold/dist/definitions/skills/present.mjs +193 -1
- package/scaffold/dist/definitions/skills/react.mjs +68 -111
- package/scaffold/dist/definitions/skills/repo-access.mjs +24 -169
- package/scaffold/dist/definitions/skills/requirements-clarity.mjs +45 -94
- package/scaffold/dist/definitions/skills/typescript.mjs +162 -230
- package/packages/server/dist/server-stdio-BUb39kqq.js +0 -2
- package/packages/server/dist/server-stdio-Ch7yAxNk.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var e=[{file:`references/error-patterns.md`,content:'# Repo Access Error Patterns\n\nUse this reference to distinguish missing repositories from authentication and policy failures when probing Git hosts.\n\n## HTTP Status Code Matrix\n\n| Platform | No auth (private repo) | Wrong credentials | Rate limited | SSO required |\n|---|---|---|---|---|\n| GitHub REST API | `404` (TRAP!) | `401` -> `403` | `403` + rate limit body | `403` + `X-GitHub-SSO` header |\n| GitHub Web | HTML "Page not found" or login redirect | Login redirect | - | - |\n| GitLab | `401` | `401` | `429` | `401` (PAT mandatory) |\n| Bitbucket | `403` | `403` | `429` | `403` |\n| Azure DevOps | `401` | `401` | - | `401` |\n\n## CRITICAL: The GitHub 404 Trap\n\nGitHub deliberately returns `404`, not `401`, for private repositories accessed without authentication.\nThis is by design to avoid leaking whether a repository exists.\n\n- Never conclude a GitHub repository does not exist from an unauthenticated `404`.\n- `GET https://api.github.com/repos/{owner}/{repo}` without auth returns `404` for both "repo truly missing" and "repo exists but is private".\n- The only reliable disambiguation is an authenticated probe.\n- If the same request still returns `404` with valid auth, the repository is truly missing.\n\nProbe order:\n\n1. Try the authenticated API request first.\n2. If it returns `200`, access works.\n3. If it returns `404` without auth context, treat it as ambiguous and recover.\n4. If it returns `404` with known-good auth, treat the repo as missing.\n\n## Git CLI Stderr Patterns\n\n| Error Text Pattern | Platform | Diagnosis | Action |\n|---|---|---|---|\n| `remote: Repository not found.` | GitHub | Auth failure, not proof the repo is missing | Try auth strategies |\n| `git@github.com: Permission denied (publickey).` | GitHub | SSH key not recognized | Check SSH keys, try HTTPS |\n| `remote: HTTP Basic: Access denied.` | GitLab | Auth failure, 2FA likely | Use PAT; password auth is blocked with 2FA |\n| `error: The requested URL returned error: 403` | Bitbucket | Auth failure | Try app password |\n| `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 |\n| `fatal: Authentication failed for \'https://...\'` | Any (HTTPS) | General auth failure | Escalate through the strategy ladder |\n| `Permission denied (publickey).` | Any (SSH) | SSH key not recognized | Check `~/.ssh/`, run `ssh-add`, try HTTPS |\n| `fatal: Could not read from remote repository.` | Any (SSH) | SSH access denied | Verify the SSH key is added to the platform |\n| `unable to access \'...\': SSL certificate problem` | Any | Self-signed or enterprise CA issue | Ask about local cert config; skip to local clone if needed |\n\nTreat these stderr strings as direct signals from tool output. Do not reinterpret GitHub\'s `Repository not found` as a clean existence check.\n\n## web_fetch / http Tool Detection\n\n- `web_fetch` against a private GitHub repo URL often returns HTML with "Page not found" or a login page.\n- GitHub web responses can be `200` with a 404-looking body, so `web_fetch` is unreliable for auth diagnosis.\n- `http` against the platform API gives machine-readable bodies and real status codes, so use it for probes.\n- 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.\n\nRecommended diagnostic probe:\n\n```text\nhttp GET https://api.github.com/repos/{owner}/{repo}\n-> 404 + no auth header -> might be private\n-> 401 -> explicit auth failure\n-> 200 -> repo is public, access works\n```\n\n## Edge Cases\n\n| Edge Case | Signal | Response |\n|---|---|---|\n| GitHub.com SAML SSO | `403` + `X-GitHub-SSO: required; url=...` | PAT needs SSO authorization for the org |\n| 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>` |\n| GHE SAML SSO (http) | `302` redirect to `/login?return_to=...` or IdP URL | Same — repo exists, needs auth. Walk the Strategy Ladder |\n| GHE SAML SSO (git CLI) | `fatal: Authentication failed` or credential prompt | `gh auth login --hostname <host>` or PAT via credential helper |\n\n## SAML SSO — Detailed Pattern\n\nGitHub Enterprise instances commonly use SAML SSO via Azure AD (Entra ID), Okta, or other IdPs. When `web_fetch` hits a GHE URL without auth:\n\n1. GHE returns `200 OK` (not 401/403!) with an HTML page\n2. The HTML contains `Initiating SAML single sign-on` and a redirect URL to the IdP\n3. The redirect URL includes `SAMLRequest=`, `RelayState=`, and often `login.microsoftonline.com`\n4. The agent sees HTML content and may conclude the repo is "inaccessible" or "behind SSO"\n\n**Detection strings** (check `web_fetch` output for ANY of these):\n```\nInitiating SAML single sign-on\nlogin.microsoftonline.com\nYou are being redirected to your identity provider\n/login?return_to=\nSAMLRequest=\nRelayState=\n```\n\n**Correct response:** The repo exists. The `web_fetch` path will never work for SSO-protected GHE. Switch to:\n- `gh auth login --hostname <ghe-host>` (if `gh` CLI available)\n- PAT + `http` with `Authorization: token <PAT>` against `<ghe-host>/api/v3/repos/{owner}/{repo}/contents/{path}`\n- Ask user for local clone if no token can be obtained\n| GitLab 2FA enabled | `401` on password auth | PAT is mandatory; 2FA blocks password auth |\n| Expired token | `401` after providing a valid-looking PAT | Generate a new token and check expiry |\n| GitHub rate limit | `403` + body contains `rate limit` | Not an auth failure; wait or authenticate for a higher limit |\n| IP allowlisting | `403` + body mentions IP or org policies | Cannot be fixed programmatically; skip to local clone (Step 5) |\n| Fine-grained PAT scope | `403` + `insufficient scope` | Switch to a classic PAT for org repos |\n| SSH key not in agent | `Permission denied (publickey)` + key file exists | Run `ssh-add ~/.ssh/id_ed25519` |\n| Wrong SSH username | `Permission denied` | Use `git@host`, not `username@host` |\n| Deploy key conflict | `key is already in use` | Use a user SSH key or PAT instead |\n\n## Escalation Decision Rules\n\n- Retry the same step for transient failures such as DNS failure, timeout, or `5xx` responses.\n- Escalate to the next strategy step for `401`, `403`, `404`, `Permission denied`, `Authentication failed`, or `Access denied`.\n- Skip directly to Step 5 (local clone) for IP allowlisting, enterprise SSL certificate issues, or org policy blocks.\n\nDefault interpretation order:\n\n1. Prefer API probes over web page fetches.\n2. Treat GitHub `404` as ambiguous until valid auth disproves privacy.\n3. Treat SSH `publickey` errors as key-distribution failures, not repo absence.\n4. Separate rate limits and org policy blocks from authentication failures before escalating.'},{file:`references/platform-matrix.md`,content:"# Platform Matrix\n\nUse 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.\n\n## Platform Detection\n\n| URL Pattern | Platform | CLI Tool (optional) | Auth Command | No-CLI Alternative |\n|---|---|---|---|---|\n| `github.com` | GitHub | `gh` | `gh auth login` | PAT + `http` with `Authorization: token <PAT>` |\n| 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` |\n| `gitlab.com` | GitLab | `glab` | `glab auth login` | PAT + `http` with `PRIVATE-TOKEN` header |\n| Self-hosted GitLab | GitLab Self-Managed | `glab` | `glab auth login --hostname <host>` | PAT + `http` with `PRIVATE-TOKEN` header |\n| `bitbucket.org` | Bitbucket Cloud | None | N/A | App password + `http` with `Authorization: Bearer` |\n| `dev.azure.com` or `*.visualstudio.com` | Azure DevOps | `az` + GCM | `az login` | PAT + `http` with Basic auth |\n| Gitea instances | Gitea | `tea` (optional) | `tea login add` | PAT + `http` with `Authorization: token` |\n| Unknown or custom domain | Ask user which platform | N/A | N/A | Probe `http` or ask before assuming generic Git |\n\n> **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.\n\n## GitHub / GitHub Enterprise\n\n- CLI: `gh auth login` uses a browser or device code flow and can open the browser automatically.\n- GitHub Enterprise CLI: `gh auth login --hostname <host>`.\n- PAT creation: `https://github.com/settings/tokens` for classic tokens.\n- PAT creation: `https://github.com/settings/personal-access-tokens` for fine-grained tokens.\n- Minimum scopes: `repo` for classic PATs (NOTE: `repo` grants read and write — prefer fine-grained PATs with `Contents: Read` for read-only access).\n- Minimum scopes: `Contents: Read` for fine-grained PATs.\n- SSH: `git@github.com:owner/repo.git`.\n- Credential helper: `gh auth setup-git` configures Git to use the GitHub credential flow.\n- Note: Fine-grained PATs may not cover organization-level access or every repo path; classic PATs are still required for some org repos.\n- SAML SSO: PATs often require explicit org authorization from `https://github.com/settings/tokens` after creation.\n- Enterprise note: PAT URLs and token policy can vary by host; reuse the same auth pattern with the enterprise hostname and instance settings pages.\n- 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.\n\n## GitLab / GitLab Self-Managed\n\n- CLI: `glab auth login` uses a browser-backed OAuth flow.\n- Self-managed CLI: `glab auth login --hostname <host>`.\n- PAT creation: `https://gitlab.com/-/user_settings/personal_access_tokens`.\n- Minimum scopes: `read_repository`.\n- SSH: `git@gitlab.com:owner/repo.git`.\n- Credential helper: `glab auth setup-git` configures Git credential handling.\n- Note: If 2FA is enabled, username/password Git auth is blocked; a PAT is mandatory for HTTPS auth.\n- Self-managed note: PAT URL is typically `https://<host>/-/user_settings/personal_access_tokens` unless the instance customizes settings paths.\n\n## Bitbucket Cloud\n\n- CLI: No official first-party CLI OAuth flow for repo auth.\n- PAT/App Password creation: `https://bitbucket.org/{workspace}/settings/app-passwords`.\n- Minimum permissions: `Repositories: Read`.\n- SSH: `git@bitbucket.org:owner/repo.git`.\n- Note: Bitbucket Cloud uses App Passwords rather than standard PAT terminology.\n- 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.\n\n## Azure DevOps\n\n- CLI: `az login` authenticates to Microsoft Entra ID; Git Credential Manager then handles Git credentials automatically.\n- PAT-based auth remains the fallback when Entra ID or GCM is unavailable.\n- PAT creation: `https://dev.azure.com/{org}/_usersSettings/tokens`.\n- Minimum scopes: `Code: Read`.\n- SSH: `git@ssh.dev.azure.com:v3/{org}/{project}/{repo}`.\n- Note: Microsoft Entra ID tokens are generally preferred over PATs in enterprise environments.\n- Credential helper: Git Credential Manager via `git-credential-manager configure`.\n- Legacy host note: Azure DevOps may also appear under `*.visualstudio.com` URLs.\n\n## Gitea / Forgejo\n\n- CLI: `tea login add` is available but optional and not universally installed.\n- PAT creation: `https://{host}/user/settings/applications`.\n- Minimum scopes: `repo`.\n- SSH: `git@{host}:owner/repo.git`.\n- Note: Forgejo commonly mirrors the same applications-token path and PAT model as Gitea.\n- Note: Some self-hosted instances rename scopes or disable API token creation, so confirm the instance policy if `repo` is rejected.\n\n## Generic Git (Self-Hosted)\n\n- Platform CLI: None assumed.\n- Auth path: Prefer SSH keys first, then PAT if the host documents HTTPS token auth.\n- PAT creation: Ask the user for the platform's PAT or application-token settings URL.\n- SSH: Use the host's documented SSH remote format; do not assume GitHub-style shortcuts if the server advertises a different pattern.\n\n## API File-Read Endpoints (for web-based code access)\n\nWhen agents need to read individual files without cloning, use these authenticated API endpoints.\n\n### GitHub / GitHub Enterprise\n\n```text\n# Read file contents (returns JSON with base64 content)\nGET https://api.github.com/repos/{owner}/{repo}/contents/{path}?ref={branch}\nAuthorization: token <PAT>\n\n# GHE: replace api.github.com with <ghe-host>/api/v3\nGET https://<ghe-host>/api/v3/repos/{owner}/{repo}/contents/{path}?ref={branch}\n\n# Or use gh CLI (auto-authenticated):\ngh api repos/{owner}/{repo}/contents/{path}?ref={branch} --jq '.content' | base64 -d\n```\n\n### GitLab / GitLab Self-Managed\n\n```text\n# URL-encode the file path (/ becomes %2F)\nGET https://gitlab.com/api/v4/projects/{project-id}/repository/files/{url-encoded-path}/raw?ref={branch}\nPRIVATE-TOKEN: <PAT>\n\n# Or use project path instead of ID:\nGET https://gitlab.com/api/v4/projects/{url-encoded-namespace%2Fproject}/repository/files/{url-encoded-path}/raw?ref={branch}\n```\n\n### Azure DevOps\n\n```text\nGET https://dev.azure.com/{org}/{project}/_apis/git/repositories/{repo}/items?path={path}&api-version=7.0\nAuthorization: Basic {base64(:PAT)}\n```\n\n### Bitbucket Cloud\n\n```text\nGET https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/src/{commit-or-branch}/{path}\nAuthorization: Bearer <app-password-or-token>\n```\n- Note: Self-hosted products often customize auth policy, token names, and minimum scopes.\n\n## Safe Credential Delivery Patterns\n\n| Method | Command | Safety |\n|---|---|---|\n| Platform CLI | `gh auth login` / `glab auth login` | Best — handles credential storage |\n| Git Credential Manager | `git credential-manager configure` | Good — OS keychain storage |\n| Environment variable | `GH_TOKEN=xxx gh repo clone ...` | OK — ephemeral; safer than URL tokens but visible to same-user processes |\n| Git askpass | `GIT_ASKPASS=script git clone ...` | OK — no shell history exposure |\n| Inline in URL | `git clone https://token@host/...` | FORBIDDEN — leaks in history/logs |\n\n## Operational Notes\n\n- Prefer SSH when the user already has working keys and the host advertises a stable SSH remote format.\n- Prefer platform CLI login for GitHub and GitLab because it also wires Git credential storage.\n- Prefer Git Credential Manager for Azure DevOps and other HTTPS-heavy enterprise setups.\n- When recommending PAT creation, always suggest setting a short expiry (7-30 days for task-specific work). Prefer fine-grained or short-lived tokens.\n- Never recommend pasting tokens inline into clone URLs, scripts checked into the repo, or long-lived shell profiles."},{file:`SKILL.md`,content:`---
|
|
2
2
|
name: repo-access
|
|
3
|
-
description: "Progressive repository access recovery for private and enterprise git repositories. Triggered
|
|
3
|
+
description: "Progressive repository access recovery for private and enterprise git repositories. Triggered by clone/fetch/pull auth errors, repo URL web_fetch/http auth failures, private/internal repo mentions, or requests involving GitHub Enterprise, GitLab Self-Managed, Bitbucket Server, or Azure DevOps. Guides safe recovery from anonymous HTTPS through SSH/CLI/PAT/local clone/browser auth."
|
|
4
4
|
metadata:
|
|
5
5
|
category: cross-cutting
|
|
6
6
|
domain: general
|
|
@@ -14,185 +14,40 @@ argument-hint: "Repository URL or error message"
|
|
|
14
14
|
|
|
15
15
|
# Repository Access Recovery
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Recover repo access without leaking credentials. Use when git/http/web_fetch indicates private, enterprise, SSO, or auth failure.
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Detect
|
|
20
20
|
|
|
21
|
-
|
|
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\`.
|
|
21
|
+
Triggers: 401, 403, 404 on private repo, Authentication failed, Permission denied (publickey), SSO required, login HTML, empty repo page, enterprise host, internal/private repo wording.
|
|
60
22
|
|
|
61
23
|
## Strategy Ladder
|
|
62
24
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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, FAIL -> Step 6.
|
|
93
|
-
|
|
94
|
-
### Step 6: Browser-Based Auth Recovery
|
|
95
|
-
|
|
96
|
-
- Goal: use the AI Kit browser tool to authenticate through login walls, SAML SSO, or OAuth flows that block all CLI paths.
|
|
97
|
-
- Prerequisite: **load the \`browser-use\` skill** before proceeding.
|
|
98
|
-
- What to do:
|
|
99
|
-
1. \`browser({ action: 'open', url: repoUrl, mode: 'ui' })\` — open the target resource in the browser.
|
|
100
|
-
2. \`browser({ action: 'read', pageId })\` — check if login form, SSO redirect, or content appears.
|
|
101
|
-
3. If SSO/OAuth login form → interact using \`browser({ action: 'act', pageId, kind: 'click' | 'type', ... })\` (ask user for credentials, NEVER guess).
|
|
102
|
-
4. If 2FA prompt → ask user for code via elicitation → \`browser({ action: 'act', pageId, kind: 'type', ... })\` to enter it.
|
|
103
|
-
5. Once authenticated → extract content via \`browser({ action: 'read', pageId })\` or \`browser({ action: 'eval', pageId, code })\`.
|
|
104
|
-
6. For ongoing CLI access → extract session cookies:
|
|
105
|
-
\`\`\`javascript
|
|
106
|
-
browser({ action: 'session', sessionAction: 'cookies', pageId })
|
|
107
|
-
\`\`\`
|
|
108
|
-
7. Use extracted cookies with the \`http\` tool: \`http({ url, headers: { Cookie: '...' } })\`.
|
|
109
|
-
- Verify: content is accessible via browser tools; SUCCESS -> stop.
|
|
110
|
-
- If browser-based auth also fails → the resource genuinely requires manual user intervention outside the agent workflow. Inform the user.
|
|
111
|
-
|
|
112
|
-
> **Security:** Never store extracted cookies in code, commits, or logs. Warn the user that cookies are auth tokens that expire.
|
|
113
|
-
|
|
114
|
-
## Security Rules (HARD GATE)
|
|
115
|
-
|
|
116
|
-
- NEVER include a PAT in a git URL; it leaks into shell history, process lists, logs, and config.
|
|
117
|
-
- NEVER repeat a user's token value in chat output, summaries, examples, or when relaying tool output that may contain credentials.
|
|
118
|
-
- Use env vars, credential helpers, or platform login tools for token delivery.
|
|
119
|
-
- Recommend minimum scopes only: read-only repo scopes, not broad write/admin scopes.
|
|
120
|
-
- Prefer ephemeral credentials, OAuth/device flows, or short-lived tokens over long-lived PATs.
|
|
121
|
-
- When guiding PAT creation, recommend the shortest feasible expiry (7–30 days for task-specific work).
|
|
122
|
-
|
|
123
|
-
## After Access Is Established
|
|
124
|
-
|
|
125
|
-
- Remind the user to revoke single-use PATs once the task is complete.
|
|
126
|
-
- If credentials were stored via a credential helper, note that they persist until manually removed or the token expires.
|
|
127
|
-
|
|
128
|
-
## Web-Based Code Access (web_fetch / http)
|
|
129
|
-
|
|
130
|
-
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.
|
|
131
|
-
|
|
132
|
-
### Common URL Patterns That Fail on Private Repos
|
|
133
|
-
|
|
134
|
-
| URL Pattern | Platform | What Happens |
|
|
135
|
-
|---|---|---|
|
|
136
|
-
| \`raw.githubusercontent.com/{owner}/{repo}/{ref}/{path}\` | GitHub | \`404\` — no auth header accepted |
|
|
137
|
-
| \`github.com/{owner}/{repo}/blob/{ref}/{path}\` | GitHub web view | \`200\` with login HTML, not code |
|
|
138
|
-
| \`api.github.com/repos/{owner}/{repo}/contents/{path}\` | GitHub API | \`404\` (the GitHub 404 trap) |
|
|
139
|
-
| \`<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 |
|
|
140
|
-
| \`gitlab.com/{owner}/{repo}/-/raw/{ref}/{path}\` | GitLab | \`401\` or login redirect |
|
|
141
|
-
| \`dev.azure.com/{org}/{project}/_apis/git/repositories/{repo}/items\` | Azure DevOps | \`401\` or \`203\` non-authoritative |
|
|
142
|
-
|
|
143
|
-
### SAML SSO Detection (CRITICAL)
|
|
144
|
-
|
|
145
|
-
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:
|
|
146
|
-
|
|
147
|
-
- \`Initiating SAML single sign-on\`
|
|
148
|
-
- \`login.microsoftonline.com\` (Azure AD / Entra ID)
|
|
149
|
-
- \`You are being redirected to your identity provider\`
|
|
150
|
-
- \`/login?return_to=\`
|
|
151
|
-
- \`SAMLRequest=\`
|
|
152
|
-
- \`RelayState=\`
|
|
153
|
-
|
|
154
|
-
If ANY of these appear → the repo exists and is accessible, it just needs authentication. This is NOT "inaccessible" — follow the Strategy Ladder.
|
|
155
|
-
|
|
156
|
-
### Recovery: Authenticated API Reads
|
|
157
|
-
|
|
158
|
-
When \`web_fetch\` fails on a private repo URL, switch to authenticated \`http\` calls:
|
|
159
|
-
|
|
160
|
-
1. **Ensure auth is established first** — walk the Strategy Ladder (Steps 1-4) to get working credentials.
|
|
161
|
-
2. **Use the platform API with auth headers**, not raw/web URLs:
|
|
25
|
+
1. Normalize URL and identify host/platform.
|
|
26
|
+
2. Try anonymous HTTPS/read-only when public access may work.
|
|
27
|
+
3. Check local clone/workspace before remote auth work.
|
|
28
|
+
4. Try SSH if keys are available and host supports it.
|
|
29
|
+
5. Try platform CLI auth when installed/configured.
|
|
30
|
+
6. Ask user for PAT/token only when needed; never echo it.
|
|
31
|
+
7. If browser login/SSO is required, load browser-use.
|
|
162
32
|
|
|
163
|
-
|
|
164
|
-
|---|---|---|
|
|
165
|
-
| GitHub / GHE | \`http GET https://api.github.com/repos/{owner}/{repo}/contents/{path}?ref={branch}\` | \`Authorization: token <PAT>\` or use \`gh api\` |
|
|
166
|
-
| GitLab | \`http GET https://gitlab.com/api/v4/projects/{id}/repository/files/{path}/raw?ref={branch}\` | \`PRIVATE-TOKEN: <PAT>\` |
|
|
167
|
-
| 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)>\` |
|
|
168
|
-
| Bitbucket | \`http GET https://api.bitbucket.org/2.0/repositories/{owner}/{repo}/src/{ref}/{path}\` | \`Authorization: Bearer <token>\` |
|
|
33
|
+
Stop climbing once access works. Record working method and scope.
|
|
169
34
|
|
|
170
|
-
|
|
171
|
-
4. **For bulk reads**, prefer \`git clone --depth 1\` over many individual API calls — it's faster and avoids rate limits.
|
|
172
|
-
5. **NEVER embed tokens in URLs** — use auth headers via the \`http\` tool or \`gh api\` CLI wrapper.
|
|
35
|
+
## Safety
|
|
173
36
|
|
|
174
|
-
|
|
37
|
+
- Never print secrets, cookies, tokens, or full auth headers.
|
|
38
|
+
- Prefer least privilege: read-only before write scopes.
|
|
39
|
+
- Ask before changing git remotes or credential helpers.
|
|
40
|
+
- Do not bypass org policy or SSO controls.
|
|
41
|
+
- Treat 404 on private hosts as possible auth failure, not proof repo is absent.
|
|
175
42
|
|
|
176
|
-
|
|
177
|
-
|---|---|
|
|
178
|
-
| Need 1-3 specific files | Authenticated API via \`http\` |
|
|
179
|
-
| Need to browse/search the repo | \`git clone --depth 1\` (shallow) |
|
|
180
|
-
| Need file history or blame | \`git clone\` |
|
|
181
|
-
| No terminal available | Authenticated API via \`http\` with PAT |
|
|
182
|
-
| Rate-limited on API | \`git clone --depth 1\` |
|
|
43
|
+
## Diagnostics
|
|
183
44
|
|
|
184
|
-
|
|
45
|
+
Capture command/tool, URL host (not secret), status/error, auth method attempted, and next safe option. Use http/web_fetch before browser unless page requires JS/login.
|
|
185
46
|
|
|
186
|
-
|
|
187
|
-
| --- | --- |
|
|
188
|
-
| \`git_context\` | Check local repo state and confirm a clone or fallback checkout is usable |
|
|
189
|
-
| \`http\` | Probe platform APIs for auth diagnostics AND read file contents from private repos with auth headers |
|
|
190
|
-
| \`web_fetch\` | Only for public repos or after confirming access works; unreliable for private repos (returns HTML, not code) |
|
|
191
|
-
| \`web_search\` | Find current platform-specific auth documentation when the host is unusual or self-managed |
|
|
192
|
-
| Terminal | Run git commands, SSH tests, CLI auth flows, and credential-helper setup |
|
|
47
|
+
## References
|
|
193
48
|
|
|
194
|
-
|
|
49
|
+
Load references/error-patterns.md for exact failure mapping. Load references/platform-matrix.md for GitHub/GitLab/Bitbucket/Azure differences.
|
|
195
50
|
|
|
196
|
-
##
|
|
51
|
+
## Output
|
|
197
52
|
|
|
198
|
-
|
|
53
|
+
Return access status, method used or blocker, safe next step, and any user action needed.`}];export{e as default};
|
|
@@ -12,38 +12,46 @@ metadata:
|
|
|
12
12
|
|
|
13
13
|
# Requirements Clarity
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Use before planning/implementation when requirements are vague, large, cross-team, user-facing, or likely to fork. Skip for clear bug fixes, exact file edits, or mechanical changes.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
- Specific file paths mentioned (e.g., "auth.go:45")
|
|
19
|
-
- Code snippets or existing functions/classes referenced
|
|
20
|
-
- Bug fixes with clear reproduction steps
|
|
21
|
-
- Task is a single-file change with obvious scope
|
|
17
|
+
## First Questions
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
Ask early unless already answered:
|
|
20
|
+
1. Why is this needed now? (YAGNI)
|
|
21
|
+
2. What simpler version would still solve it? (KISS)
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
Then ask only critical missing questions.
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
## Score
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
27
|
+
0-39: unclear goal or user.
|
|
28
|
+
40-69: goal known, major behavior/scope gaps remain.
|
|
29
|
+
70-89: mostly clear, some edge cases/acceptance gaps.
|
|
30
|
+
90-100: implementable with acceptance criteria, scope, constraints, and validation path.
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
Do not proceed to plan/implementation below 90 unless user explicitly accepts risk.
|
|
35
33
|
|
|
36
|
-
|
|
34
|
+
## Clarify Dimensions
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
36
|
+
- User/persona and job-to-be-done.
|
|
37
|
+
- Exact behavior and non-goals.
|
|
38
|
+
- Inputs/outputs/data ownership.
|
|
39
|
+
- Error/empty/loading/security/privacy cases.
|
|
40
|
+
- Success metrics and acceptance tests.
|
|
41
|
+
- Constraints: deadline, compatibility, migration, dependencies.
|
|
42
|
+
- Rollout/rollback and observability.
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
## Output
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
Return current score, knowns, unknowns, 1-3 questions, and simplest viable scope. When score reaches 90+, provide implementation-ready brief and hand off to brainstorming/planning if design choices remain.
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
## References
|
|
49
|
+
|
|
50
|
+
Load on demand:
|
|
51
|
+
- references/scoring-guide.md — Full scoring rubric (0-100), calibration examples per category, expert probing techniques, iterate-until flow.
|
|
52
|
+
`},{file:`references/scoring-guide.md`,content:`# Scoring Guide
|
|
53
|
+
|
|
54
|
+
## Full Scoring Rubric (0-100)
|
|
47
55
|
|
|
48
56
|
| Category | Points | Criteria |
|
|
49
57
|
|----------|--------|----------|
|
|
@@ -52,7 +60,7 @@ Assess the requirement against this rubric:
|
|
|
52
60
|
| Implementation Completeness | /25 | Edge cases (8), error handling (9), data validation (8) |
|
|
53
61
|
| Business Context | /20 | Problem statement (7), target users (7), success metrics (6) |
|
|
54
62
|
|
|
55
|
-
|
|
63
|
+
## Calibration Examples
|
|
56
64
|
|
|
57
65
|
**Functional Clarity 10/10:**
|
|
58
66
|
"User clicks Submit -> system validates email format (RFC 5322), checks uniqueness against users table, returns 201 with serialized user object (id, email, createdAt) or 422 with field-level errors array [{field, code, message}]"
|
|
@@ -72,9 +80,7 @@ Assess the requirement against this rubric:
|
|
|
72
80
|
**Edge Cases 2/8:**
|
|
73
81
|
"Handle errors appropriately"
|
|
74
82
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
For each gap category, ask focused questions that reveal hidden requirements:
|
|
83
|
+
## Expert Probing Techniques
|
|
78
84
|
|
|
79
85
|
**For edge cases:** Ask about empty states, concurrent access, partial failures, permission boundaries, rate limits, timezone/locale behavior, offline/degraded mode, data migration from existing state.
|
|
80
86
|
|
|
@@ -86,9 +92,8 @@ For each gap category, ask focused questions that reveal hidden requirements:
|
|
|
86
92
|
|
|
87
93
|
**For business context:** Ask "Who loses money if this breaks?", "What's the rollback plan?", "How will you know this is working in production?"
|
|
88
94
|
|
|
89
|
-
|
|
95
|
+
## Iterate Until >= 90
|
|
90
96
|
|
|
91
|
-
For each clarification round:
|
|
92
97
|
1. Score the current requirement.
|
|
93
98
|
2. Identify the 2-3 highest-impact gaps.
|
|
94
99
|
3. Ask focused questions for one category at a time.
|
|
@@ -96,76 +101,22 @@ For each clarification round:
|
|
|
96
101
|
5. Capture clarified details in a working outline.
|
|
97
102
|
6. Repeat until the score is at least 90.
|
|
98
103
|
|
|
99
|
-
Prefer short, targeted questions over long questionnaires. Build on previous answers
|
|
100
|
-
|
|
101
|
-
**HARD RULE:** Do not generate the requirements document with a score below 90.
|
|
104
|
+
Prefer short, targeted questions over long questionnaires. Build on previous answers.
|
|
102
105
|
|
|
103
|
-
|
|
106
|
+
HARD RULE: Do not generate the requirements document with a score below 90.
|
|
104
107
|
|
|
105
|
-
|
|
106
|
-
- **NEVER skip the YAGNI check** - 40% of requirements are premature. Ask "what happens if we ship without this?" first
|
|
107
|
-
- **NEVER ask more than 3 questions per round** - cognitive overload causes shallow answers. Depth > breadth.
|
|
108
|
-
- **NEVER accept "edge cases: handle errors appropriately"** - this means "I haven't thought about it." Push for specific scenarios.
|
|
109
|
-
- **NEVER generate the document below score 90** - incomplete requirements cause more rework than taking time to clarify
|
|
110
|
-
- **NEVER repeat questions the user already answered** - build on previous responses, reference what they said
|
|
111
|
-
- **NEVER score above 80 without concrete acceptance criteria** - if you can't write a test for it, it's not a requirement
|
|
108
|
+
## Generating the Document
|
|
112
109
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
- If a flow is active: \`flow({ action: 'status' })\` → write to \`{{artifacts_path}}/requirements.md\`
|
|
117
|
-
- If no flow active: write to \`.spec/{feature_name}/requirements.md\`
|
|
118
|
-
|
|
119
|
-
To detect active flow:
|
|
120
|
-
\`\`\`
|
|
121
|
-
const flowStatus = flow({ action: 'status' });
|
|
122
|
-
if (flowStatus.active) {
|
|
123
|
-
// Output to: .flows/{topic}/.spec/requirements.md
|
|
124
|
-
outputPath = \`\${flowStatus.artifactsPath}/requirements.md\`;
|
|
125
|
-
} else {
|
|
126
|
-
outputPath = \`.spec/\${featureName}/requirements.md\`;
|
|
127
|
-
}
|
|
128
|
-
\`\`\`
|
|
129
|
-
|
|
130
|
-
Use \`create_file\` to save the document after the score reaches 90 or higher.
|
|
110
|
+
When score reaches 90+:
|
|
111
|
+
- Flow-aware: write to \`{{artifacts_path}}/requirements.md\`
|
|
112
|
+
- No flow: write to \`.spec/{feature_name}/requirements.md\`
|
|
131
113
|
|
|
132
114
|
Required structure:
|
|
133
|
-
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
- Constraints
|
|
141
|
-
- Risk assessment
|
|
142
|
-
- **Acceptance Criteria**
|
|
143
|
-
- Functional acceptance checkboxes
|
|
144
|
-
- Quality standards
|
|
145
|
-
- User acceptance
|
|
146
|
-
- **Execution Phases**
|
|
147
|
-
- Preparation
|
|
148
|
-
- Core development
|
|
149
|
-
- Integration and testing
|
|
150
|
-
- Deployment
|
|
151
|
-
|
|
152
|
-
Each section must contain concrete, implementation-ready content. Do not leave placeholders.
|
|
153
|
-
|
|
154
|
-
Footer fields:
|
|
155
|
-
- Document Version
|
|
156
|
-
- Created timestamp
|
|
157
|
-
- Clarification Rounds count
|
|
158
|
-
- Quality Score /100
|
|
159
|
-
|
|
160
|
-
**After writing:** Also store a compact summary in flow-scoped knowledge for downstream step consumption:
|
|
161
|
-
\`\`\`
|
|
162
|
-
knowledge({
|
|
163
|
-
action: "remember",
|
|
164
|
-
scope: "flow",
|
|
165
|
-
category: "context",
|
|
166
|
-
title: "Requirements: <feature>",
|
|
167
|
-
content: "Score: <X>/100\\nKey Requirements:\\n- <req1>\\n- <req2>\\nAcceptance Criteria:\\n- <criteria1>\\nConstraints:\\n- <constraint1>"
|
|
168
|
-
})
|
|
169
|
-
\`\`\`
|
|
170
|
-
This ensures downstream steps (Spec, Plan, Implementation) can access requirements via \`withdraw\` even without reading the file.
|
|
115
|
+
- Requirements Description (background, feature overview, detailed requirements, edge cases)
|
|
116
|
+
- Design Decisions (technical approach, constraints, risk assessment)
|
|
117
|
+
- Acceptance Criteria (functional, quality, user acceptance)
|
|
118
|
+
- Execution Phases (preparation, core dev, integration, deployment)
|
|
119
|
+
- Footer: version, timestamp, clarification rounds, quality score
|
|
120
|
+
|
|
121
|
+
Also store compact summary in flow-scoped knowledge for downstream consumption.
|
|
171
122
|
`}];export{e as default};
|