terminal-pilot 0.0.5 → 0.0.6

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.
Files changed (86) hide show
  1. package/README.md +40 -0
  2. package/dist/ansi.js +68 -63
  3. package/dist/ansi.js.map +7 -0
  4. package/dist/cli.d.ts +2 -0
  5. package/dist/cli.js +1807 -0
  6. package/dist/cli.js.map +7 -0
  7. package/dist/commands/close-session.d.ts +12 -0
  8. package/dist/commands/close-session.js +1264 -0
  9. package/dist/commands/close-session.js.map +7 -0
  10. package/dist/commands/create-session.d.ts +26 -0
  11. package/dist/commands/create-session.js +1271 -0
  12. package/dist/commands/create-session.js.map +7 -0
  13. package/dist/commands/fill.d.ts +10 -0
  14. package/dist/commands/fill.js +1267 -0
  15. package/dist/commands/fill.js.map +7 -0
  16. package/dist/commands/get-session.d.ts +18 -0
  17. package/dist/commands/get-session.js +1269 -0
  18. package/dist/commands/get-session.js.map +7 -0
  19. package/dist/commands/index.d.ts +242 -0
  20. package/dist/commands/index.js +1781 -0
  21. package/dist/commands/index.js.map +7 -0
  22. package/dist/commands/install.d.ts +20 -0
  23. package/dist/commands/install.js +119 -0
  24. package/dist/commands/install.js.map +7 -0
  25. package/dist/commands/installer.d.ts +43 -0
  26. package/dist/commands/installer.js +123 -0
  27. package/dist/commands/installer.js.map +7 -0
  28. package/dist/commands/list-sessions.d.ts +16 -0
  29. package/dist/commands/list-sessions.js +1268 -0
  30. package/dist/commands/list-sessions.js.map +7 -0
  31. package/dist/commands/press-key.d.ts +10 -0
  32. package/dist/commands/press-key.js +1267 -0
  33. package/dist/commands/press-key.js.map +7 -0
  34. package/dist/commands/read-history.d.ts +16 -0
  35. package/dist/commands/read-history.js +1266 -0
  36. package/dist/commands/read-history.js.map +7 -0
  37. package/dist/commands/read-screen.d.ts +21 -0
  38. package/dist/commands/read-screen.js +1270 -0
  39. package/dist/commands/read-screen.js.map +7 -0
  40. package/dist/commands/resize.d.ts +12 -0
  41. package/dist/commands/resize.js +1267 -0
  42. package/dist/commands/resize.js.map +7 -0
  43. package/dist/commands/runtime.d.ts +36 -0
  44. package/dist/commands/runtime.js +1256 -0
  45. package/dist/commands/runtime.js.map +7 -0
  46. package/dist/commands/screenshot.d.ts +14 -0
  47. package/dist/commands/screenshot.js +1274 -0
  48. package/dist/commands/screenshot.js.map +7 -0
  49. package/dist/commands/send-signal.d.ts +10 -0
  50. package/dist/commands/send-signal.js +1267 -0
  51. package/dist/commands/send-signal.js.map +7 -0
  52. package/dist/commands/type.d.ts +10 -0
  53. package/dist/commands/type.js +1267 -0
  54. package/dist/commands/type.js.map +7 -0
  55. package/dist/commands/uninstall.d.ts +14 -0
  56. package/dist/commands/uninstall.js +124 -0
  57. package/dist/commands/uninstall.js.map +7 -0
  58. package/dist/commands/wait-for-exit.d.ts +14 -0
  59. package/dist/commands/wait-for-exit.js +1268 -0
  60. package/dist/commands/wait-for-exit.js.map +7 -0
  61. package/dist/commands/wait-for.d.ts +20 -0
  62. package/dist/commands/wait-for.js +1275 -0
  63. package/dist/commands/wait-for.js.map +7 -0
  64. package/dist/exports.compile-check.js +1 -1
  65. package/dist/exports.compile-check.js.map +7 -0
  66. package/dist/index.js +1118 -5
  67. package/dist/index.js.map +7 -0
  68. package/dist/keys.js +58 -49
  69. package/dist/keys.js.map +7 -0
  70. package/dist/templates/terminal-pilot.md +45 -0
  71. package/dist/terminal-buffer.d.ts +9 -1
  72. package/dist/terminal-buffer.js +525 -425
  73. package/dist/terminal-buffer.js.map +7 -0
  74. package/dist/terminal-pilot.js +1105 -35
  75. package/dist/terminal-pilot.js.map +7 -0
  76. package/dist/terminal-screen.js +108 -26
  77. package/dist/terminal-screen.js.map +7 -0
  78. package/dist/terminal-session.js +1020 -292
  79. package/dist/terminal-session.js.map +7 -0
  80. package/dist/testing/cli-repl.d.ts +15 -0
  81. package/dist/testing/cli-repl.js +1911 -0
  82. package/dist/testing/cli-repl.js.map +7 -0
  83. package/dist/testing/qa-cli.d.ts +1 -0
  84. package/dist/testing/qa-cli.js +2828 -0
  85. package/dist/testing/qa-cli.js.map +7 -0
  86. package/package.json +26 -5
package/README.md CHANGED
@@ -8,6 +8,46 @@ For design rationale and scope, see `docs/plans/terminal-pilot.md`.
8
8
 
9
9
  For the MCP server, see [terminal-pilot-mcp](../terminal-pilot-mcp).
10
10
 
11
+ ## CLI
12
+
13
+ The `terminal-pilot` package ships a CLI binary. After installing globally or via npx, all SDK commands and the skill installer are available from the command line.
14
+
15
+ ### Install globally
16
+
17
+ ```sh
18
+ npm install -g terminal-pilot
19
+ ```
20
+
21
+ Or run directly with npx:
22
+
23
+ ```sh
24
+ npx terminal-pilot <command> [options]
25
+ ```
26
+
27
+ ### Skill installation
28
+
29
+ The CLI can install a Claude Code skill that teaches the agent how to use terminal-pilot's MCP tools. Supported agents: `claude-code`, `codex`, `opencode`.
30
+
31
+ **Install the skill (local project, default):**
32
+
33
+ ```sh
34
+ terminal-pilot install claude-code
35
+ ```
36
+
37
+ **Install the skill globally (user home):**
38
+
39
+ ```sh
40
+ terminal-pilot install claude-code --global
41
+ ```
42
+
43
+ **Uninstall the skill:**
44
+
45
+ ```sh
46
+ terminal-pilot uninstall claude-code
47
+ ```
48
+
49
+ By default, `install` targets the current project (`--local`). Use `--global` to install in the user's home directory. You cannot pass both `--local` and `--global`.
50
+
11
51
  ## What it includes
12
52
 
13
53
  - **SDK:** `TerminalPilot` → `TerminalSession` → `TerminalScreen`
package/dist/ansi.js CHANGED
@@ -1,71 +1,76 @@
1
- const ESC = 0x1b;
2
- const BEL = 0x07;
3
- const ST = 0x9c;
4
- const CSI = 0x9b;
5
- const OSC = 0x9d;
6
- const DCS = 0x90;
7
- const SOS = 0x98;
8
- const PM = 0x9e;
9
- const APC = 0x9f;
10
- export function stripAnsi(input) {
11
- let output = "";
12
- for (let index = 0; index < input.length; index += 1) {
13
- const code = input.charCodeAt(index);
14
- if (code === ESC) {
15
- const nextCode = input.charCodeAt(index + 1);
16
- if (nextCode === 0x5b) {
17
- index = consumeCsi(input, index + 2);
18
- continue;
19
- }
20
- if (nextCode === 0x5d) {
21
- index = consumeTerminatedString(input, index + 2, true);
22
- continue;
23
- }
24
- if (nextCode === 0x50 || nextCode === 0x58 || nextCode === 0x5e || nextCode === 0x5f) {
25
- index = consumeTerminatedString(input, index + 2, false);
26
- continue;
27
- }
28
- if (!Number.isNaN(nextCode)) {
29
- index += 1;
30
- }
31
- continue;
32
- }
33
- if (code === CSI) {
34
- index = consumeCsi(input, index + 1);
35
- continue;
36
- }
37
- if (code === OSC) {
38
- index = consumeTerminatedString(input, index + 1, true);
39
- continue;
40
- }
41
- if (code === DCS || code === SOS || code === PM || code === APC) {
42
- index = consumeTerminatedString(input, index + 1, false);
43
- continue;
44
- }
45
- output += input[index];
1
+ // src/ansi.ts
2
+ var ESC = 27;
3
+ var BEL = 7;
4
+ var ST = 156;
5
+ var CSI = 155;
6
+ var OSC = 157;
7
+ var DCS = 144;
8
+ var SOS = 152;
9
+ var PM = 158;
10
+ var APC = 159;
11
+ function stripAnsi(input) {
12
+ let output = "";
13
+ for (let index = 0; index < input.length; index += 1) {
14
+ const code = input.charCodeAt(index);
15
+ if (code === ESC) {
16
+ const nextCode = input.charCodeAt(index + 1);
17
+ if (nextCode === 91) {
18
+ index = consumeCsi(input, index + 2);
19
+ continue;
20
+ }
21
+ if (nextCode === 93) {
22
+ index = consumeTerminatedString(input, index + 2, true);
23
+ continue;
24
+ }
25
+ if (nextCode === 80 || nextCode === 88 || nextCode === 94 || nextCode === 95) {
26
+ index = consumeTerminatedString(input, index + 2, false);
27
+ continue;
28
+ }
29
+ if (!Number.isNaN(nextCode)) {
30
+ index += 1;
31
+ }
32
+ continue;
33
+ }
34
+ if (code === CSI) {
35
+ index = consumeCsi(input, index + 1);
36
+ continue;
37
+ }
38
+ if (code === OSC) {
39
+ index = consumeTerminatedString(input, index + 1, true);
40
+ continue;
41
+ }
42
+ if (code === DCS || code === SOS || code === PM || code === APC) {
43
+ index = consumeTerminatedString(input, index + 1, false);
44
+ continue;
46
45
  }
47
- return output;
46
+ output += input[index];
47
+ }
48
+ return output;
48
49
  }
49
50
  function consumeCsi(input, index) {
50
- while (index < input.length) {
51
- const code = input.charCodeAt(index);
52
- if (code >= 0x40 && code <= 0x7e) {
53
- return index;
54
- }
55
- index += 1;
51
+ while (index < input.length) {
52
+ const code = input.charCodeAt(index);
53
+ if (code >= 64 && code <= 126) {
54
+ return index;
56
55
  }
57
- return input.length;
56
+ index += 1;
57
+ }
58
+ return input.length;
58
59
  }
59
60
  function consumeTerminatedString(input, index, allowBellTerminator) {
60
- while (index < input.length) {
61
- const code = input.charCodeAt(index);
62
- if (code === ST || (allowBellTerminator && code === BEL)) {
63
- return index;
64
- }
65
- if (code === ESC && input.charCodeAt(index + 1) === 0x5c) {
66
- return index + 1;
67
- }
68
- index += 1;
61
+ while (index < input.length) {
62
+ const code = input.charCodeAt(index);
63
+ if (code === ST || allowBellTerminator && code === BEL) {
64
+ return index;
65
+ }
66
+ if (code === ESC && input.charCodeAt(index + 1) === 92) {
67
+ return index + 1;
69
68
  }
70
- return input.length;
69
+ index += 1;
70
+ }
71
+ return input.length;
71
72
  }
73
+ export {
74
+ stripAnsi
75
+ };
76
+ //# sourceMappingURL=ansi.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/ansi.ts"],
4
+ "sourcesContent": ["const ESC = 0x1b;\nconst BEL = 0x07;\nconst ST = 0x9c;\nconst CSI = 0x9b;\nconst OSC = 0x9d;\nconst DCS = 0x90;\nconst SOS = 0x98;\nconst PM = 0x9e;\nconst APC = 0x9f;\n\nexport function stripAnsi(input: string): string {\n let output = \"\";\n\n for (let index = 0; index < input.length; index += 1) {\n const code = input.charCodeAt(index);\n\n if (code === ESC) {\n const nextCode = input.charCodeAt(index + 1);\n\n if (nextCode === 0x5b) {\n index = consumeCsi(input, index + 2);\n continue;\n }\n\n if (nextCode === 0x5d) {\n index = consumeTerminatedString(input, index + 2, true);\n continue;\n }\n\n if (nextCode === 0x50 || nextCode === 0x58 || nextCode === 0x5e || nextCode === 0x5f) {\n index = consumeTerminatedString(input, index + 2, false);\n continue;\n }\n\n if (!Number.isNaN(nextCode)) {\n index += 1;\n }\n\n continue;\n }\n\n if (code === CSI) {\n index = consumeCsi(input, index + 1);\n continue;\n }\n\n if (code === OSC) {\n index = consumeTerminatedString(input, index + 1, true);\n continue;\n }\n\n if (code === DCS || code === SOS || code === PM || code === APC) {\n index = consumeTerminatedString(input, index + 1, false);\n continue;\n }\n\n output += input[index];\n }\n\n return output;\n}\n\nfunction consumeCsi(input: string, index: number): number {\n while (index < input.length) {\n const code = input.charCodeAt(index);\n if (code >= 0x40 && code <= 0x7e) {\n return index;\n }\n\n index += 1;\n }\n\n return input.length;\n}\n\nfunction consumeTerminatedString(\n input: string,\n index: number,\n allowBellTerminator: boolean\n): number {\n while (index < input.length) {\n const code = input.charCodeAt(index);\n\n if (code === ST || (allowBellTerminator && code === BEL)) {\n return index;\n }\n\n if (code === ESC && input.charCodeAt(index + 1) === 0x5c) {\n return index + 1;\n }\n\n index += 1;\n }\n\n return input.length;\n}\n"],
5
+ "mappings": ";AAAA,IAAM,MAAM;AACZ,IAAM,MAAM;AACZ,IAAM,KAAK;AACX,IAAM,MAAM;AACZ,IAAM,MAAM;AACZ,IAAM,MAAM;AACZ,IAAM,MAAM;AACZ,IAAM,KAAK;AACX,IAAM,MAAM;AAEL,SAAS,UAAU,OAAuB;AAC/C,MAAI,SAAS;AAEb,WAAS,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS,GAAG;AACpD,UAAM,OAAO,MAAM,WAAW,KAAK;AAEnC,QAAI,SAAS,KAAK;AAChB,YAAM,WAAW,MAAM,WAAW,QAAQ,CAAC;AAE3C,UAAI,aAAa,IAAM;AACrB,gBAAQ,WAAW,OAAO,QAAQ,CAAC;AACnC;AAAA,MACF;AAEA,UAAI,aAAa,IAAM;AACrB,gBAAQ,wBAAwB,OAAO,QAAQ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