feat: export public API via barrel file (#5)#11
Conversation
Greptile SummaryThis PR completes the public API surface of the
Confidence Score: 4/5Safe to merge — changes are small, correct, and well-scoped; the only concern is the Zod v4-only peer dependency range, which may surprise consumers still on v3. The barrel additions and JSDoc update are straightforward and match the stated acceptance criteria. The peerDependencies move is the right pattern for avoiding dual-instance issues, but pinning exclusively to ^4.0.0 means a v3 consumer gets a soft warning rather than a hard failure, which could lead to confusing runtime errors. No functional bugs in the changed code itself. package.json — the peerDependencies Zod version range deserves a second look before this package is published more broadly.
|
| Filename | Overview |
|---|---|
| src/index.ts | Adds parseArgs and validateInput re-exports from ./args.ts; updates JSDoc example to reflect new exports. Change is minimal and correct — RESERVED_SUBCOMMANDS is intentionally not re-exported. |
| package.json | Moves zod from dependencies to peerDependencies (also added to devDependencies). Correct approach to prevent dual-instance issues; consumers must now explicitly install zod ^4.0.0. |
| docs/specs/issue-5-export-public-api-via-barrel-file.md | New plan artifact documenting design decisions, acceptance criteria, and implementation steps. Documentation-only, no functional impact. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
Consumer["Consumer\n`import { Tool, parseArgs, validateInput } from '@code-first-agents/tool'`"]
subgraph Package ["@code-first-agents/tool"]
Index["src/index.ts (barrel)"]
Args["src/args.ts\nexports: parseArgs, validateInput"]
Tool["src/tool-class.ts\nexports: Tool"]
Envelopes["src/envelopes.ts\nexports: ToolError"]
Types["src/types.ts\nexports: types"]
end
PeerZod["zod (peerDependency ^4.0.0)\nresolved from consumer's node_modules"]
Consumer --> Index
Index -->|"export { parseArgs, validateInput } NEW"| Args
Index --> Tool
Index --> Envelopes
Index --> Types
Args -.->|"import type { z }"| PeerZod
Tool -.->|uses Zod schemas| PeerZod
Reviews (1): Last reviewed commit: "feat: export public API via barrel file ..." | Re-trigger Greptile
Summary
parseArgsandvalidateInputfromsrc/index.tsbarrel file, completing the public API surfacezodfromdependenciestopeerDependenciesto avoid dual-instance class identity issues for consumersCloses #5
Files changed
src/index.ts— Added re-exports forparseArgs,validateInputfrom./args.ts; updated JSDoc examplepackage.json— MovedzodtopeerDependencies, added todevDependenciesdocs/specs/issue-5-export-public-api-via-barrel-file.md— Plan artifactContext
@code-first-agents/toolpackagefeat/1-implement-code-first-agentstool-package