Skip to content

feat(session-contract): scaffold @codespar/session-contract package #2

Description

@dangazineu

Goal

Create the package skeleton for @codespar/session-contract inside codespar-core/packages/session-contract/. No logic yet — just the scaffold so the workspace resolves the package and turbo includes it in the build pipeline. Subsequent issues add types, the type guard, and the contract test suite.

Context

The codespar runtime needs a shared session interface contract that both the core runtime and any downstream consumers can import without circular dependencies. This package will be the single source of truth for that contract. It's MIT-licensed, ships as an ES module, and will eventually export the Session interface, a isSession type guard, and a portable contract test suite under the ./testing export condition.

This issue covers only the scaffold: package.json, tsconfig.json, a stub src/index.ts, and wiring into the workspace and turbo pipeline. The package must build cleanly and appear in turbo's task graph before any downstream packages can depend on it.

Acceptance Criteria

  • packages/session-contract/package.json exists with name: "@codespar/session-contract", version: "0.1.0", and the exports map as specified below
  • packages/session-contract/tsconfig.json extends ../../tsconfig.base.json and points outDir to ./dist, rootDir to ./src
  • packages/session-contract/src/index.ts exists with a stub export {}
  • pnpm-workspace.yaml (or equivalent workspace manifest) includes packages/session-contract/ — if it uses a glob like packages/* this is automatic; verify with pnpm ls
  • turbo.json includes @codespar/session-contract in any explicit package lists; if turbo autodiscovers from the workspace manifest no change is needed — verify with turbo run build --filter=@codespar/session-contract (should succeed with no tasks if nothing depends on it yet, or build the stub cleanly)
  • pnpm run build --filter=@codespar/session-contract exits 0
  • pnpm run typecheck --filter=@codespar/session-contract exits 0
  • No other packages are modified as part of this issue

Required file contents

packages/session-contract/package.json

{
"name": "@codespar/session-contract",
"version": "0.1.0",
"description": "Shared session interface contract for codespar runtimes",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./testing": {
"development": {
"import": "./dist/testing/contract-suite.js",
"types": "./dist/testing/contract-suite.d.ts"
}
}
},
"scripts": {
"build": "tsc",
"typecheck": "tsc --noEmit"
},
"dependencies": {},
"devDependencies": {
"typescript": "workspace:*",
"vitest": "workspace:*"
},
"license": "MIT"
}

packages/session-contract/tsconfig.json

{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["src"]
}

packages/session-contract/src/index.ts

// Types and type guard exported in Phase 2
export {};

Dependencies

None. This is the first issue in the milestone and has no blockers.

Downstream Dependencies

All three are blocked until this scaffold exists and builds cleanly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    f4-m1Feature 4, Milestone 1: Shared Session Contract Packagevalidation:simpleSimple validation: tests pass, CI green

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions