@nearform/fling 0.7.0 → 0.9.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 (3) hide show
  1. package/README.md +99 -6
  2. package/dist/cli.js +5338 -2130
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -38,13 +38,64 @@ This does everything a new machine needs:
38
38
  sign-in providers, its login page, to choose one) and an API key is
39
39
  stored in `~/.fling/config.json` (mode 0600). This is skipped if you're already signed in.
40
40
  The server becomes your current one; logins to other Flings are kept.
41
+ When you are already signed in, it reads the server's `/.well-known/fling` again, so the CLI
42
+ knows the release it runs now.
41
43
  2. **Adds Fling to Claude Code.** If `claude` is on your PATH, setup installs the Fling plugin
42
- (skill + MCP server) from the `nearform/fling` marketplace, or updates it if it's already
43
- installed. `--scope project|local` installs it for this project only (default `user`).
44
+ (skill + MCP server) from the `nearform/fling` marketplace. `--scope project|local` installs it
45
+ for this project only (default `user`). When the plugin is already installed, setup refreshes
46
+ it instead (`claude plugin marketplace update fling`, then `claude plugin update fling@fling`)
47
+ and says which version it went from and to; restart Claude Code (or run `/reload-plugins`)
48
+ after an update. A refresh that fails is reported and leaves the installed plugin as it was;
49
+ it doesn't fail setup.
44
50
  3. **Adds Fling to Claude Desktop.** If Claude Desktop is installed (macOS, Windows), setup
45
- downloads `fling.mcpb` and opens it, and Claude Desktop asks you to confirm.
51
+ downloads the `fling.mcpb` of the CLI's own version and opens it, and Claude Desktop asks you
52
+ to confirm. That is the server's copy when the server runs the same release, otherwise the one
53
+ attached to the CLI's GitHub Release (the server's copy if that download fails). Running setup
54
+ again updates an older extension in place.
46
55
 
47
- On a terminal it asks before steps 2 and 3. With `--yes` it does them without asking.
56
+ On a terminal it asks before installing the plugin and before step 3. With `--yes` it does them
57
+ without asking. Refreshing an installed plugin needs no question.
58
+
59
+ ### Staying up to date
60
+
61
+ Every Fling publishes the release it runs (`release` in `/.well-known/fling`). After a command, when
62
+ the server it used runs a newer release than the CLI, the CLI prints one line on stderr:
63
+
64
+ ```
65
+ ▲ Fling 0.9.0 is out (this CLI is 0.8.0). Update: npm i -g @nearform/fling@latest && fling setup
66
+ ```
67
+
68
+ It compares with the metadata the CLI already holds, so it never makes a request of its own. The
69
+ stored release stays current because every server response says which release the server runs (the
70
+ `Fling-Release` header): when it differs from the stored one, the CLI stores the new release. That
71
+ needs both the server and the CLI on a release after 0.8.0; with an older server, the stored release
72
+ changes only at sign-in, when `fling setup` reads the metadata again, and when a command needs a
73
+ feature the stored copy lacks. It says it at most once a day per server, remembering when in
74
+ `update-check.json` in the config directory. It says nothing under `--json`, when stderr isn't a
75
+ terminal, when `CI` is set, or when `FLING_NO_UPDATE_CHECK` is set (to anything). A server older
76
+ than the CLI says nothing either. The MCP server tells Claude instead (see [Claude Code plugin and
77
+ MCP](#claude-code-plugin-and-mcp)).
78
+
79
+ ### When something doesn't work
80
+
81
+ `fling doctor` checks the setup and prints one line per check, `✔` ok, `▲` warning or `✖` problem,
82
+ each warning and problem with its fix:
83
+
84
+ - **CLI:** its version, Node.js against the versions it supports, the latest version on npm
85
+ (skipped when npm can't be reached), and whether `fling` on your PATH is this CLI.
86
+ - **Config:** where it lives (`FLING_CONFIG_DIR`), whether the config file is private (mode 0600:
87
+ it holds your API keys), and whether `FLING_URL` or `FLING_API_KEY` is in effect (named, never
88
+ shown).
89
+ - **Each Fling** you signed in to, the current one marked: whether its `/.well-known/fling`
90
+ answers, the release it runs against the CLI's, whether your API key is still accepted, and the
91
+ features it reports.
92
+ - **Claude Code:** `claude` on your PATH, the Fling plugin (installed, enabled, its version against
93
+ the CLI's) and the `fling` marketplace.
94
+ - **Claude Desktop:** whether the extension is installed, enabled, and its version.
95
+
96
+ It only reads: it changes nothing, and each request has a short timeout. `--json` prints
97
+ `{ ok, checks: [{ area, id, status, message, fix?, server? }] }`. The exit code is 1 when any check
98
+ is a problem.
48
99
 
49
100
  To sign in only, use `fling login <url>` (the URL is remembered: later `fling login` needs none).
50
101
  There is no default server: until you log in, commands say to run `fling login <url>`.
@@ -327,6 +378,38 @@ feedback (`reviewUrl` in `--json`); reviewers sign in to use it.
327
378
  | `fling resolve <name> <id> [--reopen]` | resolve a thread, or reopen it |
328
379
  | `fling uncomment <name> <id> [--yes]` | delete a comment (a thread with its replies): your own, or any on your site |
329
380
 
381
+ ## Forms
382
+
383
+ A form collects structured feedback on a site's review page: a label per page, rubric scores, an
384
+ A/B preference, a flagged passage's severity. It is a JSON Schema the review page renders, and
385
+ reviewers' answers (responses) come back as data you can export, instead of codes typed into
386
+ comments. On a Fling with forms (the `forms` capability, on with comments), put a
387
+ `fling.forms.json` at the top of the folder you deploy:
388
+
389
+ ```sh
390
+ fling forms init ./dist --template labels --title Labels # a starter: labels, rubric, compare, issue or survey
391
+ fling forms check ./dist # as a deploy will: errors, and the pages each form applies to
392
+ fling deploy ./dist # sends it as the site's forms (never served as a file)
393
+ fling responses my-app # who answered which page, and how far each form has got
394
+ fling responses my-app --format csv -o labels.csv # the export: json, jsonl or csv
395
+ ```
396
+
397
+ - `fling deploy` checks the file against the folder's pages and stops on errors. After the deploy
398
+ it lists each form and the pages it applies to (`forms` in `--json`). Without the file, it ends
399
+ with one line on adding a form (`formsHint` in `--json`; `--quiet` leaves it out).
400
+ - Without the file, deploying a whole site removes its forms. A `--path` deploy keeps them, and so
401
+ does a pulled folder, unless it was pulled with a `fling.forms.json` you have since deleted.
402
+ - `fling pull` writes the site's `fling.forms.json` back into the folder.
403
+ - On a form with `"visibility": "own"`, reviewers see only their own answers; the site's owners see
404
+ everyone's.
405
+
406
+ | Command | |
407
+ |---|---|
408
+ | `fling forms <name> [--path <page>]` | the live forms: a line per form, then the config as JSON (`> fling.forms.json` saves it) |
409
+ | `fling forms init [dir] [--template <name>] [--title <title>] [--force]` | write a starter `fling.forms.json` |
410
+ | `fling forms check [path]` | check a folder's `fling.forms.json` (or a file) against the folder's pages |
411
+ | `fling responses <name> [--form <id>] [--path <page>] [--format json\|jsonl\|csv] [-o file]` | the responses as a table with progress, or the export |
412
+
330
413
  ## Notifications
331
414
 
332
415
  A Fling with email tells you when a site is shared with you (directly or through a group), when
@@ -350,7 +433,8 @@ another server (a remembered one brings its key; see [Several Flings](#several-f
350
433
  Environment: `FLING_API_KEY`, `FLING_URL`, `FLING_CONFIG_DIR`, `FLING_DEBUG`, `FLING_DOWNLOADS_DIR`
351
434
  (where the MCP server looks for files given by name first), `FLING_ADD_SERVER` (a Fling the MCP
352
435
  server adds to the remembered ones when it starts), `FLING_NO_WAIT=1` (after a deploy or a new share
353
- link, don't wait the few seconds it takes to reach every edge).
436
+ link, don't wait the few seconds it takes to reach every edge), `FLING_NO_UPDATE_CHECK` (never say
437
+ that a newer Fling release is out; see [Staying up to date](#staying-up-to-date)).
354
438
 
355
439
  ## Claude Code plugin and MCP
356
440
 
@@ -407,9 +491,13 @@ The MCP tools:
407
491
  Fling, including a new one, which becomes current only if none is.
408
492
  - `fling_servers`: lists the Flings on this computer (address, name, who is signed in, which is
409
493
  current), read when called. `{use: <server>}` makes one current, the same as `fling use`.
494
+ - `fling_doctor`: the checks of `fling doctor`, read-only, as lines and data. Claude calls it when
495
+ something about Fling doesn't work (sign-in, tools missing, versions) and tells you the fixes.
410
496
  - `fling_check_name`, `fling_list`, `fling_info`, `fling_files`, `fling_share`,
411
497
  `fling_set_visibility`, `fling_archive`, `fling_rollback`, `fling_delete` (needs
412
- `confirm: true`), `fling_whoami`, the comment tools when a Fling has comments, and
498
+ `confirm: true`), `fling_whoami`, the comment tools when a Fling has comments, the forms tools when it has forms
499
+ (`fling_forms`, `fling_forms_template`, `fling_forms_check`, `fling_responses_list`, and
500
+ `fling_response_submit`, which answers a form as you, only when you ask), and
413
501
  `fling_set_audience` (`add`, `remove`, `set` or `clear` the people who can open a private site,
414
502
  and `addGroups`, `removeGroups`, `setGroups` for groups) when it can limit sites to listed
415
503
  people, `fling_set_owners` and `fling_set_publishers` (the same changes, to a site's owners or
@@ -420,6 +508,11 @@ The MCP tools:
420
508
 
421
509
  Results that give URLs (deploys, publishes, comments) end with the Fling they went to.
422
510
 
511
+ **Updates.** When a Fling the MCP server knows runs a newer release than it, its instructions say
512
+ so, and so does the first `fling_publish` or `fling_deploy` result of the session on that Fling.
513
+ Claude then suggests the update command (`npm i -g @nearform/fling@latest && fling setup`, then
514
+ restart Claude): inside Claude you never see the CLI's own update line.
515
+
423
516
  The MCP server never prompts:
424
517
 
425
518
  - **Names.** Without a `name`, `fling_deploy` uses the generated name and fails with suggestions if