reviw 0.16.1 → 0.16.2

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 (2) hide show
  1. package/cli.cjs +88 -26
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -1283,11 +1283,11 @@ function diffHtmlTemplate(diffData) {
1283
1283
  <label for="global-comment">Overall comment (optional)</label>
1284
1284
  <textarea id="global-comment" placeholder="Add a summary or overall feedback..."></textarea>
1285
1285
  <div class="modal-checkboxes">
1286
- <label><input type="checkbox" id="prompt-subagents" checked /> All implementation, verification, and report creation will be done by the sub-agents.</label>
1287
- <label><input type="checkbox" id="prompt-reviw" checked /> Open in REVIW next time.</label>
1288
- <label><input type="checkbox" id="prompt-screenshots" checked /> Update all screenshots and videos.</label>
1289
- <label><input type="checkbox" id="prompt-user-feedback-todo" checked /> Add the user's feedback to the Todo list, and do not check it off without the user's approval.</label>
1290
- <label><input type="checkbox" id="prompt-deep-dive" checked /> Before implementing, deeply probe the user's request. If using Claude Code, start with AskUserQuestion and EnterPlanMode; otherwise achieve the same depth through interactive questions and planning, even if the UI differs.</label>
1286
+ <label><input type="checkbox" id="prompt-subagents" checked /> 🤖 Delegate to sub-agents (implement, verify, report)</label>
1287
+ <label><input type="checkbox" id="prompt-reviw" checked /> 👁️ Open in REVIW next time</label>
1288
+ <label><input type="checkbox" id="prompt-screenshots" checked /> 📸 Update all screenshots/videos</label>
1289
+ <label><input type="checkbox" id="prompt-user-feedback-todo" checked /> Add feedback to Todo (require approval)</label>
1290
+ <label><input type="checkbox" id="prompt-deep-dive" checked /> 🔍 Probe requirements before implementing</label>
1291
1291
  </div>
1292
1292
  <div class="modal-actions">
1293
1293
  <button id="modal-cancel">Cancel</button>
@@ -1657,13 +1657,13 @@ function diffHtmlTemplate(diffData) {
1657
1657
  const modalSummary = document.getElementById('modal-summary');
1658
1658
  const globalCommentInput = document.getElementById('global-comment');
1659
1659
 
1660
- // Prompt checkboxes
1660
+ // Prompt checkboxes - text is the strong enforcement prompt for YAML output
1661
1661
  const promptCheckboxes = [
1662
- { id: 'prompt-subagents', text: 'All implementation, verification, and report creation will be done by the sub-agents.' },
1663
- { id: 'prompt-reviw', text: 'Open in REVIW next time.' },
1664
- { id: 'prompt-screenshots', text: 'Update all screenshots and videos.' },
1665
- { id: 'prompt-user-feedback-todo', text: "Add the user's feedback to the Todo list, and do not check it off without the user's approval." },
1666
- { id: 'prompt-deep-dive', text: "Before implementing, deeply probe the user's request. If using Claude Code, start with AskUserQuestion and EnterPlanMode; otherwise achieve the same depth through interactive questions and planning, even if the UI differs." }
1662
+ { id: 'prompt-subagents', text: 'MANDATORY: You MUST delegate ALL implementation, verification, and report creation to sub-agents. Direct execution on the main thread is PROHIBITED.' },
1663
+ { id: 'prompt-reviw', text: 'REQUIRED: Before reporting completion, you MUST open the result in REVIW for user review. Skipping this step is NOT allowed.' },
1664
+ { id: 'prompt-screenshots', text: 'MANDATORY: You MUST update ALL screenshots and videos as evidence. Reports without visual proof are REJECTED.' },
1665
+ { id: 'prompt-user-feedback-todo', text: "STRICT RULE: Add ALL user feedback to the Todo list. You are FORBIDDEN from marking any item complete without explicit user approval." },
1666
+ { id: 'prompt-deep-dive', text: "REQUIRED: Before ANY implementation, you MUST deeply probe the user's requirements using AskUserQuestion and EnterPlanMode. Starting implementation without thorough requirement analysis is PROHIBITED." }
1667
1667
  ];
1668
1668
  const PROMPT_STORAGE_KEY = 'reviw-prompt-prefs';
1669
1669
 
@@ -1710,7 +1710,7 @@ function diffHtmlTemplate(diffData) {
1710
1710
  }
1711
1711
 
1712
1712
  function payload(reason) {
1713
- const data = { file: FILE_NAME, mode: MODE, reason, at: new Date().toISOString(), comments: Object.values(comments) };
1713
+ const data = { file: FILE_NAME, mode: MODE, submittedBy: reason, submittedAt: new Date().toISOString(), comments: Object.values(comments) };
1714
1714
  if (globalComment.trim()) data.summary = globalComment.trim();
1715
1715
  const prompts = getSelectedPrompts();
1716
1716
  if (prompts.length > 0) data.prompts = prompts;
@@ -3216,11 +3216,11 @@ function htmlTemplate(dataRows, cols, projectRoot, relativePath, mode, previewHt
3216
3216
  <label for="global-comment">Overall comment (optional)</label>
3217
3217
  <textarea id="global-comment" placeholder="Add a summary or overall feedback..."></textarea>
3218
3218
  <div class="modal-checkboxes">
3219
- <label><input type="checkbox" id="prompt-subagents" checked /> All implementation, verification, and report creation will be done by the sub-agents.</label>
3220
- <label><input type="checkbox" id="prompt-reviw" checked /> Open in REVIW next time.</label>
3221
- <label><input type="checkbox" id="prompt-screenshots" checked /> Update all screenshots and videos.</label>
3222
- <label><input type="checkbox" id="prompt-user-feedback-todo" checked /> Add the user's feedback to the Todo list, and do not check it off without the user's approval.</label>
3223
- <label><input type="checkbox" id="prompt-deep-dive" checked /> Before implementing, deeply probe the user's request. If using Claude Code, start with AskUserQuestion and EnterPlanMode; otherwise achieve the same depth through interactive questions and planning, even if the UI differs.</label>
3219
+ <label><input type="checkbox" id="prompt-subagents" checked /> 🤖 Delegate to sub-agents (implement, verify, report)</label>
3220
+ <label><input type="checkbox" id="prompt-reviw" checked /> 👁️ Open in REVIW next time</label>
3221
+ <label><input type="checkbox" id="prompt-screenshots" checked /> 📸 Update all screenshots/videos</label>
3222
+ <label><input type="checkbox" id="prompt-user-feedback-todo" checked /> Add feedback to Todo (require approval)</label>
3223
+ <label><input type="checkbox" id="prompt-deep-dive" checked /> 🔍 Probe requirements before implementing</label>
3224
3224
  </div>
3225
3225
  <div class="modal-actions">
3226
3226
  <button id="modal-cancel">Cancel</button>
@@ -4217,13 +4217,13 @@ function htmlTemplate(dataRows, cols, projectRoot, relativePath, mode, previewHt
4217
4217
  const modalCancel = document.getElementById('modal-cancel');
4218
4218
  const modalSubmit = document.getElementById('modal-submit');
4219
4219
 
4220
- // Prompt checkboxes
4220
+ // Prompt checkboxes - text is the strong enforcement prompt for YAML output
4221
4221
  const promptCheckboxes = [
4222
- { id: 'prompt-subagents', text: 'All implementation, verification, and report creation will be done by the sub-agents.' },
4223
- { id: 'prompt-reviw', text: 'Open in REVIW next time.' },
4224
- { id: 'prompt-screenshots', text: 'Update all screenshots and videos.' },
4225
- { id: 'prompt-user-feedback-todo', text: "Add the user's feedback to the Todo list, and do not check it off without the user's approval." },
4226
- { id: 'prompt-deep-dive', text: "Before implementing, deeply probe the user's request. If using Claude Code, start with AskUserQuestion and EnterPlanMode; otherwise achieve the same depth through interactive questions and planning, even if the UI differs." }
4222
+ { id: 'prompt-subagents', text: 'MANDATORY: You MUST delegate ALL implementation, verification, and report creation to sub-agents. Direct execution on the main thread is PROHIBITED.' },
4223
+ { id: 'prompt-reviw', text: 'REQUIRED: Before reporting completion, you MUST open the result in REVIW for user review. Skipping this step is NOT allowed.' },
4224
+ { id: 'prompt-screenshots', text: 'MANDATORY: You MUST update ALL screenshots and videos as evidence. Reports without visual proof are REJECTED.' },
4225
+ { id: 'prompt-user-feedback-todo', text: "STRICT RULE: Add ALL user feedback to the Todo list. You are FORBIDDEN from marking any item complete without explicit user approval." },
4226
+ { id: 'prompt-deep-dive', text: "REQUIRED: Before ANY implementation, you MUST deeply probe the user's requirements using AskUserQuestion and EnterPlanMode. Starting implementation without thorough requirement analysis is PROHIBITED." }
4227
4227
  ];
4228
4228
  const PROMPT_STORAGE_KEY = 'reviw-prompt-prefs';
4229
4229
 
@@ -4269,13 +4269,75 @@ function htmlTemplate(dataRows, cols, projectRoot, relativePath, mode, previewHt
4269
4269
  return prompts;
4270
4270
  }
4271
4271
 
4272
+ // Find nearest heading for a given line number (markdown context)
4273
+ function findNearestHeading(lineNum) {
4274
+ let nearestHeading = null;
4275
+ for (let i = lineNum - 1; i >= 0; i--) {
4276
+ const line = DATA[i] ? DATA[i][0] : '';
4277
+ const match = line.match(/^(#{1,6})\\s+(.+)/);
4278
+ if (match) {
4279
+ nearestHeading = match[2].trim();
4280
+ break;
4281
+ }
4282
+ }
4283
+ return nearestHeading;
4284
+ }
4285
+
4286
+ // Check if line is inside a table
4287
+ function getTableContext(lineNum) {
4288
+ const line = DATA[lineNum] ? DATA[lineNum][0] : '';
4289
+ if (!line.includes('|')) return null;
4290
+ // Find table header (look backwards for header row)
4291
+ for (let i = lineNum; i >= 0; i--) {
4292
+ const l = DATA[i] ? DATA[i][0] : '';
4293
+ if (!l.includes('|')) break;
4294
+ // Check if next line is separator (---|---)
4295
+ const nextLine = DATA[i + 1] ? DATA[i + 1][0] : '';
4296
+ if (nextLine && nextLine.match(/^\\|?[\\s-:|]+\\|/)) {
4297
+ // This is the header row
4298
+ return l.replace(/^\\|\\s*/, '').replace(/\\s*\\|$/, '').split('|').map(h => h.trim()).slice(0, 3).join(' | ') + (l.split('|').length > 4 ? ' ...' : '');
4299
+ }
4300
+ }
4301
+ return null;
4302
+ }
4303
+
4304
+ // Transform comments for markdown mode
4305
+ function transformMarkdownComments(rawComments) {
4306
+ return rawComments.map(c => {
4307
+ const lineNum = c.row || c.startRow || 0;
4308
+ const section = findNearestHeading(lineNum);
4309
+ const tableHeader = getTableContext(lineNum);
4310
+ const content = c.content || c.value || '';
4311
+ const truncatedContent = content.length > 60 ? content.substring(0, 60) + '...' : content;
4312
+
4313
+ const transformed = {
4314
+ line: lineNum + 1,
4315
+ context: {}
4316
+ };
4317
+ if (section) transformed.context.section = section;
4318
+ if (tableHeader) transformed.context.table = tableHeader;
4319
+ if (truncatedContent) transformed.context.content = truncatedContent;
4320
+ transformed.comment = c.text;
4321
+
4322
+ if (c.isRange) {
4323
+ transformed.lineEnd = (c.endRow || c.startRow) + 1;
4324
+ }
4325
+ return transformed;
4326
+ });
4327
+ }
4328
+
4272
4329
  function payload(reason) {
4330
+ const rawComments = Object.values(comments);
4331
+ const transformedComments = MODE === 'markdown'
4332
+ ? transformMarkdownComments(rawComments)
4333
+ : rawComments;
4334
+
4273
4335
  const data = {
4274
4336
  file: FILE_NAME,
4275
4337
  mode: MODE,
4276
- reason,
4277
- at: new Date().toISOString(),
4278
- comments: Object.values(comments)
4338
+ submittedBy: reason,
4339
+ submittedAt: new Date().toISOString(),
4340
+ comments: transformedComments
4279
4341
  };
4280
4342
  if (globalComment.trim()) {
4281
4343
  data.summary = globalComment.trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reviw",
3
- "version": "0.16.1",
3
+ "version": "0.16.2",
4
4
  "description": "Lightweight file reviewer with in-browser comments for CSV, TSV, Markdown, and Git diffs.",
5
5
  "type": "module",
6
6
  "bin": {