@rfany/rf 0.12.0 → 0.13.1

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 +10 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rfany/rf",
3
- "version": "0.12.0",
3
+ "version": "0.13.1",
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
@@ -94,10 +94,10 @@ rf indexes [--json] each index of a source you index, all for admi
94
94
  its phase, crawl or follow, pages read, when last caught up, and its error and next try
95
95
  rf runs [PATH] [--since DATE] [--failed] [--running] [--long MIN] [--json]
96
96
  a line per run: start, path, run, outcome, time, cost, what started it, and any error;
97
- the outcome is done, interrupted by a person, cut by a restart, running, or failed, for
98
- credits, policy, time limit or other
97
+ the outcome is done, interrupted by a person, cut, by a restart or a change that broke its
98
+ lease, running, or failed, for credits, policy, time limit or other
99
99
  rf costs [PATH] [--since DATE] [--by workspace|series|person|day|outcome] [--json] totals, runs and cost per run; person
100
- is the runner; runs leave out those a restart cut, as the next run carries each on
100
+ is the runner; runs leave out those that were cut, as the next run carries each on
101
101
  rf activity [PATH] [--since DATE] [--json] per instance, what people and the agent said, what people uploaded and closed, and
102
102
  each run that failed
103
103
  rf wakes [PATH] [--json] each series' pending wakes and requests to start an instance, and when a wake of it last
@@ -114,6 +114,8 @@ Admins:
114
114
  rf people [--set FILE|-] [-n] [--force] everyone as lines of ROLE EMAIL, each with a comment; --set sets the roles of the people
115
115
  listed and adds new ones, removing no one
116
116
  rf user add EMAIL [admin] | role EMAIL admin|user [--force] | disable EMAIL | enable EMAIL | signout EMAIL | remove EMAIL
117
+ rf egress [add|remove HOST] the hosts runs may reach beyond package registries, GitHub and documentation sites, such as
118
+ api.example.com or *.example.org; admins add and remove them
117
119
  rf connection set NAME TYPE an outside system runs reach as their runner, by a login each person makes: graph,
118
120
  Microsoft 365, or databricks, Azure Databricks, as each person adds what their login
119
121
  offers; websites are rf site's
@@ -628,7 +630,7 @@ else if (cmd === 'comment' && args.length === 2) {
628
630
  outcome: r => r.failure ? `failed, ${r.failure}` : r.outcome,
629
631
  }[by];
630
632
  if (!key) throw new Error('--by: workspace, series, person, day or outcome');
631
- // A run a restart cut is carried on by the next, so it adds its cost, not a run.
633
+ // A run that was cut is carried on by the next, so it adds its cost, not a run.
632
634
  const sums = new Map (), rows = await runsIn(args[0]), counted = (r ) => r.outcome === 'cut' ? 0 : 1;
633
635
  for (const r of rows) sums.set(key(r), { runs: (sums.get(key(r))?.runs ?? 0) + counted(r), cost: (sums.get(key(r))?.cost ?? 0) + r.cost });
634
636
  const out = [...sums].map(([k, v]) => ({ [by]: k, runs: v.runs, cost: +v.cost.toFixed(4), per_run: v.runs ? +(v.cost / v.runs).toFixed(4) : null }))
@@ -658,6 +660,10 @@ else if (cmd === 'comment' && args.length === 2) {
658
660
  for (const e of b.entries) console.log(` ${when(e.at)} ${e.op === 'done' ? `run ${e.run} failed: ${e.error}`
659
661
  : `${e.by} ${e.op === 'comment' ? `says: ${e.text.split('\n')[0].slice(0, 200)}` : e.op === 'upload' ? `uploads ${e.file}` : `${e.op === 'close' ? 'closes' : 'abandons'} it`}`}`);
660
662
  }
663
+ } else if (cmd === 'egress' && (!args.length || (args.length === 2 && ['add', 'remove'].includes(args[0])))) {
664
+ let hosts = await (await api('/egress')).json();
665
+ if (args.length) hosts = await (await post('/egress', { hosts: args[0] === 'add' ? [...new Set([...hosts, args[1]])] : hosts.filter(h => h !== args[1]) }, 'PUT')).json();
666
+ console.log(hosts.join('\n'));
661
667
  } else if (cmd === 'people' && args.length <= 1) {
662
668
  // People as lines to edit and set: ROLE EMAIL for everyone, owner|member EMAIL-OR-GROUP for a workspace, each with a comment.
663
669
  const ws = args[0] === undefined ? undefined : await workspaceNamed(args[0]);