@nuucognition/flint-cli 0.6.0-dev.20 → 0.6.0-dev.22
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 +55 -0
- package/bin/flint-dev.js +12 -0
- package/bin/flint-prod.js +58 -22
- package/bin/launch-flint.js +119 -0
- package/dist/.build-stamp.json +7 -0
- package/dist/_flint/prompts/flint-headless.md +13 -0
- package/dist/_flint/prompts/flint-interactive.md +79 -5
- package/dist/_flint/prompts/flint-worker.md +40 -0
- package/dist/_orbh/prompts/harness/claude.md +13 -5
- package/dist/_orbh/prompts/harness/codex.md +7 -1
- package/dist/_orbh/prompts/harness/droid.md +1 -1
- package/dist/_orbh/prompts/harness/opencode.md +1 -1
- package/dist/_orbh/prompts/headless.md +17 -9
- package/dist/_orbh/prompts/peer.md +7 -2
- package/dist/_orbh/prompts/subagent.md +9 -2
- package/dist/completion.js +8967 -0
- package/dist/index.js +163807 -92889
- package/dist/open-tui-invocation.js +34 -21
- package/package.json +11 -6
- package/bin/flint.js +0 -90
- package/bin/live-build-path.js +0 -18
|
@@ -9,6 +9,9 @@ function resolveTuiRenderer(requested, envValue = process.env.ORBH_TUI_RENDERER)
|
|
|
9
9
|
return "opentui";
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
// ../orbh-cli/src/tui/browse-return.ts
|
|
13
|
+
var BROWSE_COMMAND_NAME = "browse";
|
|
14
|
+
|
|
12
15
|
// ../orbh-cli/src/open-tui-invocation.ts
|
|
13
16
|
function rendererArg(args) {
|
|
14
17
|
let requested;
|
|
@@ -19,29 +22,39 @@ function rendererArg(args) {
|
|
|
19
22
|
}
|
|
20
23
|
return requested;
|
|
21
24
|
}
|
|
22
|
-
|
|
23
|
-
function isAttachChromeRoute(invocation) {
|
|
25
|
+
function shouldEnableOpenTuiFfi(invocation) {
|
|
24
26
|
if (!invocation.stdinTty || !invocation.stdoutTty) return false;
|
|
25
|
-
if (invocation.
|
|
27
|
+
if (invocation.cli === "flint" && invocation.args[0] === BROWSE_COMMAND_NAME) {
|
|
28
|
+
return !invocation.args.some((arg) => ["--help", "-h"].includes(arg));
|
|
29
|
+
}
|
|
30
|
+
if (invocation.cli === "flint" && invocation.args[0] === "orbtest") {
|
|
31
|
+
const separator2 = invocation.args.indexOf("--");
|
|
32
|
+
const options2 = separator2 < 0 ? invocation.args : invocation.args.slice(0, separator2);
|
|
33
|
+
if (options2.length === 1) return true;
|
|
34
|
+
return options2[1] === "view" && !options2.some((arg) => ["--print", "--help", "-h"].includes(arg));
|
|
35
|
+
}
|
|
26
36
|
const args = invocation.cli === "orbh" ? invocation.args : invocation.args[0] === "orbh" ? invocation.args.slice(1) : null;
|
|
27
|
-
if (!args
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
if (!args) return false;
|
|
38
|
+
const separator = args.indexOf("--");
|
|
39
|
+
const options = separator < 0 ? args : args.slice(0, separator);
|
|
40
|
+
if (options.some((arg) => ["--help", "-h", "--json", "--print", "--orbh-internal-manager"].includes(arg))) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
const route = options[0];
|
|
44
|
+
if (route === "i" || route === "interactive") {
|
|
45
|
+
return !options.includes("--plain") && !options.includes("--no-detach");
|
|
46
|
+
}
|
|
47
|
+
if (route === "attach") return !options.includes("--plain");
|
|
48
|
+
if (route === "continue" || route === "c" || route === "watch") return true;
|
|
49
|
+
if (route === "fork") return options.includes("--attach");
|
|
50
|
+
if (route === "orchestrator" || route === "orch") {
|
|
51
|
+
return (options[1] === "managers" || options[1] === "ls") && (options.includes("-i") || options.includes("--interactive"));
|
|
52
|
+
}
|
|
53
|
+
if (route === "claude") {
|
|
54
|
+
return options[1] === "list" && (options.includes("-i") || options.includes("--interactive"));
|
|
55
|
+
}
|
|
56
|
+
if (route !== void 0 && !["tui", "v", "list", "active"].includes(route)) return false;
|
|
57
|
+
const requested = route === "tui" || route === "v" ? rendererArg(options.slice(1)) : void 0;
|
|
45
58
|
if (requested === "ink") return false;
|
|
46
59
|
if (requested === void 0 && invocation.envRenderer?.trim().toLowerCase() === "ink") return false;
|
|
47
60
|
return resolveTuiRenderer(requested, invocation.envRenderer) === "opentui";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuucognition/flint-cli",
|
|
3
|
-
"version": "0.6.0-dev.
|
|
3
|
+
"version": "0.6.0-dev.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Flint cognitive workspace CLI",
|
|
6
6
|
"license": "PROPRIETARY",
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"yaml": "^2.6.0"
|
|
28
28
|
},
|
|
29
29
|
"optionalDependencies": {
|
|
30
|
-
"node-pty": "1.1.0"
|
|
30
|
+
"node-pty": "1.1.0",
|
|
31
|
+
"playwright": "^1.50.0"
|
|
31
32
|
},
|
|
32
33
|
"engines": {
|
|
33
34
|
"node": ">=26.1"
|
|
@@ -35,19 +36,23 @@
|
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@nuucognition/cli-core": "link:../../../main/packages/cli-core",
|
|
37
38
|
"@nuucognition/nuu-cli": "link:../../../main/apps/cli-nuu",
|
|
38
|
-
"@types/node": "^24.
|
|
39
|
+
"@types/node": "^24.13.2",
|
|
39
40
|
"eslint": "^9.32.0",
|
|
40
41
|
"tsup": "^8.3.5",
|
|
41
42
|
"tsx": "^4.19.2",
|
|
42
43
|
"typescript": "5.9.3",
|
|
43
|
-
"@nuucognition/
|
|
44
|
+
"@nuucognition/entity": "1.0.0",
|
|
44
45
|
"@nuucognition/flint": "0.1.0",
|
|
45
46
|
"@nuucognition/flint-mcp": "0.1.0",
|
|
46
47
|
"@nuucognition/flint-migrations": "0.1.0",
|
|
47
|
-
"@nuucognition/flint-sdk": "0.1.0",
|
|
48
48
|
"@nuucognition/flint-server": "0.1.0",
|
|
49
|
+
"@nuucognition/flint-sdk": "0.1.0",
|
|
49
50
|
"@nuucognition/orbh": "0.0.1-dev.0",
|
|
51
|
+
"@nuucognition/orbtest-cli": "0.1.0",
|
|
50
52
|
"@nuucognition/orbh-cli": "0.1.0-dev.1",
|
|
53
|
+
"@nuucognition/orbtest-agent-orbh": "0.1.0",
|
|
54
|
+
"@nuucognition/places": "1.0.0",
|
|
55
|
+
"@nuucognition/orbtest-source-postgres": "0.1.0",
|
|
51
56
|
"@nuucognition/eslint-config": "0.0.0",
|
|
52
57
|
"@nuucognition/blacksmith-cli": "0.0.1",
|
|
53
58
|
"@nuucognition/typescript-config": "0.0.0"
|
|
@@ -68,7 +73,7 @@
|
|
|
68
73
|
"clean": "rm -rf dist",
|
|
69
74
|
"typecheck": "tsc --noEmit",
|
|
70
75
|
"lint": "eslint .",
|
|
71
|
-
"test": "
|
|
76
|
+
"test": "node ../../scripts/tests-disabled.mjs",
|
|
72
77
|
"postinstall": "node ./scripts/fix-node-pty-perms.mjs",
|
|
73
78
|
"test-pack": "../../scripts/test-pack.sh"
|
|
74
79
|
}
|
package/bin/flint.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { existsSync } from 'node:fs';
|
|
4
|
-
import { spawnSync } from 'node:child_process';
|
|
5
|
-
import { fileURLToPath } from 'node:url';
|
|
6
|
-
import { dirname, join } from 'node:path';
|
|
7
|
-
import { resolveLiveBuildPackageRoot } from './live-build-path.js';
|
|
8
|
-
|
|
9
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
-
const sourcePackageRoot = join(__dirname, '..');
|
|
11
|
-
const runtimePackageRoot = resolveLiveBuildPackageRoot(sourcePackageRoot);
|
|
12
|
-
const openTuiInvocationEntry = join(runtimePackageRoot, 'dist', 'open-tui-invocation.js');
|
|
13
|
-
const { shouldEnableOpenTuiFfi } = await import(openTuiInvocationEntry);
|
|
14
|
-
|
|
15
|
-
const openTuiRequested = shouldEnableOpenTuiFfi({
|
|
16
|
-
cli: 'flint',
|
|
17
|
-
args: process.argv.slice(2),
|
|
18
|
-
envRenderer: process.env.ORBH_TUI_RENDERER,
|
|
19
|
-
envNoChrome: process.env.ORBH_NO_CHROME,
|
|
20
|
-
stdinTty: Boolean(process.stdin.isTTY),
|
|
21
|
-
stdoutTty: Boolean(process.stdout.isTTY),
|
|
22
|
-
});
|
|
23
|
-
const [nodeMajor = 0, nodeMinor = 0] = process.versions.node.split('.').map(Number);
|
|
24
|
-
const ffiSupported = nodeMajor > 26 || (nodeMajor === 26 && nodeMinor >= 1);
|
|
25
|
-
const ffiFlag = '--experimental-ffi';
|
|
26
|
-
if (openTuiRequested && ffiSupported
|
|
27
|
-
&& !process.execArgv.includes(ffiFlag)
|
|
28
|
-
&& !process.env.NODE_OPTIONS?.split(/\s+/).includes(ffiFlag)
|
|
29
|
-
&& process.execve) {
|
|
30
|
-
const options = new Set(process.env.NODE_OPTIONS?.split(/\s+/).filter(Boolean) ?? []);
|
|
31
|
-
for (const option of [ffiFlag, '--disable-warning=ExperimentalWarning', '--disable-warning=DEP0205']) options.add(option);
|
|
32
|
-
process.execve(process.execPath, process.argv, {
|
|
33
|
-
...process.env,
|
|
34
|
-
NODE_OPTIONS: [...options].join(' '),
|
|
35
|
-
ORBH_TUI_FFI_REEXEC: '1',
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const srcEntry = join(__dirname, '..', 'src', 'index.ts');
|
|
40
|
-
const distEntry = join(runtimePackageRoot, 'dist', 'index.js');
|
|
41
|
-
|
|
42
|
-
// Default to production React/ink. Unset NODE_ENV loads react-reconciler's
|
|
43
|
-
// development build, whose per-render performance.measure() calls accumulate
|
|
44
|
-
// forever in Node's perf buffer — a ~1GB/hour leak in long-lived interactive
|
|
45
|
-
// views like `orbh list`. Explicit NODE_ENV=development still wins.
|
|
46
|
-
process.env.NODE_ENV ||= 'production';
|
|
47
|
-
|
|
48
|
-
// Performance: prefer the built dist and run it IN-PROCESS (one node process,
|
|
49
|
-
// no tsx, no recompile-on-every-invocation). `flint orbh i` previously spawned
|
|
50
|
-
// `node bin/flint.js` -> `tsx` -> `tsx loader (compiling src/index.ts)` -> agent,
|
|
51
|
-
// i.e. 3 node processes + a TypeScript compile per launch. Running the prebuilt
|
|
52
|
-
// dist in-process collapses that to a single node process with zero compile cost.
|
|
53
|
-
// Set FLINT_CLI_FORCE_SOURCE=1 to fall back to running the TypeScript source via
|
|
54
|
-
// tsx (the dev workflow where you edit src/ without rebuilding).
|
|
55
|
-
const forceSource =
|
|
56
|
-
process.env.FLINT_CLI_FORCE_SOURCE === '1' ||
|
|
57
|
-
process.env.FLINT_CLI_FORCE_SOURCE === 'true';
|
|
58
|
-
|
|
59
|
-
if (!forceSource && existsSync(distEntry)) {
|
|
60
|
-
process.env.FLINT_CLI_LAUNCHER = fileURLToPath(import.meta.url);
|
|
61
|
-
process.env.FLINT_CLI_ENTRYPOINT = distEntry;
|
|
62
|
-
// The dist entry parses process.argv and runs the CLI on import. Awaiting keeps
|
|
63
|
-
// the launcher process alive for the CLI's async work (incl. interactive `orbh i`,
|
|
64
|
-
// which blocks on the child process's exit event — no polling, no extra wrapper).
|
|
65
|
-
await import(distEntry);
|
|
66
|
-
} else {
|
|
67
|
-
// Dev fallback: run the TypeScript source via tsx in a subprocess.
|
|
68
|
-
const tsxPath = join(__dirname, '..', 'node_modules', '.bin', 'tsx');
|
|
69
|
-
|
|
70
|
-
// tsx still calls the deprecated module.register(); Node 26 turned DEP0205 into a
|
|
71
|
-
// runtime warning. Disable it just for the spawned subprocess, preserving any
|
|
72
|
-
// NODE_OPTIONS the user already set. Remove once tsx migrates to module.registerHooks().
|
|
73
|
-
const SUPPRESS_FLAG = '--disable-warning=DEP0205';
|
|
74
|
-
const existingNodeOptions = process.env.NODE_OPTIONS ?? '';
|
|
75
|
-
const nodeOptions = existingNodeOptions.includes(SUPPRESS_FLAG)
|
|
76
|
-
? existingNodeOptions
|
|
77
|
-
: (existingNodeOptions ? `${existingNodeOptions} ${SUPPRESS_FLAG}` : SUPPRESS_FLAG);
|
|
78
|
-
|
|
79
|
-
const result = spawnSync(tsxPath, [srcEntry, ...process.argv.slice(2)], {
|
|
80
|
-
stdio: 'inherit',
|
|
81
|
-
env: {
|
|
82
|
-
...process.env,
|
|
83
|
-
NODE_OPTIONS: nodeOptions,
|
|
84
|
-
FLINT_CLI_LAUNCHER: fileURLToPath(import.meta.url),
|
|
85
|
-
FLINT_CLI_ENTRYPOINT: srcEntry,
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
process.exit(result.status ?? 0);
|
|
90
|
-
}
|
package/bin/live-build-path.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
|
-
import { join, resolve } from 'node:path';
|
|
3
|
-
|
|
4
|
-
const hasCompleteDist = (packageRoot) =>
|
|
5
|
-
existsSync(join(packageRoot, 'dist', 'index.js')) &&
|
|
6
|
-
existsSync(join(packageRoot, 'dist', 'open-tui-invocation.js'));
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Source launchers prefer the atomically selected standalone release. A launcher
|
|
10
|
-
* inside a deployed/npm package has no checkout-level pointer and uses its own
|
|
11
|
-
* dist directory instead.
|
|
12
|
-
*/
|
|
13
|
-
export function resolveLiveBuildPackageRoot(sourcePackageRoot) {
|
|
14
|
-
const checkoutRoot = resolve(sourcePackageRoot, '..', '..');
|
|
15
|
-
const currentRelease = join(checkoutRoot, '.flint-live-build', 'current');
|
|
16
|
-
|
|
17
|
-
return hasCompleteDist(currentRelease) ? currentRelease : sourcePackageRoot;
|
|
18
|
-
}
|