@1aboveio/app-dev-skills 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -2
- package/package.json +34 -4
- package/skills/airflow/LICENSE +3 -0
- package/skills/airflow/SKILL.md +199 -0
- package/skills/airflow/release-check.mjs +93 -0
- package/skills/android-foundation/LICENSE +3 -0
- package/skills/android-foundation/SKILL.md +192 -0
- package/skills/android-foundation/assets/android-ci-job.yml +217 -0
- package/skills/android-foundation/references/ci.md +87 -0
- package/skills/android-foundation/references/gotchas.md +221 -0
- package/skills/android-foundation/references/setup.md +164 -0
- package/skills/android-foundation/release-check.mjs +93 -0
- package/skills/android-foundation/scripts/device-run.sh +176 -0
- package/skills/android-foundation/scripts/device-run.test.mjs +172 -0
- package/skills/app-debug/LICENSE +3 -0
- package/skills/app-debug/SKILL.md +110 -0
- package/skills/app-debug/references/common-errors.md +128 -0
- package/skills/app-debug/release-check.mjs +93 -0
- package/skills/better-auth/LICENSE +3 -0
- package/skills/better-auth/SKILL.md +598 -0
- package/skills/better-auth/references/feishu-api.md +270 -0
- package/skills/better-auth/release-check.mjs +93 -0
- package/skills/data-catalog/LICENSE +3 -0
- package/skills/data-catalog/SKILL.md +207 -0
- package/skills/data-catalog/agents/openai.yaml +3 -0
- package/skills/data-catalog/references/data-catalog-conventions.md +76 -0
- package/skills/data-catalog/references/field-definitions.md +123 -0
- package/skills/data-catalog/references/format.md +130 -0
- package/skills/data-catalog/release-check.mjs +93 -0
- package/skills/data-catalog/scripts/data-catalog.test.mjs +36 -0
- package/skills/data-catalog/scripts/data_catalog.py +1435 -0
- package/skills/data-catalog/scripts/persist-conventions-core.mjs +117 -0
- package/skills/data-catalog/scripts/persist-conventions.mjs +17 -0
- package/skills/data-catalog/scripts/test_data_catalog.py +603 -0
- package/skills/ios-foundation/LICENSE +3 -0
- package/skills/ios-foundation/SKILL.md +184 -0
- package/skills/ios-foundation/references/setup.md +243 -0
- package/skills/ios-foundation/release-check.mjs +93 -0
- package/skills/monorepo/LICENSE +3 -0
- package/skills/monorepo/SKILL.md +462 -0
- package/skills/monorepo/release-check.mjs +93 -0
- package/skills/nextjs-fullstack/LICENSE +3 -0
- package/skills/nextjs-fullstack/SKILL.md +211 -0
- package/skills/nextjs-fullstack/conventions.md +318 -0
- package/skills/nextjs-fullstack/frontend-conventions.md +61 -0
- package/skills/nextjs-fullstack/nextjs16.md +287 -0
- package/skills/nextjs-fullstack/release-check.mjs +93 -0
- package/skills/nextjs-fullstack/server-actions.md +409 -0
- package/skills/prisma-setup/LICENSE +3 -0
- package/skills/prisma-setup/SKILL.md +181 -0
- package/skills/prisma-setup/nextjs.md +258 -0
- package/skills/prisma-setup/release-check.mjs +93 -0
- package/skills/prisma-setup/turborepo.md +301 -0
- package/skills/pyspark/LICENSE +3 -0
- package/skills/pyspark/SKILL.md +127 -0
- package/skills/pyspark/assets/templates/etl.py +748 -0
- package/skills/pyspark/assets/templates/utils/__init__.py +1 -0
- package/skills/pyspark/assets/templates/utils/hudi_metadata.py +14 -0
- package/skills/pyspark/references/diagnosis-and-profiling.md +169 -0
- package/skills/pyspark/references/etl-contract.md +129 -0
- package/skills/pyspark/references/production-validation.md +131 -0
- package/skills/pyspark/references/reconciliation.md +38 -0
- package/skills/pyspark/references/transformation-design.md +190 -0
- package/skills/pyspark/references/velocity-feature-calculation.md +193 -0
- package/skills/pyspark/release-check.mjs +93 -0
- package/skills/pyspark/scripts/spark_eventlog_summary.py +223 -0
- package/skills/python-backend/LICENSE +3 -0
- package/skills/python-backend/SKILL.md +325 -0
- package/skills/python-backend/assets/uv-install.sh +48 -0
- package/skills/python-backend/references/uv-installs.md +83 -0
- package/skills/python-backend/release-check.mjs +93 -0
- package/skills/shadcn/LICENSE +3 -0
- package/skills/shadcn/SKILL.md +120 -0
- package/skills/shadcn/assets/shadcn-small.png +0 -0
- package/skills/shadcn/assets/shadcn.png +0 -0
- package/skills/shadcn/cli.md +411 -0
- package/skills/shadcn/customization.md +224 -0
- package/skills/shadcn/mcp.md +101 -0
- package/skills/shadcn/release-check.mjs +93 -0
- package/skills/shadcn/rules/base-vs-radix.md +323 -0
- package/skills/shadcn/rules/component-selection.md +67 -0
- package/skills/shadcn/rules/composition.md +195 -0
- package/skills/shadcn/rules/data-table.md +201 -0
- package/skills/shadcn/rules/forms.md +255 -0
- package/skills/shadcn/rules/icons.md +103 -0
- package/skills/shadcn/rules/styling.md +167 -0
- package/skills/zod-v4/LICENSE +3 -0
- package/skills/zod-v4/SKILL.md +286 -0
- package/skills/zod-v4/release-check.mjs +93 -0
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: monorepo
|
|
3
|
+
description: Turborepo architecture for shared packages, pnpm workspaces, DAL boundaries, and pipelines.
|
|
4
|
+
release-version: 0.38.0
|
|
5
|
+
---
|
|
6
|
+
**Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
|
|
7
|
+
# Turborepo Monorepo Architecture
|
|
8
|
+
|
|
9
|
+
**Turborepo** | **pnpm workspaces** | **Next.js 16** | **Prisma** | **Shadcn UI**
|
|
10
|
+
|
|
11
|
+
## Core Technology Stack
|
|
12
|
+
|
|
13
|
+
- **Manager:** Turborepo
|
|
14
|
+
- **Package Manager:** pnpm
|
|
15
|
+
- **Framework:** Next.js 16 (App Router)
|
|
16
|
+
- **Language:** TypeScript (Strict Mode)
|
|
17
|
+
- **UI System:** Shadcn UI (Radix + Tailwind)
|
|
18
|
+
- **Database:** Prisma (PostgreSQL)
|
|
19
|
+
- **Architecture:** DAL Separation
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Directory Structure
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
repo/
|
|
27
|
+
├── apps/
|
|
28
|
+
│ └── web/ # Next.js application
|
|
29
|
+
├── packages/
|
|
30
|
+
│ ├── typescript-config/ # Shared TS configs
|
|
31
|
+
│ ├── eslint-config/ # Shared ESLint configs
|
|
32
|
+
│ ├── database/ # Raw Prisma schema + client
|
|
33
|
+
│ ├── dal/ # Data Access Layer
|
|
34
|
+
│ └── ui/ # Shadcn UI system
|
|
35
|
+
├── turbo.json
|
|
36
|
+
├── pnpm-workspace.yaml
|
|
37
|
+
└── package.json
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Root Configuration
|
|
43
|
+
|
|
44
|
+
### pnpm-workspace.yaml
|
|
45
|
+
|
|
46
|
+
```yaml
|
|
47
|
+
packages:
|
|
48
|
+
- "apps/*"
|
|
49
|
+
- "packages/*"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### turbo.json
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"tasks": {
|
|
57
|
+
"build": {
|
|
58
|
+
"dependsOn": ["^build"]
|
|
59
|
+
},
|
|
60
|
+
"dev": {
|
|
61
|
+
"dependsOn": ["^db:generate"],
|
|
62
|
+
"cache": false,
|
|
63
|
+
"persistent": true
|
|
64
|
+
},
|
|
65
|
+
"db:generate": {
|
|
66
|
+
"inputs": ["schema.prisma"]
|
|
67
|
+
},
|
|
68
|
+
"lint": {}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Package: typescript-config
|
|
76
|
+
|
|
77
|
+
Shared TypeScript configurations.
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
packages/typescript-config/
|
|
81
|
+
├── base.json
|
|
82
|
+
├── nextjs.json
|
|
83
|
+
└── server.json
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### base.json
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
91
|
+
"compilerOptions": {
|
|
92
|
+
"strict": true,
|
|
93
|
+
"esModuleInterop": true,
|
|
94
|
+
"skipLibCheck": true,
|
|
95
|
+
"forceConsistentCasingInFileNames": true,
|
|
96
|
+
"moduleResolution": "bundler",
|
|
97
|
+
"resolveJsonModule": true,
|
|
98
|
+
"isolatedModules": true,
|
|
99
|
+
"noEmit": true
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### nextjs.json
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"extends": "./base.json",
|
|
109
|
+
"compilerOptions": {
|
|
110
|
+
"jsx": "preserve",
|
|
111
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
112
|
+
"module": "esnext",
|
|
113
|
+
"target": "esnext",
|
|
114
|
+
"plugins": [{ "name": "next" }]
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### server.json
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"extends": "./base.json",
|
|
124
|
+
"compilerOptions": {
|
|
125
|
+
"lib": ["esnext"],
|
|
126
|
+
"module": "esnext",
|
|
127
|
+
"target": "esnext"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Package: database
|
|
135
|
+
|
|
136
|
+
Holds **only** the Prisma schema and raw client. No business logic.
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
packages/database/
|
|
140
|
+
├── prisma/
|
|
141
|
+
│ └── schema.prisma
|
|
142
|
+
├── client.ts
|
|
143
|
+
├── package.json
|
|
144
|
+
└── index.ts
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### schema.prisma
|
|
148
|
+
|
|
149
|
+
```prisma
|
|
150
|
+
generator client {
|
|
151
|
+
provider = "prisma-client"
|
|
152
|
+
output = "../generated/prisma"
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
datasource db {
|
|
156
|
+
provider = "postgresql"
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
model User {
|
|
160
|
+
id String @id @default(cuid())
|
|
161
|
+
email String @unique
|
|
162
|
+
name String?
|
|
163
|
+
createdAt DateTime @default(now())
|
|
164
|
+
updatedAt DateTime @updatedAt
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### client.ts
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
import { PrismaClient } from "./generated/prisma/client"
|
|
172
|
+
import { PrismaPg } from "@prisma/adapter-pg"
|
|
173
|
+
|
|
174
|
+
const adapter = new PrismaPg({
|
|
175
|
+
connectionString: process.env.DATABASE_URL!,
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
const globalForPrisma = globalThis as unknown as { database?: PrismaClient }
|
|
179
|
+
|
|
180
|
+
export const database =
|
|
181
|
+
globalForPrisma.database ?? new PrismaClient({ adapter })
|
|
182
|
+
|
|
183
|
+
if (process.env.NODE_ENV !== "production") {
|
|
184
|
+
globalForPrisma.database = database
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### index.ts
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
export * from "./generated/prisma"
|
|
192
|
+
export { database } from "./client"
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### package.json
|
|
196
|
+
|
|
197
|
+
```json
|
|
198
|
+
{
|
|
199
|
+
"name": "@repo/database",
|
|
200
|
+
"private": true,
|
|
201
|
+
"main": "index.ts",
|
|
202
|
+
"scripts": {
|
|
203
|
+
"db:generate": "prisma generate",
|
|
204
|
+
"db:push": "prisma db push"
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Package: dal (Data Access Layer)
|
|
212
|
+
|
|
213
|
+
The **only** package allowed to import `@repo/database`.
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
packages/dal/
|
|
217
|
+
├── src/
|
|
218
|
+
│ ├── users/
|
|
219
|
+
│ │ ├── queries.ts
|
|
220
|
+
│ │ └── mutations.ts
|
|
221
|
+
│ └── index.ts
|
|
222
|
+
└── package.json
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Requirements
|
|
226
|
+
|
|
227
|
+
- **Server-Only:** All files must start with `import 'server-only'`
|
|
228
|
+
- **DTOs:** Return plain objects, not class instances
|
|
229
|
+
- **Dependencies:** `@repo/database`, `server-only`
|
|
230
|
+
|
|
231
|
+
### src/users/queries.ts
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
import "server-only"
|
|
235
|
+
import { database } from "@repo/database"
|
|
236
|
+
|
|
237
|
+
export async function getUsers() {
|
|
238
|
+
return database.user.findMany({
|
|
239
|
+
orderBy: { createdAt: "desc" },
|
|
240
|
+
})
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export async function getUserById(id: string) {
|
|
244
|
+
return database.user.findUnique({
|
|
245
|
+
where: { id },
|
|
246
|
+
})
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### src/users/mutations.ts
|
|
251
|
+
|
|
252
|
+
```typescript
|
|
253
|
+
import "server-only"
|
|
254
|
+
import { database } from "@repo/database"
|
|
255
|
+
|
|
256
|
+
export async function createUser(data: { email: string; name?: string }) {
|
|
257
|
+
return database.user.create({ data })
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export async function updateUser(id: string, data: { name?: string }) {
|
|
261
|
+
return database.user.update({
|
|
262
|
+
where: { id },
|
|
263
|
+
data,
|
|
264
|
+
})
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### src/index.ts
|
|
269
|
+
|
|
270
|
+
```typescript
|
|
271
|
+
export * from "./users/queries"
|
|
272
|
+
export * from "./users/mutations"
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### package.json
|
|
276
|
+
|
|
277
|
+
```json
|
|
278
|
+
{
|
|
279
|
+
"name": "@repo/dal",
|
|
280
|
+
"private": true,
|
|
281
|
+
"main": "src/index.ts",
|
|
282
|
+
"dependencies": {
|
|
283
|
+
"@repo/database": "*",
|
|
284
|
+
"server-only": "*"
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## Package: ui (Shadcn)
|
|
292
|
+
|
|
293
|
+
Centralized, exportable UI library.
|
|
294
|
+
|
|
295
|
+
```
|
|
296
|
+
packages/ui/
|
|
297
|
+
├── src/
|
|
298
|
+
│ ├── components/
|
|
299
|
+
│ │ └── ui/
|
|
300
|
+
│ │ ├── button.tsx
|
|
301
|
+
│ │ └── input.tsx
|
|
302
|
+
│ └── styles/
|
|
303
|
+
│ └── globals.css
|
|
304
|
+
├── components.json
|
|
305
|
+
├── tailwind.config.ts
|
|
306
|
+
├── index.ts
|
|
307
|
+
└── package.json
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### tailwind.config.ts (Master Config)
|
|
311
|
+
|
|
312
|
+
```typescript
|
|
313
|
+
import type { Config } from "tailwindcss"
|
|
314
|
+
|
|
315
|
+
const config: Config = {
|
|
316
|
+
darkMode: ["class"],
|
|
317
|
+
content: ["./src/**/*.{ts,tsx}"],
|
|
318
|
+
theme: {
|
|
319
|
+
extend: {
|
|
320
|
+
colors: {
|
|
321
|
+
border: "hsl(var(--border))",
|
|
322
|
+
background: "hsl(var(--background))",
|
|
323
|
+
foreground: "hsl(var(--foreground))",
|
|
324
|
+
primary: {
|
|
325
|
+
DEFAULT: "hsl(var(--primary))",
|
|
326
|
+
foreground: "hsl(var(--primary-foreground))",
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
borderRadius: {
|
|
330
|
+
lg: "var(--radius)",
|
|
331
|
+
md: "calc(var(--radius) - 2px)",
|
|
332
|
+
sm: "calc(var(--radius) - 4px)",
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
},
|
|
336
|
+
plugins: [require("tailwindcss-animate")],
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export default config
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### index.ts
|
|
343
|
+
|
|
344
|
+
```typescript
|
|
345
|
+
export * from "./src/components/ui/button"
|
|
346
|
+
export * from "./src/components/ui/input"
|
|
347
|
+
// Export tailwind config for apps to preset
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## App: apps/web
|
|
353
|
+
|
|
354
|
+
### Dependencies
|
|
355
|
+
|
|
356
|
+
```json
|
|
357
|
+
{
|
|
358
|
+
"dependencies": {
|
|
359
|
+
"@repo/ui": "*",
|
|
360
|
+
"@repo/dal": "*"
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
**FORBIDDEN:** Do not import `@repo/database` directly.
|
|
366
|
+
|
|
367
|
+
### next.config.ts
|
|
368
|
+
|
|
369
|
+
```typescript
|
|
370
|
+
import type { NextConfig } from "next"
|
|
371
|
+
|
|
372
|
+
const config: NextConfig = {
|
|
373
|
+
transpilePackages: ["@repo/ui", "@repo/dal"],
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
export default config
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### tailwind.config.ts
|
|
380
|
+
|
|
381
|
+
```typescript
|
|
382
|
+
import type { Config } from "tailwindcss"
|
|
383
|
+
import sharedConfig from "@repo/ui/tailwind.config"
|
|
384
|
+
|
|
385
|
+
const config: Config = {
|
|
386
|
+
presets: [sharedConfig],
|
|
387
|
+
content: [
|
|
388
|
+
"./app/**/*.{ts,tsx}",
|
|
389
|
+
"../../packages/ui/src/**/*.{ts,tsx}",
|
|
390
|
+
],
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
export default config
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### Root Layout
|
|
397
|
+
|
|
398
|
+
```typescript
|
|
399
|
+
import "@repo/ui/src/styles/globals.css"
|
|
400
|
+
|
|
401
|
+
export default function RootLayout({ children }) {
|
|
402
|
+
return (
|
|
403
|
+
<html lang="en">
|
|
404
|
+
<body>{children}</body>
|
|
405
|
+
</html>
|
|
406
|
+
)
|
|
407
|
+
}
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
### Page Example
|
|
411
|
+
|
|
412
|
+
```typescript
|
|
413
|
+
// app/page.tsx
|
|
414
|
+
import { getUsers } from "@repo/dal"
|
|
415
|
+
import { Button } from "@repo/ui"
|
|
416
|
+
|
|
417
|
+
export default async function HomePage() {
|
|
418
|
+
const users = await getUsers()
|
|
419
|
+
|
|
420
|
+
return (
|
|
421
|
+
<main>
|
|
422
|
+
<h1>Users</h1>
|
|
423
|
+
<ul>
|
|
424
|
+
{users.map((user) => (
|
|
425
|
+
<li key={user.id}>{user.name}</li>
|
|
426
|
+
))}
|
|
427
|
+
</ul>
|
|
428
|
+
<Button>Add User</Button>
|
|
429
|
+
</main>
|
|
430
|
+
)
|
|
431
|
+
}
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
## Package Boundary Rules
|
|
437
|
+
|
|
438
|
+
| Package | Can Import | Cannot Import |
|
|
439
|
+
|---------|------------|---------------|
|
|
440
|
+
| `database` | - | Any other package |
|
|
441
|
+
| `dal` | `database` | `ui`, apps |
|
|
442
|
+
| `ui` | - | `database`, `dal` |
|
|
443
|
+
| `apps/web` | `dal`, `ui` | `database` directly |
|
|
444
|
+
|
|
445
|
+
---
|
|
446
|
+
|
|
447
|
+
## Do / Don't
|
|
448
|
+
|
|
449
|
+
### Do
|
|
450
|
+
|
|
451
|
+
- Keep database package minimal (schema + client only)
|
|
452
|
+
- Use DAL for all database operations
|
|
453
|
+
- Use `server-only` in DAL packages
|
|
454
|
+
- Export tailwind config from UI package
|
|
455
|
+
- Use transpilePackages in Next.js config
|
|
456
|
+
|
|
457
|
+
### Don't
|
|
458
|
+
|
|
459
|
+
- Don't import `@repo/database` from apps
|
|
460
|
+
- Don't put business logic in database package
|
|
461
|
+
- Don't skip DAL for "simple" queries
|
|
462
|
+
- Don't duplicate tailwind theme in apps
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { homedir } from 'node:os';
|
|
5
|
+
import { dirname, join } from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
|
|
8
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
9
|
+
const WEEK_MS = 7 * DAY_MS;
|
|
10
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
|
|
12
|
+
function readJson(path, fallback = {}) {
|
|
13
|
+
try { return JSON.parse(readFileSync(path, 'utf8')); } catch { return fallback; }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function frontmatterValue(text, key) {
|
|
17
|
+
const frontmatter = /^---\n([\s\S]*?)\n---/.exec(text)?.[1] ?? '';
|
|
18
|
+
const match = new RegExp('^' + key + ':\\s*([^\\n]+)$', 'm').exec(frontmatter);
|
|
19
|
+
return match?.[1].trim().replace(/^['"]|['"]$/g, '') ?? null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function repositoryOf(source) {
|
|
23
|
+
const value = String(source ?? '').trim();
|
|
24
|
+
const match = /^(?:git@github\.com:|https:\/\/github\.com\/)?([A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+?)(?:\.git)?$/.exec(value);
|
|
25
|
+
return match?.[1] ?? null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function stableVersion(value) {
|
|
29
|
+
const match = /^v?(\d+)\.(\d+)\.(\d+)$/.exec(String(value ?? '').trim());
|
|
30
|
+
return match ? match.slice(1).map(Number) : null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function newer(left, right) {
|
|
34
|
+
for (let index = 0; index < 3; index += 1) {
|
|
35
|
+
if (left[index] !== right[index]) return left[index] > right[index];
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function writeCache(path, value) {
|
|
41
|
+
try {
|
|
42
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
43
|
+
writeFileSync(path, JSON.stringify(value));
|
|
44
|
+
} catch { /* A read-only cache must not block skill use. */ }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function main(now = Date.now()) {
|
|
48
|
+
if (process.env.ONEABOVEIO_NO_UPDATE_CHECK) return;
|
|
49
|
+
const skill = readFileSync(join(here, 'SKILL.md'), 'utf8');
|
|
50
|
+
const name = frontmatterValue(skill, 'name');
|
|
51
|
+
const localVersion = stableVersion(frontmatterValue(skill, 'release-version'));
|
|
52
|
+
if (!name || !localVersion) return;
|
|
53
|
+
|
|
54
|
+
const lock = readJson(join(process.env.HOME || homedir(), '.agents', '.skill-lock.json'));
|
|
55
|
+
const entry = lock.skills?.[name];
|
|
56
|
+
const repository = repositoryOf(entry?.sourceUrl || entry?.source);
|
|
57
|
+
if (!repository) return;
|
|
58
|
+
|
|
59
|
+
const cacheRoot = process.env.XDG_CACHE_HOME || join(process.env.HOME || homedir(), '.cache');
|
|
60
|
+
const cachePath = join(cacheRoot, '1aboveio-skills', 'release-check.json');
|
|
61
|
+
const all = readJson(cachePath);
|
|
62
|
+
const cache = all[repository] && typeof all[repository] === 'object' ? all[repository] : {};
|
|
63
|
+
|
|
64
|
+
if (!cache.lastCheck || now - cache.lastCheck >= DAY_MS) {
|
|
65
|
+
const result = spawnSync('gh', ['api', 'repos/' + repository + '/releases/latest', '--jq', '.tag_name'], {
|
|
66
|
+
encoding: 'utf8',
|
|
67
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
68
|
+
timeout: 1500,
|
|
69
|
+
});
|
|
70
|
+
cache.lastCheck = now;
|
|
71
|
+
if (result.status === 0 && stableVersion(result.stdout)) cache.latestTag = result.stdout.trim();
|
|
72
|
+
else delete cache.latestTag;
|
|
73
|
+
all[repository] = cache;
|
|
74
|
+
writeCache(cachePath, all);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const latestVersion = stableVersion(cache.latestTag);
|
|
78
|
+
if (!latestVersion || !newer(latestVersion, localVersion)) return;
|
|
79
|
+
if (cache.notifiedTag === cache.latestTag && cache.notifiedAt && now - cache.notifiedAt < WEEK_MS) return;
|
|
80
|
+
|
|
81
|
+
cache.notifiedTag = cache.latestTag;
|
|
82
|
+
cache.notifiedAt = now;
|
|
83
|
+
all[repository] = cache;
|
|
84
|
+
writeCache(cachePath, all);
|
|
85
|
+
const command = `npx skills@1.5.23 add '${repository}#${cache.latestTag}' --global --agent universal claude-code --skill ${name} --yes`;
|
|
86
|
+
process.stdout.write(
|
|
87
|
+
`UPDATE_AVAILABLE: A newer 1AboveIO skills release (${cache.latestTag}) is available; this skill is `
|
|
88
|
+
+ `v${localVersion.join('.')}. Ask once whether to refresh ${name}. On approval run \`${command}\`. `
|
|
89
|
+
+ 'The refreshed instructions apply next session. Either way, continue the current task and do not ask again this session.\n',
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
try { main(); } catch { /* Update checks are advisory and always fail silent. */ }
|