pico-ai 0.0.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.
- package/LICENSE +21 -0
- package/README.md +99 -0
- package/bin/pico.js +33 -0
- package/package.json +72 -0
- package/scripts/npm-postinstall.mjs +122 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Umesh
|
|
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
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Pico
|
|
2
|
+
|
|
3
|
+
A fast and tiny AI coding agent.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
### npm (global)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g pico-agent
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### curl (macOS/Linux)
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
curl -fsSL https://raw.githubusercontent.com/imumesh18/pico/main/scripts/install.sh | sh
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Install a specific release tag:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
curl -fsSL https://raw.githubusercontent.com/imumesh18/pico/main/scripts/install.sh | sh -s -- -v v0.0.1
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### direct binary download
|
|
26
|
+
|
|
27
|
+
Download from [GitHub Releases](https://github.com/imumesh18/pico/releases):
|
|
28
|
+
|
|
29
|
+
- `pico-darwin-arm64`
|
|
30
|
+
- `pico-darwin-x64`
|
|
31
|
+
- `pico-linux-arm64`
|
|
32
|
+
- `pico-linux-x64`
|
|
33
|
+
- `pico-windows-x64.exe`
|
|
34
|
+
|
|
35
|
+
Verify with the matching `.sha256` file, then:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
chmod +x ./pico-linux-x64
|
|
39
|
+
./pico-linux-x64 --help
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Development
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
bun run setup
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Run in watch mode:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
bun run dev
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Quality and build:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
bun run ci
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Publishing
|
|
61
|
+
|
|
62
|
+
The package name stays `pico` in this repo, but publishes to npm as `pico-agent` to avoid conflicts.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
bun run publish:npm
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
One-command publish (runs full CI first):
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
bun run ship
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Override the publish name if needed:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
PICO_PUBLISH_NAME=your-name bun run publish:npm
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Release flow
|
|
81
|
+
|
|
82
|
+
Best flow (manual-only via GitHub Actions):
|
|
83
|
+
|
|
84
|
+
1. Merge changes to `main` using conventional commits.
|
|
85
|
+
2. Trigger the Release workflow manually from GitHub Actions. It computes the next version, updates `package.json` and `CHANGELOG.md`, tags the release, builds binaries, publishes the GitHub release, and publishes to npm.
|
|
86
|
+
|
|
87
|
+
Local dry-run (optional):
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
bun run release
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Required GitHub repository secret:
|
|
94
|
+
|
|
95
|
+
- `NPM_TOKEN` (npm publish token)
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
MIT
|
package/bin/pico.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
|
+
import { existsSync } from "node:fs";
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
|
|
8
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
const root = dirname(here);
|
|
10
|
+
const platform = `${process.platform}-${process.arch}`;
|
|
11
|
+
const binaryName = process.platform === "win32" ? "pico.exe" : "pico";
|
|
12
|
+
const binaryPath = join(root, "vendor", platform, binaryName);
|
|
13
|
+
|
|
14
|
+
if (!existsSync(binaryPath)) {
|
|
15
|
+
console.error(`[pico] No prebuilt binary found for ${platform}.`);
|
|
16
|
+
console.error(
|
|
17
|
+
"[pico] Reinstall with network access or use the curl installer: https://github.com/imumesh18/pico#install",
|
|
18
|
+
);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
23
|
+
stdio: "inherit",
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
child.on("error", (error) => {
|
|
27
|
+
console.error(`[pico] Failed to start binary: ${String(error)}`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
child.on("exit", (code) => {
|
|
32
|
+
process.exit(code ?? 1);
|
|
33
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pico-ai",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Pico: A fast and tiny AI coding agent.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agent",
|
|
7
|
+
"ai",
|
|
8
|
+
"bun",
|
|
9
|
+
"cli",
|
|
10
|
+
"opentui"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/imumesh18/pico#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/imumesh18/pico/issues"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/imumesh18/pico.git"
|
|
20
|
+
},
|
|
21
|
+
"bin": {
|
|
22
|
+
"pico": "./bin/pico.js"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"bin/pico.js",
|
|
26
|
+
"scripts/npm-postinstall.mjs",
|
|
27
|
+
"README.md",
|
|
28
|
+
"LICENSE"
|
|
29
|
+
],
|
|
30
|
+
"type": "module",
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public",
|
|
33
|
+
"registry": "https://registry.npmjs.org"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"setup": "bun install",
|
|
37
|
+
"dev": "bun --watch src/cli.ts",
|
|
38
|
+
"build": "rm -rf dist && bun build ./src/cli.ts --target bun --format esm --outdir ./dist --packages external --sourcemap && chmod +x ./dist/cli.js",
|
|
39
|
+
"typecheck": "bunx tsc --noEmit",
|
|
40
|
+
"lint": "bunx oxlint --deny-warnings --import-plugin src",
|
|
41
|
+
"lint:fix": "bunx oxlint --import-plugin --fix src",
|
|
42
|
+
"format": "bunx oxfmt --write .",
|
|
43
|
+
"format:check": "bunx oxfmt --check .",
|
|
44
|
+
"quality": "bun run format:check && bun run lint",
|
|
45
|
+
"quality:fix": "bun run format && bun run lint:fix",
|
|
46
|
+
"test": "bun test --pass-with-no-tests",
|
|
47
|
+
"check": "bun run quality && bun run typecheck && bun run test",
|
|
48
|
+
"ci": "bun run check && bun run build",
|
|
49
|
+
"release": "node ./scripts/prepare-release.mjs",
|
|
50
|
+
"ship": "bun run ci && bun run publish:npm",
|
|
51
|
+
"changelog": "bunx git-cliff --config cliff.toml --unreleased",
|
|
52
|
+
"postinstall": "node ./scripts/npm-postinstall.mjs || bun ./scripts/npm-postinstall.mjs",
|
|
53
|
+
"prepublishOnly": "bun run ci",
|
|
54
|
+
"publish:npm": "node ./scripts/npm-publish.mjs"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@opentui/core": "^0.1.77",
|
|
58
|
+
"effect": "^3.19.16"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@types/bun": "^1.3.8",
|
|
62
|
+
"git-cliff": "^2.12.0",
|
|
63
|
+
"oxfmt": "^0.28.0",
|
|
64
|
+
"oxlint": "^1.43.0",
|
|
65
|
+
"typescript": "^5.9.3"
|
|
66
|
+
},
|
|
67
|
+
"engines": {
|
|
68
|
+
"bun": ">=1.3.8",
|
|
69
|
+
"node": ">=18"
|
|
70
|
+
},
|
|
71
|
+
"packageManager": "bun@1.3.8"
|
|
72
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { chmodSync, createWriteStream, existsSync, mkdirSync, renameSync, rmSync } from "node:fs";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { get } from "node:https";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
const platformMap = {
|
|
8
|
+
"darwin-arm64": "pico-darwin-arm64",
|
|
9
|
+
"darwin-x64": "pico-darwin-x64",
|
|
10
|
+
"linux-arm64": "pico-linux-arm64",
|
|
11
|
+
"linux-x64": "pico-linux-x64",
|
|
12
|
+
"win32-x64": "pico-windows-x64.exe",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const log = (message) => {
|
|
16
|
+
process.stdout.write(`[pico] ${message}\n`);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const warn = (message) => {
|
|
20
|
+
process.stderr.write(`[pico] ${message}\n`);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const download = (url, destination) =>
|
|
24
|
+
new Promise((resolve, reject) => {
|
|
25
|
+
const file = createWriteStream(destination);
|
|
26
|
+
const request = get(
|
|
27
|
+
url,
|
|
28
|
+
{
|
|
29
|
+
headers: {
|
|
30
|
+
"user-agent": "pico-npm-installer",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
(response) => {
|
|
34
|
+
if (
|
|
35
|
+
response.statusCode &&
|
|
36
|
+
response.statusCode >= 300 &&
|
|
37
|
+
response.statusCode < 400 &&
|
|
38
|
+
response.headers.location
|
|
39
|
+
) {
|
|
40
|
+
file.close();
|
|
41
|
+
rmSync(destination, { force: true });
|
|
42
|
+
resolve(download(response.headers.location, destination));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (response.statusCode !== 200) {
|
|
47
|
+
reject(new Error(`Download failed with status ${response.statusCode ?? "unknown"}`));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
response.pipe(file);
|
|
52
|
+
file.on("finish", () => {
|
|
53
|
+
file.close();
|
|
54
|
+
resolve(undefined);
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
request.on("error", (error) => {
|
|
60
|
+
file.close();
|
|
61
|
+
rmSync(destination, { force: true });
|
|
62
|
+
reject(error);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const run = async () => {
|
|
67
|
+
if (process.env.PICO_SKIP_BINARY_DOWNLOAD === "1") {
|
|
68
|
+
log("Skipping binary download because PICO_SKIP_BINARY_DOWNLOAD=1.");
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const key = `${process.platform}-${process.arch}`;
|
|
73
|
+
const assetName = platformMap[key];
|
|
74
|
+
|
|
75
|
+
if (!assetName) {
|
|
76
|
+
warn(`No prebuilt binary is published for ${key}.`);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const scriptsDir = dirname(fileURLToPath(import.meta.url));
|
|
81
|
+
const root = dirname(scriptsDir);
|
|
82
|
+
|
|
83
|
+
if (existsSync(join(root, ".git"))) {
|
|
84
|
+
log("Skipping binary download in a git checkout.");
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const packageJsonPath = join(root, "package.json");
|
|
89
|
+
const packageJson = JSON.parse(await readFile(packageJsonPath, "utf8"));
|
|
90
|
+
const version = packageJson.version;
|
|
91
|
+
const tag = `v${version}`;
|
|
92
|
+
const platformDir = join(root, "vendor", key);
|
|
93
|
+
const binaryName = process.platform === "win32" ? "pico.exe" : "pico";
|
|
94
|
+
const binaryPath = join(platformDir, binaryName);
|
|
95
|
+
|
|
96
|
+
if (existsSync(binaryPath)) {
|
|
97
|
+
log(`Binary already present at ${binaryPath}.`);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
mkdirSync(platformDir, { recursive: true });
|
|
102
|
+
const tempPath = `${binaryPath}.tmp`;
|
|
103
|
+
const url = `https://github.com/imumesh18/pico/releases/download/${tag}/${assetName}`;
|
|
104
|
+
|
|
105
|
+
try {
|
|
106
|
+
log(`Downloading ${assetName} for ${key}...`);
|
|
107
|
+
await download(url, tempPath);
|
|
108
|
+
renameSync(tempPath, binaryPath);
|
|
109
|
+
if (process.platform !== "win32") {
|
|
110
|
+
chmodSync(binaryPath, 0o755);
|
|
111
|
+
}
|
|
112
|
+
log(`Installed binary at ${binaryPath}.`);
|
|
113
|
+
} catch (error) {
|
|
114
|
+
rmSync(tempPath, { force: true });
|
|
115
|
+
warn(
|
|
116
|
+
`Could not download ${assetName} from ${url}. Install from source with Bun, or use the curl installer from https://github.com/imumesh18/pico#install.`,
|
|
117
|
+
);
|
|
118
|
+
warn(String(error));
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
await run();
|