@markjaquith/agency 1.8.2 → 1.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markjaquith/agency",
3
- "version": "1.8.2",
3
+ "version": "1.8.4",
4
4
  "description": "Manages personal agents files",
5
5
  "keywords": [
6
6
  "agents",
@@ -367,5 +367,37 @@ describe("emit command", () => {
367
367
  // This is the key assertion - the symlink target should be filtered too
368
368
  expect(lastCall!.args).toContain("AGENTS.md")
369
369
  })
370
+
371
+ test("expands injected dot-directory globs into filter paths", async () => {
372
+ await checkoutBranch(tempDir, "main")
373
+ await createBranch(tempDir, "agency--dotdir-test")
374
+
375
+ await Bun.spawn(["mkdir", "-p", join(tempDir, ".agents", "foo")], {
376
+ stdout: "pipe",
377
+ stderr: "pipe",
378
+ }).exited
379
+
380
+ await Bun.write(
381
+ join(tempDir, "agency.json"),
382
+ JSON.stringify({
383
+ version: 1,
384
+ injectedFiles: [".agents/**"],
385
+ template: "test",
386
+ createdAt: new Date().toISOString(),
387
+ }),
388
+ )
389
+ await Bun.write(join(tempDir, ".agents", "foo", "bar.whatever"), "test\n")
390
+ await addAndCommit(
391
+ tempDir,
392
+ ["agency.json", ".agents/foo/bar.whatever"],
393
+ "Add template dot-directory file",
394
+ )
395
+
396
+ await runTestEffectWithMockFilterRepo(emit({ silent: true }))
397
+
398
+ const lastCall = getLastCapturedFilterRepoCall()
399
+ expect(lastCall).toBeDefined()
400
+ expect(lastCall!.args).toContain(".agents/foo/bar.whatever")
401
+ })
370
402
  })
371
403
  })
@@ -828,6 +828,53 @@ describe("task command", () => {
828
828
  await cleanupTempDir(configDir)
829
829
  })
830
830
 
831
+ test("copies files in subdirectories from template", async () => {
832
+ await initGitRepo(tempDir)
833
+ process.chdir(tempDir)
834
+
835
+ // Create template with files in subdirectories (including dotdirectories)
836
+ const templateDir = join(configDir, "templates", "custom")
837
+ await Bun.spawn(
838
+ ["mkdir", "-p", join(templateDir, ".agents", "skills", "my-skill")],
839
+ {
840
+ stdout: "pipe",
841
+ stderr: "pipe",
842
+ },
843
+ ).exited
844
+ await Bun.spawn(["mkdir", "-p", join(templateDir, "docs")], {
845
+ stdout: "pipe",
846
+ stderr: "pipe",
847
+ }).exited
848
+
849
+ const skillContent = "# My Skill\n\nSkill instructions here"
850
+ const docContent = "# Docs\n\nDocs content"
851
+ await Bun.write(
852
+ join(templateDir, ".agents", "skills", "my-skill", "SKILL.md"),
853
+ skillContent,
854
+ )
855
+ await Bun.write(join(templateDir, "docs", "guide.md"), docContent)
856
+
857
+ await initAgency(tempDir, "custom")
858
+
859
+ await runTestEffect(task({ silent: true, emit: "test-feature" }))
860
+
861
+ // Files in dotdirectory should be created
862
+ expect(
863
+ await fileExists(
864
+ join(tempDir, ".agents", "skills", "my-skill", "SKILL.md"),
865
+ ),
866
+ ).toBe(true)
867
+ const skillFileContent = await readFile(
868
+ join(tempDir, ".agents", "skills", "my-skill", "SKILL.md"),
869
+ )
870
+ expect(skillFileContent).toBe(skillContent)
871
+
872
+ // Files in regular subdirectory should also be created
873
+ expect(await fileExists(join(tempDir, "docs", "guide.md"))).toBe(true)
874
+ const docFileContent = await readFile(join(tempDir, "docs", "guide.md"))
875
+ expect(docFileContent).toBe(docContent)
876
+ })
877
+
831
878
  test("uses AGENTS.md from template directory if it exists", async () => {
832
879
  await initGitRepo(tempDir)
833
880
  process.chdir(tempDir)
@@ -1124,7 +1124,7 @@ const discoverTemplateFiles = (templateDir: string, verboseLog: Function) =>
1124
1124
  for (const file of foundFiles) {
1125
1125
  // Get relative path from template directory
1126
1126
  const relativePath = file.replace(templateDir + "/", "")
1127
- if (relativePath && !relativePath.startsWith(".")) {
1127
+ if (relativePath) {
1128
1128
  templateFiles.push(relativePath)
1129
1129
  }
1130
1130
  }
@@ -97,10 +97,12 @@ describe("expandGlobs", () => {
97
97
  await mkdir(join(tempDir, "plans"))
98
98
  await mkdir(join(tempDir, "plans", "sub"))
99
99
  await mkdir(join(tempDir, "other"))
100
+ await mkdir(join(tempDir, ".agents", "foo"), { recursive: true })
100
101
 
101
102
  await writeFile(join(tempDir, "plans", "foo.md"), "foo")
102
103
  await writeFile(join(tempDir, "plans", "sub", "bar.md"), "bar")
103
104
  await writeFile(join(tempDir, "other", "baz.md"), "baz")
105
+ await writeFile(join(tempDir, ".agents", "foo", "bar.whatever"), "dot")
104
106
  await writeFile(join(tempDir, "root.txt"), "root")
105
107
  })
106
108
 
@@ -151,4 +153,9 @@ describe("expandGlobs", () => {
151
153
  ["plans/foo.md", "plans/sub/bar.md", "other/baz.md"].sort(),
152
154
  )
153
155
  })
156
+
157
+ test("expands glob patterns inside dot-directories", async () => {
158
+ const files = await expandGlobs([".agents/**"], tempDir)
159
+ expect(files).toEqual([".agents/foo/bar.whatever"])
160
+ })
154
161
  })
package/src/utils/glob.ts CHANGED
@@ -38,7 +38,7 @@ export async function expandGlobs(
38
38
  if (isGlobPattern(pattern)) {
39
39
  // Expand glob pattern
40
40
  const glob = new Bun.Glob(pattern)
41
- for await (const file of glob.scan({ cwd })) {
41
+ for await (const file of glob.scan({ cwd, dot: true })) {
42
42
  files.add(file)
43
43
  }
44
44
  } else {