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.

Add opt-in detached launch mode with rolling capped logs

adilei23ffc3f70317
diff --git a/README.md b/README.md
index 3debebf..c22aadd 100644
--- a/README.md
+++ b/README.md
@@ -72,6 +72,8 @@ Prefix either command with any of these:
| `SKILL_RECORDER_HOME` | `~/.skill-recorder` | where the app is installed |
| `SKILL_RECORDER_REF` | `master` | branch, tag, or commit to install |
| `SKILL_RECORDER_NO_RUN` | *(unset)* | set up without launching |
+| `SKILL_RECORDER_DETACHED` | *(unset)* | run detached (keeps running after the terminal closes) and write rolling logs to `<home>/logs` |
+| `SKILL_RECORDER_LOG_KEEP` | `5` | how many detached log files to keep |
| `SKILL_RECORDER_NODE_VERSION` | `latest-v22.x` | Node version to fetch when none is installed |
| `SKILL_RECORDER_NODE_MIRROR` | `https://nodejs.org/dist` | mirror for the Node download |
diff --git a/install.ps1 b/install.ps1
index 4e0cddf..d1db88c 100644
--- a/install.ps1
+++ b/install.ps1
@@ -22,6 +22,9 @@
SKILL_RECORDER_REPO owner/repo (default: adilei/skill-recorder)
SKILL_RECORDER_REF branch / tag / commit (default: master)
SKILL_RECORDER_NO_RUN set to install & build only, without launching
+ SKILL_RECORDER_DETACHED set to run the app detached (survives the window
+ closing) and write rolling logs to <home>\logs
+ SKILL_RECORDER_LOG_KEEP how many detached log files to keep (default: 5)
SKILL_RECORDER_NODE_VERSION Node to fetch when missing (default: latest-v22.x)
SKILL_RECORDER_NODE_MIRROR Node dist mirror (default: https://nodejs.org/dist)
#>
@@ -211,4 +214,28 @@ if ($env:SKILL_RECORDER_NO_RUN) {
}
Info "Launching Skill Recorder…"
+
+if ($env:SKILL_RECORDER_DETACHED) {
+ # Detached: keep running after this window closes, and (since there's no
+ # console to watch) capture output to a rolling, capped set of log files.
+ $logDir = Join-Path $InstallDir 'logs'
+ $keep = if ($env:SKILL_RECORDER_LOG_KEEP -match '^\d+$') { [int]$env:SKILL_RECORDER_LOG_KEEP } else { 5 }
+ if ($keep -lt 1) { $keep = 1 }
+ New-Item -ItemType Directory -Force -Path $logDir | Out-Null
+ # Rotate by launch: keep the newest ($keep-1) logs so that, once we add the
+ # one below, at most $keep remain.
+ Get-ChildItem -LiteralPath $logDir -Filter 'skill-recorder-*.log' -ErrorAction SilentlyContinue |
+ Sort-Object LastWriteTime -Descending | Select-Object -Skip ($keep - 1) |
+ Remove-Item -Force -ErrorAction SilentlyContinue
+ $logFile = Join-Path $logDir ("skill-recorder-" + (Get-Date -Format 'yyyyMMdd-HHmmss') + ".log")
+ # Let cmd.exe own the redirection so stdout+stderr share one file; Start-Process
+ # launches it independently so the app outlives this PowerShell session.
+ $proc = Start-Process -FilePath $env:ComSpec `
+ -ArgumentList "/c npm start > `"$logFile`" 2>&1" `
+ -WorkingDirectory $InstallDir -WindowStyle Hidden -PassThru
+ Info "Running in the background (PID $($proc.Id)). It will keep running after this window closes."
+ Info "Logs: $logFile"
+ return
+}
+
& npm start; Assert-Ok 'npm start'
diff --git a/install.sh b/install.sh
index 3419d39..9435a3e 100755
--- a/install.sh
+++ b/install.sh
@@ -24,6 +24,9 @@
# SKILL_RECORDER_REPO owner/repo (default: adilei/skill-recorder)
# SKILL_RECORDER_REF branch / tag / commit (default: master)
# SKILL_RECORDER_NO_RUN set to install & build only, without launching
+# SKILL_RECORDER_DETACHED set to run the app detached (survives terminal
+# close) and write rolling logs to <home>/logs
+# SKILL_RECORDER_LOG_KEEP how many detached log files to keep (default: 5)
# SKILL_RECORDER_NODE_VERSION Node to fetch when missing (default: latest-v22.x)
# SKILL_RECORDER_NODE_MIRROR Node dist mirror (default: https://nodejs.org/dist)
#
@@ -214,4 +217,28 @@ if [ -n "${SKILL_RECORDER_NO_RUN:-}" ]; then
fi
info "Launching Skill Recorder…"
+
+if [ -n "${SKILL_RECORDER_DETACHED:-}" ]; then
+ # Detached: keep running after this terminal closes, and (since there's no
+ # terminal to watch) capture output to a rolling, capped set of log files.
+ log_dir="$INSTALL_DIR/logs"
+ keep="${SKILL_RECORDER_LOG_KEEP:-5}"
+ case "$keep" in ''|*[!0-9]*) keep=5 ;; esac
+ [ "$keep" -lt 1 ] && keep=1
+ mkdir -p "$log_dir"
+ # Rotate by launch: keep the newest (keep-1) logs so that, once we add the
+ # one below, at most $keep remain. `ls -t` lists newest first; `tail` selects
+ # the ones past the cap for deletion.
+ { ls -1t "$log_dir"/skill-recorder-*.log 2>/dev/null || true; } | tail -n +"$keep" | while IFS= read -r old; do
+ rm -f "$old"
+ done
+ log_file="$log_dir/skill-recorder-$(date +%Y%m%d-%H%M%S).log"
+ # </dev/null + nohup + disown fully detach from the (possibly piped) terminal.
+ nohup npm start </dev/null >"$log_file" 2>&1 &
+ disown 2>/dev/null || true
+ info "Running in the background (PID $!). It will keep running after this terminal closes."
+ info "Logs: $log_file"
+ exit 0
+fi
+
exec npm start