Skip to content

Commit 4ccab57

Browse files
tomymaritanoclaude
andauthored
feat(ai): complete Phase 4-5 — AI command execution + plugin bridge (#150)
## Summary - **Phase 4 (AI Knowledge)**: Wire `ai:summarize`, `ai:rewrite`, `ai:tweet` commands with real Claude prompts and output routing (replace selection, insert at cursor, or show in panel) - **Phase 5 (Extensibility)**: Bridge plugin AI command store → command palette so plugin-registered AI commands are discoverable and executable ## Changes ### Phase 4 - Add built-in prompt templates (SUMMARIZE, REWRITE, TWEET) to `packages/ai-assistant` - AiPanel supports `initialCommand` prop for auto-execution - Output target routing: `replace` swaps editor selection, `insert` adds at cursor, `panel` shows in chat - Handler wiring in App.tsx → useRegisterAiCommands ### Phase 5 - New `useRegisterPluginAiCommands` hook subscribes to `aiCommandStore` and syncs to `CommandRegistry` - Plugin AI commands auto-appear in command palette with `AI:` prefix - Template resolution with editor context (`{{selection}}`, `{{note}}`, `{{title}}`) - Automatic cleanup on plugin unload ## Test plan - [ ] Open command palette → verify Summarize/Rewrite/Tweet commands appear - [ ] Select text → invoke Summarize → AI panel shows summary - [ ] Select text → invoke Rewrite → selection replaced in editor - [ ] Select text → invoke Tweet → AI panel shows tweet version - [ ] Cmd+K opens AI panel in chat mode - [ ] Cmd+Shift+K opens AI panel in ask-notes mode 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Added AI command suite: summarize, rewrite, and tweet built-in AI commands with panel integration. * Introduced violet-centric design system with new color tokens and theme consistency. * Enabled automated release workflow via GitHub Actions with semantic versioning. * **Bug Fixes** * Enhanced token encoding for secure authentication flows. * Improved sync error handling with better retry logic and abort handling. * **Documentation** * Added comprehensive roadmap and changelog documentation. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 21af479 commit 4ccab57

66 files changed

Lines changed: 1251 additions & 222 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/RELEASE.md

Lines changed: 59 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,72 @@
22

33
## Overview
44

5-
Releases are automated via GitHub Actions. When you push a tag starting with `v` (e.g., `v0.1.0`), the release workflow builds and publishes distributables for macOS, Windows, and Linux.
5+
Releases follow Git Flow and are fully automated via GitHub Actions.
6+
7+
## Flow
8+
9+
```
10+
develop → release/X.Y.Z branch → PR to main → merge
11+
↓ auto-tag.yml triggers:
12+
1. Creates git tag vX.Y.Z from package.json version
13+
2. Merges main → develop (keeps branches aligned)
14+
↓ release.yml triggers (on tag push):
15+
3. Builds distributables (macOS, Windows, Linux)
16+
4. Creates draft GitHub Release with artifacts
17+
5. Posts tweet announcement
18+
```
619

720
## Creating a Release
821

922
```bash
10-
# 1. Update version in apps/desktop/package.json
11-
# 2. Commit the change
12-
git add apps/desktop/package.json
13-
git commit -m "chore: bump version to 0.1.0"
14-
15-
# 3. Create and push the tag
16-
git tag v0.1.0
17-
git push origin main --tags
23+
# 1. Create release branch from develop
24+
git checkout develop
25+
git pull origin develop
26+
git checkout -b release/0.9.0
27+
28+
# 2. Bump version in root package.json + apps/desktop/package.json
29+
# 3. Update CHANGELOG.md
30+
# 4. Commit and push
31+
git add -A
32+
git commit -m "chore(release): bump version to 0.9.0"
33+
git push -u origin release/0.9.0
34+
35+
# 5. Create PR targeting main
36+
gh pr create --base main --title "chore(release): v0.9.0" --body "Release 0.9.0"
37+
38+
# 6. Once CI passes and PR merges → tag + release + sync happen automatically
1839
```
1940

20-
The workflow will:
41+
The release workflow will:
42+
43+
1. Validate tag matches `package.json` version
44+
2. Build packages for all platforms (macOS, Windows, Linux)
45+
3. Sign and notarize the macOS build (if secrets are configured)
46+
4. Create a draft GitHub Release with all artifacts
47+
5. Post tweet announcement
48+
49+
## Versioning
50+
51+
- **Format:** SemVer with `v` prefix — `v0.9.0`, `v0.9.1`, `v1.0.0`
52+
- **Tags are created ONLY by GitHub Actions** (auto-tag.yml)
53+
- **No manual tags** — the automation reads version from `package.json`
54+
55+
## Tag Protection Rules (GitHub Settings)
56+
57+
Configure in **Repository Settings > Rules > Tag protection rules**:
58+
59+
| Setting | Value |
60+
| ----------------- | --------------------------------- |
61+
| Tag name pattern | `v*` |
62+
| Restrict creation | Enabled |
63+
| Allowed to create | GitHub Actions, Repository admins |
64+
| Force push | Disabled |
65+
66+
This prevents:
2167

22-
1. Build packages for all platforms
23-
2. Sign and notarize the macOS build (if secrets are configured)
24-
3. Create a draft GitHub release with all artifacts
68+
- Manual tags outside the release flow
69+
- Force-pushing tags (rewriting release history)
70+
- Tags that don't follow SemVer
2571

2672
## Required Secrets
2773

.github/workflows/auto-tag.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Auto Tag & Sync
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches: [main]
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
tag-and-sync:
13+
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout main
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
token: ${{ secrets.GH_TOKEN }}
22+
23+
- name: Setup pnpm
24+
uses: pnpm/action-setup@v4
25+
26+
- name: Read version from package.json
27+
id: version
28+
run: |
29+
VERSION=$(node -p "require('./package.json').version")
30+
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
31+
echo "tag=v${VERSION}" >> "$GITHUB_OUTPUT"
32+
33+
- name: Check tag doesn't already exist
34+
id: check
35+
env:
36+
TAG_VERSION: ${{ steps.version.outputs.version }}
37+
run: |
38+
if git rev-parse "v${TAG_VERSION}" >/dev/null 2>&1; then
39+
echo "exists=true" >> "$GITHUB_OUTPUT"
40+
else
41+
echo "exists=false" >> "$GITHUB_OUTPUT"
42+
fi
43+
44+
- name: Create and push tag
45+
if: steps.check.outputs.exists == 'false'
46+
env:
47+
TAG_NAME: ${{ steps.version.outputs.tag }}
48+
run: |
49+
git config user.name "github-actions[bot]"
50+
git config user.email "github-actions[bot]@users.noreply.github.com"
51+
git tag -a "${TAG_NAME}" -m "Release ${TAG_NAME}"
52+
git push origin "${TAG_NAME}"
53+
54+
- name: Merge main → develop
55+
run: |
56+
git fetch origin develop
57+
git checkout develop
58+
git merge main --no-edit
59+
git push origin develop

.github/workflows/release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,32 @@ permissions:
1010
contents: write
1111

1212
jobs:
13+
# ── Validate tag matches package.json ─────────
14+
validate:
15+
runs-on: ubuntu-latest
16+
if: startsWith(github.ref, 'refs/tags/')
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Validate tag matches package.json
22+
env:
23+
GIT_REF: ${{ github.ref }}
24+
run: |
25+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
26+
TAG_VERSION=${GIT_REF#refs/tags/v}
27+
28+
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
29+
echo "::error::Tag version (${TAG_VERSION}) does not match package.json (${PACKAGE_VERSION})"
30+
exit 1
31+
fi
32+
33+
echo "✓ Tag v${TAG_VERSION} matches package.json ${PACKAGE_VERSION}"
34+
35+
# ── Build for all platforms ───────────────────
1336
build:
37+
needs: [validate]
38+
if: always() && (needs.validate.result == 'success' || needs.validate.result == 'skipped')
1439
strategy:
1540
matrix:
1641
include:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ npm-debug.log*
3939
# Claude cache (keep plans)
4040
.claude/plugins/
4141
.claude/statsig/
42+
.vercel

CHANGELOG.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,51 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212

1313
---
1414

15+
## [0.9.0] - 2026-03-13
16+
17+
### Added
18+
19+
#### Website
20+
21+
- Full website redesign with shadcn/ui + Magic UI
22+
23+
#### Auth
24+
25+
- Auth UX rethink with Enable Sync flow
26+
- Auth middleware fix: return 401 instead of 500 on invalid tokens
27+
28+
#### Sync
29+
30+
- Error propagation for sync failures
31+
- Exponential backoff on retry
32+
- Abort sync on logout
33+
- Typed token refresh
34+
- Sync onboarding prompt after 5 notes
35+
- Offline queue visibility in the UI
36+
37+
#### AI Commands (Cmd+K v1)
38+
39+
- Command panel for AI interactions
40+
- AI settings configuration
41+
- Keybindings for AI commands
42+
43+
#### AI Knowledge (Cmd+K v2)
44+
45+
- RAG-based knowledge retrieval
46+
- Ask Notes: query your own notes with AI
47+
- Related context suggestions
48+
49+
#### AI Extensibility
50+
51+
- Plugin API for AI commands
52+
- Presets import/export
53+
54+
#### Documentation
55+
56+
- API documentation
57+
58+
---
59+
1560
## [0.1.2] - 2026-01-01
1661

1762
### Fixed

0 commit comments

Comments
 (0)