Commit graph

68 commits

Author SHA1 Message Date
Jeremy McSpadden
d7bf3d4e72 Improve startup performance with lazy extension loading (#1336) 2026-03-19 07:38:50 -06:00
TÂCHES
5a36c131a9 fix: detect stale bundled resources via content fingerprint (#1193)
initResources() only re-synced when the GSD version changed. This meant
same-version content fixes (e.g. the subagent bundled-extension-paths.js
import fix in a2a701b1) never reached ~/.gsd/agent/extensions/ because
the version-only check saw 2.28.0 == 2.28.0 and skipped the sync.

Add a lightweight content fingerprint (sha256 of file paths + sizes) to
the managed-resources.json manifest. On startup, if the version matches
but the fingerprint doesn't, resources are re-synced. This covers:

- npm link dev workflows where source changes without version bumps
- hotfixes within a release that change bundled extension content
- upgrades from manifests without contentHash (treated as stale)

Cost: ~1ms of stat calls on ~100 files — no file reads needed.
2026-03-18 11:06:09 -06:00
Jeremy McSpadden
d24095971c feat: add pre-commit secret scanner and CI secret detection (#1148)
* feat: add pre-commit secret scanner and CI secret detection

Add a comprehensive secret scanning system to prevent accidental
credential leaks in commits and pull requests:

- scripts/secret-scan.sh: ERE-based scanner (macOS/Linux compatible)
  that detects AWS keys, API tokens, private keys, database URLs,
  GitHub/GitLab/Slack/Stripe/Google/npm tokens, and hardcoded passwords
- scripts/install-hooks.sh: one-command git pre-commit hook installer
- .secretscanignore: allowlist for known false positives (test fixtures,
  env var references, placeholder values)
- CI job: secret-scan step in ci.yml scans PR diffs against origin/main
- npm scripts: test:secret-scan, secret-scan, secret-scan:install-hook
- 17 tests covering detection, non-detection, binary skipping, CI mode

* fix: exclude secret-scan test file from CI scanning

The test file contains intentional fake secrets as test inputs.
Add it to .secretscanignore so CI doesn't flag them.

* fix: skip secret-scan tests on Windows (requires bash/POSIX grep)
2026-03-18 08:33:17 -06:00
Jeremy McSpadden
ce1ad35706 perf: skip initResources when version matches, consolidate startup I/O (#1052)
- Add version-match early return to initResources() — skips ~800ms of
  synchronous rmSync + cpSync when managed-resources.json already matches
  the running GSD version (steady-state on every launch)
- Consolidate package.json reads in loader.ts from 3 to 1 — single read
  reused for --version, --help, banner, and GSD_VERSION env var
- Replace blocking checkAndPromptForUpdates() with passive checkForUpdates()
  to avoid blocking startup on npm registry fetch + user prompt (up to 5s)
- Cache bundled extension keys in resource-loader to avoid redundant
  filesystem scan in buildResourceLoader()
- Use GSD_VERSION env var in getBundledGsdVersion() to skip package.json
  re-read from resource-loader.ts
- Add test verifying version-skip behavior: marker file survives when
  versions match, gets cleaned on mismatch
2026-03-17 21:57:13 -06:00
TÂCHES
94be09482f fix: add barrel files for remote-questions, ttsr, and shared extensions (#1048)
* fix: add barrel files for remote-questions, ttsr, and shared extensions

Centralizes public API surface for three extension directories behind
index.ts barrel files. External consumers now import from the barrel
instead of reaching into internal module files, reducing coupling and
making future refactors safer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: rename barrel files to mod.ts to avoid extension loader auto-discovery

The extension loader auto-discovers extensions by looking for index.ts files
inside extensions/*/ directories. remote-questions/ and shared/ are utility
directories, not extensions — their index.ts barrel files caused load failures.

Renamed to mod.ts which the loader ignores, and updated all import paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 18:48:32 -06:00
TÂCHES
13f9d5585d fix(search): consolidate duplicate Brave API helpers (#1010)
* fix(search): consolidate duplicate Brave API helper functions

getBraveApiKey() and braveHeaders() were duplicated across provider.ts,
tool-llm-context.ts, and tool-search.ts. Export both from provider.ts
and import in the tool files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(test): update provider export count to include braveHeaders

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 18:06:23 -06:00
Juan Francisco Lebrero
fe0f4f35e6 feat: add --events flag for JSONL stream filtering (#1000)
Allow orchestrators to filter the JSONL event stream to specific event
types, reducing stdout noise. The filter applies only to output —
internal processing (completion detection, supervised mode, answer
injection) is unaffected.

- New `--events <types>` flag (comma-separated, implies `--json`)
- Filter applied at stdout write point, all events still processed internally
- Updated help-text and SKILL.md with examples
- Tests for argument parsing and filter matching logic
2026-03-17 17:35:44 -06:00
TÂCHES
89ee5e439a fix: unify extension discovery logic (#995)
* fix: unify extension discovery between loader.ts and resource-loader.ts

Extract shared extension discovery logic (resolveExtensionEntries,
discoverExtensionEntryPaths) into extension-discovery.ts. Both loader.ts
and resource-loader.ts now use the same algorithm, which supports
package.json pi.extensions declarations in addition to index.ts/index.js
fallback.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: update test to match refactored extension discovery imports

Test checked for readdirSync which was replaced by discoverExtensionEntryPaths.
Updated import path from resource-loader.ts to extension-discovery.ts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 17:14:04 -06:00
TÂCHES
2df7a2320b fix: remove dead github-client.ts (never imported) (#990)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 17:05:44 -06:00
Lex Christopherson
6114ede489 fix: remove duplicate marketplace-discovery test
Migrated unique resolvePluginRoot and inspectPlugin tests from the older
file into the comprehensive contract test file at src/tests/, then
deleted the duplicate.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 16:18:45 -06:00
Lex Christopherson
2e013d70b5 merge: resolve 12 conflicts with main — integrate continueHere feature into refactored closeoutUnit
Conflicts arose because main added continueHereHandle cleanup and
buildSnapshotOpts (with continueHereFired) while the PR extracted
inline closeout code into closeoutUnit(). Resolution: use closeoutUnit()
with buildSnapshotOpts() to pass all fields including continueHereFired.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 13:20:20 -06:00
Colin Johnson
7733e12413 fix: reap orphan-prone child processes across session churn (#920)
* fix: reap orphan-prone child processes across session churn

* test: make bg-shell cleanup test shell-safe
2026-03-17 13:14:51 -06:00
Jeremy McSpadden
3c9762d9b7 refactor: extract 7 focused modules from auto.ts (#898)
Break up the 3,975-line auto.ts into focused, single-concern modules:

- auto-budget.ts: Pure budget alert level and enforcement functions
- auto-tool-tracking.ts: In-flight tool call tracking for idle detection
- auto-observability.ts: Pre-dispatch observability validation and repair
- auto-unit-closeout.ts: Consolidated metrics/activity/memory closeout helper
- auto-direct-dispatch.ts: Manual /gsd dispatch phase command handling
- auto-timeout-recovery.ts: Idle and hard timeout recovery with escalation
- auto-model-selection.ts: Model routing, complexity classification, fallback chains

auto.ts retains orchestration (start/stop/pause, handleAgentEnd, dispatchNextUnit)
and drops from 3,975 to 3,256 lines (-719 lines, -18%).

All extractions are pure moves with re-exports — no behavior changes.
All 1,092 unit tests and 30 integration tests pass.
2026-03-17 11:03:01 -05:00
Tom Boucher
ea9c5f7ee2 fix: headless mode exits early on progress notifications containing 'complete' (#879) (#888)
isTerminalNotification() used broad substring matching against
['complete', 'stopped', 'blocked']. Any notification containing these
words triggered early exit — including progress messages like:
  'All slices are complete — nothing to discuss.'
  'Override(s) resolved — rewrite-docs completed.'
  'Skipped 5+ completed units. Yielding to UI before continuing.'

Fix: Replace substring matching with prefix matching against the actual
stop signals emitted by stopAuto():
  'Auto-mode stopped...'
  'Step-mode stopped...'

These are the ONLY notifications that indicate auto-mode has genuinely
terminated. All other notifications (slice completion, override
resolution, skip yielding) are progress events and must not trigger
exit.

Also tighten isBlockedNotification to match 'blocked:' (with colon)
instead of bare 'blocked' to avoid false positives from unrelated
messages.

Added 15 regression tests covering:
- All real terminal notification variants
- 6 false-positive cases from the issue report
- Non-notify event rejection
- Blocked detection with and without colon
2026-03-17 09:11:34 -06:00
Tom Boucher
ae8b8eeca3 fix: limit native web_search to max_uses:5 per response (#817) (#869) 2026-03-17 08:23:05 -06:00
Tom Boucher
4c7c64f7f5 fix: completed milestone with summary re-entered as active on resume (#864) (#868) 2026-03-17 08:22:16 -06:00
Jeremy McSpadden
d06e9ca12e fix: auto-heal STATE.md missing in preDispatchHealthGate (#862) 2026-03-17 08:20:10 -06:00
Jeremy McSpadden
2d037249c4 test: expand E2E smoke tests with 14 new CLI verification tests
Add comprehensive black-box smoke tests covering command routing,
graceful error handling, headless mode validation, and help completeness.

New tests:
- Command routing: headless --help, sessions --help
- Flag aliases: -v (--version), -h (--help)
- Error handling: no-TTY clean exit, unknown flags resilience
- Headless mode: missing .gsd/ dir, missing --context, invalid/negative --timeout
- Help completeness: all subcommands listed, all key flags listed
- Edge cases: --version ignores trailing args, headless positional help

All tests run without API keys and use temp directory isolation.
2026-03-17 00:02:26 -05:00
TÂCHES
193b2b32a5 fix: strip clack UI from postinstall, keep silent Playwright download (#783)
npm ≥7 suppresses lifecycle script output by default, so the clack
banner/spinner was invisible during `npm install -g`. The user-facing
onboarding experience already lives at first `gsd` launch (onboarding.ts),
making the postinstall UI redundant dead code.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 21:35:04 -06:00
Jeremy McSpadden
6ed9cd5359 fix: resolve CI failures in VS Code extension PR
- Fix Windows MCP test failures: use pathToFileURL() instead of bare
  join() paths for dynamic imports, fixing ERR_UNSUPPORTED_ESM_URL_SCHEME
  on Windows where D:\ paths are not valid ESM import specifiers

- Remove parallel orchestration code that was WIP from another feature
  branch and not part of the VS Code extension scope (commands.ts,
  preferences.ts, types.ts changes reverted to main)

- Rebase cleanly onto main, resolving mcp-server.ts merge conflict by
  keeping main's dynamic import approach with PR's exported interface
  and JSDoc documentation
2026-03-16 16:53:34 -05:00
Jeremy McSpadden
48feced87d feat: add VS Code extension scaffold and MCP server compiled module
- Add vscode-extension/ with full MVP scaffold:
  - GsdClient: spawns gsd --mode rpc, JSON line communication
  - @gsd Chat participant: forward messages to agent, stream responses
  - Sidebar panel: connection status, model info, start/stop controls
  - Command palette: gsd.start, gsd.stop, gsd.newSession, gsd.sendMessage
  - Extension config: gsd.binaryPath setting
- Add compiled MCP server module at src/mcp-server.ts for tsc output
- Add MCP server tests verifying module import and instantiation
2026-03-16 16:46:20 -05:00
Ryan Harrington
f87b4938ca fix/gsd-bg-shell-stale-cwd: normalize bg-shell worktree cwd detection 2026-03-16 17:02:58 -04:00
Ryan Harrington
8b8ba0d207 fix/gsd-bg-shell-stale-cwd: resync bg-shell cwd after auto-worktree exit 2026-03-16 16:45:21 -04:00
TÂCHES
966e5e80fb Merge pull request #673 from jeremymcs/feat/v2.20-phase2-3-features
feat: v2.20 Phase 2-4 — skills, integrations, MCP server
2026-03-16 14:29:07 -06:00
Jeremy McSpadden
062b5c65eb fix: skip environment-dependent tests in CI
- Skip E2E --print test when no API key is configured (process hangs
  waiting for onboarding wizard input in non-TTY CI environments)
- Skip file-watcher extensions subdirectory test on Windows (chokidar
  subdirectory event delivery is unreliable in Windows CI runners)
2026-03-16 14:38:59 -05:00
Jeremy McSpadden
3690e7a8ca fix: stabilize file-watcher and E2E smoke tests for CI
- Increase file-watcher extension directory test delay to 1500ms with
  500ms settle time (Windows filesystem events are slower)
- Make E2E --print test more permissive on exit code 1: check for
  unhandled crash indicators instead of specific error messages
  (error text varies by CI environment)
2026-03-16 14:32:25 -05:00
TÂCHES
07effd64cc Merge pull request #471 from Jamie-BitFlight/feat/claude-import-skills-plugins
feat: import Claude marketplace plugins with namespaced components
2026-03-16 13:32:09 -06:00
Jeremy McSpadden
ce6e684899 fix: increase file-watcher test delay for CI stability 2026-03-16 14:00:47 -05:00
Jeremy McSpadden
8d56ab2893 feat: add MCP server mode, /lint skill, E2E smoke tests
- Add native MCP server mode (--mode mcp): exposes GSD's tools via
  Model Context Protocol over stdin/stdout for Claude Desktop, VS Code,
  and other MCP-compatible clients. Uses @modelcontextprotocol/sdk.
- Add /lint skill: auto-detects ESLint, Biome, Prettier, rustfmt,
  gofmt, Black, Ruff and runs with structured output
- Add 6 E2E smoke tests: --version, --help, config --help, update
  --help, --list-models, and --mode text --print startup
- Fix diff-context.ts stdio type for CI compatibility
- Fix token-counter.ts tiktoken import for extensions typecheck
- Update help text and CLI to include --mode mcp
2026-03-16 13:56:31 -05:00
Jeremy McSpadden
973b8992e5 feat: add GitHub API client, diff-aware context, tiktoken token counting
- Add GitHub API integration via @octokit/rest: createGitHubClient,
  getRepoInfo (parses HTTPS/SSH remotes), createPullRequest,
  getPullRequest, listPullRequestReviews, createIssueComment
- Add diff-aware context module: getRecentlyChangedFiles,
  getChangedFilesWithContext, rankFilesByRelevance — prioritizes
  recently-changed files for context window budget allocation
- Add accurate token counting via tiktoken: countTokens (async),
  countTokensSync, initTokenCounter — falls back to chars/4 heuristic
  when tiktoken is unavailable
- 27 new tests across 3 test files
2026-03-16 13:50:00 -05:00
Jeremy McSpadden
0b3163d297 feat: add /review skill, /test skill, chokidar file watcher, subcommand help
- Add /review skill: reviews staged/unstaged/commit changes for security,
  performance, bugs, and quality with structured findings by severity
- Add /test skill: auto-detects test framework, generates comprehensive
  tests for source files, or runs suites with failure analysis
- Add chokidar file watcher: watches ~/.gsd/agent/ for config changes
  (settings.json, auth.json, models.json, extensions/) with debounced
  events on an EventBus
- Add --help per subcommand: `gsd config --help` and `gsd update --help`
  show subcommand-specific usage information
- 8 new file-watcher tests (start/stop, event emission, debouncing,
  unrelated file filtering)
2026-03-16 13:47:25 -05:00
Jeremy McSpadden
ebbcbe363a security: add SSRF protection to fetch_page tool
Block requests to private/internal addresses in the fetch_page tool:
- Private IP ranges (10.x, 172.16-31.x, 192.168.x, 127.x, 169.254.x)
- Cloud metadata endpoints (metadata.google.internal, instance-data)
- localhost
- Non-HTTP protocols (file://, ftp://)
- IPv6 private ranges (::1, fc00:, fd, fe80:)

Add isBlockedUrl() to url-utils.ts with 11 new tests covering all
blocked and allowed URL patterns.
2026-03-16 13:35:48 -05:00
Jeremy McSpadden
2c926c12e3 fix: Phase 1 quick wins — bug fixes, security hardening, and performance
- Fix loadStoredEnvKeys divergent provider lists: add telegram_bot and
  custom-openai to wizard.ts (the canonical copy used by CLI), remove
  dead duplicate from onboarding.ts
- Security: add SAFE_COMMAND_PREFIXES allowlist to resolveConfigValue
  to prevent arbitrary RCE via settings.json shell commands
- Security: add TOFU (Trust On First Use) model for project-local
  extensions — skip untrusted .pi/extensions/ with stderr warning
- Performance: debounce sql.js MemoryStorage persistence (500ms window)
  so rapid mutations coalesce into a single db.export()+writeFileSync
- Fix double lstatSync call in tool-bootstrap.ts isRegularFile
- Add 26 new tests covering all changes
2026-03-16 13:18:02 -05:00
Lex Christopherson
3d2f294f6a fix: google-search OAuth test mock and Windows path separator in smoke test
- google-search test: mock getApiKeyForProvider to return JSON string
  matching real OAuth provider behavior (token+projectId), instead of
  using AuthStorage.inMemory which bypasses the OAuth getApiKey transform
- smoke test: split on /[/\\]/ for Windows path separator compatibility

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 11:56:46 -06:00
Lex Christopherson
20e0fe2460 Merge remote-tracking branch 'origin/main' into test/extension-smoke-test 2026-03-16 11:48:44 -06:00
Lex Christopherson
d187a1ed2d fix: use file:// URL for dynamic imports in smoke test (Windows compat)
On Windows, raw paths like D:\... are interpreted as protocol "d:" by
the ESM loader. Convert via pathToFileURL before dynamic import.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 11:46:04 -06:00
Jamie McGregor Nelson
13730189f2 test(claude-import): use portable fixtures for marketplace discovery tests 2026-03-16 11:47:28 -04:00
Jamie McGregor Nelson
60413c4ea9 test: skip marketplace contract tests when local repos are absent 2026-03-16 11:47:28 -04:00
Jamie McGregor Nelson
2e3fa903b1 feat: import Claude marketplace plugins with namespaced components 2026-03-16 11:47:28 -04:00
Lex Christopherson
40dd80a41e fix(voice): replace __dirname with import.meta.dirname for ESM compat
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 19:35:07 -06:00
Lex Christopherson
15462a7da7 test: add extension smoke test to catch import failures in CI
Dynamically discovers all bundled extensions and verifies they can be
imported without throwing. Catches missing imports, circular deps, and
broken module resolution that tsc cannot detect since extensions are
loaded at runtime via jiti.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 19:27:39 -06:00
Harald Heckmann
186a1de406 feat: Use google search via Google OAuth if available 2026-03-15 11:13:36 +01:00
Colin Johnson
fe03743b08 fix: guard against newer synced resources (#445)
Co-authored-by: TÂCHES <afromanguy@me.com>
2026-03-14 22:58:18 -06:00
Flux Labs
16364c7dba fix: prevent web_search tool injection for non-Anthropic providers serving Claude models (#444) (#446)
GitHub Copilot users with Claude models got 400 errors because the native
Anthropic web_search_20250305 tool was injected into requests to Copilot's
API proxy, which doesn't support it. The root cause was that model_select
never fires before the first API request on new sessions, so the fallback
heuristic (model name starts with "claude-") couldn't distinguish direct
Anthropic from proxied providers.

Fix: pass the resolved Model object through to the before_provider_request
event so extensions can check model.provider directly instead of relying on
model name heuristics.
2026-03-14 22:15:00 -06:00
Flux Labs
ecf8125e39 feat: add Ollama Cloud as model and web tool provider (#430) (#434)
Add Ollama Cloud (ollama.com) as a built-in provider with both model
hosting and web search/fetch capabilities.

Model provider:
- 13 curated models via OpenAI-compatible API (Llama 3.1, Qwen 3,
  DeepSeek R1, Gemma 3, Mistral, Phi-4, GPT-OSS)
- Auth via OLLAMA_API_KEY environment variable
- Registered in onboarding, env hydration, and model resolver

Web tool provider:
- Search via POST ollama.com/api/web_search
- Page fetch via POST ollama.com/api/web_fetch (fallback after Jina)
- Added as third search provider option alongside Tavily and Brave
- /search-provider command updated with ollama option

Closes #430
2026-03-14 21:03:31 -06:00
deseltrus
aca53c5853 refactor: replace hardcoded extension list with dynamic discovery in loader
loader.ts previously maintained a hardcoded list of bundled extension paths
for GSD_BUNDLED_EXTENSION_PATHS. This required manual updates whenever
extensions were added or removed, and created a consistency gap with
buildResourceLoader() which already discovers extensions dynamically.

Replace with runtime directory scanning that mirrors the discovery rules
in resource-loader.ts:
- Top-level .ts/.js files → extension entry point
- Directories with index.ts or index.js → extension entry point
- Directories without either (shared/, remote-questions/) → skipped

Benefits:
- Adding a new extension no longer requires editing loader.ts
- GSD_BUNDLED_EXTENSION_PATHS stays in sync with what buildResourceLoader()
  loads in the main process — subagents now receive the same extensions
- Fixes: 5 extensions (google-search, mcporter, ttsr, universal-config,
  voice) were loaded in the main process but missing from
  GSD_BUNDLED_EXTENSION_PATHS, meaning subagents did not receive them
- Eliminates a common source of merge conflicts for contributors and forks
  that add custom extensions
2026-03-14 20:37:18 +01:00
Flux Labs
b6ec4f9fad Fix packaging verification and path portability (#378) 2026-03-14 12:28:14 -06:00
Juan Francisco Lebrero
f6f1f9aa27 fix(search): always use native Anthropic web search when available (#374)
Three bugs prevented native web_search from being used with Anthropic:

1. model_select never fires on session restore (SDK's modelsAreEqual
   guard suppresses it when the default model matches the restored one),
   so isAnthropicProvider stayed false and native search was never
   injected. Fix: fall back to detecting "claude-" in the payload model
   name when model_select hasn't fired.

2. Custom search tools (search-the-web, search_and_read) were only
   removed from the payload when BRAVE_API_KEY was missing. With the
   key present, the model saw both native and Brave tools and often
   picked the Brave ones, which failed with network errors. Fix: always
   remove custom search tools from Anthropic requests.

3. google_search (Gemini-based) was not included in the disable list,
   so the model could call it even without GEMINI_API_KEY set. Fix: new
   CUSTOM_SEARCH_TOOL_NAMES list covers all three custom search tools.
2026-03-14 11:46:50 -06:00
Jamie Nelson
f791731d4f feat: add GitHub Workflows skill with CI workflow and ci_monitor tool (#294)
* feat: add GitHub Workflows skill with CI workflow and ci_monitor tool

- Runs on push to main and feature branches
- Runs on pull requests to main
- Build + test pipeline using Node 22

Cross-platform CI monitoring tool for debugging GitHub Actions:
- `runs` - List recent workflow runs
- `watch` - Monitor running workflow
- `fail-fast` - Exit 1 on first failure (for scripts)
- `log-failed` - Show failed job logs
- `test-summary` - Extract test pass/fail counts
- `check-actions` - GraphQL query for action versions
- `grep` - Search logs with context
- `wait-for` - Block until deployment keyword appears

Pure Node.js - no shell interpolation, works on macOS/Windows/Linux.

Drift-immune skill that:
- Routes all CI operations through ci_monitor.cjs
- Fetches live docs from docs.github.com (no stale training data)
- Provides validation constraints (BEFORE/AFTER/EVIDENCE)

- Split tests into test:unit (141 tests, ~12s) and test:integration (5 tests)
- Fixed idle-recovery.test.ts for current implementation
- Removed AGENTS.md dead code from resource-loader.ts
- Moved npm run build out of tests (fixes ENOBUFS)

When CI fails, you need observable diagnostics:
- `gh run` output is not script-friendly
- ci_monitor.cjs provides structured output for automation
- The skill ensures AI uses the tool, not stale training data

* fix: resolve imports and path for current upstream version

- Updated imports from @mariozechner/pi-coding-agent to @gsd/pi-coding-agent
- Fixed integration test path calculation to use process.cwd()
- Kept test:unit and test:integration scripts

* fix: replace search provider preference instead of accumulating

AuthStorage.set() for api_key credentials appends to the existing list
rather than replacing. When setSearchProviderPreference was called twice
with different values, the second call appended the new value, leaving
the first value at index 0, which get() returned.

Fix: call auth.remove() before auth.set() to ensure only the latest
preference is stored.

https://claude.ai/code/session_01Qx7HRSDb117KzDZzdKk1KB

* fix: address all 10 open PR review comments

- package.json: run build before test:integration so a fresh checkout works
- pack-install.test.ts: replace execSync+shell redirects with execFileSync
  argument arrays (portable, no shell parsing, paths with spaces safe)
- ci_monitor.test.ts: remove unconditional passed++ after assert; move
  success message after the failed > 0 check so it only prints on success
- setup_gh.cjs: replace unzip/tar shell-outs with platform-specific
  execFileSync calls (unzip on macOS, PowerShell Expand-Archive on Windows);
  add compareVersions() for correct element-by-element semver comparison
- ci_monitor.cjs: add --repo/-R global option so repo is overrideable;
  fix getLogs() to use gh run view --log --job instead of binary REST endpoint

https://claude.ai/code/session_01AT6CgcAB62kWcDsTJg9HZM

* fix: make all changed files fully cross-platform (Windows/macOS/Linux)

- pack-install.test.ts: use tar npm package instead of tar CLI; resolve
  gsd binary as gsd.cmd on Windows; skip shebang check on Windows
- setup_gh.cjs: use execFileSync for all binary invocations; replace
  which with where on Windows; add Windows PATH guidance; filter preferred
  install dirs by platform; unify ZIP extraction to use process.platform
  consistently; escape single quotes in PowerShell Expand-Archive args
- ci_monitor.cjs: use path.join for .github/workflows paths; replace
  all split('\n') with split(/\r?\n/) to handle Windows CRLF output

https://claude.ai/code/session_01AT6CgcAB62kWcDsTJg9HZM

* refactor: simplify and deduplicate changed files

- ci_monitor.cjs: memoize getRepo() so gh repo view subprocess runs at
  most once per invocation instead of once per command call in watch loops
- pack-install.test.ts: extract packTarball() helper to eliminate
  duplicate npm pack logic across two tests; remove unused contents variable

https://claude.ai/code/session_01AT6CgcAB62kWcDsTJg9HZM

* refactor: remove redundant existsSync before canWrite() in findInstallDir

canWrite() already returns false for non-existent directories, so the
pre-check was a TOCTOU-style redundancy with no behavioral value.

https://claude.ai/code/session_01AT6CgcAB62kWcDsTJg9HZM

* fix: replace tar npm package with Node built-ins (zlib + manual tar parsing)

tar is not in the dependency tree. listTarEntries() decompresses via
createGunzip() and parses the 512-byte tar block format directly,
reading name/prefix/type/size fields per POSIX ustar spec. No external
dependency required. Also fixes the broken tarball variable reference
left over from the packTarball() refactor.

https://claude.ai/code/session_01AT6CgcAB62kWcDsTJg9HZM

* remove: drop setup_gh scripts in favour of ci_monitor

setup_gh.cjs and setup_gh.py were one-shot gh CLI installers.
ci_monitor.cjs covers the day-to-day CI use case and is the tool
the skill routes through. Environments that need gh installed can
use brew/winget/distro packages directly.

https://claude.ai/code/session_01AT6CgcAB62kWcDsTJg9HZM

* fix: run only unit tests in CI — integration tests cause ENOBUFS

The integration tests (npm pack → npm install → spawn node) exceed
the buffer limits of the CI runner environment. They are documented
as requiring a manual build+run step. CI now runs test:unit only.

https://claude.ai/code/session_01AT6CgcAB62kWcDsTJg9HZM

* fix: run all tests in CI without ENOBUFS

- ci.yml: run unit and integration as separate steps; build is already
  its own step so test:integration doesn't need to rebuild
- package.json: remove npm run build from test:integration script
- pack-install.test.ts: npm install uses stdio:'ignore' to avoid
  piping large output through Node buffers (root cause of ENOBUFS);
  add early dist/ check with clear error message instead of rebuilding

https://claude.ai/code/session_01AT6CgcAB62kWcDsTJg9HZM

* fix: resolve ENOBUFS and clean up setup_gh references

- pack-install.test.ts: derive tarball filename from package.json
  instead of piping npm pack --json stdout; use stdio:ignore throughout
  to avoid exhausting OS pipe buffers on CI runners
- SKILL.md: remove setup_gh install instructions; assume gh is
  pre-installed via system package manager; point to ci_monitor.cjs
- github_project_setup.py: remove setup_gh.py reference from error message

https://claude.ai/code/session_01AT6CgcAB62kWcDsTJg9HZM

* fix: address Copilot review comments on pack-install.test.ts

- listTarEntries: collect chunks in array, Buffer.concat once on end
  instead of O(n²) repeated concat in data handler
- listTarEntries: attach error handler to createReadStream so read
  errors reject the Promise instead of crashing the process
- npm pack: use stdio:['ignore','ignore','pipe'] to preserve stderr
  for diagnostics while still avoiding ENOBUFS on stdout
- npm install: same — pipe stderr so failures include error output

https://claude.ai/code/session_01AT6CgcAB62kWcDsTJg9HZM

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-13 22:31:17 -06:00
Jamie Nelson
17074c4db5 fix: update tests for current implementation (#284)
- idle-recovery.test.ts: Use 'unknown-type' instead of 'execute-task'
  for null-path test (execute-task now has artifact paths for task summaries)

- app-smoke.test.ts: Remove AGENTS.md assertions (merged into system.md
  in commit 0b6d88f). Add ENOBUFS skip handling for tarball tests
  (system buffer exhaustion is not a code issue).
2026-03-13 16:26:17 -06:00