@phren/cli 0.1.37 → 0.1.38

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.
package/dist/ui/server.js CHANGED
@@ -7,16 +7,16 @@ import * as querystring from "querystring";
7
7
  import { spawn, execFileSync } from "child_process";
8
8
  import { computePhrenLiveStateToken, getProjectDirs, } from "../shared.js";
9
9
  import { getNonPrimaryStores, subscribeStoreProjects, unsubscribeStoreProjects } from "../store-registry.js";
10
- import { editFinding, readReviewQueue, removeFinding, readFindings, addFinding as addFindingStore, readTasksAcrossProjects, addTask as addTaskStore, completeTask as completeTaskStore, removeTask as removeTaskStore, updateTask as updateTaskStore, TASKS_FILENAME, FINDINGS_FILENAME, } from "../data/access.js";
10
+ import { editFinding, editQueueItem, approveQueueItem, readReviewQueue, rejectQueueItem, removeFinding, readFindings, addFinding as addFindingStore, readTasksAcrossProjects, addTask as addTaskStore, completeTask as completeTaskStore, removeTask as removeTaskStore, updateTask as updateTaskStore, TASKS_FILENAME, FINDINGS_FILENAME, } from "../data/access.js";
11
11
  import { entryScoreKey } from "../governance/scores.js";
12
- import { isValidProjectName, errorMessage, queueFilePath, safeProjectPath } from "../utils.js";
12
+ import { isValidProjectName, errorMessage, safeProjectPath } from "../utils.js";
13
13
  import { readInstallPreferences, writeInstallPreferences, writeGovernanceInstallPreferences } from "../init/preferences.js";
14
- import { buildGraph, collectProjectsForUI, collectSkillsForUI, getHooksData, isAllowedSkillPath, readSyncSnapshot, recentAccepted, recentLookups, recentUsage, } from "./data.js";
14
+ import { buildGraph, collectProjectsForUI, collectSkillsForUI, getHooksData, isAllowedHookConfigPath, isAllowedSkillPath, readSyncSnapshot, recentAccepted, recentLookups, recentUsage, } from "./data.js";
15
15
  import { lookupEventsLogFile } from "../shared.js";
16
16
  import { CONSOLIDATION_ENTRY_THRESHOLD } from "../content/validate.js";
17
17
  import { ensureTopicReferenceDoc, getProjectTopicsResponse, listProjectReferenceDocs, pinProjectTopicSuggestion, readReferenceContent, reclassifyLegacyTopicDocs, unpinProjectTopicSuggestion, writeProjectTopics, } from "../project-topics.js";
18
18
  import { getWorkflowPolicy, updateWorkflowPolicy, mergeConfig, getRetentionPolicy, getProjectConfigOverrides, getIndexPolicy, updateIndexPolicy, VALID_TASK_MODES } from "../governance/policy.js";
19
- import { setAccessRoles, ACCESS_ROLE_KEYS } from "../governance/rbac.js";
19
+ import { setAccessRoles, ACCESS_ROLE_KEYS, permissionDeniedError } from "../governance/rbac.js";
20
20
  import { readProjectConfig, updateProjectConfigOverrides } from "../project-config.js";
21
21
  import { buildConfigView } from "../config/resolve.js";
22
22
  import { CONFIG_DOMAINS } from "../config/schema.js";
@@ -24,6 +24,9 @@ import { findSkill } from "../skill/registry.js";
24
24
  import { setSkillEnabledAndSync } from "../skill/files.js";
25
25
  import { repairPreexistingInstall } from "../init/setup.js";
26
26
  import { logger } from "../logger.js";
27
+ import { addNote, editNote, listNotes, removeNote } from "../data/notes.js";
28
+ import { promoteNote } from "../core/note.js";
29
+ import { FINDING_TYPES } from "../shared.js";
27
30
  const CSRF_TOKEN_TTL_MS = 15 * 60 * 1000;
28
31
  const MAX_FORM_BODY_BYTES = 1_048_576;
29
32
  const WEB_UI_READY_ATTEMPTS = 12;
@@ -514,8 +517,9 @@ function handleGetSkills(res, ctx) {
514
517
  }
515
518
  function handleGetSkillContent(res, url, ctx) {
516
519
  const filePath = String(parseQs(url).path || "");
517
- if (!filePath || !isAllowedSkillPath(filePath, ctx.phrenPath))
520
+ if (!filePath || (!isAllowedSkillPath(filePath, ctx.phrenPath) && !isAllowedHookConfigPath(filePath, ctx.phrenPath))) {
518
521
  return jsonErr(res, "Invalid path", 400);
522
+ }
519
523
  if (!fs.existsSync(filePath))
520
524
  return jsonErr(res, "File not found");
521
525
  jsonOk(res, { ok: true, content: fs.readFileSync(filePath, "utf8") });
@@ -688,6 +692,17 @@ function handleGetFindings(res, pathname, ctx) {
688
692
  const result = readFindings(basePath, project);
689
693
  jsonOk(res, result.ok ? { ok: true, data: { project, findings: result.data } } : { ok: false, error: result.error });
690
694
  }
695
+ function handleGetNotes(res, url, pathname, ctx) {
696
+ const project = decodeURIComponent(pathname.slice("/api/notes/".length));
697
+ if (!project || !isValidProjectName(project))
698
+ return jsonErr(res, "Invalid project name", 400);
699
+ const date = String(parseQs(url).date || "") || undefined;
700
+ const basePath = resolveProjectBasePath(ctx.phrenPath, project);
701
+ const result = listNotes(basePath, project, { date, limit: 500 });
702
+ jsonOk(res, result.ok
703
+ ? { ok: true, data: { project, notes: result.data } }
704
+ : { ok: false, error: result.error, errorCode: result.code });
705
+ }
691
706
  // ── POST handlers ─────────────────────────────────────────────────────────────
692
707
  function handlePostSync(req, res, url, ctx) {
693
708
  withPostBody(req, res, url, ctx, (parsed) => {
@@ -726,12 +741,8 @@ function handlePostApprove(req, res, url, ctx) {
726
741
  if (!project || !isValidProjectName(project) || !line)
727
742
  return jsonErr(res, "Missing project or line");
728
743
  try {
729
- const qPath = queueFilePath(ctx.phrenPath, project);
730
- if (fs.existsSync(qPath)) {
731
- const lines = fs.readFileSync(qPath, "utf8").split("\n").filter((l) => l.trim() !== line.trim());
732
- fs.writeFileSync(qPath, lines.join("\n"));
733
- }
734
- jsonOk(res, { ok: true });
744
+ const result = approveQueueItem(ctx.phrenPath, project, line);
745
+ jsonOk(res, { ok: result.ok, error: result.ok ? undefined : result.error });
735
746
  }
736
747
  catch (err) {
737
748
  jsonErr(res, errorMessage(err));
@@ -745,15 +756,8 @@ function handlePostReject(req, res, url, ctx) {
745
756
  if (!project || !isValidProjectName(project) || !line)
746
757
  return jsonErr(res, "Missing project or line");
747
758
  try {
748
- const qPath = queueFilePath(ctx.phrenPath, project);
749
- if (fs.existsSync(qPath)) {
750
- const lines = fs.readFileSync(qPath, "utf8").split("\n").filter((l) => l.trim() !== line.trim());
751
- fs.writeFileSync(qPath, lines.join("\n"));
752
- }
753
- const findingText = line.replace(/^-\s*/, "").replace(/<!--.*?-->/g, "").trim();
754
- if (findingText)
755
- removeFinding(ctx.phrenPath, project, findingText);
756
- jsonOk(res, { ok: true });
759
+ const result = rejectQueueItem(ctx.phrenPath, project, line);
760
+ jsonOk(res, { ok: result.ok, error: result.ok ? undefined : result.error });
757
761
  }
758
762
  catch (err) {
759
763
  jsonErr(res, errorMessage(err));
@@ -768,8 +772,7 @@ function handlePostEdit(req, res, url, ctx) {
768
772
  if (!project || !isValidProjectName(project) || !line || !newText)
769
773
  return jsonErr(res, "Missing project, line, or new_text");
770
774
  try {
771
- const oldText = line.replace(/^-\s*/, "").replace(/<!--.*?-->/g, "").trim();
772
- const result = editFinding(ctx.phrenPath, project, oldText, newText);
775
+ const result = editQueueItem(ctx.phrenPath, project, line, newText);
773
776
  jsonOk(res, { ok: result.ok, error: result.ok ? undefined : result.error });
774
777
  }
775
778
  catch (err) {
@@ -781,8 +784,9 @@ function handlePostSkillSave(req, res, url, ctx) {
781
784
  withPostBody(req, res, url, ctx, (parsed) => {
782
785
  const filePath = String(parsed.path || "");
783
786
  const content = String(parsed.content || "");
784
- if (!filePath || !isAllowedSkillPath(filePath, ctx.phrenPath))
787
+ if (!filePath || (!isAllowedSkillPath(filePath, ctx.phrenPath) && !isAllowedHookConfigPath(filePath, ctx.phrenPath))) {
785
788
  return jsonErr(res, "Invalid path");
789
+ }
786
790
  try {
787
791
  fs.mkdirSync(path.dirname(filePath), { recursive: true });
788
792
  const tmpPath = `${filePath}.tmp-${crypto.randomUUID()}`;
@@ -1267,6 +1271,64 @@ function handleFindingsWrite(req, res, url, pathname, ctx) {
1267
1271
  });
1268
1272
  }
1269
1273
  }
1274
+ function handleNotesWrite(req, res, url, pathname, ctx) {
1275
+ const project = decodeURIComponent(pathname.slice("/api/notes/".length));
1276
+ if (!project || !isValidProjectName(project))
1277
+ return jsonErr(res, "Invalid project name", 400);
1278
+ const basePath = resolveProjectBasePath(ctx.phrenPath, project);
1279
+ withPostBody(req, res, url, ctx, (parsed) => {
1280
+ const selector = String(parsed.note || "");
1281
+ if (req.method === "POST" && String(parsed.action || "") === "promote") {
1282
+ if (!selector)
1283
+ return jsonErr(res, "note is required", 400);
1284
+ const denied = permissionDeniedError(basePath, "promote_note", project);
1285
+ if (denied)
1286
+ return jsonErr(res, denied, 403);
1287
+ const findingTypeRaw = String(parsed.finding_type || "");
1288
+ if (findingTypeRaw && !FINDING_TYPES.includes(findingTypeRaw)) {
1289
+ return jsonErr(res, `Invalid finding type: ${findingTypeRaw}`, 400);
1290
+ }
1291
+ const result = promoteNote(basePath, project, selector, findingTypeRaw);
1292
+ return jsonOk(res, result.ok
1293
+ ? { ok: true, data: result.data, message: `Promoted ${result.data.note.id} to a finding.` }
1294
+ : { ok: false, error: result.error, errorCode: result.code });
1295
+ }
1296
+ if (req.method === "POST") {
1297
+ const text = String(parsed.text || "");
1298
+ if (!text)
1299
+ return jsonErr(res, "text is required", 400);
1300
+ const denied = permissionDeniedError(basePath, "add_note", project);
1301
+ if (denied)
1302
+ return jsonErr(res, denied, 403);
1303
+ const date = String(parsed.date || "") || undefined;
1304
+ const result = addNote(basePath, project, text, { date });
1305
+ return jsonOk(res, result.ok
1306
+ ? { ok: true, data: { note: result.data }, message: `Added ${result.data.id}.` }
1307
+ : { ok: false, error: result.error, errorCode: result.code });
1308
+ }
1309
+ if (!selector)
1310
+ return jsonErr(res, "note is required", 400);
1311
+ if (req.method === "PUT") {
1312
+ const text = String(parsed.text || "");
1313
+ if (!text)
1314
+ return jsonErr(res, "text is required", 400);
1315
+ const denied = permissionDeniedError(basePath, "edit_note", project);
1316
+ if (denied)
1317
+ return jsonErr(res, denied, 403);
1318
+ const result = editNote(basePath, project, selector, text);
1319
+ return jsonOk(res, result.ok
1320
+ ? { ok: true, data: { note: result.data }, message: `Updated ${result.data.id}.` }
1321
+ : { ok: false, error: result.error, errorCode: result.code });
1322
+ }
1323
+ const denied = permissionDeniedError(basePath, "remove_note", project);
1324
+ if (denied)
1325
+ return jsonErr(res, denied, 403);
1326
+ const result = removeNote(basePath, project, selector);
1327
+ return jsonOk(res, result.ok
1328
+ ? { ok: true, data: { note: result.data }, message: `Removed ${result.data.id}.` }
1329
+ : { ok: false, error: result.error, errorCode: result.code });
1330
+ });
1331
+ }
1270
1332
  // ── Main router ───────────────────────────────────────────────────────────────
1271
1333
  export function createWebUiHttpServer(phrenPath, renderPage, profile, opts) {
1272
1334
  try {
@@ -1328,6 +1390,8 @@ export function createWebUiHttpServer(phrenPath, renderPage, profile, opts) {
1328
1390
  return await handleGetGraph(res, url, ctx);
1329
1391
  if (pathname.startsWith("/api/findings/"))
1330
1392
  return handleGetFindings(res, pathname, ctx);
1393
+ if (pathname.startsWith("/api/notes/"))
1394
+ return handleGetNotes(res, url, pathname, ctx);
1331
1395
  }
1332
1396
  // ── POST/PUT/DELETE routes ──
1333
1397
  if (req.method === "POST" || req.method === "PUT" || req.method === "DELETE") {
@@ -1362,6 +1426,8 @@ export function createWebUiHttpServer(phrenPath, renderPage, profile, opts) {
1362
1426
  // Prefix-matched write routes
1363
1427
  if (pathname.startsWith("/api/findings/"))
1364
1428
  return handleFindingsWrite(req, res, url, pathname, ctx);
1429
+ if (pathname.startsWith("/api/notes/"))
1430
+ return handleNotesWrite(req, res, url, pathname, ctx);
1365
1431
  }
1366
1432
  res.writeHead(404, { "content-type": "text/plain" });
1367
1433
  res.end("Not found");
@@ -3,3 +3,5 @@ export declare const SETTINGS_TAB_UI_STYLES = "\n .settings-shell {\n displa
3
3
  export declare const TASK_UI_STYLES = "\n /* \u2500\u2500 Task Manager Styles \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n .task-toolbar {\n display: flex;\n align-items: center;\n gap: 12px;\n margin-bottom: 20px;\n flex-wrap: wrap;\n }\n .task-filter-select {\n border: 1px solid var(--border);\n border-radius: var(--radius-sm);\n padding: 8px 12px;\n background: var(--surface);\n color: var(--ink);\n font-size: var(--text-sm);\n font-family: var(--font);\n cursor: pointer;\n transition: border-color 0.15s;\n }\n .task-filter-select:hover { border-color: var(--accent); }\n .task-filter-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }\n .task-count-label {\n font-size: var(--text-sm);\n color: var(--muted);\n margin-left: auto;\n font-weight: 500;\n }\n\n .task-empty-state {\n padding: 60px 40px;\n text-align: center;\n color: var(--muted);\n }\n\n .task-add-bar {\n display: flex;\n gap: 10px;\n margin-bottom: 20px;\n align-items: center;\n }\n .task-add-input {\n flex: 1;\n padding: 10px 14px;\n border: 1px solid var(--border);\n border-radius: var(--radius-sm);\n background: var(--surface);\n color: var(--ink);\n font-size: var(--text-base);\n font-family: var(--font);\n transition: border-color 0.15s, box-shadow 0.15s;\n }\n .task-add-input:focus {\n outline: none;\n border-color: var(--accent);\n box-shadow: 0 0 0 3px var(--accent-dim);\n }\n .task-add-input::placeholder { color: var(--muted); opacity: 0.6; }\n .task-add-btn {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 10px 18px;\n border: none;\n border-radius: var(--radius-sm);\n background: var(--accent);\n color: #fff;\n cursor: pointer;\n font-size: var(--text-sm);\n font-weight: 600;\n font-family: var(--font);\n transition: background 0.15s, transform 0.1s;\n white-space: nowrap;\n }\n .task-add-btn:hover { background: var(--accent-hover); }\n .task-add-btn:active { transform: scale(0.97); }\n\n .task-section-group { margin-bottom: 24px; }\n .task-section-header {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: var(--text-xs);\n font-weight: 700;\n color: var(--muted);\n text-transform: uppercase;\n letter-spacing: 0.06em;\n margin-bottom: 8px;\n padding: 0 4px;\n }\n .task-section-count {\n font-weight: 500;\n color: var(--muted);\n font-size: var(--text-xs);\n opacity: 0.7;\n }\n\n .task-list {\n display: flex;\n flex-direction: column;\n gap: 2px;\n border: 1px solid var(--border);\n border-radius: var(--radius);\n background: var(--surface);\n overflow: hidden;\n }\n\n .task-row {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 10px 14px;\n border-bottom: 1px solid var(--border-light);\n transition: background 0.1s;\n cursor: default;\n position: relative;\n }\n .task-row:last-child { border-bottom: none; }\n .task-row:hover { background: var(--surface-raised); }\n .task-row:hover .task-row-actions { opacity: 1; pointer-events: auto; }\n\n .task-row-priority {\n width: 4px;\n height: 24px;\n border-radius: 2px;\n flex-shrink: 0;\n }\n .task-row-priority-high { background: #ef4444; }\n .task-row-priority-medium { background: #f59e0b; }\n .task-row-priority-low { background: #9ca3af; }\n .task-row-priority-none { background: transparent; }\n\n .task-row-content {\n flex: 1;\n min-width: 0;\n display: flex;\n align-items: center;\n gap: 8px;\n }\n .task-row-text {\n font-size: var(--text-base);\n color: var(--ink);\n line-height: 1.4;\n word-break: break-word;\n }\n .task-row-done .task-row-text {\n text-decoration: line-through;\n opacity: 0.5;\n }\n .task-row-context {\n font-size: var(--text-xs);\n color: var(--muted);\n font-style: italic;\n margin-top: 2px;\n }\n\n .task-row-meta {\n display: flex;\n align-items: center;\n gap: 6px;\n flex-shrink: 0;\n }\n\n .task-priority-badge {\n display: inline-block;\n padding: 1px 7px;\n border-radius: 999px;\n font-size: 10px;\n font-weight: 600;\n text-transform: capitalize;\n }\n .task-priority-high { background: #ef444418; color: #ef4444; }\n .task-priority-medium { background: #f59e0b18; color: #f59e0b; }\n .task-priority-low { background: #6b728018; color: #6b7280; }\n\n .task-project-badge {\n display: inline-block;\n padding: 2px 8px;\n border-radius: var(--radius-sm);\n font-size: 10px;\n font-weight: 500;\n background: var(--accent-dim);\n color: var(--accent);\n }\n\n .task-pin-indicator {\n color: var(--accent);\n display: inline-flex;\n align-items: center;\n }\n\n .task-github-badge {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 2px 8px;\n border-radius: var(--radius-sm);\n font-size: 10px;\n font-weight: 500;\n background: var(--surface-sunken);\n color: var(--ink-secondary);\n text-decoration: none;\n transition: background 0.15s;\n }\n .task-github-badge:hover { background: var(--accent-dim); color: var(--accent); }\n\n .task-row-actions {\n display: flex;\n align-items: center;\n gap: 4px;\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.15s;\n flex-shrink: 0;\n }\n .task-action-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border: 1px solid var(--border);\n border-radius: var(--radius-sm);\n background: var(--surface);\n color: var(--muted);\n cursor: pointer;\n font-size: 12px;\n font-family: var(--font);\n transition: all 0.15s;\n padding: 0;\n }\n .task-action-btn:hover {\n border-color: var(--accent);\n color: var(--accent);\n background: var(--accent-dim);\n }\n .task-action-btn.task-action-complete:hover {\n border-color: var(--success);\n color: var(--success);\n background: var(--success-dim);\n }\n .task-action-btn.task-action-delete:hover {\n border-color: var(--danger);\n color: var(--danger);\n background: var(--danger-dim);\n }\n\n .task-done-section { margin-top: 24px; }\n .task-done-toggle {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 10px 4px;\n background: none;\n border: none;\n color: var(--muted);\n font-size: var(--text-xs);\n font-weight: 700;\n font-family: var(--font);\n cursor: pointer;\n text-transform: uppercase;\n letter-spacing: 0.06em;\n transition: color 0.15s;\n }\n .task-done-toggle:hover { color: var(--ink-secondary); }\n .task-toggle-arrow {\n font-size: 10px;\n transition: transform 0.2s;\n }\n .task-done-list { padding-top: 4px; }\n\n /* \u2500\u2500 Task Summary Bar \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n .task-summary-bar {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 10px 14px;\n background: var(--surface-sunken, var(--surface));\n border: 1px solid var(--border);\n border-radius: var(--radius);\n margin-bottom: 16px;\n flex-wrap: wrap;\n font-size: var(--text-sm);\n }\n .task-summary-total {\n font-weight: 600;\n color: var(--ink);\n font-size: var(--text-base);\n }\n .task-summary-pill {\n display: inline-flex;\n align-items: center;\n padding: 2px 8px;\n border-radius: 999px;\n font-size: 11px;\n font-weight: 600;\n }\n .task-summary-high { background: #ef444422; color: #ef4444; }\n .task-summary-medium { background: #f59e0b22; color: #f59e0b; }\n .task-summary-low { background: #6b728022; color: #6b7280; }\n .task-summary-projects {\n display: flex;\n gap: 6px;\n align-items: center;\n }\n .task-summary-project {\n font-size: 11px;\n color: var(--muted);\n padding: 1px 6px;\n border: 1px solid var(--border);\n border-radius: var(--radius-sm);\n }\n\n /* \u2500\u2500 Task Session Badge \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n .task-session-badge {\n display: inline-block;\n padding: 1px 6px;\n border-radius: var(--radius-sm);\n font-size: 10px;\n font-family: var(--mono, monospace);\n background: var(--surface-sunken, var(--surface));\n color: var(--muted);\n border: 1px solid var(--border);\n }\n";
4
4
  export declare const REVIEW_UI_STYLES = "\n /* \u2500\u2500 Review Toolbar \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n .review-toolbar {\n display: flex;\n align-items: center;\n gap: 10px;\n margin-bottom: 16px;\n flex-wrap: wrap;\n }\n .review-flagged-toggle {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n font-size: var(--text-sm);\n font-weight: 500;\n color: var(--ink-secondary);\n cursor: pointer;\n user-select: none;\n }\n .review-flagged-toggle input[type=\"checkbox\"] {\n width: 14px;\n height: 14px;\n cursor: pointer;\n accent-color: var(--accent);\n }\n .review-sync-dot {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 22px;\n height: 22px;\n flex-shrink: 0;\n }\n .review-sync-indicator {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: var(--success);\n display: inline-block;\n transition: background 0.3s;\n }\n .review-sync-indicator.syncing {\n background: var(--warning);\n animation: ledPulse 1.2s infinite;\n }\n .review-sync-indicator.error {\n background: var(--danger);\n }\n /* \u2500\u2500 Review Card Highlight (keyboard shortcuts) \u2500\u2500\u2500\u2500 */\n .review-card-highlight {\n border: 2px solid var(--blue) !important;\n box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.08), var(--shadow) !important;\n background: color-mix(in srgb, var(--surface) 98%, var(--blue)) !important;\n }\n";
5
5
  export declare const LAYOUT_VIEWPORT_STYLES = "\n /* Graph: fill the available viewport height instead of forcing 800px\n (which overflowed laptop-height screens), and frame it as a panel. */\n #graph-canvas {\n height: calc(100vh - 110px);\n min-height: 420px;\n }\n .graph-container {\n position: relative;\n border: 1px solid var(--border);\n border-radius: 10px;\n overflow: hidden;\n }\n\n /* Header nav: shrink and scroll internally on narrow widths so the header\n never pushes the page wider than the viewport. */\n .nav {\n min-width: 0;\n flex: 0 1 auto;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none;\n -ms-overflow-style: none;\n }\n .nav::-webkit-scrollbar { display: none; }\n .nav-item { flex: 0 0 auto; white-space: nowrap; }\n\n @media (max-width: 900px) {\n #graph-canvas { height: calc(100vh - 92px); min-height: 360px; }\n .header { gap: 12px; }\n .nav-item { padding: 0 12px; }\n }\n";
6
+ export declare const FINDING_CAPTURE_UI_STYLES = "\n .project-detail-header .capture-finding-btn { margin-left: auto; }\n .finding-capture-bar {\n display: flex;\n gap: 8px;\n padding: 14px 14px 0;\n }\n .finding-capture-bar input {\n flex: 1;\n min-width: 0;\n border: 1px solid var(--border);\n border-radius: var(--radius-sm);\n padding: 7px 10px;\n background: var(--surface);\n color: var(--ink);\n font: var(--text-sm) var(--font);\n }\n .finding-capture-bar input:focus {\n outline: none;\n border-color: var(--accent);\n box-shadow: 0 0 0 3px var(--accent-dim);\n }\n";
7
+ export declare const NOTES_UI_STYLES = "\n .capture-note-btn { white-space: nowrap; }\n .notes-panel { padding: 14px; }\n .note-capture {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n gap: 10px;\n padding: 14px;\n border: 1px solid var(--border);\n border-radius: var(--radius);\n background: var(--surface-raised);\n margin-bottom: 20px;\n }\n .note-capture textarea {\n width: 100%; min-height: 76px; resize: vertical; padding: 10px 12px;\n border: 1px solid var(--border); border-radius: var(--radius-sm);\n background: var(--surface); color: var(--ink); font: var(--text-base) var(--font); line-height: 1.5;\n }\n .note-capture textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }\n .note-capture-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }\n .note-capture-actions input { padding: 7px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }\n .note-day { display: flex; flex-direction: column; gap: 9px; margin-bottom: 20px; }\n .note-day-heading { font-size: var(--text-xs); font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }\n .note-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-raised); }\n .note-card-meta { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: var(--text-xs); margin-bottom: 8px; }\n .note-card-meta code { font-family: var(--mono); }\n .note-promoted { color: var(--success); background: var(--success-dim); border-radius: 999px; padding: 1px 7px; font-weight: 600; }\n .note-card-text { color: var(--ink-secondary); font-size: var(--text-base); line-height: 1.6; overflow-wrap: anywhere; }\n .note-card-actions { display: flex; gap: 7px; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--border-light); }\n .note-card-actions .note-remove { margin-left: auto; color: var(--danger); }\n @media (max-width: 680px) {\n .note-capture { grid-template-columns: 1fr; }\n .note-capture-actions { flex-direction: row; }\n .project-detail-header { flex-wrap: wrap; }\n }\n";
package/dist/ui/styles.js CHANGED
@@ -700,3 +700,62 @@ export const LAYOUT_VIEWPORT_STYLES = `
700
700
  .nav-item { padding: 0 12px; }
701
701
  }
702
702
  `;
703
+ export const FINDING_CAPTURE_UI_STYLES = `
704
+ .project-detail-header .capture-finding-btn { margin-left: auto; }
705
+ .finding-capture-bar {
706
+ display: flex;
707
+ gap: 8px;
708
+ padding: 14px 14px 0;
709
+ }
710
+ .finding-capture-bar input {
711
+ flex: 1;
712
+ min-width: 0;
713
+ border: 1px solid var(--border);
714
+ border-radius: var(--radius-sm);
715
+ padding: 7px 10px;
716
+ background: var(--surface);
717
+ color: var(--ink);
718
+ font: var(--text-sm) var(--font);
719
+ }
720
+ .finding-capture-bar input:focus {
721
+ outline: none;
722
+ border-color: var(--accent);
723
+ box-shadow: 0 0 0 3px var(--accent-dim);
724
+ }
725
+ `;
726
+ export const NOTES_UI_STYLES = `
727
+ .capture-note-btn { white-space: nowrap; }
728
+ .notes-panel { padding: 14px; }
729
+ .note-capture {
730
+ display: grid;
731
+ grid-template-columns: minmax(0, 1fr) auto;
732
+ gap: 10px;
733
+ padding: 14px;
734
+ border: 1px solid var(--border);
735
+ border-radius: var(--radius);
736
+ background: var(--surface-raised);
737
+ margin-bottom: 20px;
738
+ }
739
+ .note-capture textarea {
740
+ width: 100%; min-height: 76px; resize: vertical; padding: 10px 12px;
741
+ border: 1px solid var(--border); border-radius: var(--radius-sm);
742
+ background: var(--surface); color: var(--ink); font: var(--text-base) var(--font); line-height: 1.5;
743
+ }
744
+ .note-capture textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
745
+ .note-capture-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
746
+ .note-capture-actions input { padding: 7px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
747
+ .note-day { display: flex; flex-direction: column; gap: 9px; margin-bottom: 20px; }
748
+ .note-day-heading { font-size: var(--text-xs); font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
749
+ .note-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-raised); }
750
+ .note-card-meta { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: var(--text-xs); margin-bottom: 8px; }
751
+ .note-card-meta code { font-family: var(--mono); }
752
+ .note-promoted { color: var(--success); background: var(--success-dim); border-radius: 999px; padding: 1px 7px; font-weight: 600; }
753
+ .note-card-text { color: var(--ink-secondary); font-size: var(--text-base); line-height: 1.6; overflow-wrap: anywhere; }
754
+ .note-card-actions { display: flex; gap: 7px; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--border-light); }
755
+ .note-card-actions .note-remove { margin-left: auto; color: var(--danger); }
756
+ @media (max-width: 680px) {
757
+ .note-capture { grid-template-columns: 1fr; }
758
+ .note-capture-actions { flex-direction: row; }
759
+ .project-detail-header { flex-wrap: wrap; }
760
+ }
761
+ `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phren/cli",
3
- "version": "0.1.37",
3
+ "version": "0.1.38",
4
4
  "description": "Knowledge layer for AI agents — CLI, MCP server, and data layer",
5
5
  "type": "module",
6
6
  "bin": {
@@ -35,10 +35,18 @@
35
35
  "types": "./dist/data/tasks.d.ts",
36
36
  "default": "./dist/data/tasks.js"
37
37
  },
38
+ "./data/notes": {
39
+ "types": "./dist/data/notes.d.ts",
40
+ "default": "./dist/data/notes.js"
41
+ },
38
42
  "./core/finding": {
39
43
  "types": "./dist/core/finding.d.ts",
40
44
  "default": "./dist/core/finding.js"
41
45
  },
46
+ "./core/note": {
47
+ "types": "./dist/core/note.d.ts",
48
+ "default": "./dist/core/note.js"
49
+ },
42
50
  "./auth/profiles": {
43
51
  "types": "./dist/auth/profiles.d.ts",
44
52
  "default": "./dist/auth/profiles.js"