Skip to content

Build the v2 generated SDK, docs site, and release pipeline#13

Merged
AllyMurray merged 83 commits into
mainfrom
next
Apr 13, 2026
Merged

Build the v2 generated SDK, docs site, and release pipeline#13
AllyMurray merged 83 commits into
mainfrom
next

Conversation

@AllyMurray
Copy link
Copy Markdown
Owner

@AllyMurray AllyMurray commented Apr 6, 2026

Summary

  • replace the previous hand-maintained client structure with a sample-driven SDK generation pipeline for types, resources, tests, and mock data
  • add the new Starlight docs site with migration, API reference, guides, and examples content
  • collapse the old monorepo package layout into a single published comic-vine-sdk package built on @http-client-toolkit
  • expand build artifact coverage and update CI and release automation for the new package and docs workflow

Validation

  • pnpm test
  • pnpm run test:build
  • pnpm run lint

AllyMurray and others added 30 commits February 16, 2026 18:26
Remove Changesets configuration, Turborepo config, pnpm workspace
file, and shared TypeScript configs that are no longer needed for
the single-package structure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove shared config packages (eslint-config, tsup-config,
vitest-config) and store packages (in-memory-store, sqlite-store)
that have been extracted to the @http-client-toolkit organization.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tion

Collapse packages/client/ to the repo root and replace the Axios-based
HTTP client with @http-client-toolkit/core.

Key changes:
- Move all source from packages/client/src/ to src/
- Move build-tests/ from packages/client/ to repo root
- Delete old HTTP client (http-client.ts, http-client-factory.ts)
- Delete store interfaces (src/stores/) now provided by toolkit
- Add hooks.ts adapter connecting toolkit to Comic Vine domain errors
- Update base-resource.ts type params for toolkit's get<T>() signature
- Extend BaseError from HttpClientError for toolkit error propagation
- Update comic-vine.ts to construct toolkit HttpClient directly
- Update all test files to use toolkit HttpClient instead of factory

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rename package to comic-vine-sdk v2.0.0 and replace monorepo
tooling with inlined configuration.

- Replace axios with @http-client-toolkit/core dependency
- Inline ESLint, tsup, and vitest configs from shared packages
- Remove turbo, changesets, and workspace references
- Update tsconfig.json for flat project structure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reflect the migration from monorepo to single-package in the
development guide. Remove monorepo-specific commands and update
architecture description for toolkit integration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
These examples imported from @comic-vine/client and @comic-vine/in-memory-store
which no longer exist after the single-package restructuring.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Consolidate sample data from comic-vine-codegen into the main repo:
- API response samples for all 19 resources (details + list variants)
- Scraped API documentation HTML for property descriptions
- Extracted code comments JSON
- Resource configuration for the generation pipeline

Add samples/ to .prettierignore to avoid slow formatting of large JSON files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Port generators from comic-vine-codegen as pure functions:
- schema-generator: JSON schema inference via quicktype-core
- type-generator: TypeScript interface generation from schemas
- common-types-generator: shared type extraction across resources
- resource-generator: resource class template
- test-generator: resource test template (updated for toolkit HttpClient)
- mock-data-generator: mock API response and expected response generation
- barrel-generator: index/barrel file generation
- comment-injector: property description extraction from HTML docs
- types: shared type definitions for the pipeline
- utils: string case conversion helpers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- generate-sdk.ts: 5-step pipeline (schemas -> common types -> TypeScript -> mock data -> barrels)
- fetch-samples.ts: rate-limited Comic Vine API sample fetcher
- Add devDependencies: quicktype-core, change-case, cheerio, pluralize, tsx, axios
- Add scripts: sdk:generate, samples:fetch

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Expand functionality.test.cjs to validate all resource classes exist with
correct list/retrieve methods, instead of only testing 4 resources.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update CLAUDE.md and README.md with sdk:generate and samples:fetch
commands, codegen architecture, and sample data structure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- type-generator: `if (foundIndex)` skips index 0; changed to `!== -1`
- comment-injector: replace hand-rolled regex with `toSnakeCase()` from
  utils to match the original codegen's `snakeCase()` usage

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- getResourceName, getResourceFolderName (generate-sdk.ts, removed in
  prior edit)
- getResourceFileName (resource-generator.ts)
- GeneratorContext interface (types.ts)
- toKebabCase (utils.ts, redundant duplicate of toParamCase)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wire up extractCommentsFromHtml as Step 0 in the SDK generation
pipeline. Comments are now derived from samples/documentation.html on
every run instead of reading a stale pre-computed comments.json.

Also removes unused config variable and ResourceConfig import from the
orchestrator (config.json is only used by fetch-samples.ts).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The old code used Record<string, unknown> with dynamic keys, collecting
both "fields" and "filters" sections from the API docs. Only "fields"
was ever consumed by injectComments — "filters" describes query
parameters, not response properties.

Replace with a properly typed { title, fields } structure and skip
non-field sections during extraction. Remove the [key: string]: unknown
index signature from CodeComment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the inline convertPropertiesToCamelCase function with the
existing convertSnakeCaseToCamelCase from src/utils/case-converter.ts.
Eliminates duplicated recursive object traversal logic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The function wraps kebabCase from change-case — the name toParamCase
was misleading. Rename to toKebabCase across all call sites.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… and sample flattening

- Add upfront validation for documentation.html and api-data directory
- Read all sample data once into a Map, eliminating redundant fs reads
  across steps 1, 2, and 4
- Iterate Maps directly instead of looking up by key with ! assertions
- Flatten list endpoint results before passing to extractCommonTypes,
  so the downstream function no longer needs Array.isArray branching
- Remove dead resourceFoldersGenerated tracking (mkdirSync recursive
  already handles directory creation idempotently)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…anch

Replace findIndex-based upsert pattern (5 levels of nesting) with a
Map<string, CommonTypeConversion[]> and continue-based early returns.
Remove the Array.isArray branch in extractCommonTypes since the
orchestrator now pre-flattens list endpoint results. Convert the Map
back to CommonTypeMapping[] at the end via Array.from().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the character-by-character scanner in removeType with a regex
that matches optional JSDoc + type declaration. Uses (?:[^*]|\*(?!/))*
for JSDoc content to prevent backtracking past closing */.

Split replaceCommonTypes into focused functions:
- applyCommonTypeReplacements: replace property types with common refs
- applyKnownTypeOverrides: fix hasStaffReview/aliases quicktype misses
- prependCommonTypeImports: generate import statement via Set<string>

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace separate removeClassFromInterfaceNames and string-level
replaceAll('Element', '') with a single cleanDefinitionNames function
that handles both suffixes via structured $ref path replacement.

Uses two-pass approach (Element first, then Class) so Class definitions
correctly overwrite Element wrappers when both resolve to the same
base name.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rectly

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… scripts utils

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…e pass

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds InferredType discriminated union, PropertyInfo, TypeDefinition,
EnumDefinition, and InferredTypeGraph interfaces that replace the
intermediate JSON Schema format previously used with quicktype-core.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replaces quicktype-core's JSON Schema inference with a direct pipeline
that merges sample objects and infers property types including nullability,
arrays, nested objects, dates, enums, index signatures, and optionality.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Walks the type graph and emits TypeScript source with imports, JSDoc
comments, interfaces, and enums in a single pass. Replaces quicktype-core's
schema-to-TypeScript conversion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Applies hardcoded type overrides that cannot be inferred from sample
data alone (hasStaffReview: null | false | SiteResource, aliases: null | string).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace injectComments() (which operated on JSON Schema) with
applyComments() that sets description directly on PropertyInfo.
extractCommentsFromHtml() is unchanged.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
AllyMurray and others added 27 commits February 18, 2026 00:34
Extract two self-contained concerns from sample-inferrer.ts (562→284 lines):

- type-utils.ts (68 lines): typesEqual, addUniqueType, buildUnion
- enum-detector.ts (178 lines): enum detection, validation, grouping

Improves testability by isolating enum heuristics and type utilities.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ng it

Derive API detail/list names from resource names using snakeCase +
pluralize, with explicit overrides only for Thing and Series where the
Comic Vine API names diverge from the pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The function maps the Comic Vine API name "object" to the SDK name
"thing" — the new name makes this intent clear and adds a doc comment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use Math.ceil for page count (handles non-divisible totals), derive
start page explicitly with Math.floor, and replace reduce accumulators
with a straightforward for-loop that builds both response objects.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Consolidate the duplicated find-or-create-then-merge pattern for nested
type definitions into a single helper function.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace duplicated resourceFolder.includes('list') checks in the
orchestrator and sample-inferrer with a shared predicate function.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Prevent infinite recursion in resolveProps if common-types.ts ever
contains circular extends chains, by tracking visited interfaces.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Explain the rationale behind the 25% ratio and <=3 unique values
thresholds that control when string properties become enums.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add enum-detector, type-utils, and types.ts to the generator modules
table. Include resource-map.ts in Step 4 description and mermaid output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove axios and axios-rate-limit dev dependencies in favor of the
HttpClient already used by the SDK, consolidating on a single HTTP
library and adding retry support for transient failures.

Also updates @http-client-toolkit/core from 0.8.0 to 0.10.0 (required
by store-memory) and adapts the single-object constructor API across
src/comic-vine.ts and all test files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Close three testing gaps before release: browser bundleability via
esbuild, exported type contracts via tsd, and bundle size gating via
size-limit. All run as part of the existing test:build chain.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reset package.json version to match the current published npm version
(1.3.2) so that changesets can bump it to 2.0.0 on release.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Refactor the changeset for the v2 major release of the comic-vine-sdk to use a consistent YAML format. This change ensures better readability and adherence to the project's formatting standards.
@AllyMurray AllyMurray changed the title Prepare v2 single-package SDK release Build the v2 generated SDK, docs site, and release pipeline Apr 13, 2026
@AllyMurray AllyMurray merged commit fdbfc32 into main Apr 13, 2026
4 checks passed
@AllyMurray AllyMurray deleted the next branch April 13, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant