Skip to content

Commit

Permalink
Two-way-sync and exposed config commands
Browse files Browse the repository at this point in the history
  • Loading branch information
jahwag authored Jul 25, 2024
1 parent e7325f8 commit b414d0b
Show file tree
Hide file tree
Showing 9 changed files with 734 additions and 461 deletions.
18 changes: 15 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,24 @@ We follow the PEP 8 style guide for Python code. Please ensure your code adheres

## Reporting Bugs

If you find a bug, please open an issue on the GitHub repository. Include as much detail as possible, including:
If you find a bug, please open an issue on the GitHub repository using our bug report template. To do this:

- Steps to reproduce the bug
1. Go to the [Issues](https://github.com/jahwag/claudesync/issues) page of the ClaudeSync repository.
2. Click on "New Issue".
3. Select the "Bug Report" template.
4. Fill out the template with as much detail as possible.

When reporting a bug, please include:

- A clear and concise description of the bug
- Steps to reproduce the behavior
- Expected behavior
- Actual behavior
- Any error messages or stack traces
- Your environment details (OS, Python version, ClaudeSync version)
- Your ClaudeSync configuration (use `claudesync config list`)
- Any relevant logs (you can increase log verbosity with `claudesync config set log_level DEBUG`)

The more information you provide, the easier it will be for us to reproduce and fix the bug.

## Requesting Features

Expand Down
259 changes: 145 additions & 114 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,115 +1,146 @@
```
.oooooo. oooo .o8 .oooooo..o
d8P' `Y8b `888 "888 d8P' `Y8
888 888 .oooo. oooo oooo .oooo888 .ooooo. Y88bo. oooo ooo ooo. .oo. .ooooo.
888 888 `P )88b `888 `888 d88' `888 d88' `88b `"Y8888o. `88. .8' `888P"Y88b d88' `"Y8
888 888 .oP"888 888 888 888 888 888ooo888 `"Y88b `88..8' 888 888 888
`88b ooo 888 d8( 888 888 888 888 888 888 .o oo .d8P `888' 888 888 888 .o8
`Y8bood8P' o888o `Y888""8o `V88V"V8P' `Y8bod88P" `Y8bod8P' 8""88888P' .8' o888o o888o `Y8bod8P'
.o..P'
`Y8P'
```
![License](https://img.shields.io/badge/License-MIT-blue.svg)
[![PyPI version](https://badge.fury.io/py/claudesync.svg)](https://badge.fury.io/py/claudesync)

ClaudeSync is a powerful tool designed to seamlessly synchronize your local files with [Claude.ai](https://www.anthropic.com/claude) projects.

## Overview and Scope

ClaudeSync bridges the gap between your local development environment and Claude.ai's knowledge base. At a high level, the scope of ClaudeSync includes:

- Real-time synchronization with Claude.ai projects
- Command-line interface (CLI) for easy management
- Multiple organization and project support
- Automatic handling of file creation, modification, and deletion
- Intelligent file filtering based on .gitignore rules
- Configurable sync interval with cron job support
- Seamless integration with your existing workflow

## Roadmap

1. Enhanced support for large file synchronization
2. Improved conflict resolution mechanisms
3. GUI client for easier management
4. Integration with popular IDEs and text editors
5. Support for additional AI platforms beyond Claude.ai

## Quick Start

1. **Install ClaudeSync:**
```bash
pip install claudesync
```

2. **Login to Claude.ai:**
```bash
claudesync api login claude.ai
```

3. **Select an organization:**
```bash
claudesync organization select
```

4. **Select or create a project:**
```bash
claudesync project select
# or
claudesync project create
```

5. **Start syncing:**
```bash
claudesync sync
```

## Advanced Usage

### API Management
- Login to Claude.ai: `claudesync api login claude.ai`
- Logout: `claudesync api logout`
- Set upload delay: `claudesync api ratelimit --delay <seconds>`

### Organization Management
- List organizations: `claudesync organization ls`
- Select active organization: `claudesync organization select`

### Project Management
- List projects: `claudesync project ls`
- Create a new project: `claudesync project create`
- Archive a project: `claudesync project archive`
- Select active project: `claudesync project select`

### File Management
- List remote files: `claudesync ls`
- Sync files: `claudesync sync`

### Configuration
- View current status: `claudesync status`

### Scheduled Sync
Set up automatic syncing at regular intervals:
```bash
claudesync schedule
```

## Contributing

We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for more information.

## Communication Channels

- **Issues**: For bug reports and feature requests, please use our [GitHub Issues](https://github.com/jahwag/claudesync/issues).

## License

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

## Related Projects

- [Claude.ai](https://www.anthropic.com/claude): The AI assistant that ClaudeSync integrates with.

---

Made with ❤️ by the ClaudeSync team
```
.oooooo. oooo .o8 .oooooo..o
d8P' `Y8b `888 "888 d8P' `Y8
888 888 .oooo. oooo oooo .oooo888 .ooooo. Y88bo. oooo ooo ooo. .oo. .ooooo.
888 888 `P )88b `888 `888 d88' `888 d88' `88b `"Y8888o. `88. .8' `888P"Y88b d88' `"Y8
888 888 .oP"888 888 888 888 888 888ooo888 `"Y88b `88..8' 888 888 888
`88b ooo 888 d8( 888 888 888 888 888 888 .o oo .d8P `888' 888 888 888 .o8
`Y8bood8P' o888o `Y888""8o `V88V"V8P' `Y8bod88P" `Y8bod8P' 8""88888P' .8' o888o o888o `Y8bod8P'
.o..P'
`Y8P'
```
![License](https://img.shields.io/badge/License-MIT-blue.svg)
[![PyPI version](https://badge.fury.io/py/claudesync.svg)](https://badge.fury.io/py/claudesync)

ClaudeSync is a powerful tool designed to seamlessly synchronize your local files with [Claude.ai](https://www.anthropic.com/claude) projects.

## Overview and Scope

ClaudeSync bridges the gap between your local development environment and Claude.ai's knowledge base. At a high level, the scope of ClaudeSync includes:

- Real-time synchronization with Claude.ai projects
- Command-line interface (CLI) for easy management
- Multiple organization and project support
- Automatic handling of file creation, modification, and deletion
- Intelligent file filtering based on .gitignore rules
- Configurable sync interval with cron job support
- Seamless integration with your existing workflow
- Optional two-way synchronization support
- Configuration management through CLI

## Important Disclaimers

- **Data Privacy**: ClaudeSync does not share any personal data or project data with anyone other than Anthropic (through Claude.ai) and yourself. Your data remains private and secure.
- **Open Source Transparency**: We are committed to transparency. Our entire codebase is open source, allowing you to review and verify our practices.
- **Affiliation**: ClaudeSync is not affiliated with, endorsed by, or sponsored by Anthropic. It is an independent tool created by enthusiasts for enthusiasts of Claude.ai.
- **Use at Your Own Risk**: While we strive for reliability, please use ClaudeSync at your own discretion and risk. Always maintain backups of your important data.

## Roadmap

1. Enhanced support for large file synchronization
2. Improved conflict resolution mechanisms
3. GUI client for easier management
4. Integration with popular IDEs and text editors
5. Support for additional AI platforms beyond Claude.ai

## Quick Start

1. **Install ClaudeSync:**
```bash
pip install claudesync
```

2. **Login to Claude.ai:**
```bash
claudesync api login claude.ai
```

3. **Select an organization:**
```bash
claudesync organization select
```

4. **Select or create a project:**
```bash
claudesync project select
# or
claudesync project create
```

5. **Start syncing:**
```bash
claudesync sync
```

## Advanced Usage

### API Management
- Login to Claude.ai: `claudesync api login claude.ai`
- Logout: `claudesync api logout`
- Set upload delay: `claudesync api ratelimit --delay <seconds>`

### Organization Management
- List organizations: `claudesync organization ls`
- Select active organization: `claudesync organization select`

### Project Management
- List projects: `claudesync project ls`
- Create a new project: `claudesync project create`
- Archive a project: `claudesync project archive`
- Select active project: `claudesync project select`

### File Management
- List remote files: `claudesync ls`
- Sync files: `claudesync sync`

### Configuration
- View current status: `claudesync status`
- Set configuration values: `claudesync config set <key> <value>`
- Get configuration values: `claudesync config get <key>`
- List all configuration values: `claudesync config list`

### Synchronization Modes

#### One-Way Sync (Default)
By default, ClaudeSync operates in one-way sync mode, pushing changes from your local environment to Claude.ai. This ensures that your local files are the source of truth and prevents unexpected modifications to your local files.

#### Two-Way Sync (Experimental)
Two-way synchronization is available as an experimental feature. This mode allows changes made on the remote Claude.ai project to be reflected in your local files. However, please be aware of the following:

1. To enable two-way synchronization:
```bash
claudesync config set two_way_sync true
```

2. **Caution**: Claude.ai has a tendency to modify filenames, often appending descriptive text. For example, "README.md" might become "Updated README.md with config and two-way sync info.md". This behavior is currently beyond ClaudeSync's control.

3. **Potential Data Loss**: Due to the filename modification issue, there's a risk of unintended file duplication or data loss. Always maintain backups of your important files when using two-way sync.

4. **Future Improvements**: We're actively exploring ways to mitigate these issues, possibly through prompt engineering or updates to ClaudeSync. For now, this feature is provided as-is and should be used with understanding of its limitations.

### Scheduled Sync
Set up automatic syncing at regular intervals:
```bash
claudesync schedule
```

## Contributing

We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for more information.

## Communication Channels

- **Issues**: For bug reports and feature requests, please use our [GitHub Issues](https://github.com/jahwag/claudesync/issues).

## License

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

## Related Projects

- [Claude.ai](https://www.anthropic.com/claude): The AI assistant that ClaudeSync integrates with.

---

Made with ❤️ by the ClaudeSync team
```
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "claudesync"
version = "0.3.6"
version = "0.3.7"
authors = [
{name = "Jahziah Wagner", email = "[email protected]"},
]
Expand Down
62 changes: 62 additions & 0 deletions src/claudesync/cli/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import click

from ..exceptions import ConfigurationError
from ..utils import handle_errors


@click.group()
def config():
"""Manage claudesync configuration."""
pass


@config.command()
@click.argument("key")
@click.argument("value")
@click.pass_obj
@handle_errors
def set(config, key, value):
"""Set a configuration value."""
# Check if the key exists in the configuration
if key not in config.config:
raise ConfigurationError(f"Configuration property '{key}' does not exist.")

# Convert string 'true' and 'false' to boolean
if value.lower() == "true":
value = True
elif value.lower() == "false":
value = False
# Try to convert to int or float if possible
else:
try:
value = int(value)
except ValueError:
try:
value = float(value)
except ValueError:
pass # Keep as string if not a number

config.set(key, value)
click.echo(f"Configuration {key} set to {value}")


@config.command()
@click.argument("key")
@click.pass_obj
@handle_errors
def get(config, key):
"""Get a configuration value."""
value = config.get(key)
if value is None:
click.echo(f"Configuration {key} is not set")
else:
click.echo(f"{key}: {value}")


@config.command()
@click.pass_obj
@handle_errors
def list(config):
"""List all configuration values."""
for key, value in config.config.items():
click.echo(f"{key}: {value}")
2 changes: 2 additions & 0 deletions src/claudesync/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from .organization import organization
from .project import project
from .sync import ls, sync, schedule
from .config import config

click_completion.init()

Expand Down Expand Up @@ -53,6 +54,7 @@ def status(config):
cli.add_command(ls)
cli.add_command(sync)
cli.add_command(schedule)
cli.add_command(config)

if __name__ == "__main__":
cli()
Loading

0 comments on commit b414d0b

Please sign in to comment.