@markjaquith/agency 2.73.0 → 2.73.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 +1 -1
- package/src/cli-parser.test.ts +3 -0
- package/src/cli-parser.ts +7 -1
- package/src/cli.test.ts +42 -0
package/package.json
CHANGED
package/src/cli-parser.test.ts
CHANGED
|
@@ -229,7 +229,9 @@ describe("strict CLI parsing", () => {
|
|
|
229
229
|
test("parses addressable resource maintenance commands", () => {
|
|
230
230
|
for (const args of [
|
|
231
231
|
["doctor", "--json"],
|
|
232
|
+
["repo", "materialize", "--help"],
|
|
232
233
|
["repo", "show", "agency", "--json"],
|
|
234
|
+
["repo", "materialize", "agency", "--json"],
|
|
233
235
|
["repo", "fetch", "agency"],
|
|
234
236
|
["repo", "remove", "agency"],
|
|
235
237
|
["repo", "unlink", "agency"],
|
|
@@ -270,6 +272,7 @@ describe("strict CLI parsing", () => {
|
|
|
270
272
|
[["integration", "sync", "extra"], "agency integration sync"],
|
|
271
273
|
[["repo", "add", "a", "b", "extra"], "agency repo add"],
|
|
272
274
|
[["repo", "link", "a", "b", "extra"], "agency repo link"],
|
|
275
|
+
[["repo", "materialize", "a", "extra"], "agency repo materialize"],
|
|
273
276
|
[["repo", "list", "extra"], "agency repo list"],
|
|
274
277
|
[
|
|
275
278
|
[
|
package/src/cli-parser.ts
CHANGED
|
@@ -259,7 +259,7 @@ const commands = {
|
|
|
259
259
|
},
|
|
260
260
|
repo: {
|
|
261
261
|
usage:
|
|
262
|
-
"agency repo <setup|add|link|list|show|fetch|remove|unlink|rename|remote|verify>",
|
|
262
|
+
"agency repo <setup|add|link|materialize|list|show|fetch|remove|unlink|rename|remote|verify>",
|
|
263
263
|
options: {
|
|
264
264
|
...outputOptions,
|
|
265
265
|
"dry-run": { type: "boolean" },
|
|
@@ -285,6 +285,12 @@ const commands = {
|
|
|
285
285
|
maxArgs: 2,
|
|
286
286
|
options: ["json"],
|
|
287
287
|
},
|
|
288
|
+
materialize: {
|
|
289
|
+
usage: "agency repo materialize <alias> [--json]",
|
|
290
|
+
minArgs: 1,
|
|
291
|
+
maxArgs: 1,
|
|
292
|
+
options: ["json"],
|
|
293
|
+
},
|
|
288
294
|
list: {
|
|
289
295
|
usage: "agency repo list [--json]",
|
|
290
296
|
minArgs: 0,
|
package/src/cli.test.ts
CHANGED
|
@@ -934,6 +934,48 @@ status: open
|
|
|
934
934
|
})
|
|
935
935
|
})
|
|
936
936
|
|
|
937
|
+
test("materializes a linked repository through the CLI", async () => {
|
|
938
|
+
const parent = await createTempDir()
|
|
939
|
+
tempDirs.push(parent)
|
|
940
|
+
const root = join(parent, "workbase")
|
|
941
|
+
const source = join(parent, "source")
|
|
942
|
+
await runGit(["init", "--initial-branch=main", source])
|
|
943
|
+
await Bun.write(join(source, "README.md"), "materialize\n")
|
|
944
|
+
for (const args of [
|
|
945
|
+
["config", "user.email", "test@example.com"],
|
|
946
|
+
["config", "user.name", "Test"],
|
|
947
|
+
["add", "README.md"],
|
|
948
|
+
["-c", "commit.gpgsign=false", "commit", "-m", "initial"],
|
|
949
|
+
[
|
|
950
|
+
"remote",
|
|
951
|
+
"add",
|
|
952
|
+
"origin",
|
|
953
|
+
"https://example.com/agency-tests/source.git",
|
|
954
|
+
],
|
|
955
|
+
]) {
|
|
956
|
+
await runGit(["-C", source, ...args])
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
parseJson(await runCli(["init", root, "--json"], parent))
|
|
960
|
+
const configPath = join(root, "agency.json")
|
|
961
|
+
await Bun.write(
|
|
962
|
+
configPath,
|
|
963
|
+
JSON.stringify({ ...(await Bun.file(configPath).json()), vcs: "git" }),
|
|
964
|
+
)
|
|
965
|
+
parseJson(await runCli(["repo", "link", "agency", source, "--json"], root))
|
|
966
|
+
const materialized = parseJson(
|
|
967
|
+
await runCli(["repo", "materialize", "agency", "--json"], root),
|
|
968
|
+
)
|
|
969
|
+
|
|
970
|
+
expect(materialized).toMatchObject({
|
|
971
|
+
alias: "agency",
|
|
972
|
+
kind: "bare",
|
|
973
|
+
target: null,
|
|
974
|
+
states: ["declared", "materialized"],
|
|
975
|
+
})
|
|
976
|
+
expect(await Bun.file(join(root, "repos/agency/HEAD")).exists()).toBe(true)
|
|
977
|
+
})
|
|
978
|
+
|
|
937
979
|
test("prepares a workspace and reports a non-mutating dry-run", async () => {
|
|
938
980
|
const parent = await createTempDir()
|
|
939
981
|
tempDirs.push(parent)
|