subconscious-cli 4.0.14 → 4.0.16
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 +12 -3
- package/bin/agents.js +72 -20
- package/bin/native/subc-tui-darwin-amd64 +0 -0
- package/bin/native/subc-tui-darwin-arm64 +0 -0
- package/bin/native/subc-tui-linux-amd64 +0 -0
- package/bin/native/subc-tui-linux-arm64 +0 -0
- package/bin/native/subc-tui-windows-amd64.exe +0 -0
- package/bin/native/subc-tui-windows-arm64.exe +0 -0
- package/bin/profiles.js +9 -0
- package/bin/registry.generated.json +44 -0
- package/bin/runbook/README.md +2 -1
- package/bin/runbook/subconscious-code/install.sh +120 -0
- package/bin/runbook/subconscious-code/run.sh +21 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@ Log in to Subconscious, then run coding agents against the Subconscious gateway.
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install -g subconscious-cli
|
|
9
9
|
subc login
|
|
10
|
+
subc sc
|
|
10
11
|
subc claude
|
|
11
12
|
```
|
|
12
13
|
|
|
@@ -21,7 +22,7 @@ never block the requested command. Set `SUBC_DISABLE_UPDATE_CHECK=1` to suppress
|
|
|
21
22
|
the check in offline automation.
|
|
22
23
|
|
|
23
24
|
Login creates both the saved credential and a ready-to-use `default` profile,
|
|
24
|
-
so Claude Code, Codex, OpenCode, and DeepSeek Harness can launch immediately.
|
|
25
|
+
so Subconscious Code, Claude Code, Codex, OpenCode, and DeepSeek Harness can launch immediately.
|
|
25
26
|
Persistent editor and Pi integrations are installed per agent:
|
|
26
27
|
|
|
27
28
|
```bash
|
|
@@ -52,6 +53,7 @@ profile; they do not authenticate, install, configure, or launch anything:
|
|
|
52
53
|
|
|
53
54
|
```bash
|
|
54
55
|
subc claude help
|
|
56
|
+
subc sc help
|
|
55
57
|
subc codex help
|
|
56
58
|
subc cursor help
|
|
57
59
|
subc config help
|
|
@@ -66,6 +68,7 @@ gateway environment applied for that process. Arguments pass through as usual:
|
|
|
66
68
|
|
|
67
69
|
```bash
|
|
68
70
|
subc claude --continue
|
|
71
|
+
subc sc -- -p "fix the tests"
|
|
69
72
|
subc codex exec "write a test"
|
|
70
73
|
subc opencode
|
|
71
74
|
subc pi
|
|
@@ -78,6 +81,7 @@ The packaged integrations live in `cli/bin/runbook`.
|
|
|
78
81
|
|
|
79
82
|
| Command | Behavior |
|
|
80
83
|
| --- | --- |
|
|
84
|
+
| `subc sc` | Launch Subconscious Code with the active gateway, key, model, and DLR transport |
|
|
81
85
|
| `subc claude` | Launch Claude Code with the runbook environment, context limits, subagent limits, and OTEL usage reporting |
|
|
82
86
|
| `subc codex` | Launch Codex with the runbook provider, temporary model catalog, and surgically merged compaction hooks |
|
|
83
87
|
| `subc opencode` | Launch OpenCode with the runbook provider, client header, and context/output limits |
|
|
@@ -86,11 +90,16 @@ The packaged integrations live in `cli/bin/runbook`.
|
|
|
86
90
|
| `subc pi` | Refresh the Pi provider from the live catalog, then launch |
|
|
87
91
|
| `subc dsh` | Launch the DeepSeek Harness Web UI with a temporary provider populated from the live catalog |
|
|
88
92
|
|
|
89
|
-
If Claude Code, Codex, OpenCode, or DeepSeek Harness is missing, an interactive terminal offers
|
|
93
|
+
If Subconscious Code, Claude Code, Codex, OpenCode, or DeepSeek Harness is missing, an interactive terminal offers
|
|
90
94
|
to install it before launching. Pi refreshes its Subconscious provider on every
|
|
91
95
|
`subc pi` launch while preserving all other providers in `models.json`; its
|
|
92
96
|
executable must already be installed.
|
|
93
97
|
|
|
98
|
+
`subc sc install` detects the operating system and architecture, then downloads
|
|
99
|
+
and checksum-verifies the matching precompiled release from
|
|
100
|
+
`subconscious-systems/subconscious-code`. Apple Silicon and Intel macOS plus
|
|
101
|
+
x86_64 and ARM64 Linux are supported; Cargo is not required.
|
|
102
|
+
|
|
94
103
|
`subc codex` disables Codex apps and plugin tools for that launch by default so
|
|
95
104
|
requests remain below the gateway's 128-tool limit. Core coding tools remain
|
|
96
105
|
available. Use `subc codex --external-tools` to opt back in when targeting a
|
|
@@ -145,7 +154,7 @@ rewritten. Run a one-shot task with `subc dsh headless "PROMPT"`.
|
|
|
145
154
|
```
|
|
146
155
|
|
|
147
156
|
The file is mode `600` and contains the shared gateway URL, API key, model,
|
|
148
|
-
optional per-agent key overrides, and all Claude/Codex/OpenCode/Pi/Copilot/
|
|
157
|
+
optional per-agent key overrides, and all Subconscious Code/Claude/Codex/OpenCode/Pi/Copilot/
|
|
149
158
|
DeepSeek Harness context and output settings used by the packaged runbook scripts.
|
|
150
159
|
|
|
151
160
|
```bash
|
package/bin/agents.js
CHANGED
|
@@ -164,6 +164,17 @@ export function parseAgentAction(agent, argv = []) {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
const AGENT_HELP = {
|
|
167
|
+
'subconscious-code': {
|
|
168
|
+
usage: 'subc [-p NAME] sc [help|install] [Subconscious Code arguments...]',
|
|
169
|
+
behavior:
|
|
170
|
+
'Launches the native Subconscious coding agent with the selected profile gateway, credential, and model.',
|
|
171
|
+
options: [
|
|
172
|
+
['help', 'Show this help'],
|
|
173
|
+
['install', 'Install the latest precompiled Linux or macOS release'],
|
|
174
|
+
['--model MODEL', 'Override the profile model for this launch'],
|
|
175
|
+
['ARGS...', 'Pass arguments directly to Subconscious Code'],
|
|
176
|
+
],
|
|
177
|
+
},
|
|
167
178
|
'claude-code': {
|
|
168
179
|
usage: 'subc [-p NAME] claude [help|status|uninstall] [Claude arguments...]',
|
|
169
180
|
behavior:
|
|
@@ -309,9 +320,10 @@ export function printAgentHelp(agent, profile) {
|
|
|
309
320
|
);
|
|
310
321
|
const actions = agentSetupActions(agent);
|
|
311
322
|
if (actions.includes('install')) {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
323
|
+
const installDescription = agent.runbook?.binaryInstallScript
|
|
324
|
+
? 'Install the agent binary with'
|
|
325
|
+
: 'Install the persistent integration with';
|
|
326
|
+
console.log(` ${installDescription} ${c.cyan}subc ${command} install${c.reset}.`);
|
|
315
327
|
}
|
|
316
328
|
if (actions.includes('uninstall')) {
|
|
317
329
|
console.log(
|
|
@@ -397,6 +409,7 @@ function candidateBinDirs() {
|
|
|
397
409
|
if (home) dirs.push(path.join(home, '.local', 'bin'));
|
|
398
410
|
} else {
|
|
399
411
|
dirs.push(path.join(home, '.local', 'bin'));
|
|
412
|
+
dirs.push(path.join(home, '.cargo', 'bin'));
|
|
400
413
|
dirs.push('/opt/homebrew/bin');
|
|
401
414
|
dirs.push('/usr/local/bin');
|
|
402
415
|
}
|
|
@@ -418,6 +431,20 @@ function candidateBinDirs() {
|
|
|
418
431
|
return [...new Set(dirs.filter(Boolean))];
|
|
419
432
|
}
|
|
420
433
|
|
|
434
|
+
/** Resolve an agent-managed binary directory declared by the registry. */
|
|
435
|
+
export function preferredBinDirsForAgent(
|
|
436
|
+
agent,
|
|
437
|
+
environment = process.env,
|
|
438
|
+
home = os.homedir(),
|
|
439
|
+
) {
|
|
440
|
+
const envName = agent.runbook?.installDirEnv;
|
|
441
|
+
const configured = envName ? environment[envName]?.trim() : '';
|
|
442
|
+
if (configured) return [path.resolve(configured)];
|
|
443
|
+
|
|
444
|
+
const installDir = agent.runbook?.installDir?.trim();
|
|
445
|
+
return installDir ? [path.resolve(home, installDir)] : [];
|
|
446
|
+
}
|
|
447
|
+
|
|
421
448
|
/** Executable extensions to probe (Windows uses PATHEXT). */
|
|
422
449
|
function binExts() {
|
|
423
450
|
return process.platform === 'win32'
|
|
@@ -430,9 +457,9 @@ function binExts() {
|
|
|
430
457
|
* containing the executable if found, otherwise null. Searching the candidate
|
|
431
458
|
* dirs lets us find binaries installed this session that aren't on PATH yet.
|
|
432
459
|
*/
|
|
433
|
-
async function resolveBinPath(bin) {
|
|
460
|
+
async function resolveBinPath(bin, preferredDirs = []) {
|
|
434
461
|
const pathDirs = (process.env.PATH || '').split(path.delimiter).filter(Boolean);
|
|
435
|
-
const dirs = [...pathDirs, ...candidateBinDirs()];
|
|
462
|
+
const dirs = [...new Set([...preferredDirs, ...pathDirs, ...candidateBinDirs()])];
|
|
436
463
|
const exts = binExts();
|
|
437
464
|
for (const dir of dirs) {
|
|
438
465
|
for (const ext of exts) {
|
|
@@ -452,11 +479,24 @@ async function resolveBinPath(bin) {
|
|
|
452
479
|
* Build a PATH string with `extraDirs` prepended (deduped against PATH).
|
|
453
480
|
* Returns the augmented PATH value for use in a child env.
|
|
454
481
|
*/
|
|
455
|
-
function augmentPath(
|
|
456
|
-
|
|
482
|
+
export function augmentPath(
|
|
483
|
+
extraDirs,
|
|
484
|
+
preferredDir,
|
|
485
|
+
currentPath = process.env.PATH || '',
|
|
486
|
+
) {
|
|
487
|
+
const current = currentPath.split(path.delimiter).filter(Boolean);
|
|
457
488
|
const seen = new Set(current);
|
|
458
|
-
const prepend = extraDirs.filter(
|
|
459
|
-
|
|
489
|
+
const prepend = extraDirs.filter(
|
|
490
|
+
(dir, index) =>
|
|
491
|
+
dir &&
|
|
492
|
+
dir !== preferredDir &&
|
|
493
|
+
!seen.has(dir) &&
|
|
494
|
+
extraDirs.indexOf(dir) === index,
|
|
495
|
+
);
|
|
496
|
+
const remaining = current.filter((dir) => dir !== preferredDir);
|
|
497
|
+
return [...(preferredDir ? [preferredDir] : []), ...prepend, ...remaining].join(
|
|
498
|
+
path.delimiter,
|
|
499
|
+
);
|
|
460
500
|
}
|
|
461
501
|
|
|
462
502
|
/** Ask a yes/no question on the TTY. Empty answer counts as yes. */
|
|
@@ -481,10 +521,15 @@ function waitForEnter(prompt) {
|
|
|
481
521
|
});
|
|
482
522
|
}
|
|
483
523
|
|
|
484
|
-
/** Run the agent's
|
|
485
|
-
function runInstaller(install) {
|
|
524
|
+
/** Run the agent's packaged binary installer, or its shell install command. */
|
|
525
|
+
function runInstaller(agent, install = agent.install, usePackagedScript = true) {
|
|
486
526
|
return new Promise((resolve) => {
|
|
487
|
-
const
|
|
527
|
+
const installScript = usePackagedScript && agent.runbook?.binaryInstallScript;
|
|
528
|
+
const child = installScript
|
|
529
|
+
? spawn('bash', [runbookScriptPath(agent, installScript), 'install'], {
|
|
530
|
+
stdio: 'inherit',
|
|
531
|
+
})
|
|
532
|
+
: spawn(install, { shell: true, stdio: 'inherit' });
|
|
488
533
|
child.on('error', () => resolve(false));
|
|
489
534
|
child.on('exit', (code) => resolve(code === 0));
|
|
490
535
|
});
|
|
@@ -511,7 +556,8 @@ function printInstallCommands(agent) {
|
|
|
511
556
|
* success. May exit the process on failure or when manual action is needed.
|
|
512
557
|
*/
|
|
513
558
|
async function ensureInstalled(agent) {
|
|
514
|
-
const
|
|
559
|
+
const preferredDirs = preferredBinDirsForAgent(agent);
|
|
560
|
+
const existing = await resolveBinPath(agent.bin, preferredDirs);
|
|
515
561
|
if (existing) return existing;
|
|
516
562
|
|
|
517
563
|
// Agents without an installer are launch-only. Their setup integration may
|
|
@@ -544,14 +590,14 @@ async function ensureInstalled(agent) {
|
|
|
544
590
|
}
|
|
545
591
|
|
|
546
592
|
console.error(`\n ${c.dim}Running ${c.reset}${c.cyan}${agent.install}${c.reset}\n`);
|
|
547
|
-
let installed = await runInstaller(agent
|
|
593
|
+
let installed = await runInstaller(agent);
|
|
548
594
|
|
|
549
595
|
// Primary failed and a fallback exists — try it once.
|
|
550
596
|
if (!installed && agent.installFallback) {
|
|
551
597
|
console.error(
|
|
552
598
|
`\n ${c.dim}That didn't work. Trying the fallback: ${c.reset}${c.cyan}${agent.installFallback}${c.reset}\n`,
|
|
553
599
|
);
|
|
554
|
-
installed = await runInstaller(agent.installFallback);
|
|
600
|
+
installed = await runInstaller(agent, agent.installFallback, false);
|
|
555
601
|
}
|
|
556
602
|
|
|
557
603
|
if (!installed) {
|
|
@@ -562,7 +608,7 @@ async function ensureInstalled(agent) {
|
|
|
562
608
|
|
|
563
609
|
// PATH hardening: the freshly-installed binary is often not on the current
|
|
564
610
|
// process's PATH. Re-resolve against PATH + candidate dirs.
|
|
565
|
-
const found = await resolveBinPath(agent.bin);
|
|
611
|
+
const found = await resolveBinPath(agent.bin, preferredDirs);
|
|
566
612
|
if (found) return found;
|
|
567
613
|
|
|
568
614
|
console.error(
|
|
@@ -587,7 +633,13 @@ export function readClaudeVersion(bin, binDir, options = {}) {
|
|
|
587
633
|
const stdout = execFile(bin, ['--version'], {
|
|
588
634
|
encoding: 'utf-8',
|
|
589
635
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
590
|
-
env: {
|
|
636
|
+
env: {
|
|
637
|
+
...process.env,
|
|
638
|
+
PATH: augmentPath(
|
|
639
|
+
[binDir, ...candidateBinDirs()].filter(Boolean),
|
|
640
|
+
binDir,
|
|
641
|
+
),
|
|
642
|
+
},
|
|
591
643
|
timeout: options.timeoutMs ?? 3000,
|
|
592
644
|
});
|
|
593
645
|
return parseClaudeVersion(typeof stdout === 'string' ? stdout : stdout?.toString?.());
|
|
@@ -834,7 +886,7 @@ export function runbookEnv(
|
|
|
834
886
|
}
|
|
835
887
|
: {}),
|
|
836
888
|
SUBC_ENV_FILE: os.devNull,
|
|
837
|
-
PATH: augmentPath(extraDirs),
|
|
889
|
+
PATH: augmentPath(extraDirs, binDir),
|
|
838
890
|
},
|
|
839
891
|
picker,
|
|
840
892
|
models,
|
|
@@ -874,7 +926,7 @@ export function selectLaunchModel(requestedModel, modelSource, catalog) {
|
|
|
874
926
|
}
|
|
875
927
|
|
|
876
928
|
async function runRunbookSetup(agent, argv, profile, relativeScript = agent.runbook.script) {
|
|
877
|
-
if (isSetupWithoutAuth(argv)) {
|
|
929
|
+
if (isSetupWithoutAuth(argv) || agent.runbook?.setupNeedsAuth === false) {
|
|
878
930
|
return spawnRunbook(agent, argv, {
|
|
879
931
|
...(profile?.values || {}),
|
|
880
932
|
...process.env,
|
|
@@ -987,7 +1039,7 @@ export async function runAgent(agent, argv, options = {}) {
|
|
|
987
1039
|
...envMap,
|
|
988
1040
|
...(profile?.values || {}),
|
|
989
1041
|
...process.env,
|
|
990
|
-
PATH: augmentPath(extraDirs),
|
|
1042
|
+
PATH: augmentPath(extraDirs, binDir),
|
|
991
1043
|
};
|
|
992
1044
|
const args = [...launchArgs, ...rest];
|
|
993
1045
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bin/profiles.js
CHANGED
|
@@ -38,6 +38,7 @@ export const RUNBOOK_DEFAULTS = {
|
|
|
38
38
|
GATEWAY_URL: registry.defaults.baseUrl,
|
|
39
39
|
API_KEY: '',
|
|
40
40
|
MODEL: registry.defaults.model,
|
|
41
|
+
SC_API_KEY: '',
|
|
41
42
|
CLAUDE_CODE_SUBAGENT_MODEL: '',
|
|
42
43
|
CLAUDE_GATEWAY_URL: '',
|
|
43
44
|
CLAUDE_CODE_API_KEY: '',
|
|
@@ -89,6 +90,12 @@ const SETTINGS = {
|
|
|
89
90
|
type: 'choice',
|
|
90
91
|
choices: SUPPORTED_MODELS,
|
|
91
92
|
},
|
|
93
|
+
SC_API_KEY: {
|
|
94
|
+
key: 'SC_API_KEY',
|
|
95
|
+
label: 'Subconscious Code API key',
|
|
96
|
+
description: 'Subconscious Code credential override; blank uses API_KEY.',
|
|
97
|
+
type: 'secret',
|
|
98
|
+
},
|
|
92
99
|
CLAUDE_CODE_SUBAGENT_MODEL: {
|
|
93
100
|
key: 'CLAUDE_CODE_SUBAGENT_MODEL',
|
|
94
101
|
label: 'Subagent model',
|
|
@@ -274,6 +281,7 @@ const SETTINGS = {
|
|
|
274
281
|
};
|
|
275
282
|
|
|
276
283
|
const AGENT_SETTING_KEYS = {
|
|
284
|
+
'subconscious-code': ['SC_API_KEY'],
|
|
277
285
|
'claude-code': [
|
|
278
286
|
'CLAUDE_GATEWAY_URL',
|
|
279
287
|
'CLAUDE_CODE_API_KEY',
|
|
@@ -346,6 +354,7 @@ ${modelComments}
|
|
|
346
354
|
MODEL={MODEL}
|
|
347
355
|
|
|
348
356
|
# Optional per-agent keys. Leave blank to use API_KEY above.
|
|
357
|
+
SC_API_KEY={SC_API_KEY}
|
|
349
358
|
CLAUDE_CODE_API_KEY={CLAUDE_CODE_API_KEY}
|
|
350
359
|
CODEX_API_KEY={CODEX_API_KEY}
|
|
351
360
|
OPENCODE_API_KEY={OPENCODE_API_KEY}
|
|
@@ -13,6 +13,50 @@
|
|
|
13
13
|
"platformUrl": "https://subconscious.dev/platform"
|
|
14
14
|
},
|
|
15
15
|
"agents": [
|
|
16
|
+
{
|
|
17
|
+
"id": "subconscious-code",
|
|
18
|
+
"command": "sc",
|
|
19
|
+
"name": "Subconscious Code",
|
|
20
|
+
"aliases": [
|
|
21
|
+
"subconscious-code"
|
|
22
|
+
],
|
|
23
|
+
"description": "Launch the native Subconscious coding agent with the active profile, gateway, and model.",
|
|
24
|
+
"framework": "Subconscious Code",
|
|
25
|
+
"language": "rust",
|
|
26
|
+
"category": "coding-agent",
|
|
27
|
+
"tags": [
|
|
28
|
+
"local",
|
|
29
|
+
"cli",
|
|
30
|
+
"agents"
|
|
31
|
+
],
|
|
32
|
+
"protocol": "openai",
|
|
33
|
+
"homepage": "https://github.com/subconscious-systems/subconscious-code",
|
|
34
|
+
"bin": "sc",
|
|
35
|
+
"install": {
|
|
36
|
+
"darwin": "subc sc install",
|
|
37
|
+
"linux": "subc sc install"
|
|
38
|
+
},
|
|
39
|
+
"runbook": {
|
|
40
|
+
"mode": "launch",
|
|
41
|
+
"script": "subconscious-code/run.sh",
|
|
42
|
+
"setupScript": "subconscious-code/install.sh",
|
|
43
|
+
"binaryInstallScript": "subconscious-code/install.sh",
|
|
44
|
+
"installDirEnv": "SC_INSTALL_DIR",
|
|
45
|
+
"installDir": ".local/bin",
|
|
46
|
+
"setupActions": [
|
|
47
|
+
"install"
|
|
48
|
+
],
|
|
49
|
+
"setupNeedsAuth": false
|
|
50
|
+
},
|
|
51
|
+
"launch": "sc",
|
|
52
|
+
"env": {
|
|
53
|
+
"SC_BASE_URL": "{baseUrlV1}",
|
|
54
|
+
"SC_DLR_URL": "{baseUrl}",
|
|
55
|
+
"SC_DLR_ENABLED": "true",
|
|
56
|
+
"SC_API_KEY": "{apiKey}",
|
|
57
|
+
"SC_MODEL": "{model}"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
16
60
|
{
|
|
17
61
|
"id": "claude-code",
|
|
18
62
|
"command": "claude",
|
package/bin/runbook/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Coding-agent integrations
|
|
2
2
|
|
|
3
3
|
These scripts are part of `subc`. They launch or surgically install Claude Code,
|
|
4
|
-
Codex, OpenCode, DeepSeek Harness, Cursor, Copilot, and Pi against the
|
|
4
|
+
Subconscious Code, Codex, OpenCode, DeepSeek Harness, Cursor, Copilot, and Pi against the
|
|
5
5
|
Subconscious gateway.
|
|
6
6
|
|
|
7
7
|
`subc` reads `~/.subconscious/profiles/<name>.env` and injects those values into
|
|
@@ -10,6 +10,7 @@ directly, `SUBC_ENV_FILE` (or `cli/bin/runbook/.env`) can supply the same keys.
|
|
|
10
10
|
|
|
11
11
|
Included integrations:
|
|
12
12
|
|
|
13
|
+
- `subconscious-code/install.sh` and `run.sh`
|
|
13
14
|
- `claude-code/install.sh` and `run.sh`
|
|
14
15
|
- `codex/install.sh`, `run.sh`, `hook.sh`, `hooks.json`, and `hooks-lib.sh`
|
|
15
16
|
- `opencode/install.sh`, `run.sh`, and `subconscious-compaction.ts`
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Install a precompiled Subconscious Code release for the current platform.
|
|
3
|
+
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
REPOSITORY="subconscious-systems/subconscious-code"
|
|
7
|
+
REPOSITORY_URL="https://github.com/${REPOSITORY}"
|
|
8
|
+
INSTALL_DIR="${SC_INSTALL_DIR:-${HOME}/.local/bin}"
|
|
9
|
+
|
|
10
|
+
usage() {
|
|
11
|
+
cat <<'EOF'
|
|
12
|
+
Usage: subc sc install
|
|
13
|
+
|
|
14
|
+
Install the latest Subconscious Code release. Linux downloads and verifies the
|
|
15
|
+
published static binary. macOS downloads and verifies the matching native binary.
|
|
16
|
+
EOF
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
case "${1:-install}" in
|
|
20
|
+
install) ;;
|
|
21
|
+
help|-h|--help)
|
|
22
|
+
usage
|
|
23
|
+
exit 0
|
|
24
|
+
;;
|
|
25
|
+
*)
|
|
26
|
+
echo "error: unsupported Subconscious Code setup action: $1" >&2
|
|
27
|
+
usage >&2
|
|
28
|
+
exit 2
|
|
29
|
+
;;
|
|
30
|
+
esac
|
|
31
|
+
|
|
32
|
+
release_tag() {
|
|
33
|
+
if [[ -n "${SC_CODE_VERSION:-}" ]]; then
|
|
34
|
+
printf '%s\n' "${SC_CODE_VERSION#v}"
|
|
35
|
+
return
|
|
36
|
+
fi
|
|
37
|
+
if command -v gh >/dev/null 2>&1; then
|
|
38
|
+
local tag
|
|
39
|
+
tag="$(gh release view --repo "$REPOSITORY" --json tagName --jq '.tagName' 2>/dev/null || true)"
|
|
40
|
+
if [[ -n "$tag" ]]; then
|
|
41
|
+
printf '%s\n' "${tag#v}"
|
|
42
|
+
return
|
|
43
|
+
fi
|
|
44
|
+
fi
|
|
45
|
+
if command -v curl >/dev/null 2>&1; then
|
|
46
|
+
local tag
|
|
47
|
+
tag="$(curl -fsSL "https://api.github.com/repos/${REPOSITORY}/releases/latest" 2>/dev/null \
|
|
48
|
+
| sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' \
|
|
49
|
+
| head -n 1 || true)"
|
|
50
|
+
if [[ -n "$tag" ]]; then
|
|
51
|
+
printf '%s\n' "${tag#v}"
|
|
52
|
+
return
|
|
53
|
+
fi
|
|
54
|
+
fi
|
|
55
|
+
return 1
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
platform="$(uname -s)"
|
|
59
|
+
architecture="$(uname -m)"
|
|
60
|
+
version="$(release_tag || true)"
|
|
61
|
+
|
|
62
|
+
if [[ -z "$version" ]]; then
|
|
63
|
+
echo "error: no published Subconscious Code release is available yet" >&2
|
|
64
|
+
echo "The release may still be building. Retry subc sc install after it finishes." >&2
|
|
65
|
+
exit 1
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
case "${platform}:${architecture}" in
|
|
69
|
+
Darwin:arm64) target="aarch64-apple-darwin" ;;
|
|
70
|
+
Darwin:x86_64) target="x86_64-apple-darwin" ;;
|
|
71
|
+
Linux:aarch64|Linux:arm64) target="aarch64-unknown-linux-musl" ;;
|
|
72
|
+
Linux:x86_64|Linux:amd64) target="x86_64-unknown-linux-musl" ;;
|
|
73
|
+
*)
|
|
74
|
+
echo "error: unsupported platform or architecture: ${platform} ${architecture}" >&2
|
|
75
|
+
exit 1
|
|
76
|
+
;;
|
|
77
|
+
esac
|
|
78
|
+
|
|
79
|
+
asset="sc-${target}.tar.gz"
|
|
80
|
+
checksum="${asset}.sha256"
|
|
81
|
+
work_dir="$(mktemp -d "${TMPDIR:-/tmp}/subc-sc-install.XXXXXX")"
|
|
82
|
+
cleanup() {
|
|
83
|
+
rm -f "$work_dir/$asset" "$work_dir/$checksum" "$work_dir/sc"
|
|
84
|
+
rmdir "$work_dir" 2>/dev/null || true
|
|
85
|
+
}
|
|
86
|
+
trap cleanup EXIT HUP INT TERM
|
|
87
|
+
|
|
88
|
+
echo "Downloading Subconscious Code v${version} for ${target}..."
|
|
89
|
+
if command -v gh >/dev/null 2>&1 \
|
|
90
|
+
&& gh release view "v${version}" --repo "$REPOSITORY" >/dev/null 2>&1; then
|
|
91
|
+
gh release download "v${version}" --repo "$REPOSITORY" \
|
|
92
|
+
--pattern "$asset" --pattern "$checksum" --dir "$work_dir"
|
|
93
|
+
else
|
|
94
|
+
command -v curl >/dev/null 2>&1 || {
|
|
95
|
+
echo "error: curl is required to download Subconscious Code" >&2
|
|
96
|
+
exit 1
|
|
97
|
+
}
|
|
98
|
+
release_url="${REPOSITORY_URL}/releases/download/v${version}"
|
|
99
|
+
curl -fL "${release_url}/${asset}" -o "$work_dir/$asset"
|
|
100
|
+
curl -fL "${release_url}/${checksum}" -o "$work_dir/$checksum"
|
|
101
|
+
fi
|
|
102
|
+
|
|
103
|
+
if command -v sha256sum >/dev/null 2>&1; then
|
|
104
|
+
(cd "$work_dir" && sha256sum --check "$checksum")
|
|
105
|
+
elif command -v shasum >/dev/null 2>&1; then
|
|
106
|
+
expected="$(awk '{print $1}' "$work_dir/$checksum")"
|
|
107
|
+
actual="$(shasum -a 256 "$work_dir/$asset" | awk '{print $1}')"
|
|
108
|
+
[[ "$actual" == "$expected" ]] || {
|
|
109
|
+
echo "error: Subconscious Code checksum verification failed" >&2
|
|
110
|
+
exit 1
|
|
111
|
+
}
|
|
112
|
+
else
|
|
113
|
+
echo "error: sha256sum or shasum is required to verify the download" >&2
|
|
114
|
+
exit 1
|
|
115
|
+
fi
|
|
116
|
+
|
|
117
|
+
tar -xzf "$work_dir/$asset" -C "$work_dir" sc
|
|
118
|
+
mkdir -p "$INSTALL_DIR"
|
|
119
|
+
install -m 0755 "$work_dir/sc" "$INSTALL_DIR/sc"
|
|
120
|
+
echo "Installed Subconscious Code v${version} to $INSTALL_DIR/sc"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Launch Subconscious Code without changing ~/.sc or project settings.
|
|
3
|
+
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
GATEWAY_URL="${GATEWAY_URL:-}"
|
|
7
|
+
API_KEY="${SC_API_KEY:-${API_KEY:-}}"
|
|
8
|
+
MODEL="${MODEL:-subconscious/glm-5.2}"
|
|
9
|
+
|
|
10
|
+
if [[ -z "$GATEWAY_URL" || -z "$API_KEY" ]]; then
|
|
11
|
+
echo "error: GATEWAY_URL and API_KEY are required to launch Subconscious Code" >&2
|
|
12
|
+
exit 1
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
export SC_API_KEY="$API_KEY"
|
|
16
|
+
export SC_BASE_URL="${GATEWAY_URL%/}/v1"
|
|
17
|
+
export SC_DLR_URL="${GATEWAY_URL%/}"
|
|
18
|
+
export SC_DLR_ENABLED=true
|
|
19
|
+
export SC_MODEL="$MODEL"
|
|
20
|
+
|
|
21
|
+
exec sc "$@"
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "subconscious-cli",
|
|
3
|
-
"version": "4.0.
|
|
4
|
-
"description": "CLI for Subconscious — run Claude Code, Codex, OpenCode, DeepSeek Harness, Cursor, Copilot, and Pi",
|
|
3
|
+
"version": "4.0.16",
|
|
4
|
+
"description": "CLI for Subconscious — run Subconscious Code, Claude Code, Codex, OpenCode, DeepSeek Harness, Cursor, Copilot, and Pi",
|
|
5
5
|
"bin": {
|
|
6
6
|
"subc": "bin/cli.js"
|
|
7
7
|
},
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"authentication",
|
|
34
34
|
"profiles",
|
|
35
35
|
"coding-agent",
|
|
36
|
+
"subconscious-code",
|
|
36
37
|
"claude-code",
|
|
37
38
|
"opencode",
|
|
38
39
|
"codex",
|