jorin 0.0.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 +130 -0
- package/bin/jorin.js +150 -0
- package/package.json +21 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Dave Hulbert
|
|
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,130 @@
|
|
|
1
|
+
# `jorin`
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
[**Jorin**](https://jorin.ai) is a small coding agent written in Go.
|
|
6
|
+
|
|
7
|
+
It calls tools, like `shell`, `read_file`, `write_file`, `apply_patch`,
|
|
8
|
+
`http_get` and communicates with an OpenAI-compatible API.
|
|
9
|
+
It is designed for use as a composable command-line tool for shell scripts
|
|
10
|
+
and also for interactive coding sessions.
|
|
11
|
+
|
|
12
|
+
Jorin isn't designed to be your day-to-day coding agent for big projects.
|
|
13
|
+
Instead, Jorin is designed to be ran in constrained environments like
|
|
14
|
+
containers and on mobile devices.
|
|
15
|
+
Jorin also serves as a research prototype for agent techniques such as
|
|
16
|
+
[Skills to Agents](https://dave.engineer/blog/2025/11/skills-to-agents/)
|
|
17
|
+
and [Agent Situations](https://github.com/dave1010/agent-situations).
|
|
18
|
+
|
|
19
|
+

|
|
20
|
+
|
|
21
|
+
## Documentation
|
|
22
|
+
|
|
23
|
+
- [Usage guide](docs/usage.md)
|
|
24
|
+
- [OpenAI APIs (Completions vs Responses)](docs/openai-apis.md)
|
|
25
|
+
- [Development and architecture](docs/development.md)
|
|
26
|
+
- [Security notes](docs/security.md)
|
|
27
|
+
- [Contributing](CONTRIBUTING.md)
|
|
28
|
+
- [Code of conduct](CODE_OF_CONDUCT.md)
|
|
29
|
+
- [Changelog](CHANGELOG.md)
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
One line install:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
curl -fsSL https://get.jorin.ai | bash
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Quick run with npx (no install needed):
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx jorin --help
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The npm package bundles prebuilt binaries for supported platforms and will
|
|
46
|
+
use them when available, falling back to downloading the matching GitHub
|
|
47
|
+
release asset if needed.
|
|
48
|
+
|
|
49
|
+
The installer will place `jorin` in `/usr/local/bin` when it can, otherwise it
|
|
50
|
+
uses `~/.local/bin` and updates your shell profile to add it to `$PATH`.
|
|
51
|
+
Set `JORIN_INSTALL_DIR` to override the install location.
|
|
52
|
+
|
|
53
|
+
### Manual install
|
|
54
|
+
|
|
55
|
+
Download the latest release for your platform from
|
|
56
|
+
[GitHub Releases](https://github.com/dave1010/jorin/releases).
|
|
57
|
+
|
|
58
|
+
Then add it to your $PATH.
|
|
59
|
+
|
|
60
|
+
## Configuration
|
|
61
|
+
|
|
62
|
+
Set your API key before running jorin:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
export OPENAI_API_KEY="your-api-key"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
To use a different OpenAI-compatible endpoint:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
export OPENAI_BASE_URL="https://api.openai.com"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Quick start
|
|
75
|
+
|
|
76
|
+
Show help:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
jorin --help
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Start the REPL (default when invoked with no args):
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
jorin
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Send a single prompt:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
jorin "Refactor function X to be smaller"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Pipe stdin into a prompt:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
cat document.md | jorin "Summarize the text"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Run a Jorin prompt file (shebang optional):
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
./review-code.jorin --target src/
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
To force a literal prompt instead of loading a file, use `--prompt`:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
jorin --prompt "./review-code.jorin --target src/"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Enable Ralph Wiggum loop mode (iterative, self-referential AI loops that
|
|
113
|
+
auto-repeat until DONE or max tries):
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
jorin --ralph --ralph-max-tries 6 "Build a hello world API"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Contributing
|
|
120
|
+
|
|
121
|
+
Please read [CONTRIBUTING.md](CONTRIBUTING.md) and follow the
|
|
122
|
+
[Code of Conduct](CODE_OF_CONDUCT.md).
|
|
123
|
+
|
|
124
|
+
## License
|
|
125
|
+
|
|
126
|
+
MIT
|
|
127
|
+
|
|
128
|
+
## Colophon
|
|
129
|
+
|
|
130
|
+
"Jorin" is pronounced **jorin**, not *JOR-in* or *jor-IN*. Say it quickly, but not so quickly that it feels rushed: **Jorin**. That's it! The name comes from looking at my keyboard and trying to find something without too many Google results.
|
package/bin/jorin.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const os = require("os");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const https = require("https");
|
|
8
|
+
const { spawn } = require("child_process");
|
|
9
|
+
|
|
10
|
+
const PACKAGE_JSON = path.join(__dirname, "..", "package.json");
|
|
11
|
+
const pkg = JSON.parse(fs.readFileSync(PACKAGE_JSON, "utf8"));
|
|
12
|
+
|
|
13
|
+
function resolveTarget() {
|
|
14
|
+
let platform = process.platform;
|
|
15
|
+
if (platform === "android") {
|
|
16
|
+
platform = "android";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
switch (platform) {
|
|
20
|
+
case "linux":
|
|
21
|
+
case "darwin":
|
|
22
|
+
case "freebsd":
|
|
23
|
+
case "windows":
|
|
24
|
+
case "android":
|
|
25
|
+
break;
|
|
26
|
+
case "win32":
|
|
27
|
+
platform = "windows";
|
|
28
|
+
break;
|
|
29
|
+
default:
|
|
30
|
+
throw new Error(`Unsupported platform: ${process.platform}`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let arch;
|
|
34
|
+
switch (process.arch) {
|
|
35
|
+
case "x64":
|
|
36
|
+
arch = "amd64";
|
|
37
|
+
break;
|
|
38
|
+
case "arm64":
|
|
39
|
+
arch = "arm64";
|
|
40
|
+
break;
|
|
41
|
+
case "arm":
|
|
42
|
+
arch = "arm";
|
|
43
|
+
break;
|
|
44
|
+
case "ia32":
|
|
45
|
+
arch = "386";
|
|
46
|
+
break;
|
|
47
|
+
default:
|
|
48
|
+
throw new Error(`Unsupported architecture: ${process.arch}`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (platform === "windows" && arch === "arm64") {
|
|
52
|
+
throw new Error("Windows ARM64 builds are not available yet.");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const ext = platform === "windows" ? ".exe" : "";
|
|
56
|
+
return { platform, arch, ext };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function resolveVersion() {
|
|
60
|
+
const override = process.env.JORIN_NPX_VERSION;
|
|
61
|
+
if (override) {
|
|
62
|
+
return { tag: override.startsWith("v") ? override : `v${override}`, mode: "tag" };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (pkg.version && pkg.version !== "0.0.0") {
|
|
66
|
+
return { tag: `v${pkg.version}`, mode: "tag" };
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return { tag: "latest", mode: "latest" };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function ensureDir(dir) {
|
|
73
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function downloadFile(url, destination) {
|
|
77
|
+
return new Promise((resolve, reject) => {
|
|
78
|
+
const request = https.get(url, (response) => {
|
|
79
|
+
if (response.statusCode >= 300 && response.statusCode < 400 && response.headers.location) {
|
|
80
|
+
response.resume();
|
|
81
|
+
return resolve(downloadFile(response.headers.location, destination));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (response.statusCode !== 200) {
|
|
85
|
+
response.resume();
|
|
86
|
+
return reject(new Error(`Download failed with status ${response.statusCode}`));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const file = fs.createWriteStream(destination, { mode: 0o755 });
|
|
90
|
+
response.pipe(file);
|
|
91
|
+
file.on("finish", () => file.close(resolve));
|
|
92
|
+
file.on("error", reject);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
request.on("error", reject);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async function main() {
|
|
100
|
+
const { platform, arch, ext } = resolveTarget();
|
|
101
|
+
const { tag, mode } = resolveVersion();
|
|
102
|
+
|
|
103
|
+
const baseDir = process.env.JORIN_NPX_DIR || path.join(os.homedir(), ".jorin", "bin");
|
|
104
|
+
ensureDir(baseDir);
|
|
105
|
+
|
|
106
|
+
const assetName = `jorin-${platform}-${arch}${ext}`;
|
|
107
|
+
const cacheName = `jorin-${platform}-${arch}-${tag}${ext}`.replace(/[/:]/g, "-");
|
|
108
|
+
const targetPath = path.join(baseDir, cacheName);
|
|
109
|
+
const bundledPath = path.join(__dirname, "..", "dist", assetName);
|
|
110
|
+
|
|
111
|
+
const shouldRedownload = process.env.JORIN_NPX_FORCE === "1" || !fs.existsSync(targetPath);
|
|
112
|
+
if (shouldRedownload) {
|
|
113
|
+
if (fs.existsSync(bundledPath)) {
|
|
114
|
+
fs.copyFileSync(bundledPath, targetPath);
|
|
115
|
+
} else {
|
|
116
|
+
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "jorin-npx-"));
|
|
117
|
+
const tmpPath = path.join(tmpDir, assetName);
|
|
118
|
+
|
|
119
|
+
const url =
|
|
120
|
+
mode === "latest"
|
|
121
|
+
? `https://github.com/dave1010/jorin/releases/latest/download/${assetName}`
|
|
122
|
+
: `https://github.com/dave1010/jorin/releases/download/${tag}/${assetName}`;
|
|
123
|
+
|
|
124
|
+
process.stderr.write(`Downloading ${assetName} (${mode === "latest" ? "latest" : tag})...\n`);
|
|
125
|
+
await downloadFile(url, tmpPath);
|
|
126
|
+
|
|
127
|
+
if (platform !== "windows") {
|
|
128
|
+
fs.chmodSync(tmpPath, 0o755);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
fs.renameSync(tmpPath, targetPath);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (platform !== "windows") {
|
|
136
|
+
fs.chmodSync(targetPath, 0o755);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const child = spawn(targetPath, process.argv.slice(2), { stdio: "inherit" });
|
|
140
|
+
child.on("exit", (code) => process.exit(code ?? 0));
|
|
141
|
+
child.on("error", (err) => {
|
|
142
|
+
process.stderr.write(`Failed to launch jorin: ${err.message}\n`);
|
|
143
|
+
process.exit(1);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
main().catch((err) => {
|
|
148
|
+
process.stderr.write(`${err.message}\n`);
|
|
149
|
+
process.exit(1);
|
|
150
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jorin",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Jorin is a small coding agent written in Go.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "github:dave1010/jorin",
|
|
7
|
+
"homepage": "https://github.com/dave1010/jorin",
|
|
8
|
+
"bugs": {
|
|
9
|
+
"url": "https://github.com/dave1010/jorin/issues"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"jorin": "bin/jorin.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"bin/",
|
|
16
|
+
"dist/"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=18"
|
|
20
|
+
}
|
|
21
|
+
}
|