@rfany/rf 0.13.1 → 0.14.0

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 +13 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rfany/rf",
3
- "version": "0.13.1",
3
+ "version": "0.14.0",
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
@@ -84,6 +84,9 @@ rf wake PATH AT [--label LABEL] [--days DAYS] | rf wake --cancel ID
84
84
  AT now, +<n>m|h|d or a date; PATH an open instance, or a series with LABEL; DAYS, such as
85
85
  mon-fri, repeats it weekly at AT's time; rf ls shows each wake's ID
86
86
  rf agents [WORKSPACE] [--set FILE|-] the company's AGENTS.md, or a workspace's; setting the company's is for admins
87
+ rf readers WORKSPACE [add|remove OTHER] the workspaces whose agents read WORKSPACE and those its own read, as each one's
88
+ owners let them; its owners let OTHER's agents read it, one they see, and its owners or
89
+ OTHER's take that off; OTHER's people see what its agents read
87
90
  rf skills
88
91
  rf skill pull ID [DIR] [--version N] the newest version, or N, into DIR, ./ID by default, new or empty, as push reads it
89
92
  rf skill versions ID
@@ -561,6 +564,16 @@ else if (cmd === 'comment' && args.length === 2) {
561
564
  await (ws ? post(`/api/workspaces/${ws.id}`, { agents: text }, 'PUT') : api('/agents', { method: 'PUT', body: text }));
562
565
  console.log('saved');
563
566
  }
567
+ } else if (cmd === 'readers' && args.length === 1) {
568
+ const ws = await workspaceNamed(args[0]);
569
+ if (flags.json) console.log(JSON.stringify({ readers: ws.readers, reads: ws.reads }, null, 1));
570
+ else console.log([...ws.readers.map(r => `${r.name} reads ${ws.name}`), ...ws.reads.map(r => `${ws.name} reads ${r.name}`)].join('\n') || `${ws.name} reads no other workspace, and none reads it`);
571
+ } else if (cmd === 'readers' && args.length === 3 && ['add', 'remove'].includes(args[1])) {
572
+ // A workspace you don't see, whose agents' reading of one of yours you take off, is found among what yours read.
573
+ const all = await get('/api'), [ws, other] = [args[0], args[2]].map(name => all.find(w => w.name === name) ?? all.flatMap(w => w.reads).find(r => r.name === name));
574
+ if (!ws || !other) throw new Error(`no workspace ${ws ? args[2] : args[0]}`);
575
+ await post(`/api/workspaces/${ws.id}/readers/${other.id}`, {}, args[1] === 'add' ? 'PUT' : 'DELETE');
576
+ console.log(args[1] === 'add' ? `${other.name}'s agents read ${ws.name} from their next run` : `${other.name}'s agents no longer read ${ws.name}`);
564
577
  } else if (cmd === 'skill' && args[0] === 'push' && args[1]) {
565
578
  const files = Object.fromEntries(readdirSync(args[1], { recursive: true, withFileTypes: true }).filter(d => d.isFile())
566
579
  .map(d => [relative(args[1], join(d.parentPath, d.name)).split(sep).join('/'), readFileSync(join(d.parentPath, d.name)).toString('base64')]));