@markjaquith/agency 0.6.0 → 0.6.1
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/package.json
CHANGED
|
@@ -377,6 +377,76 @@ describe("emit command", () => {
|
|
|
377
377
|
expect(logOutput).toContain("Add feature file")
|
|
378
378
|
expect(logOutput).not.toContain("Add AGENTS.md")
|
|
379
379
|
})
|
|
380
|
+
|
|
381
|
+
test("filters pre-existing CLAUDE.md that gets edited by agency", async () => {
|
|
382
|
+
if (!hasGitFilterRepo) {
|
|
383
|
+
console.log("Skipping test: git-filter-repo not installed")
|
|
384
|
+
return
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// Start fresh on main branch
|
|
388
|
+
await checkoutBranch(tempDir, "main")
|
|
389
|
+
|
|
390
|
+
// Create CLAUDE.md on main branch (simulating pre-existing file)
|
|
391
|
+
await Bun.write(
|
|
392
|
+
join(tempDir, "CLAUDE.md"),
|
|
393
|
+
"# Original Claude Instructions\n\nSome content here.\n",
|
|
394
|
+
)
|
|
395
|
+
await addAndCommit(tempDir, "CLAUDE.md", "Add CLAUDE.md")
|
|
396
|
+
|
|
397
|
+
// Create a new feature branch
|
|
398
|
+
await createBranch(tempDir, "agency/claude-test")
|
|
399
|
+
|
|
400
|
+
// Initialize agency on this branch (this will modify CLAUDE.md)
|
|
401
|
+
await Bun.write(
|
|
402
|
+
join(tempDir, "agency.json"),
|
|
403
|
+
JSON.stringify({
|
|
404
|
+
version: 1,
|
|
405
|
+
injectedFiles: ["AGENTS.md"],
|
|
406
|
+
template: "test",
|
|
407
|
+
createdAt: new Date().toISOString(),
|
|
408
|
+
}),
|
|
409
|
+
)
|
|
410
|
+
await Bun.write(join(tempDir, "AGENTS.md"), "# Test AGENTS\n")
|
|
411
|
+
|
|
412
|
+
// Simulate what agency task does - inject into CLAUDE.md
|
|
413
|
+
const originalClaude = await Bun.file(join(tempDir, "CLAUDE.md")).text()
|
|
414
|
+
const modifiedClaude = `${originalClaude}\n# Agency References\n@AGENTS.md\n@TASK.md\n`
|
|
415
|
+
await Bun.write(join(tempDir, "CLAUDE.md"), modifiedClaude)
|
|
416
|
+
|
|
417
|
+
await addAndCommit(
|
|
418
|
+
tempDir,
|
|
419
|
+
"agency.json AGENTS.md CLAUDE.md",
|
|
420
|
+
"Initialize agency files",
|
|
421
|
+
)
|
|
422
|
+
|
|
423
|
+
// Add a feature file
|
|
424
|
+
await createCommit(tempDir, "Feature commit")
|
|
425
|
+
|
|
426
|
+
// Create emit branch (this should filter CLAUDE.md)
|
|
427
|
+
await runTestEffect(emit({ silent: true, baseBranch: "main" }))
|
|
428
|
+
|
|
429
|
+
// Should still be on source branch
|
|
430
|
+
const currentBranch = await getCurrentBranch(tempDir)
|
|
431
|
+
expect(currentBranch).toBe("agency/claude-test")
|
|
432
|
+
|
|
433
|
+
// Switch to emit branch to verify CLAUDE.md is reverted to main's version
|
|
434
|
+
await checkoutBranch(tempDir, "claude-test")
|
|
435
|
+
|
|
436
|
+
const files = await getGitOutput(tempDir, ["ls-files"])
|
|
437
|
+
expect(files).toContain("CLAUDE.md") // File should exist (from main)
|
|
438
|
+
expect(files).not.toContain("AGENTS.md") // Should be filtered
|
|
439
|
+
expect(files).not.toContain("TASK.md") // Should be filtered
|
|
440
|
+
expect(files).toContain("test.txt") // Feature file should exist
|
|
441
|
+
|
|
442
|
+
// Verify CLAUDE.md was reverted to original (no agency references)
|
|
443
|
+
const claudeContent = await Bun.file(join(tempDir, "CLAUDE.md")).text()
|
|
444
|
+
expect(claudeContent).toBe(
|
|
445
|
+
"# Original Claude Instructions\n\nSome content here.\n",
|
|
446
|
+
)
|
|
447
|
+
expect(claudeContent).not.toContain("@AGENTS.md")
|
|
448
|
+
expect(claudeContent).not.toContain("@TASK.md")
|
|
449
|
+
})
|
|
380
450
|
})
|
|
381
451
|
|
|
382
452
|
describe("error handling", () => {
|
|
@@ -49,7 +49,7 @@ export class AgencyMetadataService extends Context.Tag("AgencyMetadataService")<
|
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* Get list of files to filter during PR/merge operations.
|
|
52
|
-
* Always includes TASK.md, AGENCY.md, and agency.json, plus any injectedFiles from metadata.
|
|
52
|
+
* Always includes TASK.md, AGENCY.md, CLAUDE.md, and agency.json, plus any injectedFiles from metadata.
|
|
53
53
|
*/
|
|
54
54
|
readonly getFilesToFilter: (
|
|
55
55
|
gitRoot: string,
|
|
@@ -165,7 +165,7 @@ export const AgencyMetadataServiceLive = Layer.succeed(
|
|
|
165
165
|
const metadataPath = join(gitRoot, "agency.json")
|
|
166
166
|
|
|
167
167
|
const exists = yield* fs.exists(metadataPath)
|
|
168
|
-
const baseFiles = ["TASK.md", "AGENCY.md", "agency.json"]
|
|
168
|
+
const baseFiles = ["TASK.md", "AGENCY.md", "CLAUDE.md", "agency.json"]
|
|
169
169
|
|
|
170
170
|
if (!exists) {
|
|
171
171
|
return baseFiles
|
|
@@ -195,7 +195,7 @@ export const AgencyMetadataServiceLive = Layer.succeed(
|
|
|
195
195
|
return expandedFiles
|
|
196
196
|
}).pipe(
|
|
197
197
|
Effect.catchAll(() =>
|
|
198
|
-
Effect.succeed(["TASK.md", "AGENCY.md", "agency.json"]),
|
|
198
|
+
Effect.succeed(["TASK.md", "AGENCY.md", "CLAUDE.md", "agency.json"]),
|
|
199
199
|
),
|
|
200
200
|
),
|
|
201
201
|
|
package/src/types.ts
CHANGED
|
@@ -160,7 +160,7 @@ export async function writeAgencyMetadata(
|
|
|
160
160
|
|
|
161
161
|
/**
|
|
162
162
|
* Get list of files to filter during PR/merge operations.
|
|
163
|
-
* Always includes TASK.md, AGENCY.md, and agency.json, plus any backpack files from metadata.
|
|
163
|
+
* Always includes TASK.md, AGENCY.md, CLAUDE.md, and agency.json, plus any backpack files from metadata.
|
|
164
164
|
* @deprecated Use AgencyMetadataService.getFilesToFilter instead
|
|
165
165
|
*/
|
|
166
166
|
export async function getFilesToFilter(gitRoot: string): Promise<string[]> {
|