@clubmatto/ai-kit 0.0.1 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nvmrc +1 -0
- package/CHANGELOG.md +10 -2
- package/LICENSE +17 -0
- package/README.md +7 -7
- package/dist/src/index.js +0 -0
- package/dist/src/template.js +1 -1
- package/package.json +5 -23
- package/src/agents/monorepo.md +2 -8
- package/src/agents/opencode.json +0 -9
- package/src/commands/commit.md +6 -5
- package/src/gradient-string.d.ts +1 -0
- package/src/template.ts +1 -1
- package/dist/scripts/fetch-playwright-skills.js +0 -63
- package/dist/src/commands/sync.js +0 -111
- package/dist/src/content.js +0 -99
- package/dist/tests/content.test.js +0 -141
- package/dist/tests/integration/cli.test.js +0 -43
- package/dist/tests/output.js +0 -36
- package/dist/tests/reader.test.js +0 -141
- package/dist/tests/sync.test.js +0 -90
- package/dist/tests/utils.js +0 -20
- package/dist/vitest.config.js +0 -9
- package/docs/roadmap.md +0 -16
- package/scripts/fetch-playwright-skills.ts +0 -79
- package/src/skills/image-gen/scripts/generate.js +0 -166
- package/tests/fixtures/agents/another.json +0 -4
- package/tests/fixtures/agents/monorepo.md +0 -5
- package/tests/fixtures/agents/opencode.json +0 -4
- package/tests/fixtures/commands/another.md +0 -5
- package/tests/fixtures/commands/commit.md +0 -7
- package/tests/fixtures/commands/test.md +0 -13
- package/tests/fixtures/rules/nested/nested-rule.md +0 -3
- package/tests/fixtures/rules/test-rule.md +0 -5
- package/tests/fixtures/rules/typescript.md +0 -5
- package/tests/fixtures/skills/test-skill/SKILL.md +0 -7
- package/tests/fixtures/skills/test-skill/nested-refs/doc.md +0 -3
- package/tests/fixtures/skills/test-skill/skill-details.md +0 -7
- package/tests/integration/cli.test.ts +0 -55
- package/tests/output.ts +0 -37
- package/tests/reader.test.ts +0 -193
- package/tests/sync.test.ts +0 -136
- package/tests/utils.ts +0 -17
- package/tsconfig.json +0 -23
- package/vitest.config.ts +0 -8
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach } from "vitest";
|
|
2
|
-
import { execSync } from "child_process";
|
|
3
|
-
import { join } from "path";
|
|
4
|
-
import { fileExists, createTempDir, readFile } from "../utils";
|
|
5
|
-
|
|
6
|
-
const projectRoot = join(__dirname, "..", "..");
|
|
7
|
-
|
|
8
|
-
describe("CLI integration", () => {
|
|
9
|
-
let tempDir: string;
|
|
10
|
-
|
|
11
|
-
beforeEach(() => {
|
|
12
|
-
tempDir = createTempDir();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it("runs as CLI and syncs files", () => {
|
|
16
|
-
execSync(`node ${join(projectRoot, "dist", "src", "index.js")} sync`, {
|
|
17
|
-
cwd: tempDir,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
expect(fileExists(tempDir, ".agents/.ai-kit")).toBe(true);
|
|
21
|
-
expect(fileExists(tempDir, ".agents/rules")).toBe(true);
|
|
22
|
-
expect(fileExists(tempDir, "opencode.json")).toBe(true);
|
|
23
|
-
expect(fileExists(tempDir, "AGENTS.md")).toBe(true);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it("creates rules with templated content", () => {
|
|
27
|
-
execSync(`node ${join(projectRoot, "dist", "src", "index.js")} sync`, {
|
|
28
|
-
cwd: tempDir,
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
const ruleContent = readFile(tempDir, ".agents/rules/typescript.md");
|
|
32
|
-
expect(ruleContent).toContain("Last updated:");
|
|
33
|
-
expect(ruleContent).not.toContain("{{FOOTER}}");
|
|
34
|
-
expect(ruleContent).toMatch(/\d{4}-\d{2}-\d{2}/);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it("injects commands into opencode.json", () => {
|
|
38
|
-
execSync(`node ${join(projectRoot, "dist", "src", "index.js")} sync`, {
|
|
39
|
-
cwd: tempDir,
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
const opencodeJson = JSON.parse(readFile(tempDir, "opencode.json")!);
|
|
43
|
-
expect(opencodeJson).toHaveProperty("command");
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it("skips opencode.json when --skip-opencode is passed", () => {
|
|
47
|
-
execSync(
|
|
48
|
-
`node ${join(projectRoot, "dist", "src", "index.js")} sync --skip-opencode`,
|
|
49
|
-
{ cwd: tempDir },
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
expect(fileExists(tempDir, "opencode.json")).toBe(false);
|
|
53
|
-
expect(fileExists(tempDir, "AGENTS.md")).toBe(true);
|
|
54
|
-
});
|
|
55
|
-
});
|
package/tests/output.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
type LogCall = [string, string];
|
|
2
|
-
|
|
3
|
-
const logs: LogCall[] = [];
|
|
4
|
-
|
|
5
|
-
export const testLog = {
|
|
6
|
-
clear: () => {
|
|
7
|
-
logs.length = 0;
|
|
8
|
-
},
|
|
9
|
-
get: (): ReadonlyArray<LogCall> => [...logs],
|
|
10
|
-
|
|
11
|
-
logo: (version: string) => {
|
|
12
|
-
logs.push(["logo", version]);
|
|
13
|
-
},
|
|
14
|
-
welcome: () => {
|
|
15
|
-
logs.push(["welcome", ""]);
|
|
16
|
-
},
|
|
17
|
-
section: (msg: string) => {
|
|
18
|
-
logs.push(["section", msg]);
|
|
19
|
-
},
|
|
20
|
-
success: (msg: string) => {
|
|
21
|
-
logs.push(["success", msg]);
|
|
22
|
-
},
|
|
23
|
-
final: (msg: string) => {
|
|
24
|
-
logs.push(["final", msg]);
|
|
25
|
-
},
|
|
26
|
-
summary: (counts: { rules: number; skills: number; commands: number }) => {
|
|
27
|
-
logs.push(["summary", JSON.stringify(counts)]);
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export function getLastLog(): LogCall | undefined {
|
|
32
|
-
return logs[logs.length - 1];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function findLogs(type: string): LogCall[] {
|
|
36
|
-
return logs.filter(([t]) => t === type);
|
|
37
|
-
}
|
package/tests/reader.test.ts
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { join } from "path";
|
|
3
|
-
import {
|
|
4
|
-
getCommandConfig,
|
|
5
|
-
readContent,
|
|
6
|
-
readConfigs,
|
|
7
|
-
readAgents,
|
|
8
|
-
} from "../src/reader";
|
|
9
|
-
import { processTemplate } from "../src/template";
|
|
10
|
-
|
|
11
|
-
const fixturesDir = join(__dirname, "fixtures");
|
|
12
|
-
const commandsDir = join(fixturesDir, "commands");
|
|
13
|
-
const rulesDir = join(fixturesDir, "rules");
|
|
14
|
-
const skillsDir = join(fixturesDir, "skills");
|
|
15
|
-
const agentsDir = join(fixturesDir, "agents");
|
|
16
|
-
|
|
17
|
-
describe("getCommandConfig", () => {
|
|
18
|
-
it("parses command files and returns config object", () => {
|
|
19
|
-
const config = getCommandConfig(commandsDir);
|
|
20
|
-
|
|
21
|
-
expect(config).toHaveProperty("test");
|
|
22
|
-
expect(config.test.description).toBe(
|
|
23
|
-
"A test command for testing purposes.",
|
|
24
|
-
);
|
|
25
|
-
expect(config.test.template).toContain("This is a test command template.");
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it("includes all command files", () => {
|
|
29
|
-
const config = getCommandConfig(commandsDir);
|
|
30
|
-
|
|
31
|
-
expect(config).toHaveProperty("test");
|
|
32
|
-
expect(config).toHaveProperty("another");
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it("has correct structure for opencode.json command format", () => {
|
|
36
|
-
const config = getCommandConfig(commandsDir);
|
|
37
|
-
|
|
38
|
-
for (const [_, cmd] of Object.entries(config)) {
|
|
39
|
-
expect(cmd).toHaveProperty("description");
|
|
40
|
-
expect(cmd).toHaveProperty("template");
|
|
41
|
-
expect(typeof cmd.description).toBe("string");
|
|
42
|
-
expect(typeof cmd.template).toBe("string");
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it("returns empty object for non-existent directory", () => {
|
|
47
|
-
const config = getCommandConfig("/non/existent/dir");
|
|
48
|
-
expect(config).toEqual({});
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
describe("readContent", () => {
|
|
53
|
-
it("returns files from rules and skills directories", () => {
|
|
54
|
-
const files = readContent(rulesDir, skillsDir);
|
|
55
|
-
|
|
56
|
-
const ruleFiles = files.filter((f) => f.type === "rules");
|
|
57
|
-
const skillFiles = files.filter((f) => f.type === "skills");
|
|
58
|
-
|
|
59
|
-
expect(ruleFiles.length).toBeGreaterThan(0);
|
|
60
|
-
expect(skillFiles.length).toBeGreaterThan(0);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it("includes nested files recursively", () => {
|
|
64
|
-
const files = readContent(rulesDir, skillsDir);
|
|
65
|
-
|
|
66
|
-
const nestedRule = files.find(
|
|
67
|
-
(f) => f.name === "nested/nested-rule.md" && f.type === "rules",
|
|
68
|
-
);
|
|
69
|
-
expect(nestedRule).toBeDefined();
|
|
70
|
-
expect(nestedRule?.content).toContain("Nested Rule");
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it("returns correct file structure", () => {
|
|
74
|
-
const files = readContent(rulesDir, skillsDir);
|
|
75
|
-
|
|
76
|
-
for (const file of files) {
|
|
77
|
-
expect(file).toHaveProperty("type");
|
|
78
|
-
expect(file).toHaveProperty("name");
|
|
79
|
-
expect(file).toHaveProperty("content");
|
|
80
|
-
expect(["rules", "skills"]).toContain(file.type);
|
|
81
|
-
expect(file.name.endsWith(".md")).toBe(true);
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it("includes skill directory name in file path", () => {
|
|
86
|
-
const files = readContent(rulesDir, skillsDir);
|
|
87
|
-
|
|
88
|
-
const skillFile = files.find(
|
|
89
|
-
(f) => f.type === "skills" && f.name === "test-skill/SKILL.md",
|
|
90
|
-
);
|
|
91
|
-
expect(skillFile).toBeDefined();
|
|
92
|
-
expect(skillFile?.content).toContain("Test Skill");
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it("includes additional files in skill directories", () => {
|
|
96
|
-
const files = readContent(rulesDir, skillsDir);
|
|
97
|
-
|
|
98
|
-
const detailsFile = files.find(
|
|
99
|
-
(f) => f.type === "skills" && f.name === "test-skill/skill-details.md",
|
|
100
|
-
);
|
|
101
|
-
expect(detailsFile).toBeDefined();
|
|
102
|
-
expect(detailsFile?.content).toContain("Skill Details");
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it("includes nested references in skill directories", () => {
|
|
106
|
-
const files = readContent(rulesDir, skillsDir);
|
|
107
|
-
|
|
108
|
-
const refFile = files.find(
|
|
109
|
-
(f) => f.type === "skills" && f.name === "test-skill/nested-refs/doc.md",
|
|
110
|
-
);
|
|
111
|
-
expect(refFile).toBeDefined();
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
describe("readConfigs", () => {
|
|
116
|
-
it("returns JSON files from agents directory", () => {
|
|
117
|
-
const files = readConfigs(agentsDir);
|
|
118
|
-
|
|
119
|
-
expect(files.length).toBe(2);
|
|
120
|
-
expect(files.map((f) => f.name).sort()).toEqual([
|
|
121
|
-
"another.json",
|
|
122
|
-
"opencode.json",
|
|
123
|
-
]);
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it("returns file content as string", () => {
|
|
127
|
-
const files = readConfigs(agentsDir);
|
|
128
|
-
|
|
129
|
-
const opencodeFile = files.find((f) => f.name === "opencode.json");
|
|
130
|
-
expect(opencodeFile?.content).toContain("test-agent");
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
it("returns empty array for non-existent directory", () => {
|
|
134
|
-
const files = readConfigs("/non/existent/dir");
|
|
135
|
-
expect(files).toEqual([]);
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
describe("readAgents", () => {
|
|
140
|
-
it("returns AGENTS.md file content", () => {
|
|
141
|
-
const file = readAgents(agentsDir);
|
|
142
|
-
|
|
143
|
-
expect(file).not.toBeNull();
|
|
144
|
-
expect(file?.name).toBe("AGENTS.md");
|
|
145
|
-
expect(file?.content).toContain("AGENTS.md");
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it("returns null when monorepo.md does not exist", () => {
|
|
149
|
-
const file = readAgents(rulesDir);
|
|
150
|
-
expect(file).toBeNull();
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
describe("processTemplate", () => {
|
|
155
|
-
it("replaces {{FOOTER}} with full footer text and ISO date", () => {
|
|
156
|
-
const result = processTemplate("{{FOOTER}}");
|
|
157
|
-
const today = new Date().toISOString().split("T")[0];
|
|
158
|
-
expect(result).toBe(
|
|
159
|
-
`Last updated: ${today}. This file extends the global rules in @AGENTS.md. Always check both files.`,
|
|
160
|
-
);
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
it("replaces {{AGENTS_FOOTER}} with agents footer text and ISO date", () => {
|
|
164
|
-
const result = processTemplate("{{AGENTS_FOOTER}}");
|
|
165
|
-
const today = new Date().toISOString().split("T")[0];
|
|
166
|
-
expect(result).toBe(
|
|
167
|
-
`This file was last updated: ${today}. Always check the \`.ai/rules/\` directory for the most current language-specific guidelines.`,
|
|
168
|
-
);
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
it("replaces multiple placeholders in same content", () => {
|
|
172
|
-
const result = processTemplate("{{FOOTER}} and {{AGENTS_FOOTER}}");
|
|
173
|
-
const today = new Date().toISOString().split("T")[0];
|
|
174
|
-
expect(result).toContain(`Last updated: ${today}`);
|
|
175
|
-
expect(result).toContain(`This file was last updated: ${today}`);
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
it("leaves non-matching content unchanged", () => {
|
|
179
|
-
const input = "Some {{OTHER}} content {{NOTREAL}}";
|
|
180
|
-
const result = processTemplate(input);
|
|
181
|
-
expect(result).toBe(input);
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
it("handles empty string", () => {
|
|
185
|
-
const result = processTemplate("");
|
|
186
|
-
expect(result).toBe("");
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
it("handles content without placeholders", () => {
|
|
190
|
-
const result = processTemplate("No placeholders here");
|
|
191
|
-
expect(result).toBe("No placeholders here");
|
|
192
|
-
});
|
|
193
|
-
});
|
package/tests/sync.test.ts
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach } from "vitest";
|
|
2
|
-
import { sync, SourceDirs } from "../src/cmd/sync";
|
|
3
|
-
import { createTempDir, readFile, fileExists } from "./utils";
|
|
4
|
-
import { testLog, findLogs, getLastLog } from "./output";
|
|
5
|
-
import { join } from "path";
|
|
6
|
-
|
|
7
|
-
const fixturesDir = join(__dirname, "fixtures");
|
|
8
|
-
const testSourceDirs: SourceDirs = {
|
|
9
|
-
rules: join(fixturesDir, "rules"),
|
|
10
|
-
skills: join(fixturesDir, "skills"),
|
|
11
|
-
agents: join(fixturesDir, "agents"),
|
|
12
|
-
commands: join(fixturesDir, "commands"),
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
describe("sync command", () => {
|
|
16
|
-
let tempDir: string;
|
|
17
|
-
|
|
18
|
-
beforeEach(() => {
|
|
19
|
-
tempDir = createTempDir();
|
|
20
|
-
testLog.clear();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it("initializes when not already initialized", async () => {
|
|
24
|
-
await sync(tempDir, "0.0.1", {}, testLog, testSourceDirs);
|
|
25
|
-
|
|
26
|
-
expect(fileExists(tempDir, ".agents/.ai-kit")).toBe(true);
|
|
27
|
-
expect(fileExists(tempDir, ".agents/rules")).toBe(true);
|
|
28
|
-
expect(fileExists(tempDir, "opencode.json")).toBe(true);
|
|
29
|
-
expect(fileExists(tempDir, "AGENTS.md")).toBe(true);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it("skips opencode.json when skipOpencode is true", async () => {
|
|
33
|
-
await sync(
|
|
34
|
-
tempDir,
|
|
35
|
-
"0.0.1",
|
|
36
|
-
{ skipOpencode: true },
|
|
37
|
-
testLog,
|
|
38
|
-
testSourceDirs,
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
expect(fileExists(tempDir, "opencode.json")).toBe(false);
|
|
42
|
-
expect(fileExists(tempDir, "AGENTS.md")).toBe(true);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it("writes correct manifest on init", async () => {
|
|
46
|
-
await sync(tempDir, "0.0.1", {}, testLog, testSourceDirs);
|
|
47
|
-
|
|
48
|
-
const manifest = JSON.parse(readFile(tempDir, ".agents/.ai-kit")!);
|
|
49
|
-
expect(manifest.version).toBe("0.0.1");
|
|
50
|
-
expect(manifest.rootFiles).toContain("opencode.json");
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it("does not re-initialize if already at latest version", async () => {
|
|
54
|
-
await sync(tempDir, "0.0.1", {}, testLog, testSourceDirs);
|
|
55
|
-
|
|
56
|
-
await sync(tempDir, "0.0.1", {}, testLog, testSourceDirs);
|
|
57
|
-
|
|
58
|
-
const lastLog = getLastLog();
|
|
59
|
-
expect(lastLog).toEqual(["success", "Already at latest version (0.0.1)"]);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it("updates when version differs", async () => {
|
|
63
|
-
await sync(tempDir, "0.0.1", {}, testLog, testSourceDirs);
|
|
64
|
-
|
|
65
|
-
await sync(tempDir, "0.0.2", {}, testLog, testSourceDirs);
|
|
66
|
-
|
|
67
|
-
const manifest = JSON.parse(readFile(tempDir, ".agents/.ai-kit")!);
|
|
68
|
-
expect(manifest.version).toBe("0.0.2");
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it("respects skipOpencode option on update", async () => {
|
|
72
|
-
await sync(
|
|
73
|
-
tempDir,
|
|
74
|
-
"0.0.1",
|
|
75
|
-
{ skipOpencode: true },
|
|
76
|
-
testLog,
|
|
77
|
-
testSourceDirs,
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
await sync(
|
|
81
|
-
tempDir,
|
|
82
|
-
"0.0.2",
|
|
83
|
-
{ skipOpencode: true },
|
|
84
|
-
testLog,
|
|
85
|
-
testSourceDirs,
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
const manifest = JSON.parse(readFile(tempDir, ".agents/.ai-kit")!);
|
|
89
|
-
expect(manifest.rootFiles).toEqual([]);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it("includes commands in opencode.json", async () => {
|
|
93
|
-
await sync(tempDir, "0.0.1", {}, testLog, testSourceDirs);
|
|
94
|
-
|
|
95
|
-
const opencodeJson = JSON.parse(readFile(tempDir, "opencode.json")!);
|
|
96
|
-
expect(opencodeJson).toHaveProperty("command");
|
|
97
|
-
expect(opencodeJson.command).toHaveProperty("commit");
|
|
98
|
-
expect(opencodeJson.command.commit.description).toBe(
|
|
99
|
-
"Commit the work done in this session with a structured commit message.",
|
|
100
|
-
);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it("processes template variables in content files", async () => {
|
|
104
|
-
await sync(tempDir, "0.0.1", {}, testLog, testSourceDirs);
|
|
105
|
-
|
|
106
|
-
const ruleFiles = readFile(tempDir, ".agents/rules/typescript.md");
|
|
107
|
-
expect(ruleFiles).toContain("Last updated:");
|
|
108
|
-
expect(ruleFiles).not.toContain("{{FOOTER}}");
|
|
109
|
-
expect(ruleFiles).toMatch(/\d{4}-\d{2}-\d{2}/);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it("processes template variables in AGENTS.md", async () => {
|
|
113
|
-
await sync(tempDir, "0.0.1", {}, testLog, testSourceDirs);
|
|
114
|
-
|
|
115
|
-
const agentsMd = readFile(tempDir, "AGENTS.md");
|
|
116
|
-
expect(agentsMd).not.toContain("{{AGENTS_FOOTER}}");
|
|
117
|
-
expect(agentsMd).toMatch(/\d{4}-\d{2}-\d{2}/);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
it("logs output correctly", async () => {
|
|
121
|
-
await sync(tempDir, "0.0.1", {}, testLog, testSourceDirs);
|
|
122
|
-
|
|
123
|
-
const logs = testLog.get();
|
|
124
|
-
expect(logs[logs.length - 1][0]).toBe("summary");
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it("logs all synced files", async () => {
|
|
128
|
-
await sync(tempDir, "0.0.1", {}, testLog, testSourceDirs);
|
|
129
|
-
|
|
130
|
-
const successLogs = findLogs("success");
|
|
131
|
-
expect(successLogs.length).toBeGreaterThan(0);
|
|
132
|
-
expect(successLogs.some(([, msg]) => msg.includes(".md"))).toBe(true);
|
|
133
|
-
expect(successLogs.some(([, msg]) => msg === "opencode.json")).toBe(true);
|
|
134
|
-
expect(successLogs.some(([, msg]) => msg === "AGENTS.md")).toBe(true);
|
|
135
|
-
});
|
|
136
|
-
});
|
package/tests/utils.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { mkdtempSync, readFileSync, existsSync } from "fs";
|
|
2
|
-
import { join } from "path";
|
|
3
|
-
import { tmpdir } from "os";
|
|
4
|
-
|
|
5
|
-
export function createTempDir(): string {
|
|
6
|
-
return mkdtempSync(join(tmpdir(), "ai-kit-test-"));
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function readFile(dir: string, filename: string): string | null {
|
|
10
|
-
const path = join(dir, filename);
|
|
11
|
-
if (!existsSync(path)) return null;
|
|
12
|
-
return readFileSync(path, "utf-8");
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function fileExists(dir: string, filename: string): boolean {
|
|
16
|
-
return existsSync(join(dir, filename));
|
|
17
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "CommonJS",
|
|
5
|
-
"lib": ["ES2022"],
|
|
6
|
-
"outDir": "./dist",
|
|
7
|
-
"strict": true,
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"forceConsistentCasingInFileNames": true,
|
|
11
|
-
"resolveJsonModule": true,
|
|
12
|
-
"declaration": false,
|
|
13
|
-
"sourceMap": false,
|
|
14
|
-
"noUnusedLocals": true,
|
|
15
|
-
"noUnusedParameters": true,
|
|
16
|
-
"noImplicitReturns": true,
|
|
17
|
-
"noFallthroughCasesInSwitch": true,
|
|
18
|
-
"moduleResolution": "node",
|
|
19
|
-
"allowSyntheticDefaultImports": true
|
|
20
|
-
},
|
|
21
|
-
"include": ["src/**/*", "tests/**/*", "scripts/**/*", "vitest.config.ts"],
|
|
22
|
-
"exclude": ["node_modules", "dist"]
|
|
23
|
-
}
|