-
Notifications
You must be signed in to change notification settings - Fork 0
Add top-level CLI tab and intro page feature section #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
acdbe9b
6ac5631
d42be04
0167f79
70f0252
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| --- | ||
| title: "Authentication" | ||
| description: "How the Linkrunner CLI authenticates with your account" | ||
| icon: "key" | ||
| --- | ||
|
|
||
| The CLI uses **API keys** to authenticate with the Linkrunner API. There are two ways to obtain a key: the device login flow (recommended) or manual key creation from the dashboard. | ||
|
|
||
| ## Device Login Flow | ||
|
|
||
| When you run `lr login`, the CLI uses an OAuth2 Device Authorization flow: | ||
|
|
||
| 1. The CLI requests a **user code** from the Linkrunner API | ||
| 2. You are shown a code (e.g. `BVKD-3NH7`) and a URL to open in your browser | ||
| 3. You open the URL, log into the Linkrunner dashboard, and authorize the code | ||
| 4. The CLI polls for approval and receives an API key automatically | ||
|
|
||
| ``` | ||
| $ lr login | ||
|
|
||
| Your device code: BVKD-3NH7 | ||
|
|
||
| Open this URL to authorize: | ||
| https://dashboard.linkrunner.io/cli/auth?code=BVKD-3NH7 | ||
|
|
||
| Waiting for authorization... | ||
|
|
||
| ✔ Logged in successfully! | ||
| ``` | ||
|
|
||
| <Note> | ||
| The device code expires after **10 minutes**. If it expires, run `lr login` again to get a new code. | ||
| </Note> | ||
|
|
||
| ## API Keys | ||
|
|
||
| Each login creates an API key that is stored locally. Keys have the prefix `lr_cli_` and can be managed from the Linkrunner dashboard. | ||
|
|
||
| ### Key Properties | ||
|
|
||
| | Property | Description | | ||
| |---|---| | ||
| | **Prefix** | Starts with `lr_cli_` (first 12 chars visible in dashboard) | | ||
| | **Label** | Optional name for identification (auto-set to "CLI Login" for device flow) | | ||
| | **Last Used** | Timestamp of the most recent API call | | ||
| | **Created** | When the key was generated | | ||
|
|
||
| ### Managing Keys from the Dashboard | ||
|
|
||
| Go to **Settings > CLI Keys** in the Linkrunner dashboard to: | ||
|
|
||
| - **View** all active CLI API keys and when they were last used | ||
| - **Create** a new key manually (useful for CI/CD or shared environments) | ||
| - **Revoke** a key to immediately invalidate it | ||
|
|
||
| <Warning> | ||
| Revoking a key is permanent. Any CLI session using that key will need to re-authenticate with `lr login`. | ||
| </Warning> | ||
|
|
||
| ### Creating Keys for CI/CD | ||
|
|
||
| For automated environments where interactive login isn't possible, create a key manually: | ||
|
|
||
| 1. Go to **Settings > CLI Keys** in the dashboard | ||
| 2. Click **Create New Key** | ||
| 3. Copy the key (it's only shown once) | ||
| 4. Set it as an environment variable: | ||
|
|
||
| ```bash | ||
| export LINKRUNNER_API_KEY=lr_cli_... | ||
| ``` | ||
|
|
||
| The CLI automatically picks up the `LINKRUNNER_API_KEY` environment variable when no stored session exists. | ||
|
|
||
| ## Credential Storage | ||
|
|
||
| Your API key is stored in a local config file managed by [conf](https://github.com/sindresorhus/conf): | ||
|
|
||
| - **macOS:** `~/Library/Preferences/linkrunner-nodejs/config.json` | ||
| - **Linux:** `~/.config/linkrunner-nodejs/config.json` | ||
| - **Windows:** `%APPDATA%/linkrunner-nodejs/config.json` | ||
|
Comment on lines
+75
to
+81
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check what login.mdx says is stored
echo "=== login.mdx credential storage documentation ==="
rg -n -A 5 "## Credential Storage" cli/commands/login.mdx
# Check for any other references to what's stored
echo -e "\n=== References to 'auth token' in CLI docs ==="
rg -n "auth token" cli/
echo -e "\n=== References to 'API key' storage ==="
rg -n "API key.*stored|stored.*API key" cli/Repository: linkrunner-labs/docs Length of output: 1599 Inconsistent credential terminology across documentation. This section refers to the stored credential as "Your API key", but Both reference the same config file with identical paths. Clarify whether "API key" and "auth token" refer to the same credential, or if this documentation is incorrect. Align terminology across all files. 🤖 Prompt for AI Agents |
||
|
|
||
| ## Logout | ||
|
|
||
| To clear your stored credentials: | ||
|
|
||
| ```bash | ||
| lr logout | ||
| ``` | ||
|
|
||
| This removes the locally stored API key but does **not** revoke it on the server. To fully revoke access, also delete the key from **Settings > CLI Keys** in the dashboard. | ||
|
|
||
| ## Security | ||
|
|
||
| - API keys are hashed (SHA-256) before storage on the server — the raw key is never stored | ||
| - Keys are scoped to your user account, not individual projects | ||
| - The device flow codes use an ambiguity-excluded character set to avoid typos | ||
| - Device codes are single-use and expire after 10 minutes | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,168 @@ | ||
| --- | ||
| title: "CI/CD Integration" | ||
| description: "Use the Linkrunner CLI in your CI/CD pipelines" | ||
| icon: "rotate" | ||
| --- | ||
|
|
||
| ## Overview | ||
|
|
||
| The Linkrunner CLI supports CI/CD workflows through two key features: | ||
|
|
||
| - **`--ci` flag** -- commands exit with code 0 (pass) or 1 (fail) instead of remaining interactive | ||
| - **`--json` flag** -- structured JSON output for machine parsing | ||
|
|
||
| These flags are available on `lr doctor`, `lr validate`, `lr analyze`, and `lr test`. | ||
|
|
||
| ## Exit Codes | ||
|
|
||
| | Code | Meaning | | ||
| |---|---| | ||
| | `0` | All checks passed (no errors) | | ||
| | `1` | One or more errors found | | ||
|
|
||
| By default, warnings do not cause a non-zero exit. Add `--fail-on-warn` to treat warnings as failures. | ||
|
|
||
| ## Commands for CI | ||
|
|
||
| ### lr doctor --ci | ||
|
|
||
| Validates platform configuration and source code: | ||
|
|
||
| ```bash | ||
| # Fail on errors only | ||
| lr doctor --ci | ||
|
|
||
| # Fail on errors AND warnings | ||
| lr doctor --ci --fail-on-warn | ||
| ``` | ||
|
|
||
| ### lr test --ci | ||
|
|
||
| Verifies API connectivity and token validity: | ||
|
|
||
| ```bash | ||
| lr test --ci | ||
| ``` | ||
|
|
||
| ### lr analyze --ci | ||
|
|
||
| Runs standard checks plus AI-powered deep analysis: | ||
|
|
||
| ```bash | ||
| lr analyze --ci --fail-on-warn | ||
| ``` | ||
|
|
||
| ## Pipeline Examples | ||
|
|
||
| ### GitHub Actions | ||
|
|
||
| ```yaml | ||
| name: Linkrunner SDK Check | ||
| on: [push, pull_request] | ||
|
|
||
| jobs: | ||
| sdk-check: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
|
|
||
| - name: Install Linkrunner CLI | ||
| run: npm install -g linkrunner-cli | ||
|
|
||
| - name: Validate SDK integration | ||
| run: lr doctor --ci --fail-on-warn | ||
|
|
||
| - name: Test API connectivity | ||
| run: lr test --ci | ||
| ``` | ||
|
|
||
| ### GitLab CI | ||
|
|
||
| ```yaml | ||
| sdk-check: | ||
| image: node:20 | ||
| script: | ||
| - npm install -g linkrunner-cli | ||
| - lr doctor --ci --fail-on-warn | ||
| - lr test --ci | ||
| ``` | ||
|
|
||
| ### Bitbucket Pipelines | ||
|
|
||
| ```yaml | ||
| pipelines: | ||
| default: | ||
| - step: | ||
| name: SDK Validation | ||
| image: node:20 | ||
| script: | ||
| - npm install -g linkrunner-cli | ||
| - lr doctor --ci --fail-on-warn | ||
| ``` | ||
|
|
||
| ## JSON Output | ||
|
|
||
| Use `--json` to get machine-readable output for custom processing: | ||
|
|
||
| ```bash | ||
| lr doctor --json | jq '.summary.errors' | ||
| ``` | ||
|
|
||
| The JSON structure for `lr doctor --json`: | ||
|
|
||
| ```json | ||
| { | ||
| "project": { | ||
| "type": "flutter", | ||
| "sdkVersion": "3.2.1", | ||
| "root": "/path/to/project" | ||
| }, | ||
| "results": [ | ||
| { | ||
| "id": "check-id", | ||
| "name": "Check name", | ||
| "status": "pass", | ||
| "severity": "error", | ||
| "message": "Description", | ||
| "fix": "Suggested fix", | ||
| "autoFixable": false, | ||
| "docsUrl": "https://..." | ||
| } | ||
| ], | ||
| "summary": { | ||
| "passed": 5, | ||
| "warnings": 1, | ||
| "errors": 0 | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Combining Flags | ||
|
|
||
| You can combine `--ci` and `--json` for both structured output and exit codes: | ||
|
|
||
| ```bash | ||
| # Get JSON output AND exit code | ||
| lr doctor --ci --json > results.json | ||
| echo "Exit code: $?" | ||
| ``` | ||
|
|
||
| ## Requirements | ||
|
|
||
| - The project must contain a `.linkrunner.json` file (for `lr test`) or recognizable project files (for `lr doctor`) | ||
| - No interactive prompts are shown when `--ci` or `--json` is used | ||
| - `lr test` and `lr status` require a `.linkrunner.json` file created by `lr init` | ||
|
|
||
| <Note> | ||
| For CI environments, run `lr init` locally first and commit the `.linkrunner.json` file to your repository. The CLI reads this file to identify your project during CI runs. | ||
| </Note> | ||
|
|
||
| ## Related | ||
|
|
||
| - [lr doctor](/cli/commands/doctor) -- full diagnostics reference | ||
| - [lr test](/cli/commands/test) -- API connectivity checks | ||
| - [lr analyze](/cli/commands/analyze) -- AI-powered analysis |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,105 @@ | ||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||
| title: "lr analyze" | ||||||||||||||||||||||||
| description: "Run AI-powered deep analysis of your SDK integration" | ||||||||||||||||||||||||
| icon: "robot" | ||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ## Usage | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||
| lr analyze [options] | ||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ## Description | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| Runs all standard `lr doctor` checks plus an AI-powered deep analysis of your codebase. This is equivalent to running `lr doctor --deep`. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| The AI analysis inspects your source code for subtle integration issues, incorrect usage patterns, missing best practices, and platform-specific problems that pattern-based checks cannot catch. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| <Note>Requires authentication. Run `lr login` first.</Note> | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ## Options | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| | Flag | Description | | ||||||||||||||||||||||||
| |---|---| | ||||||||||||||||||||||||
| | `--json` | Output results as JSON | | ||||||||||||||||||||||||
| | `--ci` | Exit with code 0 (pass) or 1 (fail) | | ||||||||||||||||||||||||
| | `--fail-on-warn` | Treat warnings as failures in CI mode | | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ## What It Does | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| 1. Runs all standard platform configuration checks (same as `lr doctor`) | ||||||||||||||||||||||||
| 2. Runs source code pattern scanning (same as `lr doctor`) | ||||||||||||||||||||||||
| 3. Sends project context to an AI model for deep analysis | ||||||||||||||||||||||||
| 4. Reports any additional issues found by the AI, including: | ||||||||||||||||||||||||
| - File path and line number of the issue | ||||||||||||||||||||||||
| - Severity level (error, warn, or info) | ||||||||||||||||||||||||
| - Suggested fix | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ## Examples | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ### Basic analysis | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||
| lr analyze | ||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||
| Linkrunner Doctor | ||||||||||||||||||||||||
| Diagnosing your SDK integration... | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| Project: react-native (SDK v2.3.0) | ||||||||||||||||||||||||
| Root: /path/to/project | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ── Platform Configuration ── | ||||||||||||||||||||||||
| ✔ rn-linkrunner found in package.json | ||||||||||||||||||||||||
| ... | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ── Source Code ── | ||||||||||||||||||||||||
| ✔ init() call found | ||||||||||||||||||||||||
| ... | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ── Deep Analysis (AI-powered) ── | ||||||||||||||||||||||||
| ✘ [src/App.tsx:15] init() called outside useEffect - may run on every render | ||||||||||||||||||||||||
| Fix: Move init() inside a useEffect with an empty dependency array | ||||||||||||||||||||||||
| ⚠ [src/screens/Payment.tsx:42] capturePayment amount is hardcoded | ||||||||||||||||||||||||
| Fix: Use the actual transaction amount from your payment provider | ||||||||||||||||||||||||
| ✔ No additional issues found by AI analysis. | ||||||||||||||||||||||||
|
Comment on lines
+62
to
+67
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Example output contradicts itself. Line 63–67 lists AI findings and then says “No additional issues found,” which is confusing. Remove that line or move it to a no‑findings example. ✂️ Suggested fix- ✔ No additional issues found by AI analysis.📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ### JSON output for scripting | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||
| lr analyze --json | ||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| The JSON output includes a `deepAnalysis` array in addition to the standard `results`: | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ```json | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| "project": { "type": "react-native", "sdkVersion": "2.3.0", "root": "..." }, | ||||||||||||||||||||||||
| "results": [...], | ||||||||||||||||||||||||
| "summary": { "passed": 5, "warnings": 1, "errors": 1 }, | ||||||||||||||||||||||||
| "deepAnalysis": [ | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| "file": "src/App.tsx", | ||||||||||||||||||||||||
| "line": 15, | ||||||||||||||||||||||||
| "severity": "error", | ||||||||||||||||||||||||
| "message": "init() called outside useEffect", | ||||||||||||||||||||||||
| "fix": "Move init() inside a useEffect with an empty dependency array" | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ### In CI | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||
| lr analyze --ci --fail-on-warn | ||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ## Related | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - [lr doctor](/cli/commands/doctor) -- standard diagnostics without AI analysis | ||||||||||||||||||||||||
| - [lr suggest](/cli/commands/suggest) -- AI-powered feature suggestions | ||||||||||||||||||||||||
| - [CI/CD Integration](/cli/ci-cd) -- pipeline examples | ||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: linkrunner-labs/docs
Length of output: 1971
Authentication flow in this section is incorrect—contradicts actual implementation documented in cli/commands/login.mdx and other files.
This section documents an OAuth2 Device Authorization flow where users receive a device code in the CLI and authorize it in the browser. However,
cli/commands/login.mdx,cli/quickstart.mdx,cli/installation.mdx, andcli/troubleshooting.mdxall consistently document a magic link email flow:These flows are incompatible. The device code approach here appears outdated or incorrect. Update this section to match the actual magic link authentication flow, or clarify if this file documents a different/legacy flow.
🤖 Prompt for AI Agents