@krmxd/onegpt 0.0.0-beta
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/README.md +41 -0
- package/bin/ogpt.js +63 -0
- package/package.json +35 -0
- package/src/agent.js +763 -0
- package/src/catalog.js +108 -0
- package/src/cli.js +1111 -0
- package/src/config.js +157 -0
- package/src/glob.js +58 -0
- package/src/index.js +11 -0
- package/src/ollama.js +427 -0
- package/src/platform.js +37 -0
- package/src/preview.js +71 -0
- package/src/static.js +2 -0
- package/src/tools.js +1119 -0
- package/src/web.js +270 -0
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# OGPT (onegpt)
|
|
2
|
+
|
|
3
|
+
AI coding assistant for your terminal with a built-in local engine.
|
|
4
|
+
The Node.js build of [OGPT](https://github.com/KareemXD/OGPT) - same
|
|
5
|
+
commands, tools and session format as the Python version.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i -g @krmxd/onegpt
|
|
11
|
+
ogpt
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Requirements
|
|
15
|
+
|
|
16
|
+
- Node.js >= 18
|
|
17
|
+
- [Ollama](https://ollama.com) running locally (`ollama serve`) with a model pulled
|
|
18
|
+
|
|
19
|
+
## Highlights
|
|
20
|
+
|
|
21
|
+
- 24 built-in tools: read/write/edit files, run Python & Node code,
|
|
22
|
+
install packages (pip/npm), call HTTP APIs, git, web search & fetch
|
|
23
|
+
- Permission prompts only for genuinely risky actions (shell, installs,
|
|
24
|
+
git commit) - everything else just works
|
|
25
|
+
- Token dashboard with live tok/s charts at `http://127.0.0.1:8756` (`/dash`)
|
|
26
|
+
- Session history shared with the Python OGPT build (`/save`, `/load`, `/sessions`)
|
|
27
|
+
- Anti-sloth guardrails: tiny local models are kept on-task until every
|
|
28
|
+
requested file actually exists
|
|
29
|
+
|
|
30
|
+
## Useful commands
|
|
31
|
+
|
|
32
|
+
| Command | What it does |
|
|
33
|
+
| ------- | ------------ |
|
|
34
|
+
| `/help` | all commands |
|
|
35
|
+
| `/model` | switch model |
|
|
36
|
+
| `/tools` | list tools |
|
|
37
|
+
| `/auto` | toggle auto-approve |
|
|
38
|
+
| `/dash` | token dashboard |
|
|
39
|
+
| `/new` | fresh chat |
|
|
40
|
+
|
|
41
|
+
Config lives at `~/.config/ogpt/config.json`.
|
package/bin/ogpt.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { CLI } = require("../src/cli");
|
|
5
|
+
const { getConfig } = require("../src/config");
|
|
6
|
+
|
|
7
|
+
async function main() {
|
|
8
|
+
const args = process.argv.slice(2);
|
|
9
|
+
const cfg = getConfig();
|
|
10
|
+
|
|
11
|
+
// Parse flags
|
|
12
|
+
let prompt = [];
|
|
13
|
+
let noStream = false;
|
|
14
|
+
let autoApprove = false;
|
|
15
|
+
|
|
16
|
+
for (let i = 0; i < args.length; i++) {
|
|
17
|
+
if (args[i] === "--no-stream" || args[i] === "-s") {
|
|
18
|
+
noStream = true;
|
|
19
|
+
} else if (args[i] === "--auto") {
|
|
20
|
+
autoApprove = true;
|
|
21
|
+
} else if (args[i] === "--model" || args[i] === "-m") {
|
|
22
|
+
const name = args[++i];
|
|
23
|
+
cfg.set("active_model", cfg.resolveModel(name));
|
|
24
|
+
} else if (args[i] === "--version" || args[i] === "-v") {
|
|
25
|
+
console.log("ogpt v1.1.0 (by KareemXD)");
|
|
26
|
+
process.exit(0);
|
|
27
|
+
} else if (args[i] === "--help") {
|
|
28
|
+
console.log(`Usage: ogpt [options] [prompt]
|
|
29
|
+
|
|
30
|
+
Options:
|
|
31
|
+
-m, --model <oGPT-name|id> Override model (e.g. -m oGPT-2a)
|
|
32
|
+
-s, --no-stream Disable streaming
|
|
33
|
+
--auto Auto-approve all tools
|
|
34
|
+
-v, --version Show version
|
|
35
|
+
-h, --help Show help`);
|
|
36
|
+
process.exit(0);
|
|
37
|
+
} else {
|
|
38
|
+
prompt.push(args[i]);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (noStream) cfg.set("ui.stream", false);
|
|
43
|
+
|
|
44
|
+
const cli = new CLI({ config: cfg });
|
|
45
|
+
|
|
46
|
+
if (autoApprove) {
|
|
47
|
+
cli.tools._autoApprove = true;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (prompt.length) {
|
|
51
|
+
await cli.runSingle(prompt.join(" "));
|
|
52
|
+
} else {
|
|
53
|
+
await cli.runInteractive();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
main().catch((e) => {
|
|
58
|
+
if (e.message && e.message.includes("readline")) {
|
|
59
|
+
process.exit(0);
|
|
60
|
+
}
|
|
61
|
+
console.error(`Fatal: ${e.message}`);
|
|
62
|
+
process.exit(1);
|
|
63
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@krmxd/onegpt",
|
|
3
|
+
"version": "0.0.0-beta",
|
|
4
|
+
"description": "OGPT - AI coding assistant for the terminal with a built-in local engine",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"ogpt": "bin/ogpt.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"start": "node bin/ogpt.js",
|
|
11
|
+
"test": "node --test src/__tests__/*.test.js"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"ai",
|
|
15
|
+
"coding",
|
|
16
|
+
"assistant",
|
|
17
|
+
"cli",
|
|
18
|
+
"terminal",
|
|
19
|
+
"llm",
|
|
20
|
+
"local-engine"
|
|
21
|
+
],
|
|
22
|
+
"author": "OGPT Team",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"ollama": "^0.5.0"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=18.0.0"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"src/",
|
|
32
|
+
"bin/",
|
|
33
|
+
"README.md"
|
|
34
|
+
]
|
|
35
|
+
}
|