liteagents 2.5.2 → 2.6.0

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.
Files changed (80) hide show
  1. package/CHANGELOG.md +76 -15
  2. package/README.md +58 -30
  3. package/docs/INSTALLATION_DEMO.md +1 -1
  4. package/docs/INSTALLATION_LOCATIONS.md +5 -5
  5. package/docs/INSTALLER_GUIDE.md +5 -5
  6. package/docs/KNOWLEDGE_BASE.md +5 -5
  7. package/docs/MIGRATION.md +1 -1
  8. package/docs/PASS_QUICK_START.md +1 -1
  9. package/docs/PRIVACY.md +1 -1
  10. package/docs/PUBLISHING.md +7 -7
  11. package/docs/RELEASE_NOTES_1.2.0.md +2 -2
  12. package/docs/SILENT_MODE_GUIDE.md +1 -1
  13. package/installer/cli.js +1 -1
  14. package/installer/installation-engine.js +82 -21
  15. package/installer/package-manager.js +34 -3
  16. package/package.json +7 -6
  17. package/packages/ampcode/AGENT.md +1 -0
  18. package/packages/ampcode/commands/friction/friction.js +19 -4
  19. package/packages/ampcode/commands/live-canvas/DESIGN_PRINCIPLES.md +2140 -0
  20. package/packages/ampcode/commands/live-canvas/README.md +273 -0
  21. package/packages/ampcode/commands/live-canvas/templates/.claude/settings.local.json +8 -0
  22. package/packages/ampcode/commands/live-canvas/templates/demo/post-variants.html +205 -0
  23. package/packages/ampcode/commands/live-canvas/templates/feedback-react/FeedbackOverlay.tsx +1299 -0
  24. package/packages/ampcode/commands/live-canvas/templates/feedback-react/format-utils.ts +283 -0
  25. package/packages/ampcode/commands/live-canvas/templates/feedback-react/index.ts +62 -0
  26. package/packages/ampcode/commands/live-canvas/templates/feedback-react/selector-utils.ts +423 -0
  27. package/packages/ampcode/commands/live-canvas/templates/feedback-react/types.ts +118 -0
  28. package/packages/ampcode/commands/live-canvas/templates/overlay-vanilla.js +477 -0
  29. package/packages/ampcode/commands/live-canvas.md +1104 -0
  30. package/packages/claude/CLAUDE.md +1 -0
  31. package/packages/claude/commands/friction/friction.js +19 -4
  32. package/packages/claude/plugins/live-canvas-marketplace/.claude-plugin/marketplace.json +14 -0
  33. package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/.claude-plugin/plugin.json +18 -0
  34. package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/README.md +89 -0
  35. package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/package-lock.json +1142 -0
  36. package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/package.json +17 -0
  37. package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/schema.json +37 -0
  38. package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/server.js +179 -0
  39. package/packages/claude/plugins/live-canvas-marketplace/setup.sh +61 -0
  40. package/packages/claude/skills/live-canvas/DESIGN_PRINCIPLES.md +2140 -0
  41. package/packages/claude/skills/live-canvas/INTEGRATION_NOTES.md +210 -0
  42. package/packages/claude/skills/live-canvas/README.md +273 -0
  43. package/packages/claude/skills/live-canvas/SKILL.md +1119 -0
  44. package/packages/claude/skills/live-canvas/templates/.claude/settings.local.json +8 -0
  45. package/packages/claude/skills/live-canvas/templates/demo/post-variants.html +205 -0
  46. package/packages/claude/skills/live-canvas/templates/feedback-react/FeedbackOverlay.tsx +1299 -0
  47. package/packages/claude/skills/live-canvas/templates/feedback-react/format-utils.ts +283 -0
  48. package/packages/claude/skills/live-canvas/templates/feedback-react/index.ts +62 -0
  49. package/packages/claude/skills/live-canvas/templates/feedback-react/selector-utils.ts +423 -0
  50. package/packages/claude/skills/live-canvas/templates/feedback-react/types.ts +118 -0
  51. package/packages/claude/skills/live-canvas/templates/overlay-vanilla.js +477 -0
  52. package/packages/claude/variants.json +2 -1
  53. package/packages/droid/AGENTS.md +1 -0
  54. package/packages/droid/commands/friction/friction.js +19 -4
  55. package/packages/droid/commands/live-canvas/DESIGN_PRINCIPLES.md +2140 -0
  56. package/packages/droid/commands/live-canvas/README.md +273 -0
  57. package/packages/droid/commands/live-canvas/templates/.claude/settings.local.json +8 -0
  58. package/packages/droid/commands/live-canvas/templates/demo/post-variants.html +205 -0
  59. package/packages/droid/commands/live-canvas/templates/feedback-react/FeedbackOverlay.tsx +1299 -0
  60. package/packages/droid/commands/live-canvas/templates/feedback-react/format-utils.ts +283 -0
  61. package/packages/droid/commands/live-canvas/templates/feedback-react/index.ts +62 -0
  62. package/packages/droid/commands/live-canvas/templates/feedback-react/selector-utils.ts +423 -0
  63. package/packages/droid/commands/live-canvas/templates/feedback-react/types.ts +118 -0
  64. package/packages/droid/commands/live-canvas/templates/overlay-vanilla.js +477 -0
  65. package/packages/droid/commands/live-canvas.md +1104 -0
  66. package/packages/opencode/AGENTS.md +1 -0
  67. package/packages/opencode/command/friction/friction.js +19 -4
  68. package/packages/opencode/command/live-canvas/DESIGN_PRINCIPLES.md +2140 -0
  69. package/packages/opencode/command/live-canvas/README.md +273 -0
  70. package/packages/opencode/command/live-canvas/templates/.claude/settings.local.json +8 -0
  71. package/packages/opencode/command/live-canvas/templates/demo/post-variants.html +205 -0
  72. package/packages/opencode/command/live-canvas/templates/feedback-react/FeedbackOverlay.tsx +1299 -0
  73. package/packages/opencode/command/live-canvas/templates/feedback-react/format-utils.ts +283 -0
  74. package/packages/opencode/command/live-canvas/templates/feedback-react/index.ts +62 -0
  75. package/packages/opencode/command/live-canvas/templates/feedback-react/selector-utils.ts +423 -0
  76. package/packages/opencode/command/live-canvas/templates/feedback-react/types.ts +118 -0
  77. package/packages/opencode/command/live-canvas/templates/overlay-vanilla.js +477 -0
  78. package/packages/opencode/command/live-canvas.md +1104 -0
  79. package/packages/opencode/opencode.jsonc +4 -0
  80. package/packages/subagentic-manual.md +18 -15
@@ -0,0 +1,283 @@
1
+ /**
2
+ * Design Lab Interactive Feedback System - Format Utilities
3
+ *
4
+ * Converts feedback comments into formatted output for:
5
+ * - Markdown (clipboard) - Human-readable, paste-friendly for Claude
6
+ * - JSON (download) - Machine-parseable backup
7
+ */
8
+
9
+ import type { Comment, FeedbackPayload, VariantId } from './types';
10
+
11
+ /**
12
+ * Group comments by variant ID for organized display.
13
+ */
14
+ function groupByVariant(comments: Comment[]): Map<VariantId, Comment[]> {
15
+ const groups = new Map<VariantId, Comment[]>();
16
+
17
+ for (const comment of comments) {
18
+ const existing = groups.get(comment.variant) || [];
19
+ existing.push(comment);
20
+ groups.set(comment.variant, existing);
21
+ }
22
+
23
+ // Sort variants alphabetically
24
+ return new Map(
25
+ [...groups.entries()].sort(([a], [b]) => a.localeCompare(b))
26
+ );
27
+ }
28
+
29
+ /**
30
+ * Format a single comment for markdown output.
31
+ * Includes selector, text content hint, and the user's feedback.
32
+ */
33
+ function formatComment(comment: Comment, index: number): string {
34
+ const { element, text } = comment;
35
+
36
+ // Build the element identifier string
37
+ const selectorPart = `\`${element.selector}\``;
38
+ const textHint = element.textContent
39
+ ? `, ${element.tagName} with "${element.textContent}"`
40
+ : '';
41
+
42
+ return `${index}. **${element.readablePath.split(' > ').pop()}** (${selectorPart}${textHint})
43
+ "${text}"`;
44
+ }
45
+
46
+ /**
47
+ * Format all feedback as Markdown for clipboard.
48
+ *
49
+ * Output format:
50
+ * ```
51
+ * ## Design Lab Feedback
52
+ *
53
+ * **Target:** ComponentName
54
+ * **Comments:** 3
55
+ *
56
+ * ### Variant A
57
+ * 1. **Button** (`[data-testid='submit']`, button with "Submit")
58
+ * "Make this more prominent"
59
+ *
60
+ * ### Overall Direction
61
+ * User's synthesis guidance here...
62
+ *
63
+ * ---
64
+ * *Feedback from Design Lab interactive overlay*
65
+ * ```
66
+ */
67
+ export function formatAsMarkdown(
68
+ comments: Comment[],
69
+ target: string,
70
+ overall: string
71
+ ): string {
72
+ const lines: string[] = [];
73
+
74
+ // Header
75
+ lines.push('## Design Lab Feedback');
76
+ lines.push('');
77
+ lines.push(`**Target:** ${target}`);
78
+ lines.push(`**Comments:** ${comments.length}`);
79
+ lines.push('');
80
+
81
+ // Group and format comments by variant
82
+ const grouped = groupByVariant(comments);
83
+
84
+ for (const [variantId, variantComments] of grouped) {
85
+ lines.push(`### Variant ${variantId}`);
86
+
87
+ variantComments.forEach((comment, index) => {
88
+ lines.push(formatComment(comment, index + 1));
89
+ lines.push('');
90
+ });
91
+ }
92
+
93
+ // Overall direction
94
+ if (overall.trim()) {
95
+ lines.push('### Overall Direction');
96
+ lines.push(overall.trim());
97
+ lines.push('');
98
+ }
99
+
100
+ // Footer
101
+ lines.push('---');
102
+ lines.push('*Feedback from Design Lab interactive overlay*');
103
+
104
+ return lines.join('\n');
105
+ }
106
+
107
+ /**
108
+ * Format all feedback as a structured JSON payload.
109
+ * Used for file download backup.
110
+ */
111
+ export function formatAsJSON(
112
+ comments: Comment[],
113
+ target: string,
114
+ overall: string
115
+ ): FeedbackPayload {
116
+ return {
117
+ version: '1.0',
118
+ target,
119
+ timestamp: new Date().toISOString(),
120
+ comments,
121
+ overall,
122
+ };
123
+ }
124
+
125
+ /**
126
+ * Copy text to clipboard using the Clipboard API.
127
+ * Falls back to creating a textarea for older browsers.
128
+ */
129
+ export async function copyToClipboard(text: string): Promise<boolean> {
130
+ // Try modern Clipboard API first
131
+ if (navigator.clipboard && navigator.clipboard.writeText) {
132
+ try {
133
+ await navigator.clipboard.writeText(text);
134
+ return true;
135
+ } catch (err) {
136
+ console.warn('Clipboard API failed, trying fallback:', err);
137
+ }
138
+ }
139
+
140
+ // Fallback: create a temporary textarea
141
+ try {
142
+ const textarea = document.createElement('textarea');
143
+ textarea.value = text;
144
+ textarea.style.position = 'fixed';
145
+ textarea.style.left = '-9999px';
146
+ textarea.style.top = '0';
147
+ textarea.setAttribute('readonly', '');
148
+ document.body.appendChild(textarea);
149
+
150
+ textarea.select();
151
+ textarea.setSelectionRange(0, text.length);
152
+
153
+ const success = document.execCommand('copy');
154
+ document.body.removeChild(textarea);
155
+
156
+ return success;
157
+ } catch (err) {
158
+ console.error('Fallback clipboard method failed:', err);
159
+ return false;
160
+ }
161
+ }
162
+
163
+ /**
164
+ * Trigger a JSON file download.
165
+ */
166
+ export function downloadJSON(payload: FeedbackPayload, filename: string): void {
167
+ const json = JSON.stringify(payload, null, 2);
168
+ const blob = new Blob([json], { type: 'application/json' });
169
+ const url = URL.createObjectURL(blob);
170
+
171
+ const link = document.createElement('a');
172
+ link.href = url;
173
+ link.download = filename;
174
+ link.style.display = 'none';
175
+
176
+ document.body.appendChild(link);
177
+ link.click();
178
+ document.body.removeChild(link);
179
+
180
+ // Clean up the URL object
181
+ setTimeout(() => URL.revokeObjectURL(url), 100);
182
+ }
183
+
184
+ /**
185
+ * Generate a unique ID for a comment.
186
+ */
187
+ export function generateId(): string {
188
+ return `comment-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
189
+ }
190
+
191
+ /**
192
+ * Parse a pasted feedback string back into structured data.
193
+ * Useful if the user needs to re-import their feedback.
194
+ */
195
+ export function parseFeedbackMarkdown(
196
+ markdown: string
197
+ ): Partial<FeedbackPayload> | null {
198
+ try {
199
+ const lines = markdown.split('\n');
200
+ const result: Partial<FeedbackPayload> = {
201
+ comments: [],
202
+ overall: '',
203
+ };
204
+
205
+ let currentVariant: VariantId | null = null;
206
+ let inOverall = false;
207
+ const overallLines: string[] = [];
208
+
209
+ for (const line of lines) {
210
+ // Extract target
211
+ const targetMatch = line.match(/^\*\*Target:\*\*\s*(.+)$/);
212
+ if (targetMatch) {
213
+ result.target = targetMatch[1].trim();
214
+ continue;
215
+ }
216
+
217
+ // Detect variant section
218
+ const variantMatch = line.match(/^### Variant ([A-F])$/);
219
+ if (variantMatch) {
220
+ currentVariant = variantMatch[1] as VariantId;
221
+ inOverall = false;
222
+ continue;
223
+ }
224
+
225
+ // Detect overall section
226
+ if (line === '### Overall Direction') {
227
+ inOverall = true;
228
+ currentVariant = null;
229
+ continue;
230
+ }
231
+
232
+ // Collect overall direction text
233
+ if (inOverall && !line.startsWith('---') && !line.startsWith('*')) {
234
+ overallLines.push(line);
235
+ continue;
236
+ }
237
+
238
+ // Parse comment lines (we can't fully reconstruct, but capture the text)
239
+ if (currentVariant && line.match(/^\d+\.\s+\*\*/)) {
240
+ // This is a comment header line - next quoted line will be the text
241
+ continue;
242
+ }
243
+
244
+ // Capture quoted feedback text
245
+ const quoteMatch = line.match(/^\s+"(.+)"$/);
246
+ if (quoteMatch && currentVariant) {
247
+ // We found feedback text but can't fully reconstruct the element info
248
+ // This is mainly for display purposes
249
+ continue;
250
+ }
251
+ }
252
+
253
+ result.overall = overallLines.join('\n').trim();
254
+
255
+ return result;
256
+ } catch (err) {
257
+ console.error('Failed to parse feedback markdown:', err);
258
+ return null;
259
+ }
260
+ }
261
+
262
+ /**
263
+ * Validate that required fields are present before submission.
264
+ */
265
+ export function validateFeedback(
266
+ comments: Comment[],
267
+ overall: string
268
+ ): { valid: boolean; errors: string[] } {
269
+ const errors: string[] = [];
270
+
271
+ if (comments.length === 0) {
272
+ errors.push('Please add at least one comment to an element.');
273
+ }
274
+
275
+ if (!overall.trim()) {
276
+ errors.push('Please provide an overall direction for the design.');
277
+ }
278
+
279
+ return {
280
+ valid: errors.length === 0,
281
+ errors,
282
+ };
283
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Design Lab Interactive Feedback System
3
+ *
4
+ * This module provides a Figma-like commenting system for the Design Lab.
5
+ * Users can click on elements in design variants, add comments, and submit
6
+ * structured feedback to Claude via clipboard.
7
+ *
8
+ * Usage:
9
+ * ```tsx
10
+ * import { FeedbackOverlay } from './feedback';
11
+ *
12
+ * export default function DesignLabPage() {
13
+ * return (
14
+ * <>
15
+ * <VariantGrid>...</VariantGrid>
16
+ * <FeedbackOverlay targetName="ComponentName" />
17
+ * </>
18
+ * );
19
+ * }
20
+ * ```
21
+ *
22
+ * Requirements:
23
+ * - Variant containers must have `data-variant="A"` (B, C, D, E, F) attributes
24
+ * - React 18+ with portal support
25
+ */
26
+
27
+ // Main component
28
+ export { FeedbackOverlay, default } from './FeedbackOverlay';
29
+
30
+ // Types
31
+ export type {
32
+ Comment,
33
+ Coordinates,
34
+ ElementIdentifier,
35
+ FeedbackOverlayProps,
36
+ FeedbackPayload,
37
+ FeedbackState,
38
+ VariantId,
39
+ } from './types';
40
+
41
+ export { OVERLAY_CLASS_PREFIX, STORAGE_KEY } from './types';
42
+
43
+ // Utilities (for advanced usage)
44
+ export {
45
+ calculateCoordinates,
46
+ findVariantContainer,
47
+ generateReadablePath,
48
+ generateSelector,
49
+ getTextContent,
50
+ identifyElement,
51
+ isOverlayElement,
52
+ } from './selector-utils';
53
+
54
+ export {
55
+ copyToClipboard,
56
+ downloadJSON,
57
+ formatAsJSON,
58
+ formatAsMarkdown,
59
+ generateId,
60
+ parseFeedbackMarkdown,
61
+ validateFeedback,
62
+ } from './format-utils';