@cydm/pie 1.0.51 → 2.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/README.md +32 -15
- package/dist/builtin/extensions/ask-user/index.js +4 -3
- package/dist/builtin/extensions/ask-user/package.json +8 -7
- package/dist/builtin/extensions/changelog/package.json +9 -9
- package/dist/builtin/extensions/computer-use/index.js +5466 -0
- package/dist/builtin/extensions/computer-use/package.json +11 -0
- package/dist/builtin/extensions/computer-use/prebuilt/linux/arm64/linux-bridge +0 -0
- package/dist/builtin/extensions/computer-use/prebuilt/linux/x64/linux-bridge +0 -0
- package/dist/builtin/extensions/computer-use/prebuilt/macos/arm64/pie-computer-use +0 -0
- package/dist/builtin/extensions/computer-use/prebuilt/macos/universal/pie-computer-use.app/Contents/Info.plist +24 -0
- package/dist/builtin/extensions/computer-use/prebuilt/macos/universal/pie-computer-use.app/Contents/MacOS/pie-computer-use +0 -0
- package/dist/builtin/extensions/computer-use/prebuilt/macos/universal/pie-computer-use.app/Contents/_CodeSignature/CodeResources +115 -0
- package/dist/builtin/extensions/computer-use/prebuilt/macos/x64/pie-computer-use +0 -0
- package/dist/builtin/extensions/computer-use/prebuilt/windows/windows-bridge.exe +0 -0
- package/dist/builtin/extensions/computer-use/scripts/build-native.mjs +277 -0
- package/dist/builtin/extensions/computer-use/scripts/helper-path.mjs +48 -0
- package/dist/builtin/extensions/computer-use/scripts/setup-helper.mjs +549 -0
- package/dist/builtin/extensions/document-attachments/package.json +9 -9
- package/dist/builtin/extensions/init/package.json +9 -9
- package/dist/builtin/extensions/mcp-adapter/index.js +25250 -0
- package/dist/builtin/extensions/mcp-adapter/package.json +11 -0
- package/dist/builtin/extensions/plan-mode/index.js +4 -3
- package/dist/builtin/extensions/plan-mode/package.json +9 -9
- package/dist/builtin/extensions/subagent/index.js +6 -4
- package/dist/builtin/extensions/subagent/package.json +16 -12
- package/dist/builtin/extensions/todo/index.js +4 -3
- package/dist/builtin/extensions/todo/package.json +9 -9
- package/dist/builtin/skills/chrome-devtools-axi/CHANGELOG.md +5 -0
- package/dist/builtin/skills/chrome-devtools-axi/README.md +17 -0
- package/dist/builtin/skills/chrome-devtools-axi/SKILL.md +31 -0
- package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-cli.js +77 -0
- package/dist/builtin/skills/chrome-devtools-axi/package.json +12 -0
- package/dist/builtin/skills/tui-use/README.md +7 -0
- package/dist/builtin/skills/tui-use/SKILL.md +58 -0
- package/dist/chunks/chunk-5353DEEC.js +130 -0
- package/dist/chunks/{chunk-KDPAGHYY.js → chunk-G2POWIA5.js} +129 -194
- package/dist/chunks/{chunk-S2J3SZZX.js → chunk-IM43UYVV.js} +827 -3385
- package/dist/chunks/{chunk-A644H2XX.js → chunk-PMPD56N2.js} +159 -72
- package/dist/chunks/{chunk-B3SMW2XW.js → chunk-QJH6YN2W.js} +1 -1
- package/dist/chunks/chunk-XXGYUYXI.js +2718 -0
- package/dist/chunks/{src-UKCIAX6F.js → src-QSP2OPHU.js} +3 -2
- package/dist/chunks/{test-stream-NCBFPM2I.js → test-stream-CVGWFLSX.js} +2 -1
- package/dist/chunks/webapi-MBCKO7ZV.js +2481 -0
- package/dist/cli.js +149 -68
- package/package.json +5 -4
- package/dist/builtin/skills/browser-tools/CHANGELOG.md +0 -5
- package/dist/builtin/skills/browser-tools/README.md +0 -17
- package/dist/builtin/skills/browser-tools/SKILL.md +0 -43
- package/dist/builtin/skills/browser-tools/package.json +0 -12
- package/dist/builtin/skills/browser-tools/playwright-cli.js +0 -45
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pie/extension-mcp-adapter",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Token-efficient MCP adapter: one proxy tool instead of N tool definitions; lazy server startup; trust-gated project configs. Design ported from pi-mcp-adapter (MIT), self-maintained by Pie.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"pie": {
|
|
8
|
+
"name": "mcp-adapter",
|
|
9
|
+
"main": "index.js"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -7,11 +7,12 @@ import {
|
|
|
7
7
|
isPlanModeSafeCommand,
|
|
8
8
|
markCompletedPlanSteps,
|
|
9
9
|
restoreExecutionState
|
|
10
|
-
} from "../../../chunks/chunk-
|
|
11
|
-
import "../../../chunks/chunk-
|
|
10
|
+
} from "../../../chunks/chunk-PMPD56N2.js";
|
|
11
|
+
import "../../../chunks/chunk-QJH6YN2W.js";
|
|
12
|
+
import "../../../chunks/chunk-IM43UYVV.js";
|
|
12
13
|
import {
|
|
13
14
|
Type
|
|
14
|
-
} from "../../../chunks/chunk-
|
|
15
|
+
} from "../../../chunks/chunk-XXGYUYXI.js";
|
|
15
16
|
import "../../../chunks/chunk-LZQXQOPJ.js";
|
|
16
17
|
|
|
17
18
|
// builtin/extensions/plan-mode/index.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
"name": "plan-mode-extension",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Plan Mode Extension for Pie - Read-only exploration mode with plan tracking",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"pie": {
|
|
8
|
+
"name": "plan-mode",
|
|
9
|
+
"main": "index.js"
|
|
10
|
+
}
|
|
11
11
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
createCliHostCapabilities
|
|
4
|
-
} from "../../../chunks/chunk-
|
|
4
|
+
} from "../../../chunks/chunk-G2POWIA5.js";
|
|
5
|
+
import "../../../chunks/chunk-5353DEEC.js";
|
|
5
6
|
import {
|
|
6
7
|
createSharedFileSystemTools,
|
|
7
8
|
createSubagentCapability
|
|
8
|
-
} from "../../../chunks/chunk-
|
|
9
|
-
import "../../../chunks/chunk-
|
|
10
|
-
import "../../../chunks/chunk-
|
|
9
|
+
} from "../../../chunks/chunk-PMPD56N2.js";
|
|
10
|
+
import "../../../chunks/chunk-QJH6YN2W.js";
|
|
11
|
+
import "../../../chunks/chunk-IM43UYVV.js";
|
|
12
|
+
import "../../../chunks/chunk-XXGYUYXI.js";
|
|
11
13
|
import "../../../chunks/chunk-LZQXQOPJ.js";
|
|
12
14
|
|
|
13
15
|
// builtin/extensions/subagent/index.ts
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
"name": "@pie/extension-subagent",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Spawn child agents for isolated task handling",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"pie": {
|
|
8
|
+
"name": "subagent",
|
|
9
|
+
"main": "index.js"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"pie",
|
|
13
|
+
"extension",
|
|
14
|
+
"subagent"
|
|
15
|
+
],
|
|
16
|
+
"author": "Pie Team",
|
|
17
|
+
"license": "MIT"
|
|
14
18
|
}
|
|
@@ -8,9 +8,10 @@ import {
|
|
|
8
8
|
executeManageTodoList,
|
|
9
9
|
executionStateToTodos,
|
|
10
10
|
restoreExecutionState
|
|
11
|
-
} from "../../../chunks/chunk-
|
|
12
|
-
import "../../../chunks/chunk-
|
|
13
|
-
import "../../../chunks/chunk-
|
|
11
|
+
} from "../../../chunks/chunk-PMPD56N2.js";
|
|
12
|
+
import "../../../chunks/chunk-QJH6YN2W.js";
|
|
13
|
+
import "../../../chunks/chunk-IM43UYVV.js";
|
|
14
|
+
import "../../../chunks/chunk-XXGYUYXI.js";
|
|
14
15
|
import "../../../chunks/chunk-LZQXQOPJ.js";
|
|
15
16
|
|
|
16
17
|
// builtin/extensions/todo/index.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
"name": "@pie/extension-todo",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Todo list management tool",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"pie": {
|
|
8
|
+
"name": "todo",
|
|
9
|
+
"main": "index.js"
|
|
10
|
+
}
|
|
11
11
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# chrome-devtools-axi
|
|
2
|
+
|
|
3
|
+
Pie's chrome-devtools-axi skill is backed by the `chrome-devtools-axi` npm package (AXI-compliant chrome-devtools-mcp wrapper driving real Chrome over CDP) through `chrome-devtools-axi-cli.js`.
|
|
4
|
+
|
|
5
|
+
Use:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
node chrome-devtools-axi-cli.js --help
|
|
9
|
+
node chrome-devtools-axi-cli.js open https://example.com
|
|
10
|
+
node chrome-devtools-axi-cli.js snapshot
|
|
11
|
+
node chrome-devtools-axi-cli.js screenshot /tmp/page.png
|
|
12
|
+
node chrome-devtools-axi-cli.js console
|
|
13
|
+
node chrome-devtools-axi-cli.js network
|
|
14
|
+
node chrome-devtools-axi-cli.js stop
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Dependencies are provided by `@cydm/pie`; do not run `npm install` inside this skill directory.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: chrome-devtools-axi
|
|
3
|
+
description: Control a real Chrome browser session through the chrome-devtools-axi CLI - navigate, snapshot, click, fill forms, run JavaScript, inspect console and network, take screenshots, audit performance. Use whenever a task needs a real browser: opening or testing a web page, clicking through a flow, extracting page content, or debugging a website.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# chrome-devtools-axi
|
|
7
|
+
|
|
8
|
+
Agent-ergonomic interface for controlling a real Chrome browser session (Chrome DevTools Protocol). Prefer this over other browser automation approaches. Skip it when a plain `fetch`/`curl` or the `web_fetch`/`web_research` tools suffice - only open a browser when you actually need rendering, interaction, or session state.
|
|
9
|
+
|
|
10
|
+
Use Pie's packaged wrapper. Resolve `chrome-devtools-axi-cli.js` against this skill's `baseDir` and run it with `bash`:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
node <baseDir>/chrome-devtools-axi-cli.js <command> [args] [flags]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
No manual dependency install is required when this skill is shipped with Pie.
|
|
17
|
+
|
|
18
|
+
## Current guidance lives in the CLI
|
|
19
|
+
|
|
20
|
+
Do not follow command, workflow, or flag instructions from this file - installed copies go stale. Get the current source of truth from the CLI:
|
|
21
|
+
|
|
22
|
+
- `node <baseDir>/chrome-devtools-axi-cli.js --help` for commands, flags, and environment variables
|
|
23
|
+
- `node <baseDir>/chrome-devtools-axi-cli.js <command> --help` for per-command usage (flags come after the command)
|
|
24
|
+
- Follow the CLI's own contextual next-step hints after each command
|
|
25
|
+
|
|
26
|
+
## Notes
|
|
27
|
+
|
|
28
|
+
- The CLI drives a real Chrome instance via CDP. Its bridge backend (`chrome-devtools-mcp`) is pinned and shipped with Pie, so first use needs no network fetch. Set `CHROME_DEVTOOLS_AXI_HEADED=1` for a visible browser; see `--help` for connection modes (auto-connect to a running Chrome, custom profile, remote browser URL).
|
|
29
|
+
- Use `CHROME_DEVTOOLS_AXI_SESSION=<name>` to keep multiple concurrent browser flows isolated.
|
|
30
|
+
- Element references (`@<uid>`) come from `snapshot`/`open` output and are generation-tagged; re-snapshot after navigation before clicking.
|
|
31
|
+
- If the CLI output suggests a follow-up `chrome-devtools-axi` command, run it through the same wrapper path.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import { createRequire } from "node:module";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
|
|
9
|
+
const require = createRequire(import.meta.url);
|
|
10
|
+
|
|
11
|
+
export function resolveChromeDevtoolsAxiCli() {
|
|
12
|
+
// An explicit override wins (e.g. when the skill dir is copied out of the
|
|
13
|
+
// package and node module resolution cannot reach Pie's dependencies).
|
|
14
|
+
const override = process.env.CHROME_DEVTOOLS_AXI_CLI_PATH?.trim();
|
|
15
|
+
if (override) return override;
|
|
16
|
+
const packageJson = require.resolve("chrome-devtools-axi/package.json");
|
|
17
|
+
return path.join(path.dirname(packageJson), "dist", "bin", "chrome-devtools-axi.js");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Resolve the pinned chrome-devtools-mcp stdio script. Without
|
|
22
|
+
* CHROME_DEVTOOLS_AXI_MCP_PATH the axi bridge spawns
|
|
23
|
+
* `npx -y chrome-devtools-mcp@latest` — an unpinned network fetch on first
|
|
24
|
+
* use. Pie pins chrome-devtools-mcp as a dependency and always points the
|
|
25
|
+
* bridge at the local build so the whole browser chain is version-locked
|
|
26
|
+
* and works offline after install.
|
|
27
|
+
*/
|
|
28
|
+
export function resolveChromeDevtoolsMcpScript() {
|
|
29
|
+
const packageJson = require.resolve("chrome-devtools-mcp/package.json");
|
|
30
|
+
return path.join(path.dirname(packageJson), "build", "src", "bin", "chrome-devtools-mcp.js");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function runChromeDevtoolsAxiCli(args = process.argv.slice(2), options = {}) {
|
|
34
|
+
const bin = resolveChromeDevtoolsAxiCli();
|
|
35
|
+
return spawnSync(process.execPath, [bin, ...args], {
|
|
36
|
+
stdio: "inherit",
|
|
37
|
+
shell: false,
|
|
38
|
+
...options,
|
|
39
|
+
env: {
|
|
40
|
+
...process.env,
|
|
41
|
+
CHROME_DEVTOOLS_AXI_MCP_PATH: process.env.CHROME_DEVTOOLS_AXI_MCP_PATH?.trim() || resolveChromeDevtoolsMcpScript(),
|
|
42
|
+
// Pie pins chrome-devtools-mcp; its daily background update check
|
|
43
|
+
// (network + ~/.cache write + "install @latest" nag) stays off unless
|
|
44
|
+
// the environment or caller explicitly provides a value.
|
|
45
|
+
CHROME_DEVTOOLS_MCP_NO_UPDATE_CHECKS: process.env.CHROME_DEVTOOLS_MCP_NO_UPDATE_CHECKS || "1",
|
|
46
|
+
...options.env,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function normalizeDirectEntryPath(candidate) {
|
|
52
|
+
const resolved = path.resolve(candidate);
|
|
53
|
+
const real = fs.realpathSync.native(resolved);
|
|
54
|
+
const normalized = path.normalize(real);
|
|
55
|
+
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function isDirectEntry(moduleUrl = import.meta.url, argvPath = process.argv[1]) {
|
|
59
|
+
if (!argvPath) return false;
|
|
60
|
+
try {
|
|
61
|
+
const modulePath = normalizeDirectEntryPath(fileURLToPath(moduleUrl));
|
|
62
|
+
const entryPath = normalizeDirectEntryPath(argvPath);
|
|
63
|
+
return modulePath === entryPath;
|
|
64
|
+
} catch {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (isDirectEntry()) {
|
|
70
|
+
try {
|
|
71
|
+
const result = runChromeDevtoolsAxiCli();
|
|
72
|
+
process.exitCode = result.status ?? 1;
|
|
73
|
+
} catch (error) {
|
|
74
|
+
console.error(`chrome-devtools-axi CLI could not be resolved from Pie's installed dependencies. Run this wrapper from Pie's package location, or set CHROME_DEVTOOLS_AXI_CLI_PATH to the CLI's dist/bin/chrome-devtools-axi.js. (${error instanceof Error ? error.message : String(error)})`);
|
|
75
|
+
process.exitCode = 1;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "chrome-devtools-axi",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "chrome-devtools-axi wrapper for real-Chrome browser automation",
|
|
6
|
+
"author": "",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"private": true,
|
|
9
|
+
"pie": {
|
|
10
|
+
"dependenciesProvidedBy": "@cydm/pie"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# tui-use
|
|
2
|
+
|
|
3
|
+
Zero-bundle skill: Pie ships only this SKILL.md. The `tui-use` CLI is fetched on demand via `npx -y --install-strategy=nested tui-use@0.1.20` (the version tag in SKILL.md is the lock mechanism; upgrading means editing that one line).
|
|
4
|
+
|
|
5
|
+
Use it for stateful interactive terminal sessions - REPLs, pdb/gdb debuggers, full-screen TUI apps - that one-shot `bash` commands cannot drive. Prefer plain `bash` for anything non-interactive.
|
|
6
|
+
|
|
7
|
+
First invocation installs the PTY runtime into `~/.tui-use` (network + delay expected). Windows ConPTY is not officially verified by upstream.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tui-use
|
|
3
|
+
description: Drive interactive terminal programs (REPLs, pdb/gdb debuggers, full-screen TUI apps) through a PTY - read the screen as text, send keystrokes, wait for output. Use when a task needs a stateful interactive session that one-shot bash commands cannot handle.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# tui-use
|
|
7
|
+
|
|
8
|
+
tui-use lets you interact with programs that expect a human at the keyboard: REPLs, interactive debuggers (pdb, gdb, node inspect), and full-screen TUI apps (vim, htop, lazygit, fzf). It spawns the program in a PTY, renders the screen through a headless terminal emulator, and exposes read-screen / send-keys / wait primitives.
|
|
9
|
+
|
|
10
|
+
**When NOT to use this skill:** if a one-shot `bash` command can do the job (run a script, get output, exit), use `bash` directly. tui-use is for stateful sessions: a debugger stopped at a breakpoint, a Python interpreter with expensive in-memory state, an interactive rebase, a menu-driven TUI.
|
|
11
|
+
|
|
12
|
+
## Invocation
|
|
13
|
+
|
|
14
|
+
Always invoke through `npx` with the pinned version and the nested install strategy. The version tag is the lock mechanism; do not drop it.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npx -y --install-strategy=nested tui-use@0.1.20 <command>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The examples below write `tui-use` for brevity - always substitute the full `npx -y --install-strategy=nested tui-use@0.1.20` prefix.
|
|
21
|
+
|
|
22
|
+
**`--install-strategy=nested` is required, not optional.** tui-use@0.1.20's postinstall probes `<tui-use>/node_modules/node-pty`, which only exists when node-pty is nested; with npm's default hoisting the postinstall fails and the whole npx invocation dies silently (exit 1, no output). Nesting makes the installer find its PTY runtime.
|
|
23
|
+
|
|
24
|
+
First invocation installs the PTY runtime and starts a background daemon that keeps sessions alive between CLI calls (session state lives in `~/.tui-use`) - expect network access and some delay on the first call.
|
|
25
|
+
|
|
26
|
+
## Core loop
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
tui-use start <cmd> # Start a program (quote the whole command to pass flags)
|
|
30
|
+
tui-use wait # Block until the screen stabilizes (or: wait --text ">>>")
|
|
31
|
+
tui-use snapshot # Read the current screen as plain text
|
|
32
|
+
tui-use type "<text>\n" # Type text (\n = Enter, \t = Tab)
|
|
33
|
+
tui-use press <key> # Press a special key (enter, tab, escape, arrows, ctrl+c, ...)
|
|
34
|
+
tui-use kill # Kill the current session
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- `snapshot` output includes `screen` (clean plain text), `highlights` (inverse-video spans = the selected menu item/tab), `title`, and `is_fullscreen`. Use `--format json` for machine-readable output.
|
|
38
|
+
- `wait` is the synchronization primitive: it resolves after the screen has been stable for a debounce window - never guess with `sleep`. Prefer `wait --text <pattern>` when you know the prompt/marker you are waiting for.
|
|
39
|
+
- Useful extras: `paste` (multi-line input), `find <regex>` (search the screen), `scrollup <lines>`/`scrolldown <lines>`, `list`/`use`/`rename` (multiple sessions), `start --cwd <dir> --cols <n> --rows <n>`.
|
|
40
|
+
- Run `npx -y --install-strategy=nested tui-use@0.1.20 --help` or `<command> --help` for the current authoritative command list; this file intentionally does not mirror full CLI docs.
|
|
41
|
+
|
|
42
|
+
## Workflow example (debugging)
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
tui-use start "python3 -m pdb app.py"
|
|
46
|
+
tui-use wait --text "(Pdb)"
|
|
47
|
+
tui-use type "b 42\n"; tui-use wait
|
|
48
|
+
tui-use type "c\n"; tui-use wait --text "(Pdb)"
|
|
49
|
+
tui-use type "p my_var\n"; tui-use wait
|
|
50
|
+
tui-use snapshot
|
|
51
|
+
tui-use kill
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Platform notes
|
|
55
|
+
|
|
56
|
+
- macOS and Windows ship prebuilt PTY binaries. On Linux the first invocation compiles node-pty from source (needs python3, make, g++/build-essential; slim containers may fail).
|
|
57
|
+
- Windows ships prebuilt binaries but ConPTY behavior is not officially verified - if something misbehaves, check `--help` and `tui-use daemon status` / `daemon restart` first.
|
|
58
|
+
- Sessions live in a daemon; if state looks stale, `tui-use list` to inspect and `tui-use daemon restart` as a last resort (kills all sessions).
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/config.ts
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, renameSync } from "fs";
|
|
5
|
+
import { homedir } from "os";
|
|
6
|
+
import { dirname, join } from "path";
|
|
7
|
+
import { fileURLToPath } from "url";
|
|
8
|
+
var __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
var __dirname = dirname(__filename);
|
|
10
|
+
var isBunRuntime = !!process.versions.bun;
|
|
11
|
+
function getPackageDir() {
|
|
12
|
+
const envDir = process.env.PIE_PACKAGE_DIR;
|
|
13
|
+
if (envDir) {
|
|
14
|
+
if (envDir === "~") return homedir();
|
|
15
|
+
if (envDir.startsWith("~/")) return homedir() + envDir.slice(1);
|
|
16
|
+
return envDir;
|
|
17
|
+
}
|
|
18
|
+
let dir = __dirname;
|
|
19
|
+
while (dir !== dirname(dir)) {
|
|
20
|
+
if (existsSync(join(dir, "package.json"))) {
|
|
21
|
+
return dir;
|
|
22
|
+
}
|
|
23
|
+
dir = dirname(dir);
|
|
24
|
+
}
|
|
25
|
+
return __dirname;
|
|
26
|
+
}
|
|
27
|
+
function getThemesDir() {
|
|
28
|
+
const packageDir = getPackageDir();
|
|
29
|
+
const srcOrDist = existsSync(join(packageDir, "src")) ? "src" : "dist";
|
|
30
|
+
return join(packageDir, srcOrDist, "theme");
|
|
31
|
+
}
|
|
32
|
+
function getBuiltinDir() {
|
|
33
|
+
const packageDir = getPackageDir();
|
|
34
|
+
const distBuiltinDir = join(packageDir, "dist", "builtin");
|
|
35
|
+
if (existsSync(distBuiltinDir)) {
|
|
36
|
+
return distBuiltinDir;
|
|
37
|
+
}
|
|
38
|
+
return join(packageDir, "builtin");
|
|
39
|
+
}
|
|
40
|
+
function getPackageJsonPath() {
|
|
41
|
+
return join(getPackageDir(), "package.json");
|
|
42
|
+
}
|
|
43
|
+
var pkg = JSON.parse(readFileSync(getPackageJsonPath(), "utf-8"));
|
|
44
|
+
var CONFIG_DIR_NAME = ".pie";
|
|
45
|
+
var VERSION = pkg.version;
|
|
46
|
+
var ENV_AGENT_DIR = "PIE_CODING_AGENT_DIR";
|
|
47
|
+
function getConfigDir() {
|
|
48
|
+
const envDir = process.env[ENV_AGENT_DIR];
|
|
49
|
+
if (envDir) {
|
|
50
|
+
if (envDir === "~") return homedir();
|
|
51
|
+
if (envDir.startsWith("~/")) return homedir() + envDir.slice(1);
|
|
52
|
+
return envDir;
|
|
53
|
+
}
|
|
54
|
+
return join(homedir(), CONFIG_DIR_NAME);
|
|
55
|
+
}
|
|
56
|
+
function getAgentDir() {
|
|
57
|
+
return getConfigDir();
|
|
58
|
+
}
|
|
59
|
+
function getCustomThemesDir() {
|
|
60
|
+
return join(getConfigDir(), "themes");
|
|
61
|
+
}
|
|
62
|
+
function getSettingsPath() {
|
|
63
|
+
return join(getConfigDir(), "settings.json");
|
|
64
|
+
}
|
|
65
|
+
function getProjectSettingsPath(cwd) {
|
|
66
|
+
return join(cwd, CONFIG_DIR_NAME, "settings.json");
|
|
67
|
+
}
|
|
68
|
+
function getSessionsDir() {
|
|
69
|
+
return join(getConfigDir(), "sessions");
|
|
70
|
+
}
|
|
71
|
+
function getLogsDir() {
|
|
72
|
+
return join(getConfigDir(), "logs");
|
|
73
|
+
}
|
|
74
|
+
function getRuntimeLogPath() {
|
|
75
|
+
return join(getLogsDir(), "pie-cli.log");
|
|
76
|
+
}
|
|
77
|
+
function migrateConfigFromAgentDir() {
|
|
78
|
+
const oldAgentDir = join(homedir(), CONFIG_DIR_NAME, "agent");
|
|
79
|
+
const newConfigDir = getConfigDir();
|
|
80
|
+
if (!existsSync(oldAgentDir)) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (!existsSync(newConfigDir)) {
|
|
84
|
+
mkdirSync(newConfigDir, { recursive: true });
|
|
85
|
+
}
|
|
86
|
+
const filesToMigrate = [
|
|
87
|
+
"keybindings.json",
|
|
88
|
+
"settings.json",
|
|
89
|
+
"pie-debug.log"
|
|
90
|
+
];
|
|
91
|
+
for (const file of filesToMigrate) {
|
|
92
|
+
const oldPath = join(oldAgentDir, file);
|
|
93
|
+
const newPath = file === "pie-debug.log" ? getRuntimeLogPath() : join(newConfigDir, file);
|
|
94
|
+
if (existsSync(oldPath) && !existsSync(newPath)) {
|
|
95
|
+
try {
|
|
96
|
+
if (file === "pie-debug.log") {
|
|
97
|
+
mkdirSync(getLogsDir(), { recursive: true });
|
|
98
|
+
}
|
|
99
|
+
renameSync(oldPath, newPath);
|
|
100
|
+
console.log(`[Config] Migrated ${file} to ${newPath}`);
|
|
101
|
+
} catch (e) {
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const oldThemesDir = join(oldAgentDir, "themes");
|
|
106
|
+
const newThemesDir = getCustomThemesDir();
|
|
107
|
+
if (existsSync(oldThemesDir) && !existsSync(newThemesDir)) {
|
|
108
|
+
try {
|
|
109
|
+
renameSync(oldThemesDir, newThemesDir);
|
|
110
|
+
console.log(`[Config] Migrated themes to ${newThemesDir}`);
|
|
111
|
+
} catch (e) {
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export {
|
|
117
|
+
getPackageDir,
|
|
118
|
+
getThemesDir,
|
|
119
|
+
getBuiltinDir,
|
|
120
|
+
VERSION,
|
|
121
|
+
getConfigDir,
|
|
122
|
+
getAgentDir,
|
|
123
|
+
getCustomThemesDir,
|
|
124
|
+
getSettingsPath,
|
|
125
|
+
getProjectSettingsPath,
|
|
126
|
+
getSessionsDir,
|
|
127
|
+
getLogsDir,
|
|
128
|
+
getRuntimeLogPath,
|
|
129
|
+
migrateConfigFromAgentDir
|
|
130
|
+
};
|