3.4 KiB
3.4 KiB
Tasks: enterprise-ports
Change ID: enterprise-ports
Package: @suaveplan/ports
Target path: packages/geospatial/logistics/ports/
Prerequisite packages: @suaveplan/error, @suaveplan/types, @suaveplan/geo, @suaveplan/testing
0. Pre-flight
- 0.1 Worktree audit (
git worktree list,git status) clean. - 0.2 §0a Sync — fast-forward to
genesisHEAD (ffe254a1). - 0.3 Confirm
logisticsplugin added togeospatialsuper-category inscripts/folder-reorg/assignment.yml.
1. Scaffold
- 1.1 Create
packages/geospatial/logistics/ports/withsrc/tree perdesign.md. - 1.2 Write
package.jsonat0.1.0with"type":"module","sideEffects":false, subpath exports, deps@suaveplan/error,@suaveplan/types,@suaveplan/geo,@opentelemetry/api,zod,tslib. - 1.3
tsconfig.lib.jsonextending../../../../tsconfig.base.json. - 1.4
vite.config.tswith multi-entry library build. - 1.5
vitest.config.tsviacreateTestConfigwith 100% coverage thresholds. - 1.6 Scripts:
build,lint,test,test:coverage,typecheck.
2. Types + errors + schemas + OTel + constants
- 2.1
src/types/port.types.ts—Port,PortType,PortFacility,LaneMode,ShippingLane,LaneProgress,ETAEstimate,NearestPortResult,SphericalCoord(re-exported from geo). - 2.2
src/error-codes/error-codes.ts—PORTS_CODES(8 codes) + 8PortsErrorsubclasses. - 2.3
src/schemas/schemas.ts— Zod schemas for every public type. - 2.4
src/otel/otel.ts— 3 counters + 3 histograms +refreshPortsMeters. - 2.5
src/constants/index.ts—EARTH_RADIUS_NM,DEFAULT_SPEED_KNOTS,VESSEL_CLASS_SPEEDS,EARTH_SPHEREellipsoid.
3. Data
- 3.1 Per-region sea-port files (
sea-ports-asia,-europe,-americas,-africa-mena,-oceania). - 3.2
sea-ports/sea-ports.tsaggregating all regions. - 3.3
airports/airports.ts,rail-terminals/rail-terminals.ts. - 3.4
all-ports/all-ports.tscombining sea + air + rail. - 3.5
shipping-lanes/shipping-lanes.tswith curated lanes.
4. Modules
- 4.1
distance—distanceNm,distanceKmwrapping geo great-circle. - 4.2
find-port—findPort,findPortStrict,findPortsByCountry,findPortsByType,searchPorts. - 4.3
spatial-index—PortSpatialIndexwith 5° bucketing. - 4.4
nearest-port—findNearestPort,findPortsInRadiususing spatial index. - 4.5
lane-lookup—getShippingLane,getShippingLaneStrict,getShippingLanesByMode,getAllShippingLanes. - 4.6
lane-distance—estimateLaneDistance,cumulativeDistances. - 4.7
lane-progress—findPositionOnLane. - 4.8
eta—estimateETAwith{departureTime?, clock?}opts.
5. Verify
- 5.1 100% coverage on every module (Istanbul, branches/functions/lines/statements).
- 5.2
bunx turbo lint typecheck test build --filter=@suaveplan/portsgreen. - 5.3
bunx turbo test:coverage --filter=@suaveplan/portsgreen at 100/100/100/100. - 5.4 Co-located
.md(≥200 words, 6 sections) for every non-barrel.ts. - 5.5 Root
README.md. - 5.6 Refresh
MANIFEST.md; flipSTATUS.md.
6. Archive
- 6.1 Fold deltas into
openspec/specs/ports/spec.md(drop**Verified by:**lines). - 6.2 Move folder to
openspec/archive/2026-05-25-enterprise-ports/.