@nearform/fling 0.1.2 → 0.3.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.
- package/CHANGELOG.md +32 -0
- package/LICENSE +1 -1
- package/README.md +81 -41
- package/dist/cli.js +1812 -829
- package/dist/cli.js.map +4 -4
- package/package.json +5 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 0.3.0
|
|
6
|
+
|
|
7
|
+
**Breaking: no default server.** The CLI works with any Fling deployment, so it no longer has one
|
|
8
|
+
built in.
|
|
9
|
+
|
|
10
|
+
- `fling login <url>` (or `fling setup <url>`) signs in to the Fling at that address. The CLI
|
|
11
|
+
reads the server's `/.well-known/fling` (its name, sites domain, sign-in method) and remembers
|
|
12
|
+
both in `~/.fling/config.json`; later commands, and `fling login` without a URL, use them.
|
|
13
|
+
`FLING_URL` and `--server` still override it.
|
|
14
|
+
- Upgrading from 0.2: if you logged in with 0.2, nothing changes; the server you logged in to is
|
|
15
|
+
kept, and its metadata is fetched the first time it is needed. A config without a server (a new
|
|
16
|
+
machine, or a key set by hand) fails with `No Fling server set — run fling login <url> …`
|
|
17
|
+
instead of assuming a server.
|
|
18
|
+
- Site URLs shown before a deploy come from the server's metadata instead of being guessed from
|
|
19
|
+
the server URL.
|
|
20
|
+
- The local MCP server (`fling mcp`, the Claude Desktop extension) names your Fling and its sites
|
|
21
|
+
domain in its tool descriptions. The extension's **Fling server** setting has no built-in
|
|
22
|
+
default; the copy a Fling serves at `/downloads/fling.mcpb` has its address filled in.
|
|
23
|
+
- Comments: `fling comments`, `fling comment` (and `--reply`), `fling resolve`, `fling uncomment`;
|
|
24
|
+
the local MCP server gains `fling_comments_list`, `fling_comment_add`, `fling_comment_resolve`
|
|
25
|
+
and `fling_comment_delete` on an instance with the `comments` capability.
|
|
26
|
+
- On an instance with comments, a deploy (`fling deploy`, and the MCP server's `fling_deploy` and
|
|
27
|
+
`fling_publish`) also gives the review page, the link to share for feedback: in the output box,
|
|
28
|
+
as `reviewUrl` in `--json` and in the MCP result, where it leads.
|
|
29
|
+
|
|
30
|
+
## 0.2.0
|
|
31
|
+
|
|
32
|
+
`fling setup`, a new look, and help by default.
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
# @nearform/fling
|
|
2
2
|
|
|
3
|
-
Fling a folder of static files at
|
|
4
|
-
get a stable link back:
|
|
3
|
+
Fling a folder of static files at your Fling server and get a stable link back:
|
|
5
4
|
|
|
6
5
|
```
|
|
7
|
-
https://<name
|
|
6
|
+
https://<name>.<your sites domain>
|
|
8
7
|
```
|
|
9
8
|
|
|
10
|
-
Site names are one global namespace, first come first served. Sites are private to
|
|
11
|
-
who has the
|
|
9
|
+
Site names are one global namespace per server, first come first served. Sites are private to
|
|
10
|
+
people signed in to that Fling by default. Share links make them viewable by anyone who has the
|
|
11
|
+
link.
|
|
12
|
+
|
|
13
|
+
> **Upgrading from 0.2?** The CLI no longer has a built-in server. If you were logged in with 0.2
|
|
14
|
+
> it carries on with the server you logged in to. Otherwise (or on a new machine) run
|
|
15
|
+
> `fling login <url>` once with your Fling's address. See [CHANGELOG.md](CHANGELOG.md).
|
|
12
16
|
|
|
13
17
|
## Install
|
|
14
18
|
|
|
@@ -20,31 +24,48 @@ npm install -g @nearform/fling # then: fling …
|
|
|
20
24
|
npx @nearform/fling …
|
|
21
25
|
```
|
|
22
26
|
|
|
23
|
-
##
|
|
27
|
+
## Set up
|
|
24
28
|
|
|
25
29
|
```sh
|
|
26
|
-
fling
|
|
30
|
+
fling setup https://fling.example.com # your Fling's address; later runs can leave it out
|
|
27
31
|
```
|
|
28
32
|
|
|
29
|
-
This
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
This does everything a new machine needs:
|
|
34
|
+
|
|
35
|
+
1. **Signs you in.** The CLI reads the server's `/.well-known/fling` (its name, where its sites
|
|
36
|
+
live, how people sign in) and remembers it. Your browser opens for sign-in and an API key is
|
|
37
|
+
stored in `~/.fling/config.json` (mode 0600). This is skipped if you're already signed in.
|
|
38
|
+
2. **Adds Fling to Claude Code.** If `claude` is on your PATH, setup installs the Fling plugin
|
|
39
|
+
(skill + MCP server) from the `nearform/fling` marketplace, or updates it if it's already
|
|
40
|
+
installed. `--scope project|local` installs it for this project only (default `user`).
|
|
41
|
+
3. **Adds Fling to Claude Desktop.** If Claude Desktop is installed (macOS, Windows), setup
|
|
42
|
+
downloads `fling.mcpb` and opens it, and Claude Desktop asks you to confirm.
|
|
43
|
+
|
|
44
|
+
On a terminal it asks before steps 2 and 3. With `--yes` it does them without asking.
|
|
45
|
+
|
|
46
|
+
To sign in only, use `fling login <url>` (the URL is remembered: later `fling login` needs none).
|
|
47
|
+
There is no default server: until you log in, commands say to run `fling login <url>`.
|
|
48
|
+
`fling whoami` shows who you are, and `fling logout` removes the key (and keeps the server). For CI,
|
|
49
|
+
set `FLING_URL` and `FLING_API_KEY` instead.
|
|
32
50
|
|
|
33
51
|
## Deploy
|
|
34
52
|
|
|
35
53
|
```sh
|
|
36
54
|
npm run build
|
|
37
|
-
fling ./dist # name generated from the project, e.g. rocketpod-docs; you confirm it
|
|
38
|
-
fling ./dist --name my-app # → https://my-app
|
|
39
|
-
fling ./dist --name my-app --spa # client-side routing: unknown paths serve index.html
|
|
40
|
-
fling ./dist --public # no sign-in needed to view
|
|
41
|
-
fling ./dist --yes # never prompt (CI): use the generated name as is
|
|
42
|
-
fling # deploys the current folder
|
|
43
|
-
fling "Pitch Deck.html" # a single page, served as index.html → pitch-deck
|
|
44
|
-
fling site.zip # a zip of a site: extracted, a single top folder unwrapped
|
|
45
|
-
fling diagram.svg # any other file, next to a generated page that shows it
|
|
55
|
+
fling deploy ./dist # name generated from the project, e.g. rocketpod-docs; you confirm it
|
|
56
|
+
fling deploy ./dist --name my-app # → https://my-app.<your sites domain>
|
|
57
|
+
fling deploy ./dist --name my-app --spa # client-side routing: unknown paths serve index.html
|
|
58
|
+
fling deploy ./dist --public # no sign-in needed to view
|
|
59
|
+
fling deploy ./dist --yes # never prompt (CI): use the generated name as is
|
|
60
|
+
fling deploy # deploys the current folder
|
|
61
|
+
fling deploy "Pitch Deck.html" # a single page, served as index.html → pitch-deck
|
|
62
|
+
fling deploy site.zip # a zip of a site: extracted, a single top folder unwrapped
|
|
63
|
+
fling deploy diagram.svg # any other file, next to a generated page that shows it
|
|
46
64
|
```
|
|
47
65
|
|
|
66
|
+
`fling <path>` is short for `fling deploy <path>` when the path exists, so `fling ./dist` works.
|
|
67
|
+
An existing path wins over a command of the same name. Bare `fling` prints help.
|
|
68
|
+
|
|
48
69
|
What you can fling:
|
|
49
70
|
|
|
50
71
|
- **A folder**, as is.
|
|
@@ -57,14 +78,8 @@ What you can fling:
|
|
|
57
78
|
A file's default site name comes from its name, without the extension or a browser's ` (1)`
|
|
58
79
|
duplicate suffix: `Pitch Deck (1).html` → `pitch-deck`. Folders use the naming rules below.
|
|
59
80
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
`~/Documents/Claude`, `~/Claude` and Claude Desktop's output folders, and says where it found it:
|
|
63
|
-
|
|
64
|
-
```
|
|
65
|
-
$ fling Pitch-Deck.html
|
|
66
|
-
fling Found in Downloads: /Users/me/Downloads/Pitch-Deck.html
|
|
67
|
-
```
|
|
81
|
+
The path must exist where you give it. The CLI doesn't look for files elsewhere (the MCP server
|
|
82
|
+
does; see below).
|
|
68
83
|
|
|
69
84
|
- Re-fling to update. Identical content is a no-op, and content you deployed before is restored
|
|
70
85
|
instantly without uploading.
|
|
@@ -118,7 +133,7 @@ Without `--name`, the name is generated from the folder, never from your user na
|
|
|
118
133
|
In a terminal, Fling checks the generated name and asks before deploying:
|
|
119
134
|
|
|
120
135
|
```
|
|
121
|
-
fling Site name: rocketpod-docs → https://rocketpod-docs.
|
|
136
|
+
fling Site name: rocketpod-docs → https://rocketpod-docs.sites.example.com/ (new)
|
|
122
137
|
Use "rocketpod-docs"? [Y/n or type another name]
|
|
123
138
|
```
|
|
124
139
|
|
|
@@ -154,11 +169,27 @@ and a taken name fails (exit 1) with suggestions rather than picking another nam
|
|
|
154
169
|
| `fling archive <name>` / `fling unarchive <name>` | take offline and keep the files, or bring back |
|
|
155
170
|
| `fling rm <name> [--yes]` | delete permanently |
|
|
156
171
|
|
|
157
|
-
|
|
158
|
-
|
|
172
|
+
## Comments
|
|
173
|
+
|
|
174
|
+
People review a site on its review page (`<your Fling>/review/<name>`, the **Review** button on the
|
|
175
|
+
sites page): the site beside its comments. Anyone signed in who can open the site can comment; the
|
|
176
|
+
CLI reads and writes the same threads. On a Fling with comments, `fling deploy` (and the MCP
|
|
177
|
+
server's `fling_deploy` / `fling_publish`) also prints the review page as the link to share for
|
|
178
|
+
feedback (`reviewUrl` in `--json`); reviewers sign in to use it.
|
|
179
|
+
|
|
180
|
+
| Command | |
|
|
181
|
+
|---|---|
|
|
182
|
+
| `fling comments <name> [--path <page>] [--all]` | open threads (with replies) by page; `--all` adds resolved ones |
|
|
183
|
+
| `fling comment <name> "text" [--path <page>]` | comment on a page (default `/`) |
|
|
184
|
+
| `fling comment <name> "text" --reply <id>` | reply to a thread |
|
|
185
|
+
| `fling resolve <name> <id> [--reopen]` | resolve a thread, or reopen it |
|
|
186
|
+
| `fling uncomment <name> <id> [--yes]` | delete a comment (a thread with its replies): your own, or any on your site |
|
|
187
|
+
|
|
188
|
+
Global options: `--json` prints machine-readable output, and `--server <url>` points one command at
|
|
189
|
+
another server. Exit codes are `0` ok, `1` error, `2` not logged in and `3` forbidden.
|
|
159
190
|
|
|
160
191
|
Environment: `FLING_API_KEY`, `FLING_URL`, `FLING_CONFIG_DIR`, `FLING_DEBUG`, `FLING_DOWNLOADS_DIR`
|
|
161
|
-
(where files given by name
|
|
192
|
+
(where the MCP server looks for files given by name first), `FLING_NO_WAIT=1` (after a deploy or a new share
|
|
162
193
|
link, don't wait the few seconds it takes to reach every edge).
|
|
163
194
|
|
|
164
195
|
## Claude Code plugin and MCP
|
|
@@ -166,12 +197,20 @@ link, don't wait the few seconds it takes to reach every edge).
|
|
|
166
197
|
The Fling plugin gives Claude a `fling` skill plus an MCP server (`fling mcp`), so you can say
|
|
167
198
|
"fling the dist folder and give me a share link":
|
|
168
199
|
|
|
200
|
+
```sh
|
|
201
|
+
fling setup
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Or install it by hand in Claude Code:
|
|
205
|
+
|
|
169
206
|
```
|
|
170
207
|
/plugin marketplace add nearform/fling
|
|
171
208
|
/plugin install fling@fling
|
|
172
209
|
```
|
|
173
210
|
|
|
174
|
-
Log in once with `fling login
|
|
211
|
+
Log in once with `fling login <url>` (or `npx @nearform/fling login <url>` if it is not installed).
|
|
212
|
+
The MCP server reuses that login, and its tool descriptions name your Fling and where its sites
|
|
213
|
+
live.
|
|
175
214
|
|
|
176
215
|
The MCP tools:
|
|
177
216
|
|
|
@@ -201,20 +240,21 @@ For Claude Desktop (including Cowork), install the one-click extension. It runs
|
|
|
201
240
|
on your computer, so Claude can fling files you downloaded or that Claude Desktop saved, by name,
|
|
202
241
|
without uploading anything from Claude's sandbox.
|
|
203
242
|
|
|
204
|
-
1. Download
|
|
243
|
+
1. Download `fling.mcpb` from your Fling (Get started → Download, or `https://<your Fling>/downloads/fling.mcpb`).
|
|
205
244
|
2. Double-click it, or drag it into Claude Desktop, or go to **Settings → Extensions → Advanced
|
|
206
245
|
settings → Install Extension…** and pick the file.
|
|
207
|
-
3. Optional settings: **Fling server** (
|
|
208
|
-
folder** (default `~/Downloads`).
|
|
246
|
+
3. Optional settings: **Fling server** (filled in with the Fling you downloaded it from; empty means
|
|
247
|
+
the one the CLI is logged in to) and **Downloads folder** (default `~/Downloads`).
|
|
209
248
|
4. Ask Claude to "fling Pitch Deck.html from my Downloads". If you're not signed in, Claude calls
|
|
210
249
|
`fling_login` and your browser opens. The extension and the CLI share the login in
|
|
211
250
|
`~/.fling/config.json`.
|
|
212
251
|
|
|
213
252
|
It needs Node.js 20 or later, which Claude Desktop provides, on macOS or Windows.
|
|
214
253
|
|
|
215
|
-
Build it with `pnpm --filter
|
|
216
|
-
dependency into one file, then validates and packs `mcpb/manifest.json` into `dist/fling.mcpb
|
|
217
|
-
|
|
254
|
+
Build it with `pnpm --filter ./apps/cli build:mcpb`. That bundles `src/mcp-entry.ts` and every
|
|
255
|
+
dependency into one file, then validates and packs `mcpb/manifest.json` into `dist/fling.mcpb`
|
|
256
|
+
(`FLING_MCPB_SERVER_URL` sets the **Fling server** default). A deploy publishes it at
|
|
257
|
+
`/downloads/fling.mcpb`.
|
|
218
258
|
|
|
219
259
|
To use the MCP server in another client, run it over stdio:
|
|
220
260
|
|
|
@@ -227,7 +267,7 @@ To use the MCP server in another client, run it over stdio:
|
|
|
227
267
|
From the repo root:
|
|
228
268
|
|
|
229
269
|
```sh
|
|
230
|
-
pnpm cli
|
|
231
|
-
pnpm --filter
|
|
232
|
-
pnpm --filter
|
|
270
|
+
pnpm cli login http://localhost:47101 # against `pnpm dev`
|
|
271
|
+
pnpm --filter ./apps/cli test
|
|
272
|
+
pnpm --filter ./apps/cli build # → dist/cli.js
|
|
233
273
|
```
|