diff --git a/.cursor/rules/general.mdc b/.cursor/rules/general.mdc index 812edd6b..7dc752d4 100644 --- a/.cursor/rules/general.mdc +++ b/.cursor/rules/general.mdc @@ -1,6 +1,6 @@ --- -description: -globs: +description: +globs: alwaysApply: false --- --- @@ -38,23 +38,14 @@ All packages must follow these `package.json` rules: - `type` must be set to `module` -#### Directory Structure - -This project has the following structure: - -- A `src/` directory containing the core source code. -- A single entrypoint in index.ts that exports the package's public API. -- Place test helpers, utilities, or mocks in `src/test/` with a single entrypoint in `src/test/index.ts`. -- Tests should be placed beside source code like `src/my-file.ts` and `src/my-file.test.ts` (NOT `src/test/my-file.test.ts` or `test/my-file.test.ts`). - ## TypeScript - Avoid semicolons at the end of lines - Use TypeScript's utility types (e.g., `Partial`, `Pick`, `Omit`) to manipulate existing types - Create custom types for complex data structures used throughout the application -- If possible, avoid using `any`/`unknown` or casting values like `(value as any)` or `value!` in TypeScript outside of test files e.g. `*.test.ts` or test fixtures e.g. `**/test-data.ts`. +- If possible, avoid using `any`/`unknown` or casting values like `(value as any)` in TypeScript outside of test files e.g. `*.test.ts` or test fixtures e.g. `**/test-data.ts`. - Don't rely on `typeof`, `ReturnType<>`, `Awaited<>`, etc for complex type inference (it's ok for simple types) -- Use `as const` for better type inference +- You can use `as const` as needed for better type inference - Functions should accept an object parameter instead of multiple parameters - Good examples: ```ts @@ -77,8 +68,8 @@ This project has the following structure: } ``` - Zod should be used to parse untrusted data, but not for data that is trusted like function arguments -- Zod unions should always be used instead of enums - - For example, this union `z.union([z.literal('youtube'), z.literal('spotify')])` is better than this enum `z.enum(['youtube', 'spotify'])` +- Prefer Zod unions over Zod enums + - For example, this union `z.union([ z.literal('youtube'), z.literal('spotify') ])` is better than this enum `z.enum([ 'youtube', 'spotify' ])` - Promises (and `async` functions which implicitly create Promises) must always be properly handled, either via: - Using `await` to wait for the Promise to resolve successfully - Using `.then` or `.catch` to handle Promise resolution diff --git a/packages/api-client/package.json b/packages/api-client/package.json index 9e2511e5..cb3a1aa0 100644 --- a/packages/api-client/package.json +++ b/packages/api-client/package.json @@ -1,7 +1,7 @@ { "name": "@agentic/platform-api-client", "version": "0.0.1", - "description": "Core utilities for the Agentic platform.", + "description": "TS API client for the Agentic platform.", "author": "Travis Fischer ", "license": "UNLICENSED", "repository": { @@ -20,8 +20,7 @@ "generate": "openapi-typescript http://localhost:3000/docs --output ./src/openapi.d.ts", "test": "run-s test:*", "test:lint": "eslint .", - "test:typecheck": "tsc --noEmit", - "test:unit": "vitest run" + "test:typecheck": "tsc --noEmit" }, "dependencies": { "@agentic/platform-core": "workspace:*", diff --git a/packages/api-client/src/types.ts b/packages/api-client/src/types.ts index c18360ff..ba117888 100644 --- a/packages/api-client/src/types.ts +++ b/packages/api-client/src/types.ts @@ -1,7 +1,28 @@ import type { components } from './openapi' -export type AuthProvider = components['schemas']['AuthProvider'] -export type AuthProviders = components['schemas']['AuthProviders'] +export type Consumer = components['schemas']['Consumer'] +export type Project = components['schemas']['Project'] +export type Deployment = components['schemas']['Deployment'] export type User = components['schemas']['User'] export type Team = components['schemas']['Team'] export type TeamMember = components['schemas']['TeamMember'] + +export type AuthProviderType = components['schemas']['AuthProviderType'] +export type AuthProvider = components['schemas']['AuthProvider'] +export type AuthProviders = components['schemas']['AuthProviders'] + +export type ProjectIdentifier = components['schemas']['ProjectIdentifier'] +export type DeploymentIdentifier = components['schemas']['DeploymentIdentifier'] + +export type DeploymentOriginAdapter = + components['schemas']['DeploymentOriginAdapter'] + +export type RateLimit = components['schemas']['RateLimit'] +export type PricingInterval = components['schemas']['PricingInterval'] +export type PricingPlanTier = components['schemas']['PricingPlanTier'] +export type PricingPlanLineItem = components['schemas']['PricingPlanLineItem'] +export type PricingPlan = components['schemas']['PricingPlan'] + +export type PricingPlanName = components['schemas']['name'] +export type PricingPlanSlug = components['schemas']['slug'] +export type PricingPlanLabel = components['schemas']['label'] diff --git a/packages/cli/package.json b/packages/cli/package.json index 78ff6fcf..97586c99 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -28,6 +28,7 @@ }, "dependencies": { "@agentic/platform-core": "workspace:*", + "@agentic/platform-api-client": "workspace:*", "commander": "^14.0.0", "conf": "^13.1.0", "ora": "^8.2.0", diff --git a/packages/cli/src/store.ts b/packages/cli/src/store.ts index 04fa93eb..c0f1bfe9 100644 --- a/packages/cli/src/store.ts +++ b/packages/cli/src/store.ts @@ -1,4 +1,4 @@ -import type { User } from '@agentic/platform-db' +import type { User } from '@agentic/platform-api-client' import { assert } from '@agentic/platform-core' import Conf from 'conf' diff --git a/packages/db/package.json b/packages/db/package.json index a46f1dfa..f2be8cbd 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -1,5 +1,6 @@ { "name": "@agentic/platform-db", + "private": true, "version": "0.0.1", "description": "Postgres database schemas and types for the Agentic platform using Drizzle as the ORM.", "author": "Travis Fischer ", @@ -36,8 +37,5 @@ "postgres": "^3.4.5", "type-fest": "catalog:", "zod": "catalog:" - }, - "publishConfig": { - "access": "public" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4a319283..10ee3abb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -220,6 +220,9 @@ importers: packages/cli: dependencies: + '@agentic/platform-api-client': + specifier: workspace:* + version: link:../api-client '@agentic/platform-core': specifier: workspace:* version: link:../core diff --git a/readme.md b/readme.md index c64d7253..13ebfe14 100644 --- a/readme.md +++ b/readme.md @@ -7,13 +7,6 @@ ## TODO -- **replace Project.id and Deployment.id with cuids** - - move others to `alias` or `publicIdentifier`? - - won't work with hono routing? test this -- add prefixes to model ids - ---- - - stripe - re-add coupons - declarative json-based pricing