=== BEGIN ARTIFACT ANALYSIS.md === # Blueprint Analysis: drydock DupFind Uat Case ## Commander Expectations - assert the product is a command-line duplicate file finder that groups regular files by size and SHA-256 digest - assert the product never deletes, moves, or modifies any file it examines - assert the product reports either a full duplicate listing or a summary of reclaimable bytes - assert the product is implemented in Go 1.22 or newer using only the standard library - assert the supplied grader `sources/run.sh` is the sole acceptance verdict ## Crew | Crew | Charge | |---|---| | Commander | Defines intent and decides what done means. | | Team Lead | Confirms epic completeness and stakeholder expectations. | | Planning Crew | Authors atomic specifications and the ordered Manifest. | | Shipyard Crew | Builds the tickets without synchronous Commander access. | ## Story List ### Feature: Module and Build | ID | Story | High-level AC | |---|---|---| | MODBUILD-001 | Establish Go module at application root with main package at ./cmd/dupfind | `go build ./cmd/dupfind` succeeds using only the standard library | | MODBUILD-002 | Provide POSIX bin/test.sh running go vet and go test | `bin/test.sh` exits zero only when `go vet ./...` and `go test ./...` both pass | ### Feature: Directory Walk and Eligibility | ID | Story | High-level AC | |---|---|---| | WALK-001 | Walk the directory recursively including hidden files and directories | Every regular file under the directory, including names beginning `.`, is considered | | WALK-002 | Exclude symbolic links from consideration | Symbolic links are neither followed nor reported | | WALK-003 | Exclude files smaller than the minimum size | Files with size below `--min-size` (default 1) are ignored; zero-byte files are never reported | ### Feature: Duplicate Detection | ID | Story | High-level AC | |---|---|---| | DUP-001 | Group candidate files by exact size | Only files sharing a size are read for hashing | | DUP-002 | Group same-size files by SHA-256 digest | Files with identical size and digest form one group of two or more files | | DUP-003 | Compute reclaimable bytes per group | Reclaimable bytes equal `size × (files − 1)` | | DUP-004 | Order groups and assign group numbers | Groups ordered by reclaimable bytes descending then digest ascending; numbered from 1 | | DUP-005 | Order paths within a group | Paths relative to directory, `/` separator, no leading `./`, byte-ascending order | | DUP-006 | Skip unreadable files with a stderr warning | Unreadable file produces one stderr warning line and does not change exit code | ### Feature: Command Line Interface | ID | Story | High-level AC | |---|---|---| | CLI-001 | Parse `--summary`, `--min-size `, and one directory argument | Options precede the directory; exactly one directory is accepted | | CLI-002 | Reject malformed arguments with exit code 2 | Missing or extra arguments, unknown option, or non-positive-integer `--min-size` exit 2 with empty stdout | | CLI-003 | Reject missing or non-directory target with exit code 1 | Nonexistent path or non-directory exits 1 with empty stdout | ### Feature: Listing Output | ID | Story | High-level AC | |---|---|---| | LIST-001 | Write CSV listing with header `group,size,sha256,path` | One row per file in every duplicate group; header only when no duplicates | | LIST-002 | Quote CSV fields per RFC 4180 | Fields containing comma, double quote, or newline are quoted via `encoding/csv` | ### Feature: Summary Output | ID | Story | High-level AC | |---|---|---| | SUM-001 | Write summary row with header `groups,duplicate_files,reclaimable_bytes` | Single row totals groups, duplicate files, and reclaimable bytes; `0,0,0` when none | ## Surfaced Acceptance Criteria | ID | Story ID | Criterion | |---|---|---| | AC-001 | WALK-001 | Hidden files and directories are traversed and their regular files considered | | AC-002 | WALK-002 | A symbolic link pointing at a regular file is not reported and its target is not followed | | AC-003 | DUP-001 | Only files sharing a size are opened for hashing | | AC-004 | DUP-002 | Digest is lowercase hexadecimal SHA-256 of full file contents | | AC-005 | LIST-001 | Listing rows match header order `group,size,sha256,path` | | AC-006 | SUM-001 | Summary `duplicate_files` equals sum of `files − 1` across groups | | AC-007 | CLI-002 | Usage errors write nothing to standard output and one diagnostic line to standard error | | AC-008 | CLI-003 | Operational errors write nothing to standard output and one diagnostic line to standard error | | AC-009 | DUP-006 | Unreadable file warning is written to standard error only | | AC-010 | MODBUILD-002 | Test suite covers each rule, each output form, and each exit code against real temporary directories | ## Relationship Model | Source or group | Relationship type | Related source or group | Evidence | Delivery implication | |---|---|---|---|---| | sources/run.sh | instruction-to-test | sources/INSTRUCTIONS.md | run.sh cites the 15 checks, the `./cmd/dupfind` build target, and the exit-code table defined in INSTRUCTIONS.md | Implementation must satisfy INSTRUCTIONS.md; run.sh is the external acceptance verdict and is staged, not authored | | sources/INSTRUCTIONS.md | dependency | Command, Output, Exit codes sections | Rules 1–6 define the duplicate test that drives all listing and summary output | Walk, hash, group, and output stories depend on the Rules section | ## Source Roles | Path | Role | Plan disposition | Build disposition | |---|---|---|---| | sources/INSTRUCTIONS.md | author intent | compass | prompt-only | | sources/run.sh | conformance harness | context | stage | ## Planning Instructions ### Delivery Shape The system is a single-binary Go CLI. Input: one directory path plus optional `--summary` and `--min-size` flags. Output: CSV on standard output (listing or summary) with exit codes 0, 1, or 2. Flow: parse arguments → validate directory → walk recursively → filter regular non-empty files at or above minimum size → group by size → hash same-size groups with SHA-256 → form duplicate groups → order and number → emit CSV. ### Story Realization Map - MODBUILD-001: `sources/INSTRUCTIONS.md` Stack section; `sources/run.sh` build step. Requires a Go module and `cmd/dupfind` main package. - MODBUILD-002: `sources/INSTRUCTIONS.md` Tests section. Requires `bin/test.sh`. - WALK-001 through WALK-003: `sources/INSTRUCTIONS.md` Scope and Rule 2. Requires a directory walker. - DUP-001 through DUP-006: `sources/INSTRUCTIONS.md` Rules 3–6. Requires hashing and grouping logic. - CLI-001 through CLI-003: `sources/INSTRUCTIONS.md` Command and Exit codes. Requires argument parsing. - LIST-001, LIST-002: `sources/INSTRUCTIONS.md` Output (listing). Requires `encoding/csv`. - SUM-001: `sources/INSTRUCTIONS.md` Output (summary). ### Test and Acceptance Strategy Story-scoped tests run per feature area with bounded scope. The terminal verification story depends on every implementation story and runs the full `bin/test.sh` suite (`Suite: full`). Sea Trial `st-001` executes `sh sources/run.sh` as the sole acceptance verdict. ### Sequencing and Dependencies Build (MODBUILD-001) precedes all feature stories. CLI-001 precedes CLI-002 and CLI-003. Walk stories precede Duplicate Detection. DUP-001 precedes DUP-002. DUP-002 precedes DUP-003 and DUP-004. Listing and Summary output stories depend on DUP-004 and DUP-005. MODBUILD-002 is the terminal gate. ### Source Conflicts and Gaps - None. The single source defines all behavior; no cross-source conflicts exist. Unresolved edge cases (symlink to a directory, file read errors mid-hash) are resolved by the narrowest reading: directories are not regular files and are not walked into via symlinks; read errors follow Rule 6. ## Analysis Notes generated: 2026-10-25 blueprint: /mnt/c/Users/barlo/projects/drydock/uat/DupFind/runs/20261025.174005/workspace/targets/DupFind/blueprint Quality: Ready blockers: 0 questions: 0 features: 6 stories: 16 stack: Go 1.22+ (standard library only) display_name: not proposed short_description: not proposed Selected behaviors (unattended policy): - Symbolic links are excluded at the walk level; directories reached only through symbolic links are not traversed. - Files whose size is zero are excluded by the default `--min-size 1` and by the explicit zero-byte rule. - Unreadable files are skipped with one stderr line; they are excluded from grouping. - `--min-size` is validated as a positive decimal integer; leading `+`, signs, and non-decimal forms are usage errors. - Path separators are normalized to `/` on all platforms. === END ARTIFACT === === BEGIN ARTIFACT SEA_TRIALS.md === # Sea Trials: DupFind Project-level acceptance derived from COMPASS and sources. ## st-001: The supplied grader passes Type: technical Required: yes Criterion: The completed dupfind shall make sh sources/run.sh exit zero; that script's exit status is the sole acceptance verdict. Verification: proof Pattern: ubiquitous Command: ["sh", "sources/run.sh"] ## st-002: Test suite passes Type: technical Required: yes Criterion: The application shall provide a POSIX-compatible bin/test.sh that exits zero when go vet and every automated test pass. Verification: proof Pattern: ubiquitous ## st-003: The executable builds with go build Type: technical Required: yes Criterion: The application root shall be a Go module from which go build ./cmd/dupfind produces the dupfind executable using only the standard library. Verification: proof Pattern: ubiquitous ## st-004: Duplicate groups are exact and ordered Type: behavioral Required: yes Criterion: When dupfind lists a directory, the application shall report every group of two or more regular files with identical size and SHA-256 digest, ordered by reclaimable bytes descending then digest ascending, with paths relative to the directory in byte order. Verification: proof Pattern: event ## st-005: Empty files and symbolic links are never reported Type: behavioral Required: yes Criterion: The application shall ignore zero-byte files and shall neither follow nor report symbolic links. Verification: proof Pattern: ubiquitous ## st-006: The summary totals the listing Type: behavioral Required: yes Criterion: When --summary is given, the application shall write the group count, the duplicate file count, and the reclaimable bytes of the listing that the same options would produce. Verification: proof Pattern: event ## st-007: Errors map to exit codes Type: behavioral Required: yes Criterion: If the directory is missing or is not a directory, then the application shall exit 1; if the arguments are malformed, then the application shall exit 2; in both cases it shall write nothing to standard output. Verification: proof Pattern: unwanted ## st-008: Files are never modified Type: guardrail Required: yes Criterion: If any file under the directory is examined, then the application shall only read it and shall never delete, move, or write it. Verification: llm Pattern: unwanted ## Questions - None. === END ARTIFACT === === BEGIN ARTIFACT TECHNOLOGY_STACK.md === # Technology Stack | Technology | Rigging | Notes | |---|---|---| | Go 1.22+ | go.md | Standard library only; module root with `./cmd/dupfind` main package | | POSIX sh | — | Used by `bin/test.sh` | === END ARTIFACT === === BEGIN ARTIFACT COMPASS.md === # COMPASS: drydock DupFind Uat Case ## Compass A command-line tool that finds byte-identical duplicate files under a directory and reports each group or a summary of reclaimable disk space. It serves users who want to recover disk space safely: it only reads, never deletes, moves, or modifies a file. Written for a developer building it for the first time. ## Constraints - Implement in Go 1.22 or newer using only the standard library. - Application root is a Go module; executable is the main package at `./cmd/dupfind`. - Output is CSV on standard output with `\n` line endings; standard error is never compared. - Exit codes: 0 success, 1 operational failure, 2 usage error. ## Guardrails - Never delete, move, rename, or write any file under the scanned directory. - Never follow or report symbolic links. - Never report zero-byte files as duplicates. - Never write to standard output on a failing command. - Never modify, rewrite, or substitute `sources/run.sh`; application code never reads it or embeds its answers. === END ARTIFACT === === BEGIN ARTIFACT discovery-identity.json === { "id": "discovery-identity", "title": "Discovery: Project Identity", "purpose": "Confirm the proposed display name and short description before planning.", "questions": [ { "id": "display_name", "label": "Display Name", "prompt": "The display name Drydock will use for this project. Edit to override the proposal.", "input": "text", "proposed": "DupFind", "answer": "DupFind" }, { "id": "short_description", "label": "Short Description", "prompt": "One-sentence description of what this project does. Edit to override the proposal.", "input": "textarea", "proposed": "A command-line tool that finds byte-identical duplicate files under a directory and reports each group or a summary of reclaimable bytes.", "answer": "A command-line tool that finds byte-identical duplicate files under a directory and reports each group or a summary of reclaimable bytes." } ] } === END ARTIFACT ===