Skip to content

Commit

Permalink
Huge update for extension (v3)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Reconstruct Chrome Extension Architecture for Production-Grade Scalability (v3.0.0)
  • Loading branch information
richards199999 authored Nov 23, 2024
2 parents 33cb5f6 + 70abcf6 commit 8859b47
Show file tree
Hide file tree
Showing 48 changed files with 1,960 additions and 44 deletions.
106 changes: 106 additions & 0 deletions .github/workflows/chrome-extension-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: chrome-extension CI

on:
push:
branches: [main]
paths:
- "extensions/chrome/**"
pull_request:
branches: [main]
paths:
- "extensions/chrome/**"

defaults:
run:
working-directory: ./extensions/chrome

jobs:
lint-and-format:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Install dependencies
run: bun install

- name: Run ESLint and format fix
run: bun run fix

- name: Run markdown lint
# DON't TOUCH THIS LINE BELOW #
run: bunx markdownlint-cli2 "./**/*.md" --config .markdownlint-cli2.jsonc

test-and-build:
needs: lint-and-format
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Install dependencies
run: bun install

- name: Run tests
run: bun test

- name: Build extension
run: bun run build

- name: Zip Extension
run: zip -r chrome-extension.zip dist/

# Automatically increments the patch version (e.g., 1.0.0 -> 1.0.1)
# and creates a release
# Only increment patch version for non-major versions
- name: Check existing tag
id: check_tag
run: |
current_version=$(node -p "require('./package.json').version")
if [[ "$current_version" =~ ^[0-9]+\.0\.0$ ]]; then
# Don't increment major versions (x.0.0)
echo "version=$current_version" >> $GITHUB_OUTPUT
echo "version_changed=false" >> $GITHUB_OUTPUT
elif git ls-remote --tags origin refs/tags/v$current_version >/dev/null; then
# If tag exists and it's not a major version, increment patch
IFS='.' read -r major minor patch <<< "$current_version"
new_version="$major.$minor.$((patch + 1))"
echo "version=$new_version" >> $GITHUB_OUTPUT
echo "version_changed=true" >> $GITHUB_OUTPUT
# Update package.json with new version
sed -i "s/\"version\": \"$current_version\"/\"version\": \"$new_version\"/" package.json
# Update manifest.json with new version
sed -i "s/\"version\": \"$current_version\"/\"version\": \"$new_version\"/" public/manifest.json
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add package.json public/manifest.json
git commit -m "chore: bump version to $new_version [skip ci]"
git push
else
echo "version=$current_version" >> $GITHUB_OUTPUT
echo "version_changed=false" >> $GITHUB_OUTPUT
fi
- name: Create Release
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: softprops/action-gh-release@v1
with:
name: Chrome Extension v${{ steps.check_tag.outputs.version }}
tag_name: v${{ steps.check_tag.outputs.version }}
files: extensions/chrome/chrome-extension.zip
generate_release_notes: true
token: ${{ secrets.GITHUB_TOKEN }}
fail_on_unmatched_files: true
61 changes: 61 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Dependencies
node_modules/
.pnp/
.pnp.js
bun.lockb

# Testing
coverage/
.nyc_output/

# Production & Build files
dist/
build/
*.tsbuildinfo

# Development & IDE
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
.idea/
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json

# Debug logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
debug.log
*.log

# Cache directories
.npm/
.eslintcache
.stylelintcache
.prettiercache
.cache/

# Chrome Extension specific
*.crx
*.pem
*.zip

# Temporary files
*.swp
*.swo
*~

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
15 changes: 15 additions & 0 deletions .husky/post-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env sh

# DON'T TOUCH THIS FILE IF YOU DON'T KNOW WHAT YOU ARE DOING

echo "Checking for changes in chrome..."
if git log -1 --name-only --pretty=format: | grep "^extensions/chrome" > /dev/null; then
echo "Changes detected, fetching..."
git fetch
echo "Fetch complete"
echo "Pulling changes..."
git pull
echo "Pull complete"
fi

# TODO: config this for other extensions too
21 changes: 21 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env sh

# DON'T TOUCH THIS FILE IF YOU DON'T KNOW WHAT YOU ARE DOING

# Check if there are changes in extensions directory
if ! git diff --cached --name-only | grep "^extensions/chrome" > /dev/null; then
echo "No changes in chrome"
exit 0
fi

if ! cd extensions/chrome; then
echo "Failed to change directory"
exit 1
fi

if ! bun run lint:staged; then
echo "Lint failed"
exit 1
fi

# TODO: config this for other extensions too
110 changes: 67 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,71 +6,93 @@ Let Claude think comprehensively before responding!
> Thinking claude **is not aimed for benchmarks or huge leaps in math or something**, since those are pre-determined by the base model (new Claude-3.5 Sonnet).
> I only want to explore how further we could reach with Claude's "deep mindset". That said, when using it in your daily tasks, you will find Claude's inner monolog (thinking process) very very fun and interesting.
## Demo:

## Demo

https://github.com/user-attachments/assets/88ff0c75-c51b-42b9-a042-00d47053795a


## Overview

This project consists of two main components:

1. **Thinking Protocol**: A comprehensive set of instructions that guides Claude to think deeply and systematically before responding
2. **Browser Extension**: A tool that makes Claude's thinking process more readable and manageable in the browser interface

## Project Structure
thinking-claude/
├── extension/
│ ├── .vscode/
│ ├── chrome/
│ ├── firefox/
│ └── changelog.md
├── model_instructions/
│ ├── changelog.md
│ ├── v3.5-20241113.md
│ ├── v4-20241118.md
│ └── v4-lite-20241118.md
├── LICENSE
└── README.md
The project is organized into two main directories:
- `extension/`: Contains browser extension implementations
- `model_instructions/`: Contains thinking protocols for different versions

Each directory maintains its own changelog for version tracking.

```bash
thinking-claude/
├── extensions/
│ ├── chrome/ # Current version of Chrome extension
│ ├── chrome_v0/ # Legacy Chrome extension (deprecated)
│ ├── firefox/ # Firefox extension (in development)
│ └── changelog.md
├── model_instructions/
│ ├── changelog.md
│ ├── v5-Exp-20241123.md
│ ├── v4-20241118.md
│ ├── v4-lite-20241118.md
│ └── v3.5-20241113.md
├── .github/ # GitHub configurations and workflows
├── .husky/ # Git hooks for development
├── LICENSE
└── README.md
```

The project is organized into two main components:

- `extensions/`: Browser extension implementations

- `chrome/`: Current version with modern architecture and features
- `chrome_v0/`: Legacy version (deprecated)
- `firefox/`: Firefox version (in development)

- `model_instructions/`: Thinking protocols for different versions
- Contains versioned instruction sets
- Each version brings improvements to Claude's thinking process

## Thinking Protocol

The thinking protocol instructs Claude to follow a natural, thorough thought process before providing responses.

## Browser Extension

The browser extension enhances the Claude interface by making the thinking process more manageable:
The browser extension makes Claude's thinking process easier to read and use! It automatically organizes Claude's thoughts into neat, collapsible sections.

### Features
- 🔄 Collapsible thinking process sections
- 📋 Easy copy functionality
- 🎯 Clean and intuitive interface
- ⚡ Automatic processing of new messages

### Installation
- 🎯 Makes Claude's thinking process easy to read
- 🔄 Fold and unfold different parts of Claude's thoughts
- 📋 Copy any part with just one click
- ⚡ Works automatically with new messages
- 🎨 Clean, modern design that's easy on the eyes

### 🚀 Quick Install Guide

#### Chrome
1. **Chrome Users (Recommended)**

**Quick Install:**
Install directly from the [Chrome Web Store](https://chromewebstore.google.com/detail/thinking-claude/ncjafpbbndpggfhfgjngkcimeaciahpo)
- Install directly from the [Chrome Web Store](https://chromewebstore.google.com/detail/thinking-claude/ncjafpbbndpggfhfgjngkcimeaciahpo)

**Manual Installation:**
1. Clone the repository:
```bash
git clone https://github.com/yourusername/thinking-claude.git
2. Open Chrome and navigate to `chrome://extensions/`
3. Enable "Developer mode"
4. Click "Load unpacked" and select the `extension/chrome` folder
2. **Manual Installation**
- Download the latest version from our [Releases Page](https://github.com/richards199999/Thinking-Claude/releases)
- Unzip the file
- Open Chrome and go to `chrome://extensions/`
- Turn on "Developer mode" (top right corner)
- Click "Load unpacked" and select the unzipped folder

#### Firefox
1. Clone this repository
2. Open Firefox and navigate to `about:debugging#/runtime/this-firefox`
3. Click "Load Temporary Add-on"
4. Navigate to the repository and select the `extension/firefox/manifest.json` file
👉 Want more details? Check out our [Extension Guide](extensions/chrome/README.md) for:

- Step-by-step installation instructions
- Development setup
- Advanced features and usage
- Troubleshooting tips

### 🎉 Getting Started

Once installed, just:

1. Visit [Claude.ai](https://claude.ai)
2. Start chatting with Claude
3. That's it! The extension will automatically make Claude's thinking process more readable

## Usage

Expand All @@ -79,11 +101,12 @@ Install directly from the [Chrome Web Store](https://chromewebstore.google.com/d
1. Copy the latest version in `model_instructions` folder
2. Start a new Project in Claude.ai
3. Paste the instructions to the Custom Instructions section
3. Claude will now follow the thinking protocol for all subsequent interactions
4. Claude will now follow the thinking protocol for all subsequent interactions

### Using the Extension

Once installed, the extension automatically:

- Detects Claude's thinking process blocks
- Adds collapse/expand functionality
- Provides a copy button for each block
Expand All @@ -98,6 +121,7 @@ Once installed, the extension automatically:
## Contributing

Contributions are welcome! Feel free to:

- Submit bug reports
- Propose new features
- Create pull requests
Expand Down
File renamed without changes.
27 changes: 27 additions & 0 deletions extensions/chrome/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Dependencies
node_modules/

# Package manager files
bun.lockb

# Build output
dist/
build/

# IDE and editor files
.idea/
.vscode/
*.swp
*.swo
.DS_Store

# Environment variables
.env
.env.local
.env.*.local

# Debug logs
debug.log

# Test coverage
coverage/
Loading

0 comments on commit 8859b47

Please sign in to comment.