Merge remote-tracking branch 'origin/main' into pe/autoformat-results
This commit is contained in:
commit
77c51f4268
152 changed files with 3589 additions and 2251 deletions
21
.github/actions/run-vscode-e2e-test/action.yml
vendored
21
.github/actions/run-vscode-e2e-test/action.yml
vendored
|
|
@ -1,25 +1,25 @@
|
|||
name: 'Run VS Code E2E Test'
|
||||
description: 'Run a single VS Code E2E test with all required setup'
|
||||
name: "Run VS Code E2E Test"
|
||||
description: "Run a single VS Code E2E test with all required setup"
|
||||
inputs:
|
||||
test_file:
|
||||
description: 'E2E test file to run'
|
||||
description: "E2E test file to run"
|
||||
required: true
|
||||
command:
|
||||
description: 'Command to run (e2e:ci:run or e2e:ci:run-yaml)'
|
||||
description: "Command to run (e2e:ci:run or e2e:ci:run-yaml)"
|
||||
required: true
|
||||
ssh_key:
|
||||
description: 'SSH private key for testing'
|
||||
description: "SSH private key for testing"
|
||||
required: false
|
||||
ssh_host:
|
||||
description: 'SSH host for testing'
|
||||
description: "SSH host for testing"
|
||||
required: false
|
||||
is_fork:
|
||||
description: 'Whether this is a fork (affects SSH tests)'
|
||||
description: "Whether this is a fork (affects SSH tests)"
|
||||
required: false
|
||||
default: 'false'
|
||||
default: "false"
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
using: "composite"
|
||||
steps:
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
|
|
@ -58,6 +58,7 @@ runs:
|
|||
cd core
|
||||
npm ci
|
||||
cd ../extensions/vscode
|
||||
npm ci
|
||||
npm run e2e:ci:download
|
||||
else
|
||||
cd core
|
||||
|
|
@ -131,4 +132,4 @@ runs:
|
|||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: e2e-logs-${{ steps.sanitize_filename.outputs.sanitized_test_file || 'unknown' }}-${{ inputs.command == 'e2e:ci:run-yaml' && 'yaml' || 'json' }}
|
||||
path: extensions/vscode/e2e.log
|
||||
path: extensions/vscode/e2e.log
|
||||
|
|
|
|||
170
.github/workflows/auto-fix-failed-tests.yml
vendored
Normal file
170
.github/workflows/auto-fix-failed-tests.yml
vendored
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
name: Auto Fix Failed Tests
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["PR Checks", "CLI PR Checks"]
|
||||
types:
|
||||
- completed
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
issues: write
|
||||
actions: read
|
||||
|
||||
jobs:
|
||||
fix-failed-tests:
|
||||
# Only run if the workflow failed
|
||||
# DISABLED: Remove 'false && ' on the next line to enable auto-fixing
|
||||
if: false && github.event.workflow_run.conclusion == 'failure'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Get workflow run details
|
||||
id: workflow-details
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const workflowRun = context.payload.workflow_run;
|
||||
const { data: jobs } = await github.rest.actions.listJobsForWorkflowRun({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: workflowRun.id
|
||||
});
|
||||
|
||||
// Find all failed jobs since we're only monitoring specific test workflows
|
||||
const failedJobs = jobs.jobs.filter(job => job.conclusion === 'failure');
|
||||
|
||||
if (failedJobs.length === 0) {
|
||||
core.info('No failed jobs found');
|
||||
return null;
|
||||
}
|
||||
|
||||
core.setOutput('has_failed_tests', 'true');
|
||||
core.setOutput('workflow_name', workflowRun.name);
|
||||
core.setOutput('workflow_run_id', workflowRun.id);
|
||||
core.setOutput('head_branch', workflowRun.head_branch);
|
||||
core.setOutput('head_sha', workflowRun.head_sha);
|
||||
core.setOutput('failed_jobs', JSON.stringify(failedJobs.map(j => j.name)));
|
||||
|
||||
return failedJobs;
|
||||
|
||||
- name: Get job logs for failed tests
|
||||
if: steps.workflow-details.outputs.has_failed_tests == 'true'
|
||||
id: get-logs
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const workflowRunId = ${{ github.event.workflow_run.id }};
|
||||
const { data: jobs } = await github.rest.actions.listJobsForWorkflowRun({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: workflowRunId
|
||||
});
|
||||
|
||||
let errorLogs = '';
|
||||
|
||||
for (const job of jobs.jobs) {
|
||||
if (job.conclusion === 'failure') {
|
||||
try {
|
||||
const { data: logData } = await github.rest.actions.downloadJobLogsForWorkflowRun({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
job_id: job.id
|
||||
});
|
||||
|
||||
errorLogs += `\n\n=== Job: ${job.name} ===\n`;
|
||||
errorLogs += logData;
|
||||
} catch (error) {
|
||||
core.warning(`Could not fetch logs for job ${job.name}: ${error.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Store logs in environment file for next step
|
||||
const fs = require('fs');
|
||||
fs.writeFileSync('/tmp/test_failure_logs.txt', errorLogs);
|
||||
|
||||
core.setOutput('has_logs', errorLogs.length > 0 ? 'true' : 'false');
|
||||
|
||||
- name: Checkout repository
|
||||
if: steps.workflow-details.outputs.has_failed_tests == 'true'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
fetch-depth: 0
|
||||
ref: ${{ steps.workflow-details.outputs.head_sha }}
|
||||
|
||||
- name: Setup Node.js
|
||||
if: steps.workflow-details.outputs.has_failed_tests == 'true'
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
- name: Install Continue CLI globally
|
||||
if: steps.workflow-details.outputs.has_failed_tests == 'true'
|
||||
run: npm i -g @continuedev/cli
|
||||
|
||||
- name: Start remote session to fix failed tests
|
||||
if: steps.workflow-details.outputs.has_failed_tests == 'true'
|
||||
id: remote-session
|
||||
env:
|
||||
CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }}
|
||||
run: |
|
||||
# Create a detailed prompt for fixing the failed tests
|
||||
cat > /tmp/fix_tests_prompt.txt << 'PROMPT_EOF'
|
||||
🔧 **Auto Test Fix Request**
|
||||
|
||||
The following tests failed in workflow "${{ steps.workflow-details.outputs.workflow_name }}" (Run ID: ${{ steps.workflow-details.outputs.workflow_run_id }}):
|
||||
|
||||
**Failed Jobs:** ${{ steps.workflow-details.outputs.failed_jobs }}
|
||||
**Branch:** ${{ steps.workflow-details.outputs.head_branch }}
|
||||
**Commit:** ${{ steps.workflow-details.outputs.head_sha }}
|
||||
|
||||
**Your Task:**
|
||||
1. Analyze the test failure logs and error messages
|
||||
2. Identify the root cause of the test failures
|
||||
3. Fix the failing tests by updating the test code or the underlying implementation
|
||||
4. Ensure all tests pass after your changes
|
||||
5. Commit your fixes with a descriptive message
|
||||
|
||||
**Test Failure Context:**
|
||||
Please examine the repository structure, run the failing tests locally to understand the errors, and implement appropriate fixes.
|
||||
|
||||
Focus on:
|
||||
- Understanding what the tests are trying to validate
|
||||
- Identifying why they're failing (code changes, environment issues, test logic errors)
|
||||
- Making minimal, targeted fixes that address the root cause
|
||||
- Ensuring the fixes don't break other functionality
|
||||
|
||||
Please start by examining the failing tests and their error messages, then proceed with the necessary fixes.
|
||||
PROMPT_EOF
|
||||
|
||||
echo "Starting Continue CLI remote session for test fixes..."
|
||||
echo "Prompt content:"
|
||||
cat /tmp/fix_tests_prompt.txt
|
||||
|
||||
# Start remote session and capture JSON output
|
||||
SESSION_OUTPUT=$(cat /tmp/fix_tests_prompt.txt | cn remote -s --branch ${{ steps.workflow-details.outputs.head_branch }})
|
||||
echo "Raw session output: $SESSION_OUTPUT"
|
||||
|
||||
# Extract URL from JSON output
|
||||
SESSION_URL=$(echo "$SESSION_OUTPUT" | jq -r '.url // empty')
|
||||
|
||||
if [ -z "$SESSION_URL" ] || [ "$SESSION_URL" = "null" ]; then
|
||||
echo "Failed to extract session URL from output: $SESSION_OUTPUT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "session_url=$SESSION_URL" >> $GITHUB_OUTPUT
|
||||
echo "✅ Started remote session: $SESSION_URL"
|
||||
|
||||
- name: Log session details
|
||||
if: steps.workflow-details.outputs.has_failed_tests == 'true'
|
||||
run: |
|
||||
echo "✅ Successfully started auto-fix session for failed tests"
|
||||
echo "Workflow: ${{ steps.workflow-details.outputs.workflow_name }}"
|
||||
echo "Run ID: ${{ steps.workflow-details.outputs.workflow_run_id }}"
|
||||
echo "Branch: ${{ steps.workflow-details.outputs.head_branch }}"
|
||||
echo "Session URL: ${{ steps.remote-session.outputs.session_url }}"
|
||||
echo "Failed jobs: ${{ steps.workflow-details.outputs.failed_jobs }}"
|
||||
2
.github/workflows/beta-release.yml
vendored
2
.github/workflows/beta-release.yml
vendored
|
|
@ -24,7 +24,7 @@ jobs:
|
|||
token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: 20
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
|
|
|||
5
.github/workflows/cli-pr-checks.yml
vendored
5
.github/workflows/cli-pr-checks.yml
vendored
|
|
@ -25,7 +25,7 @@ jobs:
|
|||
uses: actions/checkout@v5
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: 20
|
||||
cache: "npm"
|
||||
|
|
@ -59,6 +59,7 @@ jobs:
|
|||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
node-version: [18, 20, 22, 24]
|
||||
fail-fast: false
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
|
|
@ -66,7 +67,7 @@ jobs:
|
|||
uses: actions/checkout@v5
|
||||
|
||||
- name: Setup Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
|
|
|
|||
4
.github/workflows/compliance.yaml
vendored
4
.github/workflows/compliance.yaml
vendored
|
|
@ -41,7 +41,7 @@ jobs:
|
|||
|
||||
- name: Add PR title guidance comment
|
||||
if: always() && steps.pr-title-check.outputs.valid == 'false'
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const { data: comments } = await github.rest.issues.listComments({
|
||||
|
|
@ -104,7 +104,7 @@ jobs:
|
|||
uses: actions/checkout@v5
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: "npm"
|
||||
|
|
|
|||
4
.github/workflows/jetbrains-release.yaml
vendored
4
.github/workflows/jetbrains-release.yaml
vendored
|
|
@ -152,7 +152,7 @@ jobs:
|
|||
|
||||
# # Setup Node.js
|
||||
- name: Use Node.js from .nvmrc
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
|
|
@ -370,7 +370,7 @@ jobs:
|
|||
|
||||
# 2. Install npm dependencies
|
||||
- name: Use Node.js from .nvmrc
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
|
|
|
|||
2
.github/workflows/label-merged-prs.yml
vendored
2
.github/workflows/label-merged-prs.yml
vendored
|
|
@ -44,7 +44,7 @@ jobs:
|
|||
|
||||
- name: Determine and apply tier label
|
||||
if: steps.check-author.outputs.should_label == 'true'
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const pr = context.payload.pull_request;
|
||||
|
|
|
|||
2
.github/workflows/main.yaml
vendored
2
.github/workflows/main.yaml
vendored
|
|
@ -70,7 +70,7 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
|
|
|
|||
6
.github/workflows/pr-checks.yaml
vendored
6
.github/workflows/pr-checks.yaml
vendored
|
|
@ -23,7 +23,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
|
|
@ -224,7 +224,7 @@ jobs:
|
|||
test_file_matrix: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
|
|
@ -342,7 +342,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
|
|
|
|||
4
.github/workflows/preview.yaml
vendored
4
.github/workflows/preview.yaml
vendored
|
|
@ -70,7 +70,7 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
|
|
@ -165,7 +165,7 @@ jobs:
|
|||
|
||||
# 4. Create PR with version bump
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
|
|
|
|||
58
.github/workflows/respond-to-cubic.yaml
vendored
58
.github/workflows/respond-to-cubic.yaml
vendored
|
|
@ -29,7 +29,7 @@ jobs:
|
|||
|
||||
- name: Add eyes reaction to comment
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
await github.rest.reactions.createForIssueComment({
|
||||
|
|
@ -49,7 +49,7 @@ jobs:
|
|||
- name: Get PR information
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
id: pr-info
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const { data: pr } = await github.rest.pulls.get({
|
||||
|
|
@ -69,7 +69,7 @@ jobs:
|
|||
|
||||
- name: Setup Node.js
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ jobs:
|
|||
|
||||
- name: Comment with session URL
|
||||
if: steps.check-mention.outputs.contains_mention == 'true' && steps.remote-session.outputs.session_url
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const commentBody = `I've started [a remote session](${{ steps.remote-session.outputs.session_url }}) to help with your request:
|
||||
|
|
@ -144,7 +144,7 @@ jobs:
|
|||
|
||||
- name: Add eyes reaction to comment
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
await github.rest.reactions.createForPullRequestReviewComment({
|
||||
|
|
@ -164,7 +164,7 @@ jobs:
|
|||
|
||||
- name: Setup Node.js
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
|
|
@ -172,21 +172,59 @@ jobs:
|
|||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
run: npm i -g @continuedev/cli
|
||||
|
||||
- name: Get review context
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
id: review-context
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
let reviewContext = '';
|
||||
|
||||
// Check if this comment is a reply to another review comment
|
||||
if (context.payload.comment.in_reply_to_id) {
|
||||
try {
|
||||
const { data: originalComment } = await github.rest.pulls.getReviewComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
comment_id: context.payload.comment.in_reply_to_id
|
||||
});
|
||||
|
||||
reviewContext = `**Original review comment by @${originalComment.user.login}:**
|
||||
${originalComment.body}
|
||||
|
||||
**Reply by @${{ github.event.comment.user.login }}:**
|
||||
${{ github.event.comment.body }}`;
|
||||
} catch (error) {
|
||||
console.log('Could not fetch original comment, using current comment only');
|
||||
reviewContext = `**Review comment by @${{ github.event.comment.user.login }}:**
|
||||
${{ github.event.comment.body }}`;
|
||||
}
|
||||
} else {
|
||||
reviewContext = `**Review comment by @${{ github.event.comment.user.login }}:**
|
||||
${{ github.event.comment.body }}`;
|
||||
}
|
||||
|
||||
core.setOutput('context', reviewContext);
|
||||
|
||||
- name: Start remote session
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
id: remote-session
|
||||
env:
|
||||
CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }}
|
||||
run: |
|
||||
# Debug: Echo the branch we're starting the session on
|
||||
echo "Starting remote session on branch: ${{ github.event.pull_request.head.ref }}"
|
||||
|
||||
# Create a temporary file for the prompt to handle special characters and newlines properly
|
||||
cat > /tmp/prompt.txt << 'PROMPT_EOF'
|
||||
Please help with the following code review comment from @${{ github.event.comment.user.login }} on PR #${{ github.event.pull_request.number }}:
|
||||
Please help with the following code review discussion from PR #${{ github.event.pull_request.number }}:
|
||||
|
||||
**File:** ${{ github.event.comment.path }}
|
||||
**Line:** ${{ github.event.comment.line || github.event.comment.original_line || 'N/A' }}
|
||||
**Comment:** ${{ github.event.comment.body }}
|
||||
|
||||
Please analyze the specific file and line mentioned, understand the review feedback, implement the necessary changes, and commit them to this branch.
|
||||
${{ steps.review-context.outputs.context }}
|
||||
|
||||
Please analyze the specific file and line mentioned, understand the review feedback and any discussion context, implement the necessary changes, and commit them to this branch.
|
||||
PROMPT_EOF
|
||||
|
||||
# Debug output
|
||||
|
|
@ -211,7 +249,7 @@ jobs:
|
|||
|
||||
- name: Comment with session URL
|
||||
if: steps.check-mention.outputs.contains_mention == 'true' && steps.remote-session.outputs.session_url
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const commentBody = `I've started [a remote session](${{ steps.remote-session.outputs.session_url }}) to help with your request:
|
||||
|
|
|
|||
2
.github/workflows/reusable-release.yml
vendored
2
.github/workflows/reusable-release.yml
vendored
|
|
@ -55,7 +55,7 @@ jobs:
|
|||
uses: ./.github/actions/setup-packages
|
||||
|
||||
- name: Use Node.js from .nvmrc
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
|
|
|
|||
6
.github/workflows/similar-issues.yml
vendored
6
.github/workflows/similar-issues.yml
vendored
|
|
@ -31,7 +31,7 @@ jobs:
|
|||
path: deja-view
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ jobs:
|
|||
echo "confidence=$CONFIDENCE" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Comment with analysis
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
let comment = '';
|
||||
|
|
@ -307,7 +307,7 @@ jobs:
|
|||
|
||||
- name: Add labels
|
||||
if: github.event_name == 'issues'
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const labels = [];
|
||||
|
|
|
|||
2
.github/workflows/stable-release.yml
vendored
2
.github/workflows/stable-release.yml
vendored
|
|
@ -40,7 +40,7 @@ jobs:
|
|||
token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: 20
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
|
|
|||
2
.github/workflows/stale-issue-helper.yaml
vendored
2
.github/workflows/stale-issue-helper.yaml
vendored
|
|
@ -10,7 +10,7 @@ jobs:
|
|||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v9
|
||||
- uses: actions/stale@v10
|
||||
with:
|
||||
close-issue-message: "This issue was closed because it wasn't updated for 10 days after being marked stale. If it's still important, please reopen + comment and we'll gladly take another look!"
|
||||
stale-issue-message: "This issue hasn't been updated in 90 days and will be closed after an additional 10 days without activity. If it's still important, please leave a comment and share any new information that would help us address the issue."
|
||||
|
|
|
|||
2
.github/workflows/vscode-version-bump.yml
vendored
2
.github/workflows/vscode-version-bump.yml
vendored
|
|
@ -21,7 +21,7 @@ jobs:
|
|||
gh auth login --with-token <<< "${{ github.token }}"
|
||||
|
||||
- name: Use Node.js from .nvmrc
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
|
|
|
|||
|
|
@ -59,27 +59,17 @@ export class ConfigHandler {
|
|||
|
||||
constructor(
|
||||
private readonly ide: IDE,
|
||||
private ideSettingsPromise: Promise<IdeSettings>,
|
||||
private llmLogger: ILLMLogger,
|
||||
sessionInfoPromise: Promise<ControlPlaneSessionInfo | undefined>,
|
||||
initialSessionInfoPromise: Promise<ControlPlaneSessionInfo | undefined>,
|
||||
) {
|
||||
this.ide = ide;
|
||||
this.ideSettingsPromise = ideSettingsPromise;
|
||||
|
||||
this.controlPlaneClient = new ControlPlaneClient(
|
||||
sessionInfoPromise,
|
||||
ideSettingsPromise,
|
||||
this.ide.getIdeInfo(),
|
||||
initialSessionInfoPromise,
|
||||
this.ide,
|
||||
);
|
||||
|
||||
// This profile manager will always be available
|
||||
this.globalLocalProfileManager = new ProfileLifecycleManager(
|
||||
new LocalProfileLoader(
|
||||
ide,
|
||||
ideSettingsPromise,
|
||||
this.controlPlaneClient,
|
||||
this.llmLogger,
|
||||
),
|
||||
new LocalProfileLoader(ide, this.controlPlaneClient, this.llmLogger),
|
||||
this.ide,
|
||||
);
|
||||
|
||||
|
|
@ -97,6 +87,7 @@ export class ConfigHandler {
|
|||
}
|
||||
|
||||
private workspaceDirs: string[] | null = null;
|
||||
|
||||
async getWorkspaceId() {
|
||||
if (!this.workspaceDirs) {
|
||||
this.workspaceDirs = await this.ide.getWorkspaceDirs();
|
||||
|
|
@ -113,6 +104,13 @@ export class ConfigHandler {
|
|||
const signal = this.cascadeAbortController.signal;
|
||||
this.workspaceDirs = null; // forces workspace dirs reload
|
||||
|
||||
// Always update globalLocalProfileManager before recreating all the loaders
|
||||
// during every cascadeInit so it holds the most recent controlPlaneClient.
|
||||
this.globalLocalProfileManager = new ProfileLifecycleManager(
|
||||
new LocalProfileLoader(this.ide, this.controlPlaneClient, this.llmLogger),
|
||||
this.ide,
|
||||
);
|
||||
|
||||
try {
|
||||
const { orgs, errors } = await this.getOrgs();
|
||||
|
||||
|
|
@ -248,7 +246,6 @@ export class ConfigHandler {
|
|||
versionSlug: assistant.configResult.config?.version ?? "latest",
|
||||
controlPlaneClient: this.controlPlaneClient,
|
||||
ide: this.ide,
|
||||
ideSettingsPromise: this.ideSettingsPromise,
|
||||
llmLogger: this.llmLogger,
|
||||
rawYaml: assistant.rawYaml,
|
||||
orgScopeId: orgScopeId,
|
||||
|
|
@ -369,7 +366,6 @@ export class ConfigHandler {
|
|||
const profiles = [...assistantFiles, ...agentFiles].map((assistant) => {
|
||||
return new LocalProfileLoader(
|
||||
this.ide,
|
||||
this.ideSettingsPromise,
|
||||
this.controlPlaneClient,
|
||||
this.llmLogger,
|
||||
assistant,
|
||||
|
|
@ -394,7 +390,6 @@ export class ConfigHandler {
|
|||
|
||||
// Ide settings change: refresh session and cascade refresh from the top
|
||||
async updateIdeSettings(ideSettings: IdeSettings) {
|
||||
this.ideSettingsPromise = Promise.resolve(ideSettings);
|
||||
this.abortCascade();
|
||||
await this.cascadeInit("IDE settings update");
|
||||
}
|
||||
|
|
@ -432,8 +427,7 @@ export class ConfigHandler {
|
|||
if (reload) {
|
||||
this.controlPlaneClient = new ControlPlaneClient(
|
||||
Promise.resolve(sessionInfo),
|
||||
this.ideSettingsPromise,
|
||||
this.ide.getIdeInfo(),
|
||||
this.ide,
|
||||
);
|
||||
this.abortCascade();
|
||||
await this.cascadeInit("Control plane session info update");
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { ConfigResult, parseConfigYaml } from "@continuedev/config-yaml";
|
||||
|
||||
import { ControlPlaneClient } from "../../control-plane/client.js";
|
||||
import { ContinueConfig, IDE, IdeSettings, ILLMLogger } from "../../index.js";
|
||||
import { ContinueConfig, IDE, ILLMLogger } from "../../index.js";
|
||||
import { ProfileDescription } from "../ProfileLifecycleManager.js";
|
||||
|
||||
import { getPrimaryConfigFilePath } from "../../util/paths.js";
|
||||
|
|
@ -15,7 +15,6 @@ export default class LocalProfileLoader implements IProfileLoader {
|
|||
|
||||
constructor(
|
||||
private ide: IDE,
|
||||
private ideSettingsPromise: Promise<IdeSettings>,
|
||||
private controlPlaneClient: ControlPlaneClient,
|
||||
private llmLogger: ILLMLogger,
|
||||
private overrideAssistantFile?:
|
||||
|
|
@ -57,7 +56,6 @@ export default class LocalProfileLoader implements IProfileLoader {
|
|||
async doLoadConfig(): Promise<ConfigResult<ContinueConfig>> {
|
||||
const result = await doLoadConfig({
|
||||
ide: this.ide,
|
||||
ideSettingsPromise: this.ideSettingsPromise,
|
||||
controlPlaneClient: this.controlPlaneClient,
|
||||
llmLogger: this.llmLogger,
|
||||
profileId: this.description.id,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { AssistantUnrolled, ConfigResult } from "@continuedev/config-yaml";
|
|||
|
||||
import { ControlPlaneClient } from "../../control-plane/client.js";
|
||||
import { getControlPlaneEnv } from "../../control-plane/env.js";
|
||||
import { ContinueConfig, IDE, IdeSettings, ILLMLogger } from "../../index.js";
|
||||
import { ContinueConfig, IDE, ILLMLogger } from "../../index.js";
|
||||
import { ProfileDescription } from "../ProfileLifecycleManager.js";
|
||||
|
||||
import doLoadConfig from "./doLoadConfig.js";
|
||||
|
|
@ -28,7 +28,6 @@ export default class PlatformProfileLoader implements IProfileLoader {
|
|||
private readonly versionSlug: string;
|
||||
private readonly controlPlaneClient: ControlPlaneClient;
|
||||
private readonly ide: IDE;
|
||||
private ideSettingsPromise: Promise<IdeSettings>;
|
||||
private llmLogger: ILLMLogger;
|
||||
readonly description: ProfileDescription;
|
||||
private readonly orgScopeId: string | null;
|
||||
|
|
@ -41,7 +40,6 @@ export default class PlatformProfileLoader implements IProfileLoader {
|
|||
versionSlug,
|
||||
controlPlaneClient,
|
||||
ide,
|
||||
ideSettingsPromise,
|
||||
llmLogger,
|
||||
description,
|
||||
orgScopeId,
|
||||
|
|
@ -53,7 +51,6 @@ export default class PlatformProfileLoader implements IProfileLoader {
|
|||
versionSlug: string;
|
||||
controlPlaneClient: ControlPlaneClient;
|
||||
ide: IDE;
|
||||
ideSettingsPromise: Promise<IdeSettings>;
|
||||
llmLogger: ILLMLogger;
|
||||
description: ProfileDescription;
|
||||
orgScopeId: string | null;
|
||||
|
|
@ -65,7 +62,6 @@ export default class PlatformProfileLoader implements IProfileLoader {
|
|||
this.versionSlug = versionSlug;
|
||||
this.controlPlaneClient = controlPlaneClient;
|
||||
this.ide = ide;
|
||||
this.ideSettingsPromise = ideSettingsPromise;
|
||||
this.llmLogger = llmLogger;
|
||||
this.description = description;
|
||||
this.orgScopeId = orgScopeId;
|
||||
|
|
@ -79,7 +75,6 @@ export default class PlatformProfileLoader implements IProfileLoader {
|
|||
versionSlug,
|
||||
controlPlaneClient,
|
||||
ide,
|
||||
ideSettingsPromise,
|
||||
llmLogger,
|
||||
rawYaml,
|
||||
orgScopeId,
|
||||
|
|
@ -91,12 +86,11 @@ export default class PlatformProfileLoader implements IProfileLoader {
|
|||
versionSlug: string;
|
||||
controlPlaneClient: ControlPlaneClient;
|
||||
ide: IDE;
|
||||
ideSettingsPromise: Promise<IdeSettings>;
|
||||
llmLogger: ILLMLogger;
|
||||
rawYaml: string;
|
||||
orgScopeId: string | null;
|
||||
}): Promise<PlatformProfileLoader> {
|
||||
const controlPlaneEnv = await getControlPlaneEnv(ideSettingsPromise);
|
||||
const controlPlaneEnv = await getControlPlaneEnv(ide.getIdeSettings());
|
||||
|
||||
const description: ProfileDescription = {
|
||||
id: `${ownerSlug}/${packageSlug}`,
|
||||
|
|
@ -121,7 +115,6 @@ export default class PlatformProfileLoader implements IProfileLoader {
|
|||
versionSlug,
|
||||
controlPlaneClient,
|
||||
ide,
|
||||
ideSettingsPromise,
|
||||
llmLogger,
|
||||
description,
|
||||
orgScopeId,
|
||||
|
|
@ -139,7 +132,6 @@ export default class PlatformProfileLoader implements IProfileLoader {
|
|||
|
||||
const results = await doLoadConfig({
|
||||
ide: this.ide,
|
||||
ideSettingsPromise: this.ideSettingsPromise,
|
||||
controlPlaneClient: this.controlPlaneClient,
|
||||
llmLogger: this.llmLogger,
|
||||
overrideConfigYaml: this.configResult.config,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import {
|
|||
import {
|
||||
ContinueConfig,
|
||||
IDE,
|
||||
IdeSettings,
|
||||
ILLMLogger,
|
||||
RuleWithSource,
|
||||
SerializedContinueConfig,
|
||||
|
|
@ -70,7 +69,6 @@ async function loadRules(ide: IDE) {
|
|||
}
|
||||
export default async function doLoadConfig(options: {
|
||||
ide: IDE;
|
||||
ideSettingsPromise: Promise<IdeSettings>;
|
||||
controlPlaneClient: ControlPlaneClient;
|
||||
llmLogger: ILLMLogger;
|
||||
overrideConfigJson?: SerializedContinueConfig;
|
||||
|
|
@ -82,7 +80,6 @@ export default async function doLoadConfig(options: {
|
|||
}): Promise<ConfigResult<ContinueConfig>> {
|
||||
const {
|
||||
ide,
|
||||
ideSettingsPromise,
|
||||
controlPlaneClient,
|
||||
llmLogger,
|
||||
overrideConfigJson,
|
||||
|
|
@ -95,7 +92,7 @@ export default async function doLoadConfig(options: {
|
|||
|
||||
const ideInfo = await ide.getIdeInfo();
|
||||
const uniqueId = await ide.getUniqueId();
|
||||
const ideSettings = await ideSettingsPromise;
|
||||
const ideSettings = await ide.getIdeSettings();
|
||||
const workOsAccessToken = await controlPlaneClient.getAccessToken();
|
||||
const isSignedIn = await controlPlaneClient.isSignedIn();
|
||||
|
||||
|
|
@ -374,7 +371,7 @@ export default async function doLoadConfig(options: {
|
|||
const useOnPremProxy =
|
||||
controlPlane?.useContinueForTeamsProxy === false && controlPlane?.proxyUrl;
|
||||
|
||||
const env = await getControlPlaneEnv(ideSettingsPromise);
|
||||
const env = await getControlPlaneEnv(Promise.resolve(ideSettings));
|
||||
let controlPlaneProxyUrl: string = useOnPremProxy
|
||||
? controlPlane?.proxyUrl
|
||||
: env.DEFAULT_CONTROL_PLANE_PROXY_URL;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class CodeContextProvider extends BaseContextProvider {
|
|||
displayTitle: "Code",
|
||||
description: "Type to search",
|
||||
type: "submenu",
|
||||
dependsOnIndexing: true,
|
||||
dependsOnIndexing: ["chunk", "codeSnippets"],
|
||||
};
|
||||
|
||||
async getContextItems(
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class CodebaseContextProvider extends BaseContextProvider {
|
|||
description: "Automatically find relevant files",
|
||||
type: "normal",
|
||||
renderInlineAs: "",
|
||||
dependsOnIndexing: true,
|
||||
dependsOnIndexing: ["embeddings", "fullTextSearch", "chunk"],
|
||||
};
|
||||
|
||||
async getContextItems(
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class FolderContextProvider extends BaseContextProvider {
|
|||
displayTitle: "Folder",
|
||||
description: "Type to search",
|
||||
type: "submenu",
|
||||
dependsOnIndexing: true,
|
||||
dependsOnIndexing: ["embeddings", "fullTextSearch", "chunk"],
|
||||
};
|
||||
|
||||
async getContextItems(
|
||||
|
|
|
|||
|
|
@ -28,11 +28,9 @@ async function getContextProviderExtras(
|
|||
): Promise<ContextProviderExtras> {
|
||||
setUpTestDir();
|
||||
const ide = new FileSystemIde(TEST_DIR);
|
||||
const ideSettingsPromise = ide.getIdeSettings();
|
||||
const llmLogger = new LLMLogger();
|
||||
const configHandler = new ConfigHandler(
|
||||
ide,
|
||||
ideSettingsPromise,
|
||||
llmLogger,
|
||||
Promise.resolve(undefined),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import {
|
|||
import fetch, { RequestInit, Response } from "node-fetch";
|
||||
|
||||
import { OrganizationDescription } from "../config/ProfileLifecycleManager.js";
|
||||
import { IdeInfo, IdeSettings, ModelDescription } from "../index.js";
|
||||
import { IDE, ModelDescription } from "../index.js";
|
||||
import { Logger } from "../util/Logger.js";
|
||||
|
||||
import { ControlPlaneSessionInfo, isOnPremSession } from "./AuthTypes.js";
|
||||
|
|
@ -44,8 +44,7 @@ export const TRIAL_PROXY_URL =
|
|||
export class ControlPlaneClient {
|
||||
constructor(
|
||||
readonly sessionInfoPromise: Promise<ControlPlaneSessionInfo | undefined>,
|
||||
private readonly ideSettingsPromise: Promise<IdeSettings>,
|
||||
private readonly ideInfoPromise: Promise<IdeInfo>,
|
||||
private readonly ide: IDE,
|
||||
) {}
|
||||
|
||||
async resolveFQSNs(
|
||||
|
|
@ -90,9 +89,9 @@ export class ControlPlaneClient {
|
|||
throw new Error("No access token");
|
||||
}
|
||||
|
||||
const env = await getControlPlaneEnv(this.ideSettingsPromise);
|
||||
const env = await getControlPlaneEnv(this.ide.getIdeSettings());
|
||||
const url = new URL(path, env.CONTROL_PLANE_URL).toString();
|
||||
const ideInfo = await this.ideInfoPromise;
|
||||
const ideInfo = await this.ide.getIdeInfo();
|
||||
|
||||
const resp = await fetch(url, {
|
||||
...init,
|
||||
|
|
|
|||
25
core/core.ts
25
core/core.ts
|
|
@ -138,7 +138,7 @@ export class Core {
|
|||
|
||||
const ideInfoPromise = messenger.request("getIdeInfo", undefined);
|
||||
const ideSettingsPromise = messenger.request("getIdeSettings", undefined);
|
||||
const sessionInfoPromise = messenger.request(
|
||||
const initialSessionInfoPromise = messenger.request(
|
||||
"getControlPlaneSessionInfo",
|
||||
{
|
||||
silent: true,
|
||||
|
|
@ -148,9 +148,8 @@ export class Core {
|
|||
|
||||
this.configHandler = new ConfigHandler(
|
||||
this.ide,
|
||||
ideSettingsPromise,
|
||||
this.llmLogger,
|
||||
sessionInfoPromise,
|
||||
initialSessionInfoPromise,
|
||||
);
|
||||
|
||||
this.docsService = DocsService.createSingleton(
|
||||
|
|
@ -175,6 +174,13 @@ export class Core {
|
|||
}
|
||||
};
|
||||
|
||||
this.codeBaseIndexer = new CodebaseIndexer(
|
||||
this.configHandler,
|
||||
this.ide,
|
||||
this.messenger,
|
||||
this.globalContext.get("indexingPaused"),
|
||||
);
|
||||
|
||||
this.configHandler.onConfigUpdate((result) => {
|
||||
void (async () => {
|
||||
const serializedResult =
|
||||
|
|
@ -187,6 +193,12 @@ export class Core {
|
|||
selectedOrgId: this.configHandler.currentOrg?.id ?? null,
|
||||
});
|
||||
|
||||
if (await this.codeBaseIndexer.wasAnyOneIndexAdded()) {
|
||||
await this.codeBaseIndexer.refreshCodebaseIndex(
|
||||
await this.ide.getWorkspaceDirs(),
|
||||
);
|
||||
}
|
||||
|
||||
// update additional submenu context providers registered via VSCode API
|
||||
const additionalProviders =
|
||||
this.configHandler.getAdditionalSubmenuContextProviders();
|
||||
|
|
@ -198,13 +210,6 @@ export class Core {
|
|||
})();
|
||||
});
|
||||
|
||||
this.codeBaseIndexer = new CodebaseIndexer(
|
||||
this.configHandler,
|
||||
this.ide,
|
||||
this.messenger,
|
||||
this.globalContext.get("indexingPaused"),
|
||||
);
|
||||
|
||||
// Dev Data Logger
|
||||
const dataLogger = DataLogger.getInstance();
|
||||
dataLogger.core = this;
|
||||
|
|
|
|||
7
core/index.d.ts
vendored
7
core/index.d.ts
vendored
|
|
@ -173,6 +173,11 @@ export interface ModelInstaller {
|
|||
}
|
||||
|
||||
export type ContextProviderType = "normal" | "query" | "submenu";
|
||||
export type ContextIndexingType =
|
||||
| "chunk"
|
||||
| "embeddings"
|
||||
| "fullTextSearch"
|
||||
| "codeSnippets";
|
||||
|
||||
export interface ContextProviderDescription {
|
||||
title: ContextProviderName;
|
||||
|
|
@ -180,7 +185,7 @@ export interface ContextProviderDescription {
|
|||
description: string;
|
||||
renderInlineAs?: string;
|
||||
type: ContextProviderType;
|
||||
dependsOnIndexing?: boolean;
|
||||
dependsOnIndexing?: ContextIndexingType[];
|
||||
}
|
||||
|
||||
export type FetchFunction = (url: string | URL, init?: any) => Promise<any>;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import CodebaseContextProvider from "../context/providers/CodebaseContextProvide
|
|||
import { ContinueConfig } from "../index.js";
|
||||
import { localPathToUri } from "../util/pathToUri.js";
|
||||
import { CodebaseIndexer } from "./CodebaseIndexer.js";
|
||||
import { FullTextSearchCodebaseIndex } from "./FullTextSearchCodebaseIndex.js";
|
||||
import { getComputeDeleteAddRemove } from "./refreshIndex.js";
|
||||
import { TestCodebaseIndex } from "./TestCodebaseIndex.js";
|
||||
import { CodebaseIndex } from "./types.js";
|
||||
|
|
@ -675,5 +676,154 @@ describe("CodebaseIndexer", () => {
|
|||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("getIndexesToBuild", () => {
|
||||
let indexer: CodebaseIndexer;
|
||||
let mockConfig: any;
|
||||
let mockEmbeddingsModel: any;
|
||||
let mockIdeSettings: any;
|
||||
|
||||
beforeEach(async () => {
|
||||
indexer = new CodebaseIndexer(
|
||||
testConfigHandler,
|
||||
testIde,
|
||||
mockMessenger as any,
|
||||
false,
|
||||
);
|
||||
|
||||
mockEmbeddingsModel = {
|
||||
maxEmbeddingChunkSize: 1000,
|
||||
model: "test-model",
|
||||
provider: "test-provider",
|
||||
};
|
||||
|
||||
mockIdeSettings = {
|
||||
remoteConfigServerUrl: "http://test.com",
|
||||
userToken: "test-token",
|
||||
};
|
||||
|
||||
mockConfig = {
|
||||
selectedModelByRole: {
|
||||
embed: mockEmbeddingsModel,
|
||||
},
|
||||
contextProviders: [],
|
||||
};
|
||||
|
||||
jest
|
||||
.spyOn(testIde, "getIdeSettings")
|
||||
.mockResolvedValue(mockIdeSettings);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
test("should create specific indexTypes for the requested context providers", async () => {
|
||||
mockConfig.contextProviders = [
|
||||
{
|
||||
description: {
|
||||
dependsOnIndexing: ["chunk", "codeSnippets"],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
jest.spyOn(testConfigHandler, "loadConfig").mockResolvedValue({
|
||||
config: mockConfig,
|
||||
errors: [],
|
||||
configLoadInterrupted: false,
|
||||
});
|
||||
|
||||
const indexes = (await (
|
||||
indexer as any
|
||||
).getIndexesToBuild()) as CodebaseIndex[];
|
||||
|
||||
expect(indexes).toHaveLength(2);
|
||||
expect(indexes[0].artifactId).toBe("chunks");
|
||||
expect(indexes[1].artifactId).toBe("codeSnippets");
|
||||
});
|
||||
|
||||
test("should handle duplicate contexts", async () => {
|
||||
mockConfig.contextProviders = [
|
||||
{
|
||||
description: {
|
||||
dependsOnIndexing: ["codeSnippets"],
|
||||
},
|
||||
},
|
||||
{
|
||||
description: {
|
||||
dependsOnIndexing: ["codeSnippets"],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
jest.spyOn(testConfigHandler, "loadConfig").mockResolvedValue({
|
||||
config: mockConfig,
|
||||
errors: [],
|
||||
configLoadInterrupted: false,
|
||||
});
|
||||
|
||||
const indexes = await (indexer as any).getIndexesToBuild();
|
||||
|
||||
expect(indexes).toHaveLength(1);
|
||||
expect(indexes[0].artifactId).toBe("codeSnippets");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("wasAnyOneIndexAdded", () => {
|
||||
let testIndexer: TestCodebaseIndexer;
|
||||
let mockGetIndexesToBuild: jest.MockedFunction<any>;
|
||||
|
||||
beforeEach(() => {
|
||||
testIndexer = new TestCodebaseIndexer(
|
||||
testConfigHandler,
|
||||
testIde,
|
||||
mockMessenger as any,
|
||||
false,
|
||||
);
|
||||
|
||||
// Mock getIndexesToBuild to control what indexes should be built
|
||||
mockGetIndexesToBuild = jest
|
||||
.spyOn(testIndexer as any, "getIndexesToBuild")
|
||||
.mockResolvedValue([]);
|
||||
|
||||
jest
|
||||
.spyOn(testIndexer, "refreshCodebaseIndex")
|
||||
.mockImplementation(async () => {});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
test("should return true when indexes to build differ from built indexes", async () => {
|
||||
const mockIndex1 = new TestCodebaseIndex();
|
||||
const mockIndex2 = new FullTextSearchCodebaseIndex();
|
||||
mockGetIndexesToBuild.mockResolvedValue([mockIndex1]);
|
||||
(testIndexer as any).builtIndexes = [mockIndex2];
|
||||
|
||||
const result = await testIndexer.wasAnyOneIndexAdded();
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
test("should return true when there are more indexes to build than built indexes", async () => {
|
||||
const mockIndex1 = new TestCodebaseIndex();
|
||||
const mockIndex2 = new FullTextSearchCodebaseIndex();
|
||||
mockGetIndexesToBuild.mockResolvedValue([mockIndex1, mockIndex2]);
|
||||
(testIndexer as any).builtIndexes = [mockIndex1];
|
||||
|
||||
const result = await testIndexer.wasAnyOneIndexAdded();
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
test("should return false when there are fewer indexes to build than built indexes", async () => {
|
||||
const mockIndex1 = new TestCodebaseIndex();
|
||||
const mockIndex2 = new FullTextSearchCodebaseIndex();
|
||||
mockGetIndexesToBuild.mockResolvedValue([mockIndex1]);
|
||||
(testIndexer as any).builtIndexes = [mockIndex1, mockIndex2];
|
||||
|
||||
const result = await testIndexer.wasAnyOneIndexAdded();
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import * as fs from "fs/promises";
|
|||
|
||||
import { ConfigHandler } from "../config/ConfigHandler.js";
|
||||
import {
|
||||
ContextIndexingType,
|
||||
ContinueConfig,
|
||||
IDE,
|
||||
IndexingProgressUpdate,
|
||||
|
|
@ -58,6 +59,7 @@ export class CodebaseIndexer {
|
|||
private indexingCancellationController: AbortController;
|
||||
private codebaseIndexingState: IndexingProgressUpdate;
|
||||
private readonly pauseToken: PauseToken;
|
||||
private builtIndexes: CodebaseIndex[] = [];
|
||||
|
||||
private getUserFriendlyIndexName(artifactId: string): string {
|
||||
if (artifactId === FullTextSearchCodebaseIndex.artifactId)
|
||||
|
|
@ -166,28 +168,46 @@ export class CodebaseIndexer {
|
|||
return [];
|
||||
}
|
||||
|
||||
const indexes: CodebaseIndex[] = [
|
||||
new ChunkCodebaseIndex(
|
||||
this.ide.readFile.bind(this.ide),
|
||||
continueServerClient,
|
||||
embeddingsModel.maxEmbeddingChunkSize,
|
||||
), // Chunking must come first
|
||||
];
|
||||
|
||||
const lanceDbIndex = await LanceDbIndex.create(
|
||||
embeddingsModel,
|
||||
this.ide.readFile.bind(this.ide),
|
||||
const indexTypesToBuild = new Set( // use set to remove duplicates
|
||||
config.contextProviders
|
||||
.map((provider) => provider.description.dependsOnIndexing)
|
||||
.filter((indexType) => Array.isArray(indexType)) // remove undefined indexTypes
|
||||
.flat(),
|
||||
);
|
||||
|
||||
if (lanceDbIndex) {
|
||||
indexes.push(lanceDbIndex);
|
||||
const indexTypeToIndexerMapping: Record<
|
||||
ContextIndexingType,
|
||||
() => Promise<CodebaseIndex | null>
|
||||
> = {
|
||||
chunk: async () =>
|
||||
new ChunkCodebaseIndex(
|
||||
this.ide.readFile.bind(this.ide),
|
||||
continueServerClient,
|
||||
embeddingsModel.maxEmbeddingChunkSize,
|
||||
),
|
||||
codeSnippets: async () => new CodeSnippetsCodebaseIndex(this.ide),
|
||||
fullTextSearch: async () => new FullTextSearchCodebaseIndex(),
|
||||
embeddings: async () => {
|
||||
const lanceDbIndex = await LanceDbIndex.create(
|
||||
embeddingsModel,
|
||||
this.ide.readFile.bind(this.ide),
|
||||
);
|
||||
return lanceDbIndex;
|
||||
},
|
||||
};
|
||||
|
||||
const indexes: CodebaseIndex[] = [];
|
||||
// not parallelizing to avoid race conditions in sqlite
|
||||
for (const indexType of indexTypesToBuild) {
|
||||
if (indexType && indexType in indexTypeToIndexerMapping) {
|
||||
const index = await indexTypeToIndexerMapping[indexType]();
|
||||
if (index) {
|
||||
indexes.push(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
indexes.push(
|
||||
new FullTextSearchCodebaseIndex(),
|
||||
new CodeSnippetsCodebaseIndex(this.ide),
|
||||
);
|
||||
|
||||
this.builtIndexes = indexes;
|
||||
return indexes;
|
||||
}
|
||||
|
||||
|
|
@ -694,6 +714,15 @@ export class CodebaseIndexer {
|
|||
}
|
||||
}
|
||||
|
||||
public async wasAnyOneIndexAdded() {
|
||||
const indexes = await this.getIndexesToBuild();
|
||||
return !indexes.every((index) =>
|
||||
this.builtIndexes.some(
|
||||
(builtIndex) => builtIndex.artifactId === index.artifactId,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public async refreshCodebaseIndex(paths: string[]) {
|
||||
if (!this.indexingCancellationController.signal.aborted) {
|
||||
this.indexingCancellationController.abort();
|
||||
|
|
|
|||
|
|
@ -370,8 +370,17 @@ export abstract class BaseLLM implements ILLM {
|
|||
},
|
||||
});
|
||||
|
||||
if (error !== undefined) {
|
||||
if (error === "cancel" || error.name === "AbortError") {
|
||||
if (typeof error === "undefined") {
|
||||
interaction?.logItem({
|
||||
kind: "success",
|
||||
promptTokens,
|
||||
generatedTokens,
|
||||
thinkingTokens,
|
||||
usage,
|
||||
});
|
||||
return "success";
|
||||
} else {
|
||||
if (error === "cancel" || error?.name?.includes("AbortError")) {
|
||||
interaction?.logItem({
|
||||
kind: "cancel",
|
||||
promptTokens,
|
||||
|
|
@ -393,15 +402,6 @@ export abstract class BaseLLM implements ILLM {
|
|||
});
|
||||
return "error";
|
||||
}
|
||||
} else {
|
||||
interaction?.logItem({
|
||||
kind: "success",
|
||||
promptTokens,
|
||||
generatedTokens,
|
||||
thinkingTokens,
|
||||
usage,
|
||||
});
|
||||
return "success";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -615,6 +615,7 @@ export abstract class BaseLLM implements ILLM {
|
|||
kind: "chunk",
|
||||
chunk: formattedContent,
|
||||
});
|
||||
|
||||
completion += formattedContent;
|
||||
yield content;
|
||||
}
|
||||
|
|
@ -630,6 +631,7 @@ export abstract class BaseLLM implements ILLM {
|
|||
kind: "chunk",
|
||||
chunk,
|
||||
});
|
||||
|
||||
completion += chunk;
|
||||
yield chunk;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ class Ollama extends BaseLLM implements ModelInstaller {
|
|||
constructor(options: LLMOptions) {
|
||||
super(options);
|
||||
|
||||
if (options.isFromAutoDetect) {
|
||||
if (options.model === "AUTODETECT") {
|
||||
return;
|
||||
}
|
||||
const headers: Record<string, string> = {
|
||||
|
|
|
|||
|
|
@ -7,16 +7,23 @@ class Scaleway extends OpenAI {
|
|||
static providerName = "scaleway";
|
||||
static defaultOptions: Partial<LLMOptions> = {
|
||||
apiBase: "https://api.scaleway.ai/v1/",
|
||||
model: "qwen2.5-coder-32b-instruct",
|
||||
model: "qwen3-coder-30b-a3b-instruct",
|
||||
useLegacyCompletionsEndpoint: false,
|
||||
};
|
||||
|
||||
private static MODEL_IDS: { [name: string]: string } = {
|
||||
"llama3.1-8b": "llama-3.1-8b-instruct",
|
||||
"llama3.3-70b": "llama-3.3-70b-instruct",
|
||||
"pixtral-12b": "pixtral-12b-2409",
|
||||
"mistral-small3.1": "mistral-small-3.1-24b-instruct-2503",
|
||||
"mistral-small3.2": "mistral-small-3.2-24b-instruct-2506",
|
||||
"devstral-small": "devstral-small-2505",
|
||||
"deepseek-r1-distill-llama-70b": "deepseek-r1-distill-llama-70b",
|
||||
"qwen2.5-coder-32b": "qwen2.5-coder-32b-instruct",
|
||||
"qwen3-coder-30b-a3b": "qwen3-coder-30b-a3b-instruct",
|
||||
"qwen3-235b-a22b": "qwen3-235b-a22b-instruct-2507",
|
||||
"gemma-3-27b": "gemma-3-27b-it",
|
||||
"gpt-oss-120b": "gpt-oss-120b",
|
||||
};
|
||||
|
||||
protected _convertModelName(model: string) {
|
||||
|
|
|
|||
|
|
@ -12,13 +12,11 @@ export const ideSettingsPromise = testIde.getIdeSettings();
|
|||
|
||||
export const testControlPlaneClient = new ControlPlaneClient(
|
||||
Promise.resolve(undefined),
|
||||
ideSettingsPromise,
|
||||
testIde.getIdeInfo(),
|
||||
testIde,
|
||||
);
|
||||
|
||||
export const testConfigHandler = new ConfigHandler(
|
||||
testIde,
|
||||
ideSettingsPromise,
|
||||
new LLMLogger(),
|
||||
Promise.resolve(undefined),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ export interface EditToolArgs {
|
|||
}
|
||||
|
||||
export const NO_PARALLEL_TOOL_CALLING_INTSRUCTION =
|
||||
"Note this tool CANNOT be called in parallel with other tools.";
|
||||
"This tool CANNOT be called in parallel with other tools.";
|
||||
|
||||
const CHANGES_DESCRIPTION =
|
||||
"Any modifications to the file, showing only needed changes. Do NOT wrap this in a codeblock or write anything besides the code changes. In larger files, use brief language-appropriate placeholders for large unmodified sections, e.g. '// ... existing code ...'";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { Tool } from "../..";
|
||||
import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn";
|
||||
import { NO_PARALLEL_TOOL_CALLING_INTSRUCTION } from "./editFile";
|
||||
import { singleFindAndReplaceTool } from "./singleFindAndReplace";
|
||||
|
||||
export interface EditOperation {
|
||||
old_string: string;
|
||||
|
|
@ -24,60 +25,41 @@ export const multiEditTool: Tool = {
|
|||
isInstant: false,
|
||||
function: {
|
||||
name: BuiltInToolNames.MultiEdit,
|
||||
description: `This is a tool for making multiple edits to a single file in one operation. It
|
||||
is built on top of the single find and replace tool and allows you to perform multiple
|
||||
find-and-replace operations efficiently. Prefer this tool over the single find and replace tool
|
||||
when you need to make multiple edits to the same file.
|
||||
description: `This is a tool for making multiple edits to a single file in one operation. It is built on top of the ${singleFindAndReplaceTool.function.name} and allows you to perform multiple find-and-replace operations efficiently.
|
||||
Prefer this tool over the ${singleFindAndReplaceTool.function.name} tool when you need to make multiple edits to the same file.
|
||||
|
||||
Before using this tool:
|
||||
|
||||
1. Use the read_file tool to understand the file's contents and context
|
||||
2. Verify the directory path is correct
|
||||
|
||||
To make multiple file edits, provide the following:
|
||||
|
||||
1. filepath: The path to the file to modify (relative to the root of the workspace)
|
||||
To make multiple edits to a file, provide the following:
|
||||
1. filepath: The path to the file to modify, RELATIVE to the project/workspace root (verify the directory path is correct)
|
||||
2. edits: An array of edit operations to perform, where each edit contains:
|
||||
- old_string: The text to replace (must match the file contents exactly, including all whitespace and indentation)
|
||||
- old_string: The text to replace (must match the old file contents exactly, including all whitespace/indentation)
|
||||
- new_string: The edited text to replace the old_string
|
||||
- replace_all: Replace all occurrences of old_string. This parameter is optional and defaults to false.
|
||||
|
||||
IMPORTANT:
|
||||
- All edits are applied in sequence, in the order they are provided
|
||||
- Each edit operates on the result of the previous edit
|
||||
- All edits must be valid for the operation to succeed - if any edit fails,
|
||||
none will be applied
|
||||
- This tool is ideal when you need to make several changes to different parts
|
||||
of the same file
|
||||
- Each edit operates on the result of the previous edit, so plan your edits carefully to avoid conflicts between sequential operations
|
||||
- Edits are atomic - all edits must be valid for the operation to succeed - if any edit fails, none will be applied
|
||||
- This tool is ideal when you need to make several changes to different parts of the same file
|
||||
|
||||
CRITICAL REQUIREMENTS:
|
||||
|
||||
1. All edits follow the same requirements as the single find and replace tool
|
||||
2. The edits are atomic - either all succeed or none are applied
|
||||
3. Plan your edits carefully to avoid conflicts between sequential operations
|
||||
4. ${NO_PARALLEL_TOOL_CALLING_INTSRUCTION}
|
||||
|
||||
WARNING:
|
||||
|
||||
- The tool will fail if edits.old_string doesn't match the file contents
|
||||
exactly (including whitespace)
|
||||
- The tool will fail if edits.old_string and edits.new_string are the same
|
||||
- Since edits are applied in sequence, ensure that earlier edits don't affect
|
||||
the text that later edits are trying to find
|
||||
|
||||
When making edits:
|
||||
|
||||
1. ALWAYS use the ${BuiltInToolNames.ReadFile} tool just before making edits, to understand the file's up-to-date contents and context. The user can also edit the file while you are working with it.
|
||||
2. ${NO_PARALLEL_TOOL_CALLING_INTSRUCTION}
|
||||
3. When making edits:
|
||||
- Ensure all edits result in idiomatic, correct code
|
||||
- Do not leave the code in a broken state
|
||||
- Only use emojis if the user explicitly requests it. Avoid adding emojis to
|
||||
files unless asked.
|
||||
- Use replace_all for replacing and renaming strings across the file. This
|
||||
parameter is useful if you want to rename a variable for instance.
|
||||
- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked
|
||||
- Use replace_all for replacing and renaming all matches for a string across the file. This parameter is useful if you want to rename a variable, for instance
|
||||
|
||||
If you want to create a new file, use:
|
||||
- A new file path
|
||||
- A new file path, including new directory if needed
|
||||
- First edit: empty old_string and the new file's contents as new_string
|
||||
- Subsequent edits are not allowed - there is no need since you are creating`,
|
||||
- Subsequent edits are not allowed - there is no need since you are creating
|
||||
- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required
|
||||
|
||||
WARNINGS:
|
||||
- If earlier edits affect the text that later edits are trying to find, files can become mangled
|
||||
- The tool will fail if edits.old_string doesn't match the file contents exactly (including whitespace)
|
||||
- The tool will fail if edits.old_string and edits.new_string are the same - they MUST be different`,
|
||||
parameters: {
|
||||
type: "object",
|
||||
required: ["filepath", "edits"],
|
||||
|
|
@ -97,16 +79,18 @@ If you want to create a new file, use:
|
|||
properties: {
|
||||
old_string: {
|
||||
type: "string",
|
||||
description: "The text to replace",
|
||||
description:
|
||||
"The text to replace (exact match including whitespace/indentation)",
|
||||
},
|
||||
new_string: {
|
||||
type: "string",
|
||||
description: "The text to replace it with",
|
||||
description:
|
||||
"The text to replace it with. MUST be different than old_string.",
|
||||
},
|
||||
replace_all: {
|
||||
type: "boolean",
|
||||
description:
|
||||
"Replace all occurrences of old_string (default false)",
|
||||
"Replace all occurrences of old_string (default false) in the file",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -20,33 +20,18 @@ export const singleFindAndReplaceTool: Tool = {
|
|||
isInstant: false,
|
||||
function: {
|
||||
name: BuiltInToolNames.SingleFindAndReplace,
|
||||
description: `Performs exact string replacements in files.
|
||||
|
||||
Usage:
|
||||
|
||||
- You must use your \`read_file\` tool at least once in the conversation before
|
||||
editing. This tool will error if you attempt an edit without reading the file.
|
||||
|
||||
- When editing text from read_file tool output, ensure you preserve the exact
|
||||
indentation (tabs/spaces) as it appears AFTER the line number prefix. The line
|
||||
number prefix format is: spaces + line number + tab. Everything after that tab
|
||||
is the actual file content to match. Never include any part of the line number
|
||||
prefix in the old_string or new_string.
|
||||
|
||||
- ALWAYS prefer editing existing files in the codebase. NEVER write new files
|
||||
unless explicitly required.
|
||||
|
||||
- Only use emojis if the user explicitly requests it. Avoid adding emojis to
|
||||
files unless asked.
|
||||
description: `Performs exact string replacements in a file.
|
||||
|
||||
IMPORTANT:
|
||||
- ALWAYS use the \`${BuiltInToolNames.ReadFile}\` tool just before making edits, to understand the file's up-to-date contents and context. The user can also edit the file while you are working with it.
|
||||
- ${NO_PARALLEL_TOOL_CALLING_INTSRUCTION}
|
||||
- When editing text from \`${BuiltInToolNames.ReadFile}\` tool output, ensure you preserve exact whitespace/indentation.
|
||||
- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.
|
||||
- Use \`replace_all\` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable, for instance.
|
||||
|
||||
- The edit will FAIL if \`old_string\` is not unique in the file. Either provide
|
||||
a larger string with more surrounding context to make it unique or use
|
||||
\`replace_all\` to change every instance of \`old_string\`.
|
||||
|
||||
- Use \`replace_all\` for replacing and renaming strings across the file. This
|
||||
parameter is useful if you want to rename a variable for instance.`,
|
||||
WARNINGS:
|
||||
- When not using \`replace_all\`, the edit will FAIL if \`old_string\` is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use \`replace_all\` to change every instance of \`old_string\`.
|
||||
- The edit will likely fail if you have not recently used the \`${BuiltInToolNames.ReadFile}\` tool to view up-to-date file contents.`,
|
||||
parameters: {
|
||||
type: "object",
|
||||
required: ["filepath", "old_string", "new_string"],
|
||||
|
|
@ -58,12 +43,13 @@ parameter is useful if you want to rename a variable for instance.`,
|
|||
},
|
||||
old_string: {
|
||||
type: "string",
|
||||
description: "The text to replace",
|
||||
description:
|
||||
"The text to replace - must be exact including whitespace/indentation",
|
||||
},
|
||||
new_string: {
|
||||
type: "string",
|
||||
description:
|
||||
"The text to replace it with (must be different from old_string)",
|
||||
"The text to replace it with (MUST be different from old_string)",
|
||||
},
|
||||
replace_all: {
|
||||
type: "boolean",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
title: "Chat"
|
||||
sidebarTitle: "How To Use AI Chat"
|
||||
icon: "circle-question"
|
||||
description: "Learn how to use Continue's AI chat assistant to solve coding problems without leaving your IDE, including code context sharing, applying generated solutions, and switching between models"
|
||||
description: "Learn how to use Continue's AI chat agent to solve coding problems without leaving your IDE, including code context sharing, applying generated solutions, and switching between models"
|
||||
---
|
||||
|
||||
<Frame>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: "Customization Overview"
|
||||
description: "Learn how to customize Continue with model providers, context providers, slash commands, and tools to create your perfect AI coding assistant"
|
||||
description: "Learn how to customize Continue with model providers, context providers, slash commands, and tools to create your perfect AI coding agent"
|
||||
---
|
||||
|
||||
Continue can be deeply customized to fit your specific development workflow and preferences. This guide covers the main ways you can customize Continue to enhance your coding experience.
|
||||
|
|
@ -21,15 +21,15 @@ Slash commands allow you to easily add custom functionality to Continue. You can
|
|||
|
||||
Unchain your LLM with the power of tools using [Agent](/features/agent/quick-start). Add custom tools using [MCP Servers](/customization/mcp-tools)
|
||||
|
||||
Whatever you choose, you'll probably start by editing your Assistant.
|
||||
Whatever you choose, you'll probably start by editing your Agent.
|
||||
|
||||
## Edit Your Assistant
|
||||
## Edit Your Agent
|
||||
|
||||
You can easily access your assistant configuration from the Continue Chat sidebar. Open the sidebar by pressing `cmd/ctrl` + `L` (VS Code) or `cmd/ctrl` + `J` (JetBrains) and click the Assistant selector above the main chat input. Then, you can hover over an assistant and click the `new window` (hub assistants) or `gear` (local assistants) icon.
|
||||
You can easily access your agent configuration from the Continue Chat sidebar. Open the sidebar by pressing `cmd/ctrl` + `L` (VS Code) or `cmd/ctrl` + `J` (JetBrains) and click the Agent selector above the main chat input. Then, you can hover over an agent and click the `new window` (hub agents) or `gear` (local agents) icon.
|
||||
|
||||

|
||||

|
||||
|
||||
## Manage Your Assistant
|
||||
## Manage Your Agent
|
||||
|
||||
- See [Editing Hub Assistants](/hub/assistants/edit-an-assistant) for more details on managing your hub assistant
|
||||
- See the [Config Deep Dive](/reference) for more details on configuring local assistants.
|
||||
- See [Editing Hub Agents](/hub/agents/edit-an-agent) for more details on managing your hub agent
|
||||
- See the [Config Deep Dive](/reference) for more details on configuring local agents.
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
---
|
||||
title: "Rules"
|
||||
description: "Rules allow you to provide specific instructions that guide how the AI assistant behaves when working with your code. Instead of the AI making assumptions about your coding standards, architecture patterns, or project-specific requirements, you can explicitly define guidelines that ensure consistent, contextually appropriate responses."
|
||||
description: "Rules allow you to provide specific instructions that guide how the AI agent behaves when working with your code. Instead of the AI making assumptions about your coding standards, architecture patterns, or project-specific requirements, you can explicitly define guidelines that ensure consistent, contextually appropriate responses."
|
||||
---
|
||||
|
||||
Think of these as the guardrails for your AI coding assistants:
|
||||
Think of these as the guardrails for your AI coding agents:
|
||||
|
||||
- **Enforce company-specific coding standards** and security practices
|
||||
- **Implement quality checks** that match your engineering culture
|
||||
- **Create paved paths** for developers to follow organizational best practices
|
||||
|
||||
By implementing rules, you transform the AI from a generic coding assistant into a knowledgeable team member that understands your project's unique requirements and constraints.
|
||||
By implementing rules, you transform the AI from a generic coding agent into a knowledgeable team member that understands your project's unique requirements and constraints.
|
||||
|
||||
## How Rules Work
|
||||
|
||||
Your assistant detects rules and applies the specified rules while in [Agent](/features/agent/quick-start), [Chat](/features/chat/quick-start), and [Edit](/features/edit/quick-start) modes.
|
||||
Your agent detects rules and applies the specified rules while in [Agent](/features/agent/quick-start), [Chat](/features/chat/quick-start), and [Edit](/features/edit/quick-start) modes.
|
||||
|
||||
Learn more in the [rules deep dive](/customize/deep-dives/rules), and view [`rules`](/reference#rules) in the YAML Reference for more details.
|
||||
|
|
@ -1,26 +1,26 @@
|
|||
---
|
||||
title: "How to Configure Continue Assistants"
|
||||
description: Learn how to access and manage Continue assistant configurations through Hub or local YAML files
|
||||
title: "How to Configure Continue Agents"
|
||||
description: Learn how to access and manage Continue agent configurations through Hub or local YAML files
|
||||
keywords: [config, settings, customize]
|
||||
sidebarTitle: "Assistant Configuration"
|
||||
sidebarTitle: "Agent Configuration"
|
||||
---
|
||||
|
||||
You can easily access your assistant configuration from the Continue Chat sidebar. Open the sidebar by pressing <kbd>cmd/ctrl</kbd> + <kbd>L</kbd> (VS Code) or <kbd>cmd/ctrl</kbd> + <kbd>J</kbd> (JetBrains) and click the Assistant selector above the main chat input. Then, you can hover over an assistant and click the `new window` (hub assistants) or `gear` (local assistants) icon.
|
||||
You can easily access your agent configuration from the Continue Chat sidebar. Open the sidebar by pressing <kbd>cmd/ctrl</kbd> + <kbd>L</kbd> (VS Code) or <kbd>cmd/ctrl</kbd> + <kbd>J</kbd> (JetBrains) and click the Agent selector above the main chat input. Then, you can hover over an agent and click the `new window` (hub agents) or `gear` (local agents) icon.
|
||||
|
||||

|
||||

|
||||
|
||||
## How to Manage Hub Assistants
|
||||
## How to Manage Hub Agents
|
||||
|
||||
Hub Assistants can be managed in [the Hub](https://hub.continue.dev). See [Editing an Assistant](../../hub/assistants/edit-an-assistant.md)
|
||||
Hub Agents can be managed in [the Hub](https://hub.continue.dev). See [Editing an Agent](../../hub/agents/edit-an-agent.md)
|
||||
|
||||
## How to Configure Local Assistants with YAML
|
||||
## How to Configure Local Agents with YAML
|
||||
|
||||
Local user-level configuration is stored and can be edited in your home directory in `config.yaml`:
|
||||
|
||||
- `~/.continue/config.yaml` (MacOS / Linux)
|
||||
- `%USERPROFILE%\.continue\config.yaml` (Windows)
|
||||
|
||||
To open this `config.yaml`, you need to open the assistants dropdown in the top-right portion of the chat input. On that dropdown beside the "Local Assistant" option, select the cog icon. It will open the local `config.yaml`.
|
||||
To open this `config.yaml`, you need to open the agents dropdown in the top-right portion of the chat input. On that dropdown beside the "Local Agent" option, select the cog icon. It will open the local `config.yaml`.
|
||||
|
||||

|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ that can be set up with custom tools.
|
|||
Currently custom tools can be configured using the Model Context
|
||||
Protocol standard to unify prompts, context, and tool use.
|
||||
|
||||
MCP Servers can be added to hub Assistants using `mcpServers` blocks. You can
|
||||
MCP Servers can be added to hub Agents using `mcpServers` blocks. You can
|
||||
explore available MCP server blocks
|
||||
[here](https://hub.continue.dev/explore/mcp).
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ explore available MCP server blocks
|
|||
|
||||
## Quick Start: How to Set Up Your First MCP Server
|
||||
|
||||
Below is a quick example of setting up a new MCP server for use in your assistant:
|
||||
Below is a quick example of setting up a new MCP server for use in your agent:
|
||||
|
||||
1. Create a folder called `.continue/mcpServers` at the top level of your workspace
|
||||
2. Add a file called `playwright-mcp.yaml` to this folder.
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ Now test your rules by asking a question about a file in chat.
|
|||
|
||||
## How to Create Rules Blocks
|
||||
|
||||
Rules can be added locally using the "Add Rules" button while viewing the Local Assistant's rules.
|
||||
Rules can be added locally using the "Add Rules" button while viewing the Local Agent's rules.
|
||||
|
||||

|
||||
|
||||
|
|
@ -53,7 +53,7 @@ For example, you can say "Create a rule for this", and a rule will be created fo
|
|||
|
||||
</Info>
|
||||
|
||||
Rules can also be added to an Assistant on the Continue Hub.
|
||||
Rules can also be added to an Agent on the Continue Hub.
|
||||
|
||||
Explore available rules [here](https://hub.continue.dev), or [create your own](https://hub.continue.dev/new?type=block&blockType=rules) in the Hub.
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ Now test your rules by asking a question about a file in chat.
|
|||
|
||||
## Creating `rules` blocks
|
||||
|
||||
Rules can be added locally using the "Add Rules" button while viewing the Local Assistant's rules.
|
||||
Rules can be added locally using the "Add Rules" button while viewing the Local Agent's rules.
|
||||
|
||||

|
||||
|
||||
|
|
@ -49,7 +49,7 @@ Automatically create local rule blocks: When in Agent mode, you can prompt the a
|
|||
For example, you can say "Create a rule for this", and a rule will be created for you in `.continue/rules` based on your conversation.
|
||||
</Info>
|
||||
|
||||
Rules can also be added to an Assistant on the Continue Hub.
|
||||
Rules can also be added to an Agent on the Continue Hub.
|
||||
|
||||
Explore available rules [here](https://hub.continue.dev), or [create your own](https://hub.continue.dev/new?type=block&blockType=rules) in the Hub.
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ name: New rule
|
|||
Always give concise responses
|
||||
```
|
||||
|
||||
This is also done when selecting "Add Rule" in the Assistant settings. This will create a new folder in `.continue/rules` with a default file named `new-rule.md`.
|
||||
This is also done when selecting "Add Rule" in the Agent settings. This will create a new folder in `.continue/rules` with a default file named `new-rule.md`.
|
||||
|
||||
### Examples
|
||||
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ Slash commands can be combined with additional instructions, including highlight
|
|||
|
||||
## Ways to Create Slash Commands in Continue
|
||||
|
||||
### Assistant Prompt Blocks
|
||||
### Agent Prompt Blocks
|
||||
|
||||
The easiest way to add a slash command is by adding [`prompt` blocks](../../hub/blocks/block-types#prompts) to your assistant, which show up as slash commands in [Chat](../../features/chat/how-it-works).
|
||||
The easiest way to add a slash command is by adding [`prompt` blocks](../../hub/blocks/block-types#prompts) to your agent, which show up as slash commands in [Chat](../../features/chat/how-it-works).
|
||||
|
||||
### Prompt Files
|
||||
|
||||
|
|
|
|||
BIN
docs/customize/model-providers/assets/tetrate-remix.png
Normal file
BIN
docs/customize/model-providers/assets/tetrate-remix.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 144 KiB |
|
|
@ -1,44 +0,0 @@
|
|||
---
|
||||
title: "Tetrate Agent Router Service"
|
||||
---
|
||||
|
||||
The Tetrate Agent Router Service (TARS) provides a unified API gateway for accessing various AI models with fast inference capabilities. TARS acts as an intelligent router that can distribute requests across multiple model providers, offering enterprise-grade reliability and performance optimization.
|
||||
|
||||
## Getting Started
|
||||
|
||||
1. Obtain an API key from the [Tetrate Agent Router Service portal](https://api.router.tetrate.ai/)
|
||||
2. Configure Continue to use TARS as your model provider
|
||||
|
||||
## Configuration
|
||||
|
||||
Update your Continue configuration file (`~/.continue/config.json` or `~/.continue/config.yaml`) with your TARS API key:
|
||||
|
||||
<Tabs>
|
||||
<Tab title="YAML">
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
- name: TARS GPT-5 Mini
|
||||
provider: tars
|
||||
model: gpt-5-mini
|
||||
apiKey: <YOUR_TARS_API_KEY>
|
||||
```
|
||||
</Tab>
|
||||
<Tab title="JSON">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "TARS GPT-5 Mini",
|
||||
"provider": "tars",
|
||||
"model": "gpt-5-mini",
|
||||
"apiKey": "<YOUR_TARS_API_KEY>"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
## Available Models
|
||||
|
||||
TARS supports routing to various models. Go to the [Tetrate Agent Router Service model catalog](https://router.tetrate.ai/models) for a full list of supported models.
|
||||
|
|
@ -33,6 +33,7 @@ Beyond the top-level providers, Continue supports many other options:
|
|||
| [Together AI](/customize/model-providers/more/together) | Platform for running a variety of open models |
|
||||
| [DeepInfra](/customize/model-providers/more/deepinfra) | Hosting for various open source models |
|
||||
| [OpenRouter](/customize/model-providers/top-level/openrouter) | Gateway to multiple model providers |
|
||||
| [Tetrate Agent Router Service](/customize/model-providers/top-level/tetrate_agent_router_service) | Gateway with intelligent routing across multiple model providers |
|
||||
| [Cohere](/customize/model-providers/more/cohere) | Models specialized for semantic search and text generation |
|
||||
| [NVIDIA](/customize/model-providers/more/nvidia) | GPU-accelerated model hosting |
|
||||
| [Cloudflare](/customize/model-providers/more/cloudflare) | Edge-based AI inference services |
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ sidebarTitle: "OpenAI"
|
|||
"models": [
|
||||
{
|
||||
"title": "<MODEL_NAME>",
|
||||
"provider": "openai",
|
||||
"provider": "openai",
|
||||
"model": "<MODEL_ID>",
|
||||
"apiKey": "<YOUR_OPENAI_API_KEY>"
|
||||
}
|
||||
|
|
@ -56,6 +56,7 @@ OpenAI API compatible providers include
|
|||
- [TensorRT-LLM](https://github.com/NVIDIA/trt-llm-as-openai-windows?tab=readme-ov-file#examples)
|
||||
- [vLLM](https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html)
|
||||
- [BerriAI/litellm](https://github.com/BerriAI/litellm)
|
||||
- [Tetrate Agent Router Service](https://router.tetrate.ai)
|
||||
|
||||
If you are using an OpenAI API compatible providers, you can change the `apiBase` like this:
|
||||
|
||||
|
|
@ -75,7 +76,7 @@ If you are using an OpenAI API compatible providers, you can change the `apiBase
|
|||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "<OPENAI_API_COMPATIBLE_PROVIDER_MODEL>",
|
||||
"title": "<OPENAI_API_COMPATIBLE_PROVIDER_MODEL>",
|
||||
"provider": "openai",
|
||||
"model": "<MODEL_NAME>",
|
||||
"apiKey": "<YOUR_CUSTOM_API_KEY>",
|
||||
|
|
@ -110,7 +111,7 @@ To force usage of `chat/completions` instead of `completions` endpoint you can s
|
|||
"title": "<OPENAI_API_COMPATIBLE_PROVIDER_MODEL>",
|
||||
"provider": "openai",
|
||||
"model": "<MODEL_NAME>",
|
||||
"apiBase": "http://localhost:8000/v1",
|
||||
"apiBase": "http://localhost:8000/v1",
|
||||
"useLegacyCompletionsEndpoint": true
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,83 @@
|
|||
---
|
||||
title: "Tetrate Agent Router Service"
|
||||
sidebarTitle: "Tetrate Agent Router Service"
|
||||
slug: ../tetrate-agent-router-service
|
||||
---
|
||||
|
||||
The **Tetrate Agent Router Service** provides a unified Gateway for accessing various AI models with fast inference capabilities as well as embedding services.
|
||||
|
||||
This gateway acts as an intelligent router that can distribute requests across multiple model providers, offering enterprise-grade reliability and performance optimization.
|
||||
|
||||
## Getting Started
|
||||
|
||||
1. Obtain an API key from the [Agent Router Service portal](https://api.router.tetrate.ai/)
|
||||
2. Configure Continue to use Agent Router Service as your model provider
|
||||
|
||||
## Configuring Models
|
||||
|
||||
You can also quickly use models from Tetrate on the Cotninue Hub by visiting Tetrate on the Continue Hub [here](https://hub.continue.dev/tetrate). The easiest way if you don't see the model you want to use is to remix one of the models on the Tetrate page and change the model to the one you want to use.
|
||||
|
||||

|
||||
|
||||
### Available Models
|
||||
|
||||
Agent Router Service supports routing to various models.
|
||||
Go to the [Agent Router Service model catalog](https://router.tetrate.ai/models) for a full list of supported models.
|
||||
|
||||
## Configuration Options
|
||||
|
||||
As Agent Router Service is an OpenAI API compatible provider, you can configure it like any other OpenAI API compatible provider. Therefore you will be setting `provider: openai` and `apiBase: https://api.router.tetrate.ai/v1`.
|
||||
|
||||
Update your Continue configuration file (`~/.continue/config.yaml`) with your Agent Router Service API key:
|
||||
|
||||
### On your local machine
|
||||
|
||||
#### In your config.yaml
|
||||
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
- name: <MODEL_NAME>
|
||||
provider: openai
|
||||
model: <MODEL_ID>
|
||||
apiKey: <TETRATE_API_KEY>
|
||||
apiBase: https://api.router.tetrate.ai/v1
|
||||
```
|
||||
|
||||
#### As a local model block
|
||||
|
||||
Review the configuration reference for [model blocks](/reference#models) and using [local blocks](/reference#local-blocks). Ensure you look at the roles and capabilities section and review the [model capabilities guide](/customize/deep-dives/model-capabilities).
|
||||
|
||||
```yaml title="model_name.yaml"
|
||||
name: <MODEL_NAME>
|
||||
models:
|
||||
- name: <MODEL_NAME>
|
||||
provider: openai
|
||||
model: <MODEL_ID>
|
||||
apiKey: ${{ inputs.TETRATE_API_KEY }}
|
||||
apiBase: https://api.router.tetrate.ai/v1
|
||||
roles:
|
||||
- chat
|
||||
- edit
|
||||
- apply
|
||||
capabilities:
|
||||
- tool_use
|
||||
```
|
||||
|
||||
### On Model Block on Continue Hub
|
||||
Learn how to use model blocks on Continue Hub [here](/hub/blocks/create-a-block).
|
||||
|
||||
```yaml title="model_name.yaml"
|
||||
name: <MODEL_NAME>
|
||||
models:
|
||||
- name: <MODEL_NAME>
|
||||
provider: openai
|
||||
model: <MODEL_ID>
|
||||
apiKey: ${{ inputs.TETRATE_API_KEY }}
|
||||
apiBase: https://api.router.tetrate.ai/v1
|
||||
roles:
|
||||
- chat
|
||||
- edit
|
||||
- apply
|
||||
capabilities:
|
||||
- tool_use
|
||||
```
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
title: "Model roles"
|
||||
sidebarTitle: Overview
|
||||
icon: "circle-info"
|
||||
description: "Learn about the different model roles in Continue including chat, autocomplete, edit, apply, embeddings, and reranking for customizing your AI coding assistant's capabilities"
|
||||
description: "Learn about the different model roles in Continue including chat, autocomplete, edit, apply, embeddings, and reranking for customizing your AI coding agent's capabilities"
|
||||
---
|
||||
|
||||
<CardGroup>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ These roles can be specified for a `config.yaml` model block using `roles`. See
|
|||
|
||||
## Selecting model roles
|
||||
|
||||
You can control which of the models in your assistant for a given role will be currently used for that role. Above the main input, click the 3 dots and then the cube icon to expand the `Models` section. Then you can use the dropdowns to select an active model for each role.
|
||||
You can control which of the models in your agent for a given role will be currently used for that role. Above the main input, click the 3 dots and then the cube icon to expand the `Models` section. Then you can use the dropdowns to select an active model for each role.
|
||||
|
||||

|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ These roles can be specified for a `config.yaml` model block using `roles`. See
|
|||
|
||||
## Selecting model roles
|
||||
|
||||
You can control which of the models in your assistant for a given role will be currently used for that role. Above the main input, click the 3 dots and then the cube icon to expand the `Models` section. Then you can use the dropdowns to select an active model for each role.
|
||||
You can control which of the models in your agent for a given role will be currently used for that role. Above the main input, click the 3 dots and then the cube icon to expand the `Models` section. Then you can use the dropdowns to select an active model for each role.
|
||||
|
||||
<Frame>
|
||||
<img src="/images/settings-model-roles-5e5f8a6bd9137b70cf94178a7e45847c.png" />
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@
|
|||
"customize/model-providers/top-level/ollama",
|
||||
"customize/model-providers/top-level/openrouter",
|
||||
"customize/model-providers/top-level/openai",
|
||||
"customize/model-providers/top-level/tetrate_agent_router_service",
|
||||
"customize/model-providers/top-level/vertexai"
|
||||
]
|
||||
},
|
||||
|
|
@ -179,13 +180,13 @@
|
|||
"pages": [
|
||||
"hub/introduction",
|
||||
{
|
||||
"group": "Assistants",
|
||||
"group": "agents",
|
||||
"icon": "robot",
|
||||
"pages": [
|
||||
"hub/assistants/intro",
|
||||
"hub/assistants/use-an-assistant",
|
||||
"hub/assistants/create-an-assistant",
|
||||
"hub/assistants/edit-an-assistant"
|
||||
"hub/agents/intro",
|
||||
"hub/agents/use-an-agent",
|
||||
"hub/agents/create-an-agent",
|
||||
"hub/agents/edit-an-agent"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -228,7 +229,7 @@
|
|||
"group": "Guides",
|
||||
"pages": [
|
||||
"guides/overview",
|
||||
"guides/understanding-assistants",
|
||||
"guides/understanding-agents",
|
||||
"guides/codebase-documentation-awareness",
|
||||
"guides/cli",
|
||||
"guides/continuous-ai",
|
||||
|
|
@ -348,17 +349,13 @@
|
|||
"source": "/hub/secrets",
|
||||
"destination": "/hub/secrets/secret-types"
|
||||
},
|
||||
{
|
||||
"source": "/hub/assistants",
|
||||
"destination": "/hub/assistants/intro"
|
||||
},
|
||||
{
|
||||
"source": "/hub/blocks",
|
||||
"destination": "/hub/blocks/intro"
|
||||
},
|
||||
{
|
||||
"source": "/hub/agents/intro",
|
||||
"destination": "/hub/assistants/intro"
|
||||
"destination": "/hub/agents/intro"
|
||||
},
|
||||
{
|
||||
"source": "/customize",
|
||||
|
|
@ -1106,7 +1103,7 @@
|
|||
},
|
||||
{
|
||||
"source": "/troubleshooting#changes-to-assistants-not-showing-in-vs-code",
|
||||
"destination": "/faqs#changes-to-assistants-not-showing-in-vs-code"
|
||||
"destination": "/faqs#changes-to-agents-not-showing-in-vs-code"
|
||||
},
|
||||
{
|
||||
"source": "/troubleshooting#i-installed-continue-but-dont-see-the-sidebar-window",
|
||||
|
|
@ -1175,6 +1172,26 @@
|
|||
{
|
||||
"source": "/features/edit/next-edit",
|
||||
"destination": "/features/autocomplete/next-edit"
|
||||
},
|
||||
{
|
||||
"source": "/hub/assistants/intro",
|
||||
"destination": "/hub/agents/intro"
|
||||
},
|
||||
{
|
||||
"source": "/hub/assistants/use-an-assistant",
|
||||
"destination": "/hub/agents/use-an-agent"
|
||||
},
|
||||
{
|
||||
"source": "/hub/assistants/create-an-assistant",
|
||||
"destination": "/hub/agents/create-an-agent"
|
||||
},
|
||||
{
|
||||
"source": "/hub/assistants/edit-an-assistant",
|
||||
"destination": "/hub/agents/edit-an-agent"
|
||||
},
|
||||
{
|
||||
"source": "/guides/understanding-assistants",
|
||||
"destination": "/guides/understanding-agents"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,15 +48,15 @@ If you are using VS Code and require requests to be made through a proxy, you ar
|
|||
|
||||
Continue can be used in [code-server](https://coder.com/), but if you are running across an error in the logs that includes "This is likely because the editor is not running in a secure context", please see [their documentation on securely exposing code-server](https://coder.com/docs/code-server/latest/guide#expose-code-server).
|
||||
|
||||
## Changes to assistants not showing in VS Code
|
||||
## Changes to agents not showing in VS Code
|
||||
|
||||
If you've made changes to assistants (adding, modifying, or removing them) but the changes aren't appearing in the Continue extension in VS Code, try reloading the VS Code window:
|
||||
If you've made changes to agents (adding, modifying, or removing them) but the changes aren't appearing in the Continue extension in VS Code, try reloading the VS Code window:
|
||||
|
||||
1. Open the command palette (`cmd/ctrl` + `shift` + `P`)
|
||||
2. Type "Reload Window"
|
||||
3. Select the reload option
|
||||
|
||||
This will restart VS Code and reload all extensions, which should make your assistant changes visible.
|
||||
This will restart VS Code and reload all extensions, which should make your agent changes visible.
|
||||
|
||||
## I installed Continue, but don't see the sidebar window
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ If you're getting parse errors with remote Ollama:
|
|||
|
||||
3. **Check URL format**: Ensure you're using `http://` not `https://` for local network addresses
|
||||
|
||||
## Local Assistant
|
||||
## Local Agent
|
||||
|
||||
### Managing Local Secrets and Environment Variables
|
||||
|
||||
|
|
@ -318,7 +318,7 @@ If your API keys aren't being recognized:
|
|||
|
||||
### Using Model Addons Locally
|
||||
|
||||
You can leverage model addons from the Continue Hub in your local assistant configurations using the `uses:` syntax. This allows you to reference pre-configured model blocks without duplicating configuration.
|
||||
You can leverage model addons from the Continue Hub in your local agent configurations using the `uses:` syntax. This allows you to reference pre-configured model blocks without duplicating configuration.
|
||||
|
||||
#### Requirements
|
||||
|
||||
|
|
@ -330,7 +330,7 @@ You can leverage model addons from the Continue Hub in your local assistant conf
|
|||
In your local `config.yaml`, reference model addons using the format `provider/model-name`:
|
||||
|
||||
```yaml
|
||||
name: My Local Assistant
|
||||
name: My Local Agent
|
||||
version: 0.0.1
|
||||
schema: v1
|
||||
models:
|
||||
|
|
@ -344,7 +344,7 @@ models:
|
|||
You can combine hub model addons with local models:
|
||||
|
||||
```yaml
|
||||
name: My Local Assistant
|
||||
name: My Local Agent
|
||||
version: 0.0.1
|
||||
schema: v1
|
||||
models:
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ sidebarTitle: "Customize Agent"
|
|||
|
||||
## How to Add Rules Blocks
|
||||
|
||||
Adding Rules can be done in your assistant locally or in the Hub. You can explore Rules on the Continue Hub and refer to the [Rules deep dive](/customize/deep-dives/rules) for more details.
|
||||
Adding Rules can be done in your agent locally or in the Hub. You can explore Rules on the Continue Hub and refer to the [Rules deep dive](/customize/deep-dives/rules) for more details.
|
||||
|
||||
## How to Customize System Messages
|
||||
|
||||
|
|
@ -18,14 +18,14 @@ models:
|
|||
provider: openai
|
||||
model: gpt-4o
|
||||
chatOptions:
|
||||
baseSystemMessage: "You are a helpful coding assistant."
|
||||
baseAgentSystemMessage: "You are a systematic coding assistant. Break down problems methodically."
|
||||
basePlanSystemMessage: "You are a planning assistant. Create clear, actionable steps."
|
||||
baseSystemMessage: "You are a helpful coding agent."
|
||||
baseAgentSystemMessage: "You are a systematic coding agent. Break down problems methodically."
|
||||
basePlanSystemMessage: "You are a planning agent. Create clear, actionable steps."
|
||||
```
|
||||
|
||||
## How to Add MCP Tools
|
||||
|
||||
You can add MCP servers to your assistant to give Agent access to more tools. Explore [MCP Servers on the Hub](https://hub.continue.dev) and consult the [MCP guide](/customize/deep-dives/mcp) for more details.
|
||||
You can add MCP servers to your agent to give Agent access to more tools. Explore [MCP Servers on the Hub](https://hub.continue.dev) and consult the [MCP guide](/customize/deep-dives/mcp) for more details.
|
||||
|
||||
## How to Configure Tool Policies
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@ title: “Customize Autocomplete Settings in Continue”
|
|||
description: “Learn how to customize autocomplete behavior in Continue, including user settings, configuration options, and adjustments to improve AI code suggestions in your IDE.”
|
||||
---
|
||||
|
||||
Continue offers a handful of settings to customize autocomplete behavior. Visit the [User Settings Page](/customize/settings) to manage these settings.
|
||||
Continue offers a handful of settings to customize autocomplete behavior. Visit the User Settings Page (Gear Icon) to manage these settings.
|
||||
|
||||
For a comprehensive guide on all configuration options and their impacts, see the [Autocomplete deep dive](/customize/deep-dives/autocomplete).
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ sidebarTitle: "Customize Edit"
|
|||
|
||||
## How to Set Active Edit/Apply Model
|
||||
|
||||
You can configure particular models from your Assistant to be used for Edit and Apply requests.
|
||||
You can configure particular models from your Agent to be used for Edit and Apply requests.
|
||||
|
||||
1. Click the 3 dots above the main input
|
||||
2. Click the cube icon to expand the "Models" section
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: "Understanding Assistants"
|
||||
title: "Understanding Agents"
|
||||
description: "Continue offers two ways to configure your AI assistants"
|
||||
---
|
||||
|
||||
This content has moved to our comprehensive guide: [Understanding Assistants: Hub vs Local Configuration](/guides/understanding-assistants)
|
||||
This content has moved to our comprehensive guide: [Understanding Agents: Hub vs Local Configuration](/guides/understanding-assistants)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ The Continue logo will appear on the left sidebar. For a better experience, move
|
|||
</Step>
|
||||
|
||||
<Step title="Sign In">
|
||||
[Sign in to the hub](https://auth.continue.dev/) to get started with your first assistant
|
||||
[Sign in to the hub](https://auth.continue.dev/) to get started with your first agent
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ Click `Install`, which will cause the Continue logo to show up on the right tool
|
|||
</Step>
|
||||
|
||||
<Step title="Sign In">
|
||||
[Sign in to the hub](https://auth.continue.dev/) to get started with your first assistant
|
||||
[Sign in to the hub](https://auth.continue.dev/) to get started with your first agent
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
|
|
@ -68,6 +68,6 @@ Click `Install`, which will cause the Continue logo to show up on the right tool
|
|||
|
||||
## Signing in
|
||||
|
||||
Click "Get started" to sign in to the hub and start using assistants.
|
||||
Click "Get started" to sign in to the hub and start using agents.
|
||||
|
||||

|
||||
|
|
|
|||
|
|
@ -57,6 +57,6 @@ description: "To quickly understand what you can do with Continue, check out eac
|
|||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
## AI Coding Assistants
|
||||
## AI Coding Agents
|
||||
|
||||
Continue offers flexible AI assistants that enhance your development workflow. You can choose between cloud-managed **Hub Assistants** for easy setup and synchronization, or **Local Assistants** for complete control and privacy. Learn more about [understanding and configuring assistants](/guides/understanding-assistants).
|
||||
Continue offers flexible AI assistants that enhance your development workflow. You can choose between cloud-managed **Hub Agents** for easy setup and synchronization, or **Local Agents** for complete control and privacy. Learn more about [understanding and configuring assistants](/guides/understanding-assistants).
|
||||
|
|
|
|||
|
|
@ -247,12 +247,12 @@ Ready to master specific features? Check out these detailed guides:
|
|||
|
||||
<Accordion title="Chat & Agent Best Practices">
|
||||
Discover [effective prompting techniques](/customize/deep-dives/prompts), [hub
|
||||
v. local assistants](/guides/understanding-assistants), and [custom slash
|
||||
v. local agents](/guides/understanding-agents), and [custom slash
|
||||
commands](/customize/deep-dives/slash-commands).
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Enterprise & Teams">
|
||||
Explore [Hub Assistants](/hub/assistants/intro), [organization
|
||||
Explore [Hub Agents](/hub/agents/intro), [organization
|
||||
management](/hub/governance/creating-an-org), and [sharing
|
||||
configurations](/hub/sharing).
|
||||
</Accordion>
|
||||
|
|
|
|||
|
|
@ -123,8 +123,8 @@ Track how often you need to correct AI output. Lower intervention rates mean hig
|
|||
Imagine setting up an AI agent that checks new GitHub issues every morning and leaves the first helpful response. This lightens the load for maintainers and ensures community members feel heard quickly.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Pattern 2: The PR Review Assistant">
|
||||
AI can automatically review new pull requests for security, performance, and style issues. The reviewer still has the final say, but the assistant highlights common problems and speeds up the feedback loop.
|
||||
<Accordion title="Pattern 2: The PR Review Agent">
|
||||
AI can automatically review new pull requests for security, performance, and style issues. The reviewer still has the final say, but the agent highlights common problems and speeds up the feedback loop.
|
||||
|
||||
</Accordion>
|
||||
<Accordion title="Pattern 3: The Documentation Guardian">
|
||||
|
|
@ -203,5 +203,5 @@ Ready to amplify your development workflow with Continuous AI? Start with one si
|
|||
|
||||
<Card title="Want to dive deeper?" icon="rocket">
|
||||
Check out our guides on [Continue CLI](/guides/cli) and [Understanding
|
||||
Assistants](/guides/understanding-assistants).
|
||||
Agents](/guides/understanding-agents).
|
||||
</Card>
|
||||
|
|
|
|||
|
|
@ -86,8 +86,8 @@ There are multiple ways to configure Ollama models in Continue:
|
|||
|
||||
The easiest way is to use [pre-configured model blocks](/reference#local-blocks) from the Continue Hub in your local configuration:
|
||||
|
||||
```yaml title="~/.continue/assistants/My Local Assistant.yaml"
|
||||
name: My Local Assistant
|
||||
```yaml title="~/.continue/agents/My Local Agent.yaml"
|
||||
name: My Local Agent
|
||||
version: 0.0.1
|
||||
schema: v1
|
||||
models:
|
||||
|
|
@ -309,11 +309,11 @@ ollama pull deepseek-r1:32b
|
|||
#### Using Hub Blocks in Local Config
|
||||
|
||||
**Problem**: Unclear how to use hub models locally
|
||||
**Solution**: Create a local assistant file:
|
||||
**Solution**: Create a local agent file:
|
||||
|
||||
```yaml
|
||||
# ~/.continue/assistants/Local.yaml
|
||||
name: Local Assistant
|
||||
# ~/.continue/agents/Local.yaml
|
||||
name: Local Agent
|
||||
version: 0.0.1
|
||||
schema: v1
|
||||
models:
|
||||
|
|
|
|||
|
|
@ -1,63 +1,63 @@
|
|||
---
|
||||
title: "How to Understand Assistants: Hub vs Local Configuration"
|
||||
description: "Learn how to choose between cloud-managed Hub assistants and local configuration for AI development assistance in Continue, including setup, management, and best practices for each approach"
|
||||
title: "How to Understand Agents: Hub vs Local Configuration"
|
||||
description: "Learn how to choose between cloud-managed Hub agents and local configuration for AI development assistance in Continue, including setup, management, and best practices for each approach"
|
||||
---
|
||||
|
||||
Every developer has unique needs when it comes to AI assistance. Some prefer the convenience of cloud-managed configurations, while others need the control and privacy of local setups. Continue offers both paths, and this guide will help you choose the right one for your workflow.
|
||||
|
||||
## What Are the Two Paths to AI Assistance?
|
||||
|
||||
Continue provides two distinct ways to configure your AI assistant:
|
||||
Continue provides two distinct ways to configure your AI agent:
|
||||
|
||||
Think of Continue's configuration options like choosing between a managed service and self-hosting. Both get you to the same destination—powerful AI assistance in your IDE—but the journey and control level differ significantly.
|
||||
|
||||
### How to Access Your Assistant Configuration
|
||||
### How to Access Your Agent Configuration
|
||||
|
||||
Before we dive into the specifics, let's understand how to access your configuration:
|
||||
|
||||
1. Open the Continue Chat sidebar by pressing <kbd>cmd/ctrl</kbd> + <kbd>L</kbd> (VS Code) or <kbd>cmd/ctrl</kbd> + <kbd>J</kbd> (JetBrains)
|
||||
2. Click the Assistant selector above the main chat input
|
||||
3. Hover over an assistant and click:
|
||||
- `new window` icon for Hub assistants
|
||||
- `gear` icon for Local assistants
|
||||
2. Click the Agent selector above the main chat input
|
||||
3. Hover over an agent and click:
|
||||
- `new window` icon for Hub agents
|
||||
- `gear` icon for Local agents
|
||||
|
||||

|
||||

|
||||
|
||||
## What Are Hub Assistants: The Managed Experience
|
||||
## What Are Hub Agents: The Managed Experience
|
||||
|
||||
Hub Assistants represent the "it just works" philosophy. When you [sign in to Continue Hub](https://auth.continue.dev/), you gain access to a curated ecosystem of pre-configured assistants that sync seamlessly across all your development environments.
|
||||
Hub Agents represent the "it just works" philosophy. When you [sign in to Continue Hub](https://auth.continue.dev/), you gain access to a curated ecosystem of pre-configured agents that sync seamlessly across all your development environments.
|
||||
|
||||
### Why Should You Choose Hub Assistants?
|
||||
### Why Should You Choose Hub Agents?
|
||||
|
||||
**The Power of Simplicity**
|
||||
|
||||
- **Instant Setup**: Browse the [assistant marketplace](https://hub.continue.dev/explore/assistants) and add any assistant to your account with a single click
|
||||
- **Instant Setup**: Browse the [agent marketplace](https://hub.continue.dev) and add any agent to your account with a single click
|
||||
- **Web-Based Management**: Configure models, add secrets, and customize settings through an intuitive web interface—no JSON editing required
|
||||
- **Automatic Synchronization**: Make a change on the hub, and it reflects immediately across all your IDE instances
|
||||
- **Team Collaboration**: Share custom assistants with your team, ensuring everyone uses the same optimized configurations
|
||||
- **Team Collaboration**: Share custom agents with your team, ensuring everyone uses the same optimized configurations
|
||||
|
||||

|
||||

|
||||
|
||||
### How to Get Started with Hub Assistants
|
||||
### How to Get Started with Hub Agents
|
||||
|
||||
The journey from zero to AI-powered coding takes just four steps:
|
||||
|
||||
1. **Select Your Assistant**: Click the assistant selector in your IDE's Continue panel
|
||||
2. **Explore or Create**: Browse community assistants or craft your own specialized helper
|
||||
1. **Select Your Agent**: Click the agent selector in your IDE's Continue panel
|
||||
2. **Explore or Create**: Browse community agents or craft your own specialized helper
|
||||
3. **Secure Your Keys**: Add API keys as [User Secrets](https://hub.continue.dev/settings/secrets) in the hub—they're encrypted and never exposed
|
||||
4. **Sync and Code**: Click "Reload config" to pull your latest settings
|
||||
|
||||
Pro tip: Hub Assistants are perfect for teams. Create a custom assistant with your team's coding standards, preferred models, and context sources, then share it with a simple link.
|
||||
Pro tip: Hub Agents are perfect for teams. Create a custom agent with your team's coding standards, preferred models, and context sources, then share it with a simple link.
|
||||
|
||||
### How to Manage Hub Assistants
|
||||
### How to Manage Hub Agents
|
||||
|
||||
All Hub Assistant management happens through [the Hub](https://hub.continue.dev). For detailed customization, see our guide on [Editing an Assistant](/hub/assistants/edit-an-assistant).
|
||||
All Hub Agent management happens through [the Hub](https://hub.continue.dev). For detailed customization, see our guide on [Editing an Agent](/hub/agents/edit-an-agent).
|
||||
|
||||
## What Are Local Assistants: The Power User's Choice
|
||||
## What Are Local Agents: The Power User's Choice
|
||||
|
||||
Local Assistants put you in the driver's seat. Using a `config.yaml` file, you have complete control over every aspect of your AI assistant's behavior, with all configuration stored directly on your machine.
|
||||
Local Agents put you in the driver's seat. Using a `config.yaml` file, you have complete control over every aspect of your AI agent's behavior, with all configuration stored directly on your machine.
|
||||
|
||||
### Why Should You Choose Local Assistants?
|
||||
### Why Should You Choose Local Agents?
|
||||
|
||||
**Complete Control and Privacy**
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ Local Assistants put you in the driver's seat. Using a `config.yaml` file, you h
|
|||
- **Offline Capability**: Once configured, no internet connection needed (assuming you're using local models)
|
||||
- **Unlimited Customization**: Access every configuration option, experimental feature, and advanced setting
|
||||
|
||||
### How to Set Up Local Assistants
|
||||
### How to Set Up Local Agents
|
||||
|
||||
Local configuration lives in a single YAML file in your home directory:
|
||||
|
||||
|
|
@ -77,13 +77,13 @@ Local configuration lives in a single YAML file in your home directory:
|
|||
|
||||
**Quick Access Method:**
|
||||
|
||||
1. Open the assistants dropdown in your IDE
|
||||
2. Click the gear icon next to "Local Assistant"
|
||||
1. Open the agents dropdown in your IDE
|
||||
2. Click the gear icon next to "Local Agent"
|
||||
3. The `config.yaml` file opens in your editor
|
||||
|
||||

|
||||
|
||||
### The Local Assistant Experience
|
||||
### The Local Agent Experience
|
||||
|
||||
When you edit your `config.yaml`, Continue provides intelligent autocomplete for all available options. Save the file, and Continue automatically reloads your configuration—no restart required.
|
||||
|
||||
|
|
@ -93,9 +93,9 @@ For the complete configuration reference, see our [config.yaml documentation](/r
|
|||
|
||||
## How to Make the Right Choice
|
||||
|
||||
The decision between Hub and Local assistants often comes down to your specific needs and constraints. Here's a framework to help you decide:
|
||||
The decision between Hub and Local agents often comes down to your specific needs and constraints. Here's a framework to help you decide:
|
||||
|
||||
### Choose Hub Assistants When You:
|
||||
### Choose Hub Agents When You:
|
||||
|
||||
**Value Convenience Over Control**
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ The decision between Hub and Local assistants often comes down to your specific
|
|||
|
||||
**Need Advanced Collaboration**
|
||||
|
||||
- Want to share custom assistants with teammates
|
||||
- Want to share custom agents with teammates
|
||||
- Need centralized API key management
|
||||
- Require quick updates across your entire organization
|
||||
|
||||
|
|
@ -116,7 +116,7 @@ The decision between Hub and Local assistants often comes down to your specific
|
|||
- Want to experiment with different models and configurations
|
||||
- Prefer guided setup experiences
|
||||
|
||||
### Choose Local Assistants When You:
|
||||
### Choose Local Agents When You:
|
||||
|
||||
**Require Maximum Control**
|
||||
|
||||
|
|
@ -140,21 +140,21 @@ The decision between Hub and Local assistants often comes down to your specific
|
|||
|
||||
Here's a secret: you don't have to choose just one. Many developers use both approaches:
|
||||
|
||||
- **Hub Assistants** for general development and experimentation
|
||||
- **Local Assistants** for production work or client projects with specific requirements
|
||||
- **Hub Agents** for general development and experimentation
|
||||
- **Local Agents** for production work or client projects with specific requirements
|
||||
|
||||
You can switch between them seamlessly using the assistant selector in your IDE.
|
||||
You can switch between them seamlessly using the agent selector in your IDE.
|
||||
|
||||
## Common Patterns and Best Practices
|
||||
|
||||
### For Hub Assistant Users
|
||||
### For Hub Agent Users
|
||||
|
||||
1. **Start with Community Assistants**: Before creating your own, explore what others have built
|
||||
1. **Start with Community Agents**: Before creating your own, explore what others have built
|
||||
2. **Use Secrets Properly**: Never hardcode API keys—always use the User Secrets feature
|
||||
3. **Create Specialized Assistants**: Make different assistants for different contexts (frontend, backend, DevOps)
|
||||
3. **Create Specialized Agents**: Make different agents for different contexts (frontend, backend, DevOps)
|
||||
4. **Share Liberally**: If you create something useful, share it with the community
|
||||
|
||||
### For Local Assistant Users
|
||||
### For Local Agent Users
|
||||
|
||||
1. **Version Control Your Config**: Treat your `config.yaml` like code—commit it, review changes, and maintain history
|
||||
2. **Use Environment Variables**: For sensitive data, reference environment variables instead of hardcoding values
|
||||
|
|
@ -163,7 +163,7 @@ You can switch between them seamlessly using the assistant selector in your IDE.
|
|||
|
||||
## Troubleshooting and Tips
|
||||
|
||||
### Hub Assistant Issues
|
||||
### Hub Agent Issues
|
||||
|
||||
**Changes Not Reflecting?**
|
||||
|
||||
|
|
@ -171,12 +171,12 @@ You can switch between them seamlessly using the assistant selector in your IDE.
|
|||
- Check your internet connection
|
||||
- Ensure you're signed in to the correct account
|
||||
|
||||
**Assistant Not Available?**
|
||||
**Agent Not Available?**
|
||||
|
||||
- Verify it's added to your account on the hub
|
||||
- Check if it requires specific API keys
|
||||
|
||||
### Local Assistant Issues
|
||||
### Local Agent Issues
|
||||
|
||||
**Config Not Loading?**
|
||||
|
||||
|
|
@ -193,7 +193,7 @@ You can switch between them seamlessly using the assistant selector in your IDE.
|
|||
|
||||
Now that you understand both configuration approaches, you're ready to dive deeper:
|
||||
|
||||
- **For Hub Users**: [Create Your First Assistant](/hub/assistants/create-an-assistant)
|
||||
- **For Hub Users**: [Create Your First Agent](/hub/agents/create-an-agent)
|
||||
- **For Local Users**: [Explore the Config Reference](/reference)
|
||||
- **For Everyone**: [Discover Available Models](/customize/model-providers/overview)
|
||||
|
||||
34
docs/hub/agents/create-an-agent.mdx
Normal file
34
docs/hub/agents/create-an-agent.mdx
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
title: "How to Create an AI Agent"
|
||||
description: "Learn how to create custom AI coding agents in Continue Hub by remixing existing agents or building new ones from scratch with reusable blocks and YAML configuration."
|
||||
sidebarTitle: "Create an AI Agent"
|
||||
---
|
||||
|
||||
## How to Create an AI Agent from Scratch
|
||||
|
||||
To create an agent from scratch, select “New agent” in the top bar.
|
||||
|
||||

|
||||
|
||||
Choose a name, slug, description, and icon for your agent.
|
||||
|
||||
The easiest way to create an agent is to click "Create agent" with the default configuration and then add / remove blocks using the sidebar.
|
||||
|
||||
Alternatively, you can edit the agent YAML directly before clicking "Create agent". Refer to examples of agents on [hub.continue.dev](https://hub.continue.dev) and visit the [YAML Reference](/reference#complete-yaml-config-example) docs for more details.
|
||||
|
||||

|
||||
|
||||
## How to Remix an Agent
|
||||
|
||||
You can also create an agent by remixing an existing one. This is useful if you want to start with a pre-configured agent and make modifications.
|
||||
|
||||
By clicking the “remix” button, you’ll be taken to the “Create a remix” page.
|
||||
|
||||

|
||||
|
||||
Once here, you’ll be able to
|
||||
|
||||
1. add or remove blocks in YAML configuration
|
||||
2. change the name, description, icon, etc.
|
||||
|
||||
Clicking “Create agent” will make this agent available for use.
|
||||
20
docs/hub/agents/edit-an-agent.mdx
Normal file
20
docs/hub/agents/edit-an-agent.mdx
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
title: "How to Edit an Agent"
|
||||
description: "New versions of an agent can be created and published using the sidebar."
|
||||
---
|
||||
|
||||

|
||||
|
||||
First, select an agent from the dropdown at the top.
|
||||
|
||||
While editing an agent, you can explore the hub and click "Add Block" from a block page to add it to your agent.
|
||||
|
||||
For blocks that require secret values like API keys, you will see a small notification on the block's tile in the sidebar that will indicate if action is needed.
|
||||
|
||||
To delete a block, click the trash icon.
|
||||
|
||||
If a block you want to use does not exist yet, you can [create a new block](/hub/blocks/create-a-block).
|
||||
|
||||
When you are done editing, click "Publish" to publish a new version of the agent.
|
||||
|
||||
Click "Open VS Code" or "Open JetBrains" to open your IDE for using the agent.
|
||||
8
docs/hub/agents/intro.mdx
Normal file
8
docs/hub/agents/intro.mdx
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
title: "Introduction to Agents"
|
||||
description: "Custom AI code agents are configurations of building blocks that enable a coding experience tailored to your specific use cases."
|
||||
---
|
||||
|
||||
`config.yaml` is a format for defining custom AI code agents. An agent has some top-level properties (e.g. `name`, `version`), but otherwise consists of composable lists of **blocks** such as `models` and `rules`, which are the atomic building blocks of an agent.
|
||||
|
||||
The `config.yaml` is parsed by the open-source Continue IDE extensions to create custom agent experiences. When you log in to [hub.continue.dev](https://hub.continue.dev/), your agents will automatically be synced with the IDE extensions.
|
||||
19
docs/hub/agents/use-an-agent.mdx
Normal file
19
docs/hub/agents/use-an-agent.mdx
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
title: "How to Use an Agent"
|
||||
description: "Learn how to add, configure, and use an AI agent in Continue, including setting required inputs and selecting it in your IDE extension."
|
||||
---
|
||||
|
||||
## Steps to Use an AI Agent in Continue
|
||||
|
||||
Once you've found the agent you want to use on Continue Hub:
|
||||
|
||||
1. Click “Add Agent” on its page
|
||||
2. Add any required inputs (e.g. secrets like API keys)
|
||||
3. Select “Save changes” in agent sidebar on the right hand side
|
||||
|
||||
After saving, open your IDE extension and:
|
||||
|
||||
- Select the agent from the **agent dropdown** in the Continue extension.
|
||||
- Begin using it for chat, code generation, or other configured capabilities.
|
||||
|
||||

|
||||
|
|
@ -1,34 +0,0 @@
|
|||
---
|
||||
title: "How to Create an AI Assistant"
|
||||
description: "Learn how to create custom AI coding assistants in Continue Hub by remixing existing assistants or building new ones from scratch with reusable blocks and YAML configuration."
|
||||
sidebarTitle: "Create an AI Assistant"
|
||||
---
|
||||
|
||||
## How to Create an AI Assistant from Scratch
|
||||
|
||||
To create an assistant from scratch, select “New assistant” in the top bar.
|
||||
|
||||

|
||||
|
||||
Choose a name, slug, description, and icon for your assistant.
|
||||
|
||||
The easiest way to create an assistant is to click "Create assistant" with the default configuration and then add / remove blocks using the sidebar.
|
||||
|
||||
Alternatively, you can edit the assistant YAML directly before clicking "Create assistant". Refer to examples of assistants on [hub.continue.dev](https://hub.continue.dev/explore/assistants) and visit the [YAML Reference](/reference#complete-yaml-config-example) docs for more details.
|
||||
|
||||

|
||||
|
||||
## How to Remix an Assistant
|
||||
|
||||
You can also create an assistant by remixing an existing one. This is useful if you want to start with a pre-configured assistant and make modifications.
|
||||
|
||||
By clicking the “remix” button, you’ll be taken to the “Create a remix” page.
|
||||
|
||||

|
||||
|
||||
Once here, you’ll be able to
|
||||
|
||||
1. add or remove blocks in YAML configuration
|
||||
2. change the name, description, icon, etc.
|
||||
|
||||
Clicking “Create assistant” will make this assistant available for use.
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
---
|
||||
title: "How to Edit an Assistant"
|
||||
description: "New versions of an assistant can be created and published using the sidebar."
|
||||
---
|
||||
|
||||

|
||||
|
||||
First, select an assistant from the dropdown at the top.
|
||||
|
||||
While editing an assistant, you can explore the hub and click "Add Block" from a block page to add it to your assistant.
|
||||
|
||||
For blocks that require secret values like API keys, you will see a small notification on the block's tile in the sidebar that will indicate if action is needed.
|
||||
|
||||
To delete a block, click the trash icon.
|
||||
|
||||
If a block you want to use does not exist yet, you can [create a new block](/hub/blocks/create-a-block).
|
||||
|
||||
When you are done editing, click "Publish" to publish a new version of the assistant.
|
||||
|
||||
Click "Open VS Code" or "Open JetBrains" to open your IDE for using the assistant.
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
title: "Introduction to Assistants"
|
||||
description: "Custom AI code assistants are configurations of building blocks that enable a coding experience tailored to your specific use cases."
|
||||
---
|
||||
|
||||
`config.yaml` is a format for defining custom AI code assistants. An assistant has some top-level properties (e.g. `name`, `version`), but otherwise consists of composable lists of **blocks** such as `models` and `rules`, which are the atomic building blocks of an assistant.
|
||||
|
||||
The `config.yaml` is parsed by the open-source Continue IDE extensions to create custom assistant experiences. When you log in to [hub.continue.dev](https://hub.continue.dev/), your assistants will automatically be synced with the IDE extensions.
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
---
|
||||
title: "How to Use an Assistant"
|
||||
description: "Learn how to add, configure, and use an AI assistant in Continue, including setting required inputs and selecting it in your IDE extension."
|
||||
---
|
||||
|
||||
## Steps to Use an AI Assistant in Continue
|
||||
|
||||
Once you've found the assistant you want to use on Continue Hub:
|
||||
|
||||
1. Click “Add Assistant” on its page
|
||||
2. Add any required inputs (e.g. secrets like API keys)
|
||||
3. Select “Save changes” in assistant sidebar on the right hand side
|
||||
|
||||
After saving, open your IDE extension and:
|
||||
|
||||
- Select the assistant from the **assistant dropdown** in the Continue extension.
|
||||
- Begin using it for chat, code generation, or other configured capabilities.
|
||||
|
||||

|
||||
|
|
@ -20,7 +20,7 @@ Learn more in the [MCP deep dive](/customize/deep-dives/mcp), and view [`mcpServ
|
|||
|
||||
## Rules
|
||||
|
||||
Rules blocks are instructions that your custom AI code assistant will always keep in mind - the contents of rules are inserted into the system message for all Chat requests. [Explore rules](https://hub.continue.dev/explore/rules) on the hub.
|
||||
Rules blocks are instructions that your custom AI code agent will always keep in mind - the contents of rules are inserted into the system message for all Chat requests. [Explore rules](https://hub.continue.dev/explore/rules) on the hub.
|
||||
|
||||
Learn more in the [rules deep dive](/customize/deep-dives/rules), and view [`rules`](/reference#rules) in the YAML Reference for more details.
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ By clicking the “remix” button, you’ll be taken to the “Create a remix
|
|||
|
||||

|
||||
|
||||
Once here, you’ll be able to 1) edit YAML configuration for the block and 2) change name, description, icon, etc. Clicking “Create block” will make this block available for use in an assistant.
|
||||
Once here, you’ll be able to 1) edit YAML configuration for the block and 2) change name, description, icon, etc. Clicking “Create block” will make this block available for use in an agent.
|
||||
|
||||
## How to Create a Block from Scratch
|
||||
|
||||
|
|
@ -26,4 +26,4 @@ After filling out information on the block, you will want to create a block foll
|
|||
|
||||
### Block Inputs
|
||||
|
||||
Blocks can receive values, including secrets, as inputs through templating. For values that the user of the block needs to set, you can use template variables (e.g. `${{ inputs.API_KEY}}`). Then, the user can set `API_KEY: ${{ secrets.MY_API_KEY }}` in the `with` clause of their assistant.
|
||||
Blocks can receive values, including secrets, as inputs through templating. For values that the user of the block needs to set, you can use template variables (e.g. `${{ inputs.API_KEY}}`). Then, the user can set `API_KEY: ${{ secrets.MY_API_KEY }}` in the `with` clause of their agent.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: "Introduction"
|
||||
description: "Blocks are the components you use to build a custom AI code assistant. These include Models, MCP Servers, Rules, and Prompts."
|
||||
description: "Blocks are the components you use to build a custom AI code agent. These include Models, MCP Servers, Rules, and Prompts."
|
||||
---
|
||||
|
||||
Blocks follow the [`config.yaml`](/reference) format. When combined with other blocks into a complete `config.yaml`, they form a custom AI code assistant.
|
||||
Blocks follow the [`config.yaml`](/reference) format. When combined with other blocks into a complete `config.yaml`, they form a custom AI code agent.
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
---
|
||||
title: "How to Use a Block"
|
||||
description: "Learn how to use blocks in Continue Hub to enhance your AI code assistant."
|
||||
description: "Learn how to use blocks in Continue Hub to enhance your AI code agent."
|
||||
---
|
||||
|
||||
Blocks are used to build custom AI code assistants in Continue Hub. Learn more:
|
||||
Blocks are used to build custom AI code agents in Continue Hub. Learn more:
|
||||
|
||||
- [Create an assistant](/hub/assistants/create-an-assistant)
|
||||
- [Edit an assistant](/hub/assistants/edit-an-assistant)
|
||||
- [Create an agent](/hub/agents/create-an-agent)
|
||||
- [Edit an agent](/hub/agents/edit-an-agent)
|
||||
|
||||
Some blocks require inputs. If you are missing an input for a block, a notification icon will show up in the sidebar next to the block. Click the notification to select which secret to use for the block input:
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ description: "To Create an Organization, click the organization selector in the
|
|||

|
||||
|
||||
1. Choose a name, which will be used as the display name for your organization throughout the hub
|
||||
2. Add a slug, which will be used for your org URL and as the prefix to all organization blocks and assistant slugs
|
||||
2. Add a slug, which will be used for your org URL and as the prefix to all organization blocks and agent slugs
|
||||
3. Select an icon for your organization using the image uploader
|
||||
4. Finally, add a Biography, which will be displayed on your org Home Page
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
---
|
||||
title: "Secret Types"
|
||||
description: "The Continue Hub comes with secrets management built-in. Secrets are values such as API keys or endpoints that can be shared across assistants and within organizations."
|
||||
description: "The Continue Hub comes with secrets management built-in. Secrets are values such as API keys or endpoints that can be shared across agents and within organizations."
|
||||
---
|
||||
|
||||
## User secrets
|
||||
|
||||
User secrets are defined by the user for themselves. This means that user secrets are available only to the user that created them. User secrets are assumed to be safe for the user to know, so they will be sent to the IDE extensions alongside the assistant `config.yaml`.
|
||||
User secrets are defined by the user for themselves. This means that user secrets are available only to the user that created them. User secrets are assumed to be safe for the user to know, so they will be sent to the IDE extensions alongside the agent `config.yaml`.
|
||||
|
||||
This allows API requests to be made directly from the IDE extensions. You can use user secrets with [Solo](/hub/governance/pricing#solo), [Teams](/hub/governance/pricing#teams), and [Enterprise](/hub/governance/pricing#enterprise). User secrets can be managed [here](https://hub.continue.dev/settings/secrets) in the hub.
|
||||
|
||||
## Org secrets
|
||||
|
||||
Org secrets are defined by admins for their organization. Org secrets are available to anyone in the organization to use with assistants in that organization. Org secrets are assumed to not be shareable with the user (e.g. you are a team lead who wants to give team members access to models without passing out API keys).
|
||||
Org secrets are defined by admins for their organization. Org secrets are available to anyone in the organization to use with agents in that organization. Org secrets are assumed to not be shareable with the user (e.g. you are a team lead who wants to give team members access to models without passing out API keys).
|
||||
|
||||
This is why LLM requests are proxied through api.continue.dev / on-premise proxy and secrets are never sent to the IDE extensions. You can only use org secrets on [Teams](/hub/governance/pricing#teams) and [Enterprise](/hub/governance/pricing#enterprise). If you are an admin, you can manage secrets for your organization from the org settings page.
|
||||
|
|
|
|||
|
|
@ -15,17 +15,17 @@ Share your custom assistants, blocks, and configurations with the Continue commu
|
|||
|
||||
[Visit the Hub →](https://hub.continue.dev)
|
||||
|
||||
## Browse Assistants
|
||||
## Browse Agents
|
||||
|
||||
Explore assistants created by the community for specific use cases and workflows.
|
||||
|
||||
[Browse Assistants →](https://hub.continue.dev)
|
||||
[Browse Agents →](https://hub.continue.dev)
|
||||
|
||||
## Using Assistants
|
||||
## Using Agents
|
||||
|
||||
Learn how to discover, install, and use community-created assistants in your projects.
|
||||
|
||||
[Learn About Assistants →](/hub/assistants/intro)
|
||||
[Learn About Agents →](/hub/assistants/intro)
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: "Source Control"
|
||||
description: "When managing your custom assistants within an organization, you might want to take advantage of your usual source control workflows. Continue makes this easy with a that automatically syncs your YAML files with hub.continue.dev. We are also planning on adding automations for GitLab, BitBucket, Gitee, and others. If you are interested, please reach out to us on ."
|
||||
description: "When managing your custom agents within an organization, you might want to take advantage of your usual source control workflows. Continue makes this easy with a that automatically syncs your YAML files with hub.continue.dev. We are also planning on adding automations for GitLab, BitBucket, Gitee, and others. If you are interested, please reach out to us on ."
|
||||
---
|
||||
|
||||
## Quickstart
|
||||
|
|
@ -34,11 +34,11 @@ This is the only configuration necessary, but you can view the full list of opti
|
|||
|
||||
### 4. Commit and push
|
||||
|
||||
Add the [YAML for your assistants and blocks](/reference) to the appropriate directories. The name of the file will be the slug of the assistant/block.
|
||||
Add the [YAML for your agents and blocks](/reference) to the appropriate directories. The name of the file will be the slug of the agent/block.
|
||||
|
||||
- `assistants/public` for public assistants
|
||||
- `assistants/private` for private (visible only within your organization) assistants
|
||||
- `assistants/public` for public agents
|
||||
- `assistants/private` for private (visible only within your organization) agents
|
||||
- `blocks/public` for public blocks
|
||||
- `blocks/private` for private blocks
|
||||
|
||||
Then, commit and push your changes. Once the GitHub Action has completed running, you should be able to view the assistants within your organization on hub.continue.dev. For subsequent changes, make sure to increment the `version` property of your updated YAML file(s).
|
||||
Then, commit and push your changes. Once the GitHub Action has completed running, you should be able to view the agents within your organization on hub.continue.dev. For subsequent changes, make sure to increment the `version` property of your updated YAML file(s).
|
||||
|
|
|
|||
|
|
@ -1,43 +1,43 @@
|
|||
---
|
||||
title: "config.yaml Reference"
|
||||
description: "Comprehensive guide to the config.yaml format used by Continue.dev for building custom coding assistants. Learn how to define models, context providers, rules, prompts, and more using reusable blocks and YAML configuration."
|
||||
description: "Comprehensive guide to the config.yaml format used by Continue.dev for building custom coding agents. Learn how to define models, context providers, rules, prompts, and more using reusable blocks and YAML configuration."
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
Continue hub assistants are defined using the `config.yaml` specification. Assistants can be loaded from [the Hub](https://hub.continue.dev/explore/assistants) or locally
|
||||
Continue hub agents are defined using the `config.yaml` specification. Agents can be loaded from [the Hub](https://hub.continue.dev/explore/agents) or locally
|
||||
|
||||
- [Continue Hub](https://hub.continue.dev/explore/assistants) - YAML is stored on the hub and automatically synced to the extension
|
||||
- [Continue Hub](https://hub.continue.dev/explore/agents) - YAML is stored on the hub and automatically synced to the extension
|
||||
|
||||
- Locally
|
||||
- in your global `.continue` folder (`~/.continue` on Mac, `%USERPROFILE%\.continue`) within `.continue/assistants`. The name of the file will be used as the display name of the assistant, e.g. `My Assistant.yaml`
|
||||
- in your workspace in a `/.continue/assistants` folder, with the same naming convention
|
||||
- in your global `.continue` folder (`~/.continue` on Mac, `%USERPROFILE%\.continue`) within `.continue/agents`. The name of the file will be used as the display name of the agent, e.g. `My Agent.yaml`
|
||||
- in your workspace in a `/.continue/agents` folder, with the same naming convention
|
||||
|
||||
<Info>
|
||||
Config YAML replaces `config.json`, which is deprecated. View the **[Migration
|
||||
Guide](/reference/yaml-migration)**.
|
||||
</Info>
|
||||
|
||||
An assistant is made up of:
|
||||
An agent is made up of:
|
||||
|
||||
1. **Top level properties**, which specify the `name`, `version`, and `config.yaml` `schema` for the assistant
|
||||
2. **Block lists**, which are composable arrays of coding assistant building blocks available to the assistant, such as models, docs, and context providers.
|
||||
1. **Top level properties**, which specify the `name`, `version`, and `config.yaml` `schema` for the agent
|
||||
2. **Block lists**, which are composable arrays of coding agent building blocks available to the agent, such as models, docs, and context providers.
|
||||
|
||||
A block is a single standalone building block of a coding assistants, e.g., one model or one documentation source. In `config.yaml` syntax, a block consists of the same top-level properties as assistants (`name`, `version`, and `schema`), but only has **ONE** item under whichever block type it is.
|
||||
A block is a single standalone building block of a coding agents, e.g., one model or one documentation source. In `config.yaml` syntax, a block consists of the same top-level properties as agents (`name`, `version`, and `schema`), but only has **ONE** item under whichever block type it is.
|
||||
|
||||
Examples of blocks and assistants can be found on the [Continue hub](https://hub.continue.dev/explore/assistants).
|
||||
Examples of blocks and agents can be found on the [Continue Hub](https://hub.continue.dev).
|
||||
|
||||
Assistants can either explicitly define blocks - see [Properties](#properties) below - or import and configure existing hub blocks.
|
||||
Agents can either explicitly define blocks - see [Properties](#properties) below - or import and configure existing hub blocks.
|
||||
|
||||
### Using Blocks
|
||||
|
||||
Hub blocks and assistants are identified with a slug in the format `owner-slug/block-or-assistant-slug`, where an owner can be a user or organization (For example, if you want to use the [OpenAI 4o Model block](https://hub.continue.dev/openai/gpt-4o), your slug would be `openai/gpt-4o`). These blocks are pulled from [https://hub.continue.dev](https://hub.continue.dev).
|
||||
Hub blocks and agents are identified with a slug in the format `owner-slug/block-or-agent-slug`, where an owner can be a user or organization (For example, if you want to use the [OpenAI 4o Model block](https://hub.continue.dev/openai/gpt-4o), your slug would be `openai/gpt-4o`). These blocks are pulled from [https://hub.continue.dev](https://hub.continue.dev).
|
||||
|
||||
Blocks can be imported into an assistant by adding a `uses` clause under the block type. This can be alongside other `uses` clauses or explicit blocks of that type.
|
||||
Blocks can be imported into an agent by adding a `uses` clause under the block type. This can be alongside other `uses` clauses or explicit blocks of that type.
|
||||
|
||||
For example, the following assistant imports an Anthropic model and defines an Ollama DeepSeek one.
|
||||
For example, the following agent imports an Anthropic model and defines an Ollama DeepSeek one.
|
||||
|
||||
Assistant models section
|
||||
Agent models section
|
||||
|
||||
```yaml
|
||||
name: Team Agent
|
||||
|
|
@ -52,13 +52,13 @@ models:
|
|||
|
||||
### Local Blocks
|
||||
|
||||
It is also possible to define blocks locally in a `.continue` folder. This folder can be located at either the root of your workspace (these will automatically be applied to all assistants when you are in that workspace) or in your home directory at `~/.continue` (these will automatically be applied globally).
|
||||
It is also possible to define blocks locally in a `.continue` folder. This folder can be located at either the root of your workspace (these will automatically be applied to all agents when you are in that workspace) or in your home directory at `~/.continue` (these will automatically be applied globally).
|
||||
|
||||
Place your YAML files in the following folders:
|
||||
|
||||
Assistants:
|
||||
Agents:
|
||||
|
||||
- `.continue/assistants` - for assistants
|
||||
- `.continue/agents` - for agents
|
||||
|
||||
Blocks:
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ models:
|
|||
Which can then be imported like this:
|
||||
|
||||
```yaml title="config.yaml"
|
||||
name: myprofile/custom-assistant
|
||||
name: myprofile/custom-agent
|
||||
version: 1.0.0
|
||||
schema: v1
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ Note that hub secrets can be passed as inputs, using a similar mustache format:
|
|||
Block properties can be also be directly overriden using `override`. For example:
|
||||
|
||||
```yaml title="config.yaml"
|
||||
name: myprofile/custom-assistant
|
||||
name: myprofile/custom-agent
|
||||
version: 1.0.0
|
||||
schema: v1
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ What context providers are available in Continue?
|
|||
### Customization
|
||||
|
||||
```
|
||||
How do I add custom rules to my assistant in Continue?
|
||||
How do I add custom rules to my agent in Continue?
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
|
|
|||
|
|
@ -408,4 +408,4 @@ The following configuration example includes:
|
|||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
This setup could also involve enabling Chromium as a backup for local documentation through the [User Settings Page](../customize/settings).
|
||||
This setup could also involve enabling Chromium as a backup for local documentation through the User Settings Page (Gear Icon).
|
||||
|
|
@ -50,8 +50,8 @@ export const ModelRecommendations = ({ role = "all" }) => {
|
|||
"[Kimi K2 (1T)](https://hub.continue.dev/openrouter/kimi-k2)",
|
||||
"[gpt-oss (120B)](https://hub.continue.dev/openrouter/gpt-oss-120b)",
|
||||
"[gpt-oss (20B)](https://hub.continue.dev/ollama/gpt-oss-20b)",
|
||||
"GLM 4.5 (355B)",
|
||||
"GLM 4.5 Air (106B)",
|
||||
"[GLM 4.5 (355B)](https://hub.continue.dev/openrouter/glm-4-5)",
|
||||
"[GLM 4.5 Air (106B)](https://hub.continue.dev/openrouter/glm-4-5-air)",
|
||||
],
|
||||
closed: [
|
||||
"[Claude Opus 4.1](https://hub.continue.dev/anthropic/claude-4-1-opus)",
|
||||
|
|
@ -83,7 +83,7 @@ export const ModelRecommendations = ({ role = "all" }) => {
|
|||
],
|
||||
closed: [
|
||||
"[Codestral](https://hub.continue.dev/mistral/codestral)",
|
||||
"[Mercury Coder](https://hub.continue.dev/inceptionlabs/mercury-coder)",
|
||||
"[Mercury Coder](https://hub.continue.dev/inception/mercury-coder)",
|
||||
],
|
||||
notes: "Closed models are slightly better than open models",
|
||||
},
|
||||
|
|
@ -119,7 +119,7 @@ export const ModelRecommendations = ({ role = "all" }) => {
|
|||
next_edit: {
|
||||
open: ["[Instinct](https://hub.continue.dev/continuedev/instinct)"],
|
||||
closed: [
|
||||
"[Mercury Coder](https://hub.continue.dev/inceptionlabs/mercury-coder)",
|
||||
"[Mercury Coder](https://hub.continue.dev/inception/mercury-coder)",
|
||||
],
|
||||
notes: "Closed models are better than open models",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,215 +0,0 @@
|
|||
name: Respond to @continuedev Comments
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
pull_request_review_comment:
|
||||
types: [created]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
respond-to-comment:
|
||||
# Only run on pull request comments
|
||||
if: github.event_name == 'issue_comment' && github.event.issue.pull_request
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check if comment contains @continuedev
|
||||
id: check-mention
|
||||
run: |
|
||||
if echo "${{ github.event.comment.body }}" | grep -q "@continuedev"; then
|
||||
echo "contains_mention=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "contains_mention=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Checkout PR branch
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get PR information
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
id: pr-info
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const { data: pr } = await github.rest.pulls.get({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
pull_number: context.issue.number
|
||||
});
|
||||
|
||||
core.setOutput('head_ref', pr.head.ref);
|
||||
core.setOutput('head_sha', pr.head.sha);
|
||||
return pr;
|
||||
|
||||
- name: Checkout PR branch
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
run: |
|
||||
git checkout ${{ steps.pr-info.outputs.head_ref }}
|
||||
|
||||
- name: Setup Node.js
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
- name: Install Continue CLI globally
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
run: npm i -g @continuedev/cli
|
||||
|
||||
- name: Start remote session
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
id: remote-session
|
||||
env:
|
||||
CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }}
|
||||
run: |
|
||||
# Create the prompt for remote session
|
||||
PROMPT="Please help with the following request from @${{ github.event.comment.user.login }} on PR #${{ github.event.issue.number }}:
|
||||
|
||||
${{ github.event.comment.body }}
|
||||
|
||||
Please analyze the current PR, understand the request, implement the necessary changes, and commit them to this branch."
|
||||
|
||||
# Start remote session and capture JSON output
|
||||
SESSION_OUTPUT=$(echo "$PROMPT" | cn remote -s --branch ${{ steps.pr-info.outputs.head_ref }})
|
||||
echo "Raw session output: $SESSION_OUTPUT"
|
||||
|
||||
# Extract URL from JSON output
|
||||
SESSION_URL=$(echo "$SESSION_OUTPUT" | jq -r '.url // empty')
|
||||
|
||||
if [ -z "$SESSION_URL" ] || [ "$SESSION_URL" = "null" ]; then
|
||||
echo "Failed to extract session URL from output: $SESSION_OUTPUT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "session_url=$SESSION_URL" >> $GITHUB_OUTPUT
|
||||
echo "✅ Started remote session: $SESSION_URL"
|
||||
|
||||
- name: Comment with session URL
|
||||
if: steps.check-mention.outputs.contains_mention == 'true' && steps.remote-session.outputs.session_url
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const commentBody = `I've started [a remote session](${{ steps.remote-session.outputs.session_url }}) to help with your request:
|
||||
> ${{ github.event.comment.body }}`;
|
||||
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
body: commentBody
|
||||
});
|
||||
|
||||
- name: Log session details
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
run: |
|
||||
echo "✅ Successfully started remote session for comment from ${{ github.event.comment.user.login }} on PR #${{ github.event.issue.number }}"
|
||||
echo "Session URL: ${{ steps.remote-session.outputs.session_url }}"
|
||||
echo "Original comment: ${{ github.event.comment.body }}"
|
||||
|
||||
respond-to-review-comment:
|
||||
# Only run on pull request review comments
|
||||
if: github.event_name == 'pull_request_review_comment'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check if comment contains @continuedev
|
||||
id: check-mention
|
||||
run: |
|
||||
if echo "${{ github.event.comment.body }}" | grep -q "@continuedev"; then
|
||||
echo "contains_mention=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "contains_mention=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Checkout PR branch
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- name: Setup Node.js
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
- name: Install Continue CLI globally
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
run: npm i -g @continuedev/cli
|
||||
|
||||
- name: Start remote session
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
id: remote-session
|
||||
env:
|
||||
CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }}
|
||||
run: |
|
||||
# Create a temporary file for the prompt to handle special characters and newlines properly
|
||||
cat > /tmp/prompt.txt << 'PROMPT_EOF'
|
||||
Please help with the following code review comment from @${{ github.event.comment.user.login }} on PR #${{ github.event.pull_request.number }}:
|
||||
|
||||
**File:** ${{ github.event.comment.path }}
|
||||
**Line:** ${{ github.event.comment.line || github.event.comment.original_line || 'N/A' }}
|
||||
**Comment:** ${{ github.event.comment.body }}
|
||||
|
||||
Please analyze the specific file and line mentioned, understand the review feedback, implement the necessary changes, and commit them to this branch.
|
||||
PROMPT_EOF
|
||||
|
||||
# Debug output
|
||||
echo "PROMPT content:"
|
||||
cat /tmp/prompt.txt
|
||||
|
||||
# Start remote session and capture JSON output
|
||||
echo "Starting cn with prompt..."
|
||||
SESSION_OUTPUT=$(cat /tmp/prompt.txt | cn remote -s --branch ${{ github.event.pull_request.head.ref }})
|
||||
echo "Raw session output: $SESSION_OUTPUT"
|
||||
|
||||
# Extract URL from JSON output
|
||||
SESSION_URL=$(echo "$SESSION_OUTPUT" | jq -r '.url // empty')
|
||||
|
||||
if [ -z "$SESSION_URL" ] || [ "$SESSION_URL" = "null" ]; then
|
||||
echo "Failed to extract session URL from output: $SESSION_OUTPUT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "session_url=$SESSION_URL" >> $GITHUB_OUTPUT
|
||||
echo "✅ Started remote session: $SESSION_URL"
|
||||
|
||||
- name: Comment with session URL
|
||||
if: steps.check-mention.outputs.contains_mention == 'true' && steps.remote-session.outputs.session_url
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const commentBody = `I've started [a remote session](${{ steps.remote-session.outputs.session_url }}) to help with your request:
|
||||
> ${{ github.event.comment.body }}`;
|
||||
|
||||
const commentParams = {
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
pull_number: ${{ github.event.pull_request.number }},
|
||||
body: commentBody,
|
||||
commit_id: '${{ github.event.pull_request.head.sha }}',
|
||||
path: '${{ github.event.comment.path }}',
|
||||
in_reply_to: ${{ github.event.comment.id }}
|
||||
};
|
||||
|
||||
await github.rest.pulls.createReviewComment(commentParams);
|
||||
|
||||
- name: Log session details
|
||||
if: steps.check-mention.outputs.contains_mention == 'true'
|
||||
run: |
|
||||
echo "✅ Successfully started remote session for review comment from ${{ github.event.comment.user.login }} on PR #${{ github.event.pull_request.number }}"
|
||||
echo "Session URL: ${{ steps.remote-session.outputs.session_url }}"
|
||||
echo "File: ${{ github.event.comment.path }}"
|
||||
echo "Line: ${{ github.event.comment.line }}"
|
||||
echo "Original comment: ${{ github.event.comment.body }}"
|
||||
2
extensions/cli/package-lock.json
generated
2
extensions/cli/package-lock.json
generated
|
|
@ -310,7 +310,7 @@
|
|||
"@types/node": "^20.11.19",
|
||||
"@types/shell-quote": "^1.7.5",
|
||||
"typescript": "^5.5.2",
|
||||
"vitest": "^1.6.0"
|
||||
"vitest": "^3.2.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@alcalzone/ansi-tokenize": {
|
||||
|
|
|
|||
138
extensions/cli/spec/shell-mode.md
Normal file
138
extensions/cli/spec/shell-mode.md
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
shell Mode (CLI TUI)
|
||||
|
||||
Overview
|
||||
|
||||
- shell mode lets users run shell commands directly from the chat input by starting their input with an exclamation mark (!).
|
||||
- It is intended for quick terminal command execution without leaving the TUI.
|
||||
|
||||
Activation
|
||||
|
||||
- shell mode is activated when the current input (trimmed) starts with !
|
||||
- Example: "!git status" or " !ls -la" both activate shell mode.
|
||||
- Visual indicator:
|
||||
- Input border color changes to yellow.
|
||||
- The input prompt indicator changes to a yellow "$".
|
||||
- The input placeholder includes "! for shell mode".
|
||||
|
||||
Deactivation / Exiting shell Mode
|
||||
|
||||
- Pressing Enter to submit the input exits shell mode immediately after submission, regardless of the command result.
|
||||
- Pressing Esc when the input (trimmed) is exactly ! clears the input and exits shell mode.
|
||||
- Editing the input so it no longer starts with ! also exits shell mode and restores normal input behavior.
|
||||
|
||||
Interaction with other input helpers
|
||||
|
||||
- When in shell mode (input starts with !):
|
||||
- "@" file search suggestions are disabled.
|
||||
- "/" slash command UI is disabled.
|
||||
- When in slash command mode (input starts with /):
|
||||
- "@" file search suggestions are disabled.
|
||||
|
||||
Submission behavior
|
||||
|
||||
- On submit (Enter) with a shell-mode input:
|
||||
- The leading ! is removed and the remainder is treated as the shell command to run.
|
||||
- The TUI immediately appends an assistant message representing a shell tool call, with status set to calling, so users can see that the command is in progress.
|
||||
- The shell command is executed asynchronously; when it completes, the tool call status is updated to done (or error) and the output is populated.
|
||||
|
||||
Execution semantics
|
||||
|
||||
- The command is executed in the same way as terminal tool commands, minus permissions
|
||||
|
||||
Output handling
|
||||
|
||||
- Stdout is streamed into memory; Stderr is captured and appended as a trailing "Stderr: ..." section on success.
|
||||
- If the process exits non-zero and Stderr contains content, the tool call is marked as error and the error text is shown.
|
||||
- Output is truncated to the first 5000 lines if exceeded.
|
||||
- Timeout behavior: If no output is received for 30 seconds (configurable in tests), the process is terminated and the result includes a note like:
|
||||
"[Command timed out after 30 seconds of no output]".
|
||||
|
||||
Keyboard behaviors (summary)
|
||||
|
||||
- Enter: submit input. If in shell mode, exits shell mode after submission and shows the pending shell tool call immediately.
|
||||
- Shift+Enter: new line.
|
||||
- Backslash (\) at end-of-line: inserts a new line (line continuation) as usual.
|
||||
- Esc: if only ! (trimmed) is present, clears input and exits shell mode; otherwise cancels streaming or closes suggestions depending on context.
|
||||
|
||||
Scope / Modes
|
||||
|
||||
- shell mode applies to interactive (TUI/standard) CLI usage. It is not part of headless (-p/--print) processing.
|
||||
|
||||
Error handling
|
||||
|
||||
- Command execution errors are captured and surfaced in the tool call as status error with human-readable error text (including Stderr when available).
|
||||
|
||||
Examples
|
||||
|
||||
- "!git status" → shows a shell tool call immediately, then populates with the git status output.
|
||||
- "!echo hello" → shows a shell tool call immediately, then output "hello".
|
||||
- "!some-unknown-cmd" → shows a shell tool call immediately, then sets status to error with an error message.
|
||||
Shell Mode (CLI TUI)
|
||||
|
||||
Overview
|
||||
|
||||
- Shell mode lets users run shell commands directly from the chat input by starting their input with an exclamation mark (!).
|
||||
- It is intended for quick terminal command execution without leaving the TUI.
|
||||
|
||||
Activation
|
||||
|
||||
- Shell mode is activated when the current input (trimmed) starts with !
|
||||
- Example: "!git status" or " !ls -la" both activate Shell mode.
|
||||
- Visual indicator:
|
||||
- Input border color changes to yellow.
|
||||
- The input prompt indicator changes to a yellow "$".
|
||||
- The input placeholder includes "! for shell mode".
|
||||
|
||||
Deactivation / Exiting Shell Mode
|
||||
|
||||
- Pressing Enter to submit the input exits shell mode immediately after submission, regardless of the command result.
|
||||
- Pressing Esc when the input (trimmed) is exactly ! clears the input and exits shell mode.
|
||||
- Editing the input so it no longer starts with ! also exits shell mode and restores normal input behavior.
|
||||
|
||||
Interaction with other input helpers
|
||||
|
||||
- When in shell mode (input starts with !):
|
||||
- "@" file search suggestions are disabled.
|
||||
- "/" slash command UI is disabled.
|
||||
- When in slash command mode (input starts with /):
|
||||
- "@" file search suggestions are disabled.
|
||||
|
||||
Submission behavior
|
||||
|
||||
- On submit (Enter) with a shell-mode input:
|
||||
- The leading ! is removed and the remainder is treated as the shell command to run.
|
||||
- The TUI immediately appends an assistant message representing a Shell tool call, with status set to calling, so users can see that the command is in progress.
|
||||
- The shell command is executed asynchronously; when it completes, the tool call status is updated to done (or error) and the output is populated.
|
||||
|
||||
Execution semantics
|
||||
|
||||
- The command is executed in the same way as terminal tool commands, minus permissions, and inserted into the chat history the same.
|
||||
|
||||
Output handling
|
||||
|
||||
- Stdout is streamed into memory; Stderr is captured and appended as a trailing "Stderr: ..." section on success.
|
||||
- If the process exits non-zero and Stderr contains content, the tool call is marked as error and the error text is shown.
|
||||
- Output is truncated to the first 5000 lines if exceeded.
|
||||
- Timeout behavior: If no output is received for 30 seconds (configurable in tests), the process is terminated and the result includes a note like:
|
||||
"[Command timed out after 30 seconds of no output]".
|
||||
|
||||
Keyboard behaviors (summary)
|
||||
|
||||
- Enter: submit input. If in shell mode, exits shell mode after submission and shows the pending Shell tool call immediately.
|
||||
- Shift+Enter: new line.
|
||||
- Backslash (\) at end-of-line: inserts a new line (line continuation) as usual.
|
||||
- Esc: if only ! (trimmed) is present, clears input and exits shell mode; otherwise cancels streaming or closes suggestions depending on context.
|
||||
|
||||
Scope / Modes
|
||||
|
||||
- Shell mode applies to interactive (TUI/standard) CLI usage. It is not part of headless (-p/--print) processing.
|
||||
|
||||
Error handling
|
||||
|
||||
- Command execution errors are captured and surfaced in the tool call as status error with human-readable error text (including Stderr when available).
|
||||
|
||||
Examples
|
||||
|
||||
- "!git status" → shows a Shell tool call immediately, then populates with the git status output.
|
||||
- "!echo hello" → shows a Shell tool call immediately, then output "hello".
|
||||
- "!some-unknown-cmd" → shows a Shell tool call immediately, then sets status to error with an error message.
|
||||
15
extensions/cli/spec/tui.md
Normal file
15
extensions/cli/spec/tui.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Continue CLI Terminal UI spec
|
||||
|
||||
This spec is incomplete.
|
||||
|
||||
## Stack
|
||||
|
||||
The Continue CLI uses Ink as a react TUI library.
|
||||
|
||||
## cwd/git display
|
||||
|
||||
The lower left corner of the TUI should display
|
||||
|
||||
- the current git branch if in a git repo
|
||||
- also the current owner/repo if enough columns are available to display and it's a gh repo
|
||||
- if not in git, the cwd
|
||||
74
extensions/cli/src/__mocks__/services/BaseService.ts
Normal file
74
extensions/cli/src/__mocks__/services/BaseService.ts
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
import { EventEmitter } from "events";
|
||||
import { vi } from "vitest";
|
||||
|
||||
/**
|
||||
* Mocked base service class for testing
|
||||
*/
|
||||
export class BaseService<TState> extends EventEmitter {
|
||||
protected serviceName: string;
|
||||
protected currentState: TState;
|
||||
private isInitialized: boolean = false;
|
||||
|
||||
constructor(serviceName: string, initialState: TState) {
|
||||
super();
|
||||
this.serviceName = serviceName;
|
||||
this.currentState = initialState;
|
||||
}
|
||||
|
||||
// Mock the abstract method
|
||||
doInitialize = vi.fn<any>();
|
||||
|
||||
async initialize(...args: any[]): Promise<TState> {
|
||||
this.emit("initializing");
|
||||
try {
|
||||
const state = await this.doInitialize(...args);
|
||||
this.currentState = state;
|
||||
this.isInitialized = true;
|
||||
this.emit("initialized", state);
|
||||
return state;
|
||||
} catch (error) {
|
||||
this.emit("error", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
getState(): TState {
|
||||
return { ...this.currentState };
|
||||
}
|
||||
|
||||
protected setState(newState: Partial<TState>): void {
|
||||
const previousState = this.currentState;
|
||||
this.currentState = { ...this.currentState, ...newState };
|
||||
this.emit("stateChanged", this.currentState, previousState);
|
||||
}
|
||||
|
||||
isReady(): boolean {
|
||||
return this.isInitialized;
|
||||
}
|
||||
|
||||
async reload(...args: any[]): Promise<TState> {
|
||||
this.isInitialized = false;
|
||||
return this.initialize(...args);
|
||||
}
|
||||
|
||||
async cleanup(): Promise<void> {
|
||||
this.removeAllListeners();
|
||||
this.isInitialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for services with dependencies
|
||||
*/
|
||||
export interface ServiceWithDependencies {
|
||||
getDependencies(): string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to check if a service has dependencies
|
||||
*/
|
||||
export function hasDependencies(
|
||||
service: any,
|
||||
): service is ServiceWithDependencies {
|
||||
return !!service && typeof service.getDependencies === "function";
|
||||
}
|
||||
258
extensions/cli/src/e2e/git-branch-display.test.ts
Normal file
258
extensions/cli/src/e2e/git-branch-display.test.ts
Normal file
|
|
@ -0,0 +1,258 @@
|
|||
import { execSync } from "child_process";
|
||||
import fs from "fs/promises";
|
||||
import path from "path";
|
||||
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
cleanupTestContext,
|
||||
createTestConfig,
|
||||
createTestContext,
|
||||
runCLI,
|
||||
type CLITestContext,
|
||||
} from "../test-helpers/cli-helpers.js";
|
||||
|
||||
describe("E2E: Git Branch Display", () => {
|
||||
let context: CLITestContext;
|
||||
let originalCwd: string;
|
||||
|
||||
const testConfig = `name: Test Assistant
|
||||
version: 1.0.0
|
||||
schema: v1
|
||||
models:
|
||||
- model: gpt-4
|
||||
provider: openai
|
||||
apiKey: test-key
|
||||
roles:
|
||||
- chat`;
|
||||
|
||||
beforeEach(async () => {
|
||||
context = await createTestContext();
|
||||
originalCwd = process.cwd();
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await cleanupTestContext(context);
|
||||
process.chdir(originalCwd);
|
||||
});
|
||||
|
||||
describe("git branch display in status bar", () => {
|
||||
it("should show branch name when in a git repository", async () => {
|
||||
// Initialize a git repo in the test directory
|
||||
process.chdir(context.testDir);
|
||||
|
||||
try {
|
||||
// Initialize git repo
|
||||
execSync("git init", { stdio: "ignore" });
|
||||
execSync("git config user.email 'test@example.com'", {
|
||||
stdio: "ignore",
|
||||
});
|
||||
execSync("git config user.name 'Test User'", { stdio: "ignore" });
|
||||
|
||||
// Create a test file and initial commit
|
||||
await fs.writeFile(
|
||||
path.join(context.testDir, "test.txt"),
|
||||
"test content",
|
||||
);
|
||||
execSync("git add .", { stdio: "ignore" });
|
||||
execSync("git commit -m 'Initial commit'", { stdio: "ignore" });
|
||||
|
||||
// Create and checkout a test branch
|
||||
const testBranchName = "feature/test-branch";
|
||||
execSync(`git checkout -b ${testBranchName}`, { stdio: "ignore" });
|
||||
|
||||
// Create config file
|
||||
await createTestConfig(context, testConfig);
|
||||
|
||||
// Run CLI in TUI mode - it should fail quickly but show the branch in output
|
||||
const result = await runCLI(context, {
|
||||
args: ["--config", context.configPath!, "--help"],
|
||||
timeout: 3000,
|
||||
});
|
||||
|
||||
// The help command should succeed
|
||||
expect(result.exitCode).toBe(0);
|
||||
expect(result.stdout).toContain("Continue CLI");
|
||||
|
||||
// Now let's test that our git utils work in this context
|
||||
// We can't easily test the full TUI display, but we can verify the git functions work
|
||||
const { getGitBranch } = await import("../util/git.js");
|
||||
const branch = getGitBranch();
|
||||
expect(branch).toBe(testBranchName);
|
||||
} catch (error) {
|
||||
// Skip test if git is not available or fails
|
||||
console.warn("Skipping git branch test - git not available:", error);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
it("should handle non-git directory gracefully", async () => {
|
||||
// Don't initialize git in test directory
|
||||
process.chdir(context.testDir);
|
||||
|
||||
await createTestConfig(context, testConfig);
|
||||
|
||||
// Test that git functions return null in non-git directory
|
||||
const { getGitBranch, isGitRepo } = await import("../util/git.js");
|
||||
|
||||
expect(isGitRepo()).toBe(false);
|
||||
expect(getGitBranch()).toBeNull();
|
||||
|
||||
// CLI should still work without git
|
||||
const result = await runCLI(context, {
|
||||
args: ["--help"],
|
||||
timeout: 3000,
|
||||
});
|
||||
|
||||
expect(result.exitCode).toBe(0);
|
||||
expect(result.stdout).toContain("Continue CLI");
|
||||
});
|
||||
|
||||
it("should handle detached HEAD state", async () => {
|
||||
process.chdir(context.testDir);
|
||||
|
||||
try {
|
||||
// Initialize git repo
|
||||
execSync("git init", { stdio: "ignore" });
|
||||
execSync("git config user.email 'test@example.com'", {
|
||||
stdio: "ignore",
|
||||
});
|
||||
execSync("git config user.name 'Test User'", { stdio: "ignore" });
|
||||
|
||||
// Create initial commit
|
||||
await fs.writeFile(
|
||||
path.join(context.testDir, "test.txt"),
|
||||
"test content",
|
||||
);
|
||||
execSync("git add .", { stdio: "ignore" });
|
||||
execSync("git commit -m 'Initial commit'", { stdio: "ignore" });
|
||||
|
||||
// Create another commit
|
||||
await fs.writeFile(
|
||||
path.join(context.testDir, "test2.txt"),
|
||||
"test content 2",
|
||||
);
|
||||
execSync("git add .", { stdio: "ignore" });
|
||||
execSync("git commit -m 'Second commit'", { stdio: "ignore" });
|
||||
|
||||
// Get first commit hash and checkout to detached HEAD
|
||||
const firstCommit = execSync(
|
||||
"git rev-list --max-count=1 --reverse HEAD",
|
||||
{
|
||||
encoding: "utf-8",
|
||||
},
|
||||
).trim();
|
||||
execSync(`git checkout ${firstCommit}`, { stdio: "ignore" });
|
||||
|
||||
// Test git functions in detached HEAD state
|
||||
const { getGitBranch, isGitRepo } = await import("../util/git.js");
|
||||
|
||||
expect(isGitRepo()).toBe(true);
|
||||
// In detached HEAD state, git branch --show-current returns empty string
|
||||
// which our function converts to null
|
||||
expect(getGitBranch()).toBeNull();
|
||||
} catch (error) {
|
||||
// Skip test if git operations fail
|
||||
console.warn(
|
||||
"Skipping detached HEAD test - git operations failed:",
|
||||
error,
|
||||
);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
it("should handle branch names with special characters", async () => {
|
||||
process.chdir(context.testDir);
|
||||
|
||||
try {
|
||||
// Initialize git repo
|
||||
execSync("git init", { stdio: "ignore" });
|
||||
execSync("git config user.email 'test@example.com'", {
|
||||
stdio: "ignore",
|
||||
});
|
||||
execSync("git config user.name 'Test User'", { stdio: "ignore" });
|
||||
|
||||
// Create initial commit
|
||||
await fs.writeFile(
|
||||
path.join(context.testDir, "test.txt"),
|
||||
"test content",
|
||||
);
|
||||
execSync("git add .", { stdio: "ignore" });
|
||||
execSync("git commit -m 'Initial commit'", { stdio: "ignore" });
|
||||
|
||||
// Create branch with special characters
|
||||
const specialBranchName = "feature/fix-123_with-dashes.and.dots";
|
||||
execSync(`git checkout -b "${specialBranchName}"`, { stdio: "ignore" });
|
||||
|
||||
// Test git functions
|
||||
const { getGitBranch } = await import("../util/git.js");
|
||||
const branch = getGitBranch();
|
||||
expect(branch).toBe(specialBranchName);
|
||||
} catch (error) {
|
||||
// Skip test if git operations fail
|
||||
console.warn(
|
||||
"Skipping special characters test - git operations failed:",
|
||||
error,
|
||||
);
|
||||
return;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("getRepoUrlText function with branch", () => {
|
||||
it("should format repo URL with branch correctly", async () => {
|
||||
process.chdir(context.testDir);
|
||||
|
||||
try {
|
||||
// Initialize git repo with remote
|
||||
execSync("git init", { stdio: "ignore" });
|
||||
execSync("git config user.email 'test@example.com'", {
|
||||
stdio: "ignore",
|
||||
});
|
||||
execSync("git config user.name 'Test User'", { stdio: "ignore" });
|
||||
|
||||
// Add a fake remote
|
||||
execSync(
|
||||
"git remote add origin https://github.com/testuser/testrepo.git",
|
||||
{ stdio: "ignore" },
|
||||
);
|
||||
|
||||
// Create initial commit and branch
|
||||
await fs.writeFile(
|
||||
path.join(context.testDir, "test.txt"),
|
||||
"test content",
|
||||
);
|
||||
execSync("git add .", { stdio: "ignore" });
|
||||
execSync("git commit -m 'Initial commit'", { stdio: "ignore" });
|
||||
execSync("git checkout -b test-branch", { stdio: "ignore" });
|
||||
|
||||
// Test the formatting function
|
||||
const { getResponsiveRepoText } = await import(
|
||||
"../ui/hooks/useTUIChatHooks.js"
|
||||
);
|
||||
const repoText = getResponsiveRepoText();
|
||||
|
||||
// Should include both repo and branch
|
||||
expect(repoText).toEqual("");
|
||||
} catch (error) {
|
||||
// Skip test if git operations fail
|
||||
console.warn(
|
||||
"Skipping repo URL formatting test - git operations failed:",
|
||||
error,
|
||||
);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
it("should handle repo URL without branch when not in git repo", async () => {
|
||||
process.chdir(context.testDir);
|
||||
|
||||
// Test without git repo
|
||||
const { getRepoUrlText } = await import("../ui/hooks/useTUIChatHooks.js");
|
||||
const repoText = getRepoUrlText();
|
||||
|
||||
// Should not contain branch separator
|
||||
expect(repoText).toEqual("");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -47,6 +47,42 @@ export function setExitMessageCallback(callback: () => void) {
|
|||
exitMessageCallback = callback;
|
||||
}
|
||||
|
||||
// Sets up SIGINT handler that requires double Ctrl+C within 1 second to exit
|
||||
export function enableSigintHandler() {
|
||||
// Remove all existing SIGINT listeners first
|
||||
process.removeAllListeners("SIGINT");
|
||||
|
||||
process.on("SIGINT", async () => {
|
||||
const now = Date.now();
|
||||
const timeSinceLastCtrlC = now - lastCtrlCTime;
|
||||
|
||||
if (timeSinceLastCtrlC <= 1000 && lastCtrlCTime !== 0) {
|
||||
// Second Ctrl+C within 1 second - exit
|
||||
showExitMessage = false;
|
||||
if (tuiUnmount) {
|
||||
tuiUnmount();
|
||||
}
|
||||
await sentryService.flush();
|
||||
process.exit(0);
|
||||
} else {
|
||||
// First Ctrl+C or too much time elapsed - show exit message
|
||||
lastCtrlCTime = now;
|
||||
showExitMessage = true;
|
||||
if (exitMessageCallback) {
|
||||
exitMessageCallback();
|
||||
}
|
||||
|
||||
// Hide message after 1 second
|
||||
setTimeout(() => {
|
||||
showExitMessage = false;
|
||||
if (exitMessageCallback) {
|
||||
exitMessageCallback();
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Check if "ctrl+c to exit" message should be displayed
|
||||
export function shouldShowExitMessage(): boolean {
|
||||
return showExitMessage;
|
||||
|
|
@ -294,41 +330,6 @@ try {
|
|||
process.exit(1);
|
||||
}
|
||||
|
||||
// Graceful shutdown with two-stage Ctrl+C exit
|
||||
|
||||
// Remove all existing SIGINT listeners first
|
||||
process.removeAllListeners("SIGINT");
|
||||
|
||||
process.on("SIGINT", async () => {
|
||||
const now = Date.now();
|
||||
const timeSinceLastCtrlC = now - lastCtrlCTime;
|
||||
|
||||
if (timeSinceLastCtrlC <= 1000 && lastCtrlCTime !== 0) {
|
||||
// Second Ctrl+C within 1 second - exit
|
||||
showExitMessage = false;
|
||||
if (tuiUnmount) {
|
||||
tuiUnmount();
|
||||
}
|
||||
await sentryService.flush();
|
||||
process.exit(0);
|
||||
} else {
|
||||
// First Ctrl+C or too much time elapsed - show exit message
|
||||
lastCtrlCTime = now;
|
||||
showExitMessage = true;
|
||||
if (exitMessageCallback) {
|
||||
exitMessageCallback();
|
||||
}
|
||||
|
||||
// Hide message after 1 second
|
||||
setTimeout(() => {
|
||||
showExitMessage = false;
|
||||
if (exitMessageCallback) {
|
||||
exitMessageCallback();
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
||||
process.on("SIGTERM", async () => {
|
||||
await sentryService.flush();
|
||||
process.exit(0);
|
||||
|
|
|
|||
136
extensions/cli/src/infoScreen.ts
Normal file
136
extensions/cli/src/infoScreen.ts
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
import { execSync } from "child_process";
|
||||
|
||||
import chalk from "chalk";
|
||||
|
||||
import {
|
||||
isAuthenticated,
|
||||
isAuthenticatedConfig,
|
||||
loadAuthConfig,
|
||||
} from "./auth/workos.js";
|
||||
import { services } from "./services/index.js";
|
||||
import { getCurrentSession, getSessionFilePath } from "./session.js";
|
||||
import { posthogService } from "./telemetry/posthogService.js";
|
||||
import { logger } from "./util/logger.js";
|
||||
import { getVersion } from "./version.js";
|
||||
|
||||
export async function handleInfoSlashCommand() {
|
||||
posthogService.capture("useSlashCommand", { name: "info" });
|
||||
|
||||
const infoLines = [];
|
||||
|
||||
// Version and working directory info
|
||||
const version = getVersion();
|
||||
const cwd = process.cwd();
|
||||
|
||||
infoLines.push(
|
||||
chalk.white("CLI Information:"),
|
||||
` Version: ${chalk.green(version)}`,
|
||||
` Working Directory: ${chalk.blue(cwd)}`,
|
||||
);
|
||||
|
||||
// Auth info
|
||||
if (isAuthenticated()) {
|
||||
const config = loadAuthConfig();
|
||||
if (config && isAuthenticatedConfig(config)) {
|
||||
const email = config.userEmail || config.userId;
|
||||
const orgId = config.organizationId;
|
||||
infoLines.push(
|
||||
"",
|
||||
chalk.white("Authentication:"),
|
||||
` Email: ${chalk.green(email)}`,
|
||||
` Org ID: ${chalk.cyan(orgId)}`,
|
||||
);
|
||||
} else {
|
||||
infoLines.push(
|
||||
"",
|
||||
chalk.white("Authentication:"),
|
||||
` ${chalk.yellow("Authenticated via environment variable")}`,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
infoLines.push(
|
||||
"",
|
||||
chalk.white("Authentication:"),
|
||||
` ${chalk.red("Not logged in")}`,
|
||||
);
|
||||
}
|
||||
|
||||
// Config info
|
||||
try {
|
||||
const configState = services.config.getState();
|
||||
infoLines.push("", chalk.white("Configuration:"));
|
||||
if (configState.config) {
|
||||
infoLines.push(` ${chalk.gray(`Using ${configState.config?.name}`)}`);
|
||||
} else {
|
||||
infoLines.push(` ${chalk.red(`Config not found`)}`);
|
||||
}
|
||||
if (configState.configPath) {
|
||||
infoLines.push(` Path: ${chalk.blue(configState.configPath)}`);
|
||||
}
|
||||
|
||||
// Add current model info
|
||||
try {
|
||||
const modelInfo = services.model?.getModelInfo();
|
||||
if (modelInfo) {
|
||||
infoLines.push(` Model: ${chalk.cyan(modelInfo.name)}`);
|
||||
} else {
|
||||
infoLines.push(` Model: ${chalk.red("Not available")}`);
|
||||
}
|
||||
} catch {
|
||||
infoLines.push(` Model: ${chalk.red("Error retrieving model info")}`);
|
||||
}
|
||||
} catch {
|
||||
infoLines.push(
|
||||
"",
|
||||
chalk.white("Configuration:"),
|
||||
` ${chalk.red("Configuration service not available")}`,
|
||||
);
|
||||
}
|
||||
|
||||
// Session info
|
||||
infoLines.push("", chalk.white("Session:"));
|
||||
try {
|
||||
const currentSession = getCurrentSession();
|
||||
const sessionFilePath = getSessionFilePath();
|
||||
infoLines.push(
|
||||
` Title: ${chalk.green(currentSession.title)}`,
|
||||
` ID: ${chalk.gray(currentSession.sessionId)}`,
|
||||
` File: ${chalk.blue(sessionFilePath)}`,
|
||||
);
|
||||
} catch {
|
||||
infoLines.push(` ${chalk.red("Session not available")}`);
|
||||
}
|
||||
|
||||
// Runtime diagnostic info
|
||||
const nodePath = process.execPath;
|
||||
const invokedPath = process.argv[1];
|
||||
|
||||
// Get npm version
|
||||
let npmVersion = "unknown";
|
||||
try {
|
||||
npmVersion = execSync("npm --version", {
|
||||
encoding: "utf8",
|
||||
timeout: 5000,
|
||||
stdio: ["pipe", "pipe", "ignore"],
|
||||
}).trim();
|
||||
} catch (error) {
|
||||
// If npm command fails, fallback to "unknown"
|
||||
logger.warn("Failed to get npm version:", error);
|
||||
}
|
||||
|
||||
// Diagnostic info
|
||||
infoLines.push(
|
||||
"",
|
||||
chalk.white("Diagnostic Info"),
|
||||
` Currently running: npm-global (${chalk.green(npmVersion)})`,
|
||||
` Path: ${chalk.blue(nodePath)}`,
|
||||
` Invoked: ${chalk.blue(invokedPath)}`,
|
||||
);
|
||||
|
||||
// TODO add global settings like auto update etc.
|
||||
|
||||
return {
|
||||
exit: false,
|
||||
output: infoLines.join("\n"),
|
||||
};
|
||||
}
|
||||
|
|
@ -1,10 +1,118 @@
|
|||
import { describe, expect, test, beforeEach, vi } from "vitest";
|
||||
import { EventEmitter } from "events";
|
||||
|
||||
import {
|
||||
BaseService,
|
||||
hasDependencies,
|
||||
ServiceWithDependencies,
|
||||
} from "./BaseService.js";
|
||||
import { beforeEach, describe, expect, test, vi } from "vitest";
|
||||
|
||||
import { logger } from "../util/logger.js";
|
||||
|
||||
/**
|
||||
* Base abstract class for all services
|
||||
* Provides common lifecycle methods and state management
|
||||
*/
|
||||
abstract class BaseService<TState> extends EventEmitter {
|
||||
protected serviceName: string;
|
||||
protected currentState: TState;
|
||||
private isInitialized: boolean = false;
|
||||
|
||||
constructor(serviceName: string, initialState: TState) {
|
||||
super();
|
||||
this.serviceName = serviceName;
|
||||
this.currentState = initialState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the service (must be implemented by subclasses)
|
||||
* This is automatically wrapped with initialization logic
|
||||
*/
|
||||
abstract doInitialize(...args: any[]): Promise<TState>;
|
||||
|
||||
/**
|
||||
* Public initialization method that wraps the implementation
|
||||
*/
|
||||
async initialize(...args: any[]): Promise<TState> {
|
||||
logger.debug(`Initializing ${this.serviceName}`, {
|
||||
wasInitialized: this.isInitialized,
|
||||
hadPreviousState: !!this.currentState,
|
||||
});
|
||||
this.emit("initializing");
|
||||
|
||||
try {
|
||||
const state = await this.doInitialize(...args);
|
||||
this.currentState = state;
|
||||
this.isInitialized = true;
|
||||
logger.debug(`${this.serviceName} initialized successfully`, {
|
||||
stateKeys: state ? Object.keys(state as any) : [],
|
||||
isNowInitialized: this.isInitialized,
|
||||
});
|
||||
this.emit("initialized", state);
|
||||
return state;
|
||||
} catch (error: any) {
|
||||
logger.debug(`Failed to initialize ${this.serviceName}:`, error);
|
||||
if (this.listenerCount("error") > 0) {
|
||||
this.emit("error", error);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current service state (shallow copy for immutability)
|
||||
*/
|
||||
getState(): TState {
|
||||
return { ...this.currentState };
|
||||
}
|
||||
|
||||
/**
|
||||
* Update service state and emit change event
|
||||
*/
|
||||
protected setState(newState: Partial<TState>): void {
|
||||
const previousState = this.currentState;
|
||||
this.currentState = { ...this.currentState, ...newState };
|
||||
// Only log state updates if not in production to avoid circular reference issues
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
logger.debug(`${this.serviceName} state updated`);
|
||||
}
|
||||
this.emit("stateChanged", this.currentState, previousState);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if service is ready for use
|
||||
*/
|
||||
isReady(): boolean {
|
||||
return this.isInitialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload/refresh the service
|
||||
*/
|
||||
async reload(...args: any[]): Promise<TState> {
|
||||
logger.debug(`Reloading ${this.serviceName}`);
|
||||
this.isInitialized = false;
|
||||
return this.initialize(...args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanup resources (can be overridden by subclasses)
|
||||
*/
|
||||
async cleanup(): Promise<void> {
|
||||
logger.debug(`Cleaning up ${this.serviceName}`);
|
||||
this.removeAllListeners();
|
||||
this.isInitialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for services with dependencies
|
||||
*/
|
||||
interface ServiceWithDependencies {
|
||||
getDependencies(): string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to check if a service has dependencies
|
||||
*/
|
||||
function hasDependencies(service: any): service is ServiceWithDependencies {
|
||||
return !!service && typeof service.getDependencies === "function";
|
||||
}
|
||||
|
||||
// Test implementation of BaseService
|
||||
interface TestState {
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ describe("slashCommands", () => {
|
|||
expect(result).toBeDefined();
|
||||
expect(result?.output).toContain("Authentication:");
|
||||
expect(result?.output).toContain("test@example.com");
|
||||
expect(result?.output).toContain("(no org)");
|
||||
expect(result?.output).toContain("test-org-id");
|
||||
expect(result?.output).toContain("Configuration:");
|
||||
expect(result?.output).toContain("/custom/config.yaml");
|
||||
expect(result?.exit).toBe(false);
|
||||
|
|
|
|||
|
|
@ -7,11 +7,12 @@ import {
|
|||
loadAuthConfig,
|
||||
} from "./auth/workos.js";
|
||||
import { getAllSlashCommands } from "./commands/commands.js";
|
||||
import { handleInfoSlashCommand } from "./infoScreen.js";
|
||||
import { reloadService, SERVICE_NAMES, services } from "./services/index.js";
|
||||
import { getCurrentSession, getSessionFilePath } from "./session.js";
|
||||
import { getCurrentSession } from "./session.js";
|
||||
import { posthogService } from "./telemetry/posthogService.js";
|
||||
import { telemetryService } from "./telemetry/telemetryService.js";
|
||||
import { SlashCommandResult } from "./ui/hooks/useChat.types.js";
|
||||
import { getVersion } from "./version.js";
|
||||
|
||||
type CommandHandler = (
|
||||
args: string[],
|
||||
|
|
@ -28,6 +29,7 @@ async function handleHelp(_args: string[], _assistant: AssistantConfig) {
|
|||
` ${chalk.cyan("Enter")} Submit message`,
|
||||
` ${chalk.cyan("Shift+Enter")} New line`,
|
||||
` ${chalk.cyan("\\")} Line continuation (at end of line)`,
|
||||
` ${chalk.cyan("!")} Shell mode - run shell commands`,
|
||||
"",
|
||||
chalk.white("Controls:"),
|
||||
` ${chalk.cyan("Ctrl+C")} Clear input`,
|
||||
|
|
@ -39,9 +41,11 @@ async function handleHelp(_args: string[], _assistant: AssistantConfig) {
|
|||
chalk.white("Special Characters:"),
|
||||
` ${chalk.cyan("@")} Search and attach files for context`,
|
||||
` ${chalk.cyan("/")} Access slash commands`,
|
||||
` ${chalk.cyan("!")} Execute bash commands directly`,
|
||||
"",
|
||||
chalk.white("Available Commands:"),
|
||||
` Type ${chalk.cyan("/")} to see available slash commands`,
|
||||
` Type ${chalk.cyan("!")} followed by a command to execute bash directly`,
|
||||
].join("\n");
|
||||
posthogService.capture("useSlashCommand", { name: "help" });
|
||||
return { output: helpMessage };
|
||||
|
|
@ -112,93 +116,6 @@ function handleWhoami() {
|
|||
}
|
||||
}
|
||||
|
||||
async function handleInfo() {
|
||||
posthogService.capture("useSlashCommand", { name: "info" });
|
||||
|
||||
const infoLines = [];
|
||||
|
||||
// Version and working directory info
|
||||
const version = getVersion();
|
||||
const cwd = process.cwd();
|
||||
|
||||
infoLines.push(chalk.white("CLI Information:"));
|
||||
infoLines.push(` Version: ${chalk.green(version)}`);
|
||||
infoLines.push(` Working Directory: ${chalk.blue(cwd)}`);
|
||||
|
||||
// Auth info
|
||||
if (isAuthenticated()) {
|
||||
const config = loadAuthConfig();
|
||||
if (config && isAuthenticatedConfig(config)) {
|
||||
const email = config.userEmail || config.userId;
|
||||
const org = "(no org)"; // Organization info not available in AuthenticatedConfig
|
||||
infoLines.push("");
|
||||
infoLines.push(chalk.white("Authentication:"));
|
||||
infoLines.push(` Email: ${chalk.green(email)}`);
|
||||
infoLines.push(` Organization: ${chalk.cyan(org)}`);
|
||||
} else {
|
||||
infoLines.push("");
|
||||
infoLines.push(chalk.white("Authentication:"));
|
||||
infoLines.push(
|
||||
` ${chalk.yellow("Authenticated via environment variable")}`,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
infoLines.push("");
|
||||
infoLines.push(chalk.white("Authentication:"));
|
||||
infoLines.push(` ${chalk.red("Not logged in")}`);
|
||||
}
|
||||
|
||||
// Config info
|
||||
try {
|
||||
const configState = services.config.getState();
|
||||
infoLines.push("");
|
||||
infoLines.push(chalk.white("Configuration:"));
|
||||
if (configState.config) {
|
||||
infoLines.push(` ${chalk.gray(`Using ${configState.config?.name}`)}`);
|
||||
} else {
|
||||
infoLines.push(` ${chalk.red(`Config not found`)}`);
|
||||
}
|
||||
if (configState.configPath) {
|
||||
infoLines.push(` Path: ${chalk.blue(configState.configPath)}`);
|
||||
}
|
||||
|
||||
// Add current model info
|
||||
try {
|
||||
const modelInfo = services.model?.getModelInfo();
|
||||
if (modelInfo) {
|
||||
infoLines.push(` Model: ${chalk.cyan(modelInfo.name)}`);
|
||||
} else {
|
||||
infoLines.push(` Model: ${chalk.red("Not available")}`);
|
||||
}
|
||||
} catch {
|
||||
infoLines.push(` Model: ${chalk.red("Error retrieving model info")}`);
|
||||
}
|
||||
} catch {
|
||||
infoLines.push("");
|
||||
infoLines.push(chalk.white("Configuration:"));
|
||||
infoLines.push(` ${chalk.red("Configuration service not available")}`);
|
||||
}
|
||||
|
||||
// Session info
|
||||
infoLines.push("");
|
||||
infoLines.push(chalk.white("Session:"));
|
||||
try {
|
||||
const currentSession = getCurrentSession();
|
||||
infoLines.push(` Title: ${chalk.green(currentSession.title)}`);
|
||||
infoLines.push(` ID: ${chalk.gray(currentSession.sessionId)}`);
|
||||
|
||||
const sessionFilePath = getSessionFilePath();
|
||||
infoLines.push(` File: ${chalk.blue(sessionFilePath)}`);
|
||||
} catch {
|
||||
infoLines.push(` ${chalk.red("Session not available")}`);
|
||||
}
|
||||
|
||||
return {
|
||||
exit: false,
|
||||
output: infoLines.join("\n"),
|
||||
};
|
||||
}
|
||||
|
||||
async function handleFork() {
|
||||
posthogService.capture("useSlashCommand", { name: "fork" });
|
||||
|
||||
|
|
@ -244,7 +161,7 @@ const commandHandlers: Record<string, CommandHandler> = {
|
|||
login: handleLogin,
|
||||
logout: handleLogout,
|
||||
whoami: handleWhoami,
|
||||
info: handleInfo,
|
||||
info: handleInfoSlashCommand,
|
||||
model: () => ({ openModelSelector: true }),
|
||||
compact: () => {
|
||||
posthogService.capture("useSlashCommand", { name: "compact" });
|
||||
|
|
@ -282,6 +199,9 @@ export async function handleSlashCommands(
|
|||
|
||||
const [command, ...args] = input.slice(1).split(" ");
|
||||
|
||||
telemetryService.recordSlashCommand(command);
|
||||
posthogService.capture("useSlashCommand", { name: command });
|
||||
|
||||
const handler = commandHandlers[command];
|
||||
if (handler) {
|
||||
return await handler(args, assistant);
|
||||
|
|
|
|||
|
|
@ -176,6 +176,13 @@ export async function constructSystemMessage(
|
|||
if (currentMode === "plan") {
|
||||
systemMessage +=
|
||||
'\n<context name="planMode">You are operating in _Plan Mode_, which means that your goal is to help the user investigate their ideas and develop a plan before taking action. You only have access to read-only tools and should not attempt to circumvent them to write / delete / create files. For example, it is not acceptable to use the Bash tool to write to files.</context>\n';
|
||||
} else {
|
||||
// TODO - make including this coauthor commit configurable
|
||||
systemMessage += `\n<context name="commitSignature">When creating commits using any CLI or tool, include the following in the commit message:
|
||||
Generated with [Continue](https://continue.dev)
|
||||
|
||||
Co-Authored-By: Continue <noreply@continue.dev>
|
||||
</context>\n`;
|
||||
}
|
||||
|
||||
// In headless mode, add instructions to be concise and only provide final answers
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ describe("PosthogService Error Handling", () => {
|
|||
properties: expect.objectContaining({
|
||||
test: "data",
|
||||
os: expect.any(String),
|
||||
extensionVersion: "",
|
||||
extensionVersion: expect.any(String),
|
||||
ideName: "cn",
|
||||
ideType: "cli",
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
import dns from "dns/promises";
|
||||
import os from "node:os";
|
||||
|
||||
import node_machine_id from "node-machine-id";
|
||||
import type { PostHog as PostHogType } from "posthog-node";
|
||||
|
||||
import { isAuthenticatedConfig, loadAuthConfig } from "../auth/workos.js";
|
||||
import { isGitHubActions } from "../util/git.js";
|
||||
import { logger } from "../util/logger.js";
|
||||
import { getVersion } from "../version.js";
|
||||
|
||||
export class PosthogService {
|
||||
private os: string | undefined;
|
||||
|
|
@ -15,13 +18,44 @@ export class PosthogService {
|
|||
this.uniqueId = this.getEventUserId();
|
||||
}
|
||||
|
||||
private _hasInternetConnection: boolean | undefined = undefined;
|
||||
private async hasInternetConnection() {
|
||||
const refetchConnection = async () => {
|
||||
try {
|
||||
await dns.lookup("app.posthog.com");
|
||||
this._hasInternetConnection = true;
|
||||
} catch {
|
||||
this._hasInternetConnection = false;
|
||||
}
|
||||
};
|
||||
|
||||
if (typeof this._hasInternetConnection !== "undefined") {
|
||||
void refetchConnection(); // check in background if connection became available
|
||||
return this._hasInternetConnection;
|
||||
}
|
||||
|
||||
await refetchConnection();
|
||||
return this._hasInternetConnection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if running in headless mode (-p/--print flags)
|
||||
*/
|
||||
private isHeadlessMode(): boolean {
|
||||
const args = process.argv.slice(2);
|
||||
return args.includes("-p") || args.includes("--print");
|
||||
}
|
||||
|
||||
get isEnabled() {
|
||||
return process.env.CONTINUE_CLI_ENABLE_TELEMETRY !== "0";
|
||||
}
|
||||
|
||||
private _client: PostHogType | undefined;
|
||||
private async getClient() {
|
||||
if (this.isEnabled) {
|
||||
if (!(await this.hasInternetConnection())) {
|
||||
this._client = undefined;
|
||||
logger.warn("No internet connection, skipping telemetry");
|
||||
} else if (this.isEnabled) {
|
||||
if (!this._client) {
|
||||
const { PostHog } = await import("posthog-node");
|
||||
this._client = new PostHog(
|
||||
|
|
@ -30,6 +64,7 @@ export class PosthogService {
|
|||
host: "https://app.posthog.com",
|
||||
},
|
||||
);
|
||||
logger.debug("Initialized telemetry");
|
||||
}
|
||||
} else {
|
||||
this._client = undefined;
|
||||
|
|
@ -62,9 +97,11 @@ export class PosthogService {
|
|||
const augmentedProperties = {
|
||||
...properties,
|
||||
os: this.os,
|
||||
extensionVersion: "", // TODO cn version
|
||||
extensionVersion: getVersion(),
|
||||
ideName: "cn",
|
||||
ideType: "cli",
|
||||
isHeadless: this.isHeadlessMode(),
|
||||
isGitHubCI: isGitHubActions(),
|
||||
};
|
||||
const payload = {
|
||||
distinctId: this.uniqueId,
|
||||
|
|
@ -83,7 +120,13 @@ export class PosthogService {
|
|||
try {
|
||||
const client = await this.getClient();
|
||||
if (client) {
|
||||
await client.shutdown();
|
||||
// Set a timeout for shutdown to prevent hanging
|
||||
const shutdownPromise = client.shutdown();
|
||||
const timeoutPromise = new Promise((_, reject) =>
|
||||
setTimeout(() => reject(new Error("Shutdown timeout")), 5000),
|
||||
);
|
||||
|
||||
await Promise.race([shutdownPromise, timeoutPromise]);
|
||||
}
|
||||
} catch (e) {
|
||||
logger.debug(`Failed to shutdown PostHog client: ${e}`);
|
||||
|
|
|
|||
|
|
@ -10,8 +10,10 @@ import {
|
|||
} from "@opentelemetry/sdk-metrics";
|
||||
import {
|
||||
SEMRESATTRS_DEPLOYMENT_ENVIRONMENT,
|
||||
SEMRESATTRS_HOST_NAME,
|
||||
SEMRESATTRS_OS_TYPE,
|
||||
SEMRESATTRS_PROCESS_PID,
|
||||
SEMRESATTRS_SERVICE_INSTANCE_ID,
|
||||
SEMRESATTRS_SERVICE_NAME,
|
||||
SEMRESATTRS_SERVICE_VERSION,
|
||||
} from "@opentelemetry/semantic-conventions";
|
||||
|
|
@ -52,6 +54,7 @@ class TelemetryService {
|
|||
private mcpConnectionsGauge: any = null;
|
||||
private startupTimeHistogram: any = null;
|
||||
private responseTimeHistogram: any = null;
|
||||
private slashCommandCounter: any = null;
|
||||
|
||||
constructor() {
|
||||
this.config = this.loadConfig();
|
||||
|
|
@ -88,6 +91,8 @@ class TelemetryService {
|
|||
const resource = resourceFromAttributes({
|
||||
[SEMRESATTRS_SERVICE_NAME]: "continue-cli",
|
||||
[SEMRESATTRS_SERVICE_VERSION]: getVersion(),
|
||||
[SEMRESATTRS_SERVICE_INSTANCE_ID]: uuidv4(),
|
||||
[SEMRESATTRS_HOST_NAME]: os.hostname(),
|
||||
[SEMRESATTRS_DEPLOYMENT_ENVIRONMENT]:
|
||||
process.env.NODE_ENV || "development",
|
||||
[SEMRESATTRS_OS_TYPE]: os.type(),
|
||||
|
|
@ -281,6 +286,14 @@ class TelemetryService {
|
|||
unit: "ms",
|
||||
},
|
||||
);
|
||||
|
||||
this.slashCommandCounter = this.meter.createCounter(
|
||||
"continue_cli_slash_command_usage",
|
||||
{
|
||||
description: "Count of slash commands used",
|
||||
unit: "count",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// Check if telemetry is enabled - this is the single point of checking
|
||||
|
|
@ -567,6 +580,15 @@ class TelemetryService {
|
|||
return this.config.sessionId;
|
||||
}
|
||||
|
||||
public recordSlashCommand(commandName: string) {
|
||||
if (!this.isEnabled()) return;
|
||||
|
||||
this.slashCommandCounter.add(
|
||||
1,
|
||||
this.getStandardAttributes({ command: commandName }),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shutdown telemetry service and ensure all metrics are flushed
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
import * as fs from "fs";
|
||||
|
||||
import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { editTool, markFileAsRead, readFilesSet } from "./edit.js";
|
||||
import { editTool } from "./edit.js";
|
||||
import { markFileAsRead, readFilesSet } from "./readFile.js";
|
||||
|
||||
// Mock the dependencies
|
||||
vi.mock("../telemetry/telemetryService.js");
|
||||
|
|
@ -21,6 +22,7 @@ vi.mock("fs", async () => {
|
|||
readFileSync: vi.fn(),
|
||||
writeFileSync: vi.fn(),
|
||||
unlinkSync: vi.fn(),
|
||||
realpathSync: vi.fn(),
|
||||
};
|
||||
});
|
||||
|
||||
|
|
@ -34,6 +36,7 @@ describe("editTool", () => {
|
|||
vi.mocked(fs.existsSync).mockReturnValue(true);
|
||||
vi.mocked(fs.readFileSync).mockReturnValue(originalContent);
|
||||
vi.mocked(fs.writeFileSync).mockImplementation(() => {});
|
||||
vi.mocked(fs.realpathSync).mockImplementation((path) => path.toString());
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
|
@ -126,7 +129,7 @@ describe("editTool", () => {
|
|||
const result = await editTool.preprocess!(args);
|
||||
|
||||
expect(result.args).toEqual({
|
||||
file_path: testFilePath,
|
||||
resolvedPath: testFilePath,
|
||||
newContent: "Hi there\nThis is a test file\nGoodbye world",
|
||||
oldContent: originalContent,
|
||||
});
|
||||
|
|
@ -163,7 +166,7 @@ describe("editTool", () => {
|
|||
it("should successfully write file and return success message", async () => {
|
||||
const newContent = "Hi there\nThis is a test file\nGoodbye world";
|
||||
const args = {
|
||||
file_path: testFilePath,
|
||||
resolvedPath: testFilePath,
|
||||
newContent,
|
||||
oldContent: originalContent,
|
||||
};
|
||||
|
|
@ -186,7 +189,7 @@ describe("editTool", () => {
|
|||
});
|
||||
|
||||
const args = {
|
||||
file_path: testFilePath,
|
||||
resolvedPath: testFilePath,
|
||||
newContent: "new content",
|
||||
oldContent: originalContent,
|
||||
};
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue