@gorsee/code 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 ADDED
@@ -0,0 +1,17 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ https://www.apache.org/licenses/
4
+
5
+ Copyright 2026 Gorsee Code Contributors
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ https://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ Gorsee Code
2
+ Copyright 2026 Gorsee Code Contributors
3
+
4
+ This product includes software developed by the Gorsee Code project.
package/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # Gorsee Code
2
+
3
+ Gorsee Code is a local NeuroGate-native coding workspace.
4
+ Install it once, run `gcode`, add your NeuroGate API key, and work from the
5
+ terminal UI.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install -g @gorsee/code
11
+ gcode
12
+ ```
13
+
14
+ The first `gcode` launch asks for a NeuroGate API key, stores it locally, and
15
+ opens the coding TUI.
16
+
17
+ ## Common Commands
18
+
19
+ ```bash
20
+ gcode init
21
+ gcode auth set
22
+ gcode doctor
23
+ gcode models
24
+ gcode limits
25
+ gcode mission "audit this repository"
26
+ gcode skills run repo-audit
27
+ gcode pause
28
+ gcode resume
29
+ gcode export
30
+ ```
31
+
32
+ ## Configuration
33
+
34
+ `gcode init` creates `gorsee-code.toml`.
35
+ The API key is read from `NEUROGATE_API_KEY` by default.
36
+ `gcode auth set` can also store a local project key in
37
+ `.gorsee-code/auth.json`, which is ignored by git.
38
+
39
+ ## Safety
40
+
41
+ Gorsee Code defaults to a balanced policy:
42
+
43
+ - read/search/test inside the workspace are allowed;
44
+ - writes, patches, commands, and network actions ask for approval;
45
+ - deletes and access outside the workspace are denied;
46
+ - event logs, exports, gateway payloads, and terminal output pass through
47
+ redaction helpers before display.
package/npm/gcode.js ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+ const { spawnSync } = require("child_process");
7
+
8
+ const exe = process.platform === "win32" ? "gcode.exe" : "gcode";
9
+ const bin = path.join(__dirname, "bin", exe);
10
+
11
+ if (!fs.existsSync(bin)) {
12
+ console.error("gcode binary is missing. Reinstall with: npm install -g @gorsee/code");
13
+ process.exit(1);
14
+ }
15
+
16
+ const result = spawnSync(bin, process.argv.slice(2), { stdio: "inherit" });
17
+
18
+ if (result.error) {
19
+ console.error(result.error.message);
20
+ process.exit(1);
21
+ }
22
+
23
+ if (result.signal) {
24
+ process.kill(process.pid, result.signal);
25
+ }
26
+
27
+ process.exit(result.status ?? 1);
@@ -0,0 +1,101 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const fs = require("fs");
5
+ const https = require("https");
6
+ const path = require("path");
7
+
8
+ const version = require("../package.json").version;
9
+ const binDir = path.join(__dirname, "bin");
10
+ const target = platformTarget(process.platform, process.arch);
11
+
12
+ if (process.argv.includes("--check")) {
13
+ console.log(`asset=${target.asset}`);
14
+ process.exit(0);
15
+ }
16
+
17
+ install().catch((error) => {
18
+ console.error(`\nInstall failed: ${error.message}`);
19
+ process.exit(1);
20
+ });
21
+
22
+ async function install() {
23
+ const stop = spinner("Installing Gorsee Code");
24
+ fs.mkdirSync(binDir, { recursive: true });
25
+
26
+ const url = `https://github.com/OlegGorsky/gorsee-code/releases/download/v${version}/${target.asset}`;
27
+ const output = path.join(binDir, target.exe);
28
+ await download(url, output);
29
+ if (process.platform !== "win32") {
30
+ fs.chmodSync(output, 0o755);
31
+ }
32
+ stop("OK");
33
+ }
34
+
35
+ function platformTarget(platform, arch) {
36
+ const cpu = { x64: "x64", arm64: "arm64" }[arch];
37
+ if (!cpu) {
38
+ throw new Error(`unsupported CPU: ${arch}`);
39
+ }
40
+ if (platform === "linux") {
41
+ return { asset: `gcode-linux-${cpu}`, exe: "gcode" };
42
+ }
43
+ if (platform === "darwin") {
44
+ return { asset: `gcode-darwin-${cpu}`, exe: "gcode" };
45
+ }
46
+ if (platform === "win32" && cpu === "x64") {
47
+ return { asset: "gcode-windows-x64.exe", exe: "gcode.exe" };
48
+ }
49
+ throw new Error(`unsupported platform: ${platform}-${arch}`);
50
+ }
51
+
52
+ function download(url, output, redirects = 0) {
53
+ if (redirects > 5) {
54
+ return Promise.reject(new Error("too many redirects"));
55
+ }
56
+
57
+ return new Promise((resolve, reject) => {
58
+ https
59
+ .get(url, (response) => {
60
+ if (isRedirect(response.statusCode)) {
61
+ response.resume();
62
+ resolve(download(new URL(response.headers.location, url), output, redirects + 1));
63
+ return;
64
+ }
65
+
66
+ if (response.statusCode !== 200) {
67
+ response.resume();
68
+ reject(new Error(`download failed with HTTP ${response.statusCode}`));
69
+ return;
70
+ }
71
+
72
+ const file = fs.createWriteStream(output);
73
+ response.pipe(file);
74
+ file.on("finish", () => file.close(resolve));
75
+ file.on("error", reject);
76
+ })
77
+ .on("error", reject);
78
+ });
79
+ }
80
+
81
+ function isRedirect(statusCode) {
82
+ return [301, 302, 303, 307, 308].includes(statusCode);
83
+ }
84
+
85
+ function spinner(label) {
86
+ if (!process.stdout.isTTY) {
87
+ console.log(`${label}...`);
88
+ return (status) => console.log(`${status} ${label}`);
89
+ }
90
+
91
+ const frames = ["-", "\\", "|", "/"];
92
+ let index = 0;
93
+ const timer = setInterval(() => {
94
+ process.stdout.write(`\r${frames[index++ % frames.length]} ${label}`);
95
+ }, 80);
96
+
97
+ return (status) => {
98
+ clearInterval(timer);
99
+ process.stdout.write(`\r${status} ${label}\n`);
100
+ };
101
+ }
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@gorsee/code",
3
+ "version": "0.1.0",
4
+ "description": "NeuroGate-native coding agent command center",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/OlegGorsky/gorsee-code.git"
9
+ },
10
+ "bin": {
11
+ "gcode": "npm/gcode.js"
12
+ },
13
+ "files": [
14
+ "npm/gcode.js",
15
+ "npm/postinstall.js",
16
+ "README.md",
17
+ "LICENSE",
18
+ "NOTICE"
19
+ ],
20
+ "scripts": {
21
+ "postinstall": "node npm/postinstall.js",
22
+ "test:npm": "node npm/postinstall.js --check"
23
+ },
24
+ "engines": {
25
+ "node": ">=16"
26
+ }
27
+ }