@rfany/rf 0.20.7 → 0.20.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/rf.mjs +9 -29
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rfany/rf",
3
- "version": "0.20.7",
3
+ "version": "0.20.8",
4
4
  "description": "rollforward's command line for people: what its page does, from a shell or a desktop agent, as you",
5
5
  "license": "MIT",
6
6
  "repository": { "type": "git", "url": "git+https://github.com/spoj/rollforward.git", "directory": "cli" },
package/rf.mjs CHANGED
@@ -201,7 +201,7 @@ What there is
201
201
  proposal missing information should be rejected with feedback, so the agent can revise and propose again. Generic comments
202
202
  are not proposal decisions. rf ls says how many asks wait in each instance. Reactions, thumbs up or down, are
203
203
  quiet signals kept for later. Only the series owner or the person a proposal names (--to) may approve or reject it; approval commits the instance's folder to its
204
- history, .git in it, as it is then, as closing does. Whose approval counts, and for what, is the series' call.
204
+ history, .git in it, as it is then, as closing does.
205
205
 
206
206
  What rf pull copies, the folders as the agent sees them
207
207
  AGENTS.md the company's conventions; <workspace>/AGENTS.md the workspace's
@@ -666,35 +666,12 @@ if (cmd === 'login' && url) {
666
666
  if (r.wakeCheck) console.log(` Wake check stopped: ${clip(r.wakeCheck.message.replace(/[\x00-\x1f\x7f-\x9f]/g, ' '), TEXT_COLS)}`);
667
667
  for (const k of r.wakes) console.log(` wake ${k.id} ${k.at}${k.label ? ` starts ${k.label}` : ''}${k.days ? `, then each ${k.days.join(', ')}` : ''}${k.text ? `: ${k.text}` : ''}${k.check ? `; check ${k.check}${k.deadline ? ` until ${k.deadline}` : ''}${k.maxStaleMin ? `, max-stale ${k.maxStaleMin}m` : ''}${k.backstopHours ? `, backstop ${k.backstopHours}h` : ''}` : ''}`);
668
668
  }
669
+ } else if (cmd === 'waiting' && flags['dismiss-settled'] && !args.length) {
670
+ const res = await (await post('/api/messages', { dismissAll: 'settled' })).json();
671
+ console.log(flags.json ? JSON.stringify(res, null, 1) : `dismissed ${res.dismissed} settled note notice${res.dismissed === 1 ? '' : 's'}`);
669
672
  } else if (cmd === 'waiting' && !args.length) {
670
- if (flags['dismiss-settled']) {
671
- const res = await (await post('/api/messages', { dismissAll: 'settled' })).json();
672
- console.log(flags.json ? JSON.stringify(res, null, 1) : `dismissed ${res.dismissed} settled note notice${res.dismissed === 1 ? '' : 's'}`);
673
- } else {
674
673
  const [me, s, all] = await Promise.all([get('/me'), get('/api/status'), get('/api')]), mine = (who ) => (who ?? me.email) === me.email;
675
674
  const series = all.flatMap(w => w.series.map(x => ({ ...x, path: `${w.name}/${x.name}` })));
676
- const refusedByHost = new Map ();
677
- for (const w of all) if (!w.archived) for (const x of w.series) if (!x.archived) for (const i of x.instances) for (const r of i.refused ?? []) for (const h of r.hosts ?? []) {
678
- const key = `${r.login}\0${r.site}\0${h}`, c = r.counts?.[h] ?? r.count ?? 1, hostAt = r.ats?.[h] ?? r.at ?? '', t = Date.parse(hostAt) || 0, rev = r.revs?.[h] ?? r.siteRev;
679
- const prev = refusedByHost.get(key);
680
- if (!prev) refusedByHost.set(key, { path: `${w.name}/${x.name}/${i.label}`, since: hostAt, t, run: r.run, site: r.site, ...(rev && { rev }), person: r.login, host: h, why: r.why?.[h] ?? '', count: c });
681
- else {
682
- prev.count += c;
683
- if (t > prev.t || (t === prev.t && (r.run ?? 0) >= prev.run)) Object.assign(prev, { path: `${w.name}/${x.name}/${i.label}`, since: hostAt, t, run: r.run, ...(rev && { rev }), why: r.why?.[h] || prev.why });
684
- }
685
- }
686
- const refusedRows = new Map ();
687
- for (const h of refusedByHost.values()) {
688
- const rowKey = `${h.person}\0${h.site}\0${h.path}\0${h.run}`;
689
- let row = refusedRows.get(rowKey);
690
- if (!row) refusedRows.set(rowKey, row = { path: h.path, since: h.since, t: h.t, run: h.run, site: h.site, person: h.person, hosts: [], why: {}, counts: {}, ats: {}, revs: {} });
691
- else if (h.t > row.t) { row.since = h.since; row.t = h.t; }
692
- row.hosts.push(h.host);
693
- if (h.why) row.why[h.host] = h.why;
694
- row.counts[h.host] = h.count;
695
- if (h.since) row.ats[h.host] = h.since;
696
- if (h.rev) row.revs[h.host] = h.rev;
697
- }
698
675
  const rows = [
699
676
  ...s.ownership.map(s => ({ kind: 'owner', path: s.path, text: s.text })),
700
677
  ...s.asks.filter(a => a.who === me.email && !a.legacyNotice).map(a => ({ kind: a.note ? 'note' : 'ask', path: a.path, since: a.since, text: a.text })),
@@ -702,7 +679,11 @@ if (cmd === 'login' && url) {
702
679
  ...series.flatMap(x => x.requests.filter(r => mine(r.who)).map(r => ({ kind: 'request', path: x.path, since: r.at, id: r.id, text: `${r.from} asks to ${r.target ? 'wake' : 'start'} ${r.label}${r.text ? `: ${r.text}` : ''}` }))),
703
680
  ...all.filter(w => w.manage && w.proposal?.into === w.id).map(({ proposal: p }) => ({ kind: 'proposal', path: p.to, since: p.at, text: `${p.by} proposes to ${p.kind === 'merge' ? `merge ${p.from} into it` : `move ${p.from}/${p.series} to it`}` })),
704
681
  ...s.expired.filter(e => e.who === me.email).map(e => ({ kind: 'expired', login: e.login, holding: e.holding, text: `your ${e.login} login expired` })),
705
- ...[...refusedRows.values()].map(r => ({ kind: 'refused', path: r.path, since: r.since, site: r.site, hosts: r.hosts, person: r.person, why: r.why, counts: r.counts, ats: r.ats, ...(Object.keys(r.revs).length && { revs: r.revs }), text: `run ${r.run}'s browser on ${r.person}'s ${r.site} was refused ${r.hosts.map(h => { const c = r.counts[h]; const meta = [c > 1 ? `${c}×` : '', r.why[h] ?? ''].filter(Boolean).join(', '); return meta ? `${h} (${meta})` : h; }).join(', ')}` })),
682
+ ...(s.refused ?? []).map(r => {
683
+ const meta = [r.count > 1 ? `${r.count}×` : '', r.why].filter(Boolean).join(', ');
684
+ return { kind: 'refused', path: r.path, since: r.at, site: r.site, host: r.host, person: r.login, why: r.why, count: r.count, ...(r.rev && { rev: r.rev }),
685
+ text: `run ${r.run}'s browser on ${r.login}'s ${r.site} was refused ${meta ? `${r.host} (${meta})` : r.host}` };
686
+ }),
706
687
  ...all.filter(w => !w.archived).flatMap(w => w.series.filter(x => !x.archived).flatMap(x => x.instances.filter(i => i.wrong && i.owner === me.email).map(i => ({ kind: 'correction', path: `${w.name}/${x.name}/${i.label}`, since: i.active, count: i.wrong, text: `${i.wrong} correction${i.wrong === 1 ? '' : 's'} say${i.wrong === 1 ? 's' : ''} it's wrong` })))),
707
688
  ...all.filter(w => w.manage).flatMap(w => w.grants.filter(g => g.state === 'pending').map(g => ({ kind: 'grant', path: w.name, since: g.at, id: g.id, text: grantText(g) }))),
708
689
  ];
@@ -710,7 +691,6 @@ if (cmd === 'login' && url) {
710
691
  else console.log(rows.map(r => r.kind === 'open' || r.kind === 'settled'
711
692
  ? `note ${r.kind} ${r.path}#${r.id} by ${r.by} at ${when(r.at)}: ${gist(r.text, 120)}`
712
693
  : `${r.kind} ${r.path ?? r.login}${r.since ? ` since ${when(r.since)}` : ''}${r.id ? `, ${r.kind === 'grant' ? 'grant' : 'request'} ${r.id}` : ''}: ${r.kind === 'grant' ? r.text : r.text.split('\n')[0].slice(0, 120)}`).join('\n') || 'Nothing waits on you.');
713
- }
714
694
  } else if (cmd === 'show' && args.length === 1) {
715
695
  const { inst, at } = await instanceAt(args[0]), { doc, log, run, queued, owner, waiting: w } = await get(at);
716
696
  const waiting = w.map(({ who, seq }) => {