flowcollab 0.3.21 → 0.3.22

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/bin/_commands.mjs CHANGED
@@ -44,6 +44,8 @@ export const CLI_COMMANDS = [
44
44
  usage: 'flow-handoff --task=<id> --to=<actor> --context="..." [--branch=] [--questions="q1|q2"] [--next-step="..."]' },
45
45
  { name: 'review', file: 'review.mjs', summary: 'Request code review; moves task to in-review',
46
46
  usage: 'flow-review <id> [--pr=<num>] [--reviewer=<actor>] [--context="..."]' },
47
+ { name: 'verify', file: 'verify.mjs', summary: 'Run the project test command + record a pass/fail on the task',
48
+ usage: 'flow-verify <id> [--cmd="npm test"] [--close] — run tests, post a verification event; --close closes on pass' },
47
49
  { name: 'search', file: 'search.mjs', summary: 'Search tasks by text, status, area, or assignee',
48
50
  usage: 'flow-search "query" [--status=] [--area=] [--assignee=]' },
49
51
  { name: 'status', file: 'status.mjs', summary: 'Quick board summary',
package/bin/verify.mjs ADDED
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+ /* flow:verify — run the project's test command, record a pass/fail verification on the task
3
+ timeline, and exit with the command's status so an agent's harness can branch on the result.
4
+ Usage: flow-verify <task_id> [--cmd="npm test"] [--close]
5
+ command resolution: --cmd > ./flow.config.json "verify_command" > "npm test"
6
+ --close closes the task (flow-close) on a PASSING run.
7
+ */
8
+
9
+ import { spawnSync } from 'node:child_process';
10
+ import { readFileSync } from 'node:fs';
11
+ import { flowFetch, resolveTaskId, positional, arg, die, sanitizeText } from './_client.mjs';
12
+
13
+ function resolveCommand() {
14
+ const c = arg('cmd');
15
+ if (c) return c;
16
+ try {
17
+ const cfg = JSON.parse(readFileSync('flow.config.json', 'utf8'));
18
+ if (typeof cfg.verify_command === 'string' && cfg.verify_command.trim()) return cfg.verify_command;
19
+ } catch { /* no local config — fall through to the default */ }
20
+ return 'npm test';
21
+ }
22
+
23
+ async function main() {
24
+ const rawId = positional(0);
25
+ if (!rawId) die('Usage: flow-verify <task_id> [--cmd="npm test"] [--close]');
26
+ const id = await resolveTaskId(rawId);
27
+ const command = resolveCommand();
28
+ const doClose = process.argv.slice(2).includes('--close');
29
+ const shortRef = '#' + rawId.replace(/^#/, '').slice(0, 6);
30
+
31
+ process.stdout.write(`Running: ${command}\n`);
32
+ // spawnSync is blocking, so output is buffered then printed; the snippet below is what we record.
33
+ const r = spawnSync(command, { shell: true, stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf8' });
34
+ const out = (r.stdout || '') + (r.stderr || '');
35
+ if (out) process.stdout.write(out.endsWith('\n') ? out : out + '\n');
36
+ const passed = r.status === 0;
37
+
38
+ // record the trailing ~20 non-empty lines as the audit snippet
39
+ const snippet = out.split('\n').filter(l => l.trim()).slice(-20).join('\n').slice(0, 4000);
40
+ await flowFetch('/api/flow/verify', { method: 'POST', body: { task_id: id, passed, command, summary: snippet } });
41
+ process.stdout.write(`${passed ? '✓ PASS' : '✗ FAIL'} — recorded on ${shortRef}\n`);
42
+
43
+ if (passed && doClose) {
44
+ await flowFetch('/api/flow/close', { method: 'POST', body: { task_id: id, summary: `Verified: ${sanitizeText(command, 100)}` } });
45
+ process.stdout.write(`Closed ${shortRef}.\n`);
46
+ }
47
+ process.exitCode = r.status ?? 1;
48
+ }
49
+
50
+ main().catch(e => die(e.message || e));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowcollab",
3
- "version": "0.3.21",
3
+ "version": "0.3.22",
4
4
  "description": "Multi-Claude coordination layer — shared task board + CLI for teams running Claude Code",
5
5
  "type": "module",
6
6
  "files": [
@@ -30,6 +30,7 @@
30
30
  "flow-project": "bin/project.mjs",
31
31
  "flow-close-sprint": "bin/close-sprint.mjs",
32
32
  "flow-review": "bin/review.mjs",
33
+ "flow-verify": "bin/verify.mjs",
33
34
  "flow-login": "bin/login.mjs",
34
35
  "flow-edit": "bin/edit.mjs",
35
36
  "flow-unblock": "bin/unblock.mjs",