@glrs-dev/cli 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/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ # @glrs-dev/cli
2
+
3
+ ## 0.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`689c103`](https://github.com/iceglober/glrs/commit/689c1034bd2b5f5c54af40b18b3c1d3bb3db4bb4), [`054cf1a`](https://github.com/iceglober/glrs/commit/054cf1ad516c171a93a1383aacd318ca670155fa)]:
8
+ - @glrs-dev/harness-opencode@1.0.0
9
+
10
+ ## 1.0.0
11
+
12
+ ### Major Changes
13
+
14
+ - Initial release. Unified CLI for the `@glrs-dev` ecosystem.
15
+ - Provides a single `glrs` binary with three subcommands:
16
+ - `glrs oc` → `harness-opencode` (OpenCode agent harness)
17
+ - `glrs agentic` → `gs-agentic` / `gsag` (agentic workflows)
18
+ - `glrs assume` → `gs-assume` / `gsa` (SSO credential manager)
19
+ - Pure dispatcher — no CLI logic duplication. Each subtool retains its own direct bin for power users.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 iceglober
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,40 @@
1
+ # `@glrs-dev/cli`
2
+
3
+ Unified CLI for the [@glrs-dev](https://www.npmjs.com/org/glrs-dev) ecosystem. One binary, three subcommands:
4
+
5
+ ```bash
6
+ npm i -g @glrs-dev/cli
7
+ ```
8
+
9
+ ```bash
10
+ glrs oc install # → harness-opencode install
11
+ glrs agentic wt new feature # → gs-agentic wt new feature
12
+ glrs assume login aws # → gs-assume login aws
13
+ ```
14
+
15
+ Each subtool still ships its own direct bin — `harness-opencode`, `gs-agentic` / `gsag`, `gs-assume` / `gsa` — if you prefer typing those. The dispatcher exists to give new users one install command and one entry point to remember.
16
+
17
+ ## How it works
18
+
19
+ The `glrs` binary is a thin dispatcher. It:
20
+
21
+ 1. Reads the first positional arg as the subcommand (`oc`, `agentic`, `assume`)
22
+ 2. Resolves the underlying binary via `require.resolve(<package>/package.json)` → reads the `bin` field
23
+ 3. Spawns the binary with the remaining argv forwarded, inheriting stdio
24
+ 4. Exits with the child's exit code
25
+
26
+ For the `assume` subcommand, the dispatcher imports `@glrs-dev/assume`'s exported `getBinaryPath()` directly and execs the prebuilt Rust binary — skipping the TS shim middle-layer for interactive credential operations.
27
+
28
+ ## Philosophy
29
+
30
+ - **Don't duplicate CLI logic.** Every flag, every subcommand, every option lives in the underlying tool. The dispatcher adds no behavior.
31
+ - **Don't fragment muscle memory.** `harness-opencode` / `gsag` / `gsa` keep working forever. `glrs` is additive, not a replacement.
32
+ - **One install, one thing to remember.** For new users in the @glrs-dev ecosystem, `npm i -g @glrs-dev/cli` gets them everything.
33
+
34
+ ## Docs
35
+
36
+ [glrs.dev](https://glrs.dev) — full ecosystem docs.
37
+
38
+ ## License
39
+
40
+ MIT.
@@ -0,0 +1,69 @@
1
+ // src/index.ts
2
+ import { createRequire } from "module";
3
+ import { dirname, resolve as pathResolve } from "path";
4
+ var require2 = createRequire(import.meta.url);
5
+ function resolveNodeBin(packageName, binKey) {
6
+ const pkgJsonPath = require2.resolve(`${packageName}/package.json`);
7
+ const pkgJson = require2(pkgJsonPath);
8
+ const bin = pkgJson.bin;
9
+ let relative;
10
+ if (typeof bin === "string") {
11
+ relative = bin;
12
+ } else if (bin && typeof bin === "object" && typeof bin[binKey] === "string") {
13
+ relative = bin[binKey];
14
+ } else {
15
+ throw new Error(
16
+ `[@glrs-dev/cli] Package ${packageName} has no bin entry for '${binKey}'. This shouldn't happen \u2014 report at https://github.com/iceglober/glrs/issues.`
17
+ );
18
+ }
19
+ const binPath = pathResolve(dirname(pkgJsonPath), relative);
20
+ return { executable: process.execPath, preArgs: [binPath] };
21
+ }
22
+ function resolveSubcommand(sub) {
23
+ switch (sub) {
24
+ case "oc":
25
+ return resolveNodeBin("@glrs-dev/harness-opencode", "harness-opencode");
26
+ case "agentic":
27
+ return resolveNodeBin("@glrs-dev/agentic", "gs-agentic");
28
+ case "assume": {
29
+ const assume = require2("@glrs-dev/assume");
30
+ return { executable: assume.getBinaryPath(), preArgs: [] };
31
+ }
32
+ default: {
33
+ const exhaustive = sub;
34
+ throw new Error(`Unknown subcommand: ${exhaustive}`);
35
+ }
36
+ }
37
+ }
38
+ var SUBCOMMANDS = ["oc", "agentic", "assume"];
39
+ var HELP_TEXT = `glrs \u2014 unified CLI for the @glrs-dev ecosystem
40
+
41
+ USAGE
42
+ glrs <subcommand> [args...]
43
+
44
+ SUBCOMMANDS
45
+ oc Open code harness (harness-opencode install, pilot, etc.)
46
+ agentic Agentic CLI (gs-agentic / gsag \u2014 worktrees, state, skills)
47
+ assume SSO credential manager (gs-assume / gsa)
48
+
49
+ Each subcommand forwards the rest of argv to the underlying tool.
50
+ Run 'glrs <subcommand> --help' for per-tool help.
51
+
52
+ EXAMPLES
53
+ glrs oc install
54
+ glrs agentic wt new my-feature
55
+ glrs assume login aws
56
+
57
+ Each subtool also ships a direct bin:
58
+ harness-opencode, gs-agentic/gsag, gs-assume/gsa
59
+ Use those directly if you prefer.
60
+
61
+ DOCS https://glrs.dev
62
+ ISSUES https://github.com/iceglober/glrs/issues
63
+ `;
64
+
65
+ export {
66
+ resolveSubcommand,
67
+ SUBCOMMANDS,
68
+ HELP_TEXT
69
+ };
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
package/dist/cli.js ADDED
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ HELP_TEXT,
4
+ SUBCOMMANDS,
5
+ resolveSubcommand
6
+ } from "./chunk-TU23AE2F.js";
7
+
8
+ // src/cli.ts
9
+ import { spawn } from "child_process";
10
+ var args = process.argv.slice(2);
11
+ if (args.length === 0 || args[0] === "--help" || args[0] === "-h" || args[0] === "help") {
12
+ process.stdout.write(HELP_TEXT);
13
+ process.exit(0);
14
+ }
15
+ if (args[0] === "--version" || args[0] === "-V") {
16
+ const { readFileSync } = await import("fs");
17
+ const { fileURLToPath } = await import("url");
18
+ const { dirname, resolve } = await import("path");
19
+ const pkgPath = resolve(
20
+ dirname(fileURLToPath(import.meta.url)),
21
+ "..",
22
+ "package.json"
23
+ );
24
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
25
+ process.stdout.write(`glrs ${pkg.version}
26
+ `);
27
+ process.exit(0);
28
+ }
29
+ var sub = args[0];
30
+ if (!SUBCOMMANDS.includes(sub)) {
31
+ process.stderr.write(
32
+ `[glrs] Unknown subcommand '${sub}'. Run 'glrs --help' for usage.
33
+ `
34
+ );
35
+ process.exit(2);
36
+ }
37
+ var resolved;
38
+ try {
39
+ resolved = resolveSubcommand(sub);
40
+ } catch (err) {
41
+ process.stderr.write(`${err.message}
42
+ `);
43
+ process.exit(1);
44
+ }
45
+ var forward = args.slice(1);
46
+ var spawnArgs = [...resolved.preArgs, ...forward];
47
+ var spawnEnv = { ...process.env, GLRS_CLI_DISPATCHED: "1" };
48
+ var child = spawn(resolved.executable, spawnArgs, {
49
+ stdio: "inherit",
50
+ windowsHide: false,
51
+ env: spawnEnv
52
+ });
53
+ child.on("error", (err) => {
54
+ process.stderr.write(`[glrs] Failed to spawn '${sub}': ${err.message}
55
+ `);
56
+ process.exit(127);
57
+ });
58
+ child.on("exit", (code, signal) => {
59
+ if (signal) {
60
+ process.kill(process.pid, signal);
61
+ return;
62
+ }
63
+ process.exit(code ?? 0);
64
+ });
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @glrs-dev/cli — unified dispatcher for the glrs ecosystem.
3
+ *
4
+ * Provides a single `glrs` binary with three subcommands, each of which
5
+ * dispatches to the underlying tool:
6
+ *
7
+ * glrs oc <args> → harness-opencode <args>
8
+ * glrs agentic <args> → gs-agentic <args>
9
+ * glrs assume <args> → gs-assume <args>
10
+ *
11
+ * Each underlying package still publishes its own direct bin (`harness-opencode`,
12
+ * `gs-agentic` / `gsag`, `gs-assume` / `gsa`) for power users and existing scripts.
13
+ * The dispatcher exists to give new users one entry point and one thing to install.
14
+ *
15
+ * Resolution strategy:
16
+ * - For @glrs-dev/harness-opencode and @glrs-dev/agentic we resolve the
17
+ * package's bin field via its package.json and spawn `node <bin.js>`.
18
+ * - For @glrs-dev/assume we import getBinaryPath() directly and skip the
19
+ * TS shim middle-layer — one fewer process startup and zero
20
+ * double-node-startup latency for interactive credential lookups.
21
+ */
22
+ type Subcommand = "oc" | "agentic" | "assume";
23
+ interface ResolvedBin {
24
+ /** The executable to invoke (usually `process.execPath` for node bins). */
25
+ executable: string;
26
+ /** Arguments to prepend before user-supplied argv (e.g. the JS file path). */
27
+ preArgs: string[];
28
+ }
29
+ declare function resolveSubcommand(sub: Subcommand): ResolvedBin;
30
+ declare const SUBCOMMANDS: Subcommand[];
31
+ declare const HELP_TEXT = "glrs \u2014 unified CLI for the @glrs-dev ecosystem\n\nUSAGE\n glrs <subcommand> [args...]\n\nSUBCOMMANDS\n oc Open code harness (harness-opencode install, pilot, etc.)\n agentic Agentic CLI (gs-agentic / gsag \u2014 worktrees, state, skills)\n assume SSO credential manager (gs-assume / gsa)\n\nEach subcommand forwards the rest of argv to the underlying tool.\nRun 'glrs <subcommand> --help' for per-tool help.\n\nEXAMPLES\n glrs oc install\n glrs agentic wt new my-feature\n glrs assume login aws\n\nEach subtool also ships a direct bin:\n harness-opencode, gs-agentic/gsag, gs-assume/gsa\nUse those directly if you prefer.\n\nDOCS https://glrs.dev\nISSUES https://github.com/iceglober/glrs/issues\n";
32
+
33
+ export { HELP_TEXT, type ResolvedBin, SUBCOMMANDS, type Subcommand, resolveSubcommand };
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ import {
2
+ HELP_TEXT,
3
+ SUBCOMMANDS,
4
+ resolveSubcommand
5
+ } from "./chunk-TU23AE2F.js";
6
+ export {
7
+ HELP_TEXT,
8
+ SUBCOMMANDS,
9
+ resolveSubcommand
10
+ };
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@glrs-dev/cli",
3
+ "version": "0.0.1",
4
+ "description": "Unified CLI for the @glrs-dev ecosystem. Dispatches to harness-opencode, agentic, and assume sub-tools.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/iceglober/glrs.git",
9
+ "directory": "packages/cli"
10
+ },
11
+ "homepage": "https://glrs.dev",
12
+ "bugs": {
13
+ "url": "https://github.com/iceglober/glrs/issues"
14
+ },
15
+ "type": "module",
16
+ "main": "./dist/index.js",
17
+ "bin": {
18
+ "glrs": "./dist/cli.js"
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "CHANGELOG.md"
23
+ ],
24
+ "publishConfig": {
25
+ "access": "public",
26
+ "provenance": true
27
+ },
28
+ "keywords": [
29
+ "glrs",
30
+ "cli",
31
+ "dispatcher",
32
+ "opencode",
33
+ "agentic",
34
+ "assume"
35
+ ],
36
+ "engines": {
37
+ "node": ">=20.10"
38
+ },
39
+ "dependencies": {
40
+ "@glrs-dev/harness-opencode": "1.0.0",
41
+ "@glrs-dev/assume": "0.6.3",
42
+ "@glrs-dev/agentic": "0.0.0"
43
+ },
44
+ "devDependencies": {
45
+ "@types/bun": "latest",
46
+ "@types/node": "^22",
47
+ "tsup": "^8",
48
+ "typescript": "^5"
49
+ },
50
+ "scripts": {
51
+ "build": "tsup src/index.ts src/cli.ts --format esm --dts --clean --target node20",
52
+ "typecheck": "tsc --noEmit",
53
+ "test": "bun test src/",
54
+ "lint": "echo 'no linter configured yet'"
55
+ }
56
+ }