fix(2137): skip worktree isolation when .gitmodules detected (#2144)

* feat(sdk): add typed query foundation and gsd-sdk query (Phase 1)

Add sdk/src/query registry and handlers with tests, GSDQueryError, CLI query wiring, and supporting type/tool-scoping hooks. Update CHANGELOG. Vitest 4 constructor mock fixes in milestone-runner tests.

Made-with: Cursor

* fix(2137): skip worktree isolation when .gitmodules detected

When a project contains git submodules, worktree isolation cannot
correctly handle submodule commits — three separate gaps exist in
worktree setup, executor commit protocol, and merge-back. Rather
than patch each gap individually, detect .gitmodules at phase start
and fall back to sequential execution, which handles submodules
transparently (Option B).

Affected workflows: execute-phase.md, quick.md

---------

Co-authored-by: David Sienkowski <dave@sienkowski.com>
This commit is contained in:
Tom Boucher
2026-04-12 08:33:04 -04:00
committed by GitHub
parent 58632e0718
commit 002bcf2a8a
63 changed files with 17872 additions and 23 deletions

50
sdk/src/query/skills.ts Normal file
View File

@@ -0,0 +1,50 @@
/**
* Agent skills query handler — scan installed skill directories.
*
* Reads from .claude/skills/, .agents/skills/, .cursor/skills/, .github/skills/,
* and the global ~/.claude/get-shit-done/skills/ directory.
*
* @example
* ```typescript
* import { agentSkills } from './skills.js';
*
* await agentSkills(['gsd-executor'], '/project');
* // { data: { agent_type: 'gsd-executor', skills: ['plan', 'verify'], skill_count: 2 } }
* ```
*/
import { existsSync, readdirSync } from 'node:fs';
import { join } from 'node:path';
import { homedir } from 'node:os';
import type { QueryHandler } from './utils.js';
export const agentSkills: QueryHandler = async (args, projectDir) => {
const agentType = args[0] || '';
const skillDirs = [
join(projectDir, '.claude', 'skills'),
join(projectDir, '.agents', 'skills'),
join(projectDir, '.cursor', 'skills'),
join(projectDir, '.github', 'skills'),
join(homedir(), '.claude', 'get-shit-done', 'skills'),
];
const skills: string[] = [];
for (const dir of skillDirs) {
if (!existsSync(dir)) continue;
try {
const entries = readdirSync(dir, { withFileTypes: true }) as unknown as Array<{ isDirectory(): boolean; name: string }>;
for (const entry of entries) {
if (entry.isDirectory()) skills.push(entry.name);
}
} catch { /* skip */ }
}
return {
data: {
agent_type: agentType,
skills: [...new Set(skills)],
skill_count: skills.length,
},
};
};