Commit 1867d62
Claude/add create template button 01 c9sv d4 nb2pfqo p7ps n1tn u (#119)
* Add 'Create New Template' button to Template Browser
- Added prominent 'Create New Template' button in the header
- Button triggers the existing noted.createCustomTemplate command
- Auto-refreshes template list after creation
- Provides quick access to template creation from browser UI
* Add 'Create Template with Variables' button for JSON templates
- Created new command noted.createTemplateWithVariables
- Prompts for template name, description, and category
- Creates JSON template with variable system support
- Opens Template Browser and directs user to Variable Editor
- Added dedicated button in Template Browser header
- Provides clear separation between simple and advanced templates
* Improve variable editor UX with usage guide and workflow
Major improvements to help users understand how to use variables:
1. **Variable Usage Guide Panel**:
- Replaced template preview with clear usage instructions
- Shows step-by-step guide on how to use variables
- Lists all custom variables with copy buttons
- One-click copy of {variable_name} syntax
2. **Edit Template Content Button**:
- Added prominent button in variable editor header
- Opens template file directly from variable editor
- Shows helpful tip when clicked
3. **Improved Save Flow**:
- Success message now includes next steps
- Keeps editor open for 8 seconds after save
- Clear guidance to click "Edit Template Content"
- User can immediately start using variables
4. **Enhanced Visual Feedback**:
- Copy buttons show "✓ Copied!" confirmation
- Green success banner with actionable next step
- Variable types displayed as badges
- Clearer separation between instructions and actions
This addresses the issue where users could save variables but didn't
know how to actually use them in their templates.
* feat(template): enhance template creation with custom variable support
* Update src/templates/templateBrowserView.ts
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* Update src/extension.ts
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* Fix CI/CD and address code review feedback
**CI/CD Fixes**:
- Add missing `import * as os from 'os'` for userInfo() usage
- Remove reference to undefined `templatesProvider` in createTemplateWithVariables
**Code Review: Race Condition Fixes**:
1. **Remove setTimeout race condition**:
- Removed fragile 500ms setTimeout waiting for webview
- Template browser auto-refreshes when opened
- User gets clear instructions to click "Edit Variables"
2. **Fix TOCTOU race condition in file creation**:
- Changed from access() check + writeFile() to atomic writeFile() with 'wx' flag
- Prevents race condition where file could be created between check and write
- Simplified error handling with specific EEXIST check
**Code Review: Improvements**:
3. **Pre-fill author field with system username**:
- Changed `author: ''` to `author: os.userInfo().username`
- Provides better default value for template metadata
4. **Improve error handling in templateService.ts**:
- Added error logging for JSON parsing failures
- Distinguish between ENOENT (file not found) and parsing errors
- Helps debugging malformed template files
**Test Results**:
✓ All 579 unit tests passing
✓ TypeScript compilation successful
✓ No type errors or warnings
---------
Co-authored-by: Claude <[email protected]>
Co-authored-by: Jason Rueckert <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>1 parent 22a29f9 commit 1867d62
File tree
4 files changed
+436
-35
lines changed- src
- services
- templates
4 files changed
+436
-35
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
260 | 265 | | |
261 | 266 | | |
262 | 267 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
1754 | 1755 | | |
1755 | 1756 | | |
1756 | 1757 | | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
1757 | 1763 | | |
1758 | 1764 | | |
1759 | 1765 | | |
| |||
2113 | 2119 | | |
2114 | 2120 | | |
2115 | 2121 | | |
2116 | | - | |
| 2122 | + | |
2117 | 2123 | | |
2118 | 2124 | | |
2119 | 2125 | | |
| |||
2371 | 2377 | | |
2372 | 2378 | | |
2373 | 2379 | | |
| 2380 | + | |
| 2381 | + | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
| 2393 | + | |
| 2394 | + | |
| 2395 | + | |
| 2396 | + | |
| 2397 | + | |
| 2398 | + | |
| 2399 | + | |
| 2400 | + | |
| 2401 | + | |
| 2402 | + | |
| 2403 | + | |
| 2404 | + | |
| 2405 | + | |
| 2406 | + | |
| 2407 | + | |
| 2408 | + | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
2374 | 2471 | | |
2375 | 2472 | | |
2376 | 2473 | | |
| |||
2513 | 2610 | | |
2514 | 2611 | | |
2515 | 2612 | | |
| 2613 | + | |
| 2614 | + | |
| 2615 | + | |
| 2616 | + | |
| 2617 | + | |
| 2618 | + | |
| 2619 | + | |
| 2620 | + | |
| 2621 | + | |
| 2622 | + | |
| 2623 | + | |
| 2624 | + | |
| 2625 | + | |
| 2626 | + | |
| 2627 | + | |
| 2628 | + | |
| 2629 | + | |
2516 | 2630 | | |
2517 | 2631 | | |
2518 | 2632 | | |
| |||
2552 | 2666 | | |
2553 | 2667 | | |
2554 | 2668 | | |
2555 | | - | |
| 2669 | + | |
2556 | 2670 | | |
2557 | 2671 | | |
2558 | 2672 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
39 | 54 | | |
40 | 55 | | |
41 | 56 | | |
| |||
59 | 74 | | |
60 | 75 | | |
61 | 76 | | |
62 | | - | |
| 77 | + | |
63 | 78 | | |
64 | 79 | | |
65 | 80 | | |
| |||
80 | 95 | | |
81 | 96 | | |
82 | 97 | | |
83 | | - | |
84 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
85 | 105 | | |
86 | 106 | | |
87 | 107 | | |
88 | | - | |
89 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
90 | 114 | | |
91 | 115 | | |
92 | 116 | | |
| |||
126 | 150 | | |
127 | 151 | | |
128 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
129 | 173 | | |
130 | 174 | | |
131 | 175 | | |
| |||
0 commit comments