mirror of
https://github.com/cline/cline.git
synced 2026-09-16 21:01:52 +08:00
Merge remote-tracking branch 'origin/main' into pashpashpash/accounts
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
# Changesets
|
||||
|
||||
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
|
||||
with multi-package repos, or single-package repos to help you version and publish your code. You can
|
||||
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
|
||||
|
||||
We have a quick list of common questions to get you started engaging with this project in
|
||||
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"$schema": "https://unpkg.com/@changesets/config@3.0.5/schema.json",
|
||||
"changelog": "@changesets/cli/changelog",
|
||||
"commit": false,
|
||||
"fixed": [],
|
||||
"linked": [],
|
||||
"access": "restricted",
|
||||
"baseBranch": "main",
|
||||
"updateInternalDependencies": "patch",
|
||||
"ignore": []
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
changesDir: .changes
|
||||
unreleasedDir: unreleased
|
||||
headerPath: header.tpl.md
|
||||
changelogPath: CHANGELOG.md
|
||||
versionExt: md
|
||||
versionFormat: '## {{.Version}} - {{.Time.Format "2006-01-02"}}'
|
||||
kindFormat: "### {{.Kind}}"
|
||||
changeFormat: "* {{.Body}}"
|
||||
kinds:
|
||||
- label: Added
|
||||
auto: minor
|
||||
- label: Changed
|
||||
auto: major
|
||||
- label: Deprecated
|
||||
auto: minor
|
||||
- label: Removed
|
||||
auto: major
|
||||
- label: Fixed
|
||||
auto: patch
|
||||
- label: Security
|
||||
auto: patch
|
||||
newlines:
|
||||
afterChangelogHeader: 1
|
||||
beforeChangelogVersion: 1
|
||||
endOfVersion: 1
|
||||
envPrefix: CHANGIE_
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
<!-- Describe your changes in detail. What problem does this PR solve? -->
|
||||
|
||||
### Test Procedure
|
||||
|
||||
<!-- How did you test this? Are you confident that it will not introduce bugs? If so, why? -->
|
||||
|
||||
### Type of Change
|
||||
|
||||
<!-- Put an 'x' in all boxes that apply -->
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
name: Pre-release Publisher
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [prereleased]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
actions: read
|
||||
checks: read
|
||||
deployments: read
|
||||
discussions: read
|
||||
issues: read
|
||||
pages: read
|
||||
pull-requests: read
|
||||
repository-projects: read
|
||||
security-events: read
|
||||
statuses: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
uses: ./.github/workflows/test.yml
|
||||
|
||||
publish-prerelease:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20.15.1"
|
||||
cache: "npm"
|
||||
|
||||
# Cache root dependencies
|
||||
- name: Cache root dependencies
|
||||
uses: actions/cache@v4
|
||||
id: root-cache
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
|
||||
|
||||
# Cache webview-ui dependencies
|
||||
- name: Cache webview-ui dependencies
|
||||
uses: actions/cache@v4
|
||||
id: webview-cache
|
||||
with:
|
||||
path: webview-ui/node_modules
|
||||
key: ${{ runner.os }}-npm-webview-${{ hashFiles('webview-ui/package-lock.json') }}
|
||||
|
||||
- name: Install root dependencies
|
||||
if: steps.root-cache.outputs.cache-hit != 'true'
|
||||
run: npm ci
|
||||
|
||||
- name: Install webview-ui dependencies
|
||||
if: steps.webview-cache.outputs.cache-hit != 'true'
|
||||
run: cd webview-ui && npm ci
|
||||
|
||||
- name: Build Extension
|
||||
run: npm run build
|
||||
|
||||
- name: Install Publishing Tools
|
||||
run: npm install -g vsce ovsx
|
||||
|
||||
- name: Package and Publish Pre-release
|
||||
env:
|
||||
VSCE_PAT: ${{ secrets.VSCE_PAT }}
|
||||
OVSX_PAT: ${{ secrets.OVSX_PAT }}
|
||||
run: |
|
||||
current_package_version=$(node -p "require('./package.json').version")
|
||||
vsce package
|
||||
vsce publish --pre-release -p ${{ secrets.VSCE_PAT }}
|
||||
echo "Successfully published pre-release version $current_package_version to VS Code Marketplace"
|
||||
|
||||
- name: Create GitHub Pre-release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: "*.vsix"
|
||||
generate_release_notes: true
|
||||
prerelease: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,115 @@
|
||||
name: "Publish Release"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release-type:
|
||||
description: "Choose release type (release or pre-release)"
|
||||
required: true
|
||||
default: "release"
|
||||
type: choice
|
||||
options:
|
||||
- pre-release
|
||||
- release
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
checks: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
test:
|
||||
uses: ./.github/workflows/test.yml
|
||||
|
||||
publish:
|
||||
needs: test
|
||||
name: Publish Extension
|
||||
runs-on: ubuntu-latest
|
||||
environment: publish
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20.15.1
|
||||
|
||||
# Cache root dependencies - only reuse if package-lock.json exactly matches
|
||||
- name: Cache root dependencies
|
||||
uses: actions/cache@v4
|
||||
id: root-cache
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
|
||||
|
||||
# Cache webview-ui dependencies - only reuse if package-lock.json exactly matches
|
||||
- name: Cache webview-ui dependencies
|
||||
uses: actions/cache@v4
|
||||
id: webview-cache
|
||||
with:
|
||||
path: webview-ui/node_modules
|
||||
key: ${{ runner.os }}-npm-webview-${{ hashFiles('webview-ui/package-lock.json') }}
|
||||
|
||||
- name: Install root dependencies
|
||||
if: steps.root-cache.outputs.cache-hit != 'true'
|
||||
run: npm ci
|
||||
|
||||
- name: Install webview-ui dependencies
|
||||
if: steps.webview-cache.outputs.cache-hit != 'true'
|
||||
run: cd webview-ui && npm ci
|
||||
|
||||
- name: Install Publishing Tools
|
||||
run: npm install -g vsce ovsx
|
||||
|
||||
- name: Get Version
|
||||
id: get_version
|
||||
run: |
|
||||
VERSION=$(node -p "require('./package.json').version")
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create Git Tag
|
||||
id: create_tag
|
||||
run: |
|
||||
VERSION=v${{ steps.get_version.outputs.version }}
|
||||
echo "tag=$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "Tagging with $VERSION"
|
||||
git tag "$VERSION"
|
||||
git push origin "$VERSION"
|
||||
|
||||
- name: Package and Publish Extension
|
||||
env:
|
||||
VSCE_PAT: ${{ secrets.VSCE_PAT }}
|
||||
OVSX_PAT: ${{ secrets.OVSX_PAT }}
|
||||
run: |
|
||||
# Required to generate the .vsix
|
||||
vsce package --out "cline-${{ steps.get_version.outputs.version }}.vsix"
|
||||
|
||||
if [ "${{ github.event.inputs.release-type }}" = "pre-release" ]; then
|
||||
npm run publish:marketplace:prerelease
|
||||
echo "Successfully published pre-release version ${{ steps.get_version.outputs.version }} to VS Code Marketplace and Open VSX Registry"
|
||||
else
|
||||
npm run publish:marketplace
|
||||
echo "Successfully published release version ${{ steps.get_version.outputs.version }} to VS Code Marketplace and Open VSX Registry"
|
||||
fi
|
||||
|
||||
# - name: Get Changelog Entry
|
||||
# id: changelog
|
||||
# uses: mindsers/changelog-reader-action@v2
|
||||
# with:
|
||||
# # This expects a standard Keep a Changelog format
|
||||
# # "latest" means it will read whichever is the most recent version
|
||||
# # set in "## [1.2.3] - 2025-01-28" style
|
||||
# version: latest
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ steps.create_tag.outputs.tag }}
|
||||
files: "*.vsix"
|
||||
# body: ${{ steps.changelog.outputs.content }}
|
||||
generate_release_notes: true
|
||||
prerelease: ${{ github.event.inputs.release-type == 'pre-release' }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -1,83 +0,0 @@
|
||||
name: Release & Publish
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
actions: read
|
||||
checks: read
|
||||
deployments: read
|
||||
discussions: read
|
||||
issues: read
|
||||
pages: read
|
||||
pull-requests: read
|
||||
repository-projects: read
|
||||
security-events: read
|
||||
statuses: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
uses: ./.github/workflows/test.yml
|
||||
|
||||
release:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js environment
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20.15.1
|
||||
|
||||
# Cache root dependencies - only reuse if package-lock.json exactly matches
|
||||
- name: Cache root dependencies
|
||||
uses: actions/cache@v4
|
||||
id: root-cache
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
|
||||
|
||||
# Cache webview-ui dependencies - only reuse if package-lock.json exactly matches
|
||||
- name: Cache webview-ui dependencies
|
||||
uses: actions/cache@v4
|
||||
id: webview-cache
|
||||
with:
|
||||
path: webview-ui/node_modules
|
||||
key: ${{ runner.os }}-npm-webview-${{ hashFiles('webview-ui/package-lock.json') }}
|
||||
|
||||
- name: Install root dependencies
|
||||
if: steps.root-cache.outputs.cache-hit != 'true'
|
||||
run: npm ci
|
||||
|
||||
- name: Install webview-ui dependencies
|
||||
if: steps.webview-cache.outputs.cache-hit != 'true'
|
||||
run: cd webview-ui && npm ci
|
||||
|
||||
- name: Build Extension
|
||||
run: npm run build
|
||||
|
||||
- name: Install Publishing Tools
|
||||
run: npm install -g vsce ovsx
|
||||
|
||||
- name: Package and Publish Extension
|
||||
env:
|
||||
VSCE_PAT: ${{ secrets.VSCE_PAT }}
|
||||
OVSX_PAT: ${{ secrets.OVSX_PAT }}
|
||||
run: |
|
||||
current_package_version=$(node -p "require('./package.json').version")
|
||||
npm run publish:marketplace
|
||||
echo "Successfully published version $current_package_version to VS Code Marketplace"
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: "*.vsix"
|
||||
generate_release_notes: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -5,6 +5,7 @@ on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
workflow_call:
|
||||
|
||||
# Set default permissions for all jobs
|
||||
permissions:
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ import { defineConfig } from "@vscode/test-cli"
|
||||
import path from "path"
|
||||
|
||||
export default defineConfig({
|
||||
files: "{out/test/**/*.test.js,src/test/suite/**/*.test.js}",
|
||||
files: "{out/**/*.test.js,src/**/*.test.js}",
|
||||
mocha: {
|
||||
ui: "bdd",
|
||||
timeout: 20000, // Maximum time (in ms) that a test can run before failing
|
||||
|
||||
+25
-1
@@ -1,4 +1,28 @@
|
||||
# Change Log
|
||||
# Changelog
|
||||
|
||||
## [3.2.12]
|
||||
|
||||
- Fix command chaining for Windows users
|
||||
- Fix reasoning_content error for OpenAI providers
|
||||
|
||||
## [3.2.11]
|
||||
|
||||
- Add OpenAI o3-mini model
|
||||
|
||||
## [3.2.10]
|
||||
|
||||
- Improve support for DeepSeek-R1 (deepseek-reasoner) model for OpenRouter, OpenAI-compatible, and DeepSeek direct
|
||||
- Show Reasoning tokens for models that support it
|
||||
- Fix issues with switching models between Plan/Act modes
|
||||
|
||||
## [3.2.6]
|
||||
|
||||
- Save last used API/model when switching between Plan and Act, for users that like to use different models for each mode
|
||||
- New Context Window progress bar in the task header to understand increased cost/generation degradation as the context increases
|
||||
- Localize READMEs and add language selector for English, Spanish, German, Chinese, and Japanese
|
||||
- Add Advanced Settings to remove MCP prompts from requests to save tokens, enable/disable checkpoints for users that don't use git (more coming soon!)
|
||||
- Add Gemini 2.0 Flash Thinking experimental model
|
||||
- Allow new users to subscribe to mailing list to get notified when new Accounts option is available
|
||||
|
||||
## [3.2.5]
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
<div align="center"><sub>
|
||||
English | <a href="https://github.com/cline/cline/blob/main/locales/es/README.md" target="_blank">Español</a> | <a href="https://github.com/cline/cline/blob/main/locales/de/README.md" target="_blank">Deutsch</a> | <a href="https://github.com/cline/cline/blob/main/locales/ja/README.md" target="_blank">日本語</a> | <a href="https://github.com/cline/cline/blob/main/locales/zh-cn/README.md" target="_blank">简体中文</a> | <a href="https://github.com/cline/cline/blob/main/locales/zh-tw/README.md" target="_blank">繁體中文</a>
|
||||
</sub></div>
|
||||
|
||||
# Cline – \#1 on OpenRouter
|
||||
|
||||
<p align="center">
|
||||
@@ -156,6 +160,31 @@ To contribute to the project, start with our [Contributing Guide](CONTRIBUTING.m
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Creating a Pull Request</summary>
|
||||
|
||||
1. Before creating a PR, generate a changeset entry:
|
||||
```bash
|
||||
npm run changeset
|
||||
```
|
||||
This will prompt you for:
|
||||
- Type of change (major, minor, patch)
|
||||
- `major` → breaking changes (1.0.0 → 2.0.0)
|
||||
- `minor` → new features (1.0.0 → 1.1.0)
|
||||
- `patch` → bug fixes (1.0.0 → 1.0.1)
|
||||
- Description of your changes
|
||||
|
||||
2. Commit your changes and the generated `.changeset` file
|
||||
|
||||
3. Push your branch and create a PR on GitHub. Our CI will:
|
||||
- Run tests and checks
|
||||
- Changesetbot will create a comment showing the version impact
|
||||
- When merged to main, changesetbot will create a Version Packages PR
|
||||
- When the Version Packages PR is merged, a new release will be published
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
## License
|
||||
|
||||
[Apache 2.0 © 2024 Cline Bot Inc.](./LICENSE)
|
||||
|
||||
@@ -38,7 +38,7 @@ STOP! Before proceeding, you MUST verify these requirements:
|
||||
<img src="https://github.com/user-attachments/assets/abf908b1-be98-4894-8dc7-ef3d27943a47" alt="MCP Server Panel" width="400" />
|
||||
|
||||
1. The MCP settings files should be display in a tab in VS Code.
|
||||
1. Replce the file's contents with this code:
|
||||
1. Replace the file's contents with this code:
|
||||
|
||||
For Windows:
|
||||
|
||||
@@ -96,7 +96,7 @@ You should witness Cline:
|
||||
1. Update the mcp setting json file
|
||||
1. Start the server and start the server
|
||||
|
||||
The mcp seetings file should now look like this:
|
||||
The mcp settings file should now look like this:
|
||||
|
||||
_For a Windows machine:_
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
# Verhaltenskodex für Mitwirkende
|
||||
|
||||
## Unser Versprechen
|
||||
|
||||
Im Interesse der Förderung einer offenen und einladenden Umgebung verpflichten wir uns als
|
||||
Mitwirkende und Betreuer, die Teilnahme an unserem Projekt und unserer
|
||||
Gemeinschaft zu einer belästigungsfreien Erfahrung für alle zu machen, unabhängig von Alter, Körpergröße,
|
||||
Behinderung, ethnischer Zugehörigkeit, sexuellen Merkmalen, Geschlechtsidentität und -ausdruck,
|
||||
Erfahrungsniveau, Bildung, sozioökonomischem Status, Nationalität, persönlichem Erscheinungsbild,
|
||||
Rasse, Religion oder sexueller Identität und Orientierung.
|
||||
|
||||
## Unsere Standards
|
||||
|
||||
Beispiele für Verhaltensweisen, die dazu beitragen, eine positive Umgebung zu schaffen, sind:
|
||||
|
||||
- Verwendung einer einladenden und inklusiven Sprache
|
||||
- Respekt gegenüber unterschiedlichen Standpunkten und Erfahrungen
|
||||
- Konstruktive Annahme von Kritik
|
||||
- Fokussierung auf das, was das Beste für die Gemeinschaft ist
|
||||
- Empathie gegenüber anderen Mitgliedern der Gemeinschaft zeigen
|
||||
|
||||
Beispiele für inakzeptables Verhalten von Teilnehmern sind:
|
||||
|
||||
- Die Verwendung von sexualisierter Sprache oder Bildern und unerwünschte sexuelle Aufmerksamkeit oder Annäherungen
|
||||
- Trollen, beleidigende/abwertende Kommentare und persönliche oder politische Angriffe
|
||||
- Öffentliche oder private Belästigung
|
||||
- Veröffentlichen von privaten Informationen anderer, wie eine physische oder elektronische Adresse,
|
||||
ohne ausdrückliche Erlaubnis
|
||||
- Andere Verhaltensweisen, die in einem professionellen Umfeld als unangemessen angesehen werden könnten
|
||||
|
||||
## Unsere Verantwortlichkeiten
|
||||
|
||||
Die Projektbetreuer sind dafür verantwortlich, die Standards für akzeptables Verhalten zu klären
|
||||
und es wird erwartet, dass sie angemessene und faire Korrekturmaßnahmen als Reaktion auf
|
||||
jedes Beispiel für inakzeptables Verhalten ergreifen.
|
||||
|
||||
Die Projektbetreuer haben das Recht und die Verantwortung, Kommentare, Commits, Code, Wiki-Änderungen, Issues und andere Beiträge zu entfernen, zu bearbeiten oder abzulehnen, die nicht mit diesem Verhaltenskodex übereinstimmen, oder jeden Mitwirkenden vorübergehend oder dauerhaft zu
|
||||
@@ -0,0 +1,82 @@
|
||||
# Beitrag zu Cline
|
||||
|
||||
Wir freuen uns, dass du daran interessiert bist, zu Cline beizutragen. Ob du einen Fehler behebst, eine Funktion hinzufügst oder unsere Dokumentation verbesserst – jeder Beitrag macht Cline intelligenter! Um unsere Community lebendig und einladend zu halten, müssen alle Mitglieder unseren [Verhaltenskodex](CODE_OF_CONDUCT.md) einhalten.
|
||||
|
||||
## Fehler oder Probleme melden
|
||||
|
||||
Fehlermeldungen helfen, Cline für alle zu verbessern! Bevor du ein neues Problem erstellst, überprüfe bitte die [bestehenden Probleme](https://github.com/cline/cline/issues), um Duplikate zu vermeiden. Wenn du bereit bist, einen Fehler zu melden, gehe zu unserer [Issues-Seite](https://github.com/cline/cline/issues/new/choose), wo du eine Vorlage findest, die dir hilft, die relevanten Informationen auszufüllen.
|
||||
|
||||
<blockquote class='warning-note'>
|
||||
🔐 <b>Wichtig:</b> Wenn du eine Sicherheitslücke entdeckst, verwende das <a href="https://github.com/cline/cline/security/advisories/new">GitHub-Sicherheitstool, um sie privat zu melden</a>.
|
||||
</blockquote>
|
||||
|
||||
## Entscheiden, woran man arbeiten möchte
|
||||
|
||||
Suchst du nach einem guten ersten Beitrag? Schau dir die mit ["good first issue"](https://github.com/cline/cline/labels/good%20first%20issue) oder ["help wanted"](https://github.com/cline/cline/labels/help%20wanted) gekennzeichneten Issues an. Diese sind speziell für neue Mitwirkende ausgewählt und Bereiche, in denen wir gerne Hilfe erhalten würden!
|
||||
|
||||
Wir begrüßen auch Beiträge zu unserer [Dokumentation](https://github.com/cline/cline/tree/main/docs). Ob du Tippfehler korrigierst, bestehende Anleitungen verbesserst oder neue Bildungsinhalte erstellst – wir möchten ein von der Community verwaltetes Ressourcen-Repository aufbauen, das allen hilft, das Beste aus Cline herauszuholen. Du kannst beginnen, indem du `/docs` erkundest und nach Bereichen suchst, die verbessert werden müssen.
|
||||
|
||||
Wenn du planst, an einer größeren Funktion zu arbeiten, erstelle bitte zuerst eine [Funktionsanfrage](https://github.com/cline/cline/discussions/categories/feature-requests?discussions_q=is%3Aopen+category%3A%22Feature+Requests%22+sort%3Atop), damit wir besprechen können, ob sie mit der Vision von Cline übereinstimmt.
|
||||
|
||||
## Entwicklungsumgebung einrichten
|
||||
|
||||
1. **VS Code Erweiterungen**
|
||||
|
||||
- Beim Öffnen des Projekts wird VS Code dich auffordern, die empfohlenen Erweiterungen zu installieren
|
||||
- Diese Erweiterungen sind für die Entwicklung erforderlich, bitte akzeptiere alle Installationsanfragen
|
||||
- Wenn du die Anfragen abgelehnt hast, kannst du sie manuell im Erweiterungsbereich installieren
|
||||
|
||||
2. **Lokale Entwicklung**
|
||||
- Führe `npm run install:all` aus, um die Abhängigkeiten zu installieren
|
||||
- Führe `npm run test` aus, um die Tests lokal auszuführen
|
||||
- Bevor du einen PR einreichst, führe `npm run format:fix` aus, um deinen Code zu formatieren
|
||||
|
||||
## Code schreiben und einreichen
|
||||
|
||||
Jeder kann Code zu Cline beitragen, aber wir bitten dich, diese Richtlinien zu befolgen, um sicherzustellen, dass deine Beiträge reibungslos integriert werden:
|
||||
|
||||
1. **Pull Requests fokussiert halten**
|
||||
|
||||
- Begrenze PRs auf eine einzelne Funktion oder Fehlerbehebung
|
||||
- Teile größere Änderungen in kleinere, kohärente PRs auf
|
||||
- Teile Änderungen in logische Commits auf, die unabhängig überprüft werden können
|
||||
|
||||
2. **Codequalität**
|
||||
|
||||
- Führe `npm run lint` aus, um den Code-Stil zu überprüfen
|
||||
- Führe `npm run format` aus, um den Code automatisch zu formatieren
|
||||
- Alle PRs müssen die CI-Prüfungen bestehen, die Linting und Formatierung umfassen
|
||||
- Behebe alle ESLint-Warnungen oder -Fehler, bevor du einreichst
|
||||
- Befolge die Best Practices für TypeScript und halte die Typensicherheit ein
|
||||
|
||||
3. **Tests**
|
||||
|
||||
- Füge Tests für neue Funktionen hinzu
|
||||
- Führe `npm test` aus, um sicherzustellen, dass alle Tests bestehen
|
||||
- Aktualisiere bestehende Tests, wenn deine Änderungen sie beeinflussen
|
||||
- Füge sowohl Unit- als auch Integrationstests hinzu, wo es angebracht ist
|
||||
|
||||
4. **Commit-Richtlinien**
|
||||
|
||||
- Schreibe klare und beschreibende Commit-Nachrichten
|
||||
- Verwende das konventionelle Commit-Format (z.B. "feat:", "fix:", "docs:")
|
||||
- Verweise auf relevante Issues in den Commits mit #Issue-Nummer
|
||||
|
||||
5. **Vor dem Einreichen**
|
||||
|
||||
- Rebase deinen Branch mit dem neuesten Main
|
||||
- Stelle sicher, dass dein Branch korrekt gebaut wird
|
||||
- Überprüfe, dass alle Tests bestehen
|
||||
- Überprüfe deine Änderungen, um jeglichen Debug-Code oder Konsolenprotokolle zu entfernen
|
||||
|
||||
6. **Beschreibung des Pull Requests**
|
||||
- Beschreibe klar, was deine Änderungen bewirken
|
||||
- Füge Schritte hinzu, um die Änderungen zu testen
|
||||
- Liste alle wichtigen Änderungen auf
|
||||
- Füge Screenshots für Änderungen an der Benutzeroberfläche hinzu
|
||||
|
||||
## Beitragsvereinbarung
|
||||
|
||||
Durch das Einreichen eines Pull Requests erklärst du dich damit einverstanden, dass deine Beiträge unter derselben Lizenz wie das Projekt ([Apache 2.0](LICENSE)) lizenziert werden.
|
||||
|
||||
Denke daran: Zu Cline beizutragen bedeutet nicht nur, Code zu schreiben, sondern Teil einer Community zu sein, die die Zukunft der KI-gestützten Entwicklung gestaltet. Lass uns gemeinsam etwas Großartiges schaffen! 🚀
|
||||
@@ -0,0 +1,162 @@
|
||||
# Cline – \#1 auf OpenRouter
|
||||
|
||||
<p align="center">
|
||||
<img src="https://media.githubusercontent.com/media/cline/cline/main/assets/docs/demo.gif" width="100%" />
|
||||
</p>
|
||||
|
||||
<div align="center">
|
||||
<table>
|
||||
<tbody>
|
||||
<td align="center">
|
||||
<a href="https://marketplace.visualstudio.com/items?itemName=saoudrizwan.claude-dev" target="_blank"><strong>Im VS Marketplace herunterladen</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://discord.gg/cline" target="_blank"><strong>Discord</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://www.reddit.com/r/cline/" target="_blank"><strong>r/cline</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/cline/cline/discussions/categories/feature-requests?discussions_q=is%3Aopen+category%3A%22Feature+Requests%22+sort%3Atop" target="_blank"><strong>Feature Requests</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://cline.bot/join-us" target="_blank"><strong>Wir stellen ein!</strong></a>
|
||||
</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
Lernen Sie Cline kennen, einen KI-Assistenten, der Ihre **CLI** u**N**d **E**ditor nutzen kann.
|
||||
|
||||
Dank der [agentischen Codierungsfähigkeiten von Claude 3.5 Sonnet](https://www-cdn.anthropic.com/fed9cc193a14b84131812372d8d5857f8f304c52/Model_Card_Claude_3_Addendum.pdf) kann Cline komplexe Softwareentwicklungsaufgaben Schritt für Schritt bewältigen. Mit Werkzeugen, die ihm das Erstellen und Bearbeiten von Dateien, das Erkunden großer Projekte, die Nutzung des Browsers und das Ausführen von Terminalbefehlen (nach Ihrer Genehmigung) ermöglichen, kann er Ihnen auf eine Weise helfen, die über die Codevervollständigung oder technischen Support hinausgeht. Cline kann sogar das Model Context Protocol (MCP) verwenden, um neue Werkzeuge zu erstellen und seine eigenen Fähigkeiten zu erweitern. Während autonome KI-Skripte traditionell in sandboxed Umgebungen laufen, bietet diese Erweiterung eine Mensch-in-der-Schleife-GUI, um jede Dateiänderung und jeden Terminalbefehl zu genehmigen, was eine sichere und zugängliche Möglichkeit bietet, das Potenzial agentischer KI zu erkunden.
|
||||
|
||||
1. Geben Sie Ihre Aufgabe ein und fügen Sie Bilder hinzu, um Mockups in funktionale Apps zu konvertieren oder Fehler mit Screenshots zu beheben.
|
||||
2. Cline beginnt mit der Analyse Ihrer Dateistruktur und Quellcode-ASTs, führt Regex-Suchen durch und liest relevante Dateien, um sich in bestehenden Projekten zurechtzufinden. Durch sorgfältiges Management der hinzugefügten Informationen kann Cline wertvolle Unterstützung auch bei großen, komplexen Projekten bieten, ohne das Kontextfenster zu überladen.
|
||||
3. Sobald Cline die benötigten Informationen hat, kann er:
|
||||
- Dateien erstellen und bearbeiten sowie Linter-/Compiler-Fehler überwachen, um proaktiv Probleme wie fehlende Importe und Syntaxfehler selbst zu beheben.
|
||||
- Befehle direkt in Ihrem Terminal ausführen und deren Ausgabe überwachen, sodass er z.B. auf Dev-Server-Probleme reagieren kann, nachdem er eine Datei bearbeitet hat.
|
||||
- Für Webentwicklungsaufgaben kann Cline die Website in einem Headless-Browser starten, klicken, tippen, scrollen und Screenshots sowie Konsolenprotokolle erfassen, sodass er Laufzeitfehler und visuelle Fehler beheben kann.
|
||||
4. Wenn eine Aufgabe abgeschlossen ist, präsentiert Cline das Ergebnis mit einem Terminalbefehl wie `open -a "Google Chrome" index.html`, den Sie mit einem Klick ausführen können.
|
||||
|
||||
> [!TIPP]
|
||||
> Verwenden Sie die Tastenkombination `CMD/CTRL + Shift + P`, um die Befehls-Palette zu öffnen und geben Sie "Cline: Open In New Tab" ein, um die Erweiterung als Tab in Ihrem Editor zu öffnen. So können Sie Cline neben Ihrem Dateiexplorer verwenden und sehen, wie er Ihren Arbeitsbereich verändert.
|
||||
|
||||
---
|
||||
|
||||
<img align="right" width="340" src="https://github.com/user-attachments/assets/3cf21e04-7ce9-4d22-a7b9-ba2c595e88a4">
|
||||
|
||||
### Verwenden Sie jede API und jedes Modell
|
||||
|
||||
Cline unterstützt API-Anbieter wie OpenRouter, Anthropic, OpenAI, Google Gemini, AWS Bedrock, Azure und GCP Vertex. Sie können auch jede OpenAI-kompatible API konfigurieren oder ein lokales Modell über LM Studio/Ollama verwenden. Wenn Sie OpenRouter verwenden, ruft die Erweiterung deren neueste Modellliste ab, sodass Sie die neuesten Modelle sofort verwenden können, sobald sie verfügbar sind.
|
||||
|
||||
Die Erweiterung verfolgt auch die gesamten Token- und API-Nutzungskosten für den gesamten Aufgabenzyklus und einzelne Anfragen, sodass Sie bei jedem Schritt über die Ausgaben informiert sind.
|
||||
|
||||
<!-- Transparenter Pixel, um einen Zeilenumbruch nach dem schwebenden Bild zu erzeugen -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="left" width="370" src="https://github.com/user-attachments/assets/81be79a8-1fdb-4028-9129-5fe055e01e76">
|
||||
|
||||
### Befehle im Terminal ausführen
|
||||
|
||||
Dank der neuen [Shell-Integrations-Updates in VSCode v1.93](https://code.visualstudio.com/updates/v1_93#_terminal-shell-integration-api) kann Cline Befehle direkt in Ihrem Terminal ausführen und die Ausgabe empfangen. Dies ermöglicht ihm eine Vielzahl von Aufgaben, von der Installation von Paketen und dem Ausführen von Build-Skripten bis hin zur Bereitstellung von Anwendungen, Verwaltung von Datenbanken und Ausführung von Tests, während er sich an Ihre Entwicklungsumgebung und Toolchain anpasst, um die Aufgabe richtig zu erledigen.
|
||||
|
||||
Für lang laufende Prozesse wie Dev-Server verwenden Sie die Schaltfläche "Während des Laufens fortfahren", um Cline die Fortsetzung der Aufgabe zu ermöglichen, während der Befehl im Hintergrund läuft. Während Cline arbeitet, wird er über neue Terminalausgaben benachrichtigt, sodass er auf auftretende Probleme reagieren kann, wie z.B. Kompilierungsfehler beim Bearbeiten von Dateien.
|
||||
|
||||
<!-- Transparenter Pixel, um einen Zeilenumbruch nach dem schwebenden Bild zu erzeugen -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="right" width="400" src="https://github.com/user-attachments/assets/c5977833-d9b8-491e-90f9-05f9cd38c588">
|
||||
|
||||
### Dateien erstellen und bearbeiten
|
||||
|
||||
Cline kann Dateien direkt in Ihrem Editor erstellen und bearbeiten und Ihnen eine Diff-Ansicht der Änderungen präsentieren. Sie können die Änderungen von Cline direkt im Diff-Ansichts-Editor bearbeiten oder rückgängig machen oder Feedback im Chat geben, bis Sie mit dem Ergebnis zufrieden sind. Cline überwacht auch Linter-/Compiler-Fehler (fehlende Importe, Syntaxfehler usw.), sodass er auftretende Probleme selbst beheben kann.
|
||||
|
||||
Alle von Cline vorgenommenen Änderungen werden in der Timeline Ihrer Datei aufgezeichnet, was eine einfache Möglichkeit bietet, Änderungen nachzuverfolgen und bei Bedarf rückgängig zu machen.
|
||||
|
||||
<!-- Transparenter Pixel, um einen Zeilenumbruch nach dem schwebenden Bild zu erzeugen -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="left" width="370" src="https://github.com/user-attachments/assets/bc2e85ba-dfeb-4fe6-9942-7cfc4703cbe5">
|
||||
|
||||
### Den Browser verwenden
|
||||
|
||||
Mit der neuen [Computer Use](https://www.anthropic.com/news/3-5-models-and-computer-use) Fähigkeit von Claude 3.5 Sonnet kann Cline einen Browser starten, Elemente anklicken, Text eingeben und scrollen, dabei Screenshots und Konsolenprotokolle bei jedem Schritt erfassen. Dies ermöglicht interaktives Debugging, End-to-End-Tests und sogar allgemeine Webnutzung! Dies gibt ihm die Autonomie, visuelle Fehler und Laufzeitprobleme zu beheben, ohne dass Sie selbst Fehlerprotokolle kopieren und einfügen müssen.
|
||||
|
||||
Versuchen Sie, Cline zu bitten, "die App zu testen", und sehen Sie zu, wie er einen Befehl wie `npm run dev` ausführt, Ihren lokal laufenden Dev-Server in einem Browser startet und eine Reihe von Tests durchführt, um zu bestätigen, dass alles funktioniert. [Sehen Sie sich hier eine Demo an.](https://x.com/sdrzn/status/1850880547825823989)
|
||||
|
||||
<!-- Transparenter Pixel, um einen Zeilenumbruch nach dem schwebenden Bild zu erzeugen -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="right" width="350" src="https://github.com/user-attachments/assets/ac0efa14-5c1f-4c26-a42d-9d7c56f5fadd">
|
||||
|
||||
### "ein Werkzeug hinzufügen, das..."
|
||||
|
||||
Dank des [Model Context Protocol](https://github.com/modelcontextprotocol) kann Cline seine Fähigkeiten durch benutzerdefinierte Werkzeuge erweitern. Während Sie [community-made servers](https://github.com/modelcontextprotocol/servers) verwenden können, kann Cline stattdessen Werkzeuge erstellen und installieren, die speziell auf Ihren Workflow zugeschnitten sind. Bitten Sie Cline einfach, "ein Werkzeug hinzuzufügen", und er erledigt alles, von der Erstellung eines neuen MCP-Servers bis zur Installation in der Erweiterung. Diese benutzerdefinierten Werkzeuge werden dann Teil von Clines Toolkit und sind bereit, in zukünftigen Aufgaben verwendet zu werden.
|
||||
|
||||
- "ein Werkzeug hinzufügen, das Jira-Tickets abruft": Abrufen von Ticket-ACs und Cline zur Arbeit bringen
|
||||
- "ein Werkzeug hinzufügen, das AWS EC2s verwaltet": Überprüfen von Servermetriken und Skalieren von Instanzen
|
||||
- "ein Werkzeug hinzufügen, das die neuesten PagerDuty-Vorfälle abruft": Abrufen von Details und Cline bitten, Fehler zu beheben
|
||||
|
||||
<!-- Transparenter Pixel, um einen Zeilenumbruch nach dem schwebenden Bild zu erzeugen -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="left" width="360" src="https://github.com/user-attachments/assets/7fdf41e6-281a-4b4b-ac19-020b838b6970">
|
||||
|
||||
### Kontext hinzufügen
|
||||
|
||||
**`@url`:** Fügen Sie eine URL ein, damit die Erweiterung sie abruft und in Markdown konvertiert, nützlich, wenn Sie Cline die neuesten Dokumente geben möchten
|
||||
|
||||
**`@problems`:** Fügen Sie Arbeitsbereichsfehler und -warnungen (Panel 'Probleme') hinzu, die Cline beheben soll
|
||||
|
||||
**`@file`:** Fügt den Inhalt einer Datei hinzu, sodass Sie keine API-Anfragen verschwenden müssen, um das Lesen der Datei zu genehmigen (+ zum Suchen von Dateien tippen)
|
||||
|
||||
**`@folder`:** Fügt die Dateien eines Ordners auf einmal hinzu, um Ihren Workflow noch weiter zu beschleunigen
|
||||
|
||||
<!-- Transparenter Pixel, um einen Zeilenumbruch nach dem schwebenden Bild zu erzeugen -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="right" width="350" src="https://github.com/user-attachments/assets/140c8606-d3bf-41b9-9a1f-4dbf0d4c90cb">
|
||||
|
||||
### Checkpoints: Vergleichen und Wiederherstellen
|
||||
|
||||
Während Cline eine Aufgabe bearbeitet, erstellt die Erweiterung bei jedem Schritt einen Schnappschuss Ihres Arbeitsbereichs. Sie können die Schaltfläche 'Vergleichen' verwenden, um einen Diff zwischen dem Schnappschuss und Ihrem aktuellen Arbeitsbereich zu sehen, und die Schaltfläche 'Wiederherstellen', um zu diesem Punkt zurückzukehren.
|
||||
|
||||
Wenn Sie beispielsweise mit einem lokalen Webserver arbeiten, können Sie 'Nur Arbeitsbereich wiederherstellen' verwenden, um schnell verschiedene Versionen Ihrer App zu testen, und 'Aufgabe und Arbeitsbereich wiederherstellen', wenn Sie die Version gefunden haben, von der aus Sie weiterentwickeln möchten. Dies ermöglicht es Ihnen, sicher verschiedene Ansätze zu erkunden, ohne Fortschritte zu verlieren.
|
||||
|
||||
<!-- Transparenter Pixel, um einen Zeilenumbruch nach dem schwebenden Bild zu erzeugen -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
## Beitrag leisten
|
||||
|
||||
Um zum Projekt beizutragen, beginnen Sie mit unserem [Beitragsleitfaden](CONTRIBUTING.md), um die Grundlagen zu lernen. Sie können auch unserem [Discord](https://discord.gg/cline) beitreten, um im Kanal `#contributors` mit anderen Mitwirkenden zu chatten. Wenn Sie auf der Suche nach einer Vollzeitstelle sind, schauen Sie sich unsere offenen Stellen auf unserer [Karriereseite](https://cline.bot/join-us) an!
|
||||
|
||||
<details>
|
||||
<summary>Lokale Entwicklungsanweisungen</summary>
|
||||
|
||||
1. Klonen Sie das Repository _(Erfordert [git-lfs](https://git-lfs.com/))_:
|
||||
```bash
|
||||
git clone https://github.com/cline/cline.git
|
||||
```
|
||||
2. Öffnen Sie das Projekt in VSCode:
|
||||
```bash
|
||||
code cline
|
||||
```
|
||||
3. Installieren Sie die notwendigen Abhängigkeiten für die Erweiterung und das Webview-GUI:
|
||||
```bash
|
||||
npm run install:all
|
||||
```
|
||||
4. Starten Sie durch Drücken von `F5` (oder `Run`->`Start Debugging`), um ein neues VSCode-Fenster mit der geladenen Erweiterung zu öffnen. (Möglicherweise müssen Sie die [esbuild problem matchers extension](https://marketplace.visualstudio.com/items?itemName=connor4312.esbuild-problem-matchers) installieren, wenn Sie auf Probleme beim Erstellen des Projekts stoßen.)
|
||||
|
||||
</details>
|
||||
|
||||
## Lizenz
|
||||
|
||||
[Apache 2.0 © 2024 Cline Bot Inc.](./LICENSE)
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
# Código de Conducta para Contribuyentes
|
||||
|
||||
## Nuestro Compromiso
|
||||
|
||||
En el interés de fomentar un entorno abierto y acogedor, nosotros como
|
||||
contribuyentes y mantenedores nos comprometemos a hacer de la participación en nuestro proyecto y
|
||||
nuestra comunidad una experiencia libre de acoso para todos, independientemente de la edad, tamaño corporal,
|
||||
discapacidad, etnia, características sexuales, identidad y expresión de género,
|
||||
nivel de experiencia, educación, estatus socioeconómico, nacionalidad, apariencia personal,
|
||||
raza, religión o identidad y orientación sexual.
|
||||
|
||||
## Nuestros Estándares
|
||||
|
||||
Ejemplos de comportamientos que contribuyen a crear un entorno positivo incluyen:
|
||||
|
||||
- Uso de un lenguaje acogedor e inclusivo
|
||||
- Respeto a diferentes puntos de vista y experiencias
|
||||
- Aceptar de manera constructiva las críticas
|
||||
- Centrarse en lo que es mejor para la comunidad
|
||||
- Mostrar empatía hacia otros miembros de la comunidad
|
||||
|
||||
Ejemplos de comportamientos inaceptables por parte de los participantes incluyen:
|
||||
|
||||
- El uso de lenguaje o imágenes sexualizadas y la atención o avances sexuales no deseados
|
||||
- Trollear, comentarios insultantes/despectivos y ataques personales o políticos
|
||||
- Acoso público o privado
|
||||
- Publicar información privada de otros, como una dirección física o electrónica,
|
||||
sin permiso explícito
|
||||
- Otras conductas que podrían considerarse inapropiadas en un entorno profesional
|
||||
|
||||
## Nuestras Responsabilidades
|
||||
|
||||
Los mantenedores del proyecto son responsables de aclarar los estándares de comportamiento aceptable
|
||||
y se espera que tomen medidas correctivas apropiadas y justas en respuesta a cualquier
|
||||
caso de comportamiento inaceptable.
|
||||
|
||||
Los mantenedores del proyecto tienen el derecho y la responsabilidad de eliminar, editar o rechazar
|
||||
comentarios, commits, código, ediciones de wiki, issues y otras contribuciones que no estén alineadas con este Código de Conducta, o de prohibir temporal o permanentemente a cualquier contribuyente cuyo comportamiento sea inapropiado,
|
||||
amenazante, ofensivo o dañino.
|
||||
|
||||
## Alcance
|
||||
|
||||
Este Código de Conducta se aplica tanto dentro de los espacios del proyecto como en espacios públicos
|
||||
cuando una persona representa el proyecto o su comunidad. Ejemplos de
|
||||
representación de un proyecto o comunidad incluyen el uso de una dirección de correo electrónico oficial del proyecto,
|
||||
publicar en una cuenta oficial de redes sociales o actuar como un representante designado
|
||||
en un evento en línea o fuera de línea. La representación de un proyecto puede
|
||||
ser definida y clarificada más específicamente por los mantenedores del proyecto.
|
||||
|
||||
## Aplicación
|
||||
|
||||
Los casos de comportamiento abusivo, acosador o inaceptable de otra manera pueden
|
||||
ser reportados contactando al equipo del proyecto en hi@cline.bot. Todas las quejas
|
||||
serán revisadas e investigadas y resultarán en una respuesta que
|
||||
se considere necesaria y apropiada a las circunstancias. El equipo del proyecto está
|
||||
obligado a mantener la confidencialidad con respecto al informante de un incidente.
|
||||
Más detalles sobre políticas específicas de aplicación pueden ser publicados por separado.
|
||||
|
||||
Los mantenedores del proyecto que no sigan o hagan cumplir el Código de Conducta de buena
|
||||
fe pueden enfrentar repercusiones temporales o permanentes según lo determinen otros
|
||||
miembros de la dirección del proyecto.
|
||||
|
||||
## Atribución
|
||||
|
||||
Este Código de Conducta está adaptado del [Contributor Covenant][homepage], versión 1.4,
|
||||
disponible en https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
Respuestas a preguntas frecuentes sobre este Código de Conducta se pueden encontrar en
|
||||
https://www.contributor-covenant.org/faq
|
||||
@@ -0,0 +1,82 @@
|
||||
# Contribuir a Cline
|
||||
|
||||
Nos alegra que estés interesado en contribuir a Cline. Ya sea que corrijas un error, añadas una función o mejores nuestra documentación, ¡cada contribución hace que Cline sea más inteligente! Para mantener nuestra comunidad viva y acogedora, todos los miembros deben cumplir con nuestro [Código de Conducta](CODE_OF_CONDUCT.md).
|
||||
|
||||
## Informar de errores o problemas
|
||||
|
||||
¡Los informes de errores ayudan a mejorar Cline para todos! Antes de crear un nuevo problema, por favor revisa los [problemas existentes](https://github.com/cline/cline/issues) para evitar duplicados. Cuando estés listo para informar un error, dirígete a nuestra [página de Issues](https://github.com/cline/cline/issues/new/choose), donde encontrarás una plantilla que te ayudará a completar la información relevante.
|
||||
|
||||
<blockquote class='warning-note'>
|
||||
🔐 <b>Importante:</b> Si descubres una vulnerabilidad de seguridad, utiliza la <a href="https://github.com/cline/cline/security/advisories/new">herramienta de seguridad de GitHub para informarla de manera privada</a>.
|
||||
</blockquote>
|
||||
|
||||
## Decidir en qué trabajar
|
||||
|
||||
¿Buscas una buena primera contribución? Revisa los issues etiquetados con ["good first issue"](https://github.com/cline/cline/labels/good%20first%20issue) o ["help wanted"](https://github.com/cline/cline/labels/help%20wanted). ¡Estos están especialmente seleccionados para nuevos colaboradores y son áreas donde nos encantaría recibir ayuda!
|
||||
|
||||
También damos la bienvenida a contribuciones a nuestra [documentación](https://github.com/cline/cline/tree/main/docs). Ya sea corrigiendo errores tipográficos, mejorando guías existentes o creando nuevos contenidos educativos, queremos construir un repositorio de recursos gestionado por la comunidad que ayude a todos a sacar el máximo provecho de Cline. Puedes comenzar explorando `/docs` y buscando áreas que necesiten mejoras.
|
||||
|
||||
Si planeas trabajar en una función más grande, por favor crea primero una [solicitud de función](https://github.com/cline/cline/discussions/categories/feature-requests?discussions_q=is%3Aopen+category%3A%22Feature+Requests%22+sort%3Atop) para que podamos discutir si se alinea con la visión de Cline.
|
||||
|
||||
## Configurar el entorno de desarrollo
|
||||
|
||||
1. **Extensiones de VS Code**
|
||||
|
||||
- Al abrir el proyecto, VS Code te pedirá que instales las extensiones recomendadas
|
||||
- Estas extensiones son necesarias para el desarrollo, por favor acepta todas las solicitudes de instalación
|
||||
- Si rechazaste las solicitudes, puedes instalarlas manualmente en la sección de extensiones
|
||||
|
||||
2. **Desarrollo local**
|
||||
- Ejecuta `npm run install:all` para instalar las dependencias
|
||||
- Ejecuta `npm run test` para ejecutar las pruebas localmente
|
||||
- Antes de enviar un PR, ejecuta `npm run format:fix` para formatear tu código
|
||||
|
||||
## Escribir y enviar código
|
||||
|
||||
Cualquiera puede contribuir código a Cline, pero te pedimos que sigas estas pautas para asegurar que tus contribuciones se integren sin problemas:
|
||||
|
||||
1. **Mantén los Pull Requests enfocados**
|
||||
|
||||
- Limita los PRs a una sola función o corrección de errores
|
||||
- Divide los cambios más grandes en PRs más pequeños y coherentes
|
||||
- Divide los cambios en commits lógicos que puedan ser revisados independientemente
|
||||
|
||||
2. **Calidad del código**
|
||||
|
||||
- Ejecuta `npm run lint` para verificar el estilo del código
|
||||
- Ejecuta `npm run format` para formatear el código automáticamente
|
||||
- Todos los PRs deben pasar las verificaciones de CI, que incluyen linting y formateo
|
||||
- Corrige todas las advertencias o errores de ESLint antes de enviar
|
||||
- Sigue las mejores prácticas para TypeScript y mantén la seguridad de tipos
|
||||
|
||||
3. **Pruebas**
|
||||
|
||||
- Añade pruebas para nuevas funciones
|
||||
- Ejecuta `npm test` para asegurarte de que todas las pruebas pasen
|
||||
- Actualiza las pruebas existentes si tus cambios las afectan
|
||||
- Añade tanto pruebas unitarias como de integración donde sea apropiado
|
||||
|
||||
4. **Pautas de commits**
|
||||
|
||||
- Escribe mensajes de commit claros y descriptivos
|
||||
- Usa el formato de commit convencional (por ejemplo, "feat:", "fix:", "docs:")
|
||||
- Haz referencia a los issues relevantes en los commits con #número-del-issue
|
||||
|
||||
5. **Antes de enviar**
|
||||
|
||||
- Rebasea tu rama con el último Main
|
||||
- Asegúrate de que tu rama se construya correctamente
|
||||
- Verifica que todas las pruebas pasen
|
||||
- Revisa tus cambios para eliminar cualquier código de depuración o registros de consola
|
||||
|
||||
6. **Descripción del Pull Request**
|
||||
- Describe claramente lo que hacen tus cambios
|
||||
- Añade pasos para probar los cambios
|
||||
- Enumera cualquier cambio importante
|
||||
- Añade capturas de pantalla para cambios en la interfaz de usuario
|
||||
|
||||
## Acuerdo de contribución
|
||||
|
||||
Al enviar un Pull Request, aceptas que tus contribuciones se licencien bajo la misma licencia que el proyecto ([Apache 2.0](LICENSE)).
|
||||
|
||||
Recuerda: Contribuir a Cline no solo significa escribir código, sino ser parte de una comunidad que está dando forma al futuro del desarrollo asistido por IA. ¡Hagamos algo grandioso juntos! 🚀
|
||||
@@ -0,0 +1,161 @@
|
||||
# Cline – #1 en OpenRouter
|
||||
|
||||
<p align="center">
|
||||
<img src="https://media.githubusercontent.com/media/cline/cline/main/assets/docs/demo.gif" width="100%" />
|
||||
</p>
|
||||
|
||||
<div align="center">
|
||||
<table>
|
||||
<tbody>
|
||||
<td align="center">
|
||||
<a href="https://marketplace.visualstudio.com/items?itemName=saoudrizwan.claude-dev" target="_blank"><strong>Descargar en VS Marketplace</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://discord.gg/cline" target="_blank"><strong>Discord</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://www.reddit.com/r/cline/" target="_blank"><strong>r/cline</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/cline/cline/discussions/categories/feature-requests?discussions_q=is%3Aopen+category%3A%22Feature+Requests%22+sort%3Atop" target="_blank"><strong>Solicitudes de Funciones</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://cline.bot/join-us" target="_blank"><strong>Estamos Contratando!</strong></a>
|
||||
</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
Conozca a Cline, un asistente de IA que puede usar su **CLI** y **E**ditor.
|
||||
|
||||
Gracias a las [habilidades de codificación agencial de Claude 3.5 Sonnet](https://www-cdn.anthropic.com/fed9cc193a14b84131812372d8d5857f8f304c52/Model_Card_Claude_3_Addendum.pdf), Cline puede abordar tareas complejas de desarrollo de software paso a paso. Con herramientas que le permiten crear y editar archivos, explorar grandes proyectos, usar el navegador y ejecutar comandos de terminal (con su aprobación), puede ayudarle de una manera que va más allá de la autocompletación de código o el soporte técnico. Cline incluso puede usar el Model Context Protocol (MCP) para crear nuevas herramientas y expandir sus propias capacidades. Mientras que los scripts de IA autónomos tradicionalmente se ejecutan en entornos aislados, esta extensión ofrece una GUI con un humano en el bucle para aprobar cada cambio de archivo y comando de terminal, proporcionando una forma segura y accesible de explorar el potencial de la IA agencial.
|
||||
|
||||
1. Ingrese su tarea y agregue imágenes para convertir maquetas en aplicaciones funcionales o solucionar errores con capturas de pantalla.
|
||||
2. Cline comenzará analizando su estructura de archivos y ASTs de código fuente, realizando búsquedas Regex y leyendo archivos relevantes para orientarse en proyectos existentes. Al gestionar cuidadosamente la información agregada, Cline puede proporcionar asistencia valiosa incluso en proyectos grandes y complejos sin sobrecargar la ventana de contexto.
|
||||
3. Una vez que Cline tenga la información necesaria, puede:
|
||||
- Crear y editar archivos + monitorear errores de Linter/Compilador, para que pueda solucionar proactivamente problemas como importaciones faltantes y errores de sintaxis.
|
||||
- Ejecutar comandos directamente en su terminal y monitorear su salida, para que pueda responder a problemas del servidor de desarrollo después de editar un archivo.
|
||||
- Para tareas de desarrollo web, Cline puede iniciar el sitio web en un navegador sin cabeza, hacer clic, escribir, desplazarse y capturar capturas de pantalla + registros de consola, para que pueda solucionar errores de tiempo de ejecución y errores visuales.
|
||||
4. Cuando una tarea esté completa, Cline le presentará el resultado con un comando de terminal como `open -a "Google Chrome" index.html`, que puede ejecutar con un clic en un botón.
|
||||
|
||||
> [!TIP]
|
||||
> Use el atajo de teclado `CMD/CTRL + Shift + P` para abrir la paleta de comandos y escriba "Cline: Open In New Tab" para abrir la extensión como una pestaña en su editor. De esta manera, puede usar Cline junto a su explorador de archivos y ver más claramente cómo cambia su espacio de trabajo.
|
||||
|
||||
---
|
||||
|
||||
<img align="right" width="340" src="https://github.com/user-attachments/assets/3cf21e04-7ce9-4d22-a7b9-ba2c595e88a4">
|
||||
|
||||
### Use cualquier API y modelo
|
||||
|
||||
Cline admite proveedores de API como OpenRouter, Anthropic, OpenAI, Google Gemini, AWS Bedrock, Azure y GCP Vertex. También puede configurar cualquier API compatible con OpenAI o usar un modelo local a través de LM Studio/Ollama. Si usa OpenRouter, la extensión recupera su lista de modelos más reciente, para que pueda usar los modelos más nuevos tan pronto como estén disponibles.
|
||||
|
||||
La extensión también rastrea el uso total de tokens y costos de API para todo el ciclo de tareas y solicitudes individuales, para que esté informado sobre los gastos en cada paso.
|
||||
|
||||
<!-- Pixel transparente para crear un salto de línea después de la imagen flotante -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="left" width="370" src="https://github.com/user-attachments/assets/81be79a8-1fdb-4028-9129-5fe055e01e76">
|
||||
|
||||
### Ejecutar comandos en el terminal
|
||||
|
||||
Gracias a las nuevas [actualizaciones de integración de Shell en VSCode v1.93](https://code.visualstudio.com/updates/v1_93#_terminal-shell-integration-api), Cline puede ejecutar comandos directamente en su terminal y recibir la salida. Esto le permite realizar una variedad de tareas, desde la instalación de paquetes y la ejecución de scripts de compilación hasta la implementación de aplicaciones, la gestión de bases de datos y la ejecución de pruebas, adaptándose a su entorno de desarrollo y cadena de herramientas para hacer el trabajo correctamente.
|
||||
|
||||
Para procesos de larga duración como servidores de desarrollo, use el botón "Continuar mientras se ejecuta" para permitir que Cline continúe con la tarea mientras el comando se ejecuta en segundo plano. Mientras Cline trabaja, será notificado sobre nuevas salidas del terminal, para que pueda responder a problemas que puedan surgir, como errores de compilación al editar archivos.
|
||||
|
||||
<!-- Pixel transparente para crear un salto de línea después de la imagen flotante -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="right" width="400" src="https://github.com/user-attachments/assets/c5977833-d9b8-491e-90f9-05f9cd38c588">
|
||||
|
||||
### Crear y editar archivos
|
||||
|
||||
Cline puede crear y editar archivos directamente en su editor y presentarle una vista de diferencias de los cambios. Puede editar o deshacer los cambios de Cline directamente en el editor de vista de diferencias o proporcionar comentarios en el chat hasta que esté satisfecho con el resultado. Cline también monitorea errores de Linter/Compilador (importaciones faltantes, errores de sintaxis, etc.), para que pueda solucionar problemas que surjan en el camino.
|
||||
|
||||
Todos los cambios realizados por Cline se registran en la línea de tiempo de su archivo, proporcionando una forma sencilla de rastrear cambios y deshacerlos si es necesario.
|
||||
|
||||
<!-- Pixel transparente para crear un salto de línea después de la imagen flotante -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="left" width="370" src="https://github.com/user-attachments/assets/bc2e85ba-dfeb-4fe6-9942-7cfc4703cbe5">
|
||||
|
||||
### Usar el navegador
|
||||
|
||||
Con la nueva [habilidad de uso de computadora](https://www.anthropic.com/news/3-5-models-and-computer-use) de Claude 3.5 Sonnet, Cline puede iniciar un navegador, hacer clic en elementos, escribir texto y desplazarse, capturando capturas de pantalla y registros de consola. Esto permite la depuración interactiva, pruebas de extremo a extremo e incluso el uso general de la web. Esto le da la autonomía para solucionar errores visuales y problemas de tiempo de ejecución sin que tenga que copiar y pegar registros de errores.
|
||||
|
||||
Intente pedirle a Cline que "pruebe la aplicación" y observe cómo ejecuta un comando como `npm run dev`, inicia su servidor de desarrollo local en un navegador y realiza una serie de pruebas para confirmar que todo funciona. [Vea una demostración aquí.](https://x.com/sdrzn/status/1850880547825823989)
|
||||
|
||||
<!-- Pixel transparente para crear un salto de línea después de la imagen flotante -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="right" width="350" src="https://github.com/user-attachments/assets/ac0efa14-5c1f-4c26-a42d-9d7c56f5fadd">
|
||||
|
||||
### "agregar una herramienta que..."
|
||||
|
||||
Gracias al [Model Context Protocol](https://github.com/modelcontextprotocol), Cline puede expandir sus habilidades mediante herramientas personalizadas. Mientras que puede usar [servidores creados por la comunidad](https://github.com/modelcontextprotocol/servers), Cline puede en su lugar crear e instalar herramientas adaptadas a su flujo de trabajo específico. Simplemente pida a Cline que "agregue una herramienta" y él se encargará de todo, desde la creación de un nuevo servidor MCP hasta la instalación en la extensión. Estas herramientas personalizadas se convierten en parte del conjunto de herramientas de Cline y están listas para ser utilizadas en tareas futuras.
|
||||
|
||||
- "agregar una herramienta que recupere tickets de Jira": Recuperar ACs de tickets y poner a Cline a trabajar
|
||||
- "agregar una herramienta que gestione AWS EC2s": Verificar métricas del servidor y escalar instancias hacia arriba o hacia abajo
|
||||
- "agregar una herramienta que recupere los últimos incidentes de PagerDuty": Recuperar detalles y pedir a Cline que solucione errores
|
||||
|
||||
<!-- Pixel transparente para crear un salto de línea después de la imagen flotante -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="left" width="360" src="https://github.com/user-attachments/assets/7fdf41e6-281a-4b4b-ac19-020b838b6970">
|
||||
|
||||
### Agregar contexto
|
||||
|
||||
**`@url`:** Inserte una URL para que la extensión la recupere y convierta en Markdown, útil cuando desee proporcionar a Cline los documentos más recientes
|
||||
|
||||
**`@problems`:** Agregue errores y advertencias del espacio de trabajo (panel 'Problemas') que Cline debe solucionar
|
||||
|
||||
**`@file`:** Agregue el contenido de un archivo para que no tenga que desperdiciar solicitudes de API para aprobar la lectura del archivo (+ para buscar archivos)
|
||||
|
||||
**`@folder`:** Agregue los archivos de una carpeta a la vez para acelerar aún más su flujo de trabajo
|
||||
|
||||
<!-- Pixel transparente para crear un salto de línea después de la imagen flotante -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="right" width="350" src="https://github.com/user-attachments/assets/140c8606-d3bf-41b9-9a1f-4dbf0d4c90cb">
|
||||
|
||||
### Puntos de control: Comparar y Restaurar
|
||||
|
||||
Mientras Cline trabaja en una tarea, la extensión crea una instantánea de su espacio de trabajo en cada paso. Puede usar el botón 'Comparar' para ver una diferencia entre la instantánea y su espacio de trabajo actual, y el botón 'Restaurar' para volver a ese punto.
|
||||
|
||||
Por ejemplo, si está trabajando con un servidor web local, puede usar 'Restaurar solo espacio de trabajo' para probar rápidamente diferentes versiones de su aplicación, y luego 'Restaurar tarea y espacio de trabajo' cuando encuentre la versión desde la que desea continuar trabajando. Esto le permite explorar diferentes enfoques de manera segura sin perder progreso.
|
||||
|
||||
<!-- Pixel transparente para crear un salto de línea después de la imagen flotante -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
## Contribuir
|
||||
|
||||
Para contribuir al proyecto, comience con nuestra [guía de contribución](CONTRIBUTING.md) para aprender los conceptos básicos. También puede unirse a nuestro [Discord](https://discord.gg/cline) para chatear con otros colaboradores en el canal `#contributors`. Si está buscando un trabajo a tiempo completo, consulte nuestras vacantes en nuestra [página de carreras](https://cline.bot/join-us).
|
||||
|
||||
<details>
|
||||
<summary>Instrucciones de desarrollo local</summary>
|
||||
|
||||
1. Clone el repositorio _(Requiere [git-lfs](https://git-lfs.com/))_:
|
||||
```bash
|
||||
git clone https://github.com/cline/cline.git
|
||||
```
|
||||
2. Abra el proyecto en VSCode:
|
||||
```bash
|
||||
code cline
|
||||
```
|
||||
3. Instale las dependencias necesarias para la extensión y la GUI de Webview:
|
||||
```bash
|
||||
npm run install:all
|
||||
```
|
||||
4. Inicie presionando `F5` (o `Run`->`Start Debugging`) para abrir una nueva ventana de VSCode con la extensión cargada. (Es posible que deba instalar la [extensión de emparejadores de problemas de esbuild](https://marketplace.visualstudio.com/items?itemName=connor4312.esbuild-problem-matchers) si encuentra problemas al compilar el proyecto.)
|
||||
|
||||
</details>
|
||||
|
||||
## Licencia
|
||||
|
||||
[Apache 2.0 © 2024 Cline Bot Inc.](./LICENSE)
|
||||
@@ -0,0 +1,47 @@
|
||||
# コントリビューター規約行動規範
|
||||
|
||||
## 我々の誓い
|
||||
|
||||
オープンで歓迎される環境を育むために、我々はコントリビューターおよびメンテナーとして、年齢、体型、障害、民族、性の特徴、性別のアイデンティティおよび表現、経験のレベル、教育、社会経済的地位、国籍、個人の外見、人種、宗教、または性的アイデンティティおよび指向に関係なく、プロジェクトおよびコミュニティへの参加がハラスメントのない体験となるよう誓います。
|
||||
|
||||
## 我々の基準
|
||||
|
||||
ポジティブな環境を作り出す行動の例としては、以下のものがあります:
|
||||
|
||||
- 歓迎的で包括的な言葉を使うこと
|
||||
- 異なる視点や経験を尊重すること
|
||||
- 建設的な批判を優雅に受け入れること
|
||||
- コミュニティのために最善を尽くすことに集中すること
|
||||
- 他のコミュニティメンバーに対して共感を示すこと
|
||||
|
||||
参加者による許容できない行動の例としては、以下のものがあります:
|
||||
|
||||
- 性的な言葉や画像の使用、望まれない性的関心やアプローチ
|
||||
- 荒らし、侮辱的/軽蔑的なコメント、個人的または政治的な攻撃
|
||||
- 公的または私的なハラスメント
|
||||
- 明示的な許可なしに他人の個人情報(物理的または電子的な住所など)を公開すること
|
||||
- プロフェッショナルな環境で不適切と合理的に見なされるその他の行動
|
||||
|
||||
## 我々の責任
|
||||
|
||||
プロジェクトのメンテナーは、許容される行動の基準を明確にする責任があり、不適切な行動の事例に対して適切かつ公平な是正措置を講じることが期待されています。
|
||||
|
||||
プロジェクトのメンテナーは、この行動規範に沿わないコメント、コミット、コード、ウィキの編集、問題、およびその他の貢献を削除、編集、または拒否する権利と責任を持ち、また、不適切、脅迫的、攻撃的、または有害と見なされるその他の行動を行ったコントリビューターを一時的または永久に禁止する権利と責任を持ちます。
|
||||
|
||||
## 範囲
|
||||
|
||||
この行動規範は、プロジェクトスペース内およびプロジェクトやコミュニティを代表する個人が公の場で行動する場合に適用されます。プロジェクトやコミュニティを代表する例としては、公式のプロジェクトメールアドレスを使用すること、公式のソーシャルメディアアカウントを通じて投稿すること、またはオンラインまたはオフラインのイベントで任命された代表として行動することが含まれます。プロジェクトの代表としての行動は、プロジェクトのメンテナーによってさらに定義および明確化される場合があります。
|
||||
|
||||
## 執行
|
||||
|
||||
虐待的、嫌がらせ、またはその他の許容できない行動の事例は、プロジェクトチームに hi@cline.bot まで報告することができます。すべての苦情はレビューおよび調査され、状況に応じて必要かつ適切な対応が行われます。プロジェクトチームは、事件の報告者に関する機密性を保持する義務があります。具体的な執行ポリシーの詳細は別途掲載される場合があります。
|
||||
|
||||
行動規範を誠実に遵守または執行しないプロジェクトのメンテナーは、プロジェクトのリーダーシップの他のメンバーによって一時的または永久的な影響を受ける可能性があります。
|
||||
|
||||
## 帰属
|
||||
|
||||
この行動規範は、[Contributor Covenant][homepage] バージョン 1.4 から適応されており、https://www.contributor-covenant.org/version/1/4/code-of-conduct.html で入手できます。
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
この行動規範に関する一般的な質問への回答については、https://www.contributor-covenant.org/faq を参照してください。
|
||||
@@ -0,0 +1,82 @@
|
||||
# Clineへの貢献
|
||||
|
||||
Clineへの貢献に興味をお持ちいただきありがとうございます。
|
||||
|
||||
## バグや問題の報告
|
||||
|
||||
バグ報告は、Clineを皆さんにとってより良いものにするために役立ちます!新しい問題を作成する前に、重複を避けるために[既存の問題を検索](https://github.com/cline/cline/issues)してください。バグを報告する準備ができたら、[問題ページ](https://github.com/cline/cline/issues/new/choose)に移動し、関連情報を記入するためのテンプレートをご利用ください。
|
||||
|
||||
<blockquote class='warning-note'>
|
||||
🔐 <b>重要:</b> セキュリティ脆弱性を発見した場合は、<a href="https://github.com/cline/cline/security/advisories/new">Githubセキュリティツールを使用して非公開で報告</a>してください。
|
||||
</blockquote>
|
||||
|
||||
## 作業内容の決定
|
||||
|
||||
最初の貢献をお探しですか?["good first issue"](https://github.com/cline/cline/labels/good%20first%20issue)や["help wanted"](https://github.com/cline/cline/labels/help%20wanted)のラベルが付いた問題をチェックしてください。これらは新しい貢献者向けに特に選ばれたもので、私たちが助けを求めている分野です!
|
||||
|
||||
また、[ドキュメント](https://github.com/cline/cline/tree/main/docs)への貢献も歓迎します!誤字の修正、既存のガイドの改善、新しい教育コンテンツの作成など、コミュニティ主導のリソースリポジトリを構築するために皆さんの力をお借りしたいと考えています。`/docs`に飛び込んで、改善が必要な箇所を探してみてください。
|
||||
|
||||
大きな機能に取り組む予定がある場合は、まず[機能リクエスト](https://github.com/cline/cline/discussions/categories/feature-requests?discussions_q=is%3Aopen+category%3A%22Feature+Requests%22+sort%3Atop)を作成し、それがClineのビジョンに合致するかどうかを議論しましょう。
|
||||
|
||||
## 開発環境のセットアップ
|
||||
|
||||
1. **VS Code拡張機能**
|
||||
|
||||
- プロジェクトを開くと、VS Codeは推奨される拡張機能のインストールを促します
|
||||
- これらの拡張機能は開発に必要です - すべてのインストールプロンプトを受け入れてください
|
||||
- プロンプトを閉じた場合は、拡張機能パネルから手動でインストールできます
|
||||
|
||||
2. **ローカル開発**
|
||||
- `npm run install:all`を実行して依存関係をインストールします
|
||||
- `npm run test`を実行してローカルでテストを実行します
|
||||
- PRを提出する前に、`npm run format:fix`を実行してコードをフォーマットします
|
||||
|
||||
## コードの作成と提出
|
||||
|
||||
誰でもClineにコードを貢献できますが、貢献がスムーズに統合されるように以下のガイドラインに従ってください:
|
||||
|
||||
1. **プルリクエストを集中させる**
|
||||
|
||||
- PRは単一の機能またはバグ修正に限定してください
|
||||
- 大きな変更は小さな関連PRに分割してください
|
||||
- 論理的なコミットに分けて、独立してレビューできるようにしてください
|
||||
|
||||
2. **コード品質**
|
||||
|
||||
- `npm run lint`を実行してコードスタイルをチェックします
|
||||
- `npm run format`を実行してコードを自動的にフォーマットします
|
||||
- すべてのPRは、リンティングとフォーマットを含むCIチェックに合格する必要があります
|
||||
- 提出前にESLintの警告やエラーをすべて解決してください
|
||||
- TypeScriptのベストプラクティスに従い、型の安全性を維持してください
|
||||
|
||||
3. **テスト**
|
||||
|
||||
- 新しい機能にはテストを追加してください
|
||||
- `npm test`を実行してすべてのテストが合格することを確認してください
|
||||
- 変更が既存のテストに影響を与える場合は、それらを更新してください
|
||||
- 適切な場合には、ユニットテストと統合テストの両方を含めてください
|
||||
|
||||
4. **コミットガイドライン**
|
||||
|
||||
- 明確で説明的なコミットメッセージを書いてください
|
||||
- 従来のコミット形式(例:"feat:", "fix:", "docs:")を使用してください
|
||||
- コミットで関連する問題を#issue-numberを使用して参照してください
|
||||
|
||||
5. **提出前に**
|
||||
|
||||
- 最新のmainにブランチをリベースしてください
|
||||
- ブランチが正常にビルドされることを確認してください
|
||||
- すべてのテストが合格していることを再確認してください
|
||||
- デバッグコードやコンソールログがないか変更を確認してください
|
||||
|
||||
6. **プルリクエストの説明**
|
||||
- 変更内容を明確に説明してください
|
||||
- 変更をテストする手順を含めてください
|
||||
- 破壊的な変更がある場合はリストしてください
|
||||
- UIの変更にはスクリーンショットを追加してください
|
||||
|
||||
## 貢献契約
|
||||
|
||||
プルリクエストを提出することで、あなたの貢献がプロジェクトと同じライセンス([Apache 2.0](LICENSE))の下でライセンスされることに同意したことになります。
|
||||
|
||||
覚えておいてください:Clineへの貢献はコードを書くことだけではなく、AI支援開発の未来を形作るコミュニティの一員になることです。一緒に素晴らしいものを作りましょう!🚀
|
||||
@@ -0,0 +1,161 @@
|
||||
# Cline – OpenRouterでのナンバーワン
|
||||
|
||||
<p align="center">
|
||||
<img src="https://media.githubusercontent.com/media/cline/cline/main/assets/docs/demo.gif" width="100%" />
|
||||
</p>
|
||||
|
||||
<div align="center">
|
||||
<table>
|
||||
<tbody>
|
||||
<td align="center">
|
||||
<a href="https://marketplace.visualstudio.com/items?itemName=saoudrizwan.claude-dev" target="_blank"><strong>VS Marketplaceでダウンロード</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://discord.gg/cline" target="_blank"><strong>Discord</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://www.reddit.com/r/cline/" target="_blank"><strong>r/cline</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/cline/cline/discussions/categories/feature-requests?discussions_q=is%3Aopen+category%3A%22Feature+Requests%22+sort%3Atop" target="_blank"><strong>機能リクエスト</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://cline.bot/join-us" target="_blank"><strong>採用情報</strong></a>
|
||||
</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
Clineは、**CLI**と**エディター**を使用できるAIアシスタントです。
|
||||
|
||||
[Claude 3.5 Sonnetのエージェント的コーディング機能](https://www-cdn.anthropic.com/fed9cc193a14b84131812372d8d5857f8f304c52/Model_Card_Claude_3_Addendum.pdf)のおかげで、Clineは複雑なソフトウェア開発タスクをステップバイステップで処理できます。ファイルの作成と編集、大規模プロジェクトの探索、ブラウザの使用、ターミナルコマンドの実行(許可後)などのツールを使用して、コード補完や技術サポートを超えた支援を提供します。Clineは、Model Context Protocol (MCP)を使用して新しいツールを作成し、自身の機能を拡張することもできます。自律的なAIスクリプトは通常サンドボックス環境で実行されますが、この拡張機能はファイル変更やターミナルコマンドを承認するための人間インターフェースを提供し、エージェント的AIの可能性を安全かつアクセスしやすい方法で探求できます。
|
||||
|
||||
1. タスクを入力し、モックアップを機能するアプリに変換したり、スクリーンショットでバグを修正したりします。
|
||||
2. Clineは、ファイル構造とソースコードASTの分析、正規表現検索の実行、関連ファイルの読み取りから始め、既存プロジェクトに精通します。コンテキストに追加される情報を慎重に管理することで、大規模で複雑なプロジェクトでもコンテキストウィンドウを圧倒することなく貴重な支援を提供できます。
|
||||
3. Clineが必要な情報を取得すると、次のことができます:
|
||||
- ファイルの作成と編集 + リンター/コンパイラーエラーの監視を行い、欠落したインポートや構文エラーなどの問題を自動的に修正します。
|
||||
- ターミナルでコマンドを直接実行し、作業中に出力を監視します。これにより、ファイル編集後の開発サーバーの問題に対応できます。
|
||||
- ウェブ開発タスクでは、ヘッドレスブラウザでサイトを起動し、クリック、入力、スクロール、スクリーンショットとコンソールログのキャプチャを行い、ランタイムエラーや視覚的なバグを修正します。
|
||||
4. タスクが完了すると、Clineは`open -a "Google Chrome" index.html`のようなターミナルコマンドを提示し、ボタンをクリックして実行できます。
|
||||
|
||||
> [!TIP]
|
||||
> `CMD/CTRL + Shift + P`ショートカットを使用してコマンドパレットを開き、「Cline: Open In New Tab」と入力して、エディターのタブとして拡張機能を開きます。これにより、ファイルエクスプローラーと並行してClineを使用し、ワークスペースの変更をより明確に確認できます。
|
||||
|
||||
---
|
||||
|
||||
<img align="right" width="340" src="https://github.com/user-attachments/assets/3cf21e04-7ce9-4d22-a7b9-ba2c595e88a4">
|
||||
|
||||
### どのAPIやモデルでも使用可能
|
||||
|
||||
Clineは、OpenRouter、Anthropic、OpenAI、Google Gemini、AWS Bedrock、Azure、GCP VertexなどのAPIプロバイダーをサポートしています。また、OpenAI互換のAPIを設定したり、LM Studio/Ollamaを通じてローカルモデルを使用することもできます。OpenRouterを使用している場合、拡張機能は最新のモデルリストを取得し、最新のモデルをすぐに使用できるようにします。
|
||||
|
||||
拡張機能は、タスクループ全体と個々のリクエストのトークン総数とAPI使用コストを追跡し、各ステップで支出を把握できます。
|
||||
|
||||
<!-- 透明なピクセルで浮動画像の後に改行を作成 -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="left" width="370" src="https://github.com/user-attachments/assets/81be79a8-1fdb-4028-9129-5fe055e01e76">
|
||||
|
||||
### ターミナルでコマンドを実行
|
||||
|
||||
VSCode v1.93の新しい[シェル統合アップデート](https://code.visualstudio.com/updates/v1_93#_terminal-shell-integration-api)のおかげで、Clineはターミナルでコマンドを直接実行し、出力を受け取ることができます。これにより、パッケージのインストールやビルドスクリプトの実行からアプリケーションのデプロイ、データベースの管理、テストの実行まで、幅広いタスクを実行できます。Clineは、開発環境とツールチェーンに適応して、タスクを正確に実行します。
|
||||
|
||||
開発サーバーのような長時間実行されるプロセスの場合、「実行中に続行」ボタンを使用して、コマンドがバックグラウンドで実行されている間にClineがタスクを続行できるようにします。Clineが作業を進める中で、新しいターミナル出力が通知され、ファイル編集時のコンパイルエラーなどの問題に対応できます。
|
||||
|
||||
<!-- 透明なピクセルで浮動画像の後に改行を作成 -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="right" width="400" src="https://github.com/user-attachments/assets/c5977833-d9b8-491e-90f9-05f9cd38c588">
|
||||
|
||||
### ファイルの作成と編集
|
||||
|
||||
Clineはエディター内でファイルを作成および編集し、変更の差分ビューを提示します。差分ビューエディターでClineの変更を直接編集または元に戻すことができ、チャットでフィードバックを提供して満足するまで調整できます。Clineはリンター/コンパイラーエラー(欠落したインポート、構文エラーなど)も監視し、発生した問題を自動的に修正します。
|
||||
|
||||
Clineによるすべての変更はファイルのタイムラインに記録され、必要に応じて変更を追跡および元に戻す簡単な方法を提供します。
|
||||
|
||||
<!-- 透明なピクセルで浮動画像の後に改行を作成 -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="left" width="370" src="https://github.com/user-attachments/assets/bc2e85ba-dfeb-4fe6-9942-7cfc4703cbe5">
|
||||
|
||||
### ブラウザの使用
|
||||
|
||||
Claude 3.5 Sonnetの新しい[コンピュータ使用](https://www.anthropic.com/news/3-5-models-and-computer-use)機能により、Clineはブラウザを起動し、要素をクリック、テキストを入力、スクロールし、各ステップでスクリーンショットとコンソールログをキャプチャできます。これにより、インタラクティブなデバッグ、エンドツーエンドテスト、さらには一般的なウェブ使用が可能になります。これにより、エラーログを手動でコピー&ペーストすることなく、視覚的なバグやランタイムの問題を自律的に修正できます。
|
||||
|
||||
Clineに「アプリをテストして」と頼んでみてください。彼は`npm run dev`のようなコマンドを実行し、ローカルで実行中の開発サーバーをブラウザで起動し、一連のテストを実行してすべてが正常に動作することを確認します。[デモはこちら。](https://x.com/sdrzn/status/1850880547825823989)
|
||||
|
||||
<!-- 透明なピクセルで浮動画像の後に改行を作成 -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="right" width="350" src="https://github.com/user-attachments/assets/ac0efa14-5c1f-4c26-a42d-9d7c56f5fadd">
|
||||
|
||||
### 「ツールを追加して...」
|
||||
|
||||
[Model Context Protocol](https://github.com/modelcontextprotocol)のおかげで、Clineはカスタムツールを通じて機能を拡張できます。[コミュニティ製サーバー](https://github.com/modelcontextprotocol/servers)を使用することもできますが、Clineは代わりに特定のワークフローに合わせたツールを作成してインストールできます。「ツールを追加して」と頼むだけで、Clineは新しいMCPサーバーの作成から拡張機能へのインストールまでをすべて処理します。これらのカスタムツールはClineのツールキットの一部となり、将来のタスクで使用できるようになります。
|
||||
|
||||
- 「Jiraチケットを取得するツールを追加して」:チケットACを取得し、Clineに作業を依頼
|
||||
- 「AWS EC2を管理するツールを追加して」:サーバーメトリクスを確認し、インスタンスをスケールアップまたはダウン
|
||||
- 「最新のPagerDutyインシデントを取得するツールを追加して」:詳細を取得し、Clineにバグ修正を依頼
|
||||
|
||||
<!-- 透明なピクセルで浮動画像の後に改行を作成 -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="left" width="360" src="https://github.com/user-attachments/assets/7fdf41e6-281a-4b4b-ac19-020b838b6970">
|
||||
|
||||
### コンテキストを追加
|
||||
|
||||
**`@url`:** 最新のドキュメントをClineに提供したい場合に、URLを貼り付けて拡張機能が取得し、Markdownに変換します。
|
||||
|
||||
**`@problems`:** Clineが修正するためのワークスペースエラーと警告(「問題」パネル)を追加します。
|
||||
|
||||
**`@file`:** ファイルの内容を追加し、読み取りファイルを承認するAPIリクエストを節約します(+ファイルを検索して入力)。
|
||||
|
||||
**`@folder`:** フォルダーのファイルを一度に追加して、ワークフローをさらにスピードアップします。
|
||||
|
||||
<!-- 透明なピクセルで浮動画像の後に改行を作成 -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="right" width="350" src="https://github.com/user-attachments/assets/140c8606-d3bf-41b9-9a1f-4dbf0d4c90cb">
|
||||
|
||||
### チェックポイント:比較と復元
|
||||
|
||||
Clineがタスクを進める中で、拡張機能は各ステップでワークスペースのスナップショットを撮ります。「比較」ボタンを使用してスナップショットと現在のワークスペースの差分を確認し、「復元」ボタンを使用してそのポイントにロールバックできます。
|
||||
|
||||
たとえば、ローカルウェブサーバーで作業している場合、「ワークスペースのみを復元」を使用して異なるバージョンのアプリを迅速にテストし、「タスクとワークスペースを復元」を使用して続行したいバージョンを見つけたときに使用します。これにより、進行状況を失うことなく異なるアプローチを安全に探求できます。
|
||||
|
||||
<!-- 透明なピクセルで浮動画像の後に改行を作成 -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
## 貢献
|
||||
|
||||
プロジェクトに貢献するには、[貢献ガイド](CONTRIBUTING.md)から基本を学び始めてください。また、[Discord](https://discord.gg/cline)に参加して、`#contributors`チャンネルで他の貢献者とチャットすることもできます。フルタイムの仕事を探している場合は、[採用ページ](https://cline.bot/join-us)でオープンポジションを確認してください。
|
||||
|
||||
<details>
|
||||
<summary>ローカル開発の手順</summary>
|
||||
|
||||
1. リポジトリをクローンします _(Requires [git-lfs](https://git-lfs.com/))_:
|
||||
```bash
|
||||
git clone https://github.com/cline/cline.git
|
||||
```
|
||||
2. プロジェクトをVSCodeで開きます:
|
||||
```bash
|
||||
code cline
|
||||
```
|
||||
3. 拡張機能とwebview-guiの必要な依存関係をインストールします:
|
||||
```bash
|
||||
npm run install:all
|
||||
```
|
||||
4. `F5`を押して(または`Run`->`Start Debugging`)、拡張機能が読み込まれた新しいVSCodeウィンドウを開きます。(プロジェクトのビルドに問題がある場合は、[esbuild problem matchers extension](https://marketplace.visualstudio.com/items?itemName=connor4312.esbuild-problem-matchers)をインストールする必要があるかもしれません。)
|
||||
|
||||
</details>
|
||||
|
||||
## ライセンス
|
||||
|
||||
[Apache 2.0 © 2024 Cline Bot Inc.](./LICENSE)
|
||||
@@ -0,0 +1,47 @@
|
||||
# 贡献者公约行为准则
|
||||
|
||||
## 我们的承诺
|
||||
|
||||
为了营造一个开放和欢迎的环境,我们作为贡献者和维护者承诺让我们的项目和社区的参与体验对每个人都无骚扰,无论年龄、体型、残疾、种族、性别特征、性别认同和表达、经验水平、教育程度、社会经济地位、国籍、个人外貌、种族、宗教或性取向。
|
||||
|
||||
## 我们的标准
|
||||
|
||||
有助于创造积极环境的行为示例包括:
|
||||
|
||||
- 使用欢迎和包容的语言
|
||||
- 尊重不同的观点和经验
|
||||
- 优雅地接受建设性的批评
|
||||
- 专注于对社区最有利的事情
|
||||
- 对其他社区成员表现出同理心
|
||||
|
||||
参与者不可接受的行为示例包括:
|
||||
|
||||
- 使用性化语言或图像以及不受欢迎的性关注或挑逗
|
||||
- 故意挑衅、侮辱/贬低性评论和个人或政治攻击
|
||||
- 公开或私下骚扰
|
||||
- 未经明确许可发布他人的私人信息,如物理或电子地址
|
||||
- 其他在专业环境中合理认为不适当的行为
|
||||
|
||||
## 我们的责任
|
||||
|
||||
项目维护者有责任澄清可接受行为的标准,并期望对任何不可接受行为采取适当和公平的纠正措施。
|
||||
|
||||
项目维护者有权利和责任删除、编辑或拒绝与本行为准则不一致的评论、提交、代码、维基编辑、问题和其他贡献,或暂时或永久禁止任何贡献者进行他们认为不适当、威胁、冒犯或有害的其他行为。
|
||||
|
||||
## 适用范围
|
||||
|
||||
本行为准则适用于项目空间内和公共空间中代表项目或其社区的个人。代表项目或社区的示例包括使用官方项目电子邮件地址,通过官方社交媒体账户发布,或在在线或离线活动中作为指定代表。项目的代表性可能由项目维护者进一步定义和澄清。
|
||||
|
||||
## 执行
|
||||
|
||||
滥用、骚扰或其他不可接受行为的实例可以通过联系项目团队 hi@cline.bot 报告。所有投诉将被审查和调查,并将导致根据情况认为必要和适当的回应。项目团队有义务对事件报告者保密。具体执行政策的详细信息可能会单独发布。
|
||||
|
||||
未能善意遵守或执行行为准则的项目维护者可能会面临由项目领导的其他成员决定的临时或永久后果。
|
||||
|
||||
## 归属
|
||||
|
||||
本行为准则改编自 [贡献者公约][主页],版本 1.4,可在 https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 获取。
|
||||
|
||||
[主页]: https://www.contributor-covenant.org
|
||||
|
||||
有关此行为准则的常见问题的答案,请参见 https://www.contributor-covenant.org/faq
|
||||
@@ -0,0 +1,82 @@
|
||||
# 贡献到 Cline
|
||||
|
||||
我们很高兴您有兴趣为 Cline 做出贡献。无论您是修复错误、添加功能还是改进我们的文档,每一份贡献都让 Cline 更加智能!为了保持我们的社区充满活力和欢迎,所有成员必须遵守我们的[行为准则](CODE_OF_CONDUCT.md)。
|
||||
|
||||
## 报告错误或问题
|
||||
|
||||
错误报告有助于让 Cline 对每个人都更好!在创建新问题之前,请先[搜索现有问题](https://github.com/cline/cline/issues)以避免重复。当您准备好报告错误时,请前往我们的[问题页面](https://github.com/cline/cline/issues/new/choose),在那里您会找到一个模板来帮助您填写相关信息。
|
||||
|
||||
<blockquote class='warning-note'>
|
||||
🔐 <b>重要:</b>如果您发现安全漏洞,请使用<a href="https://github.com/cline/cline/security/advisories/new">Github 安全工具私下报告</a>。
|
||||
</blockquote>
|
||||
|
||||
## 决定要做什么
|
||||
|
||||
寻找一个好的首次贡献?查看标记为["good first issue"](https://github.com/cline/cline/labels/good%20first%20issue)或["help wanted"](https://github.com/cline/cline/labels/help%20wanted)的问题。这些是专门为新贡献者策划的领域,我们非常欢迎您的帮助!
|
||||
|
||||
我们也欢迎对我们的[文档](https://github.com/cline/cline/tree/main/docs)做出贡献!无论是修正错别字、改进现有指南,还是创建新的教育内容 - 我们希望建立一个社区驱动的资源库,帮助每个人充分利用 Cline。您可以从深入研究 `/docs` 并寻找需要改进的地方开始。
|
||||
|
||||
如果您计划开发一个更大的功能,请先创建一个[功能请求](https://github.com/cline/cline/discussions/categories/feature-requests?discussions_q=is%3Aopen+category%3A%22Feature+Requests%22+sort%3Atop),以便我们讨论它是否符合 Cline 的愿景。
|
||||
|
||||
## 开发设置
|
||||
|
||||
1. **VS Code 扩展**
|
||||
|
||||
- 打开项目时,VS Code 会提示您安装推荐的扩展
|
||||
- 这些扩展是开发所必需的 - 请接受所有安装提示
|
||||
- 如果您忽略了提示,可以从扩展面板手动安装它们
|
||||
|
||||
2. **本地开发**
|
||||
- 运行 `npm run install:all` 安装依赖项
|
||||
- 运行 `npm run test` 本地运行测试
|
||||
- 提交 PR 之前,运行 `npm run format:fix` 格式化您的代码
|
||||
|
||||
## 编写和提交代码
|
||||
|
||||
任何人都可以为 Cline 贡献代码,但我们要求您遵循以下指南,以确保您的贡献能够顺利集成:
|
||||
|
||||
1. **保持 Pull Request 集中**
|
||||
|
||||
- 将 PR 限制为单个功能或错误修复
|
||||
- 将较大的更改拆分为较小的相关 PR
|
||||
- 将更改分为逻辑提交,以便独立审查
|
||||
|
||||
2. **代码质量**
|
||||
|
||||
- 运行 `npm run lint` 检查代码风格
|
||||
- 运行 `npm run format` 自动格式化代码
|
||||
- 所有 PR 必须通过 CI 检查,包括 lint 和格式化
|
||||
- 提交前解决所有 ESLint 警告或错误
|
||||
- 遵循 TypeScript 最佳实践并保持类型安全
|
||||
|
||||
3. **测试**
|
||||
|
||||
- 为新功能添加测试
|
||||
- 运行 `npm test` 确保所有测试通过
|
||||
- 如果您的更改影响现有测试,请更新它们
|
||||
- 在适当的情况下包括单元测试和集成测试
|
||||
|
||||
4. **提交指南**
|
||||
|
||||
- 编写清晰、描述性的提交消息
|
||||
- 使用常规提交格式(例如,“feat:”,“fix:”,“docs:”)
|
||||
- 在提交中引用相关问题,使用 #issue-number
|
||||
|
||||
5. **提交前**
|
||||
|
||||
- 将您的分支重新基于最新的 main
|
||||
- 确保您的分支成功构建
|
||||
- 仔细检查所有测试是否通过
|
||||
- 检查您的更改是否有任何调试代码或控制台日志
|
||||
|
||||
6. **Pull Request 描述**
|
||||
- 清楚描述您的更改内容
|
||||
- 包括测试更改的步骤
|
||||
- 列出任何重大更改
|
||||
- 对于 UI 更改,添加截图
|
||||
|
||||
## 贡献协议
|
||||
|
||||
通过提交 pull request,您同意您的贡献将根据与项目相同的许可证([Apache 2.0](LICENSE))进行许可。
|
||||
|
||||
记住:为 Cline 做贡献不仅仅是编写代码 - 这是成为一个社区的一部分,共同塑造 AI 辅助开发的未来。让我们一起构建一些令人惊叹的东西!🚀
|
||||
@@ -0,0 +1,162 @@
|
||||
# Cline – OpenRouter 排名第一
|
||||
|
||||
<p align="center">
|
||||
<img src="https://media.githubusercontent.com/media/cline/cline/main/assets/docs/demo.gif" width="100%" />
|
||||
</p>
|
||||
|
||||
<div align="center">
|
||||
<table>
|
||||
<tbody>
|
||||
<td align="center">
|
||||
<a href="https://marketplace.visualstudio.com/items?itemName=saoudrizwan.claude-dev" target="_blank"><strong>在 VS Marketplace 下载</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://discord.gg/cline" target="_blank"><strong>Discord</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://www.reddit.com/r/cline/" target="_blank"><strong>r/cline</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/cline/cline/discussions/categories/feature-requests?discussions_q=is%3Aopen+category%3A%22Feature+Requests%22+sort%3Atop" target="_blank"><strong>功能请求</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://cline.bot/join-us" target="_blank"><strong>我们正在招聘!</strong></a>
|
||||
</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
认识 Cline,一个可以使用你的 **CLI** 和 **编辑器** 的 AI 助手。
|
||||
|
||||
感谢 [Claude 3.5 Sonnet 的代理编码能力](https://www-cdn.anthropic.com/fed9cc193a14b84131812372d8d5857f8f304c52/Model_Card_Claude_3_Addendum.pdf),Cline 可以一步步处理复杂的软件开发任务。通过允许他创建和编辑文件、探索大型项目、使用浏览器和执行终端命令(在你授予权限后),他可以提供超越代码完成或技术支持的帮助。Cline 甚至可以使用 Model Context Protocol (MCP) 创建新工具并扩展自己的能力。虽然自主 AI 脚本传统上在沙盒环境中运行,但此扩展提供了一个人机交互的 GUI 来批准每个文件更改和终端命令,提供了一种安全且可访问的方式来探索代理 AI 的潜力。
|
||||
|
||||
1. 输入你的任务并添加图像,将模型转换为功能应用程序或通过截图修复错误。
|
||||
2. Cline 首先分析你的文件结构和源代码 AST,运行正则表达式搜索,并阅读相关文件以了解现有项目。通过仔细管理添加到上下文中的信息,Cline 即使在大型复杂项目中也能提供有价值的帮助,而不会使上下文窗口过载。
|
||||
3. 一旦 Cline 获得所需信息,他可以:
|
||||
- 创建和编辑文件 + 监控 linter/编译器错误,从而主动修复诸如缺少导入和语法错误等问题。
|
||||
- 直接在你的终端中执行命令并监控其输出,从而在编辑文件后对开发服务器问题做出反应。
|
||||
- 对于 Web 开发任务,Cline 可以在无头浏览器中启动网站,点击、输入、滚动并捕获截图和控制台日志,从而修复运行时错误和视觉错误。
|
||||
4. 当任务完成时,Cline 将通过终端命令如 `open -a "Google Chrome" index.html` 向你展示结果,你可以通过点击按钮运行该命令。
|
||||
|
||||
> [!提示]
|
||||
> 使用 `CMD/CTRL + Shift + P` 快捷键打开命令面板并输入 "Cline: Open In New Tab" 将扩展作为标签在编辑器中打开。这让你可以与文件资源管理器并排使用 Cline,更清楚地看到他如何改变你的工作空间。
|
||||
|
||||
---
|
||||
|
||||
<img align="right" width="340" src="https://github.com/user-attachments/assets/3cf21e04-7ce9-4d22-a7b9-ba2c595e88a4">
|
||||
|
||||
### 使用任何 API 和模型
|
||||
|
||||
Cline 支持 OpenRouter、Anthropic、OpenAI、Google Gemini、AWS Bedrock、Azure 和 GCP Vertex 等 API 提供商。你还可以配置任何兼容 OpenAI 的 API,或通过 LM Studio/Ollama 使用本地模型。如果你使用 OpenRouter,扩展会获取他们的最新模型列表,让你在新模型可用时立即使用。
|
||||
|
||||
扩展还会跟踪整个任务循环和单个请求的总令牌和 API 使用成本,让你在每一步都了解支出情况。
|
||||
|
||||
<!-- 透明像素以在浮动图像后创建换行 -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="left" width="370" src="https://github.com/user-attachments/assets/81be79a8-1fdb-4028-9129-5fe055e01e76">
|
||||
|
||||
### 在终端中运行命令
|
||||
|
||||
感谢 VSCode v1.93 中的新 [终端 shell 集成更新](https://code.visualstudio.com/updates/v1_93#_terminal-shell-integration-api),Cline 可以直接在你的终端中执行命令并接收输出。这使他能够执行广泛的任务,从安装包和运行构建脚本到部署应用程序、管理数据库和执行测试,同时适应你的开发环境和工具链以正确完成工作。
|
||||
|
||||
对于长时间运行的进程如开发服务器,使用“在运行时继续”按钮让 Cline 在命令后台运行时继续任务。当 Cline 工作时,他会在过程中收到任何新的终端输出通知,让他对可能出现的问题做出反应,例如编辑文件时的编译时错误。
|
||||
|
||||
<!-- 透明像素以在浮动图像后创建换行 -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="right" width="400" src="https://github.com/user-attachments/assets/c5977833-d9b8-491e-90f9-05f9cd38c588">
|
||||
|
||||
### 创建和编辑文件
|
||||
|
||||
Cline 可以直接在你的编辑器中创建和编辑文件,向你展示更改的差异视图。你可以直接在差异视图编辑器中编辑或恢复 Cline 的更改,或在聊天中提供反馈,直到你对结果满意。Cline 还会监控 linter/编译器错误(缺少导入、语法错误等),以便他在过程中自行修复出现的问题。
|
||||
|
||||
Cline 所做的所有更改都会记录在你的文件时间轴中,提供了一种简单的方法来跟踪和恢复修改(如果需要)。
|
||||
|
||||
<!-- 透明像素以在浮动图像后创建换行 -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="left" width="370" src="https://github.com/user-attachments/assets/bc2e85ba-dfeb-4fe6-9942-7cfc4703cbe5">
|
||||
|
||||
### 使用浏览器
|
||||
|
||||
借助 Claude 3.5 Sonnet 的新 [计算机使用](https://www.anthropic.com/news/3-5-models-and-computer-use) 功能,Cline 可以启动浏览器,点击元素,输入文本和滚动,在每一步捕获截图和控制台日志。这允许进行交互式调试、端到端测试,甚至是一般的网页使用!这使他能够自主修复视觉错误和运行时问题,而无需你亲自操作和复制粘贴错误日志。
|
||||
|
||||
试试让 Cline “测试应用程序”,看看他如何运行 `npm run dev` 命令,在浏览器中启动你本地运行的开发服务器,并执行一系列测试以确认一切正常。[在这里查看演示。](https://x.com/sdrzn/status/1850880547825823989)
|
||||
|
||||
<!-- 透明像素以在浮动图像后创建换行 -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="right" width="350" src="https://github.com/user-attachments/assets/ac0efa14-5c1f-4c26-a42d-9d7c56f5fadd">
|
||||
|
||||
### “添加一个工具……”
|
||||
|
||||
感谢 [Model Context Protocol](https://github.com/modelcontextprotocol),Cline 可以通过自定义工具扩展他的能力。虽然你可以使用 [社区制作的服务器](https://github.com/modelcontextprotocol/servers),但 Cline 可以创建和安装适合你特定工作流程的工具。只需让 Cline “添加一个工具”,他将处理所有事情,从创建新的 MCP 服务器到将其安装到扩展中。这些自定义工具将成为 Cline 工具包的一部分,准备在未来的任务中使用。
|
||||
|
||||
- “添加一个获取 Jira 工单的工具”:检索工单 AC 并让 Cline 开始工作
|
||||
- “添加一个管理 AWS EC2 的工具”:检查服务器指标并上下扩展实例
|
||||
- “添加一个获取最新 PagerDuty 事件的工具”:获取详细信息并让 Cline 修复错误
|
||||
|
||||
<!-- 透明像素以在浮动图像后创建换行 -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="left" width="360" src="https://github.com/user-attachments/assets/7fdf41e6-281a-4b4b-ac19-020b838b6970">
|
||||
|
||||
### 添加上下文
|
||||
|
||||
**`@url`:** 粘贴一个 URL 以供扩展获取并转换为 markdown,当你想给 Cline 提供最新文档时非常有用
|
||||
|
||||
**`@problems`:** 添加工作区错误和警告(“问题”面板)以供 Cline 修复
|
||||
|
||||
**`@file`:** 添加文件内容,这样你就不必浪费 API 请求批准读取文件(+ 输入以搜索文件)
|
||||
|
||||
**`@folder`:** 一次添加文件夹的文件,以进一步加快你的工作流程
|
||||
|
||||
<!-- 透明像素以在浮动图像后创建换行 -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="right" width="350" src="https://github.com/user-attachments/assets/140c8606-d3bf-41b9-9a1f-4dbf0d4c90cb">
|
||||
|
||||
### 检查点:比较和恢复
|
||||
|
||||
当 Cline 完成任务时,扩展会在每一步拍摄你的工作区快照。你可以使用“比较”按钮查看快照和当前工作区之间的差异,并使用“恢复”按钮回滚到该点。
|
||||
|
||||
例如,当使用本地 Web 服务器时,你可以使用“仅恢复工作区”快速测试应用程序的不同版本,然后在找到要继续构建的版本时使用“恢复任务和工作区”。这让你可以安全地探索不同的方法而不会丢失进度。
|
||||
|
||||
<!-- 透明像素以在浮动图像后创建换行 -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
## 贡献
|
||||
|
||||
要为项目做出贡献,请从我们的 [贡献指南](CONTRIBUTING.md) 开始,了解基础知识。你还可以加入我们的 [Discord](https://discord.gg/cline) 在 `#contributors` 频道与其他贡献者聊天。如果你正在寻找全职工作,请查看我们在 [招聘页面](https://cline.bot/join-us) 上的开放职位!
|
||||
|
||||
<details>
|
||||
<summary>本地开发说明</summary>
|
||||
|
||||
1. 克隆仓库 _(需要 [git-lfs](https://git-lfs.com/))_:
|
||||
```bash
|
||||
git clone https://github.com/cline/cline.git
|
||||
```
|
||||
2. 在 VSCode 中打开项目:
|
||||
```bash
|
||||
code cline
|
||||
```
|
||||
3. 安装扩展和 webview-gui 的必要依赖:
|
||||
```bash
|
||||
npm run install:all
|
||||
```
|
||||
4. 按 `F5`(或 `运行`->`开始调试`)启动以打开一个加载了扩展的新 VSCode 窗口。(如果你在构建项目时遇到问题,可能需要安装 [esbuild problem matchers 扩展](https://marketplace.visualstudio.com/items?itemName=connor4312.esbuild-problem-matchers))
|
||||
|
||||
</details>
|
||||
|
||||
## 许可证
|
||||
|
||||
[Apache 2.0 © 2024 Cline Bot Inc.](./LICENSE)
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# 貢獻者公約行為準則
|
||||
|
||||
## 我們的承諾
|
||||
|
||||
為了促進一個開放和歡迎的環境,我們作為貢獻者和維護者承諾,使我們的項目和社區的參與對每個人來說都是一個無騷擾的體驗,不論年齡、體型、殘疾、種族、性別特徵、性別認同和表達、經驗水平、教育程度、社會經濟地位、國籍、個人外貌、種族、宗教或性取向。
|
||||
|
||||
## 我們的標準
|
||||
|
||||
有助於創造積極環境的行為示例包括:
|
||||
|
||||
- 使用歡迎和包容的語言
|
||||
- 尊重不同的觀點和經驗
|
||||
- 優雅地接受建設性的批評
|
||||
- 專注於對社區最有利的事情
|
||||
- 對其他社區成員表示同情
|
||||
|
||||
參與者不可接受的行為示例包括:
|
||||
|
||||
- 使用性化語言或圖像以及不受歡迎的性注意或挑逗
|
||||
- 騷擾、侮辱/貶低性評論和個人或政治攻擊
|
||||
- 公開或私下騷擾
|
||||
- 未經明確許可發布他人的私人信息,例如物理或電子地址
|
||||
- 其他在專業環境中合理認為不適當的行為
|
||||
|
||||
## 我們的責任
|
||||
|
||||
項目維護者有責任澄清可接受行為的標準,並預期對任何不可接受行為的實例採取適當和公平的糾正行動。
|
||||
|
||||
項目維護者有權利和責任刪除、編輯或拒絕與本行為準則不符的評論、提交、代碼、維基編輯、問題和其他貢獻,或暫時或永久禁止任何他們認為不適當、威脅、冒犯或有害的貢獻者。
|
||||
|
||||
## 範圍
|
||||
|
||||
此行為準則適用於項目空間內以及當個人代表項目或其社區時的公共空間。代表項目或社區的示例包括使用官方項目電子郵件地址、通過官方社交媒體帳戶發布或作為在線或離線活動的指定代表。項目的代表可能由項目維護者進一步定義和澄清。
|
||||
|
||||
## 執行
|
||||
|
||||
濫用、騷擾或其他不可接受行為的實例可以通過聯繫項目團隊 hi@cline.bot 來報告。所有投訴將被審查和調查,並將根據情況作出必要和適當的回應。項目團隊有義務對事件的報告者保密。具體執行政策的詳細信息可能會單獨發布。
|
||||
|
||||
未能善意遵循或執行行為準則的項目維護者可能會面臨由項目領導層其他成員決定的暫時或永久後果。
|
||||
|
||||
## 歸屬
|
||||
|
||||
此行為準則改編自 [Contributor Covenant][homepage],版本 1.4,可在 https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 獲得。
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
有關此行為準則的常見問題的答案,請參見 https://www.contributor-covenant.org/faq
|
||||
@@ -0,0 +1,82 @@
|
||||
# 貢獻於 Cline
|
||||
|
||||
我們很高興您有興趣為 Cline 做出貢獻。無論您是修復錯誤、添加功能還是改進我們的文檔,每一個貢獻都讓 Cline 更加智能!為了保持我們的社區充滿活力和歡迎,所有成員必須遵守我們的[行為準則](CODE_OF_CONDUCT.md)。
|
||||
|
||||
## 報告錯誤或問題
|
||||
|
||||
錯誤報告有助於讓 Cline 對每個人都更好!在創建新問題之前,請[搜索現有問題](https://github.com/cline/cline/issues)以避免重複。當您準備報告錯誤時,請前往我們的[問題頁面](https://github.com/cline/cline/issues/new/choose),您會找到一個模板來幫助您填寫相關信息。
|
||||
|
||||
<blockquote class='warning-note'>
|
||||
🔐 <b>重要:</b> 如果您發現安全漏洞,請使用<a href="https://github.com/cline/cline/security/advisories/new">Github 安全工具私下報告</a>。
|
||||
</blockquote>
|
||||
|
||||
## 決定要做什麼
|
||||
|
||||
尋找一個好的首次貢獻?查看標有["good first issue"](https://github.com/cline/cline/labels/good%20first%20issue)或["help wanted"](https://github.com/cline/cline/labels/help%20wanted)的問題。這些是專門為新貢獻者和我們希望得到幫助的領域策劃的!
|
||||
|
||||
我們也歡迎對我們[文檔](https://github.com/cline/cline/tree/main/docs)的貢獻!無論是修正錯別字、改進現有指南還是創建新的教育內容 - 我們希望建立一個由社區驅動的資源庫,幫助每個人充分利用 Cline。您可以從深入研究 `/docs` 並尋找需要改進的領域開始。
|
||||
|
||||
如果您計劃開發一個更大的功能,請先創建一個[功能請求](https://github.com/cline/cline/discussions/categories/feature-requests?discussions_q=is%3Aopen+category%3A%22Feature+Requests%22+sort%3Atop),以便我們討論它是否符合 Cline 的願景。
|
||||
|
||||
## 開發設置
|
||||
|
||||
1. **VS Code 擴展**
|
||||
|
||||
- 打開項目時,VS Code 會提示您安裝推薦的擴展
|
||||
- 這些擴展是開發所需的 - 請接受所有安裝提示
|
||||
- 如果您忽略了提示,可以從擴展面板手動安裝它們
|
||||
|
||||
2. **本地開發**
|
||||
- 運行 `npm run install:all` 安裝依賴項
|
||||
- 運行 `npm run test` 本地運行測試
|
||||
- 提交 PR 之前,運行 `npm run format:fix` 格式化您的代碼
|
||||
|
||||
## 編寫和提交代碼
|
||||
|
||||
任何人都可以為 Cline 貢獻代碼,但我們要求您遵循以下指南,以確保您的貢獻能夠順利集成:
|
||||
|
||||
1. **保持 Pull Requests 集中**
|
||||
|
||||
- 將 PR 限制在單個功能或錯誤修復
|
||||
- 將較大的更改拆分為較小的相關 PR
|
||||
- 將更改分為邏輯提交,可以獨立審查
|
||||
|
||||
2. **代碼質量**
|
||||
|
||||
- 運行 `npm run lint` 檢查代碼風格
|
||||
- 運行 `npm run format` 自動格式化代碼
|
||||
- 所有 PR 必須通過包括 lint 和格式化在內的 CI 檢查
|
||||
- 提交前解決所有 ESLint 警告或錯誤
|
||||
- 遵循 TypeScript 最佳實踐並保持類型安全
|
||||
|
||||
3. **測試**
|
||||
|
||||
- 為新功能添加測試
|
||||
- 運行 `npm test` 確保所有測試通過
|
||||
- 如果您的更改影響現有測試,請更新它們
|
||||
- 在適當的地方包括單元測試和集成測試
|
||||
|
||||
4. **提交指南**
|
||||
|
||||
- 撰寫清晰、描述性的提交消息
|
||||
- 使用常規提交格式(例如 "feat:"、"fix:"、"docs:")
|
||||
- 在提交中引用相關問題,使用 #issue-number
|
||||
|
||||
5. **提交前**
|
||||
|
||||
- 將您的分支重新基於最新的 main
|
||||
- 確保您的分支成功構建
|
||||
- 仔細檢查所有測試是否通過
|
||||
- 檢查您的更改是否有任何調試代碼或控制台日誌
|
||||
|
||||
6. **Pull Request 描述**
|
||||
- 清楚地描述您的更改內容
|
||||
- 包括測試更改的步驟
|
||||
- 列出任何重大更改
|
||||
- 為 UI 更改添加截圖
|
||||
|
||||
## 貢獻協議
|
||||
|
||||
通過提交 pull request,您同意您的貢獻將根據與項目相同的許可證([Apache 2.0](LICENSE))進行許可。
|
||||
|
||||
記住:貢獻於 Cline 不僅僅是編寫代碼 - 這是關於成為一個塑造 AI 輔助開發未來的社區的一部分。讓我們一起創造一些驚人的東西!🚀
|
||||
@@ -0,0 +1,161 @@
|
||||
# Cline – OpenRouter 上的 \#1
|
||||
|
||||
<p align="center">
|
||||
<img src="https://media.githubusercontent.com/media/cline/cline/main/assets/docs/demo.gif" width="100%" />
|
||||
</p>
|
||||
|
||||
<div align="center">
|
||||
<table>
|
||||
<tbody>
|
||||
<td align="center">
|
||||
<a href="https://marketplace.visualstudio.com/items?itemName=saoudrizwan.claude-dev" target="_blank"><strong>在 VS Marketplace 下載</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://discord.gg/cline" target="_blank"><strong>Discord</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://www.reddit.com/r/cline/" target="_blank"><strong>r/cline</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/cline/cline/discussions/categories/feature-requests?discussions_q=is%3Aopen+category%3A%22Feature+Requests%22+sort%3Atop" target="_blank"><strong>功能請求</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://cline.bot/join-us" target="_blank"><strong>我們正在招聘!</strong></a>
|
||||
</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
認識 Cline,一個可以使用你的 **CLI** 和 **編輯器** 的 AI 助手。
|
||||
|
||||
感謝 [Claude 3.5 Sonnet 的代理編碼能力](https://www-cdn.anthropic.com/fed9cc193a14b84131812372d8d5857f8f304c52/Model_Card_Claude_3_Addendum.pdf),Cline 可以一步步處理複雜的軟件開發任務。通過允許他創建和編輯文件、探索大型項目、使用瀏覽器和執行終端命令(在你授予權限後),他可以提供超越代碼完成或技術支持的幫助。Cline 甚至可以使用 Model Context Protocol (MCP) 創建新工具並擴展自己的能力。雖然自主 AI 腳本傳統上在沙盒環境中運行,但此擴展提供了一個人機交互的 GUI 來批准每個文件更改和終端命令,提供了一種安全且可訪問的方式來探索代理 AI 的潛力。
|
||||
|
||||
1. 輸入你的任務並添加圖像,將模型轉換為功能應用程序或通過截圖修復錯誤。
|
||||
2. Cline 首先分析你的文件結構和源代碼 AST,運行正則表達式搜索,並閱讀相關文件以了解現有項目。通過仔細管理添加到上下文中的信息,Cline 即使在大型複雜項目中也能提供有價值的幫助,而不會使上下文窗口過載。
|
||||
3. 一旦 Cline 獲得所需信息,他可以:
|
||||
- 創建和編輯文件 + 監控 linter/編譯器錯誤,從而主動修復諸如缺少導入和語法錯誤等問題。
|
||||
- 直接在你的終端中執行命令並監控其輸出,從而在編輯文件後對開發服務器問題做出反應。
|
||||
- 對於 Web 開發任務,Cline 可以在無頭瀏覽器中啟動網站,點擊、輸入、滾動並捕獲截圖和控制台日誌,從而修復運行時錯誤和視覺錯誤。
|
||||
4. 當任務完成時,Cline 將通過終端命令如 `open -a "Google Chrome" index.html` 向你展示結果,你可以通過點擊按鈕運行該命令。
|
||||
|
||||
> [!提示]
|
||||
> 使用 `CMD/CTRL + Shift + P` 快捷鍵打開命令面板並輸入 "Cline: Open In New Tab" 將擴展作為標籤在編輯器中打開。這讓你可以與文件資源管理器並排使用 Cline,更清楚地看到他如何改變你的工作空間。
|
||||
|
||||
---
|
||||
|
||||
<img align="right" width="340" src="https://github.com/user-attachments/assets/3cf21e04-7ce9-4d22-a7b9-ba2c595e88a4">
|
||||
|
||||
### 使用任何 API 和模型
|
||||
|
||||
Cline 支持 OpenRouter、Anthropic、OpenAI、Google Gemini、AWS Bedrock、Azure 和 GCP Vertex 等 API 提供商。你還可以配置任何兼容 OpenAI 的 API,或通過 LM Studio/Ollama 使用本地模型。如果你使用 OpenRouter,擴展會獲取他們的最新模型列表,讓你在新模型可用時立即使用。
|
||||
|
||||
擴展還會跟蹤整個任務循環和單個請求的總令牌和 API 使用成本,讓你在每一步都了解支出情況。
|
||||
|
||||
<!-- 透明像素以在浮動圖像後創建換行 -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="left" width="370" src="https://github.com/user-attachments/assets/81be79a8-1fdb-4028-9129-5fe055e01e76">
|
||||
|
||||
### 在終端中運行命令
|
||||
|
||||
感謝 VSCode v1.93 中的新 [終端 shell 集成更新](https://code.visualstudio.com/updates/v1_93#_terminal-shell-integration-api),Cline 可以直接在你的終端中執行命令並接收輸出。這使他能夠執行廣泛的任務,從安裝包和運行構建腳本到部署應用程序、管理數據庫和執行測試,同時適應你的開發環境和工具鏈以正確完成工作。
|
||||
|
||||
對於長時間運行的進程如開發服務器,使用“在運行時繼續”按鈕讓 Cline 在命令後台運行時繼續任務。當 Cline 工作時,他會在過程中收到任何新的終端輸出通知,讓他對可能出現的問題做出反應,例如編輯文件時的編譯時錯誤。
|
||||
|
||||
<!-- 透明像素以在浮動圖像後創建換行 -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="right" width="400" src="https://github.com/user-attachments/assets/c5977833-d9b8-491e-90f9-05f9cd38c588">
|
||||
|
||||
### 創建和編輯文件
|
||||
|
||||
Cline 可以直接在你的編輯器中創建和編輯文件,向你展示更改的差異視圖。你可以直接在差異視圖編輯器中編輯或恢復 Cline 的更改,或在聊天中提供反饋,直到你對結果滿意。Cline 還會監控 linter/編譯器錯誤(缺少導入、語法錯誤等),以便他在過程中自行修復出現的問題。
|
||||
|
||||
Cline 所做的所有更改都會記錄在你的文件時間軸中,提供了一種簡單的方法來跟蹤和恢復修改(如果需要)。
|
||||
|
||||
<!-- 透明像素以在浮動圖像後創建換行 -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="left" width="370" src="https://github.com/user-attachments/assets/bc2e85ba-dfeb-4fe6-9942-7cfc4703cbe5">
|
||||
|
||||
### 使用瀏覽器
|
||||
|
||||
借助 Claude 3.5 Sonnet 的新 [計算機使用](https://www.anthropic.com/news/3-5-models-and-computer-use) 功能,Cline 可以啟動瀏覽器,點擊元素,輸入文本和滾動,在每一步捕獲截圖和控制台日誌。這允許進行交互式調試、端到端測試,甚至是一般的網頁使用!這使他能夠自主修復視覺錯誤和運行時問題,而無需你親自操作和複製粘貼錯誤日誌。
|
||||
|
||||
試試讓 Cline “測試應用程序”,看看他如何運行 `npm run dev` 命令,在瀏覽器中啟動你本地運行的開發服務器,並執行一系列測試以確認一切正常。[在這裡查看演示。](https://x.com/sdrzn/status/1850880547825823989)
|
||||
|
||||
<!-- 透明像素以在浮動圖像後創建換行 -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="right" width="350" src="https://github.com/user-attachments/assets/ac0efa14-5c1f-4c26-a42d-9d7c56f5fadd">
|
||||
|
||||
### “添加一個工具……”
|
||||
|
||||
感謝 [Model Context Protocol](https://github.com/modelcontextprotocol),Cline 可以通過自定義工具擴展他的能力。雖然你可以使用 [社區製作的服務器](https://github.com/modelcontextprotocol/servers),但 Cline 可以創建和安裝適合你特定工作流程的工具。只需讓 Cline “添加一個工具”,他將處理所有事情,從創建新的 MCP 服務器到將其安裝到擴展中。這些自定義工具將成為 Cline 工具包的一部分,準備在未來的任務中使用。
|
||||
|
||||
- “添加一個獲取 Jira 工單的工具”:檢索工單 AC 並讓 Cline 開始工作
|
||||
- “添加一個管理 AWS EC2 的工具”:檢查服務器指標並上下擴展實例
|
||||
- “添加一個獲取最新 PagerDuty 事件的工具”:獲取詳細信息並讓 Cline 修復錯誤
|
||||
|
||||
<!-- 透明像素以在浮動圖像後創建換行 -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="left" width="360" src="https://github.com/user-attachments/assets/7fdf41e6-281a-4b4b-ac19-020b838b6970">
|
||||
|
||||
### 添加上下文
|
||||
|
||||
**`@url`:** 粘貼一個 URL 以供擴展獲取並轉換為 markdown,當你想給 Cline 提供最新文檔時非常有用
|
||||
|
||||
**`@problems`:** 添加工作區錯誤和警告(“問題”面板)以供 Cline 修復
|
||||
|
||||
**`@file`:** 添加文件內容,這樣你就不必浪費 API 請求批准讀取文件(+ 輸入以搜索文件)
|
||||
|
||||
**`@folder`:** 一次添加文件夾的文件,以進一步加快你的工作流程
|
||||
|
||||
<!-- 透明像素以在浮動圖像後創建換行 -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
<img align="right" width="350" src="https://github.com/user-attachments/assets/140c8606-d3bf-41b9-9a1f-4dbf0d4c90cb">
|
||||
|
||||
### 檢查點:比較和恢復
|
||||
|
||||
當 Cline 完成任務時,擴展會在每一步拍攝你的工作區快照。你可以使用“比較”按鈕查看快照和當前工作區之間的差異,並使用“恢復”按鈕回滾到該點。
|
||||
|
||||
例如,當使用本地 Web 服務器時,你可以使用“僅恢復工作區”快速測試應用程序的不同版本,然後在找到要繼續構建的版本時使用“恢復任務和工作區”。這讓你可以安全地探索不同的方法而不會丟失進度。
|
||||
|
||||
<!-- 透明像素以在浮動圖像後創建換行 -->
|
||||
|
||||
<img width="2000" height="0" src="https://github.com/user-attachments/assets/ee14e6f7-20b8-4391-9091-8e8e25561929"><br>
|
||||
|
||||
## 貢獻
|
||||
|
||||
要為項目做出貢獻,請從我們的 [貢獻指南](CONTRIBUTING.md) 開始,了解基礎知識。你還可以加入我們的 [Discord](https://discord.gg/cline) 在 `#contributors` 頻道與其他貢獻者聊天。如果你正在尋找全職工作,請查看我們在 [招聘頁面](https://cline.bot/join-us) 上的開放職位!
|
||||
|
||||
<details>
|
||||
<summary>本地開發說明</summary>
|
||||
|
||||
1. 克隆倉庫 _(需要 [git-lfs](https://git-lfs.com/))_:
|
||||
```bash
|
||||
git clone https://github.com/cline/cline.git
|
||||
```
|
||||
2. 在 VSCode 中打開項目:
|
||||
```bash
|
||||
code cline
|
||||
```
|
||||
3. 安裝擴展和 webview-gui 的必要依賴:
|
||||
```bash
|
||||
npm run install:all
|
||||
```
|
||||
4. 按 `F5`(或 `運行`->`開始調試`)啟動以打開一個加載了擴展的新 VSCode 窗口。(如果你在構建項目時遇到問題,可能需要安裝 [esbuild problem matchers 擴展](https://marketplace.visualstudio.com/items?itemName=connor4312.esbuild-problem-matchers))
|
||||
|
||||
</details>
|
||||
|
||||
## 許可證
|
||||
|
||||
[Apache 2.0 © 2024 Cline Bot Inc.](./LICENSE)
|
||||
Generated
+903
-34
File diff suppressed because it is too large
Load Diff
+15
-11
@@ -2,7 +2,7 @@
|
||||
"name": "claude-dev",
|
||||
"displayName": "Cline",
|
||||
"description": "Autonomous coding agent right in your IDE, capable of creating/editing files, running commands, using the browser, and more with your permission every step of the way.",
|
||||
"version": "3.2.5",
|
||||
"version": "3.2.12",
|
||||
"icon": "assets/icons/icon.png",
|
||||
"galleryBanner": {
|
||||
"color": "#617A91",
|
||||
@@ -145,22 +145,22 @@
|
||||
"cline.mcp.mode": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"enabled",
|
||||
"mcp-tools-only",
|
||||
"disabled"
|
||||
"full",
|
||||
"server-use-only",
|
||||
"off"
|
||||
],
|
||||
"enumDescriptions": [
|
||||
"Full MCP functionality including server use and build instructions",
|
||||
"Enable MCP server use but exclude build instructions from AI prompts to save tokens",
|
||||
"Enable all MCP functionality (server use and build instructions)",
|
||||
"Enable MCP server use only (excludes instructions about building MCP servers)",
|
||||
"Disable all MCP functionality"
|
||||
],
|
||||
"default": "enabled",
|
||||
"description": "Control MCP server functionality and its inclusion in AI prompts. When disabled, Cline will not be aware of MCP capabilities, saving model context window tokens."
|
||||
"default": "full",
|
||||
"description": "Controls MCP inclusion in prompts, reduces token usage if you only need access to certain functionality."
|
||||
},
|
||||
"cline.enableCheckpoints": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "Enable checkpoint creation during task execution"
|
||||
"description": "Enables extension to save checkpoints of workspace throughout the task."
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -185,9 +185,12 @@
|
||||
"build:webview": "cd webview-ui && npm run build",
|
||||
"test:webview": "cd webview-ui && npm run test",
|
||||
"publish:marketplace": "vsce publish && ovsx publish",
|
||||
"prepare": "husky"
|
||||
"publish:marketplace:prerelease": "vsce publish --pre-release && ovsx publish --pre-release",
|
||||
"prepare": "husky",
|
||||
"changeset": "changeset"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@changesets/cli": "^2.27.12",
|
||||
"@types/chai": "^5.0.1",
|
||||
"@types/diff": "^5.2.1",
|
||||
"@types/mocha": "^10.0.7",
|
||||
@@ -231,10 +234,11 @@
|
||||
"firebase": "^11.2.0",
|
||||
"get-folder-size": "^5.0.0",
|
||||
"globby": "^14.0.2",
|
||||
"ignore": "^7.0.3",
|
||||
"isbinaryfile": "^5.0.2",
|
||||
"mammoth": "^1.8.0",
|
||||
"monaco-vscode-textmate-theme-converter": "^0.1.7",
|
||||
"openai": "^4.61.0",
|
||||
"openai": "^4.82.0",
|
||||
"os-name": "^6.0.0",
|
||||
"p-wait-for": "^5.0.2",
|
||||
"pdf-parse": "^1.1.1",
|
||||
|
||||
@@ -4,6 +4,7 @@ import { ApiHandler } from "../"
|
||||
import { ApiHandlerOptions, DeepSeekModelId, ModelInfo, deepSeekDefaultModelId, deepSeekModels } from "../../shared/api"
|
||||
import { convertToOpenAiMessages } from "../transform/openai-format"
|
||||
import { ApiStream } from "../transform/stream"
|
||||
import { convertToR1Format } from "../transform/r1-format"
|
||||
|
||||
export class DeepSeekHandler implements ApiHandler {
|
||||
private options: ApiHandlerOptions
|
||||
@@ -19,10 +20,22 @@ export class DeepSeekHandler implements ApiHandler {
|
||||
|
||||
async *createMessage(systemPrompt: string, messages: Anthropic.Messages.MessageParam[]): ApiStream {
|
||||
const model = this.getModel()
|
||||
|
||||
const isDeepseekReasoner = model.id.includes("deepseek-reasoner")
|
||||
|
||||
let openAiMessages: OpenAI.Chat.ChatCompletionMessageParam[] = [
|
||||
{ role: "system", content: systemPrompt },
|
||||
...convertToOpenAiMessages(messages),
|
||||
]
|
||||
|
||||
if (isDeepseekReasoner) {
|
||||
openAiMessages = convertToR1Format([{ role: "user", content: systemPrompt }, ...messages])
|
||||
}
|
||||
|
||||
const stream = await this.client.chat.completions.create({
|
||||
model: model.id,
|
||||
max_completion_tokens: model.info.maxTokens,
|
||||
messages: [{ role: "system", content: systemPrompt }, ...convertToOpenAiMessages(messages)],
|
||||
messages: openAiMessages,
|
||||
stream: true,
|
||||
stream_options: { include_usage: true },
|
||||
// Only set temperature for non-reasoner models
|
||||
@@ -38,6 +51,13 @@ export class DeepSeekHandler implements ApiHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (delta && "reasoning_content" in delta && delta.reasoning_content) {
|
||||
yield {
|
||||
type: "reasoning",
|
||||
reasoning: (delta.reasoning_content as string | undefined) || "",
|
||||
}
|
||||
}
|
||||
|
||||
if (chunk.usage) {
|
||||
yield {
|
||||
type: "usage",
|
||||
|
||||
@@ -43,6 +43,31 @@ export class OpenAiNativeHandler implements ApiHandler {
|
||||
}
|
||||
break
|
||||
}
|
||||
case "o3-mini": {
|
||||
const stream = await this.client.chat.completions.create({
|
||||
model: this.getModel().id,
|
||||
messages: [{ role: "developer", content: systemPrompt }, ...convertToOpenAiMessages(messages)],
|
||||
stream: true,
|
||||
stream_options: { include_usage: true },
|
||||
})
|
||||
for await (const chunk of stream) {
|
||||
const delta = chunk.choices[0]?.delta
|
||||
if (delta?.content) {
|
||||
yield {
|
||||
type: "text",
|
||||
text: delta.content,
|
||||
}
|
||||
}
|
||||
if (chunk.usage) {
|
||||
yield {
|
||||
type: "usage",
|
||||
inputTokens: chunk.usage.prompt_tokens || 0,
|
||||
outputTokens: chunk.usage.completion_tokens || 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
default: {
|
||||
const stream = await this.client.chat.completions.create({
|
||||
model: this.getModel().id,
|
||||
|
||||
@@ -4,6 +4,7 @@ import { ApiHandlerOptions, azureOpenAiDefaultApiVersion, ModelInfo, openAiModel
|
||||
import { ApiHandler } from "../index"
|
||||
import { convertToOpenAiMessages } from "../transform/openai-format"
|
||||
import { ApiStream } from "../transform/stream"
|
||||
import { convertToR1Format } from "../transform/r1-format"
|
||||
|
||||
export class OpenAiHandler implements ApiHandler {
|
||||
private options: ApiHandlerOptions
|
||||
@@ -27,12 +28,20 @@ export class OpenAiHandler implements ApiHandler {
|
||||
}
|
||||
|
||||
async *createMessage(systemPrompt: string, messages: Anthropic.Messages.MessageParam[]): ApiStream {
|
||||
const openAiMessages: OpenAI.Chat.ChatCompletionMessageParam[] = [
|
||||
const modelId = this.options.openAiModelId ?? ""
|
||||
const isDeepseekReasoner = modelId.includes("deepseek-reasoner")
|
||||
|
||||
let openAiMessages: OpenAI.Chat.ChatCompletionMessageParam[] = [
|
||||
{ role: "system", content: systemPrompt },
|
||||
...convertToOpenAiMessages(messages),
|
||||
]
|
||||
|
||||
if (isDeepseekReasoner) {
|
||||
openAiMessages = convertToR1Format([{ role: "user", content: systemPrompt }, ...messages])
|
||||
}
|
||||
|
||||
const stream = await this.client.chat.completions.create({
|
||||
model: this.options.openAiModelId ?? "",
|
||||
model: modelId,
|
||||
messages: openAiMessages,
|
||||
temperature: 0,
|
||||
stream: true,
|
||||
@@ -46,6 +55,14 @@ export class OpenAiHandler implements ApiHandler {
|
||||
text: delta.content,
|
||||
}
|
||||
}
|
||||
|
||||
if (delta && "reasoning_content" in delta && delta.reasoning_content) {
|
||||
yield {
|
||||
type: "reasoning",
|
||||
reasoning: (delta.reasoning_content as string | undefined) || "",
|
||||
}
|
||||
}
|
||||
|
||||
if (chunk.usage) {
|
||||
yield {
|
||||
type: "usage",
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { Anthropic } from "@anthropic-ai/sdk"
|
||||
import axios from "axios"
|
||||
import delay from "delay"
|
||||
import OpenAI from "openai"
|
||||
import { ApiHandler } from "../"
|
||||
import { ApiHandlerOptions, ModelInfo, openRouterDefaultModelId, openRouterDefaultModelInfo } from "../../shared/api"
|
||||
import { convertToOpenAiMessages } from "../transform/openai-format"
|
||||
import { ApiStream } from "../transform/stream"
|
||||
import delay from "delay"
|
||||
import { convertToR1Format } from "../transform/r1-format"
|
||||
|
||||
export class OpenRouterHandler implements ApiHandler {
|
||||
private options: ApiHandlerOptions
|
||||
@@ -27,7 +28,7 @@ export class OpenRouterHandler implements ApiHandler {
|
||||
const model = this.getModel()
|
||||
|
||||
// Convert Anthropic messages to OpenAI format
|
||||
const openAiMessages: OpenAI.Chat.ChatCompletionMessageParam[] = [
|
||||
let openAiMessages: OpenAI.Chat.ChatCompletionMessageParam[] = [
|
||||
{ role: "system", content: systemPrompt },
|
||||
...convertToOpenAiMessages(messages),
|
||||
]
|
||||
@@ -98,6 +99,18 @@ export class OpenRouterHandler implements ApiHandler {
|
||||
break
|
||||
}
|
||||
|
||||
let temperature = 0
|
||||
let topP: number | undefined = undefined
|
||||
// Handle models based on deepseek-r1
|
||||
if (this.getModel().id.startsWith("deepseek/deepseek-r1") || this.getModel().id === "perplexity/sonar-reasoning") {
|
||||
// Recommended temperature for DeepSeek reasoning models
|
||||
temperature = 0.6
|
||||
// DeepSeek highly recommends using user instead of system role
|
||||
openAiMessages = convertToR1Format([{ role: "user", content: systemPrompt }, ...messages])
|
||||
// Some provider support topP and 0.95 is value that Deepseek used in their benchmarks
|
||||
topP = 0.95
|
||||
}
|
||||
|
||||
// Removes messages in the middle when close to context window limit. Should not be applied to models that support prompt caching since it would continuously break the cache.
|
||||
let shouldApplyMiddleOutTransform = !model.info.supportsPromptCache
|
||||
// except for deepseek (which we set supportsPromptCache to true for), where because the context window is so small our truncation algo might miss and we should use openrouter's middle-out transform as a fallback to ensure we don't exceed the context window (FIXME: once we have a more robust token estimator we should not rely on this)
|
||||
@@ -109,10 +122,12 @@ export class OpenRouterHandler implements ApiHandler {
|
||||
const stream = await this.client.chat.completions.create({
|
||||
model: model.id,
|
||||
max_tokens: maxTokens,
|
||||
temperature: 0,
|
||||
temperature: temperature,
|
||||
top_p: topP,
|
||||
messages: openAiMessages,
|
||||
stream: true,
|
||||
transforms: shouldApplyMiddleOutTransform ? ["middle-out"] : undefined,
|
||||
include_reasoning: true,
|
||||
})
|
||||
|
||||
let genId: string | undefined
|
||||
@@ -136,6 +151,37 @@ export class OpenRouterHandler implements ApiHandler {
|
||||
text: delta.content,
|
||||
}
|
||||
}
|
||||
|
||||
// Reasoning tokens are returned separately from the content
|
||||
if ("reasoning" in delta && delta.reasoning) {
|
||||
// console.log("reasoning", delta.reasoning)
|
||||
yield {
|
||||
type: "reasoning",
|
||||
// @ts-ignore-next-line
|
||||
reasoning: delta.reasoning,
|
||||
}
|
||||
|
||||
// if (didStreamThinkTagInReasoning) {
|
||||
// yield {
|
||||
// type: "text",
|
||||
// // @ts-ignore-next-line
|
||||
// text: delta.reasoning,
|
||||
// }
|
||||
// } else {
|
||||
// yield {
|
||||
// type: "reasoning",
|
||||
// // @ts-ignore-next-line
|
||||
// text: delta.reasoning,
|
||||
// }
|
||||
|
||||
// // @ts-ignore-next-line
|
||||
// reasoningResponse += delta.reasoning
|
||||
// if (reasoningResponse.includes("</think>")) {
|
||||
// didStreamThinkTagInReasoning = true
|
||||
// console.log("did hit think tag", reasoningResponse)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
// if (chunk.usage) {
|
||||
// yield {
|
||||
// type: "usage",
|
||||
@@ -178,9 +224,6 @@ export class OpenRouterHandler implements ApiHandler {
|
||||
if (modelId && modelInfo) {
|
||||
return { id: modelId, info: modelInfo }
|
||||
}
|
||||
return {
|
||||
id: openRouterDefaultModelId,
|
||||
info: openRouterDefaultModelInfo,
|
||||
}
|
||||
return { id: openRouterDefaultModelId, info: openRouterDefaultModelInfo }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
import { Anthropic } from "@anthropic-ai/sdk"
|
||||
import OpenAI from "openai"
|
||||
|
||||
type ContentPartText = OpenAI.Chat.ChatCompletionContentPartText
|
||||
type ContentPartImage = OpenAI.Chat.ChatCompletionContentPartImage
|
||||
type UserMessage = OpenAI.Chat.ChatCompletionUserMessageParam
|
||||
type AssistantMessage = OpenAI.Chat.ChatCompletionAssistantMessageParam
|
||||
type Message = OpenAI.Chat.ChatCompletionMessageParam
|
||||
type AnthropicMessage = Anthropic.Messages.MessageParam
|
||||
|
||||
/**
|
||||
* Converts Anthropic messages to OpenAI format while merging consecutive messages with the same role.
|
||||
* This is required for DeepSeek Reasoner which does not support successive messages with the same role.
|
||||
*
|
||||
* @param messages Array of Anthropic messages
|
||||
* @returns Array of OpenAI messages where consecutive messages with the same role are combined
|
||||
*/
|
||||
export function convertToR1Format(messages: AnthropicMessage[]): Message[] {
|
||||
return messages.reduce<Message[]>((merged, message) => {
|
||||
const lastMessage = merged[merged.length - 1]
|
||||
let messageContent: string | (ContentPartText | ContentPartImage)[] = ""
|
||||
let hasImages = false
|
||||
|
||||
// Convert content to appropriate format
|
||||
if (Array.isArray(message.content)) {
|
||||
const textParts: string[] = []
|
||||
const imageParts: ContentPartImage[] = []
|
||||
|
||||
message.content.forEach((part) => {
|
||||
if (part.type === "text") {
|
||||
textParts.push(part.text)
|
||||
}
|
||||
if (part.type === "image") {
|
||||
hasImages = true
|
||||
imageParts.push({
|
||||
type: "image_url",
|
||||
image_url: { url: `data:${part.source.media_type};base64,${part.source.data}` },
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
if (hasImages) {
|
||||
const parts: (ContentPartText | ContentPartImage)[] = []
|
||||
if (textParts.length > 0) {
|
||||
parts.push({ type: "text", text: textParts.join("\n") })
|
||||
}
|
||||
parts.push(...imageParts)
|
||||
messageContent = parts
|
||||
} else {
|
||||
messageContent = textParts.join("\n")
|
||||
}
|
||||
} else {
|
||||
messageContent = message.content
|
||||
}
|
||||
|
||||
// If last message has same role, merge the content
|
||||
if (lastMessage?.role === message.role) {
|
||||
if (typeof lastMessage.content === "string" && typeof messageContent === "string") {
|
||||
lastMessage.content += `\n${messageContent}`
|
||||
}
|
||||
// If either has image content, convert both to array format
|
||||
else {
|
||||
const lastContent = Array.isArray(lastMessage.content)
|
||||
? lastMessage.content
|
||||
: [{ type: "text" as const, text: lastMessage.content || "" }]
|
||||
|
||||
const newContent = Array.isArray(messageContent)
|
||||
? messageContent
|
||||
: [{ type: "text" as const, text: messageContent }]
|
||||
|
||||
if (message.role === "assistant") {
|
||||
const mergedContent = [...lastContent, ...newContent] as AssistantMessage["content"]
|
||||
lastMessage.content = mergedContent
|
||||
} else {
|
||||
const mergedContent = [...lastContent, ...newContent] as UserMessage["content"]
|
||||
lastMessage.content = mergedContent
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Add as new message with the correct type based on role
|
||||
if (message.role === "assistant") {
|
||||
const newMessage: AssistantMessage = {
|
||||
role: "assistant",
|
||||
content: messageContent as AssistantMessage["content"],
|
||||
}
|
||||
merged.push(newMessage)
|
||||
} else {
|
||||
const newMessage: UserMessage = {
|
||||
role: "user",
|
||||
content: messageContent as UserMessage["content"],
|
||||
}
|
||||
merged.push(newMessage)
|
||||
}
|
||||
}
|
||||
|
||||
return merged
|
||||
}, [])
|
||||
}
|
||||
@@ -1,11 +1,16 @@
|
||||
export type ApiStream = AsyncGenerator<ApiStreamChunk>
|
||||
export type ApiStreamChunk = ApiStreamTextChunk | ApiStreamUsageChunk
|
||||
export type ApiStreamChunk = ApiStreamTextChunk | ApiStreamReasoningChunk | ApiStreamUsageChunk
|
||||
|
||||
export interface ApiStreamTextChunk {
|
||||
type: "text"
|
||||
text: string
|
||||
}
|
||||
|
||||
export interface ApiStreamReasoningChunk {
|
||||
type: "reasoning"
|
||||
reasoning: string
|
||||
}
|
||||
|
||||
export interface ApiStreamUsageChunk {
|
||||
type: "usage"
|
||||
inputTokens: number
|
||||
|
||||
+30
-3
@@ -214,7 +214,7 @@ export class Cline {
|
||||
private async addToClineMessages(message: ClineMessage) {
|
||||
// these values allow us to reconstruct the conversation history at the time this cline message was created
|
||||
// it's important that apiConversationHistory is initialized before we add cline messages
|
||||
message.conversationHistoryIndex = this.apiConversationHistory.length - 1 // NOTE: this is the index of the last added message which is the user message, and once the clinemessages have been presented we update the apiconversationhistory with the completed assistant message. This means when reseting to a message, we need to +1 this index to get the correct assistant message that this tool use corresponds to
|
||||
message.conversationHistoryIndex = this.apiConversationHistory.length - 1 // NOTE: this is the index of the last added message which is the user message, and once the clinemessages have been presented we update the apiconversationhistory with the completed assistant message. This means when resetting to a message, we need to +1 this index to get the correct assistant message that this tool use corresponds to
|
||||
message.conversationHistoryDeletedRange = this.conversationHistoryDeletedRange
|
||||
this.clineMessages.push(message)
|
||||
await this.saveClineMessages()
|
||||
@@ -1259,10 +1259,16 @@ export class Cline {
|
||||
|
||||
// This is the most reliable way to know when we're close to hitting the context window.
|
||||
if (totalTokens >= maxAllowedSize) {
|
||||
// Since the user may switch between models with different context windows, truncating half may not be enough (ie if switching from claude 200k to deepseek 64k, half truncation will only remove 100k tokens, but we need to remove much more)
|
||||
// So if totalTokens/2 is greater than maxAllowedSize, we truncate 3/4 instead of 1/2
|
||||
// FIXME: truncating the conversation in a way that is optimal for prompt caching AND takes into account multi-context window complexity is something we need to improve
|
||||
const keep = totalTokens / 2 > maxAllowedSize ? "quarter" : "half"
|
||||
|
||||
// NOTE: it's okay that we overwriteConversationHistory in resume task since we're only ever removing the last user message and not anything in the middle which would affect this range
|
||||
this.conversationHistoryDeletedRange = getNextTruncationRange(
|
||||
this.apiConversationHistory,
|
||||
this.conversationHistoryDeletedRange,
|
||||
keep,
|
||||
)
|
||||
await this.saveClineMessages() // saves task history item which we use to keep track of conversation history deleted range
|
||||
// await this.overwriteApiConversationHistory(truncatedMessages)
|
||||
@@ -1386,7 +1392,7 @@ export class Cline {
|
||||
|
||||
if (!block.partial) {
|
||||
// Some models add code block artifacts (around the tool calls) which show up at the end of text content
|
||||
// matches ``` with atleast one char after the last backtick, at the end of the string
|
||||
// matches ``` with at least one char after the last backtick, at the end of the string
|
||||
const match = content?.trimEnd().match(/```[a-zA-Z0-9_-]+$/)
|
||||
if (match) {
|
||||
const matchLength = match[0].length
|
||||
@@ -1589,6 +1595,13 @@ export class Cline {
|
||||
diff = fixModelHtmlEscaping(diff)
|
||||
diff = removeInvalidChars(diff)
|
||||
}
|
||||
|
||||
// open the editor if not done already. This is to fix diff error when model provides correct search-replace text but Cline throws error
|
||||
// because file is not open.
|
||||
if (!this.diffViewProvider.isEditing) {
|
||||
await this.diffViewProvider.open(relPath)
|
||||
}
|
||||
|
||||
try {
|
||||
newContent = await constructNewFileContent(
|
||||
diff,
|
||||
@@ -2773,7 +2786,7 @@ export class Cline {
|
||||
if (!block.partial || this.didRejectTool || this.didAlreadyUseTool) {
|
||||
// block is finished streaming and executing
|
||||
if (this.currentStreamingContentIndex === this.assistantMessageContent.length - 1) {
|
||||
// its okay that we increment if !didCompleteReadingStream, it'll just return bc out of bounds and as streaming continues it will call presentAssitantMessage if a new block is ready. if streaming is finished then we set userMessageContentReady to true when out of bounds. This gracefully allows the stream to continue on and all potential content blocks be presented.
|
||||
// its okay that we increment if !didCompleteReadingStream, it'll just return bc out of bounds and as streaming continues it will call presentAssistantMessage if a new block is ready. if streaming is finished then we set userMessageContentReady to true when out of bounds. This gracefully allows the stream to continue on and all potential content blocks be presented.
|
||||
// last block is complete and it is finished executing
|
||||
this.userMessageContentReady = true // will allow pwaitfor to continue
|
||||
}
|
||||
@@ -2973,9 +2986,14 @@ export class Cline {
|
||||
|
||||
const stream = this.attemptApiRequest(previousApiReqIndex) // yields only if the first chunk is successful, otherwise will allow the user to retry the request (most likely due to rate limit error, which gets thrown on the first chunk)
|
||||
let assistantMessage = ""
|
||||
let reasoningMessage = ""
|
||||
this.isStreaming = true
|
||||
try {
|
||||
for await (const chunk of stream) {
|
||||
if (!chunk) {
|
||||
// Sometimes chunk is undefined, no idea that can cause it, but this workaround seems to fix it
|
||||
continue
|
||||
}
|
||||
switch (chunk.type) {
|
||||
case "usage":
|
||||
inputTokens += chunk.inputTokens
|
||||
@@ -2984,7 +3002,16 @@ export class Cline {
|
||||
cacheReadTokens += chunk.cacheReadTokens ?? 0
|
||||
totalCost = chunk.totalCost
|
||||
break
|
||||
case "reasoning":
|
||||
// reasoning will always come before assistant message
|
||||
reasoningMessage += chunk.reasoning
|
||||
await this.say("reasoning", reasoningMessage, undefined, true)
|
||||
break
|
||||
case "text":
|
||||
if (reasoningMessage && assistantMessage.length === 0) {
|
||||
// complete reasoning message
|
||||
await this.say("reasoning", reasoningMessage, undefined, false)
|
||||
}
|
||||
assistantMessage += chunk.text
|
||||
// parse raw assistant message into content blocks
|
||||
const prevLength = this.assistantMessageContent.length
|
||||
|
||||
+10
-10
@@ -1,4 +1,4 @@
|
||||
import defaultShell from "default-shell"
|
||||
import { getShell } from "../../utils/shell"
|
||||
import os from "os"
|
||||
import osName from "os-name"
|
||||
import { McpHub } from "../../services/mcp/McpHub"
|
||||
@@ -38,7 +38,7 @@ Always adhere to this format for the tool use to ensure proper parsing and execu
|
||||
# Tools
|
||||
|
||||
## execute_command
|
||||
Description: Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Commands will be executed in the current working directory: ${cwd.toPosix()}
|
||||
Description: Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. For command chaining, use the appropriate chaining syntax for the user's shell. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Commands will be executed in the current working directory: ${cwd.toPosix()}
|
||||
Parameters:
|
||||
- command: (required) The CLI command to execute. This should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions.
|
||||
- requires_approval: (required) A boolean indicating whether this command requires explicit user approval before execution in case the user has auto-approve mode enabled. Set to 'true' for potentially impactful operations like installing/uninstalling packages, deleting/overwriting files, system configuration changes, network operations, or any commands that could have unintended side effects. Set to 'false' for safe operations like reading files/directories, running development servers, building projects, and other non-destructive operations.
|
||||
@@ -178,7 +178,7 @@ Usage:
|
||||
}
|
||||
|
||||
${
|
||||
mcpHub.getMode() !== "disabled"
|
||||
mcpHub.getMode() !== "off"
|
||||
? `
|
||||
## use_mcp_tool
|
||||
Description: Request to use a tool provided by a connected MCP server. Each MCP server can provide multiple tools with different capabilities. Tools have defined input schemas that specify required and optional parameters.
|
||||
@@ -310,7 +310,7 @@ return (
|
||||
</diff>
|
||||
</replace_in_file>
|
||||
${
|
||||
mcpHub.getMode() !== "disabled"
|
||||
mcpHub.getMode() !== "off"
|
||||
? `
|
||||
|
||||
## Example 4: Requesting to use an MCP tool
|
||||
@@ -357,7 +357,7 @@ It is crucial to proceed step-by-step, waiting for the user's message after each
|
||||
By waiting for and carefully considering the user's response after each tool use, you can react accordingly and make informed decisions about how to proceed with the task. This iterative process helps ensure the overall success and accuracy of your work.
|
||||
|
||||
${
|
||||
mcpHub.getMode() !== "disabled"
|
||||
mcpHub.getMode() !== "off"
|
||||
? `
|
||||
====
|
||||
|
||||
@@ -410,7 +410,7 @@ ${
|
||||
}
|
||||
|
||||
${
|
||||
mcpHub.getMode() === "enabled"
|
||||
mcpHub.getMode() === "full"
|
||||
? `
|
||||
## Creating an MCP Server
|
||||
|
||||
@@ -887,7 +887,7 @@ CAPABILITIES
|
||||
: ""
|
||||
}
|
||||
${
|
||||
mcpHub.getMode() !== "disabled"
|
||||
mcpHub.getMode() !== "off"
|
||||
? `
|
||||
- You have access to MCP servers that may provide additional tools and resources. Each server may provide different capabilities that you can use to accomplish tasks more effectively.
|
||||
`
|
||||
@@ -913,7 +913,7 @@ RULES
|
||||
- The user may provide a file's contents directly in their message, in which case you shouldn't use the read_file tool to get the file contents again since you already have it.
|
||||
- Your goal is to try to accomplish the user's task, NOT engage in a back and forth conversation.${
|
||||
supportsComputerUse
|
||||
? `\n- The user may ask generic non-development tasks, such as "what\'s the latest news" or "look up the weather in San Diego", in which case you might use the browser_action tool to complete the task if it makes sense to do so, rather than trying to create a website or using curl to answer the question.${mcpHub.getMode() !== "disabled" ? "However, if an available MCP server tool or resource can be used instead, you should prefer to use it over browser_action." : ""}`
|
||||
? `\n- The user may ask generic non-development tasks, such as "what\'s the latest news" or "look up the weather in San Diego", in which case you might use the browser_action tool to complete the task if it makes sense to do so, rather than trying to create a website or using curl to answer the question.${mcpHub.getMode() !== "off" ? "However, if an available MCP server tool or resource can be used instead, you should prefer to use it over browser_action." : ""}`
|
||||
: ""
|
||||
}
|
||||
- NEVER end attempt_completion result with a question or request to engage in further conversation! Formulate the end of your result in a way that is final and does not require further input from the user.
|
||||
@@ -929,7 +929,7 @@ RULES
|
||||
: ""
|
||||
}
|
||||
${
|
||||
mcpHub.getMode() !== "disabled"
|
||||
mcpHub.getMode() !== "off"
|
||||
? `
|
||||
- MCP operations should be used one at a time, similar to other tool usage. Wait for confirmation of success before proceeding with additional operations.
|
||||
`
|
||||
@@ -941,7 +941,7 @@ ${
|
||||
SYSTEM INFORMATION
|
||||
|
||||
Operating System: ${osName()}
|
||||
Default Shell: ${defaultShell}
|
||||
Default Shell: ${getShell()}
|
||||
Home Directory: ${os.homedir().toPosix()}
|
||||
Current Working Directory: ${cwd.toPosix()}
|
||||
|
||||
|
||||
@@ -55,17 +55,25 @@ truncated = getTruncatedMessages(messages, deletedRange);
|
||||
export function getNextTruncationRange(
|
||||
messages: Anthropic.Messages.MessageParam[],
|
||||
currentDeletedRange: [number, number] | undefined = undefined,
|
||||
keep: "half" | "quarter" = "half",
|
||||
): [number, number] {
|
||||
// Since we always keep the first message, currentDeletedRange[0] will always be 1 (for now until we have a smarter truncation algorithm)
|
||||
const rangeStartIndex = 1
|
||||
const startOfRest = currentDeletedRange ? currentDeletedRange[1] + 1 : 1
|
||||
|
||||
// Remove half of user-assistant pairs
|
||||
const messagesToRemove = Math.floor((messages.length - startOfRest) / 4) * 2 // Keep even number
|
||||
let messagesToRemove: number
|
||||
if (keep === "half") {
|
||||
// Remove half of user-assistant pairs
|
||||
messagesToRemove = Math.floor((messages.length - startOfRest) / 4) * 2 // Keep even number
|
||||
} else {
|
||||
// Remove 3/4 of user-assistant pairs
|
||||
messagesToRemove = Math.floor((messages.length - startOfRest) / 8) * 3 * 2
|
||||
}
|
||||
|
||||
let rangeEndIndex = startOfRest + messagesToRemove - 1
|
||||
|
||||
// Make sure the last message being removed is a user message, so that the next message after the initial task message is an assistant message. This preservers the user-assistant-user-assistant structure.
|
||||
// NOTE: anthropic format messages are always user-assitant-user-assistant, while openai format messages can have multiple user messages in a row (we use anthropic format throughout cline)
|
||||
// NOTE: anthropic format messages are always user-assistant-user-assistant, while openai format messages can have multiple user messages in a row (we use anthropic format throughout cline)
|
||||
if (messages[rangeEndIndex].role !== "user") {
|
||||
rangeEndIndex -= 1
|
||||
}
|
||||
|
||||
@@ -73,8 +73,10 @@ type GlobalStateKey =
|
||||
| "browserSettings"
|
||||
| "chatSettings"
|
||||
| "vsCodeLmModelSelector"
|
||||
| "localeLanguage"
|
||||
| "userInfo"
|
||||
| "previousModeApiProvider"
|
||||
| "previousModeModelId"
|
||||
| "previousModeModelInfo"
|
||||
|
||||
export const GlobalFileNames = {
|
||||
apiConversationHistory: "api_conversation_history.json",
|
||||
@@ -177,7 +179,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
webviewView.webview.html = this.getHtmlContent(webviewView.webview)
|
||||
|
||||
// Sets up an event listener to listen for messages passed from the webview view context
|
||||
// and executes code based on the message that is recieved
|
||||
// and executes code based on the message that is received
|
||||
this.setWebviewMessageListener(webviewView.webview)
|
||||
|
||||
// Logs show up in bottom panel > Debug Console
|
||||
@@ -248,7 +250,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
}
|
||||
|
||||
async initClineWithTask(task?: string, images?: string[]) {
|
||||
await this.clearTask() // ensures that an exising task doesn't exist before starting a new one, although this shouldn't be possible since user must clear task before starting a new one
|
||||
await this.clearTask() // ensures that an existing task doesn't exist before starting a new one, although this shouldn't be possible since user must clear task before starting a new one
|
||||
const { apiConfiguration, customInstructions, autoApprovalSettings, browserSettings, chatSettings } =
|
||||
await this.getState()
|
||||
this.cline = new Cline(
|
||||
@@ -362,7 +364,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
|
||||
/**
|
||||
* Sets up an event listener to listen for messages passed from the webview context and
|
||||
* executes code based on the message that is recieved.
|
||||
* executes code based on the message that is received.
|
||||
*
|
||||
* @param webview A reference to the extension webview
|
||||
*/
|
||||
@@ -504,8 +506,79 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
case "chatSettings":
|
||||
if (message.chatSettings) {
|
||||
const didSwitchToActMode = message.chatSettings.mode === "act"
|
||||
|
||||
// Get previous model info that we will revert to after saving current mode api info
|
||||
const {
|
||||
apiConfiguration,
|
||||
previousModeApiProvider: newApiProvider,
|
||||
previousModeModelId: newModelId,
|
||||
previousModeModelInfo: newModelInfo,
|
||||
} = await this.getState()
|
||||
|
||||
// Save the last model used in this mode
|
||||
await this.updateGlobalState("previousModeApiProvider", apiConfiguration.apiProvider)
|
||||
switch (apiConfiguration.apiProvider) {
|
||||
case "anthropic":
|
||||
case "bedrock":
|
||||
case "vertex":
|
||||
case "gemini":
|
||||
await this.updateGlobalState("previousModeModelId", apiConfiguration.apiModelId)
|
||||
break
|
||||
case "openrouter":
|
||||
await this.updateGlobalState("previousModeModelId", apiConfiguration.openRouterModelId)
|
||||
await this.updateGlobalState("previousModeModelInfo", apiConfiguration.openRouterModelInfo)
|
||||
break
|
||||
case "vscode-lm":
|
||||
await this.updateGlobalState("previousModeModelId", apiConfiguration.vsCodeLmModelSelector)
|
||||
break
|
||||
case "openai":
|
||||
await this.updateGlobalState("previousModeModelId", apiConfiguration.openAiModelId)
|
||||
break
|
||||
case "ollama":
|
||||
await this.updateGlobalState("previousModeModelId", apiConfiguration.ollamaModelId)
|
||||
break
|
||||
case "lmstudio":
|
||||
await this.updateGlobalState("previousModeModelId", apiConfiguration.lmStudioModelId)
|
||||
break
|
||||
}
|
||||
|
||||
// Restore the model used in previous mode
|
||||
if (newApiProvider && newModelId) {
|
||||
await this.updateGlobalState("apiProvider", newApiProvider)
|
||||
switch (newApiProvider) {
|
||||
case "anthropic":
|
||||
case "bedrock":
|
||||
case "vertex":
|
||||
case "gemini":
|
||||
await this.updateGlobalState("apiModelId", newModelId)
|
||||
break
|
||||
case "openrouter":
|
||||
await this.updateGlobalState("openRouterModelId", newModelId)
|
||||
await this.updateGlobalState("openRouterModelInfo", newModelInfo)
|
||||
break
|
||||
case "vscode-lm":
|
||||
await this.updateGlobalState("vsCodeLmModelSelector", newModelId)
|
||||
break
|
||||
case "openai":
|
||||
await this.updateGlobalState("openAiModelId", newModelId)
|
||||
break
|
||||
case "ollama":
|
||||
await this.updateGlobalState("ollamaModelId", newModelId)
|
||||
break
|
||||
case "lmstudio":
|
||||
await this.updateGlobalState("lmStudioModelId", newModelId)
|
||||
break
|
||||
}
|
||||
|
||||
if (this.cline) {
|
||||
const { apiConfiguration: updatedApiConfiguration } = await this.getState()
|
||||
this.cline.api = buildApiHandler(updatedApiConfiguration)
|
||||
}
|
||||
}
|
||||
|
||||
await this.updateGlobalState("chatSettings", message.chatSettings)
|
||||
await this.postStateToWebview()
|
||||
// console.log("chatSettings", message.chatSettings)
|
||||
if (this.cline) {
|
||||
this.cline.updateChatSettings(message.chatSettings)
|
||||
if (this.cline.isAwaitingPlanResponse && didSwitchToActMode) {
|
||||
@@ -635,6 +708,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
case "getLatestState":
|
||||
await this.postStateToWebview()
|
||||
break
|
||||
case "subscribeEmail":
|
||||
this.subscribeEmail(message.text)
|
||||
break
|
||||
case "accountLoginClicked": {
|
||||
// Generate nonce for state validation
|
||||
const nonce = crypto.randomBytes(32).toString("hex")
|
||||
@@ -704,6 +780,36 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
)
|
||||
}
|
||||
|
||||
async subscribeEmail(email?: string) {
|
||||
if (!email) {
|
||||
return
|
||||
}
|
||||
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
|
||||
if (!emailRegex.test(email)) {
|
||||
vscode.window.showErrorMessage("Please enter a valid email address")
|
||||
return
|
||||
}
|
||||
console.log("Subscribing email:", email)
|
||||
this.postMessageToWebview({ type: "emailSubscribed" })
|
||||
// Currently ignoring errors to this endpoint, but after accounts we'll remove this anyways
|
||||
try {
|
||||
const response = await axios.post(
|
||||
"https://app.cline.bot/api/mailing-list",
|
||||
{
|
||||
email: email,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
},
|
||||
)
|
||||
console.log("Email subscribed successfully. Response:", response.data)
|
||||
} catch (error) {
|
||||
console.error("Failed to subscribe email:", error)
|
||||
}
|
||||
}
|
||||
|
||||
async cancelTask() {
|
||||
if (this.cline) {
|
||||
const { historyItem } = await this.getTaskWithId(this.cline.taskId)
|
||||
@@ -1174,9 +1280,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
browserSettings,
|
||||
chatSettings,
|
||||
userInfo,
|
||||
authToken,
|
||||
} = await this.getState()
|
||||
|
||||
const authToken = await this.getSecret("authToken")
|
||||
return {
|
||||
version: this.context.extension?.packageJSON?.version ?? "",
|
||||
apiConfiguration,
|
||||
@@ -1190,7 +1296,6 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
autoApprovalSettings,
|
||||
browserSettings,
|
||||
chatSettings,
|
||||
localeLanguage: vscode.env.language,
|
||||
isLoggedIn: !!authToken,
|
||||
userInfo,
|
||||
}
|
||||
@@ -1207,7 +1312,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
Now that we use retainContextWhenHidden, we don't have to store a cache of cline messages in the user's state, but we could to reduce memory footprint in long conversations.
|
||||
|
||||
- We have to be careful of what state is shared between ClineProvider instances since there could be multiple instances of the extension running at once. For example when we cached cline messages using the same key, two instances of the extension could end up using the same key and overwriting each other's messages.
|
||||
- Some state does need to be shared between the instances, i.e. the API key--however there doesn't seem to be a good way to notfy the other instances that the API key has changed.
|
||||
- Some state does need to be shared between the instances, i.e. the API key--however there doesn't seem to be a good way to notify the other instances that the API key has changed.
|
||||
|
||||
We need to use a unique identifier for each ClineProvider instance's message cache since we could be running several instances of the extension outside of just the sidebar i.e. in editor panels.
|
||||
|
||||
@@ -1283,9 +1388,11 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
browserSettings,
|
||||
chatSettings,
|
||||
vsCodeLmModelSelector,
|
||||
localeLanguage,
|
||||
userInfo,
|
||||
authToken,
|
||||
previousModeApiProvider,
|
||||
previousModeModelId,
|
||||
previousModeModelInfo,
|
||||
] = await Promise.all([
|
||||
this.getGlobalState("apiProvider") as Promise<ApiProvider | undefined>,
|
||||
this.getGlobalState("apiModelId") as Promise<string | undefined>,
|
||||
@@ -1321,9 +1428,11 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
this.getGlobalState("browserSettings") as Promise<BrowserSettings | undefined>,
|
||||
this.getGlobalState("chatSettings") as Promise<ChatSettings | undefined>,
|
||||
this.getGlobalState("vsCodeLmModelSelector") as Promise<vscode.LanguageModelChatSelector | undefined>,
|
||||
this.getGlobalState("localeLanguage") as Promise<string | undefined>,
|
||||
this.getGlobalState("userInfo") as Promise<UserInfo | undefined>,
|
||||
this.getSecret("authToken") as Promise<string | undefined>,
|
||||
this.getGlobalState("previousModeApiProvider") as Promise<ApiProvider | undefined>,
|
||||
this.getGlobalState("previousModeModelId") as Promise<string | undefined>,
|
||||
this.getGlobalState("previousModeModelInfo") as Promise<ModelInfo | undefined>,
|
||||
])
|
||||
|
||||
let apiProvider: ApiProvider
|
||||
@@ -1379,6 +1488,10 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
browserSettings: browserSettings || DEFAULT_BROWSER_SETTINGS,
|
||||
chatSettings: chatSettings || DEFAULT_CHAT_SETTINGS,
|
||||
userInfo,
|
||||
authToken,
|
||||
previousModeApiProvider,
|
||||
previousModeModelId,
|
||||
previousModeModelInfo,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-4
@@ -3,6 +3,7 @@
|
||||
import delay from "delay"
|
||||
import * as vscode from "vscode"
|
||||
import { ClineProvider } from "./core/webview/ClineProvider"
|
||||
import { Logger } from "./services/logging/Logger"
|
||||
import { createClineAPI } from "./exports"
|
||||
import "./utils/path" // necessary to have access to String.prototype.toPosix
|
||||
import { DIFF_VIEW_URI_SCHEME } from "./integrations/editor/DiffViewProvider"
|
||||
@@ -24,7 +25,8 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
outputChannel = vscode.window.createOutputChannel("Cline")
|
||||
context.subscriptions.push(outputChannel)
|
||||
|
||||
outputChannel.appendLine("Cline extension activated")
|
||||
Logger.initialize(outputChannel)
|
||||
Logger.log("Cline extension activated")
|
||||
|
||||
const sidebarProvider = new ClineProvider(context, outputChannel)
|
||||
|
||||
@@ -36,7 +38,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
|
||||
context.subscriptions.push(
|
||||
vscode.commands.registerCommand("cline.plusButtonClicked", async () => {
|
||||
outputChannel.appendLine("Plus button Clicked")
|
||||
Logger.log("Plus button Clicked")
|
||||
await sidebarProvider.clearTask()
|
||||
await sidebarProvider.postStateToWebview()
|
||||
await sidebarProvider.postMessageToWebview({
|
||||
@@ -56,7 +58,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
)
|
||||
|
||||
const openClineInNewTab = async () => {
|
||||
outputChannel.appendLine("Opening Cline in new tab")
|
||||
Logger.log("Opening Cline in new tab")
|
||||
// (this example uses webviewProvider activation event which is necessary to deserialize cached webview, but since we use retainContextWhenHidden, we don't need to use that event)
|
||||
// https://github.com/microsoft/vscode-extension-samples/blob/main/webview-sample/src/extension.ts
|
||||
const tabProvider = new ClineProvider(context, outputChannel)
|
||||
@@ -188,5 +190,5 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
|
||||
// This method is called when your extension is deactivated
|
||||
export function deactivate() {
|
||||
outputChannel.appendLine("Cline extension deactivated")
|
||||
Logger.log("Cline extension deactivated")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,260 @@
|
||||
import { LLMFileAccessController } from "./LLMFileAccessController"
|
||||
import fs from "fs/promises"
|
||||
import path from "path"
|
||||
import os from "os"
|
||||
import { after, beforeEach, describe, it } from "mocha"
|
||||
import "should"
|
||||
|
||||
describe("LLMFileAccessController", () => {
|
||||
let tempDir: string
|
||||
let controller: LLMFileAccessController
|
||||
|
||||
beforeEach(async () => {
|
||||
// Create a temp directory for testing
|
||||
tempDir = path.join(os.tmpdir(), `llm-test-${Date.now()}-${Math.random().toString(36).slice(2)}`)
|
||||
await fs.mkdir(tempDir)
|
||||
|
||||
// Create default .clineignore file
|
||||
await fs.writeFile(
|
||||
path.join(tempDir, ".clineignore"),
|
||||
[".env", "*.secret", "private/", "# This is a comment", "", "temp.*", "file-with-space-at-end.* ", "**/.git/**"].join(
|
||||
"\n",
|
||||
),
|
||||
)
|
||||
|
||||
controller = new LLMFileAccessController(tempDir)
|
||||
await controller.initialize()
|
||||
})
|
||||
|
||||
after(async () => {
|
||||
// Clean up temp directory
|
||||
await fs.rm(tempDir, { recursive: true, force: true })
|
||||
})
|
||||
|
||||
describe("Default Patterns", () => {
|
||||
// it("should block access to common ignored files", async () => {
|
||||
// const results = await Promise.all([
|
||||
// controller.validateAccess(".env"),
|
||||
// controller.validateAccess(".git/config"),
|
||||
// controller.validateAccess("node_modules/package.json"),
|
||||
// ])
|
||||
// results.forEach((result) => result.should.be.false())
|
||||
// })
|
||||
|
||||
it("should allow access to regular files", async () => {
|
||||
const results = await Promise.all([
|
||||
controller.validateAccess("src/index.ts"),
|
||||
controller.validateAccess("README.md"),
|
||||
controller.validateAccess("package.json"),
|
||||
])
|
||||
results.forEach((result) => result.should.be.true())
|
||||
})
|
||||
})
|
||||
|
||||
describe("Custom Patterns", () => {
|
||||
it("should block access to custom ignored patterns", async () => {
|
||||
const results = await Promise.all([
|
||||
controller.validateAccess("config.secret"),
|
||||
controller.validateAccess("private/data.txt"),
|
||||
controller.validateAccess("temp.json"),
|
||||
controller.validateAccess("nested/deep/file.secret"),
|
||||
controller.validateAccess("private/nested/deep/file.txt"),
|
||||
])
|
||||
results.forEach((result) => result.should.be.false())
|
||||
})
|
||||
|
||||
it("should allow access to non-ignored files", async () => {
|
||||
const results = await Promise.all([
|
||||
controller.validateAccess("public/data.txt"),
|
||||
controller.validateAccess("config.json"),
|
||||
controller.validateAccess("src/temp/file.ts"),
|
||||
controller.validateAccess("nested/deep/file.txt"),
|
||||
controller.validateAccess("not-private/data.txt"),
|
||||
])
|
||||
results.forEach((result) => result.should.be.true())
|
||||
})
|
||||
|
||||
it("should handle pattern edge cases", async () => {
|
||||
await fs.writeFile(
|
||||
path.join(tempDir, ".clineignore"),
|
||||
["*.secret", "private/", "*.tmp", "data-*.json", "temp/*"].join("\n"),
|
||||
)
|
||||
|
||||
controller = new LLMFileAccessController(tempDir)
|
||||
await controller.initialize()
|
||||
|
||||
const results = await Promise.all([
|
||||
controller.validateAccess("data-123.json"), // Should be false (wildcard)
|
||||
controller.validateAccess("data.json"), // Should be true (doesn't match pattern)
|
||||
controller.validateAccess("script.tmp"), // Should be false (extension match)
|
||||
])
|
||||
|
||||
results[0].should.be.false() // data-123.json
|
||||
results[1].should.be.true() // data.json
|
||||
results[2].should.be.false() // script.tmp
|
||||
})
|
||||
|
||||
// ToDo: handle negation patterns successfully
|
||||
|
||||
// it("should handle negation patterns", async () => {
|
||||
// await fs.writeFile(
|
||||
// path.join(tempDir, ".clineignore"),
|
||||
// [
|
||||
// "temp/*", // Ignore everything in temp
|
||||
// "!temp/allowed/*", // But allow files in temp/allowed
|
||||
// "docs/**/*.md", // Ignore all markdown files in docs
|
||||
// "!docs/README.md", // Except README.md
|
||||
// "!docs/CONTRIBUTING.md", // And CONTRIBUTING.md
|
||||
// "assets/", // Ignore all assets
|
||||
// "!assets/public/", // Except public assets
|
||||
// "!assets/public/*.png", // Specifically allow PNGs in public assets
|
||||
// ].join("\n"),
|
||||
// )
|
||||
|
||||
// controller = new LLMFileAccessController(tempDir)
|
||||
// await controller.initialize()
|
||||
|
||||
// const results = await Promise.all([
|
||||
// // Basic negation
|
||||
// controller.validateAccess("temp/file.txt"), // Should be false (in temp/)
|
||||
// controller.validateAccess("temp/allowed/file.txt"), // Should be true (negated)
|
||||
// controller.validateAccess("temp/allowed/nested/file.txt"), // Should be true (negated with nested)
|
||||
|
||||
// // Multiple negations in same path
|
||||
// controller.validateAccess("docs/guide.md"), // Should be false (matches docs/**/*.md)
|
||||
// controller.validateAccess("docs/README.md"), // Should be true (negated)
|
||||
// controller.validateAccess("docs/CONTRIBUTING.md"), // Should be true (negated)
|
||||
// controller.validateAccess("docs/api/guide.md"), // Should be false (nested markdown)
|
||||
|
||||
// // Nested negations
|
||||
// controller.validateAccess("assets/logo.png"), // Should be false (in assets/)
|
||||
// controller.validateAccess("assets/public/logo.png"), // Should be true (negated and matches *.png)
|
||||
// controller.validateAccess("assets/public/data.json"), // Should be true (in negated public/)
|
||||
// ])
|
||||
|
||||
// results[0].should.be.false() // temp/file.txt
|
||||
// results[1].should.be.true() // temp/allowed/file.txt
|
||||
// results[2].should.be.true() // temp/allowed/nested/file.txt
|
||||
// results[3].should.be.false() // docs/guide.md
|
||||
// results[4].should.be.true() // docs/README.md
|
||||
// results[5].should.be.true() // docs/CONTRIBUTING.md
|
||||
// results[6].should.be.false() // docs/api/guide.md
|
||||
// results[7].should.be.false() // assets/logo.png
|
||||
// results[8].should.be.true() // assets/public/logo.png
|
||||
// results[9].should.be.true() // assets/public/data.json
|
||||
// })
|
||||
|
||||
it("should handle comments in .clineignore", async () => {
|
||||
// Create a new .clineignore with comments
|
||||
await fs.writeFile(
|
||||
path.join(tempDir, ".clineignore"),
|
||||
["# Comment line", "*.secret", "private/", "temp.*"].join("\n"),
|
||||
)
|
||||
|
||||
controller = new LLMFileAccessController(tempDir)
|
||||
await controller.initialize()
|
||||
|
||||
const result = await controller.validateAccess("test.secret")
|
||||
result.should.be.false()
|
||||
})
|
||||
})
|
||||
|
||||
describe("Path Handling", () => {
|
||||
it("should handle absolute paths and match ignore patterns", async () => {
|
||||
// Test absolute path that should be allowed
|
||||
const allowedPath = path.join(tempDir, "src/file.ts")
|
||||
const allowedResult = await controller.validateAccess(allowedPath)
|
||||
allowedResult.should.be.true()
|
||||
|
||||
// Test absolute path that matches an ignore pattern (*.secret)
|
||||
const ignoredPath = path.join(tempDir, "config.secret")
|
||||
const ignoredResult = await controller.validateAccess(ignoredPath)
|
||||
ignoredResult.should.be.false()
|
||||
|
||||
// Test absolute path in ignored directory (private/)
|
||||
const ignoredDirPath = path.join(tempDir, "private/data.txt")
|
||||
const ignoredDirResult = await controller.validateAccess(ignoredDirPath)
|
||||
ignoredDirResult.should.be.false()
|
||||
})
|
||||
|
||||
it("should handle relative paths and match ignore patterns", async () => {
|
||||
// Test relative path that should be allowed
|
||||
const allowedResult = await controller.validateAccess("./src/file.ts")
|
||||
allowedResult.should.be.true()
|
||||
|
||||
// Test relative path that matches an ignore pattern (*.secret)
|
||||
const ignoredResult = await controller.validateAccess("./config.secret")
|
||||
ignoredResult.should.be.false()
|
||||
|
||||
// Test relative path in ignored directory (private/)
|
||||
const ignoredDirResult = await controller.validateAccess("./private/data.txt")
|
||||
ignoredDirResult.should.be.false()
|
||||
})
|
||||
|
||||
it("should normalize paths with backslashes", async () => {
|
||||
const result = await controller.validateAccess("src\\file.ts")
|
||||
result.should.be.true()
|
||||
})
|
||||
|
||||
it("should handle paths outside cwd", async () => {
|
||||
// Create a path that points to parent directory of cwd
|
||||
const outsidePath = path.join(path.dirname(tempDir), "outside.txt")
|
||||
const result = await controller.validateAccess(outsidePath)
|
||||
|
||||
// Should return false for security since path is outside cwd
|
||||
result.should.be.false()
|
||||
|
||||
// Test with a deeply nested path outside cwd
|
||||
const deepOutsidePath = path.join(path.dirname(tempDir), "deep", "nested", "outside.secret")
|
||||
const deepResult = await controller.validateAccess(deepOutsidePath)
|
||||
deepResult.should.be.false()
|
||||
|
||||
// Test with a path that tries to escape using ../
|
||||
const escapeAttemptPath = path.join(tempDir, "..", "escape-attempt.txt")
|
||||
const escapeResult = await controller.validateAccess(escapeAttemptPath)
|
||||
escapeResult.should.be.false()
|
||||
})
|
||||
})
|
||||
|
||||
describe("Batch Filtering", () => {
|
||||
it("should filter an array of paths", async () => {
|
||||
const paths = ["src/index.ts", ".env", "lib/utils.ts", ".git/config", "dist/bundle.js"]
|
||||
|
||||
const filtered = controller.filterPaths(paths)
|
||||
filtered.should.deepEqual(["src/index.ts", "lib/utils.ts", "dist/bundle.js"])
|
||||
})
|
||||
})
|
||||
|
||||
describe("Error Handling", () => {
|
||||
it("should handle invalid paths", async () => {
|
||||
// Test with an invalid path containing null byte
|
||||
const result = await controller.validateAccess("\0invalid")
|
||||
result.should.be.true()
|
||||
})
|
||||
|
||||
it("should handle missing .clineignore gracefully", async () => {
|
||||
// Create a new controller in a directory without .clineignore
|
||||
const emptyDir = path.join(os.tmpdir(), `llm-test-empty-${Date.now()}`)
|
||||
await fs.mkdir(emptyDir)
|
||||
|
||||
try {
|
||||
const controller = new LLMFileAccessController(emptyDir)
|
||||
await controller.initialize()
|
||||
const result = await controller.validateAccess("file.txt")
|
||||
result.should.be.true()
|
||||
} finally {
|
||||
await fs.rm(emptyDir, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
|
||||
it("should handle empty .clineignore", async () => {
|
||||
await fs.writeFile(path.join(tempDir, ".clineignore"), "")
|
||||
|
||||
controller = new LLMFileAccessController(tempDir)
|
||||
await controller.initialize()
|
||||
|
||||
const result = await controller.validateAccess("regular-file.txt")
|
||||
result.should.be.true()
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,100 @@
|
||||
import path from "path"
|
||||
import { fileExistsAtPath } from "../../utils/fs"
|
||||
import fs from "fs/promises"
|
||||
import ignore, { Ignore } from "ignore"
|
||||
|
||||
/**
|
||||
* Controls LLM access to files by enforcing ignore patterns.
|
||||
* Designed to be instantiated once in Cline.ts and passed to file manipulation services.
|
||||
* Uses the 'ignore' library to support standard .gitignore syntax in .clineignore files.
|
||||
*/
|
||||
export class LLMFileAccessController {
|
||||
private cwd: string
|
||||
private ignoreInstance: Ignore
|
||||
|
||||
/**
|
||||
* Default patterns that are always ignored for security
|
||||
*/
|
||||
private static readonly DEFAULT_PATTERNS = [] // empty for now
|
||||
|
||||
constructor(cwd: string) {
|
||||
this.cwd = cwd
|
||||
this.ignoreInstance = ignore()
|
||||
|
||||
// Add default patterns immediately
|
||||
this.ignoreInstance.add(LLMFileAccessController.DEFAULT_PATTERNS)
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the controller by loading custom patterns
|
||||
* This must be called and awaited before using the controller
|
||||
*/
|
||||
async initialize(): Promise<void> {
|
||||
await this.loadCustomPatterns()
|
||||
}
|
||||
|
||||
/**
|
||||
* Load custom patterns from .clineignore if it exists
|
||||
*/
|
||||
private async loadCustomPatterns(): Promise<void> {
|
||||
try {
|
||||
const ignorePath = path.join(this.cwd, ".clineignore")
|
||||
if (await fileExistsAtPath(ignorePath)) {
|
||||
const content = await fs.readFile(ignorePath, "utf8")
|
||||
const customPatterns = content
|
||||
.split("\n")
|
||||
.map((line) => line.trim())
|
||||
.filter((line) => line && !line.startsWith("#"))
|
||||
|
||||
this.ignoreInstance.add(customPatterns)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Failed to load .clineignore:", error)
|
||||
// Continue with default patterns
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a file should be accessible to the LLM
|
||||
* @param filePath - Path to check (relative to cwd)
|
||||
* @returns true if file is accessible, false if ignored
|
||||
*/
|
||||
validateAccess(filePath: string): boolean {
|
||||
try {
|
||||
// Normalize path to be relative to cwd and use forward slashes
|
||||
const absolutePath = path.resolve(this.cwd, filePath)
|
||||
const relativePath = path.relative(this.cwd, absolutePath).replace(/\\/g, "/")
|
||||
|
||||
// Block access to paths outside cwd (those starting with '..')
|
||||
if (relativePath.startsWith("..")) {
|
||||
return false
|
||||
}
|
||||
|
||||
// Use ignore library to check if path should be ignored
|
||||
return !this.ignoreInstance.ignores(relativePath)
|
||||
} catch (error) {
|
||||
console.error(`Error validating access for ${filePath}:`, error)
|
||||
return false // Fail closed for security
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter an array of paths, removing those that should be ignored
|
||||
* @param paths - Array of paths to filter (relative to cwd)
|
||||
* @returns Array of allowed paths
|
||||
*/
|
||||
filterPaths(paths: string[]): string[] {
|
||||
try {
|
||||
return paths
|
||||
.map((p) => ({
|
||||
path: p,
|
||||
allowed: this.validateAccess(p),
|
||||
}))
|
||||
.filter((x) => x.allowed)
|
||||
.map((x) => x.path)
|
||||
} catch (error) {
|
||||
console.error("Error filtering paths:", error)
|
||||
return [] // Fail closed for security
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import type { OutputChannel } from "vscode"
|
||||
|
||||
/**
|
||||
* Simple logging utility for the extension's backend code.
|
||||
* Uses VS Code's OutputChannel which must be initialized from extension.ts
|
||||
* to ensure proper registration with the extension context.
|
||||
*/
|
||||
export class Logger {
|
||||
private static outputChannel: OutputChannel
|
||||
|
||||
static initialize(outputChannel: OutputChannel) {
|
||||
Logger.outputChannel = outputChannel
|
||||
}
|
||||
|
||||
static log(message: string) {
|
||||
Logger.outputChannel.appendLine(message)
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ export class McpHub {
|
||||
}
|
||||
|
||||
getMode(): McpMode {
|
||||
return vscode.workspace.getConfiguration("cline.mcp").get<McpMode>("mode", "enabled")
|
||||
return vscode.workspace.getConfiguration("cline.mcp").get<McpMode>("mode", "full")
|
||||
}
|
||||
|
||||
async getMcpServersPath(): Promise<string> {
|
||||
|
||||
@@ -25,6 +25,7 @@ export interface ExtensionMessage {
|
||||
| "relinquishControl"
|
||||
| "vsCodeLmModels"
|
||||
| "requestVsCodeLmModels"
|
||||
| "emailSubscribed"
|
||||
text?: string
|
||||
action?:
|
||||
| "chatButtonClicked"
|
||||
@@ -60,7 +61,6 @@ export interface ExtensionState {
|
||||
autoApprovalSettings: AutoApprovalSettings
|
||||
browserSettings: BrowserSettings
|
||||
chatSettings: ChatSettings
|
||||
localeLanguage: string
|
||||
isLoggedIn: boolean
|
||||
userInfo?: {
|
||||
displayName: string | null
|
||||
@@ -75,6 +75,7 @@ export interface ClineMessage {
|
||||
ask?: ClineAsk
|
||||
say?: ClineSay
|
||||
text?: string
|
||||
reasoning?: string
|
||||
images?: string[]
|
||||
partial?: boolean
|
||||
lastCheckpointHash?: string
|
||||
@@ -103,6 +104,7 @@ export type ClineSay =
|
||||
| "api_req_started"
|
||||
| "api_req_finished"
|
||||
| "text"
|
||||
| "reasoning"
|
||||
| "completion_result"
|
||||
| "user_feedback"
|
||||
| "user_feedback_diff"
|
||||
|
||||
@@ -41,6 +41,7 @@ export interface WebviewMessage {
|
||||
| "getLatestState"
|
||||
| "accountLoginClicked"
|
||||
| "accountLogoutClicked"
|
||||
| "subscribeEmail"
|
||||
// | "relaunchChromeDebugMode"
|
||||
text?: string
|
||||
disabled?: boolean
|
||||
|
||||
@@ -344,6 +344,14 @@ export const geminiModels = {
|
||||
export type OpenAiNativeModelId = keyof typeof openAiNativeModels
|
||||
export const openAiNativeDefaultModelId: OpenAiNativeModelId = "gpt-4o"
|
||||
export const openAiNativeModels = {
|
||||
"o3-mini": {
|
||||
maxTokens: 100_000,
|
||||
contextWindow: 200_000,
|
||||
supportsImages: false,
|
||||
supportsPromptCache: false,
|
||||
inputPrice: 1.1,
|
||||
outputPrice: 4.4,
|
||||
},
|
||||
// don't support tool use yet
|
||||
o1: {
|
||||
maxTokens: 100_000,
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
export type McpMode = "enabled" | "mcp-tools-only" | "disabled"
|
||||
export type McpMode = "full" | "server-use-only" | "off"
|
||||
|
||||
export type McpServer = {
|
||||
name: string
|
||||
|
||||
@@ -0,0 +1,235 @@
|
||||
import { describe, it, beforeEach, afterEach } from "mocha"
|
||||
import { expect } from "chai"
|
||||
import { getShell } from "../utils/shell"
|
||||
import * as vscode from "vscode"
|
||||
import { userInfo } from "os"
|
||||
|
||||
describe("Shell Detection Tests", () => {
|
||||
let originalPlatform: string
|
||||
let originalEnv: NodeJS.ProcessEnv
|
||||
let originalGetConfig: any
|
||||
let originalUserInfo: any
|
||||
|
||||
// Helper to mock VS Code configuration
|
||||
function mockVsCodeConfig(platformKey: string, defaultProfileName: string | null, profiles: Record<string, any>) {
|
||||
vscode.workspace.getConfiguration = () =>
|
||||
({
|
||||
get: (key: string) => {
|
||||
if (key === `defaultProfile.${platformKey}`) {
|
||||
return defaultProfileName
|
||||
}
|
||||
if (key === `profiles.${platformKey}`) {
|
||||
return profiles
|
||||
}
|
||||
return undefined
|
||||
},
|
||||
}) as any
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
// Store original references
|
||||
originalPlatform = process.platform
|
||||
originalEnv = { ...process.env }
|
||||
originalGetConfig = vscode.workspace.getConfiguration
|
||||
originalUserInfo = userInfo
|
||||
|
||||
// Clear environment variables for a clean test
|
||||
delete process.env.SHELL
|
||||
delete process.env.COMSPEC
|
||||
|
||||
// Default userInfo() mock
|
||||
;(userInfo as any) = () => ({ shell: null })
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
// Restore everything
|
||||
Object.defineProperty(process, "platform", { value: originalPlatform })
|
||||
process.env = originalEnv
|
||||
vscode.workspace.getConfiguration = originalGetConfig
|
||||
;(userInfo as any) = originalUserInfo
|
||||
})
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Windows Shell Detection
|
||||
// --------------------------------------------------------------------------
|
||||
describe("Windows Shell Detection", () => {
|
||||
beforeEach(() => {
|
||||
Object.defineProperty(process, "platform", { value: "win32" })
|
||||
})
|
||||
|
||||
it("uses explicit PowerShell 7 path from VS Code config (profile path)", () => {
|
||||
mockVsCodeConfig("windows", "PowerShell", {
|
||||
PowerShell: { path: "C:\\Program Files\\PowerShell\\7\\pwsh.exe" },
|
||||
})
|
||||
expect(getShell()).to.equal("C:\\Program Files\\PowerShell\\7\\pwsh.exe")
|
||||
})
|
||||
|
||||
it("uses PowerShell 7 path if source is 'PowerShell' but no explicit path", () => {
|
||||
mockVsCodeConfig("windows", "PowerShell", {
|
||||
PowerShell: { source: "PowerShell" },
|
||||
})
|
||||
expect(getShell()).to.equal("C:\\Program Files\\PowerShell\\7\\pwsh.exe")
|
||||
})
|
||||
|
||||
it("falls back to legacy PowerShell if profile includes 'powershell' but no path/source", () => {
|
||||
mockVsCodeConfig("windows", "PowerShell", {
|
||||
PowerShell: {},
|
||||
})
|
||||
expect(getShell()).to.equal("C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe")
|
||||
})
|
||||
|
||||
it("uses WSL bash when profile indicates WSL source", () => {
|
||||
mockVsCodeConfig("windows", "WSL", {
|
||||
WSL: { source: "WSL" },
|
||||
})
|
||||
expect(getShell()).to.equal("/bin/bash")
|
||||
})
|
||||
|
||||
it("uses WSL bash when profile name includes 'wsl'", () => {
|
||||
mockVsCodeConfig("windows", "Ubuntu WSL", {
|
||||
"Ubuntu WSL": {},
|
||||
})
|
||||
expect(getShell()).to.equal("/bin/bash")
|
||||
})
|
||||
|
||||
it("defaults to cmd.exe if no special profile is matched", () => {
|
||||
mockVsCodeConfig("windows", "CommandPrompt", {
|
||||
CommandPrompt: {},
|
||||
})
|
||||
expect(getShell()).to.equal("C:\\Windows\\System32\\cmd.exe")
|
||||
})
|
||||
|
||||
it("respects userInfo() if no VS Code config is available", () => {
|
||||
vscode.workspace.getConfiguration = () => ({ get: () => undefined }) as any
|
||||
;(userInfo as any) = () => ({ shell: "C:\\Custom\\PowerShell.exe" })
|
||||
|
||||
expect(getShell()).to.equal("C:\\Custom\\PowerShell.exe")
|
||||
})
|
||||
|
||||
it("respects an odd COMSPEC if no userInfo shell is available", () => {
|
||||
vscode.workspace.getConfiguration = () => ({ get: () => undefined }) as any
|
||||
process.env.COMSPEC = "D:\\CustomCmd\\cmd.exe"
|
||||
|
||||
expect(getShell()).to.equal("D:\\CustomCmd\\cmd.exe")
|
||||
})
|
||||
})
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// macOS Shell Detection
|
||||
// --------------------------------------------------------------------------
|
||||
describe("macOS Shell Detection", () => {
|
||||
beforeEach(() => {
|
||||
Object.defineProperty(process, "platform", { value: "darwin" })
|
||||
})
|
||||
|
||||
it("uses VS Code profile path if available", () => {
|
||||
mockVsCodeConfig("osx", "MyCustomShell", {
|
||||
MyCustomShell: { path: "/usr/local/bin/fish" },
|
||||
})
|
||||
expect(getShell()).to.equal("/usr/local/bin/fish")
|
||||
})
|
||||
|
||||
it("falls back to userInfo().shell if no VS Code config is available", () => {
|
||||
vscode.workspace.getConfiguration = () => ({ get: () => undefined }) as any
|
||||
;(userInfo as any) = () => ({ shell: "/opt/homebrew/bin/zsh" })
|
||||
|
||||
expect(getShell()).to.equal("/opt/homebrew/bin/zsh")
|
||||
})
|
||||
|
||||
it("falls back to SHELL env var if no userInfo shell is found", () => {
|
||||
vscode.workspace.getConfiguration = () => ({ get: () => undefined }) as any
|
||||
process.env.SHELL = "/usr/local/bin/zsh"
|
||||
|
||||
expect(getShell()).to.equal("/usr/local/bin/zsh")
|
||||
})
|
||||
|
||||
it("falls back to /bin/zsh if no config, userInfo, or env variable is set", () => {
|
||||
vscode.workspace.getConfiguration = () => ({ get: () => undefined }) as any
|
||||
// userInfo => null, SHELL => undefined
|
||||
expect(getShell()).to.equal("/bin/zsh")
|
||||
})
|
||||
})
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Linux Shell Detection
|
||||
// --------------------------------------------------------------------------
|
||||
describe("Linux Shell Detection", () => {
|
||||
beforeEach(() => {
|
||||
Object.defineProperty(process, "platform", { value: "linux" })
|
||||
})
|
||||
|
||||
it("uses VS Code profile path if available", () => {
|
||||
mockVsCodeConfig("linux", "CustomProfile", {
|
||||
CustomProfile: { path: "/usr/bin/fish" },
|
||||
})
|
||||
expect(getShell()).to.equal("/usr/bin/fish")
|
||||
})
|
||||
|
||||
it("falls back to userInfo().shell if no VS Code config is available", () => {
|
||||
vscode.workspace.getConfiguration = () => ({ get: () => undefined }) as any
|
||||
;(userInfo as any) = () => ({ shell: "/usr/bin/zsh" })
|
||||
|
||||
expect(getShell()).to.equal("/usr/bin/zsh")
|
||||
})
|
||||
|
||||
it("falls back to SHELL env var if no userInfo shell is found", () => {
|
||||
vscode.workspace.getConfiguration = () => ({ get: () => undefined }) as any
|
||||
process.env.SHELL = "/usr/bin/fish"
|
||||
|
||||
expect(getShell()).to.equal("/usr/bin/fish")
|
||||
})
|
||||
|
||||
it("falls back to /bin/bash if nothing is set", () => {
|
||||
vscode.workspace.getConfiguration = () => ({ get: () => undefined }) as any
|
||||
// userInfo => null, SHELL => undefined
|
||||
expect(getShell()).to.equal("/bin/bash")
|
||||
})
|
||||
})
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Unknown Platform & Error Handling
|
||||
// --------------------------------------------------------------------------
|
||||
describe("Unknown Platform / Error Handling", () => {
|
||||
it("falls back to /bin/sh for unknown platforms", () => {
|
||||
Object.defineProperty(process, "platform", { value: "sunos" })
|
||||
vscode.workspace.getConfiguration = () => ({ get: () => undefined }) as any
|
||||
|
||||
expect(getShell()).to.equal("/bin/sh")
|
||||
})
|
||||
|
||||
it("handles VS Code config errors gracefully, falling back to userInfo shell if present", () => {
|
||||
Object.defineProperty(process, "platform", { value: "linux" })
|
||||
vscode.workspace.getConfiguration = () => {
|
||||
throw new Error("Configuration error")
|
||||
}
|
||||
;(userInfo as any) = () => ({ shell: "/bin/bash" })
|
||||
|
||||
expect(getShell()).to.equal("/bin/bash")
|
||||
})
|
||||
|
||||
it("handles userInfo errors gracefully, falling back to environment variable if present", () => {
|
||||
Object.defineProperty(process, "platform", { value: "darwin" })
|
||||
vscode.workspace.getConfiguration = () => ({ get: () => undefined }) as any
|
||||
;(userInfo as any) = () => {
|
||||
throw new Error("userInfo error")
|
||||
}
|
||||
process.env.SHELL = "/bin/zsh"
|
||||
|
||||
expect(getShell()).to.equal("/bin/zsh")
|
||||
})
|
||||
|
||||
it("falls back fully to default shell paths if everything fails", () => {
|
||||
Object.defineProperty(process, "platform", { value: "linux" })
|
||||
vscode.workspace.getConfiguration = () => {
|
||||
throw new Error("Configuration error")
|
||||
}
|
||||
;(userInfo as any) = () => {
|
||||
throw new Error("userInfo error")
|
||||
}
|
||||
// No SHELL in env
|
||||
delete process.env.SHELL
|
||||
|
||||
expect(getShell()).to.equal("/bin/bash")
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,227 @@
|
||||
import * as vscode from "vscode"
|
||||
import { userInfo } from "os"
|
||||
|
||||
const SHELL_PATHS = {
|
||||
// Windows paths
|
||||
POWERSHELL_7: "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
|
||||
POWERSHELL_LEGACY: "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
|
||||
CMD: "C:\\Windows\\System32\\cmd.exe",
|
||||
WSL_BASH: "/bin/bash",
|
||||
// Unix paths
|
||||
MAC_DEFAULT: "/bin/zsh",
|
||||
LINUX_DEFAULT: "/bin/bash",
|
||||
CSH: "/bin/csh",
|
||||
BASH: "/bin/bash",
|
||||
KSH: "/bin/ksh",
|
||||
SH: "/bin/sh",
|
||||
ZSH: "/bin/zsh",
|
||||
DASH: "/bin/dash",
|
||||
TCSH: "/bin/tcsh",
|
||||
FALLBACK: "/bin/sh",
|
||||
} as const
|
||||
|
||||
interface MacTerminalProfile {
|
||||
path?: string
|
||||
}
|
||||
|
||||
type MacTerminalProfiles = Record<string, MacTerminalProfile>
|
||||
|
||||
interface WindowsTerminalProfile {
|
||||
path?: string
|
||||
source?: "PowerShell" | "WSL"
|
||||
}
|
||||
|
||||
type WindowsTerminalProfiles = Record<string, WindowsTerminalProfile>
|
||||
|
||||
interface LinuxTerminalProfile {
|
||||
path?: string
|
||||
}
|
||||
|
||||
type LinuxTerminalProfiles = Record<string, LinuxTerminalProfile>
|
||||
|
||||
// -----------------------------------------------------
|
||||
// 1) VS Code Terminal Configuration Helpers
|
||||
// -----------------------------------------------------
|
||||
|
||||
function getWindowsTerminalConfig() {
|
||||
try {
|
||||
const config = vscode.workspace.getConfiguration("terminal.integrated")
|
||||
const defaultProfileName = config.get<string>("defaultProfile.windows")
|
||||
const profiles = config.get<WindowsTerminalProfiles>("profiles.windows") || {}
|
||||
return { defaultProfileName, profiles }
|
||||
} catch {
|
||||
return { defaultProfileName: null, profiles: {} as WindowsTerminalProfiles }
|
||||
}
|
||||
}
|
||||
|
||||
function getMacTerminalConfig() {
|
||||
try {
|
||||
const config = vscode.workspace.getConfiguration("terminal.integrated")
|
||||
const defaultProfileName = config.get<string>("defaultProfile.osx")
|
||||
const profiles = config.get<MacTerminalProfiles>("profiles.osx") || {}
|
||||
return { defaultProfileName, profiles }
|
||||
} catch {
|
||||
return { defaultProfileName: null, profiles: {} as MacTerminalProfiles }
|
||||
}
|
||||
}
|
||||
|
||||
function getLinuxTerminalConfig() {
|
||||
try {
|
||||
const config = vscode.workspace.getConfiguration("terminal.integrated")
|
||||
const defaultProfileName = config.get<string>("defaultProfile.linux")
|
||||
const profiles = config.get<LinuxTerminalProfiles>("profiles.linux") || {}
|
||||
return { defaultProfileName, profiles }
|
||||
} catch {
|
||||
return { defaultProfileName: null, profiles: {} as LinuxTerminalProfiles }
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------
|
||||
// 2) Platform-Specific VS Code Shell Retrieval
|
||||
// -----------------------------------------------------
|
||||
|
||||
/** Attempts to retrieve a shell path from VS Code config on Windows. */
|
||||
function getWindowsShellFromVSCode(): string | null {
|
||||
const { defaultProfileName, profiles } = getWindowsTerminalConfig()
|
||||
if (!defaultProfileName) {
|
||||
return null
|
||||
}
|
||||
|
||||
const profile = profiles[defaultProfileName]
|
||||
|
||||
// If the profile name indicates PowerShell, do version-based detection.
|
||||
// In testing it was found these typically do not have a path, and this
|
||||
// implementation manages to deductively get the corect version of PowerShell
|
||||
if (defaultProfileName.toLowerCase().includes("powershell")) {
|
||||
if (profile?.path) {
|
||||
// If there's an explicit PowerShell path, return that
|
||||
return profile.path
|
||||
} else if (profile?.source === "PowerShell") {
|
||||
// If the profile is sourced from PowerShell, assume the newest
|
||||
return SHELL_PATHS.POWERSHELL_7
|
||||
}
|
||||
// Otherwise, assume legacy Windows PowerShell
|
||||
return SHELL_PATHS.POWERSHELL_LEGACY
|
||||
}
|
||||
|
||||
// If there's a specific path, return that immediately
|
||||
if (profile.path) {
|
||||
return profile.path
|
||||
}
|
||||
|
||||
// If the profile indicates WSL
|
||||
if (profile?.source === "WSL" || defaultProfileName.toLowerCase().includes("wsl")) {
|
||||
return SHELL_PATHS.WSL_BASH
|
||||
}
|
||||
|
||||
// If nothing special detected, we assume cmd
|
||||
return SHELL_PATHS.CMD
|
||||
}
|
||||
|
||||
/** Attempts to retrieve a shell path from VS Code config on macOS. */
|
||||
function getMacShellFromVSCode(): string | null {
|
||||
const { defaultProfileName, profiles } = getMacTerminalConfig()
|
||||
if (!defaultProfileName) {
|
||||
return null
|
||||
}
|
||||
|
||||
const profile = profiles[defaultProfileName]
|
||||
return profile?.path || null
|
||||
}
|
||||
|
||||
/** Attempts to retrieve a shell path from VS Code config on Linux. */
|
||||
function getLinuxShellFromVSCode(): string | null {
|
||||
const { defaultProfileName, profiles } = getLinuxTerminalConfig()
|
||||
if (!defaultProfileName) {
|
||||
return null
|
||||
}
|
||||
|
||||
const profile = profiles[defaultProfileName]
|
||||
return profile?.path || null
|
||||
}
|
||||
|
||||
// -----------------------------------------------------
|
||||
// 3) General Fallback Helpers
|
||||
// -----------------------------------------------------
|
||||
|
||||
/**
|
||||
* Tries to get a user’s shell from os.userInfo() (works on Unix if the
|
||||
* underlying system call is supported). Returns null on error or if not found.
|
||||
*/
|
||||
function getShellFromUserInfo(): string | null {
|
||||
try {
|
||||
const { shell } = userInfo()
|
||||
return shell || null
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the environment-based shell variable, or null if not set. */
|
||||
function getShellFromEnv(): string | null {
|
||||
const { env } = process
|
||||
|
||||
if (process.platform === "win32") {
|
||||
// On Windows, COMSPEC typically holds cmd.exe
|
||||
return env.COMSPEC || "C:\\Windows\\System32\\cmd.exe"
|
||||
}
|
||||
|
||||
if (process.platform === "darwin") {
|
||||
// On macOS/Linux, SHELL is commonly the environment variable
|
||||
return env.SHELL || "/bin/zsh"
|
||||
}
|
||||
|
||||
if (process.platform === "linux") {
|
||||
// On Linux, SHELL is commonly the environment variable
|
||||
return env.SHELL || "/bin/bash"
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
// -----------------------------------------------------
|
||||
// 4) Publicly Exposed Shell Getter
|
||||
// -----------------------------------------------------
|
||||
|
||||
export function getShell(): string {
|
||||
// 1. Check VS Code config first.
|
||||
if (process.platform === "win32") {
|
||||
// Special logic for Windows
|
||||
const windowsShell = getWindowsShellFromVSCode()
|
||||
if (windowsShell) {
|
||||
return windowsShell
|
||||
}
|
||||
} else if (process.platform === "darwin") {
|
||||
// macOS from VS Code
|
||||
const macShell = getMacShellFromVSCode()
|
||||
if (macShell) {
|
||||
return macShell
|
||||
}
|
||||
} else if (process.platform === "linux") {
|
||||
// Linux from VS Code
|
||||
const linuxShell = getLinuxShellFromVSCode()
|
||||
if (linuxShell) {
|
||||
return linuxShell
|
||||
}
|
||||
}
|
||||
|
||||
// 2. If no shell from VS Code, try userInfo()
|
||||
const userInfoShell = getShellFromUserInfo()
|
||||
if (userInfoShell) {
|
||||
return userInfoShell
|
||||
}
|
||||
|
||||
// 3. If still nothing, try environment variable
|
||||
const envShell = getShellFromEnv()
|
||||
if (envShell) {
|
||||
return envShell
|
||||
}
|
||||
|
||||
// 4. Finally, fall back to a default
|
||||
if (process.platform === "win32") {
|
||||
// On Windows, if we got here, we have no config, no COMSPEC, and one very messed up operating system.
|
||||
// Use CMD as a last resort
|
||||
return SHELL_PATHS.CMD
|
||||
}
|
||||
// On macOS/Linux, fallback to a POSIX shell - This is the behavior of our old shell detection method.
|
||||
return SHELL_PATHS.FALLBACK
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// "Official" jest workaround for mocking window.matchMedia()
|
||||
// https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
|
||||
|
||||
Object.defineProperty(window, "matchMedia", {
|
||||
writable: true,
|
||||
value: vi.fn().mockImplementation((query) => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addListener: vi.fn(), // Deprecated
|
||||
removeListener: vi.fn(), // Deprecated
|
||||
addEventListener: vi.fn(),
|
||||
removeEventListener: vi.fn(),
|
||||
dispatchEvent: vi.fn(),
|
||||
})),
|
||||
})
|
||||
Generated
+1890
-373
File diff suppressed because it is too large
Load Diff
+12
-10
@@ -3,13 +3,6 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@testing-library/jest-dom": "^5.17.0",
|
||||
"@testing-library/react": "^13.4.0",
|
||||
"@testing-library/user-event": "^13.5.0",
|
||||
"@types/jest": "^27.5.2",
|
||||
"@types/node": "^16.18.101",
|
||||
"@types/react": "^18.3.3",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"@vscode/webview-ui-toolkit": "^1.4.0",
|
||||
"debounce": "^2.1.1",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
@@ -17,7 +10,6 @@
|
||||
"pretty-bytes": "^6.1.1",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-i18next": "^15.4.0",
|
||||
"react-remark": "^2.1.0",
|
||||
"react-scripts": "^5.0.1",
|
||||
"react-textarea-autosize": "^8.5.3",
|
||||
@@ -35,7 +27,8 @@
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "node ./scripts/build-react-no-split.js",
|
||||
"test": "react-scripts test",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest dev",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
@@ -57,6 +50,15 @@
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/vscode-webview": "^1.57.5"
|
||||
"@testing-library/jest-dom": "^5.17.0",
|
||||
"@testing-library/react": "^15.0.6",
|
||||
"@testing-library/user-event": "^13.5.0",
|
||||
"@types/vscode-webview": "^1.57.5",
|
||||
"@types/jest": "^27.5.2",
|
||||
"@types/node": "^20.x",
|
||||
"@types/react": "^18.3.3",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"jsdom": "^25.0.1",
|
||||
"vitest": "^2.1.8"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
import "@testing-library/jest-dom"
|
||||
import "./matchMedia"
|
||||
@@ -9,11 +9,9 @@ import AccountView from "./components/account/AccountView"
|
||||
import { ExtensionStateContextProvider, useExtensionState } from "./context/ExtensionStateContext"
|
||||
import { vscode } from "./utils/vscode"
|
||||
import McpView from "./components/mcp/McpView"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
const AppContent = () => {
|
||||
const { didHydrateState, showWelcome, shouldShowAnnouncement, localeLanguage } = useExtensionState()
|
||||
const { i18n } = useTranslation()
|
||||
const { didHydrateState, showWelcome, shouldShowAnnouncement } = useExtensionState()
|
||||
const [showSettings, setShowSettings] = useState(false)
|
||||
const [showHistory, setShowHistory] = useState(false)
|
||||
const [showMcp, setShowMcp] = useState(false)
|
||||
@@ -69,12 +67,6 @@ const AppContent = () => {
|
||||
}
|
||||
}, [shouldShowAnnouncement])
|
||||
|
||||
useEffect(() => {
|
||||
if (localeLanguage) {
|
||||
i18n.changeLanguage(localeLanguage)
|
||||
}
|
||||
}, [i18n, localeLanguage])
|
||||
|
||||
if (!didHydrateState) {
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { VSCodeButton, VSCodeLink } from "@vscode/webview-ui-toolkit/react"
|
||||
import { memo } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { Trans } from "react-i18next"
|
||||
import { getAsVar, VSC_DESCRIPTION_FOREGROUND, VSC_INACTIVE_SELECTION_BACKGROUND } from "../../utils/vscStyles"
|
||||
|
||||
interface AnnouncementProps {
|
||||
@@ -13,8 +11,6 @@ interface AnnouncementProps {
|
||||
You must update the latestAnnouncementId in ClineProvider for new announcements to show to users. This new id will be compared with whats in state for the 'last announcement shown', and if it's different then the announcement will render. As soon as an announcement is shown, the id will be updated in state. This ensures that announcements are not shown more than once, even if the user doesn't close it themselves.
|
||||
*/
|
||||
const Announcement = ({ version, hideAnnouncement }: AnnouncementProps) => {
|
||||
const { t } = useTranslation("translation", { keyPrefix: "announcement" })
|
||||
|
||||
const minorVersion = version.split(".").slice(0, 2).join(".") // 2.0.0 -> 2.0
|
||||
return (
|
||||
<div
|
||||
@@ -29,7 +25,9 @@ const Announcement = ({ version, hideAnnouncement }: AnnouncementProps) => {
|
||||
<VSCodeButton appearance="icon" onClick={hideAnnouncement} style={{ position: "absolute", top: "8px", right: "8px" }}>
|
||||
<span className="codicon codicon-close"></span>
|
||||
</VSCodeButton>
|
||||
<h3 style={{ margin: "0 0 8px" }}>{t("newInVersion", { version: minorVersion })}</h3>
|
||||
<h3 style={{ margin: "0 0 8px" }}>
|
||||
🎉{" "}New in v{minorVersion}
|
||||
</h3>
|
||||
<ul style={{ margin: "0 0 8px", paddingLeft: "12px" }}>
|
||||
<li>
|
||||
<b>Plan/Act mode toggle:</b> Plan mode turns Cline into an architect that gathers information, asks clarifying
|
||||
@@ -111,13 +109,15 @@ const Announcement = ({ version, hideAnnouncement }: AnnouncementProps) => {
|
||||
}}
|
||||
/>
|
||||
<p style={{ margin: "0" }}>
|
||||
<Trans
|
||||
i18nKey="announcement.joinOurCommunities"
|
||||
components={{
|
||||
DiscordLink: <VSCodeLink href="https://discord.gg/cline" />,
|
||||
RedditLink: <VSCodeLink href="https://www.reddit.com/r/cline/" />,
|
||||
}}
|
||||
/>
|
||||
Join our{" "}
|
||||
<VSCodeLink style={{ display: "inline" }} href="https://discord.gg/cline">
|
||||
discord
|
||||
</VSCodeLink>{" "}
|
||||
or{" "}
|
||||
<VSCodeLink style={{ display: "inline" }} href="https://www.reddit.com/r/cline/">
|
||||
r/cline
|
||||
</VSCodeLink>
|
||||
for more updates!
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -169,7 +169,7 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
|
||||
// }}
|
||||
onClick={(e) => {
|
||||
/*
|
||||
vscode web toolkit bug: when changing the value of a vscodecheckbox programatically, it will call its onChange with stale state. This led to updateEnabled being called with an old vesion of autoApprovalSettings, effectively undoing the state change that was triggered by the last action being unchecked. A simple workaround is to just not use onChange and intead use onClick. We are lucky this is a checkbox and the newvalue is simply opposite of current state.
|
||||
vscode web toolkit bug: when changing the value of a vscodecheckbox programmatically, it will call its onChange with stale state. This led to updateEnabled being called with an old version of autoApprovalSettings, effectively undoing the state change that was triggered by the last action being unchecked. A simple workaround is to just not use onChange and instead use onClick. We are lucky this is a checkbox and the newvalue is simply opposite of current state.
|
||||
*/
|
||||
if (!hasEnabledActions) return
|
||||
e.stopPropagation() // stops click from bubbling up to the parent, in this case stopping the expanding/collapsing
|
||||
|
||||
@@ -765,7 +765,7 @@ export const ChatRowContent = ({ message, isExpanded, onToggleExpand, lastModifi
|
||||
}}>
|
||||
{icon}
|
||||
{title}
|
||||
{/* Need to render this everytime since it affects height of row by 2px */}
|
||||
{/* Need to render this every time since it affects height of row by 2px */}
|
||||
<VSCodeBadge
|
||||
style={{
|
||||
opacity: cost != null && cost > 0 ? 1 : 0,
|
||||
@@ -891,6 +891,62 @@ export const ChatRowContent = ({ message, isExpanded, onToggleExpand, lastModifi
|
||||
<Markdown markdown={message.text} />
|
||||
</div>
|
||||
)
|
||||
case "reasoning":
|
||||
return (
|
||||
<>
|
||||
{message.text && (
|
||||
<div
|
||||
onClick={onToggleExpand}
|
||||
style={{
|
||||
// marginBottom: 15,
|
||||
cursor: "pointer",
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
|
||||
fontStyle: "italic",
|
||||
overflow: "hidden",
|
||||
}}>
|
||||
{isExpanded ? (
|
||||
<div style={{ marginTop: -3 }}>
|
||||
<span style={{ fontWeight: "bold", display: "block", marginBottom: "4px" }}>
|
||||
Reasoning
|
||||
<span
|
||||
className="codicon codicon-chevron-down"
|
||||
style={{
|
||||
display: "inline-block",
|
||||
transform: "translateY(3px)",
|
||||
marginLeft: "1.5px",
|
||||
}}
|
||||
/>
|
||||
</span>
|
||||
{message.text}
|
||||
</div>
|
||||
) : (
|
||||
<div style={{ display: "flex", alignItems: "center" }}>
|
||||
<span style={{ fontWeight: "bold", marginRight: "4px" }}>Reasoning:</span>
|
||||
<span
|
||||
style={{
|
||||
whiteSpace: "nowrap",
|
||||
overflow: "hidden",
|
||||
textOverflow: "ellipsis",
|
||||
direction: "rtl",
|
||||
textAlign: "left",
|
||||
flex: 1,
|
||||
}}>
|
||||
{message.text + "\u200E"}
|
||||
</span>
|
||||
<span
|
||||
className="codicon codicon-chevron-right"
|
||||
style={{
|
||||
marginLeft: "4px",
|
||||
flexShrink: 0,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
case "user_feedback":
|
||||
return (
|
||||
<div
|
||||
|
||||
@@ -4,7 +4,6 @@ import DynamicTextArea from "react-textarea-autosize"
|
||||
import { useClickAway, useWindowSize } from "react-use"
|
||||
import styled from "styled-components"
|
||||
import { mentionRegex, mentionRegexGlobal } from "../../../../src/shared/context-mentions"
|
||||
import { ExtensionMessage } from "../../../../src/shared/ExtensionMessage"
|
||||
import { useExtensionState } from "../../context/ExtensionStateContext"
|
||||
import {
|
||||
ContextMenuOptionType,
|
||||
@@ -378,7 +377,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
||||
charBeforeCursor === " " || charBeforeCursor === "\n" || charBeforeCursor === "\r\n"
|
||||
const charAfterIsWhitespace =
|
||||
charAfterCursor === " " || charAfterCursor === "\n" || charAfterCursor === "\r\n"
|
||||
// checks if char before cusor is whitespace after a mention
|
||||
// checks if char before cursor is whitespace after a mention
|
||||
if (
|
||||
charBeforeIsWhitespace &&
|
||||
inputValue.slice(0, cursorPosition - 1).match(new RegExp(mentionRegex.source + "$")) // "$" is added to ensure the match occurs at the end of the string
|
||||
@@ -585,20 +584,40 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
||||
[updateCursorPosition],
|
||||
)
|
||||
|
||||
// Separate the API config submission logic
|
||||
const submitApiConfig = useCallback(() => {
|
||||
const apiValidationResult = validateApiConfiguration(apiConfiguration)
|
||||
const modelIdValidationResult = validateModelId(apiConfiguration, openRouterModels)
|
||||
|
||||
if (!apiValidationResult && !modelIdValidationResult) {
|
||||
vscode.postMessage({ type: "apiConfiguration", apiConfiguration })
|
||||
} else {
|
||||
vscode.postMessage({ type: "getLatestState" })
|
||||
}
|
||||
}, [apiConfiguration, openRouterModels])
|
||||
|
||||
const onModeToggle = useCallback(() => {
|
||||
if (textAreaDisabled) return
|
||||
const newMode = chatSettings.mode === "plan" ? "act" : "plan"
|
||||
vscode.postMessage({
|
||||
type: "chatSettings",
|
||||
chatSettings: {
|
||||
mode: newMode,
|
||||
},
|
||||
})
|
||||
// Focus the textarea after mode toggle with slight delay
|
||||
// if (textAreaDisabled) return
|
||||
let changeModeDelay = 0
|
||||
if (showModelSelector) {
|
||||
// user has model selector open, so we should save it before switching modes
|
||||
submitApiConfig()
|
||||
changeModeDelay = 250 // necessary to let the api config update (we send message and wait for it to be saved) FIXME: this is a hack and we ideally should check for api config changes, then wait for it to be saved, before switching modes
|
||||
}
|
||||
setTimeout(() => {
|
||||
textAreaRef.current?.focus()
|
||||
}, 100)
|
||||
}, [chatSettings.mode, textAreaDisabled])
|
||||
const newMode = chatSettings.mode === "plan" ? "act" : "plan"
|
||||
vscode.postMessage({
|
||||
type: "chatSettings",
|
||||
chatSettings: {
|
||||
mode: newMode,
|
||||
},
|
||||
})
|
||||
// Focus the textarea after mode toggle with slight delay
|
||||
setTimeout(() => {
|
||||
textAreaRef.current?.focus()
|
||||
}, 100)
|
||||
}, changeModeDelay)
|
||||
}, [chatSettings.mode, showModelSelector, submitApiConfig])
|
||||
|
||||
const handleContextButtonClick = useCallback(() => {
|
||||
if (textAreaDisabled) return
|
||||
@@ -643,18 +662,6 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
||||
updateHighlights()
|
||||
}, [inputValue, textAreaDisabled, handleInputChange, updateHighlights])
|
||||
|
||||
// Separate the API config submission logic
|
||||
const submitApiConfig = useCallback(() => {
|
||||
const apiValidationResult = validateApiConfiguration(apiConfiguration)
|
||||
const modelIdValidationResult = validateModelId(apiConfiguration, openRouterModels)
|
||||
|
||||
if (!apiValidationResult && !modelIdValidationResult) {
|
||||
vscode.postMessage({ type: "apiConfiguration", apiConfiguration })
|
||||
} else {
|
||||
vscode.postMessage({ type: "getLatestState" })
|
||||
}
|
||||
}, [apiConfiguration, openRouterModels])
|
||||
|
||||
// Use an effect to detect menu close
|
||||
useEffect(() => {
|
||||
if (prevShowModelSelector.current && !showModelSelector) {
|
||||
@@ -1031,7 +1038,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
||||
<ModelDisplayButton
|
||||
role="button"
|
||||
isActive={showModelSelector}
|
||||
disabled={textAreaDisabled}
|
||||
disabled={false}
|
||||
onClick={handleModelButtonClick}
|
||||
// onKeyDown={(e) => {
|
||||
// if (e.key === "Enter" || e.key === " ") {
|
||||
@@ -1061,7 +1068,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
||||
</ModelContainer>
|
||||
</ButtonGroup>
|
||||
|
||||
<SwitchContainer data-testid="mode-switch" disabled={textAreaDisabled} onClick={onModeToggle}>
|
||||
<SwitchContainer data-testid="mode-switch" disabled={false} onClick={onModeToggle}>
|
||||
<Slider isAct={chatSettings.mode === "act"} isPlan={chatSettings.mode === "plan"} />
|
||||
<SwitchOption isActive={chatSettings.mode === "plan"}>Plan</SwitchOption>
|
||||
<SwitchOption isActive={chatSettings.mode === "act"}>Act</SwitchOption>
|
||||
|
||||
@@ -5,6 +5,7 @@ import { useDeepCompareEffect, useEvent, useMount } from "react-use"
|
||||
import { Virtuoso, type VirtuosoHandle } from "react-virtuoso"
|
||||
import styled from "styled-components"
|
||||
import {
|
||||
ClineApiReqInfo,
|
||||
ClineAsk,
|
||||
ClineMessage,
|
||||
ClineSayBrowserAction,
|
||||
@@ -44,6 +45,20 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
|
||||
// has to be after api_req_finished are all reduced into api_req_started messages
|
||||
const apiMetrics = useMemo(() => getApiMetrics(modifiedMessages), [modifiedMessages])
|
||||
|
||||
const lastApiReqTotalTokens = useMemo(() => {
|
||||
const getTotalTokensFromApiReqMessage = (msg: ClineMessage) => {
|
||||
if (!msg.text) return 0
|
||||
const { tokensIn, tokensOut, cacheWrites, cacheReads }: ClineApiReqInfo = JSON.parse(msg.text)
|
||||
return (tokensIn || 0) + (tokensOut || 0) + (cacheWrites || 0) + (cacheReads || 0)
|
||||
}
|
||||
const lastApiReqMessage = findLast(modifiedMessages, (msg) => {
|
||||
if (msg.say !== "api_req_started") return false
|
||||
return getTotalTokensFromApiReqMessage(msg) > 0
|
||||
})
|
||||
if (!lastApiReqMessage) return undefined
|
||||
return getTotalTokensFromApiReqMessage(lastApiReqMessage)
|
||||
}, [modifiedMessages])
|
||||
|
||||
const [inputValue, setInputValue] = useState("")
|
||||
const textAreaRef = useRef<HTMLTextAreaElement>(null)
|
||||
const [textAreaDisabled, setTextAreaDisabled] = useState(false)
|
||||
@@ -418,7 +433,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
|
||||
break
|
||||
}
|
||||
}
|
||||
// textAreaRef.current is not explicitly required here since react gaurantees that ref will be stable across re-renders, and we're not using its value but its reference.
|
||||
// textAreaRef.current is not explicitly required here since react guarantees that ref will be stable across re-renders, and we're not using its value but its reference.
|
||||
},
|
||||
[isHidden, textAreaDisabled, enableButtons, handleSendMessage, handlePrimaryButtonClick, handleSecondaryButtonClick],
|
||||
)
|
||||
@@ -729,6 +744,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
|
||||
cacheWrites={apiMetrics.totalCacheWrites}
|
||||
cacheReads={apiMetrics.totalCacheReads}
|
||||
totalCost={apiMetrics.totalCost}
|
||||
lastApiReqTotalTokens={lastApiReqTotalTokens}
|
||||
onClose={handleTaskCloseButtonClick}
|
||||
/>
|
||||
) : (
|
||||
|
||||
@@ -8,6 +8,7 @@ import { formatLargeNumber } from "../../utils/format"
|
||||
import { formatSize } from "../../utils/size"
|
||||
import { vscode } from "../../utils/vscode"
|
||||
import Thumbnails from "../common/Thumbnails"
|
||||
import { normalizeApiConfiguration } from "../settings/ApiOptions"
|
||||
|
||||
interface TaskHeaderProps {
|
||||
task: ClineMessage
|
||||
@@ -17,6 +18,7 @@ interface TaskHeaderProps {
|
||||
cacheWrites?: number
|
||||
cacheReads?: number
|
||||
totalCost: number
|
||||
lastApiReqTotalTokens?: number
|
||||
onClose: () => void
|
||||
}
|
||||
|
||||
@@ -28,6 +30,7 @@ const TaskHeader: React.FC<TaskHeaderProps> = ({
|
||||
cacheWrites,
|
||||
cacheReads,
|
||||
totalCost,
|
||||
lastApiReqTotalTokens,
|
||||
onClose,
|
||||
}) => {
|
||||
const { apiConfiguration, currentTaskItem, checkpointTrackerErrorMessage } = useExtensionState()
|
||||
@@ -37,6 +40,9 @@ const TaskHeader: React.FC<TaskHeaderProps> = ({
|
||||
const textContainerRef = useRef<HTMLDivElement>(null)
|
||||
const textRef = useRef<HTMLDivElement>(null)
|
||||
|
||||
const { selectedModelInfo } = useMemo(() => normalizeApiConfiguration(apiConfiguration), [apiConfiguration])
|
||||
const contextWindow = selectedModelInfo?.contextWindow
|
||||
|
||||
/*
|
||||
When dealing with event listeners in React components that depend on state variables, we face a challenge. We want our listener to always use the most up-to-date version of a callback function that relies on current state, but we don't want to constantly add and remove event listeners as that function updates. This scenario often arises with resize listeners or other window events. Simply adding the listener in a useEffect with an empty dependency array risks using stale state, while including the callback in the dependencies can lead to unnecessary re-registrations of the listener. There are react hook libraries that provide a elegant solution to this problem by utilizing the useRef hook to maintain a reference to the latest callback function without triggering re-renders or effect re-runs. This approach ensures that our event listener always has access to the most current state while minimizing performance overhead and potential memory leaks from multiple listener registrations.
|
||||
Sources
|
||||
@@ -105,6 +111,68 @@ const TaskHeader: React.FC<TaskHeaderProps> = ({
|
||||
|
||||
const shouldShowPromptCacheInfo = doesModelSupportPromptCache && apiConfiguration?.apiProvider !== "openrouter"
|
||||
|
||||
const ContextWindowComponent = (
|
||||
<>
|
||||
{isTaskExpanded && contextWindow && (
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: windowWidth < 270 ? "column" : "row",
|
||||
gap: "4px",
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: "4px",
|
||||
flexShrink: 0, // Prevents shrinking
|
||||
}}>
|
||||
<span style={{ fontWeight: "bold" }}>
|
||||
{/* {windowWidth > 280 && windowWidth < 310 ? "Context:" : "Context Window:"} */}
|
||||
Context Window:
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: "3px",
|
||||
flex: 1,
|
||||
whiteSpace: "nowrap",
|
||||
}}>
|
||||
<span>{formatLargeNumber(lastApiReqTotalTokens || 0)}</span>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: "3px",
|
||||
flex: 1,
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
flex: 1,
|
||||
height: "4px",
|
||||
backgroundColor: "color-mix(in srgb, var(--vscode-badge-foreground) 20%, transparent)",
|
||||
borderRadius: "2px",
|
||||
overflow: "hidden",
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
width: `${((lastApiReqTotalTokens || 0) / contextWindow) * 100}%`,
|
||||
height: "100%",
|
||||
backgroundColor: "var(--vscode-badge-foreground)",
|
||||
borderRadius: "2px",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<span>{formatLargeNumber(contextWindow)}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
|
||||
return (
|
||||
<div style={{ padding: "10px 13px 10px 13px" }}>
|
||||
<div
|
||||
@@ -354,6 +422,7 @@ const TaskHeader: React.FC<TaskHeaderProps> = ({
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
{ContextWindowComponent}
|
||||
{isCostAvailable && (
|
||||
<div
|
||||
style={{
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import { render, screen, fireEvent } from "@testing-library/react"
|
||||
import { describe, it, expect, vi } from "vitest"
|
||||
import Announcement from "../Announcement"
|
||||
|
||||
vi.mock("@vscode/webview-ui-toolkit/react", () => ({
|
||||
useTheme: () => ({ themeType: "light" }),
|
||||
VSCodeButton: (props: any) => <button {...props}>{props.children}</button>,
|
||||
VSCodeLink: ({ children }: { children: React.ReactNode }) => <a>{children}</a>,
|
||||
}))
|
||||
|
||||
describe("Announcement", () => {
|
||||
const hideAnnouncement = vi.fn()
|
||||
|
||||
it("renders the announcement with the correct version", () => {
|
||||
render(<Announcement version="2.0.0" hideAnnouncement={hideAnnouncement} />)
|
||||
expect(screen.getByText(/New in v2.0/)).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it("calls hideAnnouncement when close button is clicked", () => {
|
||||
render(<Announcement version="2.0.0" hideAnnouncement={hideAnnouncement} />)
|
||||
fireEvent.click(screen.getByRole("button"))
|
||||
expect(hideAnnouncement).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it("renders the mcp server improvements announcement", () => {
|
||||
render(<Announcement version="2.0.0" hideAnnouncement={hideAnnouncement} />)
|
||||
expect(screen.getByText(/MCP server improvements:/)).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it("renders the 'See new changes' button feature", () => {
|
||||
render(<Announcement version="2.0.0" hideAnnouncement={hideAnnouncement} />)
|
||||
expect(screen.getByText(/See it in action here./)).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it("renders the demo link", () => {
|
||||
render(<Announcement version="2.0.0" hideAnnouncement={hideAnnouncement} />)
|
||||
expect(screen.getByText(/See a demo here./)).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
@@ -120,7 +120,7 @@ const CodeBlock = memo(({ source, forceWrap = false }: CodeBlockProps) => {
|
||||
if (!node.lang) {
|
||||
node.lang = "javascript"
|
||||
} else if (node.lang.includes(".")) {
|
||||
// if the langauge is a file, get the extension
|
||||
// if the language is a file, get the extension
|
||||
node.lang = node.lang.split(".").slice(-1)[0]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -35,16 +35,13 @@ import {
|
||||
vertexDefaultModelId,
|
||||
vertexModels,
|
||||
} from "../../../../src/shared/api"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { Trans } from "react-i18next"
|
||||
import { ExtensionMessage } from "../../../../src/shared/ExtensionMessage"
|
||||
import { useExtensionState } from "../../context/ExtensionStateContext"
|
||||
import { vscode } from "../../utils/vscode"
|
||||
import VSCodeButtonLink from "../common/VSCodeButtonLink"
|
||||
import OpenRouterModelPicker, { ModelDescriptionMarkdown } from "./OpenRouterModelPicker"
|
||||
import styled from "styled-components"
|
||||
import * as vscodemodels from "vscode"
|
||||
import OpenRouterModelPicker, { ModelDescriptionMarkdown, OPENROUTER_MODEL_PICKER_Z_INDEX } from "./OpenRouterModelPicker"
|
||||
import OpenAiModelPicker from "./OpenAiModelPicker"
|
||||
|
||||
interface ApiOptionsProps {
|
||||
showModelOptions: boolean
|
||||
@@ -78,7 +75,6 @@ declare module "vscode" {
|
||||
}
|
||||
|
||||
const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, isPopup }: ApiOptionsProps) => {
|
||||
const { t, ready } = useTranslation("translation", { keyPrefix: "apiOptions", useSuspense: false })
|
||||
const { apiConfiguration, setApiConfiguration, uriScheme } = useExtensionState()
|
||||
const [ollamaModels, setOllamaModels] = useState<string[]>([])
|
||||
const [lmStudioModels, setLmStudioModels] = useState<string[]>([])
|
||||
@@ -92,7 +88,10 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
}
|
||||
|
||||
const handleInputChange = (field: keyof ApiConfiguration) => (event: any) => {
|
||||
setApiConfiguration({ ...apiConfiguration, [field]: event.target.value })
|
||||
setApiConfiguration({
|
||||
...apiConfiguration,
|
||||
[field]: event.target.value,
|
||||
})
|
||||
}
|
||||
|
||||
const { selectedProvider, selectedModelId, selectedModelInfo } = useMemo(() => {
|
||||
@@ -102,7 +101,10 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
// Poll ollama/lmstudio models
|
||||
const requestLocalModels = useCallback(() => {
|
||||
if (selectedProvider === "ollama") {
|
||||
vscode.postMessage({ type: "requestOllamaModels", text: apiConfiguration?.ollamaBaseUrl })
|
||||
vscode.postMessage({
|
||||
type: "requestOllamaModels",
|
||||
text: apiConfiguration?.ollamaBaseUrl,
|
||||
})
|
||||
} else if (selectedProvider === "lmstudio") {
|
||||
vscode.postMessage({
|
||||
type: "requestLmStudioModels",
|
||||
@@ -149,7 +151,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
value={selectedModelId}
|
||||
onChange={handleInputChange("apiModelId")}
|
||||
style={{ width: "100%" }}>
|
||||
<VSCodeOption value="">{t("selectModel")}</VSCodeOption>
|
||||
<VSCodeOption value="">Select a model...</VSCodeOption>
|
||||
{Object.keys(models).map((modelId) => (
|
||||
<VSCodeOption
|
||||
key={modelId}
|
||||
@@ -170,13 +172,16 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
<div style={{ display: "flex", flexDirection: "column", gap: 5, marginBottom: isPopup ? -10 : 0 }}>
|
||||
<DropdownContainer className="dropdown-container">
|
||||
<label htmlFor="api-provider">
|
||||
<span style={{ fontWeight: 500 }}>{t("apiProvider")}</span>
|
||||
<span style={{ fontWeight: 500 }}>API Provider</span>
|
||||
</label>
|
||||
<VSCodeDropdown
|
||||
id="api-provider"
|
||||
value={selectedProvider}
|
||||
onChange={handleInputChange("apiProvider")}
|
||||
style={{ minWidth: 130, position: "relative", zIndex: OPENROUTER_MODEL_PICKER_Z_INDEX + 1 }}>
|
||||
style={{
|
||||
minWidth: 130,
|
||||
position: "relative",
|
||||
}}>
|
||||
<VSCodeOption value="cline">Cline</VSCodeOption>
|
||||
<VSCodeOption value="openrouter">OpenRouter</VSCodeOption>
|
||||
<VSCodeOption value="anthropic">Anthropic</VSCodeOption>
|
||||
@@ -186,7 +191,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
<VSCodeOption value="vertex">GCP Vertex AI</VSCodeOption>
|
||||
<VSCodeOption value="bedrock">AWS Bedrock</VSCodeOption>
|
||||
<VSCodeOption value="openai-native">OpenAI</VSCodeOption>
|
||||
<VSCodeOption value="openai">{t("getCompatibleVendor", { vendor: "OpenAI" })}</VSCodeOption>
|
||||
<VSCodeOption value="openai">OpenAI Compatible</VSCodeOption>
|
||||
<VSCodeOption value="vscode-lm">VS Code LM API</VSCodeOption>
|
||||
<VSCodeOption value="lmstudio">LM Studio</VSCodeOption>
|
||||
<VSCodeOption value="ollama">Ollama</VSCodeOption>
|
||||
@@ -201,7 +206,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
style={{ width: "100%" }}
|
||||
type="password"
|
||||
onInput={handleInputChange("clineApiKey")}
|
||||
placeholder={t("enterApiKey")}>
|
||||
placeholder={"enterApiKey"}>
|
||||
<span style={{ fontWeight: 500 }}>Cline API Key</span>
|
||||
</VSCodeTextField>
|
||||
)}
|
||||
@@ -213,7 +218,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
marginTop: 3,
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
{t("apiKeyInfo")}
|
||||
{"apiKeyInfo"}
|
||||
</p>
|
||||
)}
|
||||
|
||||
@@ -234,7 +239,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
style={{ width: "100%" }}
|
||||
type="password"
|
||||
onInput={handleInputChange("apiKey")}
|
||||
placeholder={t("enterApiKey")}>
|
||||
placeholder="Enter API Key...">
|
||||
<span style={{ fontWeight: 500 }}>Anthropic API Key</span>
|
||||
</VSCodeTextField>
|
||||
|
||||
@@ -244,10 +249,13 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
const isChecked = e.target.checked === true
|
||||
setAnthropicBaseUrlSelected(isChecked)
|
||||
if (!isChecked) {
|
||||
setApiConfiguration({ ...apiConfiguration, anthropicBaseUrl: "" })
|
||||
setApiConfiguration({
|
||||
...apiConfiguration,
|
||||
anthropicBaseUrl: "",
|
||||
})
|
||||
}
|
||||
}}>
|
||||
{t("useCustomBaseUrl")}
|
||||
Use custom base URL
|
||||
</VSCodeCheckbox>
|
||||
|
||||
{anthropicBaseUrlSelected && (
|
||||
@@ -266,7 +274,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
marginTop: 3,
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
{t("apiKeyInfo")}
|
||||
This key is stored locally and only used to make API requests from this extension.
|
||||
{!apiConfiguration?.apiKey && (
|
||||
<VSCodeLink
|
||||
href="https://console.anthropic.com/settings/keys"
|
||||
@@ -274,7 +282,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
display: "inline",
|
||||
fontSize: "inherit",
|
||||
}}>
|
||||
{t("getApiKeyMessage", { vendor: "Anthropic" })}
|
||||
You can get an Anthropic API key by signing up here.
|
||||
</VSCodeLink>
|
||||
)}
|
||||
</p>
|
||||
@@ -288,8 +296,8 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
style={{ width: "100%" }}
|
||||
type="password"
|
||||
onInput={handleInputChange("openAiNativeApiKey")}
|
||||
placeholder={t("enterApiKey")}>
|
||||
<span style={{ fontWeight: 500 }}>{t("getApiVendorKey", { vendor: "OpenAI" })}</span>
|
||||
placeholder="Enter API Key...">
|
||||
<span style={{ fontWeight: 500 }}>OpenAI API Key</span>
|
||||
</VSCodeTextField>
|
||||
<p
|
||||
style={{
|
||||
@@ -297,7 +305,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
marginTop: 3,
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
{t("apiKeyInfo")}
|
||||
This key is stored locally and only used to make API requests from this extension.
|
||||
{!apiConfiguration?.openAiNativeApiKey && (
|
||||
<VSCodeLink
|
||||
href="https://platform.openai.com/api-keys"
|
||||
@@ -305,7 +313,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
display: "inline",
|
||||
fontSize: "inherit",
|
||||
}}>
|
||||
{t("getApiKeyMessage", { vendor: "OpenAI" })}
|
||||
You can get an OpenAI API key by signing up here.
|
||||
</VSCodeLink>
|
||||
)}
|
||||
</p>
|
||||
@@ -319,8 +327,8 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
style={{ width: "100%" }}
|
||||
type="password"
|
||||
onInput={handleInputChange("deepSeekApiKey")}
|
||||
placeholder={t("enterApiKey")}>
|
||||
<span style={{ fontWeight: 500 }}>{t("getApiVendorKey", { vendor: "DeepSeek" })}</span>
|
||||
placeholder="Enter API Key...">
|
||||
<span style={{ fontWeight: 500 }}>DeepSeek API Key</span>
|
||||
</VSCodeTextField>
|
||||
<p
|
||||
style={{
|
||||
@@ -328,7 +336,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
marginTop: 3,
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
{t("apiKeyInfo")}
|
||||
This key is stored locally and only used to make API requests from this extension.
|
||||
{!apiConfiguration?.deepSeekApiKey && (
|
||||
<VSCodeLink
|
||||
href="https://www.deepseek.com/"
|
||||
@@ -336,7 +344,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
display: "inline",
|
||||
fontSize: "inherit",
|
||||
}}>
|
||||
{t("getApiKeyMessage", { vendor: "DeepSeek" })}
|
||||
You can get a DeepSeek API key by signing up here.
|
||||
</VSCodeLink>
|
||||
)}
|
||||
</p>
|
||||
@@ -350,8 +358,8 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
style={{ width: "100%" }}
|
||||
type="password"
|
||||
onInput={handleInputChange("mistralApiKey")}
|
||||
placeholder={t("enterApiKey")}>
|
||||
<span style={{ fontWeight: 500 }}>{t("getApiVendorKey", { vendor: "Mistral" })}</span>
|
||||
placeholder="Enter API Key...">
|
||||
<span style={{ fontWeight: 500 }}>Mistral API Key</span>
|
||||
</VSCodeTextField>
|
||||
<p
|
||||
style={{
|
||||
@@ -359,7 +367,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
marginTop: 3,
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
{t("apiKeyInfo")}
|
||||
This key is stored locally and only used to make API requests from this extension.
|
||||
{!apiConfiguration?.mistralApiKey && (
|
||||
<VSCodeLink
|
||||
href="https://console.mistral.ai/codestral"
|
||||
@@ -367,7 +375,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
display: "inline",
|
||||
fontSize: "inherit",
|
||||
}}>
|
||||
{t("getApiKeyMessage", { vendor: "Mistral" })}
|
||||
You can get a Mistral API key by signing up here.
|
||||
</VSCodeLink>
|
||||
)}
|
||||
</p>
|
||||
@@ -381,15 +389,15 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
style={{ width: "100%" }}
|
||||
type="password"
|
||||
onInput={handleInputChange("openRouterApiKey")}
|
||||
placeholder={t("enterApiKey")}>
|
||||
<span style={{ fontWeight: 500 }}>{t("getApiVendorKey", { vendor: "OpenRouter" })}</span>
|
||||
placeholder="Enter API Key...">
|
||||
<span style={{ fontWeight: 500 }}>OpenRouter API Key</span>
|
||||
</VSCodeTextField>
|
||||
{!apiConfiguration?.openRouterApiKey && (
|
||||
<VSCodeButtonLink
|
||||
href={getOpenRouterAuthUrl(uriScheme)}
|
||||
style={{ margin: "5px 0 0 0" }}
|
||||
appearance="secondary">
|
||||
{t("getApiKeyMessage", { vendor: "OpenRouter" })}
|
||||
Get OpenRouter API Key
|
||||
</VSCodeButtonLink>
|
||||
)}
|
||||
<p
|
||||
@@ -398,47 +406,58 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
marginTop: "5px",
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
{t("apiKeyInfo")}
|
||||
This key is stored locally and only used to make API requests from this extension.{" "}
|
||||
{/* {!apiConfiguration?.openRouterApiKey && (
|
||||
<span style={{ color: "var(--vscode-charts-green)" }}>
|
||||
(<span style={{ fontWeight: 500 }}>Note:</span> OpenRouter is recommended for high rate
|
||||
limits, prompt caching, and wider selection of models.)
|
||||
</span>
|
||||
)} */}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{selectedProvider === "bedrock" && (
|
||||
<div style={{ display: "flex", flexDirection: "column", gap: 5 }}>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: 5,
|
||||
}}>
|
||||
<VSCodeTextField
|
||||
value={apiConfiguration?.awsAccessKey || ""}
|
||||
style={{ width: "100%" }}
|
||||
type="password"
|
||||
onInput={handleInputChange("awsAccessKey")}
|
||||
placeholder={t("enterAwsAccessKey")}>
|
||||
<span style={{ fontWeight: 500 }}>{t("awsAccessKey")}</span>
|
||||
placeholder="Enter Access Key...">
|
||||
<span style={{ fontWeight: 500 }}>AWS Access Key</span>
|
||||
</VSCodeTextField>
|
||||
<VSCodeTextField
|
||||
value={apiConfiguration?.awsSecretKey || ""}
|
||||
style={{ width: "100%" }}
|
||||
type="password"
|
||||
onInput={handleInputChange("awsSecretKey")}
|
||||
placeholder={t("enterAwsSecretKey")}>
|
||||
<span style={{ fontWeight: 500 }}>{t("awsSecretKey")}</span>
|
||||
placeholder="Enter Secret Key...">
|
||||
<span style={{ fontWeight: 500 }}>AWS Secret Key</span>
|
||||
</VSCodeTextField>
|
||||
<VSCodeTextField
|
||||
value={apiConfiguration?.awsSessionToken || ""}
|
||||
style={{ width: "100%" }}
|
||||
type="password"
|
||||
onInput={handleInputChange("awsSessionToken")}
|
||||
placeholder={t("enterAwsSessionToken")}>
|
||||
<span style={{ fontWeight: 500 }}>{t("awsSessionToken")}</span>
|
||||
placeholder="Enter Session Token...">
|
||||
<span style={{ fontWeight: 500 }}>AWS Session Token</span>
|
||||
</VSCodeTextField>
|
||||
<DropdownContainer zIndex={DROPDOWN_Z_INDEX - 1} className="dropdown-container">
|
||||
<label htmlFor="aws-region-dropdown">
|
||||
<span style={{ fontWeight: 500 }}>{t("getRegion", { vendor: "AWS" })}</span>
|
||||
<span style={{ fontWeight: 500 }}>AWS Region</span>
|
||||
</label>
|
||||
<VSCodeDropdown
|
||||
id="aws-region-dropdown"
|
||||
value={apiConfiguration?.awsRegion || ""}
|
||||
style={{ width: "100%" }}
|
||||
onChange={handleInputChange("awsRegion")}>
|
||||
<VSCodeOption value="">{t("selectRegion")}</VSCodeOption>
|
||||
<VSCodeOption value="">Select a region...</VSCodeOption>
|
||||
{/* The user will have to choose a region that supports the model they use, but this shouldn't be a problem since they'd have to request access for it in that region in the first place. */}
|
||||
<VSCodeOption value="us-east-1">us-east-1</VSCodeOption>
|
||||
<VSCodeOption value="us-east-2">us-east-2</VSCodeOption>
|
||||
@@ -470,9 +489,12 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
checked={apiConfiguration?.awsUseCrossRegionInference || false}
|
||||
onChange={(e: any) => {
|
||||
const isChecked = e.target.checked === true
|
||||
setApiConfiguration({ ...apiConfiguration, awsUseCrossRegionInference: isChecked })
|
||||
setApiConfiguration({
|
||||
...apiConfiguration,
|
||||
awsUseCrossRegionInference: isChecked,
|
||||
})
|
||||
}}>
|
||||
{t("useCrossRegionInference")}
|
||||
Use cross-region inference
|
||||
</VSCodeCheckbox>
|
||||
<p
|
||||
style={{
|
||||
@@ -480,30 +502,37 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
marginTop: "5px",
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
{t("awsInfo")}
|
||||
Authenticate by either providing the keys above or use the default AWS credential providers, i.e.
|
||||
~/.aws/credentials or environment variables. These credentials are only used locally to make API requests
|
||||
from this extension.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{apiConfiguration?.apiProvider === "vertex" && (
|
||||
<div style={{ display: "flex", flexDirection: "column", gap: 5 }}>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: 5,
|
||||
}}>
|
||||
<VSCodeTextField
|
||||
value={apiConfiguration?.vertexProjectId || ""}
|
||||
style={{ width: "100%" }}
|
||||
onInput={handleInputChange("vertexProjectId")}
|
||||
placeholder={t("enterGcpProjectId")}>
|
||||
<span style={{ fontWeight: 500 }}>{t("gcpProjectId")}</span>
|
||||
placeholder="Enter Project ID...">
|
||||
<span style={{ fontWeight: 500 }}>Google Cloud Project ID</span>
|
||||
</VSCodeTextField>
|
||||
<DropdownContainer zIndex={DROPDOWN_Z_INDEX - 2} className="dropdown-container">
|
||||
<label htmlFor="vertex-region-dropdown">
|
||||
<span style={{ fontWeight: 500 }}>{t("getRegion", { vendor: "Google Cloud" })}</span>
|
||||
<span style={{ fontWeight: 500 }}>Google Cloud Region</span>
|
||||
</label>
|
||||
<VSCodeDropdown
|
||||
id="vertex-region-dropdown"
|
||||
value={apiConfiguration?.vertexRegion || ""}
|
||||
style={{ width: "100%" }}
|
||||
onChange={handleInputChange("vertexRegion")}>
|
||||
<VSCodeOption value="">{t("selectRegion")}</VSCodeOption>
|
||||
<VSCodeOption value="">Select a region...</VSCodeOption>
|
||||
<VSCodeOption value="us-east5">us-east5</VSCodeOption>
|
||||
<VSCodeOption value="us-central1">us-central1</VSCodeOption>
|
||||
<VSCodeOption value="europe-west1">europe-west1</VSCodeOption>
|
||||
@@ -517,12 +546,17 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
marginTop: "5px",
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
<Trans
|
||||
i18nKey="apiOptions.gcpLinks"
|
||||
components={{
|
||||
Link: <VSCodeLink />,
|
||||
}}
|
||||
/>
|
||||
To use Google Cloud Vertex AI, you need to
|
||||
<VSCodeLink
|
||||
href="https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude#before_you_begin"
|
||||
style={{ display: "inline", fontSize: "inherit" }}>
|
||||
{"1) create a Google Cloud account › enable the Vertex AI API › enable the desired Claude models,"}
|
||||
</VSCodeLink>{" "}
|
||||
<VSCodeLink
|
||||
href="https://cloud.google.com/docs/authentication/provide-credentials-adc#google-idp"
|
||||
style={{ display: "inline", fontSize: "inherit" }}>
|
||||
{"2) install the Google Cloud CLI › configure Application Default Credentials."}
|
||||
</VSCodeLink>
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
@@ -534,8 +568,8 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
style={{ width: "100%" }}
|
||||
type="password"
|
||||
onInput={handleInputChange("geminiApiKey")}
|
||||
placeholder={t("enterApiKey")}>
|
||||
<span style={{ fontWeight: 500 }}>{t("getApiVendorKey", { vendor: "Gemini" })}</span>
|
||||
placeholder="Enter API Key...">
|
||||
<span style={{ fontWeight: 500 }}>Gemini API Key</span>
|
||||
</VSCodeTextField>
|
||||
<p
|
||||
style={{
|
||||
@@ -543,7 +577,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
marginTop: 3,
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
{t("apiKeyInfo")}
|
||||
This key is stored locally and only used to make API requests from this extension.
|
||||
{!apiConfiguration?.geminiApiKey && (
|
||||
<VSCodeLink
|
||||
href="https://ai.google.dev/"
|
||||
@@ -551,7 +585,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
display: "inline",
|
||||
fontSize: "inherit",
|
||||
}}>
|
||||
{t("getApiKeyMessage", { vendor: "Gemini" })}
|
||||
You can get a Gemini API key by signing up here.
|
||||
</VSCodeLink>
|
||||
)}
|
||||
</p>
|
||||
@@ -565,36 +599,44 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
style={{ width: "100%" }}
|
||||
type="url"
|
||||
onInput={handleInputChange("openAiBaseUrl")}
|
||||
placeholder={t("enterBaseUrl")}>
|
||||
<span style={{ fontWeight: 500 }}>{t("baseUrl")}</span>
|
||||
placeholder={"Enter base URL..."}>
|
||||
<span style={{ fontWeight: 500 }}>Base URL</span>
|
||||
</VSCodeTextField>
|
||||
<VSCodeTextField
|
||||
value={apiConfiguration?.openAiApiKey || ""}
|
||||
style={{ width: "100%" }}
|
||||
type="password"
|
||||
onInput={handleInputChange("openAiApiKey")}
|
||||
placeholder={t("enterApiKey")}>
|
||||
<span style={{ fontWeight: 500 }}>{t("apiKey")}</span>
|
||||
placeholder="Enter API Key...">
|
||||
<span style={{ fontWeight: 500 }}>API Key</span>
|
||||
</VSCodeTextField>
|
||||
<VSCodeTextField
|
||||
value={apiConfiguration?.openAiModelId || ""}
|
||||
style={{ width: "100%" }}
|
||||
onInput={handleInputChange("openAiModelId")}
|
||||
placeholder={"Enter Model ID..."}>
|
||||
<span style={{ fontWeight: 500 }}>Model ID</span>
|
||||
</VSCodeTextField>
|
||||
<span style={{ fontWeight: 500 }}>{t("model")}</span>
|
||||
<OpenAiModelPicker />
|
||||
<VSCodeCheckbox
|
||||
checked={azureApiVersionSelected}
|
||||
onChange={(e: any) => {
|
||||
const isChecked = e.target.checked === true
|
||||
setAzureApiVersionSelected(isChecked)
|
||||
if (!isChecked) {
|
||||
setApiConfiguration({ ...apiConfiguration, azureApiVersion: "" })
|
||||
setApiConfiguration({
|
||||
...apiConfiguration,
|
||||
azureApiVersion: "",
|
||||
})
|
||||
}
|
||||
}}>
|
||||
{t("setAzureApiVersion")}
|
||||
Set Azure API version
|
||||
</VSCodeCheckbox>
|
||||
{azureApiVersionSelected && (
|
||||
<VSCodeTextField
|
||||
value={apiConfiguration?.azureApiVersion || ""}
|
||||
style={{ width: "100%", marginTop: 3 }}
|
||||
onInput={handleInputChange("azureApiVersion")}
|
||||
placeholder={t("getDefault", azureOpenAiDefaultApiVersion)}
|
||||
placeholder={`Default: ${azureOpenAiDefaultApiVersion}`}
|
||||
/>
|
||||
)}
|
||||
<p
|
||||
@@ -603,13 +645,10 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
marginTop: 3,
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
<Trans
|
||||
i18nKey="apiOptions.azureInfo"
|
||||
components={{
|
||||
Link: <VSCodeLink />,
|
||||
ErrSpan: <span style={{ color: "var(--vscode-errorForeground)" }} />,
|
||||
}}
|
||||
/>
|
||||
<span style={{ color: "var(--vscode-errorForeground)" }}>
|
||||
(<span style={{ fontWeight: 500 }}>Note:</span> Cline uses complex prompts and works best with Claude
|
||||
models. Less capable models may not work as expected.)
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
@@ -618,7 +657,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
<div>
|
||||
<DropdownContainer zIndex={DROPDOWN_Z_INDEX - 2} className="dropdown-container">
|
||||
<label htmlFor="vscode-lm-model">
|
||||
<span style={{ fontWeight: 500 }}>{t("languageModel")}</span>
|
||||
<span style={{ fontWeight: 500 }}>Language Model</span>
|
||||
</label>
|
||||
{vsCodeLmModels.length > 0 ? (
|
||||
<VSCodeDropdown
|
||||
@@ -641,7 +680,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
})
|
||||
}}
|
||||
style={{ width: "100%" }}>
|
||||
<VSCodeOption value="">{t("selectModel")}</VSCodeOption>
|
||||
<VSCodeOption value="">Select a model...</VSCodeOption>
|
||||
{vsCodeLmModels.map((model) => (
|
||||
<VSCodeOption
|
||||
key={`${model.vendor}/${model.family}`}
|
||||
@@ -657,7 +696,9 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
marginTop: "5px",
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
{t("vscodeLanguageModelsInfo")}
|
||||
The VS Code Language Model API allows you to run models provided by other VS Code extensions
|
||||
(including but not limited to GitHub Copilot). The easiest way to get started is to install the
|
||||
Copilot extension from the VS Marketplace and enabling Claude 3.5 Sonnet.
|
||||
</p>
|
||||
)}
|
||||
|
||||
@@ -668,7 +709,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
color: "var(--vscode-errorForeground)",
|
||||
fontWeight: 500,
|
||||
}}>
|
||||
{t("experimentalFeature")}
|
||||
Note: This is a very experimental integration and may not work as expected.
|
||||
</p>
|
||||
</DropdownContainer>
|
||||
</div>
|
||||
@@ -681,15 +722,15 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
style={{ width: "100%" }}
|
||||
type="url"
|
||||
onInput={handleInputChange("lmStudioBaseUrl")}
|
||||
placeholder={t("getDefault", { defaultValue: "http://localhost/1234" })}>
|
||||
<span style={{ fontWeight: 500 }}>{t("optionalBaseUrl")}</span>
|
||||
placeholder={"Default: http://localhost:1234"}>
|
||||
<span style={{ fontWeight: 500 }}>Base URL (optional)</span>
|
||||
</VSCodeTextField>
|
||||
<VSCodeTextField
|
||||
value={apiConfiguration?.lmStudioModelId || ""}
|
||||
style={{ width: "100%" }}
|
||||
onInput={handleInputChange("lmStudioModelId")}
|
||||
placeholder={"e.g. meta-llama-3.1-8b-instruct"}>
|
||||
<span style={{ fontWeight: 500 }}>{t("modelId")}</span>
|
||||
<span style={{ fontWeight: 500 }}>Model ID</span>
|
||||
</VSCodeTextField>
|
||||
{lmStudioModels.length > 0 && (
|
||||
<VSCodeRadioGroup
|
||||
@@ -720,13 +761,22 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
marginTop: "5px",
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
<Trans
|
||||
i18nKey="apiOptions.lmStudioInfo"
|
||||
components={{
|
||||
Link: <VSCodeLink style={{ display: "inline", fontSize: "inherit" }} />,
|
||||
ErrSpan: <span style={{ color: "var(--vscode-errorForeground)" }} />,
|
||||
}}
|
||||
/>
|
||||
LM Studio allows you to run models locally on your computer. For instructions on how to get started, see
|
||||
their
|
||||
<VSCodeLink href="https://lmstudio.ai/docs" style={{ display: "inline", fontSize: "inherit" }}>
|
||||
quickstart guide.
|
||||
</VSCodeLink>
|
||||
You will also need to start LM Studio's{" "}
|
||||
<VSCodeLink
|
||||
href="https://lmstudio.ai/docs/basics/server"
|
||||
style={{ display: "inline", fontSize: "inherit" }}>
|
||||
local server
|
||||
</VSCodeLink>{" "}
|
||||
feature to use it with this extension.{" "}
|
||||
<span style={{ color: "var(--vscode-errorForeground)" }}>
|
||||
(<span style={{ fontWeight: 500 }}>Note:</span> Cline uses complex prompts and works best with Claude
|
||||
models. Less capable models may not work as expected.)
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
@@ -738,8 +788,8 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
style={{ width: "100%" }}
|
||||
type="url"
|
||||
onInput={handleInputChange("ollamaBaseUrl")}
|
||||
placeholder={t("getDefault", { defaultValue: "http://localhost:11434" })}>
|
||||
<span style={{ fontWeight: 500 }}>{t("optionalBaseUrl")}</span>
|
||||
placeholder={"Default: http://localhost:11434"}>
|
||||
<span style={{ fontWeight: 500 }}>Base URL (optional)</span>
|
||||
</VSCodeTextField>
|
||||
<VSCodeTextField
|
||||
value={apiConfiguration?.ollamaModelId || ""}
|
||||
@@ -777,15 +827,17 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
marginTop: "5px",
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
{
|
||||
<Trans
|
||||
i18nKey="apiOptions.ollamaInfo"
|
||||
components={{
|
||||
Link: <VSCodeLink style={{ display: "inline", fontSize: "inherit" }} />,
|
||||
ErrorSpan: <span style={{ color: "var(--vscode-errorForeground)" }} />,
|
||||
}}
|
||||
/>
|
||||
}
|
||||
Ollama allows you to run models locally on your computer. For instructions on how to get started, see
|
||||
their
|
||||
<VSCodeLink
|
||||
href="https://github.com/ollama/ollama/blob/main/README.md"
|
||||
style={{ display: "inline", fontSize: "inherit" }}>
|
||||
quickstart guide.
|
||||
</VSCodeLink>
|
||||
<span style={{ color: "var(--vscode-errorForeground)" }}>
|
||||
(<span style={{ fontWeight: 500 }}>Note:</span> Cline uses complex prompts and works best with Claude
|
||||
models. Less capable models may not work as expected.)
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
@@ -810,7 +862,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
<>
|
||||
<DropdownContainer zIndex={DROPDOWN_Z_INDEX - 2} className="dropdown-container">
|
||||
<label htmlFor="model-id">
|
||||
<span style={{ fontWeight: 500 }}>{t("model")}</span>
|
||||
<span style={{ fontWeight: 500 }}>Model</span>
|
||||
</label>
|
||||
{selectedProvider === "cline" && createDropdown(clineModels)}
|
||||
{selectedProvider === "anthropic" && createDropdown(anthropicModels)}
|
||||
@@ -851,6 +903,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is
|
||||
export function getOpenRouterAuthUrl(uriScheme?: string) {
|
||||
return `https://openrouter.ai/auth?callback_url=${uriScheme || "vscode"}://saoudrizwan.claude-dev/openrouter`
|
||||
}
|
||||
|
||||
export const formatPrice = (price: number) => {
|
||||
return new Intl.NumberFormat("en-US", {
|
||||
style: "currency",
|
||||
@@ -874,7 +927,6 @@ export const ModelInfoView = ({
|
||||
isPopup?: boolean
|
||||
}) => {
|
||||
const isGemini = Object.keys(geminiModels).includes(selectedModelId)
|
||||
const { t, ready } = useTranslation("translation", { keyPrefix: "apiOptions", useSuspense: false })
|
||||
|
||||
const infoItems = [
|
||||
modelInfo.description && (
|
||||
@@ -889,64 +941,68 @@ export const ModelInfoView = ({
|
||||
<ModelInfoSupportsItem
|
||||
key="supportsImages"
|
||||
isSupported={modelInfo.supportsImages ?? false}
|
||||
supportsLabel={t("supportsImages")}
|
||||
doesNotSupportLabel={t("doesNotSupportImages")}
|
||||
supportsLabel="Supports images"
|
||||
doesNotSupportLabel="Does not support images"
|
||||
/>,
|
||||
<ModelInfoSupportsItem
|
||||
key="supportsComputerUse"
|
||||
isSupported={modelInfo.supportsComputerUse ?? false}
|
||||
supportsLabel={t("supportsComputerUse")}
|
||||
doesNotSupportLabel={t("doesNotSupportComputerUse")}
|
||||
supportsLabel="Supports computer use"
|
||||
doesNotSupportLabel="Does not support computer use"
|
||||
/>,
|
||||
!isGemini && (
|
||||
<ModelInfoSupportsItem
|
||||
key="supportsPromptCache"
|
||||
isSupported={modelInfo.supportsPromptCache}
|
||||
supportsLabel={t("supportsPromptCache")}
|
||||
doesNotSupportLabel={t("doesNotSupportPromptCache")}
|
||||
supportsLabel="Supports prompt caching"
|
||||
doesNotSupportLabel="Does not support prompt caching"
|
||||
/>
|
||||
),
|
||||
modelInfo.maxTokens !== undefined && modelInfo.maxTokens > 0 && (
|
||||
<span key="maxTokens">
|
||||
<span style={{ fontWeight: 500 }}>{t("maxOutput")}:</span> {modelInfo.maxTokens?.toLocaleString()} {t("tokens")}
|
||||
<span style={{ fontWeight: 500 }}>Max output:</span> {modelInfo.maxTokens?.toLocaleString()} tokens
|
||||
</span>
|
||||
),
|
||||
modelInfo.inputPrice !== undefined && modelInfo.inputPrice > 0 && (
|
||||
<span key="inputPrice">
|
||||
<span style={{ fontWeight: 500 }}>{t("inputPrice")}:</span> {formatPrice(modelInfo.inputPrice)}/
|
||||
{t("millionTokens")}
|
||||
<span style={{ fontWeight: 500 }}>Input price:</span> {formatPrice(modelInfo.inputPrice)}/million tokens
|
||||
</span>
|
||||
),
|
||||
modelInfo.supportsPromptCache && modelInfo.cacheWritesPrice && (
|
||||
<span key="cacheWritesPrice">
|
||||
<span style={{ fontWeight: 500 }}>{t("cacheWritesPrice")}:</span> {formatPrice(modelInfo.cacheWritesPrice || 0)}/
|
||||
{t("millionTokens")}
|
||||
<span style={{ fontWeight: 500 }}>Cache writes price:</span> {formatPrice(modelInfo.cacheWritesPrice || 0)}
|
||||
/million tokens
|
||||
</span>
|
||||
),
|
||||
modelInfo.supportsPromptCache && modelInfo.cacheReadsPrice && (
|
||||
<span key="cacheReadsPrice">
|
||||
<span style={{ fontWeight: 500 }}>{t("cacheReadsPrice")}:</span> {formatPrice(modelInfo.cacheReadsPrice || 0)}/
|
||||
{t("millionTokens")}
|
||||
<span style={{ fontWeight: 500 }}>Cache reads price:</span> {formatPrice(modelInfo.cacheReadsPrice || 0)}/million
|
||||
tokens
|
||||
</span>
|
||||
),
|
||||
modelInfo.outputPrice !== undefined && modelInfo.outputPrice > 0 && (
|
||||
<span key="outputPrice">
|
||||
<span style={{ fontWeight: 500 }}>{t("outputPrice")}:</span> {formatPrice(modelInfo.outputPrice)}/
|
||||
{t("millionTokens")}
|
||||
<span style={{ fontWeight: 500 }}>Output price:</span> {formatPrice(modelInfo.outputPrice)}/million tokens
|
||||
</span>
|
||||
),
|
||||
isGemini && (
|
||||
<span key="geminiInfo" style={{ fontStyle: "italic" }}>
|
||||
{t("geminiInfo", { selectedModelId })}{" "}
|
||||
* Free up to {selectedModelId && selectedModelId.includes("flash") ? "15" : "2"} requests per minute. After that,
|
||||
billing depends on prompt size.{" "}
|
||||
<VSCodeLink href="https://ai.google.dev/pricing" style={{ display: "inline", fontSize: "inherit" }}>
|
||||
{t("pricingDetails")}
|
||||
For more info, see pricing details.
|
||||
</VSCodeLink>
|
||||
</span>
|
||||
),
|
||||
].filter(Boolean)
|
||||
|
||||
return (
|
||||
<p style={{ fontSize: "12px", marginTop: "2px", color: "var(--vscode-descriptionForeground)" }}>
|
||||
<p
|
||||
style={{
|
||||
fontSize: "12px",
|
||||
marginTop: "2px",
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
{infoItems.map((item, index) => (
|
||||
<Fragment key={index}>
|
||||
{item}
|
||||
@@ -1003,7 +1059,11 @@ export function normalizeApiConfiguration(apiConfiguration?: ApiConfiguration):
|
||||
selectedModelId = defaultId
|
||||
selectedModelInfo = models[defaultId]
|
||||
}
|
||||
return { selectedProvider: provider, selectedModelId, selectedModelInfo }
|
||||
return {
|
||||
selectedProvider: provider,
|
||||
selectedModelId,
|
||||
selectedModelInfo,
|
||||
}
|
||||
}
|
||||
switch (provider) {
|
||||
case "cline":
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
import { VSCodeDropdown, VSCodeOption } from "@vscode/webview-ui-toolkit/react"
|
||||
import { memo } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
const LanguageOptions = () => {
|
||||
const { t, i18n } = useTranslation("translation", { keyPrefix: "settingsView", useSuspense: false })
|
||||
|
||||
const changeLanguage = (e: any) => {
|
||||
const language = e.target.value
|
||||
i18n.changeLanguage(language)
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={{ display: "flex", flexDirection: "column", gap: 5 }}>
|
||||
<div className="dropdown-container">
|
||||
<label htmlFor="language-dropdown">
|
||||
<span style={{ fontWeight: 500 }}>{t("language")}</span>
|
||||
</label>
|
||||
<VSCodeDropdown
|
||||
id="language-dropdown"
|
||||
value={i18n.resolvedLanguage}
|
||||
style={{ width: "100%" }}
|
||||
onChange={changeLanguage}>
|
||||
<VSCodeOption value="en">English</VSCodeOption>
|
||||
<VSCodeOption value="de">Deutsch</VSCodeOption>
|
||||
<VSCodeOption value="zh-CN">中文(简体)</VSCodeOption>
|
||||
<VSCodeOption value="zh-TW">中文(繁體)</VSCodeOption>
|
||||
<VSCodeOption value="ja">日本語</VSCodeOption>
|
||||
</VSCodeDropdown>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default memo(LanguageOptions)
|
||||
@@ -1,21 +1,17 @@
|
||||
import { VSCodeButton, VSCodeLink, VSCodeTextArea } from "@vscode/webview-ui-toolkit/react"
|
||||
import { memo, useEffect, useState } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useExtensionState } from "../../context/ExtensionStateContext"
|
||||
import { validateApiConfiguration, validateModelId } from "../../utils/validate"
|
||||
import { vscode } from "../../utils/vscode"
|
||||
import ApiOptions from "./ApiOptions"
|
||||
import LanguageOptions from "./LanguageOptions"
|
||||
import SettingsButton from "../common/SettingsButton"
|
||||
|
||||
const IS_DEV = true // FIXME: use flags when packaging
|
||||
const IS_DEV = false // FIXME: use flags when packaging
|
||||
|
||||
type SettingsViewProps = {
|
||||
onDone: () => void
|
||||
}
|
||||
|
||||
const SettingsView = ({ onDone }: SettingsViewProps) => {
|
||||
const { t } = useTranslation("translation", { keyPrefix: "settingsView", useSuspense: false })
|
||||
const { apiConfiguration, version, customInstructions, setCustomInstructions, openRouterModels } = useExtensionState()
|
||||
const [apiErrorMessage, setApiErrorMessage] = useState<string | undefined>(undefined)
|
||||
const [modelIdErrorMessage, setModelIdErrorMessage] = useState<string | undefined>(undefined)
|
||||
@@ -45,7 +41,7 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
|
||||
// validate as soon as the component is mounted
|
||||
/*
|
||||
useEffect will use stale values of variables if they are not included in the dependency array. so trying to use useEffect with a dependency array of only one value for example will use any other variables' old values. In most cases you don't want this, and should opt to use react-use hooks.
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
// uses someVar and anotherVar
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
@@ -79,8 +75,8 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
|
||||
marginBottom: "17px",
|
||||
paddingRight: 17,
|
||||
}}>
|
||||
<h3 style={{ color: "var(--vscode-foreground)", margin: 0 }}>{t("settings")}</h3>
|
||||
<VSCodeButton onClick={handleSubmit}>{t("done")}</VSCodeButton>
|
||||
<h3 style={{ color: "var(--vscode-foreground)", margin: 0 }}>Settings</h3>
|
||||
<VSCodeButton onClick={handleSubmit}>Done</VSCodeButton>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
@@ -104,9 +100,9 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
|
||||
style={{ width: "100%" }}
|
||||
resize="vertical"
|
||||
rows={4}
|
||||
placeholder={t("customInstructionsPlaceholder")}
|
||||
placeholder={'e.g. "Run unit tests at the end", "Use TypeScript with async/await", "Speak in Spanish"'}
|
||||
onInput={(e: any) => setCustomInstructions(e.target?.value ?? "")}>
|
||||
<span style={{ fontWeight: "500" }}>{t("customInstructions")}</span>
|
||||
<span style={{ fontWeight: "500" }}>Custom Instructions</span>
|
||||
</VSCodeTextArea>
|
||||
<p
|
||||
style={{
|
||||
@@ -114,18 +110,15 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
|
||||
marginTop: "5px",
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
{t("customInstructionsDescription")}
|
||||
These instructions are added to the end of the system prompt sent with every request.
|
||||
</p>
|
||||
</div>
|
||||
<div style={{ marginBottom: 5 }}>
|
||||
<LanguageOptions />
|
||||
</div>
|
||||
|
||||
{IS_DEV && (
|
||||
<>
|
||||
<div style={{ marginTop: "10px", marginBottom: "4px" }}>{t("debug")}</div>
|
||||
<div style={{ marginTop: "10px", marginBottom: "4px" }}>Debug</div>
|
||||
<VSCodeButton onClick={handleResetState} style={{ marginTop: "5px", width: "auto" }}>
|
||||
{t("resetState")}
|
||||
Reset State
|
||||
</VSCodeButton>
|
||||
<p
|
||||
style={{
|
||||
@@ -133,7 +126,7 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
|
||||
marginTop: "5px",
|
||||
color: "var(--vscode-descriptionForeground)",
|
||||
}}>
|
||||
{t("resetStateDescription")}
|
||||
This will reset all global state and secret storage in the extension.
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
@@ -168,7 +161,7 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
}}>
|
||||
{t("feedback")}{" "}
|
||||
If you have any questions or feedback, feel free to open an issue at{" "}
|
||||
<VSCodeLink href="https://github.com/cline/cline" style={{ display: "inline" }}>
|
||||
https://github.com/cline/cline
|
||||
</VSCodeLink>
|
||||
@@ -179,7 +172,7 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
|
||||
margin: "10px 0 0 0",
|
||||
padding: 0,
|
||||
}}>
|
||||
{t("version")} {version}
|
||||
v{version}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,6 @@ import ApiOptions from "../settings/ApiOptions"
|
||||
|
||||
const WelcomeView = () => {
|
||||
const { apiConfiguration } = useExtensionState()
|
||||
const [showApiOptions, setShowApiOptions] = useState(false)
|
||||
const [apiErrorMessage, setApiErrorMessage] = useState<string | undefined>(undefined)
|
||||
|
||||
const disableLetsGoButton = apiErrorMessage != null
|
||||
@@ -36,47 +35,46 @@ const WelcomeView = () => {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
}}>
|
||||
<h2>Hi, I'm Cline</h2>
|
||||
<p>
|
||||
I can do all kinds of tasks thanks to the latest breakthroughs in{" "}
|
||||
<VSCodeLink
|
||||
href="https://www-cdn.anthropic.com/fed9cc193a14b84131812372d8d5857f8f304c52/Model_Card_Claude_3_Addendum.pdf"
|
||||
style={{ display: "inline" }}>
|
||||
Claude 3.5 Sonnet's agentic coding capabilities
|
||||
</VSCodeLink>{" "}
|
||||
and access to tools that let me create & edit files, explore complex projects, use the browser, and execute
|
||||
terminal commands (with your permission, of course). I can even use MCP to create new tools and extend my own
|
||||
capabilities.
|
||||
</p>
|
||||
<div
|
||||
style={{
|
||||
height: "100%",
|
||||
padding: "0 20px",
|
||||
overflow: "auto",
|
||||
}}>
|
||||
<h2>Hi, I'm Cline</h2>
|
||||
<p>
|
||||
I can do all kinds of tasks thanks to the latest breakthroughs in{" "}
|
||||
<VSCodeLink
|
||||
href="https://www-cdn.anthropic.com/fed9cc193a14b84131812372d8d5857f8f304c52/Model_Card_Claude_3_Addendum.pdf"
|
||||
style={{ display: "inline" }}>
|
||||
Claude 3.5 Sonnet's agentic coding capabilities
|
||||
</VSCodeLink>{" "}
|
||||
and access to tools that let me create & edit files, explore complex projects, use the browser, and execute
|
||||
terminal commands (with your permission, of course). I can even use MCP to create new tools and extend my own
|
||||
capabilities.
|
||||
</p>
|
||||
|
||||
<div style={{ marginTop: "20px", marginBottom: "20px" }}>
|
||||
<VSCodeButton appearance="primary" onClick={handleLogin}>
|
||||
Log in to Cline
|
||||
</VSCodeButton>
|
||||
<div style={{ marginTop: "20px", marginBottom: "20px" }}>
|
||||
<VSCodeButton appearance="primary" onClick={handleLogin}>
|
||||
Log in to Cline
|
||||
</VSCodeButton>
|
||||
|
||||
<div style={{ marginTop: "10px" }}>
|
||||
<ul style={{ paddingLeft: "20px", margin: "10px 0" }}>
|
||||
<li>Get 1 task worth of free tokens</li>
|
||||
<li>No credit card required - just start using Cline immediately!</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<VSCodeDivider />
|
||||
|
||||
<div style={{ marginTop: "20px" }}>
|
||||
<VSCodeButton appearance="secondary" onClick={() => setShowApiOptions(!showApiOptions)}>
|
||||
{showApiOptions ? "Hide API options" : "Use your own provider API key"}
|
||||
</VSCodeButton>
|
||||
|
||||
{showApiOptions && (
|
||||
<div style={{ marginTop: "10px" }}>
|
||||
<ApiOptions showModelOptions={false} />
|
||||
<VSCodeButton onClick={handleSubmit} disabled={disableLetsGoButton} style={{ marginTop: "3px" }}>
|
||||
Let's go!
|
||||
</VSCodeButton>
|
||||
<ul style={{ paddingLeft: "20px", margin: "10px 0" }}>
|
||||
<li>Get 1 task worth of free tokens</li>
|
||||
<li>No credit card required - just start using Cline immediately!</li>
|
||||
</ul>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<VSCodeDivider />
|
||||
|
||||
<div style={{ marginTop: "15px" }}>
|
||||
<ApiOptions showModelOptions={false} />
|
||||
<VSCodeButton onClick={handleSubmit} disabled={disableLetsGoButton} style={{ marginTop: "3px" }}>
|
||||
Let's go!
|
||||
</VSCodeButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -35,7 +35,6 @@ export const ExtensionStateContextProvider: React.FC<{
|
||||
shouldShowAnnouncement: false,
|
||||
autoApprovalSettings: DEFAULT_AUTO_APPROVAL_SETTINGS,
|
||||
browserSettings: DEFAULT_BROWSER_SETTINGS,
|
||||
localeLanguage: "en",
|
||||
chatSettings: DEFAULT_CHAT_SETTINGS,
|
||||
isLoggedIn: false,
|
||||
})
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
import i18n from "i18next"
|
||||
import { initReactI18next } from "react-i18next"
|
||||
|
||||
import translationEN from "./locales/en/translation.json"
|
||||
import translationDE from "./locales/de/translation.json"
|
||||
import translationZHCN from "./locales/zh-cn/translation.json"
|
||||
import translationZHTW from "./locales/zh-tw/translation.json"
|
||||
import translationJA from "./locales/ja/translation.json"
|
||||
|
||||
i18n.use(initReactI18next) // passes i18n down to react-i18next
|
||||
.init({
|
||||
fallbackLng: "en",
|
||||
debug: true,
|
||||
react: {
|
||||
bindI18n: "languageChanged",
|
||||
transSupportBasicHtmlNodes: true,
|
||||
transKeepBasicHtmlNodesFor: ["b", "i", "strong", "em", "br"],
|
||||
},
|
||||
})
|
||||
|
||||
i18n.addResourceBundle("de", "translation", translationDE)
|
||||
i18n.addResourceBundle("en", "translation", translationEN)
|
||||
i18n.addResourceBundle("zh-CN", "translation", translationZHCN)
|
||||
i18n.addResourceBundle("zh-TW", "translation", translationZHTW)
|
||||
i18n.addResourceBundle("ja", "translation", translationJA)
|
||||
|
||||
export default i18n
|
||||
@@ -4,7 +4,6 @@ import "./index.css"
|
||||
import App from "./App"
|
||||
import reportWebVitals from "./reportWebVitals"
|
||||
import "../../node_modules/@vscode/codicons/dist/codicon.css"
|
||||
import "./i18n"
|
||||
|
||||
const root = ReactDOM.createRoot(document.getElementById("root") as HTMLElement)
|
||||
root.render(
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
{
|
||||
"announcement": {
|
||||
"newInVersion": "Neu in Version {{version}}",
|
||||
"joinOurCommunities": "Treten Sie unserem <DiscordLink>Discord</DiscordLink> oder <RedditLink>Reddit</RedditLink> für weitere Updates bei!"
|
||||
},
|
||||
"settingsView": {
|
||||
"settings": "Einstellungen",
|
||||
"done": "Fertig",
|
||||
"language": "Sprache",
|
||||
"customInstructions": "Benutzerdefinierte Anweisungen",
|
||||
"customInstructionsPlaceholder": "z.B. \"Führen Sie am Ende Unit-Tests durch\", \"Verwenden Sie TypeScript mit async/await\", \"Sprechen Sie auf Japanisch\"",
|
||||
"customInstructionsDescription": "Diese Anweisungen werden am Ende des Systemprompts hinzugefügt, der mit jeder Anfrage gesendet wird.",
|
||||
"debug": "Debuggen",
|
||||
"resetState": "Zustand zurücksetzen",
|
||||
"resetStateDescription": "Dies setzt den gesamten globalen Zustand und die geheime Speicherung in der Erweiterung zurück.",
|
||||
"feedback": "Wenn Sie Fragen oder Feedback haben, können Sie gerne ein Issue eröffnen unter",
|
||||
"version": "v"
|
||||
},
|
||||
"apiOptions": {
|
||||
"selectModel": "Modell auswählen...",
|
||||
"model": "Modell",
|
||||
"apiProvider": "API-Anbieter",
|
||||
"enterApiKey": "API-Schlüssel eingeben...",
|
||||
"apiKey": "API-Schlüssel",
|
||||
"enterBaseUrl": "Basis-URL eingeben...",
|
||||
"baseUrl": "Basis-URL",
|
||||
"optionalBaseUrl": "Basis-URL (optional)",
|
||||
"enterModelId": "Modell-ID eingeben...",
|
||||
"modelId": "Modell-ID",
|
||||
"useCustomBaseUrl": "Benutzerdefinierte Basis-URL verwenden",
|
||||
"apiKeyInfo": "Dieser Schlüssel wird lokal gespeichert und nur verwendet, um API-Anfragen von dieser Erweiterung zu stellen.",
|
||||
"getDefault": "Standard: {{defaultValue}}",
|
||||
"getApiKeyMessage": "Sie können einen {{vendor}} API-Schlüssel erhalten, indem Sie sich hier anmelden.",
|
||||
"getApiVendorKey": "{{vendor}} API-Schlüssel",
|
||||
"getCompatibleVendor": "{{vendor}} kompatibel",
|
||||
"lmStudioInfo": "LM Studio ermöglicht es Ihnen, Modelle lokal auf Ihrem Computer auszuführen. Anweisungen zum Einstieg finden Sie in ihrem <Link href=\"https://lmstudio.ai/docs\">Schnellstart-Handbuch.</Link> Sie müssen auch die <Link href=\"https://lmstudio.ai/docs/basics/server\">lokale Server</Link>-Funktion von LM Studio starten, um sie mit dieser Erweiterung zu verwenden. <ErrSpan>(<b>Hinweis:</b> Cline verwendet komplexe Prompts und funktioniert am besten mit Claude-Modellen. Weniger leistungsfähige Modelle funktionieren möglicherweise nicht wie erwartet.)</ErrSpan>",
|
||||
"ollamaInfo": "Ollama ermöglicht es Ihnen, Modelle lokal auf Ihrem Computer auszuführen. Anweisungen zum Einstieg finden Sie in ihrem <Link href=\"https://github.com/ollama/ollama/blob/main/README.md\">Schnellstart-Handbuch.</Link> <ErrorSpan>(<b>Hinweis:</b> Cline verwendet komplexe Prompts und funktioniert am besten mit Claude-Modellen. Weniger leistungsfähige Modelle funktionieren möglicherweise nicht wie erwartet.)</ErrorSpan>",
|
||||
"azureInfo": "<ErrSpan>(<b>Hinweis:</b> Cline verwendet komplexe Prompts und funktioniert am besten mit Claude-Modellen. Weniger leistungsfähige Modelle funktionieren möglicherweise nicht wie erwartet.)</ErrSpan>",
|
||||
"setAzureApiVersion": "Azure API-Version festlegen",
|
||||
"enterGcpProjectId": "Projekt-ID eingeben...",
|
||||
"gcpProjectId": "Google Cloud Projekt-ID",
|
||||
"gcpLinks": "Um Google Cloud Vertex AI zu verwenden, müssen Sie <Link href=\"https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude#before_you_begin\"> 1) ein Google Cloud-Konto erstellen › die Vertex AI API aktivieren › die gewünschten Claude-Modelle aktivieren, </Link><br /> <Link href=\"https://cloud.google.com/docs/authentication/provide-credentials-adc#google-idp\"> 2) die Google Cloud CLI installieren › Anwendungsstandardanmeldeinformationen konfigurieren. </Link>",
|
||||
"enterAwsAccessKey": "Zugangsschlüssel eingeben...",
|
||||
"awsAccessKey": "AWS Zugangsschlüssel",
|
||||
"enterAwsSecretKey": "Geheimschlüssel eingeben...",
|
||||
"awsSecretKey": "AWS Geheimschlüssel",
|
||||
"enterAwsSessionToken": "Sitzungstoken eingeben...",
|
||||
"awsSessionToken": "AWS Sitzungstoken",
|
||||
"getRegion": "{{vendor}} Region",
|
||||
"selectRegion": "Region auswählen...",
|
||||
"useCrossRegionInference": "Regionsübergreifende Inferenz verwenden",
|
||||
"awsInfo": "Authentifizieren Sie sich entweder durch die Angabe der oben genannten Schlüssel oder verwenden Sie die Standard-AWS-Anmeldeinformationen, d.h. ~/.aws/credentials oder Umgebungsvariablen. Diese Anmeldeinformationen werden nur lokal verwendet, um API-Anfragen von dieser Erweiterung zu stellen.",
|
||||
"vscodeLanguageModelsInfo": "Die VS Code Language Model API ermöglicht es Ihnen, Modelle zu verwenden, die von anderen VS Code-Erweiterungen bereitgestellt werden (einschließlich, aber nicht beschränkt auf GitHub Copilot). Der einfachste Weg, um loszulegen, ist die Installation der Copilot-Erweiterung aus dem VS Marketplace und die Aktivierung von Claude 3.5 Sonnet.",
|
||||
"experimentalFeature": "Hinweis: Dies ist eine sehr experimentelle Integration und funktioniert möglicherweise nicht wie erwartet.",
|
||||
"supportsImages": "Unterstützt Bilder",
|
||||
"doesNotSupportImages": "Unterstützt keine Bilder",
|
||||
"supportsComputerUse": "Unterstützt Computernutzung",
|
||||
"doesNotSupportComputerUse": "Unterstützt keine Computernutzung",
|
||||
"supportsPromptCache": "Unterstützt Prompt-Caching",
|
||||
"doesNotSupportPromptCache": "Unterstützt kein Prompt-Caching",
|
||||
"maxOutput": "Maximale Ausgabe",
|
||||
"tokens": "Tokens",
|
||||
"inputPrice": "Eingabepreis",
|
||||
"millionTokens": "Millionen Tokens",
|
||||
"cacheWritesPrice": "Cache-Schreibpreis",
|
||||
"cacheReadsPrice": "Cache-Lesepreis",
|
||||
"outputPrice": "Ausgabepreis",
|
||||
"geminiInfo": "* Kostenlos bis zu {{selectedModelId}} Anfragen pro Minute. Danach hängt die Abrechnung von der Prompt-Größe ab.",
|
||||
"pricingDetails": "Weitere Informationen finden Sie in den Preisdaten.",
|
||||
"languageModel": "Sprachmodell"
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
{
|
||||
"announcement": {
|
||||
"newInVersion": "New in version {{version}}",
|
||||
"joinOurCommunities": "Join our <DiscordLink>Discord</DiscordLink> or <RedditLink>Reddit</RedditLink> for more updates!"
|
||||
},
|
||||
"settingsView": {
|
||||
"settings": "Settings",
|
||||
"done": "Done",
|
||||
"language": "Language",
|
||||
"customInstructions": "Custom Instructions",
|
||||
"customInstructionsPlaceholder": "e.g. \"Run unit tests at the end\", \"Use TypeScript with async/await\", \"Speak in Japanese\"",
|
||||
"customInstructionsDescription": "These instructions are added to the end of the system prompt sent with every request.",
|
||||
"debug": "Debug",
|
||||
"resetState": "Reset State",
|
||||
"resetStateDescription": "This will reset all global state and secret storage in the extension.",
|
||||
"feedback": "If you have any questions or feedback, feel free to open an issue at",
|
||||
"version": "v"
|
||||
},
|
||||
"apiOptions": {
|
||||
"selectModel": "Select a Model...",
|
||||
"model": "Model",
|
||||
"apiProvider": "API Provider",
|
||||
"enterApiKey": "Enter API Key...",
|
||||
"apiKey": "API Key",
|
||||
"enterBaseUrl": "Enter Base URL...",
|
||||
"baseUrl": "Base URL",
|
||||
"optionalBaseUrl": "Base URL (optional)",
|
||||
"enterModelId": "Enter Model ID...",
|
||||
"modelId": "Model ID",
|
||||
"useCustomBaseUrl": "Use custom base URL",
|
||||
"apiKeyInfo": "This key is stored locally and only used to make API requests from this extension.",
|
||||
"getDefault": "Default: {{defaultValue}}",
|
||||
"getApiKeyMessage": "You can get an {{vendor}} API key by signing up here.",
|
||||
"getApiVendorKey": "{{vendor}} API Key",
|
||||
"getCompatibleVendor": "{{vendor}} Compatible",
|
||||
"lmStudioInfo": "LM Studio allows you to run models locally on your computer. For instructions on how to get started, see their <Link href=\"https://lmstudio.ai/docs\">quickstart guide.</Link> You will also need to start LM Studio's <Link href=\"https://lmstudio.ai/docs/basics/server\">local server</Link> feature to use it with this extension. <ErrSpan>(<b>Note:</b> Cline uses complex prompts and works best with Claude models. Less capable models may not work as expected.)</ErrSpan>",
|
||||
"ollamaInfo": "Ollama allows you to run models locally on your computer. For instructions on how to get started, see their <Link href=\"https://github.com/ollama/ollama/blob/main/README.md\">quickstart guide.</Link> <ErrorSpan>(<b>Note:</b> Cline uses complex prompts and works best with Claude models. Less capable models may not work as expected.)</ErrorSpan>",
|
||||
"azureInfo": "<ErrSpan>(<b>Note:</b> Cline uses complex prompts and works best with Claude models. Less capable models may not work as expected.)</ErrSpan>",
|
||||
"setAzureApiVersion": "Set Azure API version",
|
||||
"enterGcpProjectId": "Enter Project ID...",
|
||||
"gcpProjectId": "Google Cloud Project ID",
|
||||
"gcpLinks": "To use Google Cloud Vertex AI, you need to <Link href=\"https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude#before_you_begin\"> 1) create a Google Cloud account › enable the Vertex AI API › enable the desired Claude models, </Link><br /> <Link href=\"https://cloud.google.com/docs/authentication/provide-credentials-adc#google-idp\"> 2) install the Google Cloud CLI › configure Application Default Credentials. </Link>",
|
||||
"enterAwsAccessKey": "Enter Access Key...",
|
||||
"awsAccessKey": "AWS Access Key",
|
||||
"enterAwsSecretKey": "Enter Secret Key...",
|
||||
"awsSecretKey": "AWS Secret Key",
|
||||
"enterAwsSessionToken": "Enter Session Token...",
|
||||
"awsSessionToken": "AWS Session Token",
|
||||
"getRegion": "{{vendor}} Region",
|
||||
"selectRegion": "Select a Region...",
|
||||
"useCrossRegionInference": "Use cross-region inference",
|
||||
"awsInfo": "Authenticate by either providing the keys above or use the default AWS credential providers, i.e. ~/.aws/credentials or environment variables. These credentials are only used locally to make API requests from this extension.",
|
||||
"vscodeLanguageModelsInfo": "The VS Code Language Model API allows you to run models provided by other VS Code extensions (including but not limited to GitHub Copilot). The easiest way to get started is to install the Copilot extension from the VS Marketplace and enabling Claude 3.5 Sonnet.",
|
||||
"experimentalFeature": "Note: This is a very experimental integration and may not work as expected.",
|
||||
"supportsImages": "Supports images",
|
||||
"doesNotSupportImages": "Does not support images",
|
||||
"supportsComputerUse": "Supports computer use",
|
||||
"doesNotSupportComputerUse": "Does not support computer use",
|
||||
"supportsPromptCache": "Supports prompt caching",
|
||||
"doesNotSupportPromptCache": "Does not support prompt caching",
|
||||
"maxOutput": "Max output",
|
||||
"tokens": "tokens",
|
||||
"inputPrice": "Input price",
|
||||
"millionTokens": "million tokens",
|
||||
"cacheWritesPrice": "Cache writes price",
|
||||
"cacheReadsPrice": "Cache reads price",
|
||||
"outputPrice": "Output price",
|
||||
"geminiInfo": "* Free up to {{selectedModelId}} requests per minute. After that, billing depends on prompt size.",
|
||||
"pricingDetails": "For more info, see pricing details.",
|
||||
"languageModel": "Language Model"
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
{
|
||||
"announcement": {
|
||||
"newInVersion": "バージョン{{version}}の新機能",
|
||||
"joinOurCommunities": "最新情報については、<DiscordLink>Discord</DiscordLink> または <RedditLink>Reddit</RedditLink> にぜひご参加ください!"
|
||||
},
|
||||
"settingsView": {
|
||||
"settings": "設定",
|
||||
"done": "完了",
|
||||
"language": "言語",
|
||||
"customInstructions": "カスタム指示",
|
||||
"customInstructionsPlaceholder": "例: 「最後にユニットテストを実行する」、「async/awaitでTypeScriptを使用する」、「英語で話す」",
|
||||
"customInstructionsDescription": "これらの指示は、各リクエストで送信されるシステムプロンプトの末尾に追加されます。",
|
||||
"debug": "デバッグ",
|
||||
"resetState": "状態をリセット",
|
||||
"resetStateDescription": "拡張機能のすべてのグローバル状態とシークレットストレージがリセットされます。",
|
||||
"feedback": "ご質問やフィードバックがある場合は、ご自由にイシューを作成してください。",
|
||||
"version": "バージョン"
|
||||
},
|
||||
"apiOptions": {
|
||||
"selectModel": "モデルを選択...",
|
||||
"model": "モデル",
|
||||
"apiProvider": "APIプロバイダー",
|
||||
"enterApiKey": "APIキーを入力...",
|
||||
"apiKey": "APIキー",
|
||||
"enterBaseUrl": "ベースURLを入力...",
|
||||
"baseUrl": "ベースURL",
|
||||
"optionalBaseUrl": "ベースURL(任意)",
|
||||
"enterModelId": "モデルIDを入力...",
|
||||
"modelId": "モデルID",
|
||||
"useCustomBaseUrl": "カスタムベースURLを使用",
|
||||
"apiKeyInfo": "このキーはローカル環境にのみ保存され、拡張機能によるAPIリクエストでのみ使用されます。",
|
||||
"getDefault": "デフォルト: {{defaultValue}}",
|
||||
"getApiKeyMessage": "{{vendor}}のAPIキーは、こちらでサインアップして取得できます。",
|
||||
"getApiVendorKey": "{{vendor}} APIキー",
|
||||
"getCompatibleVendor": "{{vendor}}互換",
|
||||
"lmStudioInfo": "LM Studioを使用すると、モデルをローカルコンピューターで実行できます。始め方については、<Link href=\"https://lmstudio.ai/docs\">クイックスタートガイド</Link>をご覧ください。また、この拡張機能で使用するには、LM Studioの<Link href=\"https://lmstudio.ai/docs/basics/server\">ローカルサーバー</Link>機能を起動する必要があります。<ErrSpan>(<b>注意:</b> Clineは複雑なプロンプトを使用するため、Claudeモデルで最適に動作します。処理能力の低いモデルでは、期待通りに動作しない可能性があります。)</ErrSpan>",
|
||||
"ollamaInfo": "Ollamaを使用すると、モデルをローカルコンピューターで実行できます。始め方については、<Link href=\"https://github.com/ollama/ollama/blob/main/README.md\">クイックスタートガイド</Link>をご覧ください。<ErrorSpan>(<b>注意:</b> Clineは複雑なプロンプトを使用するため、Claudeモデルで最適に動作します。処理能力の低いモデルでは、期待通りに動作しない可能性があります。)</ErrorSpan>",
|
||||
"azureInfo": "<ErrSpan>(<b>注意:</b> Clineは複雑なプロンプトを使用するため、Claudeモデルで最適に動作します。処理能力の低いモデルでは、期待通りに動作しない可能性があります。)</ErrSpan>",
|
||||
"setAzureApiVersion": "Azure APIバージョンを設定",
|
||||
"enterGcpProjectId": "プロジェクトIDを入力...",
|
||||
"gcpProjectId": "Google CloudプロジェクトID",
|
||||
"gcpLinks": "Google Cloud Vertex AIを使用するには、<Link href=\"https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude#before_you_begin\"> 1) Google Cloudアカウントを作成 › Vertex AI APIを有効化 › Claudeモデルを有効化</Link><br /> <Link href=\"https://cloud.google.com/docs/authentication/provide-credentials-adc#google-idp\"> 2) Google Cloud CLIをインストール › アプリケーションデフォルト認証情報を設定</Link>が必要です。",
|
||||
"enterAwsAccessKey": "アクセスキーを入力...",
|
||||
"awsAccessKey": "AWSアクセスキー",
|
||||
"enterAwsSecretKey": "シークレットキーを入力...",
|
||||
"awsSecretKey": "AWSシークレットキー",
|
||||
"enterAwsSessionToken": "セッショントークンを入力...",
|
||||
"awsSessionToken": "AWSセッショントークン",
|
||||
"getRegion": "{{vendor}} リージョン",
|
||||
"selectRegion": "リージョンを選択...",
|
||||
"useCrossRegionInference": "クロスリージョン推論を使用",
|
||||
"awsInfo": "上記のキーを入力するか、デフォルトのAWS認証プロバイダー (例: ~/.aws/credentials または環境変数) を使用して認証してください。これらの認証情報は、この拡張機能からのAPIリクエストにのみローカルで使用されます。",
|
||||
"vscodeLanguageModelsInfo": "VS Code Language Model APIを使用すると、他のVS Code拡張機能 (GitHub Copilotなど) が提供するモデルを実行できます。始める最も簡単な方法は、VSマーケットプレイスからCopilot拡張機能をインストールし、Claude 3.5 Sonnetを有効化することです。",
|
||||
"experimentalFeature": "注意: これは試験的な統合機能であり、意図した通りに動作しない場合があります。",
|
||||
"supportsImages": "画像サポートあり",
|
||||
"doesNotSupportImages": "画像サポートなし",
|
||||
"supportsComputerUse": "コンピューター利用サポートあり",
|
||||
"doesNotSupportComputerUse": "コンピューター利用サポートなし",
|
||||
"supportsPromptCache": "プロンプトキャッシュサポートあり",
|
||||
"doesNotSupportPromptCache": "プロンプトキャッシュサポートなし",
|
||||
"maxOutput": "最大出力",
|
||||
"tokens": "トークン",
|
||||
"inputPrice": "入力価格",
|
||||
"millionTokens": "百万トークン",
|
||||
"cacheWritesPrice": "キャッシュ書き込み価格",
|
||||
"cacheReadsPrice": "キャッシュ読み取り価格",
|
||||
"outputPrice": "出力価格",
|
||||
"geminiInfo": "* {{selectedModelId}} リクエスト毎分まで無料。その後、料金はプロンプトサイズに基づいて計算されます。",
|
||||
"pricingDetails": "詳細については料金情報をご確認ください。",
|
||||
"languageModel": "言語モデル"
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
{
|
||||
"announcement": {
|
||||
"newInVersion": "版本 {{version}} 中的新功能",
|
||||
"joinOurCommunities": "加入我们的 <DiscordLink>Discord</DiscordLink> 或 <RedditLink>Reddit</RedditLink> 获取更多更新!"
|
||||
},
|
||||
"settingsView": {
|
||||
"settings": "设置",
|
||||
"done": "完成",
|
||||
"language": "语言",
|
||||
"customInstructions": "自定义指令",
|
||||
"customInstructionsPlaceholder": "例如 \"在结束时运行单元测试\", \"使用 TypeScript 和 async/await\", \"用日语交流\"",
|
||||
"customInstructionsDescription": "这些指令会添加到每个请求发送的系统提示的末尾。",
|
||||
"debug": "调试",
|
||||
"resetState": "重置状态",
|
||||
"resetStateDescription": "这将重置扩展中的所有全局状态和秘密存储。",
|
||||
"feedback": "如果您有任何问题或反馈,请随时在以下网址提交问题",
|
||||
"version": "版本"
|
||||
},
|
||||
"apiOptions": {
|
||||
"selectModel": "选择模型...",
|
||||
"model": "模型",
|
||||
"apiProvider": "API 提供商",
|
||||
"enterApiKey": "请输入 API 密钥...",
|
||||
"apiKey": "API 密钥",
|
||||
"enterBaseUrl": "输入基本 URL...",
|
||||
"baseUrl": "基本 URL",
|
||||
"enterModelId": "输入模型 ID...",
|
||||
"modelId": "模型 ID",
|
||||
"useCustomBaseUrl": "使用自定义基本 URL",
|
||||
"apiKeyInfo": "此密钥存储在本地,仅用于从此扩展进行 API 请求。",
|
||||
"getApiKeyMessage": "您可以通过在此处注册来获取 {{vendor}} API 密钥。",
|
||||
"getApiVendorKey": "{{vendor}} API 密钥",
|
||||
"getCompatibleVendor": "{{vendor}} 兼容",
|
||||
"enterGcpProjectId": "输入项目 ID...",
|
||||
"gcpProjectId": "Google Cloud 项目 ID",
|
||||
"gcpLinks": "要使用 Google Cloud Vertex AI,您需要 <Link href=\"https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude#before_you_begin\"> 1) 创建一个 Google Cloud 帐户 › 启用 Vertex AI API › 启用所需的 Claude 模型,</Link><br /> <Link href=\"https://cloud.google.com/docs/authentication/provide-credentials-adc#google-idp\"> 2) 安装 Google Cloud CLI › 配置应用程序默认凭据。</Link>",
|
||||
"enterAwsAccessKey": "输入访问密钥...",
|
||||
"awsAccessKey": "AWS 访问密钥",
|
||||
"enterAwsSecretKey": "输入秘密密钥...",
|
||||
"awsSecretKey": "AWS 密钥",
|
||||
"enterAwsSessionToken": "输入会话令牌...",
|
||||
"awsSessionToken": "AWS 会话令牌",
|
||||
"awsRegion": "AWS 区域",
|
||||
"getRegion": "{{vendor}} 区域",
|
||||
"selectRegion": "选择区域...",
|
||||
"useCrossRegionInference": "使用跨区域推理",
|
||||
"awsInfo": "通过提供上述密钥或使用默认的 AWS 凭证提供程序进行身份验证,即 ~/.aws/credentials 或环境变量。这些凭证仅在本地用于从此扩展进行 API 请求。",
|
||||
"vscodeLanguageModelsInfo": "VS Code 语言模型 API 允许您运行其他 VS Code 扩展提供的模型(包括但不限于 GitHub Copilot)。最简单的方法是从 VS Marketplace 安装 Copilot 扩展并启用 Claude 3.5 Sonnet。",
|
||||
"experimentalFeature": "注意:这是一个非常实验性功能,可能无法按预期工作。",
|
||||
"supportsImages": "支持图像",
|
||||
"doesNotSupportImages": "不支持图像",
|
||||
"supportsComputerUse": "支持计算机使用",
|
||||
"doesNotSupportComputerUse": "不支持计算机使用",
|
||||
"supportsPromptCache": "支持提示缓存",
|
||||
"doesNotSupportPromptCache": "不支持提示缓存",
|
||||
"maxOutput": "最大输出",
|
||||
"tokens": "令牌",
|
||||
"inputPrice": "输入价格",
|
||||
"millionTokens": "百万令牌",
|
||||
"cacheWritesPrice": "缓存写入价格",
|
||||
"cacheReadsPrice": "缓存读取价格",
|
||||
"outputPrice": "输出价格",
|
||||
"geminiInfo": "* 每分钟最多 {{selectedModelId}} 次请求免费。之后,费用取决于提示大小。",
|
||||
"pricingDetails": "有关更多信息,请参阅定价详情。",
|
||||
"languageModel": "语言模型"
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
{
|
||||
"announcement": {
|
||||
"newInVersion": "版本 {{version}} 中的新功能",
|
||||
"joinOurCommunities": "加入我們的 <DiscordLink>Discord</DiscordLink> 或 <RedditLink>Reddit</RedditLink> 獲取更多更新!"
|
||||
},
|
||||
"settingsView": {
|
||||
"settings": "設置",
|
||||
"done": "完成",
|
||||
"language": "語言",
|
||||
"customInstructions": "自定義指令",
|
||||
"customInstructionsPlaceholder": "例如 \"在結束時運行單元測試\", \"使用 TypeScript 和 async/await\", \"用日語交流\"",
|
||||
"customInstructionsDescription": "這些指令會添加到每個請求發送的系統提示的末尾。",
|
||||
"debug": "調試",
|
||||
"resetState": "重置狀態",
|
||||
"resetStateDescription": "這將重置擴展中的所有全局狀態和秘密存儲。",
|
||||
"feedback": "如果您有任何問題或反饋,請隨時在以下網址提交問題",
|
||||
"version": "版本"
|
||||
},
|
||||
"apiOptions": {
|
||||
"selectModel": "選擇模型...",
|
||||
"model": "模型",
|
||||
"apiProvider": "API 提供者",
|
||||
"enterApiKey": "請輸入 API 密鑰...",
|
||||
"apiKey": "API 密鑰",
|
||||
"enterBaseUrl": "輸入基本 URL...",
|
||||
"baseUrl": "基本 URL",
|
||||
"enterModelId": "輸入模型 ID...",
|
||||
"modelId": "模型 ID",
|
||||
"useCustomBaseUrl": "使用自定義基本 URL",
|
||||
"apiKeyInfo": "此密鑰僅存儲在本地,僅用於從此擴展進行 API 請求。",
|
||||
"getApiKeyMessage": "您可以通過在此處註冊來獲取 {{vendor}} API 金鑰。",
|
||||
"getApiVendorKey": "{{vendor}} API 金鑰",
|
||||
"getCompatibleVendor": "{{vendor}} 兼容",
|
||||
"enterGcpProjectId": "輸入項目 ID...",
|
||||
"gcpProjectId": "Google Cloud 項目 ID",
|
||||
"gcpLinks": "要使用 Google Cloud Vertex AI,您需要 <Link href=\"https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude#before_you_begin\"> 1) 創建 Google Cloud 帳戶 › 啟用 Vertex AI API › 啟用所需的 Claude 模型, </Link><br /> <Link href=\"https://cloud.google.com/docs/authentication/provide-credentials-adc#google-idp\"> 2) 安裝 Google Cloud CLI › 配置應用程序默認憑據。 </Link>",
|
||||
"enterAwsAccessKey": "輸入訪問金鑰...",
|
||||
"awsAccessKey": "AWS 訪問金鑰",
|
||||
"enterAwsSecretKey": "輸入秘密金鑰...",
|
||||
"awsSecretKey": "AWS 秘密金鑰",
|
||||
"enterAwsSessionToken": "輸入會話令牌...",
|
||||
"awsSessionToken": "AWS 會話令牌",
|
||||
"awsRegion": "AWS 區域",
|
||||
"getRegion": "{{vendor}} 區域",
|
||||
"selectRegion": "選擇區域...",
|
||||
"useCrossRegionInference": "使用跨區域推理",
|
||||
"awsInfo": "通過提供上述金鑰或使用默認的 AWS 憑據提供者進行身份驗證,即 ~/.aws/credentials 或環境變量。這些憑據僅在本地用於從此擴展進行 API 請求。",
|
||||
"vscodeLanguageModelsInfo": "VS Code 語言模型 API 允許您運行其他 VS Code 擴展提供的模型(包括但不限於 GitHub Copilot)。最簡單的入門方法是從 VS Marketplace 安裝 Copilot 擴展並啟用 Claude 3.5 Sonnet。",
|
||||
"experimentalFeature": "注意:這是一個非常實驗性的集成,可能無法按預期工作。",
|
||||
"supportsImages": "支持圖片",
|
||||
"doesNotSupportImages": "不支持圖片",
|
||||
"supportsComputerUse": "支持電腦使用",
|
||||
"doesNotSupportComputerUse": "不支持電腦使用",
|
||||
"supportsPromptCache": "支持提示緩存",
|
||||
"doesNotSupportPromptCache": "不支持提示緩存",
|
||||
"maxOutput": "最大輸出",
|
||||
"tokens": "標記",
|
||||
"inputPrice": "輸入價格",
|
||||
"millionTokens": "百萬標記",
|
||||
"cacheWritesPrice": "緩存寫入價格",
|
||||
"cacheReadsPrice": "緩存讀取價格",
|
||||
"outputPrice": "輸出價格",
|
||||
"geminiInfo": "* 每分鐘最多免費 {{selectedModelId}} 次請求。之後,計費取決於提示大小。",
|
||||
"pricingDetails": "更多信息,請參見定價詳情。",
|
||||
"languageModel": "語言模型"
|
||||
}
|
||||
}
|
||||
@@ -16,5 +16,6 @@
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx"
|
||||
},
|
||||
"include": ["src", "../src/shared"]
|
||||
"include": ["src", "../src/shared"],
|
||||
"exclude": ["src/**/*.spec.ts", "setupTests.js", "matchMedia.js"]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import { defineConfig } from "vitest/config"
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
environment: "jsdom",
|
||||
globals: true,
|
||||
setupFiles: ["./setupTests.js"],
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user