Skip to content

feat: add project boundary support to tspconfig.yaml#10242

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/design-tspconfig-project-structure
Draft

feat: add project boundary support to tspconfig.yaml#10242
Copilot wants to merge 4 commits intomainfrom
copilot/design-tspconfig-project-structure

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 1, 2026

Today tspconfig.yaml is purely build config — no project identity, no explicit entrypoint, no project-scoped settings. This implements Phase 1 of the project tspconfig design: project boundary marker and entrypoint resolution.

Usage

# Shorthand — defaults to main.tsp
project: true
emit:
  - "@typespec/openapi3"

# Explicit entrypoint
project:
  entrypoint: src/service.tsp
emit:
  - "@typespec/openapi3"

Changes

  • Types (config/types.ts): Added TypeSpecProjectConfig, TypeSpecRawProjectConfig, and project field on both raw and normalized config interfaces
  • Schema (config-schema.ts): project validates as true | { entrypoint?: string } via oneOf
  • Config loader (config-loader.ts): resolveProjectConfig() normalizes raw project config, resolving entrypoint to an absolute path relative to config directory (default: main.tsp)
  • CLI entrypoint resolution (entrypoint-resolution.ts): resolveTypeSpecEntrypointForDir checks project tspconfig before package.json tspMain and main.tsp fallback
  • IDE entrypoint resolver (entrypoint-resolver.ts): At each directory in the walk-up, project tspconfig is checked first. If found, the walk stops — entrypoint is definitively resolved
  • Tests: Config loading (shorthand, explicit entrypoint, nested projects, backward compat), schema validation, IDE resolver priority semantics, completion items updated

Backward compatibility

Existing tspconfig.yaml files without project continue to work identically. The project check is additive — only configs with project participate in the new resolution path.

Note: tsp init does not automatically add project: true to scaffolded configs, since the published compiler version would reject the unknown field. Users can manually opt-in by adding project: true to their tspconfig.yaml.

Copilot AI linked an issue Apr 1, 2026 that may be closed by this pull request
Add `project` field to tspconfig.yaml that marks a config as a project
boundary. When present, the directory containing the file becomes the
project root with an explicit entrypoint declaration.

Changes:
- Add TypeSpecProjectConfig and TypeSpecRawProjectConfig types
- Add project field to TypeSpecRawConfig and TypeSpecConfig
- Add project property to JSON schema validation
- Update config loader to parse and normalize project settings
- Update CLI entrypoint resolution to check project tspconfig first
- Update IDE entrypoint resolver to check project tspconfig first
- Update tsp init scaffold to include project: true for non-library templates
- Add comprehensive tests for all new functionality

Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/52b4adb2-a8c8-4e7c-b9a6-8a3fcfdb2fb6

Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service bot added the compiler:core Issues for @typespec/compiler label Apr 1, 2026
Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/52b4adb2-a8c8-4e7c-b9a6-8a3fcfdb2fb6

Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Copilot AI changed the title [WIP] Update tspconfig.yaml to define project boundaries feat: add project boundary support to tspconfig.yaml Apr 1, 2026
Copilot AI requested a review from timotheeguerin April 1, 2026 21:04
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 1, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/compiler@10242

commit: aaca4b1

@timotheeguerin
Copy link
Copy Markdown
Member

@copilot e2e test are failing, make sure the pnpm and test also pass

The scaffolded tspconfig.yaml with project: true was rejected by the
published compiler version used in e2e tests (which doesn't know about
the new field). Remove the automatic addition from scaffold since users
can manually opt-in to project: true once the feature is released.

Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/e47a1ecd-c8a3-4d1f-af77-277a4b10ea04

Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 1, 2026

@copilot e2e test are failing, make sure the pnpm and test also pass

Fixed in 7dac40b. The e2e validate rest template test was failing because the scaffold was adding project: true to generated tspconfig.yaml, but the e2e test uses the published compiler version (via npx tsp compile .) which doesn't know about the project field and rejects it with additionalProperties: false. Removed the automatic scaffold addition — users can manually add project: true once the feature is released. All e2e tests (32/32) and unit tests (3830) now pass.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/bin/astro.mjs build sh -c tput-dir ../../w--llmstxt sh ules/.bin/node import @typespecnode systemd-run nfig/composer/vegenerate-scenarios-summary sh pec/�� rs &amp;&amp; pnpm build:src sh /node_modules/.bin/sh --no-emit bash .2/node_modules/doc sh (dns block)
  • update.code.visualstudio.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/packages/typespec-vscode/node_modules/.bin/../@vscode/test-web/out/server/index.js --quality stable --extensionDevelopmentPath=. --headless --extensionTestsPath=dist/test/web/suite.js ./test/web/data / --report-unusenode node /.bin/node pnpm olde�� on k/typespec/types@typespec/library-linter piler/node_modul--no-emit rts.ts node pnpm/dist/node-gformat pnpm (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/packages/typespec-vscode/node_modules/.bin/../vitest/vitest.mjs run --root test/extension on k/typespec/typespec/temp/artifacts /.bin/node ite pec/node_modules-c /.bin/node pnpm pile�� --no-emit on /.bin/npm tsc &amp;&amp; npm run bnode pnpm yp-bin/pnpm pnpm (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

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

Labels

compiler:core Issues for @typespec/compiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tspconfig.yaml project

2 participants