Default the manifest to index.mf and keep it out of its own listing (closes #100)
check / check (push) Failing after 2s

mfer gen now writes index.mf instead of .index.mf, the name fetch
requests and the README calls the standard filename. Given a
directory, check, freshen, list and export look only for index.mf;
.index.mf is no longer recognized. Because index.mf is not hidden, the
scanner now leaves the output file out of the listing by its path: gen
--force over an existing manifest no longer lists the old one, while a
file named index.mf in a subdirectory is still listed.

Model: opus-5-5
This commit is contained in:
2026-10-04 08:52:52 +00:00
parent 588c1bae74
commit 73b97ac2e4
11 changed files with 83 additions and 26 deletions
+37
View File
@@ -638,6 +638,43 @@ func TestGenerateFailsWithoutForceWhenOutputExists(t *testing.T) {
assert.Equal(t, "existing", string(content), "original file should be preserved")
}
// TestGenerateLeavesOutputOutOfListing overwrites an output file inside the
// scanned tree with --force: the old file is not listed, while a file named
// index.mf in a subdirectory still is.
func TestGenerateLeavesOutputOutOfListing(t *testing.T) {
t.Parallel()
for name, output := range map[string]string{
"default name": "/testdir/index.mf",
"other name in a subdirectory": "/testdir/sub/listing.mf",
} {
t.Run(name, func(t *testing.T) {
t.Parallel()
fs := afero.NewMemMapFs()
require.NoError(t, fs.MkdirAll("/testdir/sub", 0o755))
writeTestFile(t, fs, "/testdir/readme.txt", "hello")
writeTestFile(t, fs, "/testdir/sub/index.mf", "an ordinary file")
writeTestFile(t, fs, output, "previous manifest")
opts := testOpts([]string{
testApp, cmdGenerate, "-q", "--force", "-o", output, testDir,
}, fs)
require.Equal(t, 0, runCLI(opts), "stderr: %s", testStderr(t, opts))
manifest, err := mfer.NewManifestFromFile(fs, output)
require.NoError(t, err)
paths := make([]string, 0, len(manifest.Files()))
for _, f := range manifest.Files() {
paths = append(paths, f.GetPath())
}
assert.ElementsMatch(t, []string{"readme.txt", "sub/index.mf"}, paths)
})
}
}
func TestGenerateAtomicWriteUsesTemp(t *testing.T) {
t.Parallel()