Add token variable support for code blocks (#4)#8
Conversation
Users can now define token variables in code blocks using %%tokenName%% syntax. When copying code with tokens, a modal prompts for values which replace the placeholders before copying to clipboard. Changes: - Extended Task interface with optional tokens field in codeBlock - Created TokenMergeModal component for token value input - Updated CodeBlock to show modal when tokens exist - Added token detection UI in TaskEditForm - Updated useTasks hook signatures for token support Fixes #4 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
✅ Deploy Preview for task-list-advanced ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🔍 Comprehensive PR ReviewPR: #8 - Add token variable support for code blocks SummaryThis PR adds token variable support for code blocks, allowing users to define Verdict:
🟠 High Issues (Should Fix)1. CLAUDE.md Task Interface Missing Tokens Property📍 The Task Interface documentation doesn't include the new View fixUpdate Task Interface to include: codeBlock?: {
language: string;
code: string;
tokens?: Record<string, string>; // Token variables
};Also add to Task System bullet points: - Token variables in code blocks (%%tokenName%% syntax)2. README.md Task List Format Missing Tokens Property📍 The JSON example doesn't show the View fixUpdate JSON example and add to Features: - 🔀 Token variables in code blocks (replaceable %%tokenName%% placeholders)🟡 Medium Issues (Needs Decision)1. Unhandled clipboard.writeText() in TokenMergeModal📍 Clipboard write can fail silently, showing "Copied!" when nothing was copied. Options: Fix now (recommended) | Create issue | Skip View fixconst handleCopy = async () => {
try {
await navigator.clipboard.writeText(getMergedCode());
setCopied(true);
setTimeout(() => setCopied(false), 2000);
} catch (error) {
console.error('Failed to copy code:', error);
}
};2. Unhandled clipboard.writeText() in CodeBlock📍 Same clipboard issue in the non-token code path. Options: Fix now (recommended) | Create issue | Skip (pre-existing) 3. Potential Regex Injection in Token Replacement📍 Token names interpolated into regex without escaping. Defensive fix recommended. View fixconst escapedKey = key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
merged = merged.replace(new RegExp(`%%${escapedKey}%%`, 'g'), value);🟢 Low IssuesView 6 low-priority suggestions
✅ What's Good
📋 Suggested Follow-up Issues
Next Steps
Reviewed by Archon comprehensive-pr-review workflow |
Fixes applied: - Update CLAUDE.md Task Interface with tokens property - Update README.md with token variable feature documentation - Add try-catch error handling to clipboard operations in TokenMergeModal - Add try-catch error handling to clipboard operations in CodeBlock - Add defensive regex escaping in getMergedCode Review artifacts: artifacts/runs/4c9765715e0fb2ba01826a2a0d9c0705/review/ Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
⚡ Auto-Fix ReportStatus: COMPLETE Fixes Applied
What Was FixedHIGH Priority:
MEDIUM Priority:
📋 LOW Issues (For Consideration)
📋 Suggested Follow-up Issues
Validation✅ Build | Auto-fixed by Archon comprehensive-pr-review workflow |
🎯 Workflow SummaryPlan: Token variable support for code blocks (#4) Implementation vs Plan
📋 Deviation from Plan (1)Removed unused Review Summary
All HIGH and MEDIUM issues have been addressed. ✅ Issues Fixed (5)
ℹ️ LOW Issues (Not Blocking)
📋 Suggested Follow-Up Issues
Validation
Artifacts: 🤖 Generated with Claude Code |
Summary
%%tokenName%%syntax) that prompts users for values when copying codeRoot Cause
N/A - This is an enhancement requested in issue #4
Changes
src/types/task.tssrc/components/TokenMergeModal.tsxsrc/components/code/CodeBlock.tsxsrc/components/TaskDisplay.tsxsrc/components/TaskEditForm.tsxsrc/hooks/useTasks.tsTesting
npm run build)%%username%%placeholderValidation
Issue
Fixes #4
📋 Implementation Details
Implementation followed artifact:
/home/archon/.archon/workspaces/task-list-advanced/artifacts/runs/4c9765715e0fb2ba01826a2a0d9c0705/investigation.mdDeviations from plan:
setTokenssetter from TaskEditForm to avoid lint errorAutomated implementation from investigation artifact
🤖 Generated with Claude Code