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
31 changes: 29 additions & 2 deletions packages/dotagents/src/cli/commands/add.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
import { mkdtemp, mkdir, writeFile, rm, readFile, symlink } from "node:fs/promises";
import { mkdtemp, mkdir, writeFile, rm, readFile, symlink, cp } from "node:fs/promises";
import { existsSync, readFileSync } from "node:fs";
import { join } from "node:path";
import { tmpdir } from "node:os";
import { fileURLToPath } from "node:url";
import * as clack from "@clack/prompts";
import addCommand, {
runAdd as runAddCommand,
Expand All @@ -13,7 +14,7 @@ import addCommand, {
} from "./add.js";
import * as installModule from "./install.js";
import { runSync } from "./sync.js";
import { TrustError, exec } from "@sentry/dotagents-lib";
import { TrustError, discoverSkill, exec } from "@sentry/dotagents-lib";
import { resolveScope } from "../../scope.js";
import type { CommandContext } from "../context.js";
import { z } from "zod/v4";
Expand Down Expand Up @@ -133,6 +134,32 @@ describe("runAdd", () => {
await rm(tmpDir, { recursive: true });
});

it("installs this repository's dotagents plugin and still discovers its standalone skill", async () => {
const sourceRoot = fileURLToPath(new URL("../../../../../", import.meta.url));
const localSource = join(projectRoot, "source");
for (const path of [".claude-plugin", "plugins/dotagents", "skills/dotagents"]) {
await cp(join(sourceRoot, path), join(localSource, path), {
recursive: true,
verbatimSymlinks: true,
});
}
await writeFile(join(projectRoot, "agents.toml"), 'version = 1\nagents = ["claude"]\n');
const scope = resolveScope("project", projectRoot);

await expect(runAdd({
scope,
specifier: "path:source",
names: ["dotagents"],
})).resolves.toBe("dotagents");

const installedSkill = await readFile(
join(scope.pluginsDir, "dotagents", "skills", "dotagents", "SKILL.md"),
"utf-8",
);
expect(installedSkill).toBe(await readFile(join(sourceRoot, "skills", "dotagents", "SKILL.md"), "utf-8"));
expect((await discoverSkill(sourceRoot, "dotagents"))?.meta.name).toBe("dotagents");
});

it("does not fetch a git source again during the nested install", async () => {
const tracePath = join(tmpDir, "add-git-trace.json");
process.env["GIT_TRACE2_EVENT"] = tracePath;
Expand Down
1 change: 0 additions & 1 deletion plugins/dotagents/skills/dotagents

This file was deleted.

File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions skills/dotagents
Loading