From 69c24fcd8f1048ce7f29a938979a680e33020cf1 Mon Sep 17 00:00:00 2001 From: Guy Ben-Aharon Date: Sat, 21 Feb 2026 18:58:08 +0200 Subject: [PATCH 1/3] fix: watcher image --- apps/watcher/Dockerfile | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/apps/watcher/Dockerfile b/apps/watcher/Dockerfile index 202f483..c281d40 100644 --- a/apps/watcher/Dockerfile +++ b/apps/watcher/Dockerfile @@ -1,35 +1,31 @@ -FROM node:22-slim AS build - +FROM node:22-slim AS base +RUN corepack enable && corepack prepare pnpm@9.0.0 --activate WORKDIR /app -# Copy monorepo root files -COPY pnpm-lock.yaml pnpm-workspace.yaml package.json .npmrc* ./ - -# Copy workspace package manifests -COPY apps/watcher/package.json ./apps/watcher/ -COPY packages/shared/package.json ./packages/shared/ -COPY packages/backend/package.json ./packages/backend/ +# Prune monorepo to only watcher's dependencies +FROM base AS pruner +COPY . . +RUN pnpm dlx turbo prune @clawe/watcher --docker -# Install pnpm and fetch dependencies -RUN corepack enable && corepack prepare pnpm@latest --activate +# Install dependencies (cached unless package.json/lockfile changes) +FROM base AS deps +COPY --from=pruner /app/out/json/ . RUN pnpm install --frozen-lockfile -# Copy source and build -COPY packages/shared/ ./packages/shared/ -COPY packages/backend/ ./packages/backend/ -COPY apps/watcher/ ./apps/watcher/ +# Build the app +FROM base AS builder +COPY --from=deps /app/ . +COPY --from=pruner /app/out/full/ . RUN pnpm build --filter=@clawe/watcher -# Deploy: extract watcher with all production deps into /app/deploy +# Extract watcher with production deps only RUN pnpm --filter=@clawe/watcher --prod deploy deploy -# --- Production image --- +# Production runner FROM node:22-slim - WORKDIR /app - -COPY --from=build /app/deploy . - ENV NODE_ENV=production +COPY --from=builder /app/deploy . + CMD ["node", "dist/index.js"] From f08d76484b210e1677d62ad2934e594129e8468f Mon Sep 17 00:00:00 2001 From: Guy Ben-Aharon Date: Sat, 21 Feb 2026 19:44:11 +0200 Subject: [PATCH 2/3] fix --- apps/watcher/eslint.config.mjs | 4 + apps/watcher/package.json | 5 ++ packages/backend/package.json | 1 + packages/eslint-config/node.js | 5 ++ packages/eslint-config/package.json | 1 + packages/shared/package.json | 1 + packages/shared/src/squadhub/client.ts | 2 +- .../shared/src/squadhub/gateway-client.ts | 2 +- packages/shared/src/squadhub/index.ts | 14 ++-- packages/shared/src/squadhub/shared-client.ts | 6 +- packages/shared/tsconfig.json | 2 - pnpm-lock.yaml | 76 +++++++++++++++++++ 12 files changed, 105 insertions(+), 14 deletions(-) create mode 100644 apps/watcher/eslint.config.mjs diff --git a/apps/watcher/eslint.config.mjs b/apps/watcher/eslint.config.mjs new file mode 100644 index 0000000..77b0bb5 --- /dev/null +++ b/apps/watcher/eslint.config.mjs @@ -0,0 +1,4 @@ +import { nodeConfig } from "@clawe/eslint-config/node"; + +/** @type {import("eslint").Linter.Config} */ +export default nodeConfig; diff --git a/apps/watcher/package.json b/apps/watcher/package.json index c810a66..9aa807c 100644 --- a/apps/watcher/package.json +++ b/apps/watcher/package.json @@ -3,10 +3,13 @@ "version": "0.1.0", "private": true, "type": "module", + "files": ["dist"], "scripts": { "dev": "tsx watch src/index.ts", "start": "node dist/index.js", "build": "tsc", + "lint": "eslint . --max-warnings 0", + "lint:fix": "eslint . --fix --max-warnings 0", "check-types": "tsc --noEmit", "test": "vitest run", "test:watch": "vitest" @@ -17,7 +20,9 @@ "convex": "^1.21.0" }, "devDependencies": { + "@clawe/eslint-config": "workspace:*", "@clawe/typescript-config": "workspace:*", + "eslint": "^9.39.1", "@types/node": "^22.0.0", "tsx": "^4.19.0", "typescript": "5.9.2", diff --git a/packages/backend/package.json b/packages/backend/package.json index 224396c..eb0b78e 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -3,6 +3,7 @@ "version": "0.1.0", "private": true, "type": "module", + "files": ["convex"], "exports": { ".": { "types": "./convex/_generated/api.d.ts", diff --git a/packages/eslint-config/node.js b/packages/eslint-config/node.js index 2642062..75dc67f 100644 --- a/packages/eslint-config/node.js +++ b/packages/eslint-config/node.js @@ -1,4 +1,5 @@ import globals from "globals"; +import nodePlugin from "eslint-plugin-n"; import { config as baseConfig } from "./base.js"; /** @@ -9,11 +10,15 @@ import { config as baseConfig } from "./base.js"; export const nodeConfig = [ ...baseConfig, { + plugins: { n: nodePlugin }, languageOptions: { globals: { ...globals.node, }, }, + rules: { + "n/file-extension-in-import": ["error", "always"], + }, }, { ignores: ["dist/**"], diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index 84a80f7..73476f5 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -14,6 +14,7 @@ "@next/eslint-plugin-next": "^15.5.0", "eslint": "^9.39.1", "eslint-config-prettier": "^10.1.1", + "eslint-plugin-n": "^17.24.0", "eslint-plugin-only-warn": "^1.1.0", "eslint-plugin-react": "^7.37.5", "eslint-plugin-react-hooks": "^5.2.0", diff --git a/packages/shared/package.json b/packages/shared/package.json index d2af38f..b45bc4f 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -3,6 +3,7 @@ "version": "0.1.0", "private": true, "type": "module", + "files": ["dist"], "exports": { "./squadhub": { "types": "./dist/squadhub/index.d.ts", diff --git a/packages/shared/src/squadhub/client.ts b/packages/shared/src/squadhub/client.ts index 9416f25..679c6fa 100644 --- a/packages/shared/src/squadhub/client.ts +++ b/packages/shared/src/squadhub/client.ts @@ -7,7 +7,7 @@ import type { GatewayHealthResult, TelegramProbeResult, PairingRequest, -} from "./types"; +} from "./types.js"; export type SquadhubConnection = { squadhubUrl: string; diff --git a/packages/shared/src/squadhub/gateway-client.ts b/packages/shared/src/squadhub/gateway-client.ts index f99db98..3e81474 100644 --- a/packages/shared/src/squadhub/gateway-client.ts +++ b/packages/shared/src/squadhub/gateway-client.ts @@ -5,7 +5,7 @@ import type { ConnectParams, HelloOkResponse, ChatEvent, -} from "./gateway-types"; +} from "./gateway-types.js"; type PendingRequest = { resolve: (value: unknown) => void; diff --git a/packages/shared/src/squadhub/index.ts b/packages/shared/src/squadhub/index.ts index 6832bbc..f236504 100644 --- a/packages/shared/src/squadhub/index.ts +++ b/packages/shared/src/squadhub/index.ts @@ -14,7 +14,7 @@ export { listPairingRequests, approvePairingCode, parseToolText, -} from "./client"; +} from "./client.js"; export type { SquadhubConnection, CronJob, @@ -27,12 +27,12 @@ export type { CronDelivery, CronPayload, CronJobState, -} from "./client"; +} from "./client.js"; // Gateway Client -export { GatewayClient, createGatewayClient } from "./gateway-client"; -export type { GatewayClientOptions } from "./gateway-client"; -export { getSharedClient } from "./shared-client"; +export { GatewayClient, createGatewayClient } from "./gateway-client.js"; +export type { GatewayClientOptions } from "./gateway-client.js"; +export { getSharedClient } from "./shared-client.js"; // Types export type { @@ -46,7 +46,7 @@ export type { GatewayHealthResult, TelegramProbeResult, PairingRequest, -} from "./types"; +} from "./types.js"; // Gateway Types export type { @@ -75,4 +75,4 @@ export type { ChatHistoryResponse, SSEEventType, SSEEvent, -} from "./gateway-types"; +} from "./gateway-types.js"; diff --git a/packages/shared/src/squadhub/shared-client.ts b/packages/shared/src/squadhub/shared-client.ts index 4bb0895..043c5b1 100644 --- a/packages/shared/src/squadhub/shared-client.ts +++ b/packages/shared/src/squadhub/shared-client.ts @@ -1,6 +1,6 @@ -import { GatewayClient, createGatewayClient } from "./gateway-client"; -import type { GatewayClientOptions } from "./gateway-client"; -import type { SquadhubConnection } from "./client"; +import { GatewayClient, createGatewayClient } from "./gateway-client.js"; +import type { GatewayClientOptions } from "./gateway-client.js"; +import type { SquadhubConnection } from "./client.js"; let sharedClient: GatewayClient | null = null; let connectingPromise: Promise | null = null; diff --git a/packages/shared/tsconfig.json b/packages/shared/tsconfig.json index 5bb6f44..3a3886c 100644 --- a/packages/shared/tsconfig.json +++ b/packages/shared/tsconfig.json @@ -1,8 +1,6 @@ { "extends": "@clawe/typescript-config/base.json", "compilerOptions": { - "module": "ESNext", - "moduleResolution": "bundler", "types": ["node"], "rootDir": "./src", "outDir": "./dist", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b1afa95..f39cd8e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -36,12 +36,18 @@ importers: specifier: ^1.21.0 version: 1.31.7(react@19.2.0) devDependencies: + '@clawe/eslint-config': + specifier: workspace:* + version: link:../../packages/eslint-config '@clawe/typescript-config': specifier: workspace:* version: link:../../packages/typescript-config '@types/node': specifier: ^22.0.0 version: 22.15.3 + eslint: + specifier: ^9.39.1 + version: 9.39.1(jiti@2.6.1) tsx: specifier: ^4.19.0 version: 4.21.0 @@ -270,6 +276,9 @@ importers: eslint-config-prettier: specifier: ^10.1.1 version: 10.1.1(eslint@9.39.1(jiti@2.6.1)) + eslint-plugin-n: + specifier: ^17.24.0 + version: 17.24.0(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.2) eslint-plugin-only-warn: specifier: ^1.1.0 version: 1.1.0 @@ -3444,12 +3453,30 @@ packages: resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==} engines: {node: '>=12'} + eslint-compat-utils@0.5.1: + resolution: {integrity: sha512-3z3vFexKIEnjHE3zCMRo6fn/e44U7T1khUjg+Hp0ZQMCigh28rALD0nPFBcGZuiLC5rLZa2ubQHDRln09JfU2Q==} + engines: {node: '>=12'} + peerDependencies: + eslint: '>=6.0.0' + eslint-config-prettier@10.1.1: resolution: {integrity: sha512-4EQQr6wXwS+ZJSzaR5ZCrYgLxqvUjdXctaEtBqHcbkW944B1NQyO4qpdHQbXBONfwxXdkAY81HH4+LUfrg+zPw==} hasBin: true peerDependencies: eslint: '>=7.0.0' + eslint-plugin-es-x@7.8.0: + resolution: {integrity: sha512-7Ds8+wAAoV3T+LAKeu39Y5BzXCrGKrcISfgKEqTS4BDN8SFEDQd0S43jiQ8vIa3wUKD07qitZdfzlenSi8/0qQ==} + engines: {node: ^14.18.0 || >=16.0.0} + peerDependencies: + eslint: '>=8' + + eslint-plugin-n@17.24.0: + resolution: {integrity: sha512-/gC7/KAYmfNnPNOb3eu8vw+TdVnV0zhdQwexsw6FLXbhzroVj20vRn2qL8lDWDGnAQ2J8DhdfvXxX9EoxvERvw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: '>=8.23.0' + eslint-plugin-only-warn@1.1.0: resolution: {integrity: sha512-2tktqUAT+Q3hCAU0iSf4xAN1k9zOpjK5WO8104mB0rT/dGhOa09582HN5HlbxNbPRZ0THV7nLGvzugcNOSjzfA==} engines: {node: '>=6'} @@ -3671,6 +3698,10 @@ packages: resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} engines: {node: '>=18'} + globals@15.15.0: + resolution: {integrity: sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==} + engines: {node: '>=18'} + globals@16.5.0: resolution: {integrity: sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==} engines: {node: '>=18'} @@ -3679,6 +3710,9 @@ packages: resolution: {integrity: sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==} engines: {node: '>= 0.4'} + globrex@0.1.2: + resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==} + gopd@1.2.0: resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} engines: {node: '>= 0.4'} @@ -4814,6 +4848,7 @@ packages: semver@7.7.3: resolution: {integrity: sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==} engines: {node: '>=10'} + hasBin: true set-function-length@1.2.2: resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} @@ -5038,6 +5073,11 @@ packages: peerDependencies: typescript: '>=4.8.4' + ts-declaration-location@1.0.7: + resolution: {integrity: sha512-EDyGAwH1gO0Ausm9gV6T2nUvBgXT5kGoCMJPllOaooZ+4VvJiKBdZE7wK18N1deEowhcUptS+5GXZK8U/fvpwA==} + peerDependencies: + typescript: '>=4.0.0' + ts-interface-checker@0.1.13: resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} @@ -8921,10 +8961,37 @@ snapshots: escape-string-regexp@5.0.0: {} + eslint-compat-utils@0.5.1(eslint@9.39.1(jiti@2.6.1)): + dependencies: + eslint: 9.39.1(jiti@2.6.1) + semver: 7.7.3 + eslint-config-prettier@10.1.1(eslint@9.39.1(jiti@2.6.1)): dependencies: eslint: 9.39.1(jiti@2.6.1) + eslint-plugin-es-x@7.8.0(eslint@9.39.1(jiti@2.6.1)): + dependencies: + '@eslint-community/eslint-utils': 4.9.0(eslint@9.39.1(jiti@2.6.1)) + '@eslint-community/regexpp': 4.12.2 + eslint: 9.39.1(jiti@2.6.1) + eslint-compat-utils: 0.5.1(eslint@9.39.1(jiti@2.6.1)) + + eslint-plugin-n@17.24.0(eslint@9.39.1(jiti@2.6.1))(typescript@5.9.2): + dependencies: + '@eslint-community/eslint-utils': 4.9.0(eslint@9.39.1(jiti@2.6.1)) + enhanced-resolve: 5.18.4 + eslint: 9.39.1(jiti@2.6.1) + eslint-plugin-es-x: 7.8.0(eslint@9.39.1(jiti@2.6.1)) + get-tsconfig: 4.13.6 + globals: 15.15.0 + globrex: 0.1.2 + ignore: 5.3.2 + semver: 7.7.3 + ts-declaration-location: 1.0.7(typescript@5.9.2) + transitivePeerDependencies: + - typescript + eslint-plugin-only-warn@1.1.0: {} eslint-plugin-react-hooks@5.2.0(eslint@9.39.1(jiti@2.6.1)): @@ -9178,6 +9245,8 @@ snapshots: globals@14.0.0: {} + globals@15.15.0: {} + globals@16.5.0: {} globalthis@1.0.4: @@ -9185,6 +9254,8 @@ snapshots: define-properties: 1.2.1 gopd: 1.2.0 + globrex@0.1.2: {} + gopd@1.2.0: {} graceful-fs@4.2.11: {} @@ -10911,6 +10982,11 @@ snapshots: dependencies: typescript: 5.9.2 + ts-declaration-location@1.0.7(typescript@5.9.2): + dependencies: + picomatch: 4.0.3 + typescript: 5.9.2 + ts-interface-checker@0.1.13: {} tslib@2.8.1: {} From a10339dd01d9e72c77f02177bfb758c74f8d361c Mon Sep 17 00:00:00 2001 From: Guy Ben-Aharon Date: Sat, 21 Feb 2026 19:47:43 +0200 Subject: [PATCH 3/3] fix --- apps/watcher/package.json | 4 +++- packages/backend/package.json | 4 +++- packages/shared/package.json | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/watcher/package.json b/apps/watcher/package.json index 9aa807c..8efb2e9 100644 --- a/apps/watcher/package.json +++ b/apps/watcher/package.json @@ -3,7 +3,9 @@ "version": "0.1.0", "private": true, "type": "module", - "files": ["dist"], + "files": [ + "dist" + ], "scripts": { "dev": "tsx watch src/index.ts", "start": "node dist/index.js", diff --git a/packages/backend/package.json b/packages/backend/package.json index eb0b78e..a4d11be 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -3,7 +3,9 @@ "version": "0.1.0", "private": true, "type": "module", - "files": ["convex"], + "files": [ + "convex" + ], "exports": { ".": { "types": "./convex/_generated/api.d.ts", diff --git a/packages/shared/package.json b/packages/shared/package.json index b45bc4f..295a9ac 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -3,7 +3,9 @@ "version": "0.1.0", "private": true, "type": "module", - "files": ["dist"], + "files": [ + "dist" + ], "exports": { "./squadhub": { "types": "./dist/squadhub/index.d.ts",