@unaquatic/flow 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +66 -2
- package/bin/flow-darwin-arm64 +0 -0
- package/bin/flow-darwin-x64 +0 -0
- package/bin/flow-linux-arm64 +0 -0
- package/bin/flow-linux-x64 +0 -0
- package/bin/flow-win32-arm64.exe +0 -0
- package/bin/flow-win32-x64.exe +0 -0
- package/bin/flow.js +69 -0
- package/package.json +26 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Aquatic
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,67 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://github.com/unaquatic/flow">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/logo-dark.svg">
|
|
5
|
+
<img src="docs/logo-light.svg" alt="flow">
|
|
6
|
+
</picture>
|
|
7
|
+
</a>
|
|
8
|
+
</p>
|
|
2
9
|
|
|
3
|
-
|
|
10
|
+
<p align="center">
|
|
11
|
+
<a href="https://go.dev/"><img src="https://img.shields.io/badge/Go-1.27-555?labelColor=888&logo=go&logoColor=white&style=flat-square" alt="Go"></a>
|
|
12
|
+
<a href="https://github.com/unaquatic/flow/blob/main/LICENSE"><img src="https://img.shields.io/github/license/unaquatic/flow?labelColor=888&color=555&style=flat-square" alt="License"></a>
|
|
13
|
+
<a href="https://github.com/unaquatic/flow/stargazers"><img src="https://img.shields.io/github/stars/unaquatic/flow?labelColor=888&color=555&style=flat-square" alt="GitHub stars"></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p align="center"><b>A tiny and fast agent written in golang.</b></p>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
curl -fsSL https://aquatic.dev/flow/install | sh # macOS, Linux, Git Bash on Windows
|
|
25
|
+
npm install -g @unaquatic/flow
|
|
26
|
+
pnpm add -g @unaquatic/flow
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The install script downloads flow from its GitHub release, checked against
|
|
30
|
+
the digest GitHub reports for it, puts it in `~/.flow/bin`, links it from
|
|
31
|
+
`~/.local/bin`, and adds that to `PATH`. `FLOW_VERSION`, `FLOW_INSTALL_DIR` and
|
|
32
|
+
`FLOW_NO_MODIFY_PATH=1` change what it does.
|
|
33
|
+
|
|
34
|
+
On Windows, flow runs in Windows Terminal or any Windows 10+ console. Its bash
|
|
35
|
+
tool runs commands with Git Bash, so install
|
|
36
|
+
[Git for Windows](https://git-scm.com/download/win), or put another
|
|
37
|
+
`bash.exe` on `PATH`.
|
|
38
|
+
|
|
39
|
+
## Updating
|
|
40
|
+
|
|
41
|
+
When it starts, flow checks for a newer release where it was installed from:
|
|
42
|
+
GitHub for the install script, npm for npm and pnpm. It installs the release
|
|
43
|
+
in the background the same way, and runs it from the next start, which shows
|
|
44
|
+
`Updated to v1.2.3` under the status. Install output goes to
|
|
45
|
+
`~/.flow/logs/update.log`. Windows cannot replace a running flow, so there
|
|
46
|
+
flow updates only when you run `flow update`.
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
flow update # install the latest release now
|
|
50
|
+
flow update --check # only check for one
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Set `"auto_update": false` in `~/.flow/config.json`, or
|
|
54
|
+
`FLOW_DISABLE_AUTOUPDATE=1`, to turn off the background check and install.
|
|
55
|
+
|
|
56
|
+
## Development
|
|
57
|
+
|
|
58
|
+
Build and run from source with Go 1.27+.
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
go build ./cmd/flow/
|
|
62
|
+
./flow
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
Flow is released under the [MIT License](LICENSE).
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bin/flow.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Runs the flow binary for this platform.
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
const { spawn } = require("node:child_process");
|
|
6
|
+
const { existsSync, realpathSync } = require("node:fs");
|
|
7
|
+
const path = require("node:path");
|
|
8
|
+
|
|
9
|
+
const { name } = require("../package.json");
|
|
10
|
+
const root = realpathSync(path.join(__dirname, ".."));
|
|
11
|
+
|
|
12
|
+
// Errors read as the install script's, with "error:" in red on a terminal.
|
|
13
|
+
function fail(message) {
|
|
14
|
+
const color = process.stderr.isTTY && !process.env.NO_COLOR && process.env.TERM !== "dumb";
|
|
15
|
+
console.error(`${color ? "\x1b[31merror:\x1b[39m" : "error:"} flow: ${message}`);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// The package holds a binary for every platform, next to this file, with .exe
|
|
20
|
+
// on Windows.
|
|
21
|
+
const windows = process.platform === "win32";
|
|
22
|
+
const bin = path.join(__dirname, `flow-${process.platform}-${process.arch}${windows ? ".exe" : ""}`);
|
|
23
|
+
if (!existsSync(bin)) {
|
|
24
|
+
fail(`unsupported platform: ${process.platform}/${process.arch}`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Tells flow whether pnpm or npm installed it, so it updates with the same one.
|
|
28
|
+
// pnpm marks its node_modules with .modules.yaml.
|
|
29
|
+
function managedBy() {
|
|
30
|
+
for (let dir = root; dir !== path.dirname(dir); dir = path.dirname(dir)) {
|
|
31
|
+
const modules = path.join(dir, "node_modules");
|
|
32
|
+
try {
|
|
33
|
+
if (existsSync(path.join(modules, ".modules.yaml")) && realpathSync(path.join(modules, name)) === root) {
|
|
34
|
+
return "pnpm";
|
|
35
|
+
}
|
|
36
|
+
} catch {}
|
|
37
|
+
}
|
|
38
|
+
return "npm";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const child = spawn(bin, process.argv.slice(2), {
|
|
42
|
+
stdio: "inherit",
|
|
43
|
+
env: { ...process.env, FLOW_MANAGED_BY: managedBy() },
|
|
44
|
+
});
|
|
45
|
+
child.on("error", (err) => fail(`launch failed: ${err.message}`));
|
|
46
|
+
|
|
47
|
+
// Pass stop signals on to flow. On Windows the console sends Ctrl-C to flow
|
|
48
|
+
// as well, and child.kill would end flow at once, without its cleanup, so the
|
|
49
|
+
// launcher only stays alive until flow exits.
|
|
50
|
+
const signals = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
51
|
+
for (const signal of signals) {
|
|
52
|
+
process.on(signal, () => {
|
|
53
|
+
if (!windows) {
|
|
54
|
+
child.kill(signal);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Exit the way flow exited.
|
|
60
|
+
child.on("exit", (code, signal) => {
|
|
61
|
+
if (signal) {
|
|
62
|
+
for (const s of signals) {
|
|
63
|
+
process.removeAllListeners(s);
|
|
64
|
+
}
|
|
65
|
+
process.kill(process.pid, signal);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
process.exit(code ?? 1);
|
|
69
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unaquatic/flow",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A tiny and fast agent written in golang.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/unaquatic/flow.git"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"flow": "bin/flow.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin"
|
|
15
|
+
],
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=18"
|
|
18
|
+
},
|
|
19
|
+
"os": [
|
|
20
|
+
"darwin",
|
|
21
|
+
"linux",
|
|
22
|
+
"win32"
|
|
23
|
+
],
|
|
24
|
+
"cpu": [
|
|
25
|
+
"arm64",
|
|
26
|
+
"x64"
|
|
27
|
+
]
|
|
28
|
+
}
|