jt-workspace-dashboard 0.1.5 → 0.1.6

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`.
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.6";
12
12
 
13
13
  /* ---------- page skeleton ---------- */
14
14
  document.title = CFG.title || "Dashboard";
@@ -200,6 +200,7 @@
200
200
  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
201
  });
202
202
  items = next; cache[w.id] = next; saveCache(w.id, next); setStatus(""); render();
203
+ ensureNotesPages(w).catch(() => {});
203
204
  } catch(e){
204
205
  if(w !== WS) return;
205
206
  const c = e && e.code;
@@ -225,7 +226,7 @@
225
226
  let desc = it.description, labels = null;
226
227
  if("section" in patch){
227
228
  const s = patch.section;
228
- if(s === "done"){ await td("complete-tasks", {ids: [id]}); it._completed = true; }
229
+ if(s === "done"){ await td("complete-tasks", {ids: [id]}); it._completed = true; markNotesDone(it); }
229
230
  else if(s === "removed"){ await td("delete-object", {type: "task", id}); }
230
231
  else {
231
232
  if(it._completed){ await td("uncomplete-tasks", {ids: [id]}); it._completed = false; }
@@ -235,6 +236,7 @@
235
236
  }
236
237
  } else if("waitingOn" in patch) desc = setLine(desc, "Waiting on", patch.waitingOn);
237
238
  if("chat" in patch) desc = setLine(desc, "Chat", patch.chat);
239
+ if("notion" in patch) desc = setLine(desc, "Notion", patch.notion);
238
240
  const up = {id};
239
241
  if(labels){ up.labels = labels; it.labels = labels; }
240
242
  if(desc !== it.description){ up.description = desc; it.description = desc; }
@@ -250,6 +252,52 @@
250
252
  scheduleRefresh();
251
253
  }
252
254
 
255
+ /* ---------- automatic Notion notes pages for projects ----------
256
+ A workspace with notes:{dataSource} gets one Notion page per project task, created by the page itself (no Claude tokens).
257
+ notes.all = every task is a project (client work); otherwise a task becomes a project at notes.minSteps steps (default 3). */
258
+ const notionCall = (tool, input) => mcp.callTool(CFG.notionServer || "Notion", tool, input, {cache: false});
259
+ const notesTried = store("dash.notesTried", {});
260
+ function isProject(w, it){
261
+ const n = w.notes; if(!n || !n.dataSource) return false;
262
+ if(it.notion || !["today", "ready", "waiting", "handoff", "upcoming", "later"].includes(it.section)) return false;
263
+ return n.all || (it.subtasks || []).length >= (n.minSteps || 3);
264
+ }
265
+ function notesMarkdown(it){
266
+ const out = [];
267
+ const links = [["Todoist", it.todoistUrl], ["Figma", it.figma], ["Source", it.url !== it.todoistUrl ? it.url : null], ["Chat", it.chat]].filter(x => safeUrl(x[1]));
268
+ if(links.length) out.push(links.map(([k, u]) => "[" + k + "](" + u + ")").join(" · "), "");
269
+ const pr = priorityOf(it.note); const note = pr ? pr.rest : it.note;
270
+ if(note) out.push(note, "");
271
+ if((it.log || []).length){ out.push("## Context"); it.log.forEach(x => out.push("- " + x.t)); out.push(""); }
272
+ 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(""); }
273
+ out.push("## Notes", "Longer notes, meeting discussions and decisions for this project go here.");
274
+ return out.join("\n");
275
+ }
276
+ let notesBusy = false;
277
+ async function ensureNotesPages(w){
278
+ if(notesBusy || !mcp || !w.notes || !w.notes.dataSource) return;
279
+ const due = items.filter(it => isProject(w, it) && !(Date.now() - (notesTried[it.id] || 0) < 24 * 3600 * 1000)).slice(0, 3);
280
+ if(!due.length) return;
281
+ notesBusy = true;
282
+ try {
283
+ for(const it of due){
284
+ notesTried[it.id] = Date.now(); save("dash.notesTried", notesTried);
285
+ const props = {Name: it.title, Status: "Active", Todoist: it.todoistUrl};
286
+ if(w.notes.figmaProp && it.figma) props[w.notes.figmaProp] = it.figma;
287
+ const r = await notionCall("notion-create-pages", {parent: {data_source_id: w.notes.dataSource}, pages: [{properties: props, content: notesMarkdown(it)}], allow_async: false});
288
+ const txt = JSON.stringify(r && (r.payload || r.content) || "");
289
+ const m = txt.match(/https:\/\/(?:app\.|www\.)?notion\.(?:so|com)\/[^\s"'<>)\\]+/);
290
+ if(!m) continue;
291
+ const url = m[0].replace(/\?pvs=\d+$/, "");
292
+ it.notion = url; await write(it.id, {notion: url});
293
+ }
294
+ } finally { notesBusy = false; }
295
+ }
296
+ async function markNotesDone(it){
297
+ if(!it.notion || !mcp || !(WS.notes && WS.notes.dataSource)) return;
298
+ try { await notionCall("notion-update-page", {page_id: it.notion, command: "update_properties", properties: {Status: "Done"}}); } catch(_){}
299
+ }
300
+
253
301
  /* ---------- calendar ---------- */
254
302
  let dayData = null;
255
303
  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.6",
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": [