@krmxd/onegpt 2.0.0-beta.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/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": "2.0.0-beta.1",
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
+ }