Skip to content

Commit

Permalink
chore: readme, license
Browse files Browse the repository at this point in the history
  • Loading branch information
rexdotsh committed Dec 25, 2024
1 parent 0d14a92 commit f7d81d1
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 7 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 rex

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
96 changes: 95 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,96 @@
# claudesync
# ClaudeSync

Seamlessly integrate your VS Code workspace with Claude.ai projects. ClaudeSync keeps your local files in perfect harmony with your Claude.ai conversations, making it easier than ever to collaborate with Claude on your development projects.

> This extension requires a Claude.ai account with the Pro plan.
## Quick Start Guide

### 1. Install the Extension

You can install ClaudeSync directly from the [VS Code Marketplace](https://marketplace.visualstudio.com/PLACEHOLDER)!

### 2. Get Your Claude Token

To connect ClaudeSync with your Claude.ai account, you'll need your session token. Here's how to get it:

1. Visit [claude.ai](https://claude.ai) and sign in to your account.
2. Open Developer Tools:
- Windows/Linux: `F12` or `Ctrl+Shift+I`
- Mac: `Cmd+Option+I`
3. Navigate to: `Application → Cookies → claude.ai → sessionKey`
4. Copy the token value (starts with "sk-ant")

> Tip: Make sure you copy the raw token value, not the URL-encoded version!
### 3. Configure the Extension

1. Open the Command Palette in VS Code:
- Windows/Linux: `Ctrl+Shift+P`
- Mac: `Cmd+Shift+P`
2. Type "ClaudeSync: Set Token"
3. Paste your Claude session token
4. You're ready to go!

## Available Commands

Access these commands through the Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P`):

| Command | Description |
| --------------------------------------- | --------------------------------------------- |
| `ClaudeSync: Set Token` | Configure your Claude session token |
| `ClaudeSync: Initialize Project` | Set up a new Claude project for the workspace |
| `ClaudeSync: Sync Current File` | Sync the active file |
| `ClaudeSync: Sync Workspace` | Sync all workspace files |
| `ClaudeSync: Configure Auto-sync` | Manage automatic file syncing |
| `ClaudeSync: Configure Startup Sync` | Control syncing on VS Code startup |
| `ClaudeSync: Sync Project Instructions` | Update project instructions |
| `ClaudeSync: Open in Browser` | View project in Claude.ai's Web UI |

## Configuration

Customize ClaudeSync through `.vscode/claudesync.json`:

```json
{
"excludePatterns": [
"node_modules/**",
"dist/**",
".git/**"
// ... other patterns
],
"maxFileSize": 1048576, // 1MB
"autoSync": false,
"autoSyncDelay": 30,
"syncOnStartup": false
}
```

### Configuration Options

| Option | Description | Default |
| ----------------- | -------------------------------- | --------- |
| `excludePatterns` | Glob patterns for excluded files | `[]` |
| `maxFileSize` | Maximum file size (bytes) | `1048576` |
| `autoSync` | Enable automatic syncing | `false` |
| `autoSyncDelay` | Sync delay (seconds) | `30` |
| `syncOnStartup` | Sync when VS Code starts | `false` |

## Project Instructions

Need to give Claude specific instructions for your project? Create a `.projectinstructions` file in your workspace root. These instructions sync automatically:

- When initializing a new project, or
- When manually running "Sync Project Instructions".

## Contributing

Feel free to contribute to this project by opening an issue or submitting a pull request.

## License

ClaudeSync is open source software licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

---

> ⚠️ Note: This extension is not officially affiliated with Anthropic's Claude.ai service.
10 changes: 4 additions & 6 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export async function activate(context: vscode.ExtensionContext) {

let autoSyncDelay = config.autoSyncDelay;
if (enableAutoSync === "Enable") {
// get delay from user (10 seconds to 3 minutes)
const delay = await vscode.window.showInputBox({
prompt: "Enter auto-sync delay in seconds (10-180)",
value: String(config.autoSyncDelay),
Expand All @@ -118,13 +117,13 @@ export async function activate(context: vscode.ExtensionContext) {
autoSyncDelay = parseInt(delay);
}

// Save configuration
// save configuration
await configManager.saveWorkspaceConfig({
autoSync: enableAutoSync === "Enable",
autoSyncDelay,
});

// Update file watcher based on new auto-sync setting
// update file watcher based on new auto-sync setting
await setupFileWatcher();

vscode.window.showInformationMessage(
Expand Down Expand Up @@ -183,14 +182,13 @@ export async function activate(context: vscode.ExtensionContext) {
return;
}

// Check if we're in cooldown period after a failed sync
// check if we're in cooldown period after a failed sync
const now = Date.now();
if (now - lastFailedSyncTime < SYNC_COOLDOWN_MS) {
outputChannel.appendLine("Skipping sync attempt - in cooldown period after recent failure");
return;
}

// Pass all files to syncManager which will handle filtering
if (files.length === 0) {
vscode.window.showInformationMessage("No files to sync");
return;
Expand Down Expand Up @@ -254,7 +252,7 @@ export async function activate(context: vscode.ExtensionContext) {
}

if (!success) {
lastFailedSyncTime = Date.now(); // Start cooldown period
lastFailedSyncTime = Date.now(); // start cooldown period
}

if (success) {
Expand Down

0 comments on commit f7d81d1

Please sign in to comment.