From eba5f6c4a7cf4d769c08f9834541bccd00fd9b37 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 19 Aug 2026 06:21:57 +0000 Subject: [PATCH 1/5] refactor: move C# SDK to src/, codegen tooling to codegen/, dedupe README Restructure the repository layout so the generated C# package lives at the repository root instead of a nested output/ tree, and consolidate the TypeScript codegen tooling. - Generate and keep the C# library at src/Seam and tests at src/Seam.Test (previously output/csharp/src/Seam and .../Seam.Test); move the solution file to the repository root as Seam.sln. - Point the codegen output root (codegen/lib/csharp.ts) at src/Seam. - Move the codegen-support scripts (generate-csproj.ts, postgenerate.ts, version.ts) from src/ into codegen/, where the rest of the codegen lives. - Stop maintaining a duplicate package README: pack the root README.md directly via the csproj instead of a hand-synced copy under the package. - Update all path references: justfile, setup action, automerge workflow, .gitattributes, package.json scripts, README, and codegen comments. - Drop the redundant output/csharp/.gitignore (root .gitignore ignores bin/ and obj/) and remove the now-empty output/ tree. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01BYTZ1b713smMtpQ5UHrrbt --- .gitattributes | 10 +- .github/actions/setup/action.yml | 2 +- .github/workflows/automerge.yml | 4 +- README.md | 4 +- output/csharp/csharp-testing.sln => Seam.sln | 0 {src => codegen}/generate-csproj.ts | 4 +- codegen/lib/class-model.ts | 4 +- codegen/lib/csharp.ts | 6 +- {src => codegen}/postgenerate.ts | 4 +- {src => codegen}/version.ts | 4 +- justfile | 8 +- output/csharp/.gitignore | 2 - output/csharp/src/Seam/README.md | 124 ------------------ package.json | 6 +- .../Seam.Test/Client/ApiResponseTests.cs | 0 .../src => src}/Seam.Test/Client/NullTests.cs | 0 .../Seam.Test/Client/RequestTransportTests.cs | 0 .../src => src}/Seam.Test/Client/SeamTests.cs | 0 .../StrictUrlSearchParamsSerializerTests.cs | 0 .../Seam.Test/Client/TimeoutTests.cs | 0 .../Client/UrlSearchParamsSerializerTests.cs | 0 .../Seam.Test/Client/UrlSearchParamsTests.cs | 0 .../src => src}/Seam.Test/GlobalUsings.cs | 0 .../src => src}/Seam.Test/Seam.Test.csproj | 0 .../src => src}/Seam/Api/AccessCodes.cs | 0 .../src => src}/Seam/Api/AccessGrants.cs | 0 .../src => src}/Seam/Api/AccessGroupsAcs.cs | 0 .../src => src}/Seam/Api/AccessMethods.cs | 0 .../src => src}/Seam/Api/ActionAttempts.cs | 0 .../src => src}/Seam/Api/ClientSessions.cs | 0 .../src => src}/Seam/Api/ConnectWebviews.cs | 0 .../src => src}/Seam/Api/ConnectedAccounts.cs | 0 .../src => src}/Seam/Api/CredentialsAcs.cs | 0 .../csharp/src => src}/Seam/Api/Customers.cs | 0 .../Seam/Api/DailyProgramsThermostats.cs | 0 .../csharp/src => src}/Seam/Api/Devices.cs | 0 .../src => src}/Seam/Api/EncodersAcs.cs | 0 .../src => src}/Seam/Api/EntrancesAcs.cs | 0 {output/csharp/src => src}/Seam/Api/Events.cs | 0 .../src => src}/Seam/Api/InstantKeys.cs | 0 {output/csharp/src => src}/Seam/Api/Locks.cs | 0 .../src => src}/Seam/Api/NoiseSensors.cs | 0 .../Seam/Api/NoiseThresholdsNoiseSensors.cs | 0 {output/csharp/src => src}/Seam/Api/Phones.cs | 0 .../Seam/Api/SchedulesThermostats.cs | 0 .../Seam/Api/SimulateAccessCodes.cs | 0 .../Seam/Api/SimulateConnectedAccounts.cs | 0 .../src => src}/Seam/Api/SimulateDevices.cs | 0 .../Seam/Api/SimulateEncodersAcs.cs | 0 .../src => src}/Seam/Api/SimulateLocks.cs | 0 .../Seam/Api/SimulateNoiseSensors.cs | 0 .../src => src}/Seam/Api/SimulatePhones.cs | 0 .../Seam/Api/SimulateThermostats.cs | 0 {output/csharp/src => src}/Seam/Api/Spaces.cs | 0 .../csharp/src => src}/Seam/Api/SystemsAcs.cs | 0 .../src => src}/Seam/Api/Thermostats.cs | 0 .../Seam/Api/UnmanagedAccessCodes.cs | 0 .../Seam/Api/UnmanagedAccessGrants.cs | 0 .../Seam/Api/UnmanagedAccessMethods.cs | 0 .../src => src}/Seam/Api/UnmanagedDevices.cs | 0 .../Seam/Api/UnmanagedUserIdentities.cs | 0 .../src => src}/Seam/Api/UserIdentities.cs | 0 .../csharp/src => src}/Seam/Api/UsersAcs.cs | 0 .../csharp/src => src}/Seam/Api/Webhooks.cs | 0 .../csharp/src => src}/Seam/Api/Workspaces.cs | 0 .../src => src}/Seam/Client/ApiResponse.cs | 0 .../src => src}/Seam/Client/ClientUtils.cs | 0 .../Seam/Client/ExceptionFactory.cs | 0 .../Client/GlobalSeamRequestConfiguration.cs | 0 .../src => src}/Seam/Client/HttpMethod.cs | 0 .../Seam/Client/IAsynchronousSeam.cs | 0 .../IReadableSeamRequestConfiguration.cs | 0 .../Seam/Client/ISynchronousSeam.cs | 0 .../src => src}/Seam/Client/Multimap.cs | 0 .../csharp/src => src}/Seam/Client/Null.cs | 0 .../src => src}/Seam/Client/RequestOptions.cs | 0 .../Seam/Client/RetryConfiguration.cs | 0 .../csharp/src => src}/Seam/Client/Seam.cs | 0 .../src => src}/Seam/Client/SeamException.cs | 0 .../Seam/Client/SeamRequestConfiguration.cs | 0 .../Client/StrictUrlSearchParamsSerializer.cs | 0 .../Seam/Client/UnserializableParamError.cs | 0 .../Seam/Client/UrlSearchParams.cs | 0 .../Seam/Client/UrlSearchParamsSerializer.cs | 0 .../src => src}/Seam/Model/AccessCode.cs | 0 .../src => src}/Seam/Model/AccessGrant.cs | 0 .../src => src}/Seam/Model/AccessMethod.cs | 0 .../src => src}/Seam/Model/AcsAccessGroup.cs | 0 .../src => src}/Seam/Model/AcsCredential.cs | 0 .../src => src}/Seam/Model/AcsEncoder.cs | 0 .../src => src}/Seam/Model/AcsEntrance.cs | 0 .../src => src}/Seam/Model/AcsSystem.cs | 0 .../csharp/src => src}/Seam/Model/AcsUser.cs | 0 .../src => src}/Seam/Model/ActionAttempt.cs | 0 .../Seam/Model/AsbtractModelSchema.cs | 0 .../csharp/src => src}/Seam/Model/Batch.cs | 0 .../src => src}/Seam/Model/ClientSession.cs | 0 .../src => src}/Seam/Model/ConnectWebview.cs | 0 .../Seam/Model/ConnectedAccount.cs | 0 .../src => src}/Seam/Model/CustomerPortal.cs | 0 .../csharp/src => src}/Seam/Model/Device.cs | 0 .../src => src}/Seam/Model/DeviceProvider.cs | 0 .../csharp/src => src}/Seam/Model/Event.cs | 0 .../src => src}/Seam/Model/InstantKey.cs | 0 .../src => src}/Seam/Model/NoiseThreshold.cs | 0 .../csharp/src => src}/Seam/Model/Phone.cs | 0 .../Seam/Model/SafeStringEnumConverter.cs | 0 .../csharp/src => src}/Seam/Model/Space.cs | 0 .../Seam/Model/ThermostatDailyProgram.cs | 0 .../Seam/Model/ThermostatSchedule.cs | 0 .../Seam/Model/UnmanagedAccessCode.cs | 0 .../Seam/Model/UnmanagedAccessGrant.cs | 0 .../Seam/Model/UnmanagedAccessMethod.cs | 0 .../src => src}/Seam/Model/UnmanagedDevice.cs | 0 .../Seam/Model/UnmanagedUserIdentity.cs | 0 .../src => src}/Seam/Model/UserIdentity.cs | 0 .../csharp/src => src}/Seam/Model/Webhook.cs | 0 .../src => src}/Seam/Model/Workspace.cs | 0 {output/csharp/src => src}/Seam/Seam.csproj | 2 +- {output/csharp/src => src}/Seam/icon.png | Bin 120 files changed, 29 insertions(+), 155 deletions(-) rename output/csharp/csharp-testing.sln => Seam.sln (100%) rename {src => codegen}/generate-csproj.ts (93%) rename {src => codegen}/postgenerate.ts (53%) rename {src => codegen}/version.ts (89%) delete mode 100644 output/csharp/.gitignore delete mode 100644 output/csharp/src/Seam/README.md rename {output/csharp/src => src}/Seam.Test/Client/ApiResponseTests.cs (100%) rename {output/csharp/src => src}/Seam.Test/Client/NullTests.cs (100%) rename {output/csharp/src => src}/Seam.Test/Client/RequestTransportTests.cs (100%) rename {output/csharp/src => src}/Seam.Test/Client/SeamTests.cs (100%) rename {output/csharp/src => src}/Seam.Test/Client/StrictUrlSearchParamsSerializerTests.cs (100%) rename {output/csharp/src => src}/Seam.Test/Client/TimeoutTests.cs (100%) rename {output/csharp/src => src}/Seam.Test/Client/UrlSearchParamsSerializerTests.cs (100%) rename {output/csharp/src => src}/Seam.Test/Client/UrlSearchParamsTests.cs (100%) rename {output/csharp/src => src}/Seam.Test/GlobalUsings.cs (100%) rename {output/csharp/src => src}/Seam.Test/Seam.Test.csproj (100%) rename {output/csharp/src => src}/Seam/Api/AccessCodes.cs (100%) rename {output/csharp/src => src}/Seam/Api/AccessGrants.cs (100%) rename {output/csharp/src => src}/Seam/Api/AccessGroupsAcs.cs (100%) rename {output/csharp/src => src}/Seam/Api/AccessMethods.cs (100%) rename {output/csharp/src => src}/Seam/Api/ActionAttempts.cs (100%) rename {output/csharp/src => src}/Seam/Api/ClientSessions.cs (100%) rename {output/csharp/src => src}/Seam/Api/ConnectWebviews.cs (100%) rename {output/csharp/src => src}/Seam/Api/ConnectedAccounts.cs (100%) rename {output/csharp/src => src}/Seam/Api/CredentialsAcs.cs (100%) rename {output/csharp/src => src}/Seam/Api/Customers.cs (100%) rename {output/csharp/src => src}/Seam/Api/DailyProgramsThermostats.cs (100%) rename {output/csharp/src => src}/Seam/Api/Devices.cs (100%) rename {output/csharp/src => src}/Seam/Api/EncodersAcs.cs (100%) rename {output/csharp/src => src}/Seam/Api/EntrancesAcs.cs (100%) rename {output/csharp/src => src}/Seam/Api/Events.cs (100%) rename {output/csharp/src => src}/Seam/Api/InstantKeys.cs (100%) rename {output/csharp/src => src}/Seam/Api/Locks.cs (100%) rename {output/csharp/src => src}/Seam/Api/NoiseSensors.cs (100%) rename {output/csharp/src => src}/Seam/Api/NoiseThresholdsNoiseSensors.cs (100%) rename {output/csharp/src => src}/Seam/Api/Phones.cs (100%) rename {output/csharp/src => src}/Seam/Api/SchedulesThermostats.cs (100%) rename {output/csharp/src => src}/Seam/Api/SimulateAccessCodes.cs (100%) rename {output/csharp/src => src}/Seam/Api/SimulateConnectedAccounts.cs (100%) rename {output/csharp/src => src}/Seam/Api/SimulateDevices.cs (100%) rename {output/csharp/src => src}/Seam/Api/SimulateEncodersAcs.cs (100%) rename {output/csharp/src => src}/Seam/Api/SimulateLocks.cs (100%) rename {output/csharp/src => src}/Seam/Api/SimulateNoiseSensors.cs (100%) rename {output/csharp/src => src}/Seam/Api/SimulatePhones.cs (100%) rename {output/csharp/src => src}/Seam/Api/SimulateThermostats.cs (100%) rename {output/csharp/src => src}/Seam/Api/Spaces.cs (100%) rename {output/csharp/src => src}/Seam/Api/SystemsAcs.cs (100%) rename {output/csharp/src => src}/Seam/Api/Thermostats.cs (100%) rename {output/csharp/src => src}/Seam/Api/UnmanagedAccessCodes.cs (100%) rename {output/csharp/src => src}/Seam/Api/UnmanagedAccessGrants.cs (100%) rename {output/csharp/src => src}/Seam/Api/UnmanagedAccessMethods.cs (100%) rename {output/csharp/src => src}/Seam/Api/UnmanagedDevices.cs (100%) rename {output/csharp/src => src}/Seam/Api/UnmanagedUserIdentities.cs (100%) rename {output/csharp/src => src}/Seam/Api/UserIdentities.cs (100%) rename {output/csharp/src => src}/Seam/Api/UsersAcs.cs (100%) rename {output/csharp/src => src}/Seam/Api/Webhooks.cs (100%) rename {output/csharp/src => src}/Seam/Api/Workspaces.cs (100%) rename {output/csharp/src => src}/Seam/Client/ApiResponse.cs (100%) rename {output/csharp/src => src}/Seam/Client/ClientUtils.cs (100%) rename {output/csharp/src => src}/Seam/Client/ExceptionFactory.cs (100%) rename {output/csharp/src => src}/Seam/Client/GlobalSeamRequestConfiguration.cs (100%) rename {output/csharp/src => src}/Seam/Client/HttpMethod.cs (100%) rename {output/csharp/src => src}/Seam/Client/IAsynchronousSeam.cs (100%) rename {output/csharp/src => src}/Seam/Client/IReadableSeamRequestConfiguration.cs (100%) rename {output/csharp/src => src}/Seam/Client/ISynchronousSeam.cs (100%) rename {output/csharp/src => src}/Seam/Client/Multimap.cs (100%) rename {output/csharp/src => src}/Seam/Client/Null.cs (100%) rename {output/csharp/src => src}/Seam/Client/RequestOptions.cs (100%) rename {output/csharp/src => src}/Seam/Client/RetryConfiguration.cs (100%) rename {output/csharp/src => src}/Seam/Client/Seam.cs (100%) rename {output/csharp/src => src}/Seam/Client/SeamException.cs (100%) rename {output/csharp/src => src}/Seam/Client/SeamRequestConfiguration.cs (100%) rename {output/csharp/src => src}/Seam/Client/StrictUrlSearchParamsSerializer.cs (100%) rename {output/csharp/src => src}/Seam/Client/UnserializableParamError.cs (100%) rename {output/csharp/src => src}/Seam/Client/UrlSearchParams.cs (100%) rename {output/csharp/src => src}/Seam/Client/UrlSearchParamsSerializer.cs (100%) rename {output/csharp/src => src}/Seam/Model/AccessCode.cs (100%) rename {output/csharp/src => src}/Seam/Model/AccessGrant.cs (100%) rename {output/csharp/src => src}/Seam/Model/AccessMethod.cs (100%) rename {output/csharp/src => src}/Seam/Model/AcsAccessGroup.cs (100%) rename {output/csharp/src => src}/Seam/Model/AcsCredential.cs (100%) rename {output/csharp/src => src}/Seam/Model/AcsEncoder.cs (100%) rename {output/csharp/src => src}/Seam/Model/AcsEntrance.cs (100%) rename {output/csharp/src => src}/Seam/Model/AcsSystem.cs (100%) rename {output/csharp/src => src}/Seam/Model/AcsUser.cs (100%) rename {output/csharp/src => src}/Seam/Model/ActionAttempt.cs (100%) rename {output/csharp/src => src}/Seam/Model/AsbtractModelSchema.cs (100%) rename {output/csharp/src => src}/Seam/Model/Batch.cs (100%) rename {output/csharp/src => src}/Seam/Model/ClientSession.cs (100%) rename {output/csharp/src => src}/Seam/Model/ConnectWebview.cs (100%) rename {output/csharp/src => src}/Seam/Model/ConnectedAccount.cs (100%) rename {output/csharp/src => src}/Seam/Model/CustomerPortal.cs (100%) rename {output/csharp/src => src}/Seam/Model/Device.cs (100%) rename {output/csharp/src => src}/Seam/Model/DeviceProvider.cs (100%) rename {output/csharp/src => src}/Seam/Model/Event.cs (100%) rename {output/csharp/src => src}/Seam/Model/InstantKey.cs (100%) rename {output/csharp/src => src}/Seam/Model/NoiseThreshold.cs (100%) rename {output/csharp/src => src}/Seam/Model/Phone.cs (100%) rename {output/csharp/src => src}/Seam/Model/SafeStringEnumConverter.cs (100%) rename {output/csharp/src => src}/Seam/Model/Space.cs (100%) rename {output/csharp/src => src}/Seam/Model/ThermostatDailyProgram.cs (100%) rename {output/csharp/src => src}/Seam/Model/ThermostatSchedule.cs (100%) rename {output/csharp/src => src}/Seam/Model/UnmanagedAccessCode.cs (100%) rename {output/csharp/src => src}/Seam/Model/UnmanagedAccessGrant.cs (100%) rename {output/csharp/src => src}/Seam/Model/UnmanagedAccessMethod.cs (100%) rename {output/csharp/src => src}/Seam/Model/UnmanagedDevice.cs (100%) rename {output/csharp/src => src}/Seam/Model/UnmanagedUserIdentity.cs (100%) rename {output/csharp/src => src}/Seam/Model/UserIdentity.cs (100%) rename {output/csharp/src => src}/Seam/Model/Webhook.cs (100%) rename {output/csharp/src => src}/Seam/Model/Workspace.cs (100%) rename {output/csharp/src => src}/Seam/Seam.csproj (94%) rename {output/csharp/src => src}/Seam/icon.png (100%) diff --git a/.gitattributes b/.gitattributes index 6c0b1a83..9ba231c0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,10 +1,10 @@ # Code generated from the blueprint by the codegen. -output/csharp/src/Seam/Api/** linguist-generated -output/csharp/src/Seam/Model/** linguist-generated -output/csharp/src/Seam/Seam.csproj linguist-generated +src/Seam/Api/** linguist-generated +src/Seam/Model/** linguist-generated +src/Seam/Seam.csproj linguist-generated # Static, schema-independent sources kept alongside the generated code. -output/csharp/src/Seam/Model/AsbtractModelSchema.cs -linguist-generated -output/csharp/src/Seam/Model/SafeStringEnumConverter.cs -linguist-generated +src/Seam/Model/AsbtractModelSchema.cs -linguist-generated +src/Seam/Model/SafeStringEnumConverter.cs -linguist-generated diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index a1a7a5d3..37255cec 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -37,4 +37,4 @@ runs: - name: Restore dependencies if: inputs.install_dependencies == 'true' shell: bash - run: dotnet restore ./output/csharp + run: dotnet restore ./Seam.sln diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index e9ae5dbb..c72fae71 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -30,8 +30,8 @@ jobs: uses: tj-actions/changed-files@v44 with: files: | - output/csharp/src/Seam/Api/** - output/csharp/src/Seam/Model/** + src/Seam/Api/** + src/Seam/Model/** merge: name: Merge runs-on: ubuntu-latest diff --git a/README.md b/README.md index 470ffe7a..b6fecc85 100644 --- a/README.md +++ b/README.md @@ -208,8 +208,8 @@ Packages. > The version lives in `package.json`, the development manifest that > drives the codegen, and is injected into `Seam.csproj` by -> `src/generate-csproj.ts`. -> The injection runs from `src/version.ts`, wired to the `version` +> `codegen/generate-csproj.ts`. +> The injection runs from `codegen/version.ts`, wired to the `version` > lifecycle script, which npm runs after the bump but before the commit, > so the updated project file is part of the tagged commit and MSBuild > surfaces the version at runtime through diff --git a/output/csharp/csharp-testing.sln b/Seam.sln similarity index 100% rename from output/csharp/csharp-testing.sln rename to Seam.sln diff --git a/src/generate-csproj.ts b/codegen/generate-csproj.ts similarity index 93% rename from src/generate-csproj.ts rename to codegen/generate-csproj.ts index f04b8eb1..e300c53a 100644 --- a/src/generate-csproj.ts +++ b/codegen/generate-csproj.ts @@ -48,7 +48,7 @@ export const csprojTemplate = (version: string, dotNetVersions: string[]) => - + @@ -62,7 +62,7 @@ export const csprojTemplate = (version: string, dotNetVersions: string[]) => const main = async () => { writeFileSync( - './output/csharp/src/Seam/Seam.csproj', + './src/Seam/Seam.csproj', csprojTemplate(version, ['8.0', '10.0']), ) } diff --git a/codegen/lib/class-model.ts b/codegen/lib/class-model.ts index 3fcb59cd..13d64f9f 100644 --- a/codegen/lib/class-model.ts +++ b/codegen/lib/class-model.ts @@ -83,7 +83,7 @@ export interface CsUnion { export type CsDecl = CsClass | CsUnion -// A generated model file (output/csharp/src/Seam/Model/.cs): one or more +// A generated model file (src/Seam/Model/.cs): one or more // top-level declarations (the main type first, then sibling classes spawned by // inline-object properties). export interface CsModelFile { @@ -119,7 +119,7 @@ export interface CsRoute { obsoleteMessage?: string } -// A generated Api file (output/csharp/src/Seam/Api/.cs). +// A generated Api file (src/Seam/Api/.cs). export interface CsApiFile { className: string routes: CsRoute[] diff --git a/codegen/lib/csharp.ts b/codegen/lib/csharp.ts index 1b6e293b..d35e4d82 100644 --- a/codegen/lib/csharp.ts +++ b/codegen/lib/csharp.ts @@ -9,7 +9,7 @@ import { buildModelFile, } from './build-model.js' -const outputRoot = 'output/csharp/src/Seam' +const outputRoot = 'src/Seam' // Resource types that are emitted as discriminated unions rather than plain // model classes. @@ -21,8 +21,8 @@ const apiClassName = (path: string): string => pascalCase(path.split('/').filter(Boolean).reverse().join('_')) // Metalsmith plugin that generates the blueprint-derived C# SDK files: the Api -// route classes (output/csharp/src/Seam/Api/*.cs) and the resource models -// (output/csharp/src/Seam/Model/*.cs). Static, schema-independent files (the +// route classes (src/Seam/Api/*.cs) and the resource models +// (src/Seam/Model/*.cs). Static, schema-independent files (the // Client/* runtime, the static Model helpers, the .sln, the test project) are // normal committed package source and are intentionally NOT generated here. // diff --git a/src/postgenerate.ts b/codegen/postgenerate.ts similarity index 53% rename from src/postgenerate.ts rename to codegen/postgenerate.ts index f35da16c..eb565f95 100644 --- a/src/postgenerate.ts +++ b/codegen/postgenerate.ts @@ -2,6 +2,6 @@ import { $ } from 'execa' const run = $({ stdio: 'inherit' }) -await run`tsx src/generate-csproj.ts` +await run`tsx codegen/generate-csproj.ts` await run`dotnet tool restore` -await run`dotnet csharpier ./output/csharp` +await run`dotnet csharpier ./src` diff --git a/src/version.ts b/codegen/version.ts similarity index 89% rename from src/version.ts rename to codegen/version.ts index 714eba75..d5b39289 100644 --- a/src/version.ts +++ b/codegen/version.ts @@ -3,7 +3,7 @@ import { fileURLToPath } from 'node:url' import { $ } from 'execa' -const csprojFile = './output/csharp/src/Seam/Seam.csproj' +const csprojFile = './src/Seam/Seam.csproj' const main = async (): Promise => { const { version } = await readPackageJson() @@ -12,7 +12,7 @@ const main = async (): Promise => { throw new Error('Missing version in package.json') } - await $({ stdio: 'inherit' })`tsx src/generate-csproj.ts` + await $({ stdio: 'inherit' })`tsx codegen/generate-csproj.ts` const data = await readFile( fileURLToPath(new URL(`../${csprojFile}`, import.meta.url)), diff --git a/justfile b/justfile index cddb9e88..09d2f3c4 100644 --- a/justfile +++ b/justfile @@ -1,15 +1,15 @@ # Build the package build: - dotnet pack --configuration Release --output pkg ./output/csharp/src/Seam + dotnet pack --configuration Release --output pkg ./src/Seam # Run the tests test framework="": - dotnet test ./output/csharp {{ if framework == "" { "" } else { "--framework " + framework } }} + dotnet test ./Seam.sln {{ if framework == "" { "" } else { "--framework " + framework } }} # Lint lint: - dotnet csharpier --check ./output/csharp + dotnet csharpier --check ./src # Format format: - dotnet csharpier ./output/csharp + dotnet csharpier ./src diff --git a/output/csharp/.gitignore b/output/csharp/.gitignore deleted file mode 100644 index 1746e326..00000000 --- a/output/csharp/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -bin -obj diff --git a/output/csharp/src/Seam/README.md b/output/csharp/src/Seam/README.md deleted file mode 100644 index 3afd5453..00000000 --- a/output/csharp/src/Seam/README.md +++ /dev/null @@ -1,124 +0,0 @@ -# Seam C# - -## Usage - -```csharp -using Seam.Client; - -var seam = new SeamClient(apiToken: "YOUR_API_KEY"); - -var myDevices = seam.Devices.List(); - -Console.WriteLine("First Device Name: " + myDevices[0].Properties.Name); - -var accessCode = seam.AccessCodes.Create(deviceId: myDevices[0].DeviceId, code: "1234"); -``` - -### Setting a value to null - -The Seam API distinguishes three states for an updatable parameter: -omitted (leave the stored value unchanged), null (unset the stored value), -and a value (set it). - -C#'s `null` means omitted. -The SDK removes `null` parameters from the request entirely, -so passing `null` never unsets a value. -To unset a value, pass the `Null.Value` sentinel, -which the SDK sends as JSON `null` in request bodies -and as an empty value in query strings: - -```csharp -// Omits custom_metadata, leaving the stored metadata unchanged. -seam.Devices.Update(deviceId: deviceId, customMetadata: null); - -// Unsets the sync key of the stored metadata. -seam.Devices.Update( - deviceId: deviceId, - customMetadata: new Dictionary { ["sync"] = Null.Value } -); -``` - -Only pass `Null.Value` where the Seam API documents a value as nullable. -A parameter typed as a specific C# type, e.g. `string?`, does not accept the -sentinel: pass it wherever a parameter is typed `object`, and to the URL search -params serializer below. - -## Advanced Usage - -### Setting the request timeout - -Requests time out after 30 seconds by default. -Pass the `timeout` option, in milliseconds, to override this: - -```csharp -var seam = new SeamClient(apiToken: "YOUR_API_KEY", timeout: 60000); -``` - -The default may also be changed for every client at once: - -```csharp -GlobalSeamRequestConfiguration.Instance.Timeout = 60000; -``` - -### Serializing URL search params - -The Seam API parses URL search params as complex types. -The SDK serializes the params of every endpoint -the Seam API prefers to receive as a GET or DELETE this way. -If you call the API with your own HTTP client, -`StrictUrlSearchParamsSerializer` is exported for that purpose. -The `_strict=true` parameter is added to any non-empty query -so the Seam API uses strict, schema-aware parsing. -A query with no serializable parameters remains empty. - -```csharp -using Seam.Client; - -var query = StrictUrlSearchParamsSerializer.Serialize( - new Dictionary { ["device_ids"] = new[] { "device1", "device2" } } -); - -using var client = new HttpClient(); -client.DefaultRequestHeaders.Add("Authorization", "Bearer your-api-key"); - -var devices = await client.GetStringAsync($"https://connect.getseam.com/devices/list?{query}"); -``` - -The serialization defines the name and value of each search param, -where every value is a string. -`UrlSearchParams` holds those pairs and renders the query string, -as [URLSearchParams] does for the [reference implementation]: - -```csharp -using Seam.Client; - -var searchParams = new UrlSearchParams(); - -StrictUrlSearchParamsSerializer.Update( - searchParams, - new Dictionary { ["device_ids"] = new[] { "device1", "device2" } } -); - -searchParams.Select(pair => (pair.Key, pair.Value)).ToList(); -// => [("device_ids", "device1"), ("device_ids", "device2"), ("_strict", "true")] - -searchParams.ToString(); -// => "device_ids=device1&device_ids=device2&_strict=true" -``` - -Pass either the query string or the pairs to your HTTP client. -A client may percent-encode a few characters differently -than `URLSearchParams` does, -which the Seam API reads as the same params either way. - -A parameter set to `null` is omitted, -while a parameter set to `Null.Value` is serialized to an empty value, -which the Seam API reads as null, -as described in [Setting a value to null](#setting-a-value-to-null). -A parameter that cannot be represented throws an `UnserializableParamError`. - -The Seam API parses these params with the corresponding [parser]. - -[URLSearchParams]: https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams -[reference implementation]: https://github.com/seamapi/url-search-params-serializer -[parser]: https://github.com/seamapi/url-search-params-parser diff --git a/package.json b/package.json index 4a9d6e60..29620e2e 100644 --- a/package.json +++ b/package.json @@ -5,11 +5,11 @@ "private": true, "license": "MIT", "scripts": { - "version": "tsx src/version.ts", + "version": "tsx codegen/version.ts", "postversion": "git push --follow-tags", "generate": "tsx codegen/smith.ts", - "postgenerate": "tsx src/postgenerate.ts", - "generate:csproj": "tsx src/generate-csproj.ts", + "postgenerate": "tsx codegen/postgenerate.ts", + "generate:csproj": "tsx codegen/generate-csproj.ts", "typecheck": "tsc", "lint": "eslint .", "postlint": "prettier --check --ignore-path .gitignore --ignore-path .prettierignore .", diff --git a/output/csharp/src/Seam.Test/Client/ApiResponseTests.cs b/src/Seam.Test/Client/ApiResponseTests.cs similarity index 100% rename from output/csharp/src/Seam.Test/Client/ApiResponseTests.cs rename to src/Seam.Test/Client/ApiResponseTests.cs diff --git a/output/csharp/src/Seam.Test/Client/NullTests.cs b/src/Seam.Test/Client/NullTests.cs similarity index 100% rename from output/csharp/src/Seam.Test/Client/NullTests.cs rename to src/Seam.Test/Client/NullTests.cs diff --git a/output/csharp/src/Seam.Test/Client/RequestTransportTests.cs b/src/Seam.Test/Client/RequestTransportTests.cs similarity index 100% rename from output/csharp/src/Seam.Test/Client/RequestTransportTests.cs rename to src/Seam.Test/Client/RequestTransportTests.cs diff --git a/output/csharp/src/Seam.Test/Client/SeamTests.cs b/src/Seam.Test/Client/SeamTests.cs similarity index 100% rename from output/csharp/src/Seam.Test/Client/SeamTests.cs rename to src/Seam.Test/Client/SeamTests.cs diff --git a/output/csharp/src/Seam.Test/Client/StrictUrlSearchParamsSerializerTests.cs b/src/Seam.Test/Client/StrictUrlSearchParamsSerializerTests.cs similarity index 100% rename from output/csharp/src/Seam.Test/Client/StrictUrlSearchParamsSerializerTests.cs rename to src/Seam.Test/Client/StrictUrlSearchParamsSerializerTests.cs diff --git a/output/csharp/src/Seam.Test/Client/TimeoutTests.cs b/src/Seam.Test/Client/TimeoutTests.cs similarity index 100% rename from output/csharp/src/Seam.Test/Client/TimeoutTests.cs rename to src/Seam.Test/Client/TimeoutTests.cs diff --git a/output/csharp/src/Seam.Test/Client/UrlSearchParamsSerializerTests.cs b/src/Seam.Test/Client/UrlSearchParamsSerializerTests.cs similarity index 100% rename from output/csharp/src/Seam.Test/Client/UrlSearchParamsSerializerTests.cs rename to src/Seam.Test/Client/UrlSearchParamsSerializerTests.cs diff --git a/output/csharp/src/Seam.Test/Client/UrlSearchParamsTests.cs b/src/Seam.Test/Client/UrlSearchParamsTests.cs similarity index 100% rename from output/csharp/src/Seam.Test/Client/UrlSearchParamsTests.cs rename to src/Seam.Test/Client/UrlSearchParamsTests.cs diff --git a/output/csharp/src/Seam.Test/GlobalUsings.cs b/src/Seam.Test/GlobalUsings.cs similarity index 100% rename from output/csharp/src/Seam.Test/GlobalUsings.cs rename to src/Seam.Test/GlobalUsings.cs diff --git a/output/csharp/src/Seam.Test/Seam.Test.csproj b/src/Seam.Test/Seam.Test.csproj similarity index 100% rename from output/csharp/src/Seam.Test/Seam.Test.csproj rename to src/Seam.Test/Seam.Test.csproj diff --git a/output/csharp/src/Seam/Api/AccessCodes.cs b/src/Seam/Api/AccessCodes.cs similarity index 100% rename from output/csharp/src/Seam/Api/AccessCodes.cs rename to src/Seam/Api/AccessCodes.cs diff --git a/output/csharp/src/Seam/Api/AccessGrants.cs b/src/Seam/Api/AccessGrants.cs similarity index 100% rename from output/csharp/src/Seam/Api/AccessGrants.cs rename to src/Seam/Api/AccessGrants.cs diff --git a/output/csharp/src/Seam/Api/AccessGroupsAcs.cs b/src/Seam/Api/AccessGroupsAcs.cs similarity index 100% rename from output/csharp/src/Seam/Api/AccessGroupsAcs.cs rename to src/Seam/Api/AccessGroupsAcs.cs diff --git a/output/csharp/src/Seam/Api/AccessMethods.cs b/src/Seam/Api/AccessMethods.cs similarity index 100% rename from output/csharp/src/Seam/Api/AccessMethods.cs rename to src/Seam/Api/AccessMethods.cs diff --git a/output/csharp/src/Seam/Api/ActionAttempts.cs b/src/Seam/Api/ActionAttempts.cs similarity index 100% rename from output/csharp/src/Seam/Api/ActionAttempts.cs rename to src/Seam/Api/ActionAttempts.cs diff --git a/output/csharp/src/Seam/Api/ClientSessions.cs b/src/Seam/Api/ClientSessions.cs similarity index 100% rename from output/csharp/src/Seam/Api/ClientSessions.cs rename to src/Seam/Api/ClientSessions.cs diff --git a/output/csharp/src/Seam/Api/ConnectWebviews.cs b/src/Seam/Api/ConnectWebviews.cs similarity index 100% rename from output/csharp/src/Seam/Api/ConnectWebviews.cs rename to src/Seam/Api/ConnectWebviews.cs diff --git a/output/csharp/src/Seam/Api/ConnectedAccounts.cs b/src/Seam/Api/ConnectedAccounts.cs similarity index 100% rename from output/csharp/src/Seam/Api/ConnectedAccounts.cs rename to src/Seam/Api/ConnectedAccounts.cs diff --git a/output/csharp/src/Seam/Api/CredentialsAcs.cs b/src/Seam/Api/CredentialsAcs.cs similarity index 100% rename from output/csharp/src/Seam/Api/CredentialsAcs.cs rename to src/Seam/Api/CredentialsAcs.cs diff --git a/output/csharp/src/Seam/Api/Customers.cs b/src/Seam/Api/Customers.cs similarity index 100% rename from output/csharp/src/Seam/Api/Customers.cs rename to src/Seam/Api/Customers.cs diff --git a/output/csharp/src/Seam/Api/DailyProgramsThermostats.cs b/src/Seam/Api/DailyProgramsThermostats.cs similarity index 100% rename from output/csharp/src/Seam/Api/DailyProgramsThermostats.cs rename to src/Seam/Api/DailyProgramsThermostats.cs diff --git a/output/csharp/src/Seam/Api/Devices.cs b/src/Seam/Api/Devices.cs similarity index 100% rename from output/csharp/src/Seam/Api/Devices.cs rename to src/Seam/Api/Devices.cs diff --git a/output/csharp/src/Seam/Api/EncodersAcs.cs b/src/Seam/Api/EncodersAcs.cs similarity index 100% rename from output/csharp/src/Seam/Api/EncodersAcs.cs rename to src/Seam/Api/EncodersAcs.cs diff --git a/output/csharp/src/Seam/Api/EntrancesAcs.cs b/src/Seam/Api/EntrancesAcs.cs similarity index 100% rename from output/csharp/src/Seam/Api/EntrancesAcs.cs rename to src/Seam/Api/EntrancesAcs.cs diff --git a/output/csharp/src/Seam/Api/Events.cs b/src/Seam/Api/Events.cs similarity index 100% rename from output/csharp/src/Seam/Api/Events.cs rename to src/Seam/Api/Events.cs diff --git a/output/csharp/src/Seam/Api/InstantKeys.cs b/src/Seam/Api/InstantKeys.cs similarity index 100% rename from output/csharp/src/Seam/Api/InstantKeys.cs rename to src/Seam/Api/InstantKeys.cs diff --git a/output/csharp/src/Seam/Api/Locks.cs b/src/Seam/Api/Locks.cs similarity index 100% rename from output/csharp/src/Seam/Api/Locks.cs rename to src/Seam/Api/Locks.cs diff --git a/output/csharp/src/Seam/Api/NoiseSensors.cs b/src/Seam/Api/NoiseSensors.cs similarity index 100% rename from output/csharp/src/Seam/Api/NoiseSensors.cs rename to src/Seam/Api/NoiseSensors.cs diff --git a/output/csharp/src/Seam/Api/NoiseThresholdsNoiseSensors.cs b/src/Seam/Api/NoiseThresholdsNoiseSensors.cs similarity index 100% rename from output/csharp/src/Seam/Api/NoiseThresholdsNoiseSensors.cs rename to src/Seam/Api/NoiseThresholdsNoiseSensors.cs diff --git a/output/csharp/src/Seam/Api/Phones.cs b/src/Seam/Api/Phones.cs similarity index 100% rename from output/csharp/src/Seam/Api/Phones.cs rename to src/Seam/Api/Phones.cs diff --git a/output/csharp/src/Seam/Api/SchedulesThermostats.cs b/src/Seam/Api/SchedulesThermostats.cs similarity index 100% rename from output/csharp/src/Seam/Api/SchedulesThermostats.cs rename to src/Seam/Api/SchedulesThermostats.cs diff --git a/output/csharp/src/Seam/Api/SimulateAccessCodes.cs b/src/Seam/Api/SimulateAccessCodes.cs similarity index 100% rename from output/csharp/src/Seam/Api/SimulateAccessCodes.cs rename to src/Seam/Api/SimulateAccessCodes.cs diff --git a/output/csharp/src/Seam/Api/SimulateConnectedAccounts.cs b/src/Seam/Api/SimulateConnectedAccounts.cs similarity index 100% rename from output/csharp/src/Seam/Api/SimulateConnectedAccounts.cs rename to src/Seam/Api/SimulateConnectedAccounts.cs diff --git a/output/csharp/src/Seam/Api/SimulateDevices.cs b/src/Seam/Api/SimulateDevices.cs similarity index 100% rename from output/csharp/src/Seam/Api/SimulateDevices.cs rename to src/Seam/Api/SimulateDevices.cs diff --git a/output/csharp/src/Seam/Api/SimulateEncodersAcs.cs b/src/Seam/Api/SimulateEncodersAcs.cs similarity index 100% rename from output/csharp/src/Seam/Api/SimulateEncodersAcs.cs rename to src/Seam/Api/SimulateEncodersAcs.cs diff --git a/output/csharp/src/Seam/Api/SimulateLocks.cs b/src/Seam/Api/SimulateLocks.cs similarity index 100% rename from output/csharp/src/Seam/Api/SimulateLocks.cs rename to src/Seam/Api/SimulateLocks.cs diff --git a/output/csharp/src/Seam/Api/SimulateNoiseSensors.cs b/src/Seam/Api/SimulateNoiseSensors.cs similarity index 100% rename from output/csharp/src/Seam/Api/SimulateNoiseSensors.cs rename to src/Seam/Api/SimulateNoiseSensors.cs diff --git a/output/csharp/src/Seam/Api/SimulatePhones.cs b/src/Seam/Api/SimulatePhones.cs similarity index 100% rename from output/csharp/src/Seam/Api/SimulatePhones.cs rename to src/Seam/Api/SimulatePhones.cs diff --git a/output/csharp/src/Seam/Api/SimulateThermostats.cs b/src/Seam/Api/SimulateThermostats.cs similarity index 100% rename from output/csharp/src/Seam/Api/SimulateThermostats.cs rename to src/Seam/Api/SimulateThermostats.cs diff --git a/output/csharp/src/Seam/Api/Spaces.cs b/src/Seam/Api/Spaces.cs similarity index 100% rename from output/csharp/src/Seam/Api/Spaces.cs rename to src/Seam/Api/Spaces.cs diff --git a/output/csharp/src/Seam/Api/SystemsAcs.cs b/src/Seam/Api/SystemsAcs.cs similarity index 100% rename from output/csharp/src/Seam/Api/SystemsAcs.cs rename to src/Seam/Api/SystemsAcs.cs diff --git a/output/csharp/src/Seam/Api/Thermostats.cs b/src/Seam/Api/Thermostats.cs similarity index 100% rename from output/csharp/src/Seam/Api/Thermostats.cs rename to src/Seam/Api/Thermostats.cs diff --git a/output/csharp/src/Seam/Api/UnmanagedAccessCodes.cs b/src/Seam/Api/UnmanagedAccessCodes.cs similarity index 100% rename from output/csharp/src/Seam/Api/UnmanagedAccessCodes.cs rename to src/Seam/Api/UnmanagedAccessCodes.cs diff --git a/output/csharp/src/Seam/Api/UnmanagedAccessGrants.cs b/src/Seam/Api/UnmanagedAccessGrants.cs similarity index 100% rename from output/csharp/src/Seam/Api/UnmanagedAccessGrants.cs rename to src/Seam/Api/UnmanagedAccessGrants.cs diff --git a/output/csharp/src/Seam/Api/UnmanagedAccessMethods.cs b/src/Seam/Api/UnmanagedAccessMethods.cs similarity index 100% rename from output/csharp/src/Seam/Api/UnmanagedAccessMethods.cs rename to src/Seam/Api/UnmanagedAccessMethods.cs diff --git a/output/csharp/src/Seam/Api/UnmanagedDevices.cs b/src/Seam/Api/UnmanagedDevices.cs similarity index 100% rename from output/csharp/src/Seam/Api/UnmanagedDevices.cs rename to src/Seam/Api/UnmanagedDevices.cs diff --git a/output/csharp/src/Seam/Api/UnmanagedUserIdentities.cs b/src/Seam/Api/UnmanagedUserIdentities.cs similarity index 100% rename from output/csharp/src/Seam/Api/UnmanagedUserIdentities.cs rename to src/Seam/Api/UnmanagedUserIdentities.cs diff --git a/output/csharp/src/Seam/Api/UserIdentities.cs b/src/Seam/Api/UserIdentities.cs similarity index 100% rename from output/csharp/src/Seam/Api/UserIdentities.cs rename to src/Seam/Api/UserIdentities.cs diff --git a/output/csharp/src/Seam/Api/UsersAcs.cs b/src/Seam/Api/UsersAcs.cs similarity index 100% rename from output/csharp/src/Seam/Api/UsersAcs.cs rename to src/Seam/Api/UsersAcs.cs diff --git a/output/csharp/src/Seam/Api/Webhooks.cs b/src/Seam/Api/Webhooks.cs similarity index 100% rename from output/csharp/src/Seam/Api/Webhooks.cs rename to src/Seam/Api/Webhooks.cs diff --git a/output/csharp/src/Seam/Api/Workspaces.cs b/src/Seam/Api/Workspaces.cs similarity index 100% rename from output/csharp/src/Seam/Api/Workspaces.cs rename to src/Seam/Api/Workspaces.cs diff --git a/output/csharp/src/Seam/Client/ApiResponse.cs b/src/Seam/Client/ApiResponse.cs similarity index 100% rename from output/csharp/src/Seam/Client/ApiResponse.cs rename to src/Seam/Client/ApiResponse.cs diff --git a/output/csharp/src/Seam/Client/ClientUtils.cs b/src/Seam/Client/ClientUtils.cs similarity index 100% rename from output/csharp/src/Seam/Client/ClientUtils.cs rename to src/Seam/Client/ClientUtils.cs diff --git a/output/csharp/src/Seam/Client/ExceptionFactory.cs b/src/Seam/Client/ExceptionFactory.cs similarity index 100% rename from output/csharp/src/Seam/Client/ExceptionFactory.cs rename to src/Seam/Client/ExceptionFactory.cs diff --git a/output/csharp/src/Seam/Client/GlobalSeamRequestConfiguration.cs b/src/Seam/Client/GlobalSeamRequestConfiguration.cs similarity index 100% rename from output/csharp/src/Seam/Client/GlobalSeamRequestConfiguration.cs rename to src/Seam/Client/GlobalSeamRequestConfiguration.cs diff --git a/output/csharp/src/Seam/Client/HttpMethod.cs b/src/Seam/Client/HttpMethod.cs similarity index 100% rename from output/csharp/src/Seam/Client/HttpMethod.cs rename to src/Seam/Client/HttpMethod.cs diff --git a/output/csharp/src/Seam/Client/IAsynchronousSeam.cs b/src/Seam/Client/IAsynchronousSeam.cs similarity index 100% rename from output/csharp/src/Seam/Client/IAsynchronousSeam.cs rename to src/Seam/Client/IAsynchronousSeam.cs diff --git a/output/csharp/src/Seam/Client/IReadableSeamRequestConfiguration.cs b/src/Seam/Client/IReadableSeamRequestConfiguration.cs similarity index 100% rename from output/csharp/src/Seam/Client/IReadableSeamRequestConfiguration.cs rename to src/Seam/Client/IReadableSeamRequestConfiguration.cs diff --git a/output/csharp/src/Seam/Client/ISynchronousSeam.cs b/src/Seam/Client/ISynchronousSeam.cs similarity index 100% rename from output/csharp/src/Seam/Client/ISynchronousSeam.cs rename to src/Seam/Client/ISynchronousSeam.cs diff --git a/output/csharp/src/Seam/Client/Multimap.cs b/src/Seam/Client/Multimap.cs similarity index 100% rename from output/csharp/src/Seam/Client/Multimap.cs rename to src/Seam/Client/Multimap.cs diff --git a/output/csharp/src/Seam/Client/Null.cs b/src/Seam/Client/Null.cs similarity index 100% rename from output/csharp/src/Seam/Client/Null.cs rename to src/Seam/Client/Null.cs diff --git a/output/csharp/src/Seam/Client/RequestOptions.cs b/src/Seam/Client/RequestOptions.cs similarity index 100% rename from output/csharp/src/Seam/Client/RequestOptions.cs rename to src/Seam/Client/RequestOptions.cs diff --git a/output/csharp/src/Seam/Client/RetryConfiguration.cs b/src/Seam/Client/RetryConfiguration.cs similarity index 100% rename from output/csharp/src/Seam/Client/RetryConfiguration.cs rename to src/Seam/Client/RetryConfiguration.cs diff --git a/output/csharp/src/Seam/Client/Seam.cs b/src/Seam/Client/Seam.cs similarity index 100% rename from output/csharp/src/Seam/Client/Seam.cs rename to src/Seam/Client/Seam.cs diff --git a/output/csharp/src/Seam/Client/SeamException.cs b/src/Seam/Client/SeamException.cs similarity index 100% rename from output/csharp/src/Seam/Client/SeamException.cs rename to src/Seam/Client/SeamException.cs diff --git a/output/csharp/src/Seam/Client/SeamRequestConfiguration.cs b/src/Seam/Client/SeamRequestConfiguration.cs similarity index 100% rename from output/csharp/src/Seam/Client/SeamRequestConfiguration.cs rename to src/Seam/Client/SeamRequestConfiguration.cs diff --git a/output/csharp/src/Seam/Client/StrictUrlSearchParamsSerializer.cs b/src/Seam/Client/StrictUrlSearchParamsSerializer.cs similarity index 100% rename from output/csharp/src/Seam/Client/StrictUrlSearchParamsSerializer.cs rename to src/Seam/Client/StrictUrlSearchParamsSerializer.cs diff --git a/output/csharp/src/Seam/Client/UnserializableParamError.cs b/src/Seam/Client/UnserializableParamError.cs similarity index 100% rename from output/csharp/src/Seam/Client/UnserializableParamError.cs rename to src/Seam/Client/UnserializableParamError.cs diff --git a/output/csharp/src/Seam/Client/UrlSearchParams.cs b/src/Seam/Client/UrlSearchParams.cs similarity index 100% rename from output/csharp/src/Seam/Client/UrlSearchParams.cs rename to src/Seam/Client/UrlSearchParams.cs diff --git a/output/csharp/src/Seam/Client/UrlSearchParamsSerializer.cs b/src/Seam/Client/UrlSearchParamsSerializer.cs similarity index 100% rename from output/csharp/src/Seam/Client/UrlSearchParamsSerializer.cs rename to src/Seam/Client/UrlSearchParamsSerializer.cs diff --git a/output/csharp/src/Seam/Model/AccessCode.cs b/src/Seam/Model/AccessCode.cs similarity index 100% rename from output/csharp/src/Seam/Model/AccessCode.cs rename to src/Seam/Model/AccessCode.cs diff --git a/output/csharp/src/Seam/Model/AccessGrant.cs b/src/Seam/Model/AccessGrant.cs similarity index 100% rename from output/csharp/src/Seam/Model/AccessGrant.cs rename to src/Seam/Model/AccessGrant.cs diff --git a/output/csharp/src/Seam/Model/AccessMethod.cs b/src/Seam/Model/AccessMethod.cs similarity index 100% rename from output/csharp/src/Seam/Model/AccessMethod.cs rename to src/Seam/Model/AccessMethod.cs diff --git a/output/csharp/src/Seam/Model/AcsAccessGroup.cs b/src/Seam/Model/AcsAccessGroup.cs similarity index 100% rename from output/csharp/src/Seam/Model/AcsAccessGroup.cs rename to src/Seam/Model/AcsAccessGroup.cs diff --git a/output/csharp/src/Seam/Model/AcsCredential.cs b/src/Seam/Model/AcsCredential.cs similarity index 100% rename from output/csharp/src/Seam/Model/AcsCredential.cs rename to src/Seam/Model/AcsCredential.cs diff --git a/output/csharp/src/Seam/Model/AcsEncoder.cs b/src/Seam/Model/AcsEncoder.cs similarity index 100% rename from output/csharp/src/Seam/Model/AcsEncoder.cs rename to src/Seam/Model/AcsEncoder.cs diff --git a/output/csharp/src/Seam/Model/AcsEntrance.cs b/src/Seam/Model/AcsEntrance.cs similarity index 100% rename from output/csharp/src/Seam/Model/AcsEntrance.cs rename to src/Seam/Model/AcsEntrance.cs diff --git a/output/csharp/src/Seam/Model/AcsSystem.cs b/src/Seam/Model/AcsSystem.cs similarity index 100% rename from output/csharp/src/Seam/Model/AcsSystem.cs rename to src/Seam/Model/AcsSystem.cs diff --git a/output/csharp/src/Seam/Model/AcsUser.cs b/src/Seam/Model/AcsUser.cs similarity index 100% rename from output/csharp/src/Seam/Model/AcsUser.cs rename to src/Seam/Model/AcsUser.cs diff --git a/output/csharp/src/Seam/Model/ActionAttempt.cs b/src/Seam/Model/ActionAttempt.cs similarity index 100% rename from output/csharp/src/Seam/Model/ActionAttempt.cs rename to src/Seam/Model/ActionAttempt.cs diff --git a/output/csharp/src/Seam/Model/AsbtractModelSchema.cs b/src/Seam/Model/AsbtractModelSchema.cs similarity index 100% rename from output/csharp/src/Seam/Model/AsbtractModelSchema.cs rename to src/Seam/Model/AsbtractModelSchema.cs diff --git a/output/csharp/src/Seam/Model/Batch.cs b/src/Seam/Model/Batch.cs similarity index 100% rename from output/csharp/src/Seam/Model/Batch.cs rename to src/Seam/Model/Batch.cs diff --git a/output/csharp/src/Seam/Model/ClientSession.cs b/src/Seam/Model/ClientSession.cs similarity index 100% rename from output/csharp/src/Seam/Model/ClientSession.cs rename to src/Seam/Model/ClientSession.cs diff --git a/output/csharp/src/Seam/Model/ConnectWebview.cs b/src/Seam/Model/ConnectWebview.cs similarity index 100% rename from output/csharp/src/Seam/Model/ConnectWebview.cs rename to src/Seam/Model/ConnectWebview.cs diff --git a/output/csharp/src/Seam/Model/ConnectedAccount.cs b/src/Seam/Model/ConnectedAccount.cs similarity index 100% rename from output/csharp/src/Seam/Model/ConnectedAccount.cs rename to src/Seam/Model/ConnectedAccount.cs diff --git a/output/csharp/src/Seam/Model/CustomerPortal.cs b/src/Seam/Model/CustomerPortal.cs similarity index 100% rename from output/csharp/src/Seam/Model/CustomerPortal.cs rename to src/Seam/Model/CustomerPortal.cs diff --git a/output/csharp/src/Seam/Model/Device.cs b/src/Seam/Model/Device.cs similarity index 100% rename from output/csharp/src/Seam/Model/Device.cs rename to src/Seam/Model/Device.cs diff --git a/output/csharp/src/Seam/Model/DeviceProvider.cs b/src/Seam/Model/DeviceProvider.cs similarity index 100% rename from output/csharp/src/Seam/Model/DeviceProvider.cs rename to src/Seam/Model/DeviceProvider.cs diff --git a/output/csharp/src/Seam/Model/Event.cs b/src/Seam/Model/Event.cs similarity index 100% rename from output/csharp/src/Seam/Model/Event.cs rename to src/Seam/Model/Event.cs diff --git a/output/csharp/src/Seam/Model/InstantKey.cs b/src/Seam/Model/InstantKey.cs similarity index 100% rename from output/csharp/src/Seam/Model/InstantKey.cs rename to src/Seam/Model/InstantKey.cs diff --git a/output/csharp/src/Seam/Model/NoiseThreshold.cs b/src/Seam/Model/NoiseThreshold.cs similarity index 100% rename from output/csharp/src/Seam/Model/NoiseThreshold.cs rename to src/Seam/Model/NoiseThreshold.cs diff --git a/output/csharp/src/Seam/Model/Phone.cs b/src/Seam/Model/Phone.cs similarity index 100% rename from output/csharp/src/Seam/Model/Phone.cs rename to src/Seam/Model/Phone.cs diff --git a/output/csharp/src/Seam/Model/SafeStringEnumConverter.cs b/src/Seam/Model/SafeStringEnumConverter.cs similarity index 100% rename from output/csharp/src/Seam/Model/SafeStringEnumConverter.cs rename to src/Seam/Model/SafeStringEnumConverter.cs diff --git a/output/csharp/src/Seam/Model/Space.cs b/src/Seam/Model/Space.cs similarity index 100% rename from output/csharp/src/Seam/Model/Space.cs rename to src/Seam/Model/Space.cs diff --git a/output/csharp/src/Seam/Model/ThermostatDailyProgram.cs b/src/Seam/Model/ThermostatDailyProgram.cs similarity index 100% rename from output/csharp/src/Seam/Model/ThermostatDailyProgram.cs rename to src/Seam/Model/ThermostatDailyProgram.cs diff --git a/output/csharp/src/Seam/Model/ThermostatSchedule.cs b/src/Seam/Model/ThermostatSchedule.cs similarity index 100% rename from output/csharp/src/Seam/Model/ThermostatSchedule.cs rename to src/Seam/Model/ThermostatSchedule.cs diff --git a/output/csharp/src/Seam/Model/UnmanagedAccessCode.cs b/src/Seam/Model/UnmanagedAccessCode.cs similarity index 100% rename from output/csharp/src/Seam/Model/UnmanagedAccessCode.cs rename to src/Seam/Model/UnmanagedAccessCode.cs diff --git a/output/csharp/src/Seam/Model/UnmanagedAccessGrant.cs b/src/Seam/Model/UnmanagedAccessGrant.cs similarity index 100% rename from output/csharp/src/Seam/Model/UnmanagedAccessGrant.cs rename to src/Seam/Model/UnmanagedAccessGrant.cs diff --git a/output/csharp/src/Seam/Model/UnmanagedAccessMethod.cs b/src/Seam/Model/UnmanagedAccessMethod.cs similarity index 100% rename from output/csharp/src/Seam/Model/UnmanagedAccessMethod.cs rename to src/Seam/Model/UnmanagedAccessMethod.cs diff --git a/output/csharp/src/Seam/Model/UnmanagedDevice.cs b/src/Seam/Model/UnmanagedDevice.cs similarity index 100% rename from output/csharp/src/Seam/Model/UnmanagedDevice.cs rename to src/Seam/Model/UnmanagedDevice.cs diff --git a/output/csharp/src/Seam/Model/UnmanagedUserIdentity.cs b/src/Seam/Model/UnmanagedUserIdentity.cs similarity index 100% rename from output/csharp/src/Seam/Model/UnmanagedUserIdentity.cs rename to src/Seam/Model/UnmanagedUserIdentity.cs diff --git a/output/csharp/src/Seam/Model/UserIdentity.cs b/src/Seam/Model/UserIdentity.cs similarity index 100% rename from output/csharp/src/Seam/Model/UserIdentity.cs rename to src/Seam/Model/UserIdentity.cs diff --git a/output/csharp/src/Seam/Model/Webhook.cs b/src/Seam/Model/Webhook.cs similarity index 100% rename from output/csharp/src/Seam/Model/Webhook.cs rename to src/Seam/Model/Webhook.cs diff --git a/output/csharp/src/Seam/Model/Workspace.cs b/src/Seam/Model/Workspace.cs similarity index 100% rename from output/csharp/src/Seam/Model/Workspace.cs rename to src/Seam/Model/Workspace.cs diff --git a/output/csharp/src/Seam/Seam.csproj b/src/Seam/Seam.csproj similarity index 94% rename from output/csharp/src/Seam/Seam.csproj rename to src/Seam/Seam.csproj index 8ad7bd57..08b53f1b 100644 --- a/output/csharp/src/Seam/Seam.csproj +++ b/src/Seam/Seam.csproj @@ -38,7 +38,7 @@ - + diff --git a/output/csharp/src/Seam/icon.png b/src/Seam/icon.png similarity index 100% rename from output/csharp/src/Seam/icon.png rename to src/Seam/icon.png From ac6b8276e91a5f2e8947890159468a1e395ae118 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 19 Aug 2026 06:53:17 +0000 Subject: [PATCH 2/5] refactor: move test project to top-level test/ Follow the conventional .NET layout of shippable code under src/ and test projects under a sibling test/ directory, rather than nesting the test project inside src/. - Move src/Seam.Test to test/Seam.Test. - Fix the test project's ProjectReference to reach src/Seam across the new directory boundary. - Update Seam.sln: repoint the Seam.Test project path and group it under a new "test" solution folder instead of "src". - Point the csharpier lint/format tasks at both ./src and ./test so the test sources are still covered. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01BYTZ1b713smMtpQ5UHrrbt --- Seam.sln | 6 ++++-- justfile | 4 ++-- {src => test}/Seam.Test/Client/ApiResponseTests.cs | 0 {src => test}/Seam.Test/Client/NullTests.cs | 0 {src => test}/Seam.Test/Client/RequestTransportTests.cs | 0 {src => test}/Seam.Test/Client/SeamTests.cs | 0 .../Client/StrictUrlSearchParamsSerializerTests.cs | 0 {src => test}/Seam.Test/Client/TimeoutTests.cs | 0 .../Seam.Test/Client/UrlSearchParamsSerializerTests.cs | 0 {src => test}/Seam.Test/Client/UrlSearchParamsTests.cs | 0 {src => test}/Seam.Test/GlobalUsings.cs | 0 {src => test}/Seam.Test/Seam.Test.csproj | 2 +- 12 files changed, 7 insertions(+), 5 deletions(-) rename {src => test}/Seam.Test/Client/ApiResponseTests.cs (100%) rename {src => test}/Seam.Test/Client/NullTests.cs (100%) rename {src => test}/Seam.Test/Client/RequestTransportTests.cs (100%) rename {src => test}/Seam.Test/Client/SeamTests.cs (100%) rename {src => test}/Seam.Test/Client/StrictUrlSearchParamsSerializerTests.cs (100%) rename {src => test}/Seam.Test/Client/TimeoutTests.cs (100%) rename {src => test}/Seam.Test/Client/UrlSearchParamsSerializerTests.cs (100%) rename {src => test}/Seam.Test/Client/UrlSearchParamsTests.cs (100%) rename {src => test}/Seam.Test/GlobalUsings.cs (100%) rename {src => test}/Seam.Test/Seam.Test.csproj (93%) diff --git a/Seam.sln b/Seam.sln index 9cf67046..cbc8d6ff 100644 --- a/Seam.sln +++ b/Seam.sln @@ -5,9 +5,11 @@ VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E1444EB3-69DB-4DC7-B1DA-798B74419077}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{7C2E8F1A-4B3D-4C5E-9A6F-1D2E3F4A5B6C}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Seam", "src\Seam\Seam.csproj", "{9A33E809-F95A-4E65-A9F8-145A49A16EBC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Seam.Test", "src\Seam.Test\Seam.Test.csproj", "{B6EDC1FF-9838-4997-B98E-62B768430DF3}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Seam.Test", "test\Seam.Test\Seam.Test.csproj", "{B6EDC1FF-9838-4997-B98E-62B768430DF3}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -29,6 +31,6 @@ Global EndGlobalSection GlobalSection(NestedProjects) = preSolution {9A33E809-F95A-4E65-A9F8-145A49A16EBC} = {E1444EB3-69DB-4DC7-B1DA-798B74419077} - {B6EDC1FF-9838-4997-B98E-62B768430DF3} = {E1444EB3-69DB-4DC7-B1DA-798B74419077} + {B6EDC1FF-9838-4997-B98E-62B768430DF3} = {7C2E8F1A-4B3D-4C5E-9A6F-1D2E3F4A5B6C} EndGlobalSection EndGlobal diff --git a/justfile b/justfile index 09d2f3c4..7e39b832 100644 --- a/justfile +++ b/justfile @@ -8,8 +8,8 @@ test framework="": # Lint lint: - dotnet csharpier --check ./src + dotnet csharpier --check ./src ./test # Format format: - dotnet csharpier ./src + dotnet csharpier ./src ./test diff --git a/src/Seam.Test/Client/ApiResponseTests.cs b/test/Seam.Test/Client/ApiResponseTests.cs similarity index 100% rename from src/Seam.Test/Client/ApiResponseTests.cs rename to test/Seam.Test/Client/ApiResponseTests.cs diff --git a/src/Seam.Test/Client/NullTests.cs b/test/Seam.Test/Client/NullTests.cs similarity index 100% rename from src/Seam.Test/Client/NullTests.cs rename to test/Seam.Test/Client/NullTests.cs diff --git a/src/Seam.Test/Client/RequestTransportTests.cs b/test/Seam.Test/Client/RequestTransportTests.cs similarity index 100% rename from src/Seam.Test/Client/RequestTransportTests.cs rename to test/Seam.Test/Client/RequestTransportTests.cs diff --git a/src/Seam.Test/Client/SeamTests.cs b/test/Seam.Test/Client/SeamTests.cs similarity index 100% rename from src/Seam.Test/Client/SeamTests.cs rename to test/Seam.Test/Client/SeamTests.cs diff --git a/src/Seam.Test/Client/StrictUrlSearchParamsSerializerTests.cs b/test/Seam.Test/Client/StrictUrlSearchParamsSerializerTests.cs similarity index 100% rename from src/Seam.Test/Client/StrictUrlSearchParamsSerializerTests.cs rename to test/Seam.Test/Client/StrictUrlSearchParamsSerializerTests.cs diff --git a/src/Seam.Test/Client/TimeoutTests.cs b/test/Seam.Test/Client/TimeoutTests.cs similarity index 100% rename from src/Seam.Test/Client/TimeoutTests.cs rename to test/Seam.Test/Client/TimeoutTests.cs diff --git a/src/Seam.Test/Client/UrlSearchParamsSerializerTests.cs b/test/Seam.Test/Client/UrlSearchParamsSerializerTests.cs similarity index 100% rename from src/Seam.Test/Client/UrlSearchParamsSerializerTests.cs rename to test/Seam.Test/Client/UrlSearchParamsSerializerTests.cs diff --git a/src/Seam.Test/Client/UrlSearchParamsTests.cs b/test/Seam.Test/Client/UrlSearchParamsTests.cs similarity index 100% rename from src/Seam.Test/Client/UrlSearchParamsTests.cs rename to test/Seam.Test/Client/UrlSearchParamsTests.cs diff --git a/src/Seam.Test/GlobalUsings.cs b/test/Seam.Test/GlobalUsings.cs similarity index 100% rename from src/Seam.Test/GlobalUsings.cs rename to test/Seam.Test/GlobalUsings.cs diff --git a/src/Seam.Test/Seam.Test.csproj b/test/Seam.Test/Seam.Test.csproj similarity index 93% rename from src/Seam.Test/Seam.Test.csproj rename to test/Seam.Test/Seam.Test.csproj index 6f275428..05858056 100644 --- a/src/Seam.Test/Seam.Test.csproj +++ b/test/Seam.Test/Seam.Test.csproj @@ -23,7 +23,7 @@ - + From 1d389c6a4201a43ec353a9e2c7aeadccb9d944a5 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 19 Aug 2026 07:03:29 +0000 Subject: [PATCH 3/5] refactor: inject SDK version via the version hook, not postgenerate Align version injection with the sibling SDK repos (php, ruby, python), where the package manifest is a committed source file and the version is injected surgically at release time rather than by regenerating a file during postgenerate. Previously three scripts were entangled: postgenerate.ts and version.ts both regenerated the entire Seam.csproj via generate-csproj.ts to inject the version, folding a release-time concern into every codegen run. Following the php repo's pattern (its closest analog, sharing the npm version/postversion lifecycle scripts): - Rewrite codegen/version.ts to replace only the element of the committed Seam.csproj with a regex, then stage it. This runs from the npm version lifecycle script, so the bump lands in the tagged commit. - Treat Seam.csproj as committed static source: drop generate-csproj.ts and the generate:csproj script, and stop marking the csproj linguist-generated. Add a note on the element that it is injected, not hand-edited. - Make postgenerate format-only: "dotnet tool restore && just format", matching the python repo's "just format" postgenerate. The tool restore is retained because the generate workflow runs with dependency install disabled. Removes postgenerate.ts. - Update the README publishing note to describe the injection. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01BYTZ1b713smMtpQ5UHrrbt --- .gitattributes | 1 - README.md | 13 ++++--- codegen/generate-csproj.ts | 70 -------------------------------------- codegen/postgenerate.ts | 7 ---- codegen/version.ts | 38 +++++++++++++-------- src/Seam/Seam.csproj | 2 ++ 6 files changed, 32 insertions(+), 99 deletions(-) delete mode 100644 codegen/generate-csproj.ts delete mode 100644 codegen/postgenerate.ts diff --git a/.gitattributes b/.gitattributes index 9ba231c0..90a9845d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,7 +2,6 @@ src/Seam/Api/** linguist-generated src/Seam/Model/** linguist-generated -src/Seam/Seam.csproj linguist-generated # Static, schema-independent sources kept alongside the generated code. diff --git a/README.md b/README.md index b6fecc85..e0cbb43f 100644 --- a/README.md +++ b/README.md @@ -199,7 +199,7 @@ and dispatches the [Version](.github/workflows/version.yml) workflow. Run the [Version](.github/workflows/version.yml) workflow with the version to cut. It runs `npm version`, which bumps the `version` field in `package.json`, -regenerates `Seam.csproj` with that version, creates a signed `v*` git tag +injects that version into `Seam.csproj`, creates a signed `v*` git tag and pushes it. Pushing the tag triggers the [Publish](.github/workflows/publish.yml) workflow, which packs the library with `dotnet pack` and pushes the @@ -207,12 +207,11 @@ package to [NuGet](https://www.nuget.org/packages/Seam) and GitHub Packages. > The version lives in `package.json`, the development manifest that -> drives the codegen, and is injected into `Seam.csproj` by -> `codegen/generate-csproj.ts`. -> The injection runs from `codegen/version.ts`, wired to the `version` -> lifecycle script, which npm runs after the bump but before the commit, -> so the updated project file is part of the tagged commit and MSBuild -> surfaces the version at runtime through +> drives the codegen. +> `codegen/version.ts`, wired to the `version` lifecycle script, injects it +> into the `` element of `Seam.csproj`, which npm runs after the +> bump but before the commit, so the updated project file is part of the +> tagged commit and MSBuild surfaces the version at runtime through > `AssemblyInformationalVersionAttribute`. > Never edit the version in `Seam.csproj` by hand. diff --git a/codegen/generate-csproj.ts b/codegen/generate-csproj.ts deleted file mode 100644 index e300c53a..00000000 --- a/codegen/generate-csproj.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { readFileSync, writeFileSync } from 'node:fs' - -const { version } = JSON.parse( - readFileSync(new URL('../package.json', import.meta.url), 'utf-8'), -) - -export const csprojTemplate = (version: string, dotNetVersions: string[]) => - ` - - - - ${dotNetVersions - .map((v) => `net${v}`) - .join(';')} - enable - annotations - - Seam - - ${version} - - Seam Labs, Inc. - - Seam - - SDK for the Seam API written in C#. - - Copyright (c) 2021-2026 Seam Labs, Inc. - - seam;api;iot - - MIT - - README.md - - icon.png - - https://github.com/seamapi/csharp - - https://github.com/seamapi/csharp - - git - - true - - $(NoWarn);CS1591 - - - - - - - - - - - - - - -`.trim() - -const main = async () => { - writeFileSync( - './src/Seam/Seam.csproj', - csprojTemplate(version, ['8.0', '10.0']), - ) -} - -main() diff --git a/codegen/postgenerate.ts b/codegen/postgenerate.ts deleted file mode 100644 index eb565f95..00000000 --- a/codegen/postgenerate.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { $ } from 'execa' - -const run = $({ stdio: 'inherit' }) - -await run`tsx codegen/generate-csproj.ts` -await run`dotnet tool restore` -await run`dotnet csharpier ./src` diff --git a/codegen/version.ts b/codegen/version.ts index d5b39289..50994873 100644 --- a/codegen/version.ts +++ b/codegen/version.ts @@ -1,33 +1,43 @@ -import { readFile } from 'node:fs/promises' +import { readFile, writeFile } from 'node:fs/promises' import { fileURLToPath } from 'node:url' import { $ } from 'execa' -const csprojFile = './src/Seam/Seam.csproj' +const versionFile = './src/Seam/Seam.csproj' + +const versionPattern = /[^<]*<\/Version>/ const main = async (): Promise => { + const version = await injectVersion( + fileURLToPath(new URL(`../${versionFile}`, import.meta.url)), + ) + // eslint-disable-next-line no-console + console.log(`✓ Version ${version} injected into ${versionFile}`) + + const { command } = await $`git add ${versionFile}` + // eslint-disable-next-line no-console + console.log(`✓ Staged with '${command}'`) +} + +const injectVersion = async (path: string): Promise => { const { version } = await readPackageJson() if (version == null) { throw new Error('Missing version in package.json') } - await $({ stdio: 'inherit' })`tsx codegen/generate-csproj.ts` - - const data = await readFile( - fileURLToPath(new URL(`../${csprojFile}`, import.meta.url)), - ) + const data = (await readFile(path)).toString() - if (!data.toString().includes(`${version}`)) { - throw new Error(`Could not find version ${version} in ${csprojFile}`) + if (!versionPattern.test(data)) { + throw new Error(`Could not find the version element in ${versionFile}`) } - // eslint-disable-next-line no-console - console.log(`✓ Version ${version} injected into ${csprojFile}`) + await writeFile( + path, + data.replace(versionPattern, `${version}`), + ) - const { command } = await $`git add ${csprojFile}` - // eslint-disable-next-line no-console - console.log(`✓ Staged with '${command}'`) + return version } const readPackageJson = async (): Promise<{ version?: string }> => { diff --git a/src/Seam/Seam.csproj b/src/Seam/Seam.csproj index 08b53f1b..7c22047d 100644 --- a/src/Seam/Seam.csproj +++ b/src/Seam/Seam.csproj @@ -7,6 +7,8 @@ Seam + 1.3.0 Seam Labs, Inc. From cd0dd6f45eb2b1758df5480234361321c57d178d Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 19 Aug 2026 07:21:21 +0000 Subject: [PATCH 4/5] refactor: move version.ts to the repository root The version lifecycle script is the npm `version` hook, run by `npm version` from the repository root, so its script belongs at the root alongside package.json, matching the sibling SDK repos (php, ruby, python). - Move codegen/version.ts to version.ts and resolve package.json and the csproj relative to the repository root. - Point the npm `version` script at ./version.ts. - Add version.ts to the tsconfig include set, as the php repo does. - Update the README reference. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01BYTZ1b713smMtpQ5UHrrbt --- README.md | 2 +- package.json | 2 +- tsconfig.json | 2 +- codegen/version.ts => version.ts | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) rename codegen/version.ts => version.ts (90%) diff --git a/README.md b/README.md index e0cbb43f..f1c18324 100644 --- a/README.md +++ b/README.md @@ -208,7 +208,7 @@ Packages. > The version lives in `package.json`, the development manifest that > drives the codegen. -> `codegen/version.ts`, wired to the `version` lifecycle script, injects it +> `version.ts`, wired to the `version` lifecycle script, injects it > into the `` element of `Seam.csproj`, which npm runs after the > bump but before the commit, so the updated project file is part of the > tagged commit and MSBuild surfaces the version at runtime through diff --git a/package.json b/package.json index 29620e2e..a71b7f17 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "private": true, "license": "MIT", "scripts": { - "version": "tsx codegen/version.ts", + "version": "tsx ./version.ts", "postversion": "git push --follow-tags", "generate": "tsx codegen/smith.ts", "postgenerate": "tsx codegen/postgenerate.ts", diff --git a/tsconfig.json b/tsconfig.json index 6190bfbf..c3d380f1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,5 +2,5 @@ "$schema": "https://json.schemastore.org/tsconfig.json", "extends": "./node_modules/@seamapi/smith/tsconfig.base.json", "files": ["codegen/index.ts"], - "include": ["codegen/**/*", "eslint.config.ts"] + "include": ["codegen/**/*", "eslint.config.ts", "version.ts"] } diff --git a/codegen/version.ts b/version.ts similarity index 90% rename from codegen/version.ts rename to version.ts index 50994873..b63abae2 100644 --- a/codegen/version.ts +++ b/version.ts @@ -9,7 +9,7 @@ const versionPattern = /[^<]*<\/Version>/ const main = async (): Promise => { const version = await injectVersion( - fileURLToPath(new URL(`../${versionFile}`, import.meta.url)), + fileURLToPath(new URL(versionFile, import.meta.url)), ) // eslint-disable-next-line no-console console.log(`✓ Version ${version} injected into ${versionFile}`) @@ -42,7 +42,7 @@ const injectVersion = async (path: string): Promise => { const readPackageJson = async (): Promise<{ version?: string }> => { const pkgBuff = await readFile( - fileURLToPath(new URL('../package.json', import.meta.url)), + fileURLToPath(new URL('package.json', import.meta.url)), ) return JSON.parse(pkgBuff.toString()) } From e3ef4d6ae5c4c6e074b850615df9aa4a23477eaa Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 19 Aug 2026 08:01:06 +0000 Subject: [PATCH 5/5] fix: repair postgenerate script and keep it format-only The earlier version-injection commit deleted codegen/postgenerate.ts and codegen/generate-csproj.ts but, due to a botched working-tree restore, left package.json still pointing its postgenerate and generate:csproj scripts at those now-deleted files, which would break `npm run generate`. Set postgenerate to `just format` and drop the generate:csproj script, matching the sibling repos where formatting is the npm postgenerate hook (python: `just format`) and the Smith pipeline stays codegen-only. Restore the formatter's tooling with an explicit `dotnet tool restore` step in the generate workflow, before `npm run generate`, mirroring the python repo's `uv sync` step. The generate workflow sets up .NET but runs with dependency install disabled, so the tools are otherwise unavailable to the postgenerate format step. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01BYTZ1b713smMtpQ5UHrrbt --- .github/workflows/generate.yml | 2 ++ package.json | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 255dd128..7ef8ead3 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -37,6 +37,8 @@ jobs: install_dependencies: 'false' - name: Normalize package-lock.json run: npm install + - name: Restore tools + run: dotnet tool restore - name: Generate code run: npm run generate - name: Commit diff --git a/package.json b/package.json index a71b7f17..1f972e7b 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,7 @@ "version": "tsx ./version.ts", "postversion": "git push --follow-tags", "generate": "tsx codegen/smith.ts", - "postgenerate": "tsx codegen/postgenerate.ts", - "generate:csproj": "tsx codegen/generate-csproj.ts", + "postgenerate": "just format", "typecheck": "tsc", "lint": "eslint .", "postlint": "prettier --check --ignore-path .gitignore --ignore-path .prettierignore .",