Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
28 changes: 14 additions & 14 deletions cli/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export class PluginFetcherAdapter implements PluginFetcher {
}

private gitWithNoPrompt(baseDir?: string): ReturnType<typeof simpleGit> {
const git = baseDir ? simpleGit(baseDir) : simpleGit();
const git = simpleGit({ baseDir, allowEnvironment: ["GIT_TERMINAL_PROMPT"] });
return git.env("GIT_TERMINAL_PROMPT", "0");
}

Expand Down
20 changes: 12 additions & 8 deletions scripts/__tests__/a-skill-links-only-inside-itself.test.js
Original file line number Diff line number Diff line change
@@ -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");

Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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 });
}
});
});
Loading