Skip to content

Commit de528bc

Browse files
jsonifyclaudeJason Rueckertgemini-code-assist[bot]
authored
Claude/review auto tagging docs 011 c uu z pg hdk v he mn e qf4f fy (#75)
* feat: implement Smart Auto-Tagging infrastructure (Phase 1) - Add TagParser for YAML frontmatter tag storage with metadata * Supports tags format: [tag1, tag2, tag3] * Stores tag metadata: name, confidence, source, addedAt * Preserves existing frontmatter fields * Compatible with existing tag system - Add TagManager for comprehensive tag operations * CRUD operations: tagNote, getNoteTags, removeTag, removeAllTags * Advanced operations: renameTag, mergeTags, deleteTag * Search functionality: findNotesByTag, getAllTags * In-memory caching with 5s TTL for performance * Excludes template files from operations - Add TagGenerator with VS Code LLM API integration * AI-powered tag generation using GitHub Copilot (gpt-4o) * Confidence-based filtering (>0.6 threshold) * Content hashing (SHA-256) for cache invalidation * Configurable tag categories and exclude patterns * Graceful error handling for offline/rate limit scenarios - Add configuration settings for auto-tagging * noted.tagging.enabled (default: true) * noted.tagging.autoTagOnCreate (default: false) * noted.tagging.maxTags (default: 5) * noted.tagging.customCategories (default: []) * noted.tagging.excludePatterns (default: ["draft", "temp"]) - Install js-yaml dependency for frontmatter parsing - Update documentation (CHANGELOG.md, CLAUDE.md) Implements design from dev-docs/DESIGN-AUTO-TAGGING.md Part of Smart Auto-Tagging feature implementation * feat: add Smart Auto-Tagging UI integration (Phase 3) - Register new auto-tagging commands in extension.ts * noted.generateTags - Generate tags for a note with AI * noted.generateTagsCurrentNote - Generate tags for current note * noted.batchGenerateTags - Batch process multiple notes * noted.manageNoteTags - Manually manage tags with AI suggestions * noted.addCustomTag - Add custom tags manually - Add command definitions to package.json * All commands available via Command Palette * Icons: sparkle for AI generation, tag for custom tags - Add context menu integration * Right-click on notes in tree view to access commands * Commands appear in 'ai@' group alongside other AI features * Generate Tags and Manage Note Tags available in context menu - Interactive UI features * Quick pick for reviewing suggested tags with confidence scores * Multi-select interface for choosing which tags to apply * Progress indicators for batch operations * Full error handling with user-friendly messages - Update CHANGELOG with Phase 3 features Implements Phase 3 from dev-docs/DESIGN-AUTO-TAGGING.md All code compiles successfully * feat: add Smart Auto-Tagging advanced features (Phase 4) - Implement auto-tagging on note creation * Add autoTagOnCreate.ts module for background auto-tagging * Hooks into openDailyNote() and createNoteFromTemplate() * Controlled by noted.tagging.autoTagOnCreate setting (default: false) * Waits 2 seconds after creation to avoid interrupting user * Only applies high-confidence tags (>0.75) automatically * Shows notification with option to view/manage tags * Skips notes shorter than 50 characters * Non-blocking: runs in background without blocking UI - Add comprehensive tag statistics and analytics * New tagStatistics.ts module for tag analytics * noted.showTagStats - Quick summary dialog with key metrics * noted.showTagStatsDetailed - Beautiful webview with charts * Tracks: - Total unique tags and tag occurrences - Tagged vs untagged notes count - Average tags per note - Most used tags (top 10) - AI-generated vs manual tag breakdown - Recently added tags (last 24 hours) * Interactive webview with: - Stat cards for key metrics - Progress bars for AI vs manual tags - Sorted tag lists with usage counts - Recent activity timeline - Relative time formatting - Register new commands in extension.ts and package.json * Icons: for stats, for detailed view - Update CHANGELOG with Phase 4 features Implements Phase 4 (Advanced Features) from dev-docs/DESIGN-AUTO-TAGGING.md All code compiles successfully * docs: add comprehensive Smart Auto-Tagging documentation - Add dev-docs/TESTING-AUTO-TAGGING.md * Step-by-step testing guide for developers * 7 different test scenarios with expected results * Configuration testing instructions * Troubleshooting common issues * Performance benchmarks * What to look for when testing - Add docs/auto-tagging.md * Complete user guide for Smart Auto-Tagging * Quick start tutorial with examples * Feature documentation (auto-tag, statistics, manual) * Configuration reference with all settings * Tag quality tips and best practices * Real-world examples (bug reports, meetings, research) * Use cases and workflows * Integration with existing features * Troubleshooting section * FAQ * Privacy information Provides complete documentation for testing and using the feature * refactor: simplify command titles and update tag handling to support array format * Update src/tagging/TagManager.ts Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * fix: ensure tagged-at is updated correctly based on tag presence in frontmatter --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Jason Rueckert <jruecke@costco.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent eb7636c commit de528bc

File tree

13 files changed

+2786
-59
lines changed

13 files changed

+2786
-59
lines changed

CHANGELOG.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,48 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [Unreleased]
6+
7+
### Features
8+
9+
* **Smart Auto-Tagging (Phase 1 - Infrastructure)**: Implement core auto-tagging infrastructure
10+
- Add `TagParser` for YAML frontmatter tag storage with metadata
11+
- Add `TagManager` for comprehensive tag operations (CRUD, search, rename, merge)
12+
- Add `TagGenerator` with VS Code LLM API integration for AI-powered tag suggestions
13+
- Add configuration settings for tagging (enabled, maxTags, customCategories, excludePatterns)
14+
- Install `js-yaml` dependency for frontmatter parsing
15+
- Tags stored in frontmatter format: `tags: [tag1, tag2, tag3]`
16+
- Full caching support for performance optimization
17+
- Compatible with existing tag system (inline #hashtags and frontmatter tags)
18+
19+
* **Smart Auto-Tagging (Phase 3 - UI Integration)**: Connect infrastructure to VS Code UI
20+
- Add `noted.generateTags` command for AI-powered tag generation
21+
- Add `noted.generateTagsCurrentNote` command for current note
22+
- Add `noted.batchGenerateTags` command for batch processing
23+
- Add `noted.manageNoteTags` command for manual tag management
24+
- Add `noted.addCustomTag` command for adding custom tags
25+
- Context menu integration in notes tree view (right-click on notes)
26+
- Commands available via Command Palette
27+
- Interactive quick pick UI for reviewing and selecting suggested tags
28+
- Progress indicators for batch operations
29+
- Full error handling with user-friendly messages
30+
31+
* **Smart Auto-Tagging (Phase 4 - Advanced Features)**: Enhance tagging with smart automation
32+
- Auto-tag on note creation (controlled by `noted.tagging.autoTagOnCreate` setting)
33+
* Automatically tags new notes 2 seconds after creation
34+
* Only applies high-confidence tags (>0.75) automatically
35+
* Works for daily notes and template-based notes
36+
* Non-blocking: runs in background without interrupting workflow
37+
* Shows notification with option to view/manage tags
38+
- Tag statistics and analytics
39+
* `noted.showTagStats` - Quick summary of tag usage
40+
* `noted.showTagStatsDetailed` - Beautiful webview with comprehensive statistics
41+
* Shows total tags, tagged/untagged notes, average tags per note
42+
* Displays most used tags with usage counts
43+
* Tracks AI-generated vs manually added tags
44+
* Shows recently added tags (last 24 hours)
45+
* Visual progress bars and interactive charts
46+
547
## [1.39.0](https://github.com/jsonify/noted/compare/v1.38.1...v1.39.0) (2025-11-08)
648

749

CLAUDE.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ The extension now uses a fully modular architecture with clear separation of con
5353
- `undoHelpers.ts`: Undo operation helpers (v1.13.0)
5454
- `graphService.ts`: Graph data preparation and analysis (v1.14.0)
5555
- `activityService.ts`: Activity metrics collection and analysis (v1.36.0)
56+
- **`src/tagging/`**: Smart Auto-Tagging infrastructure (v1.40.0 - Phase 1)
57+
- `TagParser.ts`: YAML frontmatter tag parsing and writing
58+
- `TagManager.ts`: Tag CRUD operations, search, rename, merge
59+
- `TagGenerator.ts`: AI-powered tag generation using VS Code LLM API
60+
- `autoTagCommands.ts`: Command handlers for auto-tagging features
5661
- **`src/providers/`**: VS Code tree view providers
5762
- `treeItems.ts`: Tree item classes (includes ConnectionSectionItem and ConnectionItem)
5863
- `templatesTreeProvider.ts`: Templates view
@@ -198,6 +203,42 @@ The extension now uses a fully modular architecture with clear separation of con
198203
- `openWorkspaceSearch()` opens VS Code search with tag regex pattern
199204
- `hasChildren()`, `getChildCount()` helper methods for hierarchy checks
200205

206+
- **TagParser** (v1.40.0 - Smart Auto-Tagging Phase 1): YAML frontmatter tag parsing and writing
207+
- `parseTags()` extracts tags from YAML frontmatter with metadata
208+
- `writeTags()` inserts or updates frontmatter with tags in array format `[tag1, tag2, tag3]`
209+
- `hasFrontmatter()` checks if file has YAML frontmatter block
210+
- `removeTags()` removes all tags from a note
211+
- Preserves existing frontmatter fields when updating
212+
- Compatible with existing tag extraction system
213+
- Stores tag metadata: name, confidence, source (ai/manual), addedAt timestamp
214+
215+
- **TagManager** (v1.40.0 - Smart Auto-Tagging Phase 1): Comprehensive tag management operations
216+
- `tagNote()` applies tags to a note file (merge or replace mode)
217+
- `getNoteTags()` retrieves all tags from a specific note
218+
- `findNotesByTag()` searches for notes containing a specific tag
219+
- `getAllTags()` returns map of all unique tags with occurrence counts
220+
- `removeTag()` removes a specific tag from a note
221+
- `removeAllTags()` clears all tags from a note
222+
- `renameTag()` renames a tag across all notes
223+
- `mergeTags()` merges multiple tags into a single tag
224+
- `deleteTag()` deletes a tag from all notes
225+
- In-memory caching with TTL for performance (5 second cache)
226+
- Singleton instance exported as `tagManager`
227+
- Excludes template files from operations
228+
229+
- **TagGenerator** (v1.40.0 - Smart Auto-Tagging Phase 1): AI-powered tag generation using VS Code LLM API
230+
- `generateTags()` analyzes note content and generates tag suggestions with confidence scores
231+
- Uses GitHub Copilot (gpt-4o) via VS Code Language Model API
232+
- `buildTagPrompt()` constructs prompts with available categories and tagging rules
233+
- `getCategories()` returns default + custom tag categories from configuration
234+
- `parseTagResponse()` parses JSON response from LLM and filters by confidence (>0.6)
235+
- Content hashing (SHA-256) for cache invalidation
236+
- `needsRetagging()` checks if content has changed since last tagging
237+
- Cache TTL: 1 hour
238+
- Handles errors gracefully (Copilot not available, rate limiting, malformed responses)
239+
- Default categories: note types, technologies, topics, status
240+
- Singleton instance exported as `tagGenerator`
241+
201242
### File Organization Pattern
202243

203244
Notes are stored in hierarchical structure:
@@ -250,6 +291,11 @@ Settings in `package.json` contributions:
250291
- `noted.template`: Template string (defined but not used - only built-in templates are used)
251292
- `noted.tagAutoComplete`: Enable tag autocomplete (default: true)
252293
- `noted.autoBacklinks`: Automatically append backlinks sections to notes (default: true, v1.24.0)
294+
- `noted.tagging.enabled`: Enable automatic tagging features (default: true, v1.40.0)
295+
- `noted.tagging.autoTagOnCreate`: Automatically tag new notes when created (default: false, v1.40.0)
296+
- `noted.tagging.maxTags`: Maximum number of tags to suggest per note (default: 5, v1.40.0)
297+
- `noted.tagging.customCategories`: Custom tag categories for your domain (default: [], v1.40.0)
298+
- `noted.tagging.excludePatterns`: Tag patterns to exclude from suggestions (default: ["draft", "temp"], v1.40.0)
253299

254300
## Commands
255301

dev-docs/TESTING-AUTO-TAGGING.md

Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
# Smart Auto-Tagging Testing Guide
2+
3+
## Prerequisites
4+
5+
1. **GitHub Copilot**: You must have GitHub Copilot installed and signed in
6+
- The feature uses VS Code's Language Model API (Copilot)
7+
- Without Copilot, you'll get a friendly error message
8+
9+
2. **Notes Folder**: Have the Noted extension configured with a notes folder
10+
11+
## Quick Testing Steps
12+
13+
### Test 1: Manual Tag Generation (Easiest to Start)
14+
15+
1. **Create a test note** with some content:
16+
```
17+
PROBLEM: User authentication fails with 401 error
18+
19+
STEPS TAKEN:
20+
1. Checked JWT token expiration
21+
2. Verified API endpoint configuration
22+
3. Tested with Postman
23+
24+
SOLUTION:
25+
The JWT secret key was incorrect in the .env file.
26+
Updated the key and restarted the server.
27+
28+
NOTES:
29+
- Need to add better error messages
30+
- Should implement token refresh logic
31+
```
32+
33+
2. **Open Command Palette** (`Cmd+Shift+P` or `Ctrl+Shift+P`)
34+
35+
3. **Run**: `Noted: Generate Tags for Current Note`
36+
37+
4. **Expected behavior**:
38+
- Shows "Generating tags..." notification
39+
- AI analyzes the content (takes 2-3 seconds)
40+
- Quick pick appears with suggested tags and confidence scores
41+
- Tags might include: `bug`, `authentication`, `jwt`, `problem-solving`
42+
- High confidence tags (>80%) are pre-selected
43+
- Select/deselect tags as desired
44+
- Press Enter to apply
45+
46+
5. **Verify**:
47+
- Open the note again
48+
- Should see frontmatter at the top:
49+
```yaml
50+
---
51+
tags: [bug, authentication, jwt, problem-solving]
52+
tagged-at: 2025-11-08T...
53+
---
54+
```
55+
56+
### Test 2: Right-Click Context Menu
57+
58+
1. **In the Noted sidebar**, right-click any note
59+
2. **Look for**: "Generate Tags with AI" (sparkle icon ✨)
60+
3. **Click it** - same behavior as Test 1
61+
4. **Also try**: "Manage Note Tags" to manually edit tags
62+
63+
### Test 3: Batch Tag Multiple Notes
64+
65+
1. **Open Command Palette**
66+
2. **Run**: `Noted: Batch Generate Tags`
67+
3. **Choose option**:
68+
- "Tag only untagged notes" (recommended for testing)
69+
- OR "Re-tag all notes"
70+
4. **Confirm** the action
71+
5. **Watch progress**: Shows "Tagging notes... (1/10)" etc.
72+
6. **Review results**: Shows summary of how many notes were tagged
73+
74+
### Test 4: Auto-Tag on Creation (Advanced)
75+
76+
1. **Enable the setting**:
77+
- Open Settings (`Cmd+,`)
78+
- Search for: `noted.tagging.autoTagOnCreate`
79+
- Check the box to enable
80+
81+
2. **Create a new note**:
82+
- Run: `Noted: Open Today's Note`
83+
- OR: `Noted: Open with Template`
84+
85+
3. **Write some content** (at least 50 characters):
86+
```
87+
Meeting with the frontend team about the new React dashboard.
88+
Discussed performance optimizations and state management.
89+
```
90+
91+
4. **Wait 2 seconds**
92+
93+
5. **Expected behavior**:
94+
- Notification appears: "Auto-tagged note with: meeting, react, frontend"
95+
- Click "View Tags" to review
96+
- Tags are already in frontmatter
97+
98+
### Test 5: Tag Statistics
99+
100+
1. **After tagging some notes**, run: `Noted: Show Tag Statistics`
101+
102+
2. **See summary** with:
103+
- Total tags
104+
- Tagged/untagged notes
105+
- Top 5 tags
106+
- AI vs manual count
107+
108+
3. **Click "View Details"** to see beautiful dashboard:
109+
- Stat cards
110+
- Most used tags list
111+
- Progress bars
112+
- Recent activity
113+
114+
### Test 6: Manage Tags Manually
115+
116+
1. **Open a note** that has tags
117+
2. **Run**: `Noted: Manage Note Tags`
118+
3. **See**:
119+
- Existing tags (pre-selected with checkmarks)
120+
- AI-suggested tags (unchecked)
121+
4. **Toggle selections** as desired
122+
5. **Press Enter** to update
123+
124+
### Test 7: Add Custom Tag
125+
126+
1. **Open a note**
127+
2. **Run**: `Noted: Add Custom Tag`
128+
3. **Enter tag name**: e.g., `urgent` or `follow-up`
129+
4. **Validation**: Only allows lowercase, hyphens, numbers
130+
5. **Tag is added** to the note
131+
132+
## Expected Tag Suggestions
133+
134+
Based on content, you should see tags like:
135+
136+
**For bug/problem notes:**
137+
- `bug`, `problem-solving`, `debugging`, `troubleshooting`
138+
- Technology tags: `typescript`, `javascript`, `react`, `node`
139+
- Specific issues: `authentication`, `api`, `database`
140+
141+
**For meeting notes:**
142+
- `meeting`, `discussion`, `planning`
143+
- Teams: `frontend`, `backend`, `design`
144+
- Topics: `architecture`, `performance`, `ui-ux`
145+
146+
**For research notes:**
147+
- `research`, `learning`, `documentation`
148+
- Technologies being researched
149+
- Topics: `security`, `optimization`, `deployment`
150+
151+
## Configuration Options to Test
152+
153+
Open Settings and try:
154+
155+
1. **`noted.tagging.maxTags`**: Change from 5 to 3
156+
- Should only suggest 3 tags instead of 5
157+
158+
2. **`noted.tagging.customCategories`**: Add your own categories
159+
```json
160+
["frontend-team", "backend-team", "urgent", "later"]
161+
```
162+
- AI should include these in suggestions
163+
164+
3. **`noted.tagging.excludePatterns`**: Add patterns to exclude
165+
```json
166+
["draft", "temp", "test"]
167+
```
168+
- AI won't suggest these tags
169+
170+
## Troubleshooting
171+
172+
### "GitHub Copilot is not available"
173+
- **Cause**: Not signed in to Copilot
174+
- **Fix**: Install GitHub Copilot extension and sign in
175+
176+
### No tags suggested
177+
- **Cause**: Note content too short or generic
178+
- **Fix**: Add more specific technical content (at least 100 chars recommended)
179+
180+
### Tags not appearing in frontmatter
181+
- **Cause**: File wasn't saved
182+
- **Fix**: Save the file (Cmd+S) and reopen
183+
184+
### Auto-tag not working
185+
- **Cause**: Setting disabled or note too short
186+
- **Fix**:
187+
- Enable `noted.tagging.autoTagOnCreate`
188+
- Write at least 50 characters
189+
- Wait 2 seconds
190+
191+
## Verifying Tag Storage
192+
193+
Open any tagged note in a text editor - you should see:
194+
195+
```yaml
196+
---
197+
tags: [bug, typescript, react]
198+
tagged-at: 2025-11-08T10:30:00.000Z
199+
---
200+
201+
Your note content here...
202+
```
203+
204+
The tags are:
205+
- ✅ Searchable using existing tag features (F2 rename, tag search, etc.)
206+
- ✅ Compatible with inline `#hashtags`
207+
- ✅ Shown in the Tags sidebar view
208+
- ✅ Included in tag statistics
209+
210+
## What to Look For
211+
212+
**Good signs:**
213+
- ✅ Suggested tags are relevant to content
214+
- ✅ Confidence scores make sense (higher for obvious tags)
215+
- ✅ Tags follow naming convention (lowercase, hyphenated)
216+
- ✅ No duplicate tags
217+
- ✅ Frontmatter preserves other fields
218+
219+
**Issues to report:**
220+
- ❌ Irrelevant tag suggestions
221+
- ❌ Duplicate tags in frontmatter
222+
- ❌ Frontmatter corrupted
223+
- ❌ Performance issues (slow response)
224+
- ❌ Crashes or errors
225+
226+
## Performance Notes
227+
228+
- **Single note**: ~2-3 seconds (depends on Copilot API)
229+
- **Batch tagging**: ~1-2 notes per second (rate limited)
230+
- **Auto-tag on create**: Non-blocking, runs in background
231+
232+
## Next Steps
233+
234+
After testing, you can:
235+
1. Review tag statistics to see patterns
236+
2. Adjust configuration based on your needs
237+
3. Use tags for better note organization
238+
4. Search notes by tags using existing features

0 commit comments

Comments
 (0)