@phren/cli 0.1.10 → 0.1.11

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.
@@ -1156,17 +1156,51 @@ export async function handleHookContext() {
1156
1156
  parts.push("");
1157
1157
  }
1158
1158
  }
1159
+ // Collect pinned tasks across ALL projects (excluding Done)
1160
+ const allTaskRows = queryRows(db, "SELECT project, content FROM docs WHERE type = 'task'", []);
1161
+ const pinnedFromOtherProjects = [];
1162
+ if (allTaskRows) {
1163
+ for (const row of allTaskRows) {
1164
+ const taskProject = row[0];
1165
+ if (taskProject === project)
1166
+ continue;
1167
+ const content = row[1];
1168
+ const pinned = content.split("\n")
1169
+ .filter(l => l.startsWith("- [ ] ") && /\[pinned\]/i.test(l))
1170
+ .map(l => `[${taskProject}] ${l}`);
1171
+ pinnedFromOtherProjects.push(...pinned);
1172
+ }
1173
+ }
1174
+ // Active project tasks — pinned float to top, exclude Done
1159
1175
  const taskRow = queryRows(db, "SELECT content FROM docs WHERE project = ? AND type = 'task'", [project]);
1176
+ const pinnedItems = [];
1177
+ const otherItems = [];
1160
1178
  if (taskRow) {
1161
1179
  const content = taskRow[0][0];
1162
- const activeItems = content.split("\n").filter(l => l.startsWith("- "));
1163
- const filtered = filterTaskByPriority(activeItems);
1164
- const trimmed = filtered.slice(0, 5);
1165
- if (trimmed.length > 0) {
1180
+ const allItems = content.split("\n").filter(l => l.startsWith("- [ ] "));
1181
+ for (const item of allItems) {
1182
+ if (/\[pinned\]/i.test(item)) {
1183
+ pinnedItems.push(item);
1184
+ }
1185
+ else {
1186
+ otherItems.push(item);
1187
+ }
1188
+ }
1189
+ }
1190
+ const filteredOther = filterTaskByPriority(otherItems);
1191
+ const allPinned = [...pinnedItems, ...pinnedFromOtherProjects].slice(0, 10);
1192
+ const remaining = Math.max(0, 5 - allPinned.length);
1193
+ const trimmedOther = filteredOther.slice(0, remaining);
1194
+ if (allPinned.length > 0 || trimmedOther.length > 0) {
1195
+ if (allPinned.length > 0) {
1196
+ parts.push("## Pinned tasks");
1197
+ parts.push(allPinned.join("\n"));
1198
+ }
1199
+ if (trimmedOther.length > 0) {
1166
1200
  parts.push("## Active tasks");
1167
- parts.push(trimmed.join("\n"));
1168
- parts.push("");
1201
+ parts.push(trimmedOther.join("\n"));
1169
1202
  }
1203
+ parts.push("");
1170
1204
  }
1171
1205
  }
1172
1206
  else {