Run artifact

workspace/targets/CsvStat/ANALYSIS.md

Blueprint Analysis: CsvStat

Commander Expectations

Crew

CrewCharge
CommanderDefines intent and decides what done means.
Team LeadConfirms epic completeness and stakeholder expectations.
Planning CrewAuthors atomic specifications and the ordered Manifest.
Shipyard CrewBuilds the tickets without synchronous Commander access.

Story List

Feature: CLI Foundation and Input Handling

IDStoryHigh-level AC
CLI-001Build the csvstat command entry pointA Go module builds ./cmd/csvstat as an executable using only the standard library, with command help text available for the supported invocation forms.
CLI-002Read and validate CSV inputThe command reads RFC 4180 CSV, trims headers and values, accepts quoted fields, and rejects empty files, invalid headers, and ragged records.
CLI-003Resolve columns and null valuesThe command recognizes the specified null spellings and rejects absent named columns without writing standard output.

Feature: Column Profiling

IDStoryHigh-level AC
PROFILE-001Infer column typesEach column is classified as integer, number, date, boolean, text, or empty according to the stated precedence and validation rules.
PROFILE-002Calculate column statisticsProfile output reports rows, nulls, distinct values, min, max, numeric sum, mean, and median with the required formatting and ordering.
PROFILE-003Render profile CSV outputFull-file and single-column profile commands emit the exact CSV header and row structure, including RFC-compliant quoting and empty fields.

Feature: Frequency Reporting

IDStoryHigh-level AC
FREQ-001List frequent column values--freq excludes nulls and orders values by descending count then bytewise ascending value.
FREQ-002Apply frequency limits--top accepts positive integers, defaults to five, and limits the frequency rows while preserving ordering.

Feature: Command Errors and Verification

IDStoryHigh-level AC
CLI-004Map operational and usage failuresFile, argument, and rejected-input failures return exit codes 1, 2, and 3 respectively and write nothing to standard output.
TEST-001Provide the project test gatebin/test.sh runs go vet ./... and go test ./..., succeeding only when both pass.
VERIFY-001Pass the complete supplied conformance suiteThe complete supplied sources/run.sh suite passes without filtering; acceptance declares Suite: full.

Story Guidance

Named stories planning must produce. Authoritative record: STORY_GUIDANCE.json.

None.

Surfaced Acceptance Criteria

IDStory IDCriterion
AC-001CLI-001The command shall provide help text covering the supported profile and frequency invocation forms.
AC-002CLI-002The parser shall preserve quoted commas and apply trimming before null, type, and statistic evaluation.
AC-003CLI-004A failing command shall write one diagnostic line to standard error naming the file and, for rejected records, the line number.

Source Inventory

PathContent kindDispositionReason
sources/INSTRUCTIONS.mdmarkdownanalyzedreadable UTF-8
sources/employees.csvtextanalyzedreadable UTF-8
sources/header_only.csvtextanalyzedreadable UTF-8
sources/orders.csvtextanalyzedreadable UTF-8
sources/ragged.csvtextanalyzedreadable UTF-8
sources/run.shcodeanalyzedreadable UTF-8
sources/sensors.csvtextanalyzedreadable UTF-8

Relationship Model

Source or groupRelationship typeRelated source or groupEvidenceDelivery implication
sources/INSTRUCTIONS.mdinstruction-to-testsources/run.shThe instructions define the CLI, rules, outputs, and exit codes that the harness checks.Implement the normative behavior before running conformance verification.
sources/run.shtest-kit-to-implementation./cmd/csvstatThe harness builds the command and invokes all profile, frequency, rejection, operational, and usage cases.Stage the harness and fixtures; terminal verification runs the full suite.
sources/*.csvfixture-to-verificationsources/run.shThe harness reads the supplied employee, sensor, order, header-only, and ragged fixtures.Preserve fixtures unchanged and make parser behavior data-driven.
CSV parserparser-to-normalizertype and statistics engineValues must be trimmed before null, type, comparison, and aggregation rules.Establish normalization as the shared boundary for all downstream stories.
CLI argument parserdependencyprofile and frequency commandsOptions select distinct execution modes and invalid combinations have defined exit codes.Complete argument validation before command dispatch.

Source Roles

PathRolePlan dispositionBuild disposition
sources/INSTRUCTIONS.mdnormative specificationcontextprompt-only
sources/run.shconformance test suitecontextstage
sources/employees.csvassetcontextstage
sources/sensors.csvassetcontextstage
sources/orders.csvassetcontextstage
sources/header_only.csvassetcontextstage
sources/ragged.csvassetcontextstage

Planning Instructions

Delivery Shape

A Go command-line pipeline accepts one CSV file and optional column, frequency, and top arguments. It parses and normalizes records, validates structure, infers column types, computes profiles or frequencies, writes CSV to standard output, and maps failures to defined exit codes.

Story Realization Map

Story IDBlueprint scopeEvidenceRelated filesDelivery kind
CLI-001Go module and command entry pointsources/INSTRUCTIONS.md command and stack sectionscmd/csvstat, go.modcapability
CLI-002CSV parser and structural validationsources/INSTRUCTIONS.md reading sectionsources/*.csvcapability
CLI-003normalization, nulls, and column lookupsources/INSTRUCTIONS.md null and command sectionssources/employees.csv, sources/orders.csvcapability
PROFILE-001type inference and date validationsources/INSTRUCTIONS.md types sectionsources/employees.csv, sources/sensors.csv, sources/orders.csvcapability
PROFILE-002statistics and decimal formattingsources/INSTRUCTIONS.md profile and decimals sectionsall profile fixturescapability
PROFILE-003profile CSV renderingsources/INSTRUCTIONS.md output sectionsources/run.shcapability
FREQ-001frequency aggregation and orderingsources/INSTRUCTIONS.md frequency sectionsources/run.shcapability
FREQ-002top argument behaviorsources/INSTRUCTIONS.md command sectionsources/run.shcapability
CLI-004diagnostics and exit-code mappingsources/INSTRUCTIONS.md exit sectionsources/run.shcapability
TEST-001local vet/test launchersources/INSTRUCTIONS.md tests sectionbin/test.shtest harness
VERIFY-001complete supplied conformance executionsources/run.shsources/run.sh, staged CSV fixturesacceptance contract

Test and Acceptance Strategy

Implementation stories use focused unit and command tests for parsing, normalization, inference, statistics, rendering, frequency ordering, and exit codes. TEST-001 provides the local vet and test gate. VERIFY-001 is the sole terminal story that runs the complete unfiltered supplied harness and declares Suite: full; all other validation remains scoped to the story capability.

Sequencing and Dependencies

Create the Go module and command entry point first. Implement CSV parsing and normalization before inference and aggregation. Implement profile and frequency renderers after their calculations. Add error mapping around all command paths. Run focused tests and bin/test.sh before the final full sources/run.sh verification. The supplied harness and all fixtures must be staged before terminal verification.

Source Conflicts and Gaps

No unresolved source conflicts or blockers. The CLI help wording is not specified, so the command story carries the derived requirement to expose help for the documented invocation forms.

Analysis Notes

generated: 2026-10-23 blueprint: /mnt/c/Users/barlo/projects/drydock/uat/CsvStat/runs/20261023.222823/workspace/targets/CsvStat/blueprint

Quality: Ready blockers: 0 questions: 0 features: 4 stories: 11 stack: Go 1.22+, standard library, POSIX shell display_name: not proposed short_description: not proposed

Project type: cli. No blockers or open Commander questions remain.