hale-commenting-system 1.0.7 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,20 +1,21 @@
1
- # @apollo/commenting-system
1
+ # hale-commenting-system
2
2
 
3
- A reusable React commenting system with GitHub/GitLab integration and AI-powered summarization.
3
+ A local-first React commenting system with localStorage persistence. Perfect for prototypes, design reviews, and local development.
4
4
 
5
5
  ## Features
6
6
 
7
- - 📌 **Visual Comment Pins** - Click anywhere to add comment threads
8
- - 🔄 **GitHub/GitLab Sync** - Two-way sync with issue trackers
9
- - 🤖 **AI Summarization** - Powered by DeepSeek R1 via MaaS
10
- - 📦 **Version Management** - Track comments across prototype versions
7
+ - 📌 **Visual Comment Pins** - Click anywhere on your app to add comment threads
8
+ - 💾 **LocalStorage Persistence** - Comments persist across page refreshes
9
+ - 🔄 **Threaded Conversations** - Add multiple replies to each comment pin
10
+ - 📦 **Version Management** - Filter comments by prototype version
11
11
  - 🎨 **PatternFly UI** - Built with PatternFly React components
12
12
  - 🧙 **CLI Wizard** - Automated setup with `npx hale-commenting-system init`
13
+ - 🚀 **Zero Configuration** - No backend, no auth, no setup hassle
13
14
 
14
15
  ## Installation
15
16
 
16
17
  ```bash
17
- npm install @apollo/commenting-system
18
+ npm install hale-commenting-system
18
19
  ```
19
20
 
20
21
  ## Quick Start
@@ -26,185 +27,195 @@ npx hale-commenting-system init
26
27
  ```
27
28
 
28
29
  This will:
29
- - Detect your project type (React, PatternFly, Vite/Webpack)
30
- - Prompt for GitHub OAuth credentials
31
- - Generate serverless authentication functions
32
- - Create environment files (.env.local, .env.example)
33
- - Generate apollo-comments.config.json
34
- - Provide integration instructions
30
+ 1. Detect your React project
31
+ 2. Auto-integrate the commenting system into your App component
32
+ 3. You're done! Start your dev server and click anywhere to add comments
35
33
 
36
- ## Manual Setup
34
+ ## How It Works
37
35
 
38
- ### 1. Basic Setup
36
+ All comments are stored locally in your browser's localStorage. They persist across:
37
+ - Page refreshes
38
+ - Browser restarts
39
+ - Dev server restarts
40
+
41
+ Perfect for:
42
+ - Local prototyping
43
+ - Design reviews
44
+ - Quick feedback sessions
45
+ - Testing before adding a backend
46
+
47
+ ## Usage
48
+
49
+ Once installed, the commenting system provides two modes:
50
+
51
+ ### View Mode (Default)
52
+ - Click the "Show Pins" toggle to see existing comment pins
53
+ - Click on pins to view threads and replies
54
+ - Read-only, no editing
55
+
56
+ ### Comment Mode
57
+ - Click "Enable Commenting" to enter edit mode
58
+ - Your cursor becomes a crosshair
59
+ - Click anywhere to create a new comment thread
60
+ - Click pins to add replies, edit, or delete
61
+
62
+ ### Keyboard Shortcuts
63
+ - Press `Enter` in the comment textarea to submit
64
+ - Press `Esc` to close the comment drawer
65
+
66
+ ## Manual Integration
67
+
68
+ If the CLI doesn't work for your project, you can manually integrate:
39
69
 
40
70
  ```tsx
71
+ import React from 'react';
72
+ import { BrowserRouter as Router } from 'react-router-dom';
41
73
  import {
42
74
  CommentProvider,
43
- VersionProvider,
44
- GitHubAuthProvider,
45
75
  CommentOverlay,
46
76
  CommentDrawer
47
- } from '@apollo/commenting-system';
48
- import apolloCommentsConfig from './apollo-comments.config.json';
49
- import React from 'react';
77
+ } from 'hale-commenting-system';
50
78
 
51
79
  function App() {
52
80
  const [selectedThreadId, setSelectedThreadId] = React.useState<string | null>(null);
53
81
 
54
82
  return (
55
- <GitHubAuthProvider config={apolloCommentsConfig}>
56
- <VersionProvider>
57
- <CommentProvider>
58
- <CommentDrawer
83
+ <Router>
84
+ <CommentProvider>
85
+ <CommentDrawer
86
+ selectedThreadId={selectedThreadId}
87
+ onThreadSelect={setSelectedThreadId}
88
+ >
89
+ <CommentOverlay
59
90
  selectedThreadId={selectedThreadId}
60
91
  onThreadSelect={setSelectedThreadId}
61
- >
62
- <CommentOverlay
63
- selectedThreadId={selectedThreadId}
64
- onThreadSelect={setSelectedThreadId}
65
- />
66
- {/* Your app content */}
67
- </CommentDrawer>
68
- </CommentProvider>
69
- </VersionProvider>
70
- </GitHubAuthProvider>
92
+ />
93
+ {/* Your app content */}
94
+ </CommentDrawer>
95
+ </CommentProvider>
96
+ </Router>
71
97
  );
72
98
  }
73
99
  ```
74
100
 
75
- ### 2. API Configuration
76
-
77
- The CLI generates serverless functions for GitHub OAuth. For manual setup, create:
101
+ ## API
78
102
 
79
- **Vercel**: `/api/github-oauth-login.ts` and `/api/github-oauth-callback.ts`
80
- **Netlify**: `/netlify/functions/github-oauth-login.ts` and `/netlify/functions/github-oauth-callback.ts`
103
+ ### `<CommentProvider>`
104
+ Root provider that manages comment state and localStorage persistence.
81
105
 
82
- See the [manual setup guide](https://github.com/apollo/commenting-system/blob/main/docs/manual-setup.md) for templates.
106
+ ### `<CommentOverlay>`
107
+ Invisible overlay that handles click events for creating new comments.
83
108
 
84
- ### 3. Environment Variables
109
+ **Props:**
110
+ - `selectedThreadId: string | null` - Currently selected thread ID
111
+ - `onThreadSelect: (id: string | null) => void` - Callback when a thread is selected
85
112
 
86
- ```env
87
- GITHUB_CLIENT_ID=your_github_client_id
88
- GITHUB_CLIENT_SECRET=your_github_client_secret
89
- GITHUB_OWNER=your_github_org
90
- GITHUB_REPO=your_repo_name
113
+ ### `<CommentDrawer>`
114
+ Sidebar drawer that displays the selected thread and its replies.
91
115
 
92
- # Vite (if using Vite)
93
- VITE_GITHUB_CLIENT_ID=your_github_client_id
94
- VITE_GITHUB_OWNER=your_github_org
95
- VITE_GITHUB_REPO=your_repo_name
96
- ```
97
-
98
- ## CLI Commands
99
-
100
- ### Initialize
101
-
102
- ```bash
103
- hale-commenting-system init
104
- ```
116
+ **Props:**
117
+ - `selectedThreadId: string | null` - Thread to display
118
+ - `onThreadSelect: (id: string | null) => void` - Callback to close the drawer
119
+ - `children: React.ReactNode` - Your app content
105
120
 
106
- Options:
107
- - `-y, --yes` - Skip prompts and use defaults
108
- - `--platform <platform>` - Specify platform (vercel, netlify, manual)
121
+ ### `useComments()` Hook
109
122
 
110
- ### Validate
123
+ Access comment state and actions:
111
124
 
112
- ```bash
113
- hale-commenting-system validate
125
+ ```tsx
126
+ import { useComments } from 'hale-commenting-system';
127
+
128
+ function MyComponent() {
129
+ const {
130
+ threads, // All comment threads
131
+ showPins, // Whether pins are visible
132
+ enableCommenting, // Whether commenting mode is active
133
+ toggleShowPins, // Toggle pin visibility
134
+ toggleEnableCommenting, // Toggle commenting mode
135
+ addThread, // Create a new thread
136
+ addReply, // Add a reply to a thread
137
+ updateComment, // Update a comment
138
+ deleteComment, // Delete a comment
139
+ deleteThread, // Delete a thread
140
+ clearAllThreads, // Clear all comments
141
+ getThreadsForRoute // Get comments for current route
142
+ } = useComments();
143
+ }
114
144
  ```
115
145
 
116
- Checks your setup for:
117
- - Configuration files
118
- - Serverless functions
119
- - GitHub connectivity
120
- - Repository access
121
-
122
- ## Components
123
-
124
- ### Core Components
146
+ ## Version Management
125
147
 
126
- - **CommentOverlay** - Renders comment pins on the page
127
- - **CommentDrawer** - Side panel for viewing/editing comments
128
- - **CommentPin** - Individual comment pin component
129
- - **AIAssistant** - AI chatbot toggle and panel
148
+ The system supports filtering comments by version (useful for iterating on prototypes):
130
149
 
131
- ### Providers
132
-
133
- - **CommentProvider** - Comment state and CRUD operations
134
- - **VersionProvider** - Version management
135
- - **GitHubAuthProvider** - GitHub authentication
136
- - **GitLabAuthProvider** - GitLab authentication
137
- - **AIProvider** - AI chat state and API calls
138
-
139
- ## Types
150
+ ```tsx
151
+ import { VersionProvider, useVersion } from 'hale-commenting-system';
140
152
 
141
- ```typescript
142
- import type {
143
- Comment,
144
- Thread,
145
- SyncStatus,
146
- AIMessage,
147
- GitHubResult
148
- } from '@apollo/commenting-system';
149
- ```
153
+ function App() {
154
+ return (
155
+ <VersionProvider>
156
+ <CommentProvider>
157
+ {/* Your app */}
158
+ </CommentProvider>
159
+ </VersionProvider>
160
+ );
161
+ }
150
162
 
151
- ## Peer Dependencies
152
-
153
- - @patternfly/react-core: ^6.0.0
154
- - @patternfly/react-icons: ^6.0.0
155
- - @patternfly/chatbot: ^6.0.0
156
- - react: ^18.0.0
157
- - react-dom: ^18.0.0
158
- - react-router-dom: ^6.0.0 || ^7.0.0
159
-
160
- ## Configuration File
161
-
162
- The CLI generates `apollo-comments.config.json`:
163
-
164
- ```json
165
- {
166
- "version": "1.0.0",
167
- "platform": "vercel",
168
- "github": {
169
- "owner": "your-org",
170
- "repo": "your-repo",
171
- "clientId": "your-client-id"
172
- },
173
- "redirectUri": "https://your-domain.com/api/github-oauth-callback",
174
- "features": {
175
- "aiSummarization": true,
176
- "versionTracking": true,
177
- "gitlabIntegration": false
178
- }
163
+ // In your component
164
+ function MyComponent() {
165
+ const { currentVersion, setCurrentVersion } = useVersion();
166
+
167
+ // Comments are automatically filtered by version
168
+ return (
169
+ <select value={currentVersion} onChange={(e) => setCurrentVersion(e.target.value)}>
170
+ <option value="1">Version 1</option>
171
+ <option value="2">Version 2</option>
172
+ <option value="3">Version 3 (current)</option>
173
+ </select>
174
+ );
179
175
  }
180
176
  ```
181
177
 
182
- ## Development
178
+ ## TypeScript
183
179
 
184
- ```bash
185
- # Install dependencies
186
- npm install
180
+ The package includes full TypeScript definitions:
187
181
 
188
- # Build library and CLI
189
- npm run build
190
-
191
- # Watch mode (library only)
192
- npm run dev
182
+ ```tsx
183
+ import type { Thread, Comment } from 'hale-commenting-system';
184
+
185
+ interface Thread {
186
+ id: string;
187
+ x: number;
188
+ y: number;
189
+ route: string;
190
+ comments: Comment[];
191
+ version?: string;
192
+ }
193
193
 
194
- # Type check
195
- npm run type-check
194
+ interface Comment {
195
+ id: string;
196
+ author?: string;
197
+ text: string;
198
+ createdAt: string;
199
+ }
196
200
  ```
197
201
 
198
- ## Testing the Package Locally
202
+ ## Browser Compatibility
199
203
 
200
- ```bash
201
- # In this package directory
202
- npm link
204
+ Works in all modern browsers that support:
205
+ - localStorage
206
+ - React 18+
207
+ - ES2020+
203
208
 
204
- # In your test project
205
- npm link @apollo/commenting-system
206
- apollo-comments init
207
- ```
209
+ ## Roadmap
210
+
211
+ This is the MVP (local-only) version. Future enhancements:
212
+ - [ ] Backend sync (GitHub Issues, GitLab, custom)
213
+ - [ ] OAuth authentication
214
+ - [ ] Real-time collaboration
215
+ - [ ] Export/import comments
216
+ - [ ] Comment notifications
217
+ - [ ] Rich text editing
218
+ - [ ] File attachments
208
219
 
209
220
  ## License
210
221
 
@@ -213,10 +224,3 @@ MIT
213
224
  ## Author
214
225
 
215
226
  Justin Hale
216
-
217
- ## Support
218
-
219
- - [Documentation](https://github.com/apollo/commenting-system)
220
- - [Issues](https://github.com/apollo/commenting-system/issues)
221
- - [Discussions](https://github.com/apollo/commenting-system/discussions)
222
-