Skip to content

Make scripts a workspace package so CI runs its tests - #306

Open
joei4cm wants to merge 3 commits into
CopilotKit:mainfrom
joei4cm:fix/267-scripts-workspace
Open

joei4cm wants to merge 3 commits into
CopilotKit:mainfrom
joei4cm:fix/267-scripts-workspace

Conversation

@joei4cm

@joei4cm joei4cm commented Dec 1, 2026 •

Copy link
Copy Markdown

What changed

  • Add scripts/ as a pnpm workspace package with its own Vitest and TypeScript tasks so Turbo and CI run the scripts tests and typecheck.
  • Declare the scripts' runtime and development dependencies in the package and update the lockfile.
  • Typecheck the scripts' tests and use generated Prisma delegate types instead of unsafe structural casts.
  • Import Linear mappings through the Outpost workspace package. A source export keeps the documented tsx command usable from a fresh checkout before shared/dist has been built.
  • Leave the shadow-mode behavior from Treat an unclear SHADOW_MODE as on, instead of posting for real #233 unchanged.

Rebased on main after #327

#327 removed the one-off migration and cutover tooling, including scripts/migrate-from-orca.ts. This branch is rebased onto that main, so the fixes that only applied to the deleted Orca migration script are gone with it. The workspace package itself is unchanged: scripts/ now holds create-admin.ts and import-linear.ts, and the Vitest config moved to scripts/vitest.config.ts.

Validation

  • pnpm turbo run typecheck --filter=@copilotkit/outpost-scripts — passed.
  • pnpm --filter @copilotkit/outpost-scripts test — 2 files, 12 tests passed.
  • npx prettier --check on the changed files — passed.
  • git diff --check — passed.

Refs #267

🤖 Generated with Claude Code

@NathanTarbert

Copy link
Copy Markdown
Collaborator

Thanks @joei4cm, this is a really tidy piece of work. Swapping the structural casts for the generated Prisma delegate types makes import-linear.ts much easier to read, and keeping the documented tsx command working from a fresh checkout was a thoughtful touch.

There are two things I'd like to ask for before we merge.

The scripts tests now have two configs. The root vitest.config.ts still includes scripts/__tests__/**/*.test.ts, and the new scripts/vitest.config.ts covers the same files. If someone later adds setup files or an environment to one of them, the same tests will behave differently depending on where they're run from. Could you remove the scripts include from the root config, or the root file entirely if nothing else uses it? The root package.json also still lists @linear/sdk and tsx, which were only there for the scripts. Now that scripts/package.json declares them, could you drop them from the root as well?

The second is the new ./shared/source export in packages/outpost/package.json. It points at the raw .ts source, so it only works under tsx or vitest. Any package in the workspace can import it, though. An app that did would typecheck and build fine, then crash at startup under plain node. It also loads all of shared, including bcrypt, Octokit and the integrations, when the importer only needs the three Linear mapping helpers from sync. Could you narrow it to a ./shared/source/sync subpath pointing at shared/src/sync/index.ts, and add a short comment at the import in import-linear.ts saying the subpath is only for tsx and vitest?

A few older things in the importer came up while reading through it. None of them were introduced here, so I've put them in #307 rather than asking for them in this PR.

@joei4cm

joei4cm commented Dec 2, 2026

Copy link
Copy Markdown
Author

Addressed both requests in f3f0998: removed the redundant root vitest.config.ts and root-only @linear/sdk/tsx devDependencies, and narrowed the source export to ./shared/source/sync with an import comment noting it is only for tsx/vitest. Validation: scripts Vitest 64/64 passed, scripts typecheck passed after building @copilotkit/outpost, Prettier and git diff --check passed.

@NathanTarbert

Copy link
Copy Markdown
Collaborator

Thanks @joei4cm, this looks good. The single vitest config and the narrowed subpath are exactly what I had in mind, and it's great to have the scripts tests running in CI.

There's one thing I'd like to ask for, and it comes from my own earlier request. With tsx gone from the root package.json, running npx tsx scripts/... from the repo root no longer finds a local copy. That's the command in scripts/cutover/README.md and in the usage text of both scripts, so npx will now fetch an unpinned tsx or fail. Could you add tsx back to the root devDependencies? @linear/sdk can stay where it is in scripts/package.json.

@joei4cm

joei4cm commented Dec 3, 2026

Copy link
Copy Markdown
Author

Done in 07de27c: tsx is back in the root devDependencies at the same ^4.21.0 range scripts/package.json uses, so npx tsx scripts/... from the repo root resolves a pinned local copy again. @linear/sdk stays in scripts/package.json. The lockfile diff is just the importer entry (two unrelated deprecated annotations the newer pnpm added were left out).

@NathanTarbert

Copy link
Copy Markdown
Collaborator

Thanks @joei4cm, that's exactly it. With tsx pinned at the root again, the documented npx tsx scripts/... commands resolve a local copy, and the lockfile change stays nice and small.

This is ready from my side. We'll merge once CI has run. Thanks for your continued work on this, it's great to have the scripts tests running in CI now.

joei4cm and others added 3 commits December 4, 2026 01:31
Co-Authored-By: Claude Code <noreply@anthropic.com>
Remove the redundant root vitest config and root-only script dependencies. Limit the source export to the sync subpath and document that it is only for tsx and vitest.

Co-Authored-By: Claude Code <noreply@anthropic.com>
npx tsx scripts/... from the repo root is the documented way to run the
import and cutover scripts (scripts/cutover/README.md and both scripts'
usage text), and with tsx only in scripts/package.json npx no longer
finds a local copy there — it fetches an unpinned version or fails.
@linear/sdk stays in scripts/package.json.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@joei4cm
joei4cm force-pushed the fix/267-scripts-workspace branch from 07de27c to 3993a52 Compare December 3, 2026 17:36
@joei4cm

joei4cm commented Dec 3, 2026

Copy link
Copy Markdown
Author

Rebased onto main after #327 (the Orca migration and cutover tooling removal). The workspace package is unchanged; the fixes that only applied to the deleted scripts/migrate-from-orca.ts went with it. Prettier, the scripts test suite (2 files, 12 tests) and the scripts typecheck all pass on the rebased branch.

This branch has not been deployed

No deployments
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.

2 participants