feat(index): public library barrel re-exporting CspIndex + types#12
Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request establishes the public library barrel (src/index.ts) and introduces placeholder stubs for CspIndex (src/indexing/index.ts) and associated types (src/types.ts) to enable isolated type-checking and imports. Additionally, it adds smoke tests (src/index.test.ts) to lock down the public API surface and a version module (src/version.ts). There are no review comments, and I have no feedback to provide.
There was a problem hiding this comment.
No issues found across 5 files
Architecture diagram
sequenceDiagram
participant Consumer as External Consumer
participant Barrel as src/index.ts (Barrel)
participant Indexing as src/indexing/index.ts (CspIndex)
participant Types as src/types.ts (Types)
participant Version as src/version.ts
participant Test as src/index.test.ts (Smoke Tests)
Note over Consumer,Test: Public Library Barrel — Runtime & Type-Space Flow
Consumer->>Barrel: import { CspIndex, ContentType, version } from '@pleaseai/csp'
Note over Barrel: Re-exports both values & types
Barrel->>Indexing: export { CspIndex }
Note over Indexing: Placeholder stub (throws on construction)
Indexing-->>Barrel: CspIndex class reference
Barrel->>Types: export { ContentType } (value)
Barrel->>Types: export type { Chunk, SearchResult, IndexStats, EmbeddingMatrix }
Note over Types: Placeholder stubs with const-object enum
Types-->>Barrel: ContentType runtime object + type aliases
Barrel->>Version: export { version }
Note over Version: '0.0.0' literal
Version-->>Barrel: version string
Barrel-->>Consumer: Resolved imports (types at compile-time, values at runtime)
Note over Consumer: Runtime Usage (verified by smoke tests)
Consumer->>Consumer: typeof csp.version === 'string' && length > 0
Consumer->>Consumer: typeof csp.CspIndex === 'function'
Consumer->>Consumer: csp.ContentType.Code === 'code'
Consumer->>Consumer: csp.ContentType.Docs === 'docs'
Consumer->>Consumer: csp.ContentType.Config === 'config'
Note over Test: Smoke tests lock down exported surface
Test->>Barrel: import * as csp
Barrel-->>Test: Module namespace object
Test->>Test: Object.keys(csp) includes CspIndex, ContentType, version
Test->>Test: version is non-empty string
Test->>Test: CspIndex is function
Test->>Test: ContentType enum values match contract
amondnet
commented
May 28, 2026
amondnet
left a comment
Contributor
Author
There was a problem hiding this comment.
Reviewed both bot reviews; no actionable line comments. The stub modules are intentional placeholders pending Unit 12/Unit 1 PRs.
Port of `src/semble/__init__.py` and `src/semble/version.py`.
The barrel stitches the documented public surface:
- `CspIndex` (from `./indexing/index.ts`, owned by Unit 12)
- `Chunk`, `SearchResult`, `IndexStats`, `EmbeddingMatrix`
(types from `./types.ts`, owned by Unit 1)
- `ContentType` (re-exported as a *value* so the runtime enum object
survives `verbatimModuleSyntax` — `export type {}` would erase it)
- `version` (from `./version.ts`, currently mirrors `package.json#version`)
Includes `// TODO` placeholder stubs for Unit 1 (`src/types.ts`) and
Unit 12 (`src/indexing/index.ts`) so the barrel type-checks and
`src/index.test.ts` runs in isolation. Both placeholders are clearly
marked and will be overwritten when the owning unit lands.
Co-authored-by: Minsu Lee <minsu.lee@dietfriends.kr>
b61f7bd to
9e56611
Compare
This was referenced Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Unit 16 — port of
src/semble/__init__.pyandsrc/semble/version.py.Stitches the documented public surface of
@pleaseai/csp:What's in the barrel
CspIndex(value) — re-exported from./indexing/index.ts(Unit 12)Chunk,SearchResult,IndexStats,EmbeddingMatrix(types) — from./types.ts(Unit 1)ContentType(value + type) — re-exported withexport { }(notexport type { }) so the runtime enum object survivesverbatimModuleSyntax— listing it underexport typewould erase the runtime sideversion— from./version.ts, currently'0.0.0'to matchpackage.json#versionPlaceholder stubs for sibling units
Per the unit instructions, this PR adds
// TODOplaceholder modules so the barrel type-checks andsrc/index.test.tscan run standalone:src/types.ts— minimal stub mirroring Unit 1'sContentTypeconst-object enum +Chunk/SearchResult/IndexStats/EmbeddingMatrixshapessrc/indexing/index.ts— placeholderCspIndexclass that throws eagerly to surface sequencing bugsBoth files are clearly marked with
TODO(unit-1)/TODO(unit-12)comments and will be overwritten when those units land.Tests
Smoke tests verify:
csp.versionis a non-empty stringcsp.CspIndexis afunction(coversclassor factory style)csp.ContentType.Code === 'code'etc. — the lowercase string values are part of the on-disk / CLI contract with sembleNotes for reviewers
feat/unit-1-types) and Unit 12 (CspIndex implementation) land — the stubs are interface-compatible with the real ports.package.jsonis intentionally untouched per unit instructions.Source of truth
semble/__init__.pysemble/version.pySummary by cubic
Adds a public barrel for
@pleaseai/cspthat re-exportsCspIndex,ContentType, core types, andversionto match the documented API. Includes minimal stubs and smoke tests so the surface is stable until Units 1 and 12 land.CspIndexfrom./indexing/index.tsandContentType(as a value) plusChunk,SearchResult,IndexStats,EmbeddingMatrixfrom./types.ts.versionfrom./version.ts(0.0.0, mirroringpackage.json).ContentTyperuntime values, andversionshape.Written for commit 9e56611. Summary will update on new commits.