Skip to content

refactor: group the definitions package by domain - #139

Merged
nclsndr merged 1 commit into
mainfrom
refactor/definitions-dirs
Dec 3, 2026
Merged

nclsndr merged 1 commit into
mainfrom
refactor/definitions-dirs

Conversation

@nclsndr

@nclsndr nclsndr commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Why

packages/definitions/src held every contract in one flat folder of 35 files. File name prefixes were the only sign of a domain, and some files mixed two: the types every extension host shares were in the docs host, and one file held script declarations, runs, history and type files. Follow-up of #130, after #137 and #138.

What

The package now has one folder per domain. This is structure only: moves, splits along domain lines and import updates. No CLI behaviour, output or schema changes.

  • command holds the command builder. Write reach, help rows and the invocation issue leave command.ts, which is now command/spec.ts. booleanFlag and previewApply join the other grammar parts.
  • extension holds the extension list, manifests, state slices, slots, the extension host and the view kit. The extension IDs and the state slices are now files of their own. HostError and StateHandle, which both hosts use, leave the docs host.
  • docs and scripts hold each extension's commands, host and payloads. The script payloads split into declaration, run, history and type files. The docs search and settings payloads have their own files.
  • profiles holds each extension's part of a profile.
  • sources holds the source root rules and SourceResource.
  • shared holds names and IDs, ordering, hashing and the published package name.

The two entry points, @tackup/definitions and @tackup/definitions/source-edges, stay. They export the same names as before.

The import cycles between the extension list, the slots and the docs host are gone: no file of the package imports itself through another. The docs and extension folders still import each other, because the closed extension list names the docs slice and specs.

The boundary test of the package now accepts an import of a sibling folder, and still refuses any import that leaves the package. The package README, two skills and the build scripts name the new paths.

Before:

packages/definitions/src
├── command.ts                  command.test.ts
├── command-line.ts
├── docs-commands.ts
├── docs-host.ts
├── docs-payloads.ts            docs-payloads.test.ts
├── docs-settings.ts
├── docs-slice.ts               docs-slice.test.ts
├── doctor-checks.ts
├── extension-folders.ts
├── extension-host.ts
├── extension-implementation.ts
├── extension-specs.ts
├── extensions.ts
├── failure.ts
├── grammar.ts
├── identity.ts
├── implementation.ts
├── index.ts
├── profile-parts.ts            profile-parts.test.ts
├── published-name.ts
├── reader-engine.ts
├── review.ts
├── scripts-commands.ts
├── scripts-host.ts
├── scripts-payloads.ts         scripts-payloads.test.ts
├── sha256.ts
├── slots.ts
├── source-edges.ts
├── sync-flags.ts
└── view-kit.ts

After:

packages/definitions/src
├── index.ts
├── command
│   ├── command-line.ts
│   ├── failure.ts
│   ├── grammar.ts
│   ├── help.ts
│   ├── implementation.ts
│   ├── invocation-issue.ts
│   ├── spec.ts                 spec.test.ts
│   └── write-reach.ts
├── docs
│   ├── commands.ts
│   ├── host.ts
│   ├── payloads.ts
│   ├── reader-engine.ts
│   ├── review.ts
│   ├── search.ts
│   ├── settings.ts             settings.test.ts
│   └── slice.ts                slice.test.ts
├── extension
│   ├── doctor-checks.ts
│   ├── failure.ts
│   ├── folders.ts
│   ├── host.ts
│   ├── ids.ts
│   ├── implementation.ts
│   ├── manifests.ts
│   ├── slices.ts
│   ├── slots.ts
│   ├── specs.ts
│   ├── sync-flags.ts
│   └── view-kit.ts
├── profiles
│   └── parts.ts                parts.test.ts
├── scripts
│   ├── commands.ts
│   ├── declaration.ts
│   ├── history.ts              history.test.ts
│   ├── host.ts
│   ├── run.ts                  run.test.ts
│   └── types-file.ts
├── shared
│   ├── identity.ts
│   ├── ordering.ts
│   ├── published-name.ts
│   └── sha256.ts
└── sources
    ├── edges.ts
    └── resource.ts

Related to

Follows #130.

Cleanups seen and left out of this change:

  • command/grammar.ts links selectorFrom in a comment, and the package has no such function.
  • docs/reader-engine.ts declares its own, looser DocsResourceReferenceSchema beside the one of docs/slice.ts.
  • docs/settings.ts and docs/slice.ts each build the key of a docs resource and check that attachments are unique.
  • extension/doctor-checks.ts holds general text helpers, plural and sorted, beside skippedCheck.

Checks

  • Every line of the package outside import and re-export statements is unchanged, as a multiset of lines.
  • The 215 names @tackup/definitions exports are the same before and after.
  • The unit tests pass, and the uncovered counts stay under the budget, which is unchanged.

AI assisted

One folder per domain: command, docs, extension, profiles, scripts, sources and shared. Moves, splits along domain lines and import updates only; both entry points export the same names.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying tack-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: c619caf
Status: ✅  Deploy successful!
Preview URL: https://a9e6f186.tack-ayg.pages.dev
Branch Preview URL: https://refactor-definitions-dirs.tack-ayg.pages.dev

View logs

@nclsndr
nclsndr merged commit 2cc0baa into main Dec 3, 2026
9 checks passed
@nclsndr
nclsndr deleted the refactor/definitions-dirs branch December 3, 2026 14:39
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