Skip to content

Desktop app that records your on-screen work session and uses the GitHub Copilot SDK to reconstruct it as an intent + ordered steps, then builds a reusable Skill or Automation for Microsoft Autopilots like Scout, Microsoft Copilot Cowork, or Copilot Studio.

Remove always-on terminal-command capture (#8)

adileic5b711e96450
diff --git a/WINDOWS-VALIDATION.md b/WINDOWS-VALIDATION.md
index 4e9d4e5..7b65049 100644
--- a/WINDOWS-VALIDATION.md
+++ b/WINDOWS-VALIDATION.md
@@ -24,7 +24,7 @@ The skill-recorder **works on Windows** for core recording. Install, typecheck,
| Pipeline (bundle + description) | ✅ | `bundle.json` and `description.md` generated post-stop |
| ffmpeg-static | ✅ | Binary exists at `node_modules/ffmpeg-static/ffmpeg.exe`, runs `ffmpeg -version` |
| Path handling | ✅ | All `path.join` usage is OS-agnostic; no hardcoded `/` separators found |
-| Terminal hooks (pwsh) | ✅ | PowerShell hook snippet is correct and would write to `~/.skill-recorder/shell.jsonl` |
+| Terminal hooks (pwsh) | ➖ | Removed after this report. The always-on shell hook was dropped; a safer recorded-terminal (PTY) approach is tracked in #7 |
---
@@ -65,7 +65,7 @@ The skill-recorder **works on Windows** for core recording. Install, typecheck,
### Things that already work correctly
1. **`doctor.ts`** — uses `where` (Windows) vs `which` (Unix) for binary detection ✅
-2. **`terminal-hooks.ts`** — includes a PowerShell hook (`PWSH_HOOK`) alongside zsh/bash ✅
+2. **`terminal-hooks.ts`** — _(removed after this report; terminal capture dropped, see #7)_ included a PowerShell hook (`PWSH_HOOK`) alongside zsh/bash
3. **`session-store.ts`** — uses `path.join()` everywhere, no hardcoded separators ✅
4. **`vite.config.ts`** — uses `path.join()` for all asset copying ✅
5. **`video/recorder.ts`** — uses `path.join()` for preload and capture.html paths ✅
diff --git a/common/config.ts b/common/config.ts
index 3246d9e..0054cf5 100644
--- a/common/config.ts
+++ b/common/config.ts
@@ -7,7 +7,6 @@
* Cost tiers (per source):
* 0 — no prompt, no setup (works out of the box)
* 1 — one-time OS grant (accessibility / screen-capture permission)
- * 2 — manual setup (install a shell hook)
* 3 — heaviest OS grant (screen-capture permission for video)
*/
@@ -22,8 +21,6 @@ export interface CaptureConfig {
windowTitles: boolean;
/** Active browser tab URLs. Tier 1 — needs the same grant as titles. */
browserUrls: boolean;
- /** Terminal commands. Tier 2 — needs the opt-in shell hook installed. */
- terminal: boolean;
/** Low-fps screen video + extracted keyframes. Tier 3 — needs screen-capture. */
video: boolean;
}
@@ -38,7 +35,6 @@ export const LEVEL_PRESETS: Record<Exclude<CaptureLevel, "custom">, CaptureConfi
clipboard: true,
windowTitles: false,
browserUrls: false,
- terminal: false,
video: false,
},
// One-time OS grant unlocks the biggest accuracy jump (what/where, not just which app).
@@ -47,16 +43,14 @@ export const LEVEL_PRESETS: Record<Exclude<CaptureLevel, "custom">, CaptureConfi
clipboard: true,
windowTitles: true,
browserUrls: true,
- terminal: false,
video: false,
},
- // Everything, including shell hooks and screen video for frame correlation.
+ // Everything: adds screen video + frame correlation on top of standard.
full: {
appActivity: true,
clipboard: true,
windowTitles: true,
browserUrls: true,
- terminal: true,
video: true,
},
};
@@ -87,7 +81,6 @@ export const CAPTURE_SOURCES: readonly CaptureSourceInfo[] = [
tier: 1,
cost: "One-time OS permission",
},
- { key: "terminal", label: "Terminal commands", tier: 2, cost: "Install a shell hook (one-time)" },
{ key: "video", label: "Screen video + keyframes", tier: 3, cost: "Screen-capture permission" },
];
@@ -117,7 +110,7 @@ export const CAPTURE_LEVEL_INFO: readonly CaptureLevelInfo[] = [
{
level: "full",
label: "Full",
- blurb: "Adds terminal commands + screen video. Most setup, best detail.",
+ blurb: "Adds screen video + keyframes. Most setup, best detail.",
},
];
diff --git a/common/events.ts b/common/events.ts
index 2e59373..0d4605e 100644
--- a/common/events.ts
+++ b/common/events.ts
@@ -11,6 +11,8 @@ export const EventType = {
AppActivate: "app.activate",
AppTitleChange: "app.title-change",
ClipboardChange: "clipboard.change",
+ // Retained as describer/eval vocabulary; live capture was removed (no producer
+ // ships today). A safer recorded-terminal (PTY) producer is tracked in #7.
TerminalCommand: "terminal.command",
BrowserUrl: "browser.url",
VideoStart: "video.start",
diff --git a/common/ipc.ts b/common/ipc.ts
index aceaac1..c0222a5 100644
--- a/common/ipc.ts
+++ b/common/ipc.ts
@@ -150,13 +150,6 @@ export interface BrowserUrlInfo {
supported: boolean;
}
-/** Shell-hook install status for terminal capture. */
-export interface ShellHookInfo {
- shell: "zsh" | "bash" | "pwsh" | null;
- profilePath: string | null;
- installed: boolean;
-}
-
/** One capture source in the doctor report, annotated with platform support. */
export interface DoctorSource {
key: string;
@@ -175,21 +168,11 @@ export interface DoctorReport {
copilotCli: CopilotInfo;
activeWindow: ActiveWindowInfo;
browserUrl: BrowserUrlInfo;
- shellHook: ShellHookInfo;
sessionsDir: string;
captureLevel: CaptureLevel;
activeSources: DoctorSource[];
}
-/** Result of installing the terminal shell hook. */
-export interface ShellHookInstallResult {
- ok: boolean;
- shell: "zsh" | "bash" | "pwsh" | null;
- profilePath: string | null;
- alreadyInstalled: boolean;
- error?: string;
-}
-
/** Current capture configuration plus its resolved named level. */
export interface CaptureState {
level: CaptureLevel;
@@ -203,7 +186,6 @@ export const IPC = {
status: "recorder:status",
marker: "recorder:marker",
doctor: "doctor:check",
- installShellHook: "doctor:install-shell-hook",
statusChanged: "recorder:status-changed",
getCapture: "capture:get",
setLevel: "capture:set-level",
@@ -233,8 +215,6 @@ export interface SkillRecorderApi {
status(): Promise<RecorderStatus>;
marker(note: string): Promise<MarkerResult>;
doctor(): Promise<DoctorReport>;
- /** Install the terminal shell hook into the user's shell profile (idempotent). */
- installShellHook(): Promise<ShellHookInstallResult>;
getCapture(): Promise<CaptureState>;
setLevel(level: Exclude<CaptureLevel, "custom">): Promise<CaptureState>;
setConfig(config: CaptureConfig): Promise<CaptureState>;
diff --git a/docs/windows-capture.md b/docs/windows-capture.md
index 33065fd..68829ff 100644
--- a/docs/windows-capture.md
+++ b/docs/windows-capture.md
@@ -14,7 +14,6 @@ before trusting a Windows build.
| Window titles | `get-windows` native addon | Full (better: no grant needed) | None |
| Browser URLs | UI Automation address bar read (`powershell.exe` host) | Functional, not byte exact | None |
| Clipboard | Electron clipboard | Full | None |
-| Terminal commands | PowerShell `$PROFILE` hook writing `~/.skill-recorder/shell.jsonl` | Parity for pwsh (no cmd.exe) | Install hook once |
| Screen video + frames | `desktopCapturer` + ffmpeg + sharp | Full | Screen capture |
Notes:
@@ -25,8 +24,6 @@ Notes:
segmentation, and unlike macOS it also reads **Firefox**. Values that look like
a search term (whitespace, or no dot) are dropped rather than emitted as noise.
- **Window titles** need no OS permission on Windows (macOS needs Accessibility).
-- **Terminal** capture is pwsh only. The hook overrides the `prompt` function, so
- a heavily customized prompt (oh-my-posh etc.) may need manual merging.
## Prerequisites
@@ -49,8 +46,6 @@ On Windows, confirm:
- **window tracking** = `native` (not `addon missing`). `addon missing` means the
`get-windows` `.node` did not resolve, which is a packaging or install problem.
- **browser URLs** = `uia` when the capture level includes URLs.
-- **terminal hook** shows `install` until the PowerShell hook is added; click it
- (or run the installer) and it flips to `pwsh`.
## Live smoke test
@@ -66,11 +61,8 @@ Run a real recording on Windows and verify each source lands in the session's
Typing a partial URL or a search term should not emit a bogus event.
4. **Clipboard.** Copy some text. Expect a `clipboard.change` event with a
preview and hash.
-5. **Terminal.** Ensure the hook is installed (doctor row shows `pwsh`), open a
- new PowerShell window, run a couple of commands. Expect `terminal.command`
- events tailing `~/.skill-recorder/shell.jsonl`.
-6. **Video.** Confirm a `.webm` is written and `frame.captured` events appear.
-7. **Stop.** The recording should show up in the library as `recorded`, and
+5. **Video.** Confirm a `.webm` is written and `frame.captured` events appear.
+6. **Stop.** The recording should show up in the library as `recorded`, and
analysis should produce a coherent intent + ordered steps.
If a source produces nothing, check the doctor row for it first, then the main
@@ -98,7 +90,8 @@ binaries and is not supported here.
## Known limitations
- Browser URLs are best effort display strings, not the exact tab URL.
-- Terminal capture is pwsh only (no cmd.exe).
+- Terminal capture is not currently implemented; a recorded-terminal (PTY)
+ approach is tracked in issue #7.
- Semantic UI events (focus/invoke/value via UI Automation) are not implemented
on either platform yet.
- The Windows paths above are validated by typecheck, a PowerShell parse check of
diff --git a/electron/collectors/index.ts b/electron/collectors/index.ts
index 93efd18..3e982be 100644
--- a/electron/collectors/index.ts
+++ b/electron/collectors/index.ts
@@ -2,7 +2,6 @@ import type { CaptureConfig } from "../../common/config";
import type { Collector } from "../recorder/collector";
import { ActiveWindowCollector } from "./active-window";
import { ClipboardCollector } from "./clipboard";
-import { TerminalCollector } from "./terminal";
/**
* Builds the collectors enabled by `config`. Sources the user hasn't opted into
@@ -25,7 +24,6 @@ export function createCollectors(config: CaptureConfig): Collector[] {
);
}
if (config.clipboard) collectors.push(new ClipboardCollector());
- if (config.terminal) collectors.push(new TerminalCollector());
return collectors;
}
diff --git a/electron/collectors/shell-hook.ts b/electron/collectors/shell-hook.ts
deleted file mode 100644
index 864140c..0000000
--- a/electron/collectors/shell-hook.ts
+++ /dev/null
@@ -1,143 +0,0 @@
-import { execFileSync } from "node:child_process";
-import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
-import os from "node:os";
-import path from "node:path";
-
-import { SHELL_HOOKS } from "./terminal-hooks";
-
-/**
- * Terminal capture needs a one-time shell hook installed into the user's shell
- * profile (see terminal-hooks.ts for the snippets). This module detects the
- * active shell, resolves its profile file, reports whether our hook is present,
- * and installs it idempotently. Cross-platform: zsh/bash on macOS + Linux,
- * PowerShell on Windows.
- *
- * The snippet is wrapped in a marked block so install is idempotent and the
- * status check is a simple substring test.
- */
-
-export type SupportedShell = "zsh" | "bash" | "pwsh";
-
-const MARKER = ">>> skill-recorder";
-
-export interface ShellHookStatus {
- /** Detected shell, or null when it isn't one we can hook. */
- shell: SupportedShell | null;
- /** Absolute path to the profile we'd install into, when known. */
- profilePath: string | null;
- /** True when our marked hook block is already present in the profile. */
- installed: boolean;
-}
-
-export interface ShellHookInstallResult {
- ok: boolean;
- shell: SupportedShell | null;
- profilePath: string | null;
- /** True when the block was already there and we made no change. */
- alreadyInstalled: boolean;
- error?: string;
-}
-
-/** Detect the shell we'd install a hook for on this platform. */
-export function detectShell(): SupportedShell | null {
- if (process.platform === "win32") return "pwsh";
- const shellPath = process.env.SHELL ?? "";
- const base = path.basename(shellPath).toLowerCase();
- if (base.includes("zsh")) return "zsh";
- if (base.includes("bash")) return "bash";
- // A sensible default per platform when $SHELL is unset or exotic.
- return process.platform === "darwin" ? "zsh" : "bash";
-}
-
-/**
- * Resolve the profile file for a shell. For pwsh we ask PowerShell for its real
- * `$PROFILE.CurrentUserAllHosts` (locale- / OneDrive-aware), falling back to the
- * conventional path when no interpreter is reachable.
- */
-export function resolveProfilePath(shell: SupportedShell): string | null {
- const home = os.homedir();
- if (shell === "zsh") return path.join(home, ".zshrc");
- if (shell === "bash") return path.join(home, ".bashrc");
- return resolvePwshProfile(home);
-}
-
-function resolvePwshProfile(home: string): string {
- for (const exe of ["pwsh", "powershell.exe"]) {
- try {
- const out = execFileSync(
- exe,
- ["-NoProfile", "-NonInteractive", "-Command", "$PROFILE.CurrentUserAllHosts"],
- { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] },
- )
- .trim()
- .split(/\r?\n/)[0];
- if (out) return out;
- } catch {
- // try the next interpreter
- }
- }
- // Conventional PowerShell 7 location when no interpreter answered.
- return path.join(home, "Documents", "PowerShell", "Microsoft.PowerShell_profile.ps1");
-}
-
-function readProfile(profilePath: string): string | null {
- try {
- return existsSync(profilePath) ? readFileSync(profilePath, "utf8") : "";
- } catch {
- return null;
- }
-}
-
-/** Whether our marked hook block is present in the resolved profile. */
-export function shellHookStatus(): ShellHookStatus {
- const shell = detectShell();
- if (!shell) return { shell: null, profilePath: null, installed: false };
- const profilePath = resolveProfilePath(shell);
- const contents = profilePath ? readProfile(profilePath) : null;
- return {
- shell,
- profilePath,
- installed: contents != null && contents.includes(MARKER),
- };
-}
-
-/** Idempotently append our shell hook to the detected shell's profile. */
-export function installShellHook(): ShellHookInstallResult {
- const shell = detectShell();
- if (!shell) {
- return {
- ok: false,
- shell: null,
- profilePath: null,
- alreadyInstalled: false,
- error: "No supported shell detected (zsh, bash, or PowerShell).",
- };
- }
- const profilePath = resolveProfilePath(shell);
- if (!profilePath) {
- return { ok: false, shell, profilePath: null, alreadyInstalled: false, error: "Could not resolve a shell profile path." };
- }
-
- const existing = readProfile(profilePath);
- if (existing == null) {
- return { ok: false, shell, profilePath, alreadyInstalled: false, error: `Could not read ${profilePath}.` };
- }
- if (existing.includes(MARKER)) {
- return { ok: true, shell, profilePath, alreadyInstalled: true };
- }
-
- try {
- mkdirSync(path.dirname(profilePath), { recursive: true });
- const sep = existing.length && !existing.endsWith("\n") ? "\n\n" : existing.length ? "\n" : "";
- writeFileSync(profilePath, `${existing}${sep}${SHELL_HOOKS[shell]}\n`, "utf8");
- return { ok: true, shell, profilePath, alreadyInstalled: false };
- } catch (err) {
- return {
- ok: false,
- shell,
- profilePath,
- alreadyInstalled: false,
- error: err instanceof Error ? err.message : String(err),
- };
- }
-}
diff --git a/electron/collectors/terminal-hooks.ts b/electron/collectors/terminal-hooks.ts
deleted file mode 100644
index ed1eae3..0000000
--- a/electron/collectors/terminal-hooks.ts
+++ /dev/null
@@ -1,116 +0,0 @@
-import os from "node:os";
-import path from "node:path";
-
-/**
- * Terminal capture uses opt-in shell hooks rather than scraping terminal
- * windows (which is fragile and needs Accessibility). Each shell appends a
- * single tab-delimited record per command to a well-known log file; the
- * TerminalCollector tails that file during a recording.
- *
- * Record format (one line):
- * v1 \t <epochMs> \t <shell> \t <exitCode> \t <durationMs> \t <base64 command> \t <base64 cwd>
- *
- * command and cwd are base64-encoded so arbitrary quotes/newlines/backslashes
- * survive shell printf and our parser without escaping headaches.
- */
-export const SHELL_LOG_DIR = path.join(os.homedir(), ".skill-recorder");
-export const SHELL_LOG_PATH = path.join(SHELL_LOG_DIR, "shell.jsonl");
-export const RECORD_VERSION = "v1";
-
-export interface ShellRecord {
- ts: number;
- shell: string;
- exitCode: number;
- durationMs: number;
- command: string;
- cwd: string;
-}
-
-/** Parse one log line; returns null for blank/malformed/other-version lines. */
-export function parseShellRecord(line: string): ShellRecord | null {
- const trimmed = line.trim();
- if (!trimmed) return null;
- const parts = trimmed.split("\t");
- if (parts.length !== 7 || parts[0] !== RECORD_VERSION) return null;
- const [, tsRaw, shell, ecRaw, durRaw, cmdB64, cwdB64] = parts;
- try {
- return {
- ts: Number(tsRaw),
- shell,
- exitCode: Number(ecRaw),
- durationMs: Number(durRaw),
- command: Buffer.from(cmdB64, "base64").toString("utf8"),
- cwd: Buffer.from(cwdB64, "base64").toString("utf8"),
- };
- } catch {
- return null;
- }
-}
-
-/** zsh hook for ~/.zshrc. */
-export const ZSH_HOOK = `# >>> skill-recorder (zsh) >>>
-zmodload zsh/datetime 2>/dev/null
-_skr_preexec() { _SKR_CMD=$1; _SKR_T0=$EPOCHREALTIME; }
-_skr_precmd() {
- local ec=$?
- [ -n "$_SKR_CMD" ] || return 0
- local dir="$HOME/.skill-recorder"; [ -d "$dir" ] || mkdir -p "$dir"
- local ts=$(( $(date +%s%N) / 1000000 ))
- local dur=0; [ -n "$_SKR_T0" ] && dur=$(( (EPOCHREALTIME - _SKR_T0) * 1000 ))
- printf 'v1\\t%d\\tzsh\\t%d\\t%d\\t%s\\t%s\\n' "$ts" "$ec" "\${dur%.*}" \\
- "$(printf %s "$_SKR_CMD" | base64 | tr -d '\\n')" \\
- "$(printf %s "$PWD" | base64 | tr -d '\\n')" >> "$dir/shell.jsonl"
- _SKR_CMD=
-}
-autoload -Uz add-zsh-hook
-add-zsh-hook preexec _skr_preexec
-add-zsh-hook precmd _skr_precmd
-# <<< skill-recorder (zsh) <<<`;
-
-/** bash hook for ~/.bashrc. */
-export const BASH_HOOK = `# >>> skill-recorder (bash) >>>
-_skr_preexec() {
- [ -n "$COMP_LINE" ] && return
- [ "$BASH_COMMAND" = "$PROMPT_COMMAND" ] && return
- _SKR_CMD=$BASH_COMMAND
-}
-trap '_skr_preexec' DEBUG
-_skr_precmd() {
- local ec=$?
- [ -n "$_SKR_CMD" ] || return 0
- local dir="$HOME/.skill-recorder"; [ -d "$dir" ] || mkdir -p "$dir"
- local ts=$(( $(date +%s%N) / 1000000 ))
- printf 'v1\\t%d\\tbash\\t%d\\t0\\t%s\\t%s\\n' "$ts" "$ec" \\
- "$(printf %s "$_SKR_CMD" | base64 | tr -d '\\n')" \\
- "$(printf %s "$PWD" | base64 | tr -d '\\n')" >> "$dir/shell.jsonl"
- _SKR_CMD=
-}
-PROMPT_COMMAND="_skr_precmd\${PROMPT_COMMAND:+; $PROMPT_COMMAND}"
-# <<< skill-recorder (bash) <<<`;
-
-/** PowerShell hook for $PROFILE (Windows / pwsh). */
-export const PWSH_HOOK = `# >>> skill-recorder (pwsh) >>>
-function prompt {
- $h = Get-History -Count 1
- if ($h -and $h.Id -ne $global:SkrLastId) {
- $global:SkrLastId = $h.Id
- $dir = Join-Path $HOME ".skill-recorder"
- if (!(Test-Path $dir)) { New-Item -ItemType Directory -Path $dir | Out-Null }
- $ts = [DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds()
- $ec = if ($?) { 0 } else { 1 }
- $dur = [int]($h.EndExecutionTime - $h.StartExecutionTime).TotalMilliseconds
- $cmd = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes([string]$h.CommandLine))
- $cwd = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($PWD.Path))
- "v1\`t$ts\`tpwsh\`t$ec\`t$dur\`t$cmd\`t$cwd" |
- Out-File -Append -Encoding utf8 (Join-Path $dir "shell.jsonl")
- }
- "PS $($executionContext.SessionState.Path.CurrentLocation)> "
-}
-# <<< skill-recorder (pwsh) <<<`;
-
-/** All hook snippets keyed by shell, for the setup/doctor UI and docs. */
-export const SHELL_HOOKS: Record<"zsh" | "bash" | "pwsh", string> = {
- zsh: ZSH_HOOK,
- bash: BASH_HOOK,
- pwsh: PWSH_HOOK,
-};
diff --git a/electron/collectors/terminal.ts b/electron/collectors/terminal.ts
deleted file mode 100644
index 2b1a54e..0000000
--- a/electron/collectors/terminal.ts
+++ /dev/null
@@ -1,98 +0,0 @@
-import { open, stat } from "node:fs/promises";
-
-import type { Collector, CollectorContext } from "../recorder/collector";
-import { parseShellRecord, SHELL_LOG_PATH } from "./terminal-hooks";
-
-const POLL_MS = 500;
-
-/**
- * Tails the shell activity log (see terminal-hooks.ts) and emits a
- * `terminal.command` event per command run *during* the recording. On start it
- * seeks to the current end of the file, so pre-session history is ignored. If
- * the shell hooks are not installed the log simply never grows and this
- * collector stays silent — it never fails a recording.
- *
- * Cross-platform: the same tab-delimited, base64-encoded record format is
- * produced by the zsh, bash, and PowerShell hooks.
- */
-export class TerminalCollector implements Collector {
- readonly name = "terminal";
- private timer: NodeJS.Timeout | null = null;
- private ctx: CollectorContext | null = null;
- private offset = 0;
- private remainder = "";
- private reading = false;
-
- async start(ctx: CollectorContext): Promise<void> {
- this.ctx = ctx;
- this.remainder = "";
- try {
- const s = await stat(SHELL_LOG_PATH);
- this.offset = s.size; // begin tailing from the end — ignore prior commands
- } catch {
- this.offset = 0; // log doesn't exist yet; we'll pick it up when it appears
- }
- this.timer = setInterval(() => void this.poll(), POLL_MS);
- }
-
- async stop(): Promise<void> {
- if (this.timer) {
- clearInterval(this.timer);
- this.timer = null;
- }
- await this.poll(); // final flush of any trailing records
- this.ctx = null;
- }
-
- private async poll(): Promise<void> {
- if (this.reading || !this.ctx) return;
- this.reading = true;
- try {
- let size: number;
- try {
- size = (await stat(SHELL_LOG_PATH)).size;
- } catch {
- return; // no log file yet
- }
- if (size < this.offset) {
- // File was truncated or rotated between sessions — restart from the top.
- this.offset = 0;
- this.remainder = "";
- }
- if (size === this.offset) return;
-
- const handle = await open(SHELL_LOG_PATH, "r");
- try {
- const length = size - this.offset;
- const buf = Buffer.alloc(length);
- await handle.read(buf, 0, length, this.offset);
- this.offset = size;
- this.consume(buf.toString("utf8"));
- } finally {
- await handle.close();
- }
- } catch (err) {
- this.ctx?.log.warn("terminal tail failed:", err instanceof Error ? err.message : err);
- } finally {
- this.reading = false;
- }
- }
-
- /** Split appended text into complete lines, parse, and emit; keep any partial tail. */
- private consume(chunk: string): void {
- const text = this.remainder + chunk;
- const lines = text.split("\n");
- this.remainder = lines.pop() ?? ""; // last element is an incomplete line (or "")
- for (const line of lines) {
- const rec = parseShellRecord(line);
- if (!rec || !this.ctx) continue;
- this.ctx.publish("terminal.command", {
- command: rec.command,
- cwd: rec.cwd,
- shell: rec.shell,
- exitCode: rec.exitCode,
- durationMs: rec.durationMs,
- });
- }
- }
-}
diff --git a/electron/describer/instructions.ts b/electron/describer/instructions.ts
index ab872ec..5965dff 100644
--- a/electron/describer/instructions.ts
+++ b/electron/describer/instructions.ts
@@ -23,7 +23,7 @@ The recorder harvested cheap, high-signal OS events as the PRIMARY source:
- **window titles**,
- **browser URLs** (the pages visited),
- **clipboard changes** (copied text),
-- **terminal commands** (when the shell hook was active).
+- **terminal commands** (only if a terminal producer was active for the session).
A low-frame-rate **screen video** may also exist. It is OPPORTUNISTIC enrichment
— you pull frames only where the events are ambiguous. Do NOT assume you must
diff --git a/electron/doctor.ts b/electron/doctor.ts
index 224a832..e6a4706 100644
--- a/electron/doctor.ts
+++ b/electron/doctor.ts
@@ -12,7 +12,6 @@ import type {
DoctorSource,
FfmpegInfo,
} from "../common/ipc";
-import { shellHookStatus } from "./collectors/shell-hook";
import { browserUrlProviderKind } from "./collectors/url-provider";
import { sessionsRoot } from "./recorder/session-store";
import type { SettingsStore } from "./settings";
@@ -88,15 +87,10 @@ function sourceSupport(key: string, browserUrl: BrowserUrlInfo): { supported: bo
export function runDoctor(settings: SettingsStore): DoctorReport {
const config = settings.resolve();
const browserUrl = checkBrowserUrl();
- const shellHook = shellHookStatus();
const activeSources: DoctorSource[] = CAPTURE_SOURCES.filter((s) => config[s.key]).map((s) => {
const support = sourceSupport(s.key, browserUrl);
- let note = support.note;
- if (s.key === "terminal" && support.supported && !shellHook.installed) {
- note = "Shell hook not installed";
- }
- return { key: s.key, label: s.label, tier: s.tier, cost: s.cost, supported: support.supported, note };
+ return { key: s.key, label: s.label, tier: s.tier, cost: s.cost, supported: support.supported, note: support.note };
});
return {
@@ -105,7 +99,6 @@ export function runDoctor(settings: SettingsStore): DoctorReport {
copilotCli: checkCopilot(),
activeWindow: checkActiveWindow(),
browserUrl,
- shellHook,
sessionsDir: sessionsRoot(),
captureLevel: settings.level,
activeSources,
diff --git a/electron/ipc.ts b/electron/ipc.ts
index 1fea0b6..4daef06 100644
--- a/electron/ipc.ts
+++ b/electron/ipc.ts
@@ -15,7 +15,6 @@ import type {
import { IPC } from "../common/ipc";
import { Describer, loadPersistedAnalysis } from "./describer/describer";
import { runDoctor } from "./doctor";
-import { installShellHook } from "./collectors/shell-hook";
import { createLogger } from "./logger";
import type { RecorderController } from "./recorder/controller";
import { isValidSessionId } from "./recorder/session-store";
@@ -42,7 +41,6 @@ export function registerIpc(
ipcMain.handle(IPC.status, () => recorder.status());
ipcMain.handle(IPC.marker, (_event, note: string) => recorder.marker(note));
ipcMain.handle(IPC.doctor, () => runDoctor(settings));
- ipcMain.handle(IPC.installShellHook, () => installShellHook());
ipcMain.handle(IPC.getCapture, () => captureState());
ipcMain.handle(IPC.setLevel, (_event, level: Exclude<CaptureLevel, "custom">) => {
settings.setLevel(level);
diff --git a/electron/preload.cjs b/electron/preload.cjs
index 29eb810..86e429b 100644
--- a/electron/preload.cjs
+++ b/electron/preload.cjs
@@ -8,7 +8,6 @@ const IPC = {
status: "recorder:status",
marker: "recorder:marker",
doctor: "doctor:check",
- installShellHook: "doctor:install-shell-hook",
statusChanged: "recorder:status-changed",
getCapture: "capture:get",
setLevel: "capture:set-level",
@@ -37,7 +36,6 @@ contextBridge.exposeInMainWorld("skillRecorder", {
status: () => ipcRenderer.invoke(IPC.status),
marker: (note) => ipcRenderer.invoke(IPC.marker, note),
doctor: () => ipcRenderer.invoke(IPC.doctor),
- installShellHook: () => ipcRenderer.invoke(IPC.installShellHook),
getCapture: () => ipcRenderer.invoke(IPC.getCapture),
setLevel: (level) => ipcRenderer.invoke(IPC.setLevel, level),
setConfig: (config) => ipcRenderer.invoke(IPC.setConfig, config),
diff --git a/electron/recorder/collector.ts b/electron/recorder/collector.ts
index 545ef2f..46866c8 100644
--- a/electron/recorder/collector.ts
+++ b/electron/recorder/collector.ts
@@ -16,7 +16,7 @@ export interface CollectorContext {
/**
* A source of events. Implementations are cheap to construct and only do real
* work between `start` and `stop`. Both may be async (native handles, polling
- * loops, file tails). Later milestones add ActiveWindow / Clipboard / Terminal.
+ * loops, file tails). Implementations include ActiveWindow and Clipboard.
*/
export interface Collector {
readonly name: string;
diff --git a/src/Recorder.tsx b/src/Recorder.tsx
index 400ad5c..e79d560 100644
--- a/src/Recorder.tsx
+++ b/src/Recorder.tsx
@@ -15,7 +15,6 @@ export function Recorder() {
const [elapsed, setElapsed] = useState(0);
const [sessionCount, setSessionCount] = useState(0);
const [pendingCount, setPendingCount] = useState(0);
- const [installingHook, setInstallingHook] = useState(false);
const refreshCount = useCallback(async () => {
const list = await window.skillRecorder.listSessions();
@@ -78,25 +77,6 @@ export function Recorder() {
void window.skillRecorder.openLibrary();
}, []);
- const installHook = useCallback(async () => {
- setInstallingHook(true);
- try {
- const res = await window.skillRecorder.installShellHook();
- if (!res.ok) {
- window.alert(res.error ?? "Could not install the shell hook.");
- } else if (res.alreadyInstalled) {
- window.alert("The shell hook is already installed.");
- } else {
- window.alert(
- `Installed the ${res.shell} hook. Open a new terminal to start capturing commands.`,
- );
- }
- setDoctor(await window.skillRecorder.doctor());
- } finally {
- setInstallingHook(false);
- }
- }, []);
-
return (
<div className="hud">
<header className="hud-head">
@@ -219,21 +199,6 @@ export function Recorder() {
note={doctor.ffmpeg.ok ? doctor.ffmpeg.source : "missing"}
/>
<Row label="copilot CLI" ok={doctor.copilotCli.ok} note={doctor.copilotCli.ok ? "found" : "missing"} />
- {doctor.activeSources.some((s) => s.key === "terminal") && (
- <div className="row">
- <span className={`badge ${doctor.shellHook.installed ? "good" : "warn"}`}>
- {doctor.shellHook.installed ? "✓" : "!"}
- </span>
- <span className="row-label">terminal hook</span>
- {doctor.shellHook.installed ? (
- <span className="row-note">{doctor.shellHook.shell}</span>
- ) : (
- <button className="row-action" onClick={installHook} disabled={installingHook}>
- {installingHook ? "installing" : "install"}
- </button>
- )}
- </div>
- )}
</div>
)}