Commit graph

1143 commits

Author SHA1 Message Date
Derek Pearson
aab9b0cb33 fix(skills): address QA round 21
QA21-1: Recognize pip-tools style requirement manifests, including
requirements.in, requirements-dev.in, and files under requirements/*.in
or requirements/*.txt, for Python/FastAPI detection and nested marker
normalization.

QA21-2: Generalize Spring Boot version-catalog detection beyond the
default libs accessor by supporting any *.versions.toml catalog name and
matching its corresponding accessor in build.gradle(.kts).

Also fix the root-level requirements/base.in path matcher and add
regression tests for custom catalog accessors and pip-tools layouts.
2026-03-22 08:56:20 -04:00
Derek Pearson
c77d35e9f7 fix(skills): address QA round 20
QA20-1: Make Spring Boot bundle detection order-independent by first
collecting library aliases across version catalogs and then resolving
bundle aliases against that complete set.

QA20-2: Recognize common split Python requirements layouts
(requirements/base.txt, requirements-dev.txt, etc.) as requirements
sources for both Python/FastAPI detection and nested marker
normalization.

Also repair the detector helper block after the prior patch splice and
keep the full regression suite green.
2026-03-22 08:51:13 -04:00
Derek Pearson
f860fe0a91 fix(skills): address QA round 19
QA19-1: In pyproject dependency parsing, treat Poetry/table-form keys
as dependency names and only scan quoted requirement specs on
[project] dependencies / optional-dependency array lines. Prevents
extras like extras = ["fastapi"] from emitting dep:fastapi.

QA19-2: Support legacy Gradle Spring Boot declaration styles via
apply plugin: 'org.springframework.boot' and apply(plugin = ...).

QA19-3: Scope Maven Spring Boot detection to org.springframework.boot
groupId instead of any artifactId that happens to start with
spring-boot.

Add regression tests for:
- Poetry dependency table extras mentioning fastapi
- legacy apply plugin Spring Boot detection
- Maven artifactId-only spring-boot false positive
2026-03-22 08:46:08 -04:00
Derek Pearson
d8443b89e5 fix(skills): address QA round 18
QA18-1: Replace token-level FastAPI matching with package-name-aware
parsing for requirements.txt and pyproject dependency sections so extras
like my-sdk[fastapi] and unrelated fastapi tokens do not emit
dep:fastapi.

QA18-2: Scope direct Spring Boot detection to actual plugin/dependency
declarations instead of arbitrary spring-boot text, and fix Kotlin DSL
plugin syntax matching (id("org.springframework.boot")).

Add regression tests for:
- dependency extras mentioning fastapi
- build metadata mentioning spring-boot
- Kotlin DSL Spring Boot plugin detection
2026-03-22 08:41:42 -04:00
Derek Pearson
414a1433ba fix(skills): address QA round 17
QA17-1: Support multiline arrays inside [project.optional-dependencies]
so FastAPI declared in multiline optional dependency groups is detected
correctly.

QA17-2: Extend Spring Boot version-catalog detection to bundle aliases
(libs.bundles.*) by resolving bundles back to library aliases that map
to org.springframework.boot artifacts.

Add regression tests for:
- multiline optional FastAPI dependencies
- Spring Boot bundle alias detection
2026-03-22 08:36:40 -04:00
Derek Pearson
30d799e1b9 fix(skills): address QA round 16
QA16-1: In pyproject.toml, treat [project.optional-dependencies]
keys as extra names rather than dependency names by scanning only the
right-hand-side values. Prevents extras named 'fastapi' from emitting
dep:fastapi.

QA16-2: Support FastAPI direct-reference requirements using the @
operator (e.g. fastapi @ https://...).

QA16-3: Extend Spring Boot version-catalog detection to library aliases
(e.g. implementation(libs.backend.web) + module =
org.springframework.boot:spring-boot-starter-web), while keeping alias
correlation strict.

QA16-4: Use a neutral 'java/kotlin' language hint for nested Gradle
Spring Boot services, even when they use build.gradle.kts, to avoid
mislabeling Java codebases as Kotlin.

Add regression tests for optional-dependency extras, direct-reference
FastAPI, Spring Boot library aliases, and nested Gradle language hints.
2026-03-22 08:28:56 -04:00
Derek Pearson
da6f246891 fix(skills): address QA round 15
QA15-1: Extend exact FastAPI dependency detection to support common
PEP 508 specifiers like ~= and !=.

QA15-2: Scope pyproject.toml FastAPI detection to actual dependency
sections ([project] dependencies array, [project.optional-dependencies],
[tool.poetry.dependencies], and [tool.poetry.group.*.dependencies]) so
metadata-only mentions do not emit dep:fastapi.

QA15-3: Remove spring.boot alias-name matching from direct Spring Boot
detection. Direct matches now require org.springframework.boot or
spring-boot(-starter) strings; alias-based detection only succeeds via
alias usage + version-catalog id correlation.

QA15-4: When a nested Gradle Spring Boot service emits dep:spring-boot
and no language was otherwise detected, set primaryLanguage to
java/kotlin so onboarding no longer reports 'unknown project'.

Add regression tests for:
- FastAPI ~= operator
- pyproject metadata-only fastapi mention
- spring-like alias names without Spring Boot id
- nested Spring Boot language hint
2026-03-22 08:25:07 -04:00
Derek Pearson
803913b13d fix(skills): address QA round 14
QA14-1: Strip comments in libs.versions.toml indirectly by moving Spring
Boot version-catalog detection to alias correlation rather than raw
presence matching.

QA14-2: Require actual alias usage in build.gradle(.kts) plus matching
org.springframework.boot alias definition in libs.versions.toml before
emitting dep:spring-boot.

QA14-3: Tighten FastAPI detection to an exact dependency token with
valid package delimiters so fastapi-users / fastapi-cli alone do not
emit dep:fastapi.

Add stronger regression tests for:
- arbitrary Spring Boot alias correlation
- commented Spring Boot aliases
- unused Spring Boot aliases
- fastapi-* packages without fastapi itself
2026-03-22 08:21:03 -04:00
Derek Pearson
73bd5d9331 fix(skills): address QA round 13
QA13-1: Strip inline trailing comments when scanning dependency/build
files so comment-only mentions of fastapi or spring-boot no longer emit
synthetic framework markers.

QA13-2: Detect Spring Boot in Gradle version-catalog alias setups by
including libs.versions.toml in the scan and matching spring.boot /
spring-boot alias patterns as well as org.springframework.boot.

Add regression tests for:
- FastAPI inline comments
- Android inline spring-boot comments
- Spring Boot version-catalog alias detection
2026-03-22 08:16:20 -04:00
Derek Pearson
c297fe2e34 fix(skills): address QA round 12
QA12-1: Replace generic Gradle/POM matching for Java & Spring Boot
with a real framework marker () detected by scanning
pom.xml and Gradle files for Spring Boot plugins/dependencies. This
restores nested Gradle service detection without reintroducing Android
false positives.

QA12-2: Prevent standard Android projects (root build.gradle +
app/build.gradle) from matching the Spring Boot pack. Spring Boot now
requires the synthetic dependency marker, not generic build files.

QA12-3: Harden FastAPI detection:
- strip comments before matching
- scan each dependency file independently
- continue on per-file read errors instead of failing the whole scan

Also add regression tests for comment-only FastAPI mentions, nested
Spring Boot Gradle services, Android non-Spring Gradle projects, and
Spring Boot pack matching via dep:spring-boot.
2026-03-22 08:13:09 -04:00
Derek Pearson
18508c1129 fix(skills): address QA round 11
QA11-1: Expand recursive-scan ignore set to skip common heavyweight
folders (.venv, venv, Pods, bin, obj, .gradle, DerivedData, out)
so the bounded scan is far less likely to exhaust its budget before
reaching relevant nested project files.

QA11-2: Remove the arbitrary 10-file cap from FastAPI dependency reads.
All discovered requirements.txt / pyproject.toml files within the bounded
scan are now checked, eliminating traversal-order dependence in
multi-service repos.

QA11-3: Normalize safe nested project markers from the recursive scan
back into PROJECT_FILES markers (e.g. nested next.config.ts, manage.py,
requirements.txt, prisma/schema.prisma, app/build.gradle) while keeping
noisy root-only markers like package.json and generic build.gradle
root-only. Add regression tests for these nested layouts and Android
root-only exclusion behavior.
2026-03-22 08:08:41 -04:00
Derek Pearson
bc63161593 fix(skills): address QA round 10
QA10-1: Replace root-only synthetic marker detection with a bounded
recursive project scan (max 2000 files, depth 6, ignoring heavy dirs)
so nested .csproj/.fsproj/.sln, SQL, SQLite, Vue, and FastAPI service
layouts are detected correctly.

QA10-2: Split .NET synthetic markers by actual file type:
- *.csproj => primaryLanguage csharp
- *.fsproj => primaryLanguage fsharp
- *.sln => primaryLanguage dotnet

Update .NET Backend Patterns to match generic .NET markers
(*.csproj, *.fsproj, *.sln) while keeping .NET & C# limited to C#.

QA10-3: Add invariant tests validating:
- every SKILL_CATALOG matchFiles entry is backed by detection
- every GREENFIELD_STACKS pack label resolves to SKILL_CATALOG

Also add regression tests for nested SQL, nested .csproj, F#,
nested .vue, and nested FastAPI service requirements detection.
2026-03-22 08:01:31 -04:00
Derek Pearson
d7d5d0e3ad fix(skills): address QA round 8
QA8-1: Add case-insensitivity test for FastAPI detection using PyPI
canonical name 'FastAPI' (mixed case) in pyproject.toml.

QA8-2: False positive — comment matching is acceptable tradeoff;
mentions of 'fastapi' in requirements comments almost always correlate
with actual FastAPI usage or intent.

QA8-3: Empty catch block is trivially correct; skipping test for it.
2026-03-22 07:52:11 -04:00
Derek Pearson
183b54d75e fix(skills): detect FastAPI via dependency scanning
Replace the lazy 'no brownfield detection' approach with proper
dependency-based detection. Scan requirements.txt and pyproject.toml
for the 'fastapi' package name (case-insensitive word-boundary match)
using the existing readBounded() utility (64KB cap).

Adds 'dep:fastapi' synthetic marker to detectedFiles when found,
which the FastAPI skill pack matches via matchFiles: ['dep:fastapi'].
This ensures only actual FastAPI projects get the pack recommended,
not all Python projects.

Tests: 3 new detection tests (requirements.txt, pyproject.toml,
negative Django case) + 1 new catalog test (dep:fastapi matching).
Total: 50 detection + 17 catalog + 5 activation + 12 smoke = 84.
2026-03-22 07:39:16 -04:00
Derek Pearson
064c9ce421 fix(skills): address QA round 6
QA6-1: Add 16 matchPacksForProject unit tests covering language match,
file match, Xcode platform match, matchAlways, and isolation checks
(FastAPI not in generic Python, Spring Boot not via language alone,
Unity/Godot don't cross-contaminate).

QA6-2: Remove FastAPI from brownfield auto-detection entirely — no
matchFiles or matchLanguages. Available via greenfield stack selection
or manual install only, since no FastAPI-specific file marker exists
on disk.

QA6-3: Remove matchLanguages from Java & Spring Boot pack so it only
triggers via matchFiles (pom.xml, build.gradle*). Prevents Android
projects from getting Spring Boot recommended via language match.

QA6-4: False positive — F# gets 'csharp' label cosmetically but the
.NET packs are correct for F# developers.
2026-03-22 07:34:41 -04:00
Derek Pearson
84657d0398 fix(skills): address QA round 5
QA5-1: Remove matchLanguages from FastAPI pack so it only triggers via
file-based detection (matchFiles), not for all Python projects. Aligns
with Django precedent of framework-specific file matching.

QA5-2: Add requirements.txt to pytest verification command check so
requirements.txt-only Python projects get pytest suggested.

QA5-3: Add FastAPI greenfield stack entry (packs: FastAPI + Python +
Python Advanced) for parity with Django.

QA5-4: False positive — Vue src/ scanning is non-recursive by design;
all standard Vue scaffolds place App.vue directly in src/.

QA5-5: Add 11 new detection tests covering Vue .vue scanning, Vue CLI
config, requirements.txt Python detection, Android app/build.gradle,
Unity, Godot, Airflow, Kubernetes Helm, Blockchain Hardhat, CI/CD
.github/workflows, and Tailwind config. Test count: 36 → 47.
2026-03-22 07:26:32 -04:00
Derek Pearson
90b13021f8 fix(skills): address QA round 4
QA4-1: Split Game Development into separate Unity and Godot packs to
avoid cross-contamination between engines.

QA4-2: Add requirements.txt to Python base pack matchFiles so Python
Advanced doesn't trigger without the base pack.

QA4-3: Add Prisma to fullstack-js greenfield stack to differentiate
it from react-web.

QA4-4: Remove Spring Boot from Android greenfield stack — server-side
Java framework is irrelevant for Android development.

QA4-5: Extract FastAPI into its own pack (consistent with Django being
separate) instead of bundling in Python Advanced.

QA4-6: Add airflow.cfg to PROJECT_FILES and Data Engineering matchFiles
so Airflow-only projects also trigger data engineering skills.

QA4-7: Add Tailwind CSS to react-web, fullstack-js, nextjs, and
svelte greenfield stacks.

QA4-8: Add Unity and Godot as separate greenfield stack options.

QA4-9: Fix Vue.js detection for non-Nuxt projects by adding .vue
file extension scanning (scans src/ for *.vue files), vue.config.*
to PROJECT_FILES, and *.vue synthetic marker to Vue.js pack matchFiles.

QA4-10: Add app/build.gradle and app/build.gradle.kts to LANGUAGE_MAP
for Android project language detection.
2026-03-22 07:21:04 -04:00
Derek Pearson
0067ada24e feat(skills): add 19 wshobson/agents packs with 40 curated skills
Add comprehensive coverage from wshobson/agents (654K total installs,
31.9K GitHub stars, all security audits PASS):

Complement existing packs:
- TypeScript & JS Development (4 skills, 41K combined installs)
- React State & Patterns (2 skills, 8.1K)
- React Native Architecture (2 skills, 10K)
- Next.js App Router Patterns (1 skill, 9.5K)
- Angular Migration (1 skill, 3.2K)
- Python Advanced (5 skills, 40K — perf, testing, async, uv, FastAPI)
- Rust Async Patterns (1 skill, 5.9K)
- Go Concurrency Patterns (1 skill, 3.4K)
- .NET Backend Patterns (1 skill, 6K)
- PostgreSQL Design (1 skill, 8.8K)

New domain packs:
- Tailwind CSS (1 skill, 22.8K)
- Android (1 skill, 7K)
- Kubernetes (4 skills — manifests, Helm, GitOps, security)
- CI/CD Automation (3 skills — pipelines, GitHub Actions, secrets)
- Blockchain & Web3 (3 skills — Solidity, DeFi, testing)
- Data Engineering (4 skills — dbt, Airflow, Spark, quality)
- Game Development (2 skills — Unity ECS, Godot GDScript)

Essential (matchAlways):
- Code Review & Quality (2 skills, 15K)
- Git Advanced Workflows (1 skill, 4.6K)

New detection triggers: tailwind.config.*, app/build.gradle*,
Chart.yaml, kustomization.yaml, .github/workflows, hardhat.config.*,
foundry.toml, dbt_project.yml, ProjectSettings/ProjectVersion.txt,
project.godot.

Updated GREENFIELD_STACKS with new complement packs and 4 new
greenfield options (Android, Kubernetes, Blockchain, Data Engineering).
2026-03-22 07:09:46 -04:00
Derek Pearson
3a35eae883 feat(skills): add 11 new skill packs covering major frameworks and languages
New skill packs with auto-detection:
- Java & Spring Boot (github/awesome-copilot, 9.1K installs)
- .NET & C# (github/awesome-copilot, 8.1K installs) — scans for *.csproj/*.sln
- Flutter (flutter/skills, official, 54.6K total)
- Angular (analogjs/angular-skills, official, 33.5K total)
- Vue.js (vuejs-ai/skills, official, 30.7K total) — triggers on nuxt.config.*
- Svelte (sveltejs/ai-tools, official, 3.1K total)
- Next.js (vercel-labs/vercel-plugin, official) — triggers on next.config.*
- Docker (github/awesome-copilot, 8.3K installs)
- Terraform (hashicorp/agent-skills, official, 9.4K total)
- Django (vintasoftware/django-ai-plugins, 2.2K total)
- PHP & Laravel (jeffallan/claude-skills, 10.1K total)

Detection additions:
- PROJECT_FILES: angular.json, next.config.*, nuxt.config.*, svelte.config.*,
  Dockerfile, docker-compose.*, main.tf, manage.py, requirements.txt
- Extension scanning: *.csproj/*.sln/*.fsproj for .NET detection
- LANGUAGE_MAP: manage.py and requirements.txt → python
- GREENFIELD_STACKS: Angular, Vue, Svelte, Next.js, Flutter, Java, .NET,
  PHP, Django entries
- 8 new detection tests (36 total, up from 28)
2026-03-22 06:52:55 -04:00
Derek Pearson
a30b125020 feat(skills): add SQLite/SQL detection, SQL optimization pack, and Redis pack
- Scan project root for *.sqlite/*.sqlite3/*.db files → synthetic *.sqlite marker
- Scan for *.sql files (migrations, schemas, seeds) → synthetic *.sql marker
- Add SQL Optimization & Review pack (github/awesome-copilot): sql-optimization
  (7.8K installs) and sql-code-review (7.6K installs) — covers SQL injection
  prevention, parameterized queries, index strategy, anti-patterns. Triggers on
  *.sql, *.sqlite, or any database ORM config (Prisma, Supabase, Drizzle).
- Add Redis pack (redis/agent-skills): redis-development. Triggers on redis.conf.
- Add redis.conf to PROJECT_FILES.
- 4 new detection tests for SQLite/SQL file scanning.
2026-03-22 06:40:53 -04:00
Derek Pearson
e48538b70d feat(skills): add Prisma and Supabase/Postgres database packs
- Prisma: prisma-database-setup, prisma-client-api, prisma-cli from
  prisma/skills (10.7K installs). Auto-detects via prisma/schema.prisma.
- Supabase & Postgres: supabase-postgres-best-practices from
  supabase/agent-skills (44.3K installs). Auto-detects via
  supabase/config.toml. Covers Postgres patterns (indexing, RLS,
  migrations) through Supabase lens.
- Add drizzle.config.ts/js to PROJECT_FILES for future ORM detection.
2026-03-22 06:29:50 -04:00
Derek Pearson
a4de1d30c5 fix(skills): address QA round 3
- Fix Windows fd leak: close markerFd before unlinkSync in catch block
- Increase pbxproj read limit from 256KB to 1MB (SDKROOT appears after
  file references/build phases in large projects)
- Fix matchPacksForProject docstring: returns catalog order, not sorted
- Add legacy dir to skill telemetry (captureAvailableSkills, detectStaleSkills)
  so pre-migration skills appear in health/telemetry reports
2026-03-22 06:22:23 -04:00
Derek Pearson
b442a55bff fix(skills): address QA round 2
- Add azure-pipelines.yml to PROJECT_FILES and Azure pack matchFiles
- Add serverless.yaml variant to PROJECT_FILES and AWS pack matchFiles
- Fix marker fd leak in migrateSkillsToEcosystemDir: wrap mkdirSync
  inside try/finally, remove marker on failure so migration retries
2026-03-22 06:13:50 -04:00
Derek Pearson
aa0822466e fix(skills): defer greenfield skill selection to post-design phase
Greenfield projects (empty directories) no longer ask users to pick a tech
stack during init. Non-technical users may not know their architecture yet.
Instead, only essential packs (find-skills, skill-creator, agent-browser,
document handling) are installed. Stack-specific skills auto-detect later
via brownfield detection once the LLM creates project files.

GREENFIELD_STACKS retained as a reference for programmatic use by the LLM
and the /gsd skills command.
2026-03-22 06:11:44 -04:00
Derek Pearson
ddeb352143 feat(skills): add cloud platform packs (Firebase, Azure, AWS) and improve detection
- Add Firebase, Azure, and AWS skill packs to curated catalog
- Add cloud config files (firebase.json, cdk.json, samconfig.toml, serverless.yml)
  and React Native markers (metro.config.js/ts, react-native.config.js) to detection
- Fix React Native detection to use matchFiles instead of broad language match
- Add matchAlways flag for essential packs so they are offered to all projects
- Add Firebase/AWS/Azure to greenfield tech stack wizard
- Improve Xcode detection: scan ios/macos/app subdirs, use bounded fd read,
  set primaryLanguage=swift when xcodeproj found, handle SDKROOT=auto via
  SUPPORTED_PLATFORMS fallback
- Fix migration: handle symlinked skill dirs, use atomic wx flag for race safety
2026-03-22 06:03:42 -04:00
Derek Pearson
a0ea8c92bb feat(skills): curate catalog — add top ecosystem skills, drop low-quality bundled ones
Catalog changes:
- Added: find-skills (#1 on skills.sh, 657K installs), shadcn/ui (#5,
  130K), skill-creator (#26, 98K), agent-browser (#23, 120K)
- Removed from React pack: web-design-guidelines (thin wrapper that
  just fetches an external URL; redundant with the Vercel ecosystem
  version and userinterface-wiki)
- The old bundled skills (18 total, 11 web-frontend-focused) are no
  longer force-synced. The catalog now points to the better ecosystem
  versions from Vercel, Anthropic, and shadcn.

Reasoning: The original bundled skills were heavily web-frontend biased
with significant overlap (3 UI polish skills, 4 web audit skills). The
catalog should surface the highest-quality ecosystem skills rather than
force-installing duplicative bundled ones.
2026-03-22 05:47:16 -04:00
Derek Pearson
6889f6666f docs(skills): update all references from ~/.gsd/agent/skills/ to ~/.agents/skills/
Updates docs/skills.md with:
- New skill directories section (global + project-local)
- Migration note for existing users
- Installation via skills.sh CLI
- Curated onboarding catalog with all available packs
- Maintainer guide for adding/editing catalog entries

Also updates:
- docs/configuration.md: skill lookup paths
- docs/what-is-pi/09-the-customization-stack.md: placement paths
- docs/context-and-hooks/07-the-system-prompt-anatomy.md: example path
- src/resource-loader.ts: JSDoc comment (skills no longer synced)
2026-03-22 05:35:14 -04:00
Derek Pearson
e706876114 fix(skills): add migration from ~/.gsd/agent/skills/ to ~/.agents/skills/
Existing GSD users have skills in ~/.gsd/agent/skills/ that would
silently vanish after the directory switch.  This adds:

1. One-time migration in initResources() — copies skill directories
   from ~/.gsd/agent/skills/ to ~/.agents/skills/ (collision-safe,
   writes .migrated-to-agents marker so it runs at most once).

2. Legacy fallback reads in loadSkills() and getSkillSearchDirs() —
   the old directory is scanned as a low-priority fallback so skills
   work immediately, even before the migration runs on next restart.

The old directory is NOT deleted — users can safely downgrade to a
pre-migration GSD version without losing skills.
2026-03-22 05:30:29 -04:00
Derek Pearson
4020828260 feat(skills): parse SDKROOT from pbxproj for platform-aware iOS skill matching
Replace boolean hasXcodeProject with xcodePlatforms array that reads
SDKROOT values from *.xcodeproj/project.pbxproj files. iOS skill packs
now only match when SDKROOT=iphoneos, so macOS / watchOS / visionOS /
tvOS Xcode projects won't get iOS-specific skills.

Also splits the monolithic "Swift / iOS" pack into 8 granular bundles
matching dpearson2699/swift-ios-skills plugin structure:
  - SwiftUI + Swift Core (any Swift project)
  - iOS App Frameworks, Data Frameworks, AI & ML, Engineering,
    Hardware, Platform (iphoneos projects only)

Adds batched installation to minimize npx invocations when multiple
packs share the same repo.
2026-03-22 05:19:05 -04:00
Derek Pearson
aaed0ab796 feat(skills): use ~/.agents/skills/ as primary skills directory with curated catalog
Stop force-syncing bundled skills to ~/.gsd/agent/skills/ on every launch.
Instead, use ~/.agents/skills/ (the industry-standard skills.sh directory)
as the primary global skills location, and .agents/skills/ for project-local
skills.

Changes:
- loadSkills() now scans ~/.agents/skills/ (global) and .agents/skills/ (project)
  instead of ~/.gsd/agent/skills/ and .gsd/skills/
- initResources() no longer syncs src/resources/skills/ → ~/.gsd/agent/skills/
- skill-discovery, skill-telemetry, skill-health, preferences-skills all updated
  to use the ecosystem directory
- New skill-catalog.ts: curated skill packs mapped to tech stacks, with
  brownfield auto-detection and greenfield tech stack selection
- Init wizard gains a skill installation step that presents relevant packs
  and installs via `npx skills add`
- Export ECOSYSTEM_SKILLS_DIR and ECOSYSTEM_PROJECT_SKILLS_DIR from pi-coding-agent

Fixes #2004
2026-03-22 05:03:36 -04:00
Iouri Goussev
642c0f5a9e test: fix Assertion Roulette, Eager Test, and contract test regressions (#1938)
* test: add assertion messages to fix Assertion Roulette in GSD tests

Add descriptive messages to multi-assertion tests where a bare failure
output ("expected true, got false") wouldn't identify which assertion
broke. Affected tests: auto-secrets-gate, search-tavily, search-provider-
command, tavily-helpers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: fix Eager Test smell in captures and worktree-manager tests

- Split captures: loadPendingCaptures test — extracted loadAllCaptures
  assertion into its own focused test
- Refactor worktree-manager: replace monolithic main() script with 11
  isolated test() calls, each with its own repo setup via helpers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: add assertion messages to remaining test files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: fix contract test gate, dynamic roots, and shared fetch helpers

- Fix reject-notice sub-test gated on outcome.kind (actual) instead of
  expectedKind (map value) in web-command-parity-contract.test.ts
- Restore dynamic loop over registered non-gsd passthrough roots with
  an explicit count assertion so new registrations fail loudly
- Extract normalizeHeaders/parseJsonBody to src/tests/fetch-test-helpers.ts
  and import in both search-tavily and llm-context-tavily tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-21 21:24:15 -06:00
Lex Christopherson
61e473b32c fix: add missing codeFilesChanged to journal integration test mock
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 21:12:38 -06:00
TÂCHES
d40ed851a2 fix(repo-identity): use native realpath on Windows to resolve 8.3 short paths (#1960)
Use realpathSync.native() on Windows in canonicalizeExistingPath to resolve
8.3 short names (RUNNER~1 → runneradmin). Fixes isInheritedRepo path
comparison failures on Windows CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 21:08:58 -06:00
Tom Boucher
09f3a5f970 fix(doctor): gate roadmap checkbox on summary existing on disk, not issue detection (#1915)
The roadmap-done condition checked whether the missing-summary issue was
detected in the issues array, but at fixLevel="task" the summary is
detected and never fixed (deferred via COMPLETION_TRANSITION_CODES).
This caused the roadmap checkbox to be marked without the summary on
disk, making deriveState() skip the summarizing phase and hard-stop at
validating-milestone.

Replace the issues.some() fallback with an existsSync re-check so the
roadmap is only marked when the summary actually exists — either
pre-existing or created earlier in the same doctor run.

Fixes #1910

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 21:06:53 -06:00
Tom Boucher
53d7350e0d fix: warn when milestone merge contains only metadata and no code (#1906) (#1927)
mergeMilestoneToMain now detects when the squash-merge commit contains
only .gsd/ metadata files and no actual code changes. The worktree
resolver surfaces a clear warning so users know the milestone summary
may describe planned work that was never implemented.

The complete-milestone prompt now requires the LLM to verify code
changes exist on the branch before declaring verification passed.

Fixes #1906

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 21:05:56 -06:00
TÂCHES
79e49aa413 fix(worktree): resolve 8.3 short paths and use shell mode for .bat hooks on Windows (#1956)
Resolve Windows 8.3 short paths (RUNNER~1 → runneradmin) via realpathSync.native()
and use shell mode for .bat/.cmd files in worktree post-create hooks. Fixes
pre-existing windows-portability CI failure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 20:52:30 -06:00
TÂCHES
60885610ac feat(gsd): unified rule registry, event journal, journal query tool, and tool naming convention (#1928)
Unify dispatch rules and hooks into a flat rule registry, add structured event journal with causal tracing, expose journal query as an LLM tool, and adopt gsd_concept_action tool naming.

- RuleRegistry class absorbs dispatch rules + hooks into UnifiedRule objects with common when/where/then shape
- post-unit-hooks.ts refactored from 524 lines → 90-line thin facade delegating to the registry
- Event journal emits structured JSONL events with per-iteration flowId grouping and causedBy chains
- gsd_journal_query LLM-callable tool for AI self-debugging of autonomous runs
- 4 DB tools renamed to gsd_concept_action pattern with backward-compatible aliases
- 164 new tests, zero regressions

Closes #1763, closes #1764, closes #1766

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 18:47:41 -06:00
Jeremy McSpadden
c1a35dd1b3 feat: ADR attribution — distinguish human vs agent vs collaborative decisions (#1830)
* feat: add made_by attribution field to decisions (human/agent/collaborative)

Add a 'made_by' field to the Decision type that tracks whether a
decision was made by the human, the agent, or collaboratively. This
enables ADR-style accountability — you can always tell who actually
made each call.

Schema:
- New DecisionMadeBy type: 'human' | 'agent' | 'collaborative'
- DB schema v3 → v4: ALTER TABLE decisions ADD COLUMN made_by
- Existing decisions default to 'agent' (backward compatible)
- DECISIONS.md gains a 'Made By' column
- Parser handles old 7-column format gracefully (defaults to 'agent')

Surfaces updated:
- gsd_save_decision tool accepts optional made_by parameter
- Markdown generator/parser round-trips the new column
- Prompt formatter shows attribution in LLM context
- Compact formatter includes made_by in pipe-separated output
- Worktree reconciliation includes made_by in conflict detection + merge

Tests: 476 assertions across 9 test suites, all passing.

* fix(gsd-db): resolve CI failures and address review findings

- Update memory-store.test.ts to expect schema version 4
- Recreate active_decisions view in v4 migration to pick up new made_by column
- Handle missing made_by column in older worktrees during reconciliation
- Optimize VALID_MADE_BY Set by moving it outside the parser loop

* fix(types): resolve missing made_by property errors in context-store and tests
2026-03-21 15:26:28 -06:00
Tom Boucher
f4db25b9b8 fix(web): persist auth token in sessionStorage to survive page refreshes (#1877)
Next.js 16 auto-detects web/proxy.ts as middleware, gating all /api/*
routes behind bearer token validation. The token was only cached in
memory (lost on page refresh) and extracted from the URL hash fragment
(cleared after first extraction). This caused 401 errors on page
refresh and broke the sendBeacon shutdown call which cannot set
custom headers.

Changes:
- Persist the auth token to sessionStorage after extracting from the
  URL fragment so it survives page refreshes within the same tab
- Fall back to sessionStorage when the URL hash is absent (refresh,
  bookmark without hash)
- Pass the auth token as a _token query parameter in the sendBeacon
  shutdown call since sendBeacon cannot set Authorization headers
- Add regression tests for token persistence, sessionStorage fallback,
  and sendBeacon authentication

Fixes #1851

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 15:25:27 -06:00
Iouri Goussev
e0011a897a test: replace shape-only assertions with value checks (#1875)
Several test files used assert.ok(Array.isArray(x)) or assert.ok(result)
patterns that verify structure/existence without checking actual values.
These pass even when the code returns wrong data.

- web-diagnostics-contract: Array.isArray() checks → deepEqual([], [])
  for fields constructed as empty; DoctorFixResult uses deepEqual(["fix1"])
  instead of Array.isArray + length; InstanceType<typeof GSDWorkspaceStore>
  for type assertions from dynamic import
- skill-lifecycle: computeStaleAvoidList → deepEqual(result, []) since
  nonexistent path must return empty
- blob-store: remove redundant assert.ok(retrieved) before deepEqual
- discovery-cache: assert.ok(entry) existence check → verify models[0].id

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-21 15:25:10 -06:00
Tom Boucher
747e29b9b4 fix: clean up SQUASH_MSG after squash-merge and guard worktree teardown against uncommitted changes (#1868)
Three changes to prevent data loss and persistent doctor errors in the
worktree merge-back lifecycle:

1. After nativeCommit in mergeMilestoneToMain, explicitly delete
   .git/SQUASH_MSG. The native libgit2 path and git commit -F - on
   some versions do not auto-remove it, causing doctor to report
   corrupt_merge_state on every run.

2. Before worktree removal (step 11), check for uncommitted changes
   and force a final auto-commit if dirty. This prevents code files
   written by task agents from being destroyed by git worktree remove.

3. Invalidate the nativeHasChanges 10-second cache before the
   post-unit auto-commit in auto-post-unit.ts. A stale false result
   causes autoCommit to skip staging entirely.

Fixes #1853

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 15:24:53 -06:00
Tom Boucher
99032444eb fix: populate RecoveryContext in hook unit supervision to prevent crash on stalled tool recovery (#1867)
The buildRecoveryContext callback in auto/phases.ts returned an empty
object instead of a valid RecoveryContext. When the idle watchdog detected
a stalled tool and called recoverTimedOutUnit, basePath was undefined,
causing join(undefined, ".gsd") to throw "The path argument must be of
type string. Received undefined". The error left the session permanently
hung because the unit promise was never resolved.

Fixes #1855

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 15:24:37 -06:00
Tom Boucher
f79de8a583 fix: resolve worktree path from git registry when .gsd/ symlink is shadowed (#1866)
When .gsd/ is a symlink to an external state directory, git registers
worktrees at the resolved (real) path. If syncStateToProjectRoot later
creates a real .gsd/ directory that shadows the symlink, worktreePath()
computes a local path that diverges from git's registered path. The
stale local directory passes existsSync but is not a git worktree, so
nativeWorktreeRemove fails silently.

removeWorktree now queries nativeWorktreeList to find the actual
git-registered path by matching on branch name before attempting
removal, falling back to the computed path if the lookup fails.

Fixes #1852

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 15:24:21 -06:00
Tom Boucher
2e04253c0b fix: resolve Node v24 web boot failure — ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING (#1864)
Node v24 forbids --experimental-strip-types for files under node_modules/.
When GSD is globally installed, all src/ files live under node_modules/gsd-pi/,
causing every subprocess worker to crash with ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING.

Bug 1: Extract resolveTypeStrippingFlag() into src/web/ts-subprocess-flags.ts.
When the package root is under node_modules/ and Node >= 22.7, the function
returns --experimental-transform-types (which handles node_modules paths).
All 15 service files and cli-entry.ts now call this function instead of
hardcoding --experimental-strip-types.

Bug 2: waitForBootReady() now tracks consecutive 5xx responses and aborts
after 3 in a row, including the response body in the error message.
Connection-level errors (transient during cold start) reset the counter.

Bug 3: The /api/boot route handler now wraps collectBootPayload() in
try/catch and returns { error: message } with status 500, matching the
error response pattern used by other API routes.

Fixes #1849

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 15:24:07 -06:00
Tom Boucher
7140ee0f53 feat: add /gsd fast command and gate service tier icon to supported models (#1848) (#1862)
Add `/gsd fast [on|off|flex|status]` command for toggling OpenAI service
tiers, with `supportsServiceTier()` gating so the status bar icon only
appears on models that actually support service tiers (gpt-5.4 variants).

Fixes #1848

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 15:23:54 -06:00
Iouri Goussev
0dd7176af6 test: replace shape-only assertions with value checks in preferences and routing-history (#1842)
- preferences.test.ts: hook config tests were testing Math.max/min and a
  locally-constructed Set (testing JS builtins, not production code); replaced
  with validatePreferences calls that exercise real clamping in
  preferences-validation.ts and action validation for pre_dispatch_hooks.
  assert.ok(prefs) existence checks replaced with assert.notEqual(prefs, null).
- routing-history.test.ts: removed assert.ok(history) and assert.ok(pattern)
  guards that only verified object existence; assertions now go directly to
  the values that matter.
2026-03-21 15:23:26 -06:00
Tom Boucher
b49cb8cbad fix(auto): broaden worktree health check to all ecosystems (#1860)
* fix(auto): use PROJECT_FILES from detection.ts in worktree health check

The worktree health check introduced in #1833 hard-coded package.json
and src/ as the only valid project markers, blocking auto-mode dispatch
for Rust (Cargo.toml), Go (go.mod), Python (pyproject.toml), and 14
other ecosystems. Replace the JS-centric heuristic with the shared
PROJECT_FILES array from detection.ts which already covers 17+
ecosystems.

Fixes #1843

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

* fix: update test assertion to match new project files message

The health check now says "no recognized project files" instead of
"no package.json or src/" after broadening to PROJECT_FILES.

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-21 15:22:34 -06:00
Tom Boucher
358dc1da6b fix(doctor): cascade slice uncheck when task_done_missing_summary unchecks tasks (#1850) (#1858)
When tasks are [x] done but no T##-SUMMARY.md exists, doctor unchecks
the tasks but left the slice [x] done in the roadmap. The state machine
skips done slices, so unchecked tasks never re-execute and doctor fires
again on every start — infinite loop.

After unchecking tasks via task_done_missing_summary, also uncheck the
slice in the roadmap so the state machine re-enters the executing phase.

Fixes #1850

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 15:22:23 -06:00
Tom Boucher
1ad1b5d061 fix: defend exit path against ESM module cache mismatch (#1854)
* fix: defend exit path against ESM module cache mismatch (#1839)

Wrap the stopAuto import/call in exit-command.ts with try/catch so
that a mid-session gsd-pi update (which causes stale ESM cache for
native-git-bridge.js exports) does not crash the /exit handler.
A warning is emitted instead. The user's work is already saved;
this path is cleanup only.

Fixes #1839

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

* fix: use "warning" not "warn" for notify severity type

TS2345: "warn" is not in the severity union type.

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

* fix: update test assertion to match "warning" severity

The source was corrected to "warning" (valid union type), test must match.

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-21 15:22:13 -06:00
Andrew
3f8d7921ca feat: add --host, --port, --allowed-origins flags for web mode (#1847) (#1873)
Wire CLI flags through parseCliArgs → runWebCliBranch → launchWebMode
so users can bind to a custom host/port and whitelist CORS origins for
LAN/Tailscale access.

- Add webHost, webPort, webAllowedOrigins to CliFlags
- Parse --host, --port (validated 1-65535), --allowed-origins (csv)
- Forward into launchWebMode options
- Set GSD_WEB_ALLOWED_ORIGINS in subprocess env when provided
- Add allowedOrigins to WebModeLaunchOptions

Usage: gsd --web --host 0.0.0.0 --port 8080 --allowed-origins http://192.168.1.10:8080

Closes #1847
2026-03-21 15:22:01 -06:00