feat: support simple projects and root Git repositories
Allow registering a single Git repository at the engineering project root with --path . while retaining path safety checks. Document Git-optional projects first and cover plain folders, root repositories, and multiple repositories in process tests and native smoke scenarios. Validated with 23 passing tests and macOS ARM64 native smoke checks for all three layouts.
This commit is contained in:
@@ -52,6 +52,28 @@ class ProtocolIntegrationTest {
|
||||
assertThat(ok("work", "context", "WRK-0002").out()).doesNotContain("Only one");
|
||||
assertThat(ok("work", "context", "WRK-0001").out()).isEqualTo(ok("work", "context", "WRK-0001").out());
|
||||
}
|
||||
@Test void singleGitRepositoryCanShareTheEngineeringProjectRoot() throws Exception {
|
||||
var git = new ProcessBuilder("git", "init", root.toString()).redirectErrorStream(true).start();
|
||||
git.getInputStream().readAllBytes(); assertThat(git.waitFor()).isZero();
|
||||
Path source = Files.writeString(root.resolve("main.txt"), "Existing application source\n");
|
||||
byte[] gitConfig = Files.readAllBytes(root.resolve(".git/config"));
|
||||
init(); ok("repo", "add", "app", "--path", ".");
|
||||
assertThat(ok("repo", "list", "--format", "json").out()).contains("\"path\" : \".\"", "\"edit\" : false");
|
||||
ok("work", "create", "Improve application", "--repo", "app");
|
||||
String exported = ok("work", "context", "WRK-0001", "--format", "json").out();
|
||||
assertThat(exported).contains("\"repositoryId\" : \"app\"", "\"head\" : \"UNBORN\"");
|
||||
Path nested = Files.createDirectories(root.resolve("src/feature"));
|
||||
var fresh = run(nested, "work", "context", "WRK-0001", "--format", "json");
|
||||
assertThat(fresh.code()).as(fresh.err()).isZero(); assertThat(fresh.out()).isEqualTo(exported);
|
||||
ok("project", "validate");
|
||||
assertThat(Files.readString(source)).isEqualTo("Existing application source\n");
|
||||
assertThat(Files.readAllBytes(root.resolve(".git/config"))).isEqualTo(gitConfig);
|
||||
assertThat(run(root, "repo", "add", "duplicate", "--path", "./.").code()).isEqualTo(2);
|
||||
}
|
||||
@Test void protocolStorageCannotBeRegisteredAsASourceRepository() {
|
||||
init();
|
||||
assertThat(run(root, "repo", "add", "protocol", "--path", ".ai-engineering").code()).isEqualTo(2);
|
||||
}
|
||||
@Test void invalidIdentifiersMissingResourcesAndNoOverwrite() throws Exception {
|
||||
init();
|
||||
assertThat(run(root, "init", "--name", "Again").code()).isEqualTo(2);
|
||||
|
||||
Reference in New Issue
Block a user