diff --git a/cli/package.json b/cli/package.json index d88fbca50..7749e1865 100644 --- a/cli/package.json +++ b/cli/package.json @@ -83,7 +83,7 @@ "ajv": "^8.20.0", "ajv-formats": "^3.0.1", "commander": "^15.0.0", - "simple-git": "^3.36.0", + "simple-git": "^4.0.2", "smol-toml": "^1.6.1" }, "devDependencies": { diff --git a/cli/pnpm-lock.yaml b/cli/pnpm-lock.yaml index 503359d01..7946e774c 100644 --- a/cli/pnpm-lock.yaml +++ b/cli/pnpm-lock.yaml @@ -128,8 +128,8 @@ importers: specifier: ^15.0.0 version: 15.0.0 simple-git: - specifier: ^3.36.0 - version: 3.36.0(supports-color@7.2.0) + specifier: ^4.0.2 + version: 4.0.2(supports-color@7.2.0) smol-toml: specifier: ^1.6.1 version: 1.9.0 @@ -1301,11 +1301,11 @@ packages: '@sec-ant/readable-stream@0.4.1': resolution: {integrity: sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==} - '@simple-git/args-pathspec@1.0.3': - resolution: {integrity: sha512-ngJMaHlsWDTfjyq9F3VIQ8b7NXbBLq5j9i5bJ6XLYtD6qlDXT7fdKY2KscWWUF8t18xx052Y/PUO1K1TRc9yKA==} + '@simple-git/args-pathspec@1.0.4': + resolution: {integrity: sha512-EtMX6XjRWSastG2SdkmSQByPtJ9dx/NIjnHbpQPCYt62j4RmSx5rgLTGpw0YCjF5h191gZOmBfheOT23cRSFdw==} - '@simple-git/argv-parser@1.1.1': - resolution: {integrity: sha512-Q9lBcfQ+VQCpQqGJFHe5yooOS5hGdLFFbJ5R+R5aDsnkPCahtn1hSkMcORX65J2Z5lxSkD0lQorMsncuBQxYUw==} + '@simple-git/argv-parser@2.0.1': + resolution: {integrity: sha512-M++IaVWrN+vYalilOHfwvT2IL3wYZtVEBQpmX6DLSOJLtxbZ+SUeIDE3IiPogzhPACLajwtxfa5rp+ZX1FczzQ==} '@simple-libs/child-process-utils@2.0.0': resolution: {integrity: sha512-dvNoRKLijXnD0XoJAz94pbNuB5GQgDr55UhpSPhffDkTT0Cmcqh9jSCOtwfT2d4H6MI9E7c4SgtMuJXZ6F3c6A==} @@ -2332,8 +2332,8 @@ packages: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} engines: {node: '>=14'} - simple-git@3.36.0: - resolution: {integrity: sha512-cGQjLjK8bxJw4QuYT7gxHw3/IouVESbhahSsHrX97MzCL1gu2u7oy38W6L2ZIGECEfIBG4BabsWDPjBxJENv9Q==} + simple-git@4.0.2: + resolution: {integrity: sha512-l0sIsv9VrPwovKELFDBOj/lhmIcbMvxBk2B+hRhsMM4/VL3gKtuZvYnBNixVo+N/0HnqQx2cBdLvxnAbygHpqA==} smol-toml@1.9.0: resolution: {integrity: sha512-hpd+HLON7HdZXqYchMM/+LaTTbdK0AU3NngIJ4KVyWbY9bfQqdL9cD+4yf6dUoU2Ap4VsU0JkQi6FxAI1B2mXQ==} @@ -3541,11 +3541,11 @@ snapshots: '@sec-ant/readable-stream@0.4.1': {} - '@simple-git/args-pathspec@1.0.3': {} + '@simple-git/args-pathspec@1.0.4': {} - '@simple-git/argv-parser@1.1.1': + '@simple-git/argv-parser@2.0.1': dependencies: - '@simple-git/args-pathspec': 1.0.3 + '@simple-git/args-pathspec': 1.0.4 '@simple-libs/child-process-utils@2.0.0': dependencies: @@ -4588,12 +4588,12 @@ snapshots: signal-exit@4.1.0: {} - simple-git@3.36.0(supports-color@7.2.0): + simple-git@4.0.2(supports-color@7.2.0): dependencies: '@kwsites/file-exists': 1.1.1(supports-color@7.2.0) '@kwsites/promise-deferred': 1.1.1 - '@simple-git/args-pathspec': 1.0.3 - '@simple-git/argv-parser': 1.1.1 + '@simple-git/args-pathspec': 1.0.4 + '@simple-git/argv-parser': 2.0.1 debug: 4.4.3(supports-color@7.2.0) transitivePeerDependencies: - supports-color diff --git a/cli/src/contexts/distribution/infrastructure/plugin-fetcher-adapter.ts b/cli/src/contexts/distribution/infrastructure/plugin-fetcher-adapter.ts index e0098d8f1..b00db5dae 100644 --- a/cli/src/contexts/distribution/infrastructure/plugin-fetcher-adapter.ts +++ b/cli/src/contexts/distribution/infrastructure/plugin-fetcher-adapter.ts @@ -132,7 +132,7 @@ export class PluginFetcherAdapter implements PluginFetcher { } private gitWithNoPrompt(baseDir?: string): ReturnType { - const git = baseDir ? simpleGit(baseDir) : simpleGit(); + const git = simpleGit({ baseDir, allowEnvironment: ["GIT_TERMINAL_PROMPT"] }); return git.env("GIT_TERMINAL_PROMPT", "0"); } diff --git a/scripts/__tests__/a-skill-links-only-inside-itself.test.js b/scripts/__tests__/a-skill-links-only-inside-itself.test.js index 78ce3209f..435709f0f 100644 --- a/scripts/__tests__/a-skill-links-only-inside-itself.test.js +++ b/scripts/__tests__/a-skill-links-only-inside-itself.test.js @@ -1,5 +1,6 @@ const assert = require("node:assert/strict"); const fs = require("node:fs"); +const os = require("node:os"); const path = require("node:path"); const { describe, it } = require("node:test"); @@ -38,10 +39,10 @@ function skillRootOf(relativePath) { return SKILL_ROOT.test(root) ? root : null; } -function linksLeavingTheirSkill() { +function linksLeavingTheirSkill(repository = ROOT) { const escaping = []; - for (const file of everyMarkdownUnderPlugins(path.join(ROOT, "plugins"), [])) { - const relative = path.relative(ROOT, file).split(path.sep).join("/"); + for (const file of everyMarkdownUnderPlugins(path.join(repository, "plugins"), [])) { + const relative = path.relative(repository, file).split(path.sep).join("/"); const root = skillRootOf(relative); if (root === null) continue; const text = fs.readFileSync(file, "utf8"); @@ -70,17 +71,20 @@ describe("a skill links only inside itself", () => { // The guard has to be able to see one. A checker that resolves every path against this // repository, the way `check-markdown-links.js` does, reports nothing here at all. it("sees an escaping link when one is put in front of it", () => { - const root = path.join(ROOT, "plugins", "aidd-dev", "skills", "01-plan"); - const probe = path.join(root, "escaping-link-probe.md"); - fs.writeFileSync(probe, "[out](../../../../README.md)\n", "utf8"); + // Other test files scan the repository concurrently; synthetic links belong outside it. + const repository = fs.mkdtempSync(path.join(os.tmpdir(), "aidd-skill-links-")); try { - const found = linksLeavingTheirSkill(); + const root = path.join(repository, "plugins", "aidd-dev", "skills", "01-plan"); + fs.mkdirSync(root, { recursive: true }); + fs.writeFileSync(path.join(repository, "README.md"), "# Repository\n", "utf8"); + fs.writeFileSync(path.join(root, "escaping-link-probe.md"), "[out](../../../../README.md)\n", "utf8"); + const found = linksLeavingTheirSkill(repository); assert.ok( found.some((entry) => entry.includes("escaping-link-probe.md")), `the probe was not detected; found: ${JSON.stringify(found)}`, ); } finally { - fs.rmSync(probe); + fs.rmSync(repository, { recursive: true, force: true }); } }); });