← back to Gated Morning Review
fix: Tasks-tab Close now marks the tk ticket done (was a no-op — a task is a ticket, not a queue file)
8bf121c602d162f8f2d8410c5348da9b00a31d99 · 2026-08-20 10:32:37 -0700 · steve
Files touched
Diff
commit 8bf121c602d162f8f2d8410c5348da9b00a31d99
Author: steve <steve@designerwallcoverings.com>
Date: Thu Aug 20 10:32:37 2026 -0700
fix: Tasks-tab Close now marks the tk ticket done (was a no-op — a task is a ticket, not a queue file)
---
server.mjs | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/server.mjs b/server.mjs
index 06edc87..cf66d20 100644
--- a/server.mjs
+++ b/server.mjs
@@ -4,7 +4,7 @@ import http from 'http';
import fs from 'fs';
import path from 'path';
import os from 'os';
-import { execFile } from 'child_process';
+import { execFile, execFileSync } from 'child_process';
import { fileURLToPath } from 'url';
import { scanQueue, scanTasks, gatedTicketNums, QDIR } from './lib.mjs';
@@ -24,12 +24,21 @@ const authed = (req) => {
return u === USER && p === PASS;
};
-function closeItem(file, action) {
- const src = path.join(QDIR, file);
+function closeItem(id, action, kind) {
+ // A TASK is a tk ticket, not a file in the queue — close it by marking the ticket done
+ // (this is why the Close button did nothing on the Tasks tab: there was no file to move).
+ if (kind === 'task') {
+ try {
+ execFileSync('tk', ['done', id], { env: { ...process.env, TK_AGENT: 'morning-viewer' }, timeout: 8000, stdio: 'ignore' });
+ fs.appendFileSync(DECIS, JSON.stringify({ ts: new Date().toISOString(), file: id, action: 'tk-done' }) + '\n');
+ return { ok: true };
+ } catch (e) { return { ok: false, err: String(e.message).slice(0, 80) }; }
+ }
+ const src = path.join(QDIR, id);
if (!fs.existsSync(src)) return { ok: false, err: 'gone' };
const dir = action === 'never' ? '_never' : '_done';
- fs.renameSync(src, path.join(QDIR, dir, file));
- fs.appendFileSync(DECIS, JSON.stringify({ ts: new Date().toISOString(), file, action: 'close-' + dir }) + '\n');
+ fs.renameSync(src, path.join(QDIR, dir, id));
+ fs.appendFileSync(DECIS, JSON.stringify({ ts: new Date().toISOString(), file: id, action: 'close-' + dir }) + '\n');
return { ok: true };
}
@@ -131,7 +140,7 @@ http.createServer((req, res) => {
let b = ''; req.on('data', c => b += c); req.on('end', async () => {
try {
const { id, kind, action } = JSON.parse(b);
- if (req.url === '/api/decide') { const r = closeItem(id, action === 'never' ? 'never' : 'toss'); res.writeHead(r.ok ? 200 : 404, { 'content-type': 'application/json' }); return res.end(JSON.stringify(r)); }
+ if (req.url === '/api/decide') { const r = closeItem(id, action === 'never' ? 'never' : 'toss', kind); res.writeHead(r.ok ? 200 : 404, { 'content-type': 'application/json' }); return res.end(JSON.stringify(r)); }
// run: rebuild the item (gated from queue scan, task from tk)
const all = kind === 'task' ? scanTasks() : scanQueue();
const item = all.find(x => (x.id || x.file) === id) || { kind, id, file: id, title: id, big: '', why: '', good: '', bad: '' };
← e3a8b5e morning-review: dedupe queue — hide tasks that duplicate a g
·
back to Gated Morning Review
·
auto-data-snapshot: 2026-09-01T12:55:30 (1 data files) — pac 03c1002 →