jt-workspace-dashboard 0.1.5 → 0.1.8

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/README.md CHANGED
@@ -29,6 +29,7 @@ Publishing uses npm trusted publishing, linked to `.github/workflows/publish.yml
29
29
  labels: { ready: "Ready to show" }, // optional: this workspace's label names (= section names)
30
30
  calendar: { ids: ["primary"], hide: ["Time Blocking"] }, // or false
31
31
  updateTask: "trig_…",
32
+ notes: { dataSource: "collection id", minSteps: 3 }, // automatic Notion notes pages (or all: true)
32
33
  features: { handoff: false, meetingAsks: false, showFollowUp: false, chatLink: false }
33
34
  }
34
35
  ]
@@ -37,6 +38,8 @@ Publishing uses npm trusted publishing, linked to `.github/workflows/publish.yml
37
38
 
38
39
  The page's database (only used for the update button's status line) is read at `meta/status-<workspace id>`.
39
40
 
41
+ **Project notes pages:** a workspace with `notes` gets a Notion page per project, created by the page itself (no Claude tokens) in that Notion database: every task when `notes.all` is true (client work), otherwise once a task has `notes.minSteps` steps (default 3). The page gets the task's links, note, context and steps, the task gets a `Notion:` line (Notes chip), and completing the task sets the page's Status to Done. The update tasks add longer notes to the page's Notes section. Needs `Notion` → `notion-create-pages`, `notion-update-page` in the page's capabilities.
42
+
40
43
  **Loading:** the page shows the last tasks and today's calendar it saw (saved in the browser) instantly, then refreshes from Todoist in the background: on open, every 2 minutes, and when you come back to the tab after 30+ seconds.
41
44
 
42
45
  The page's declared capabilities must include `mcp` with Todoist (`find-tasks`, `find-completed-tasks`, `update-tasks`, `complete-tasks`, `uncomplete-tasks`, `delete-object`), Google Calendar (`list_events`), Claude Code Remote (`fire_trigger`), plus `host:claude_browser` (`preview_start`, `find`) if `chatLink` is on, and `db`.
@@ -72,6 +75,8 @@ Context:
72
75
  - decision or background bullet
73
76
  ```
74
77
 
78
+ **Project notes:** longer notes live in Notion, one page per project, linked from the task with the `Notion:` line (shown as a Notes chip). The update tasks create and maintain these pages: every Tactus task gets one; a personal task gets one once it has 3+ subtasks.
79
+
75
80
  **Subtasks** are the checklist; a subtask's description lines are its notes. Subtasks labelled `Question` show in the card's **Questions** fold instead (complete = answered). Priority p1–p3 shows as Urgent / High / Medium.
76
81
 
77
82
  ## Develop
package/dist/dashboard.js CHANGED
@@ -8,7 +8,7 @@
8
8
  const BASE_LABELS = Object.assign({today: "In progress", ready: "Paused", waiting: "Waiting", later: "Later", handoff: "Handoff", meeting: "Ask", question: "Question"}, CFG.labels || {});
9
9
  let LABELS = BASE_LABELS; // per workspace: BASE_LABELS + workspace.labels
10
10
  const OWNER_NAME = String(CFG.ownerName || "").slice(0, 40);
11
- const VERSION = "0.1.5";
11
+ const VERSION = "0.1.8";
12
12
 
13
13
  /* ---------- page skeleton ---------- */
14
14
  document.title = CFG.title || "Dashboard";
@@ -32,7 +32,8 @@
32
32
  };
33
33
  const CHEV = '<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 6l4 4 4-4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
34
34
  function el(tag, cls, text){ const e = document.createElement(tag); if(cls) e.className = cls; if(text != null) e.textContent = text; return e; }
35
- function safeUrl(u){ return typeof u === "string" && /^https:\/\//.test(u) ? u : null; }
35
+ // Accepts a plain https link or a Markdown one like [title](https://…)
36
+ function safeUrl(u){ if(typeof u !== "string") return null; const m = u.match(/^\[[^\]]*\]\((https:\/\/[^\s)]+)\)/); if(m) return m[1]; return /^https:\/\/\S+$/.test(u.trim()) ? u.trim() : null; }
36
37
  const store = (k, d) => { try { return JSON.parse(localStorage.getItem(k) || "null") ?? d; } catch(_){ return d; } };
37
38
  const save = (k, v) => { try { localStorage.setItem(k, JSON.stringify(v)); } catch(_){} };
38
39
  function setStatus(msg){ const s = $("status"); s.textContent = msg || ""; s.hidden = !msg; }
@@ -200,6 +201,7 @@
200
201
  done.forEach(t => next.push({id: t.id, title: t.content, section: "done", _completed: true, labels: t.labels || [], description: String(t.description || ""), touchedAt: Date.parse(t.completedAt) || 0, subtasks: [], questions: [], _server: []}));
201
202
  });
202
203
  items = next; cache[w.id] = next; saveCache(w.id, next); setStatus(""); render();
204
+ ensureNotesPages(w).catch(() => {});
203
205
  } catch(e){
204
206
  if(w !== WS) return;
205
207
  const c = e && e.code;
@@ -225,7 +227,7 @@
225
227
  let desc = it.description, labels = null;
226
228
  if("section" in patch){
227
229
  const s = patch.section;
228
- if(s === "done"){ await td("complete-tasks", {ids: [id]}); it._completed = true; }
230
+ if(s === "done"){ await td("complete-tasks", {ids: [id]}); it._completed = true; markNotesDone(it); }
229
231
  else if(s === "removed"){ await td("delete-object", {type: "task", id}); }
230
232
  else {
231
233
  if(it._completed){ await td("uncomplete-tasks", {ids: [id]}); it._completed = false; }
@@ -235,6 +237,7 @@
235
237
  }
236
238
  } else if("waitingOn" in patch) desc = setLine(desc, "Waiting on", patch.waitingOn);
237
239
  if("chat" in patch) desc = setLine(desc, "Chat", patch.chat);
240
+ if("notion" in patch) desc = setLine(desc, "Notion", patch.notion);
238
241
  const up = {id};
239
242
  if(labels){ up.labels = labels; it.labels = labels; }
240
243
  if(desc !== it.description){ up.description = desc; it.description = desc; }
@@ -250,6 +253,52 @@
250
253
  scheduleRefresh();
251
254
  }
252
255
 
256
+ /* ---------- automatic Notion notes pages for projects ----------
257
+ A workspace with notes:{dataSource} gets one Notion page per project task, created by the page itself (no Claude tokens).
258
+ notes.all = every task is a project (client work); otherwise a task becomes a project at notes.minSteps steps (default 3). */
259
+ const notionCall = (tool, input) => mcp.callTool(CFG.notionServer || "Notion", tool, input, {cache: false});
260
+ const notesTried = store("dash.notesTried", {});
261
+ function isProject(w, it){
262
+ const n = w.notes; if(!n || !n.dataSource) return false;
263
+ if(it.notion || !["today", "ready", "waiting", "handoff", "upcoming", "later"].includes(it.section)) return false;
264
+ return n.all || (it.subtasks || []).length >= (n.minSteps || 3);
265
+ }
266
+ function notesMarkdown(it){
267
+ const out = [];
268
+ const links = [["Todoist", it.todoistUrl], ["Figma", it.figma], ["Source", it.url !== it.todoistUrl ? it.url : null], ["Chat", it.chat]].filter(x => safeUrl(x[1]));
269
+ if(links.length) out.push(links.map(([k, u]) => "[" + k + "](" + u + ")").join(" · "), "");
270
+ const pr = priorityOf(it.note); const note = pr ? pr.rest : it.note;
271
+ if(note) out.push(note, "");
272
+ if((it.log || []).length){ out.push("## Context"); it.log.forEach(x => out.push("- " + x.t)); out.push(""); }
273
+ if((it.subtasks || []).length){ out.push("## Steps when this page was made"); it.subtasks.forEach(x => out.push("- [" + (x.d ? "x" : " ") + "] " + x.t)); out.push(""); }
274
+ out.push("## Notes", "Longer notes, meeting discussions and decisions for this project go here.");
275
+ return out.join("\n");
276
+ }
277
+ let notesBusy = false;
278
+ async function ensureNotesPages(w){
279
+ if(notesBusy || !mcp || !w.notes || !w.notes.dataSource) return;
280
+ const due = items.filter(it => isProject(w, it) && !(Date.now() - (notesTried[it.id] || 0) < 24 * 3600 * 1000)).slice(0, 3);
281
+ if(!due.length) return;
282
+ notesBusy = true;
283
+ try {
284
+ for(const it of due){
285
+ notesTried[it.id] = Date.now(); save("dash.notesTried", notesTried);
286
+ const props = {Name: it.title, Status: "Active", Todoist: it.todoistUrl};
287
+ if(w.notes.figmaProp && it.figma) props[w.notes.figmaProp] = it.figma;
288
+ const r = await notionCall("notion-create-pages", {parent: {data_source_id: w.notes.dataSource}, pages: [{properties: props, content: notesMarkdown(it)}], allow_async: false});
289
+ const txt = JSON.stringify(r && (r.payload || r.content) || "");
290
+ const m = txt.match(/https:\/\/(?:app\.|www\.)?notion\.(?:so|com)\/[^\s"'<>)\\]+/);
291
+ if(!m) continue;
292
+ const url = m[0].replace(/\?pvs=\d+$/, "");
293
+ it.notion = url; await write(it.id, {notion: url});
294
+ }
295
+ } finally { notesBusy = false; }
296
+ }
297
+ async function markNotesDone(it){
298
+ if(!it.notion || !mcp || !(WS.notes && WS.notes.dataSource)) return;
299
+ try { await notionCall("notion-update-page", {page_id: it.notion, command: "update_properties", properties: {Status: "Done"}}); } catch(_){}
300
+ }
301
+
253
302
  /* ---------- calendar ---------- */
254
303
  let dayData = null;
255
304
  async function loadCalendar(){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jt-workspace-dashboard",
3
- "version": "0.1.5",
3
+ "version": "0.1.8",
4
4
  "description": "Shared code for Jeremy's Claude dashboards: a Todoist + Google Calendar consolidator with workspaces.",
5
5
  "main": "dist/dashboard.js",
6
6
  "files": [