@1aboveio/app-dev-skills 0.0.0-stage → 0.1.0
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 +29 -2
- package/package.json +33 -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/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,243 @@
|
|
|
1
|
+
# iOS foundation: shell snippets
|
|
2
|
+
|
|
3
|
+
Replace each `<placeholder>` with the repo's real value. Tool shells do not keep variables,
|
|
4
|
+
functions or traps between calls: step 1 writes `.cache/ios-env.sh`, which also `cd`s into
|
|
5
|
+
the worktree, and every later block starts by sourcing it by absolute path. The backend
|
|
6
|
+
(step 6) and Metro (step 7) each run as one long-running command in its own background shell.
|
|
7
|
+
|
|
8
|
+
## 1. Checkout and environment
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
set -euo pipefail
|
|
12
|
+
git fetch origin main
|
|
13
|
+
git worktree add -b <new-branch> ../<repo>-ios-setup origin/main
|
|
14
|
+
cd ../<repo>-ios-setup
|
|
15
|
+
git rev-parse HEAD
|
|
16
|
+
mkdir -p .cache
|
|
17
|
+
{ echo 'set -euo pipefail'; printf 'cd %q\n' "$PWD"; } > .cache/ios-env.sh
|
|
18
|
+
cat >> .cache/ios-env.sh <<'ENV'
|
|
19
|
+
|
|
20
|
+
# Repo-specific names, read from the repo's app config, build script and device harness.
|
|
21
|
+
export APP_FILTER=<native-workspace-package> # pnpm --filter target
|
|
22
|
+
export IOS_DIR=<path/to/ios> # holds the Podfile and .xcworkspace
|
|
23
|
+
export IOS_BUNDLE_ID=<ios-bundle-identifier>
|
|
24
|
+
export IOS_APP_NAME=<Scheme> # the .app the build script produces
|
|
25
|
+
export DB_NAME_PREFIX=<db-prefix-the-harness-accepts> # the harness rejects other names
|
|
26
|
+
export DB_URL_VAR=<harness-admin-url-variable> # e.g. SHARD_ADMIN_URL
|
|
27
|
+
export DB_NAME_VAR=<harness-db-name-variable> # e.g. SHARD_DB_NAME
|
|
28
|
+
|
|
29
|
+
# Private caches.
|
|
30
|
+
export PNPM_CONFIG_STORE_DIR="$PWD/.cache/pnpm-store"
|
|
31
|
+
export PNPM_CONFIG_CACHE_DIR="$PWD/.cache/pnpm"
|
|
32
|
+
export npm_config_cache="$PWD/.cache/npm"
|
|
33
|
+
export TMPDIR="$PWD/.cache/tmp"
|
|
34
|
+
export CP_CACHE_DIR="$PWD/.cache/cocoapods"
|
|
35
|
+
export CP_HOME_DIR="$PWD/.cache/cocoapods-home"
|
|
36
|
+
export IOS_DERIVED_DATA_PATH="$PWD/.cache/ios-derived-data"
|
|
37
|
+
export IOS_APP="$IOS_DERIVED_DATA_PATH/Build/Products/Debug-iphonesimulator/$IOS_APP_NAME.app"
|
|
38
|
+
|
|
39
|
+
# Run identifiers: free ports only; never stop another worker's service to free one.
|
|
40
|
+
export IOS_BACKEND_PORT=<free-port>
|
|
41
|
+
export IOS_METRO_PORT=<free-port>
|
|
42
|
+
ENV
|
|
43
|
+
source .cache/ios-env.sh
|
|
44
|
+
mkdir -p "$TMPDIR" "$npm_config_cache" "$CP_CACHE_DIR" "$CP_HOME_DIR" .cache/logs
|
|
45
|
+
|
|
46
|
+
xcode-select -p
|
|
47
|
+
xcodebuild -version
|
|
48
|
+
xcodebuild -showsdks
|
|
49
|
+
xcrun simctl list runtimes
|
|
50
|
+
xcrun simctl list devicetypes
|
|
51
|
+
node --version; pnpm --version; ruby --version; pod --version
|
|
52
|
+
grep '^COCOAPODS:' "$IOS_DIR/Podfile.lock" # must match pod --version
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`xcode-select -p` must point into `Xcode.app`, not CommandLineTools. The workstation owner
|
|
56
|
+
selects Xcode and accepts its license; do not run `sudo xcodebuild -license` yourself.
|
|
57
|
+
|
|
58
|
+
## 2. Install
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
source <worktree>/.cache/ios-env.sh
|
|
62
|
+
pnpm install --frozen-lockfile
|
|
63
|
+
(cd "$IOS_DIR" && pod install --deployment)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Only for a reviewed native config or dependency change, regenerate iOS alone and review
|
|
67
|
+
the diff before installing pods without `--deployment`:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
source <worktree>/.cache/ios-env.sh
|
|
71
|
+
pnpm --filter "$APP_FILTER" exec expo prebuild \
|
|
72
|
+
--platform ios --no-install --skip-dependency-update react,react-native
|
|
73
|
+
git diff -- <app-config> <app-package.json> "$IOS_DIR"
|
|
74
|
+
(cd "$IOS_DIR" && pod install)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 3. Runtime (only with the workstation owner's permission)
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
source <worktree>/.cache/ios-env.sh
|
|
81
|
+
xcodebuild -downloadPlatform iOS -buildVersion <sdk-version> \
|
|
82
|
+
-architectureVariant arm64 -exportPath "$PWD/.cache/ios-runtimes"
|
|
83
|
+
xcrun simctl list runtimes # must list the runtime as available
|
|
84
|
+
# Only if it is not listed: import the exported image (installs shared CoreSimulator state).
|
|
85
|
+
xcodebuild -importPlatform "$PWD/.cache/ios-runtimes/<exported>.dmg"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## 4. Check and build
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
source <worktree>/.cache/ios-env.sh
|
|
92
|
+
pnpm --filter "$APP_FILTER" test
|
|
93
|
+
pnpm --filter "$APP_FILTER" typecheck
|
|
94
|
+
node --test <path/to/build-script.test.mjs> # if the repo tests its build script
|
|
95
|
+
EXPO_PUBLIC_API_URL=https://app.invalid \
|
|
96
|
+
pnpm --filter "$APP_FILTER" exec expo export --platform ios
|
|
97
|
+
<ios-build-command, e.g. pnpm build:ios> -jobs 2 2>&1 | tee .cache/logs/xcodebuild.log
|
|
98
|
+
test -d "$IOS_APP"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`app.invalid` is an unreachable origin for bundling only. The repo's build script should run
|
|
102
|
+
`xcodebuild` on the `.xcworkspace` with its scheme, `-configuration Debug`,
|
|
103
|
+
`-sdk iphonesimulator`, `-destination 'generic/platform=iOS Simulator'`, `-derivedDataPath "$IOS_DERIVED_DATA_PATH"`,
|
|
104
|
+
`CODE_SIGN_IDENTITY=-` and `CODE_SIGNING_ALLOWED=YES`. If the repo has no build script,
|
|
105
|
+
run that `xcodebuild` command directly. Pass extra Xcode diagnostic arguments after the
|
|
106
|
+
command; never override the SDK or signing.
|
|
107
|
+
|
|
108
|
+
## 5. Owned simulator
|
|
109
|
+
|
|
110
|
+
Pick the runtime and device type from the `simctl list` output in step 1.
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
source <worktree>/.cache/ios-env.sh
|
|
114
|
+
IOS_RUNTIME=com.apple.CoreSimulator.SimRuntime.iOS-<x-y>
|
|
115
|
+
IOS_DEVICE_TYPE=com.apple.CoreSimulator.SimDeviceType.<iPhone-model>
|
|
116
|
+
IOS_SIMULATOR_UDID="$(xcrun simctl create "<repo>-ios-$(date +%s)" "$IOS_DEVICE_TYPE" "$IOS_RUNTIME")"
|
|
117
|
+
printf 'export IOS_SIMULATOR_UDID=%q\n' "$IOS_SIMULATOR_UDID" >> .cache/ios-env.sh
|
|
118
|
+
xcrun simctl boot "$IOS_SIMULATOR_UDID"
|
|
119
|
+
xcrun simctl bootstatus "$IOS_SIMULATOR_UDID" -b
|
|
120
|
+
open -a Simulator
|
|
121
|
+
xcrun simctl install "$IOS_SIMULATOR_UDID" "$IOS_APP"
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## 6. Disposable backend: one command
|
|
125
|
+
|
|
126
|
+
In its own background shell. Cleanup is registered before Docker creates anything, every
|
|
127
|
+
Docker command has a 30-second limit, and stopping the command (TERM or Ctrl-C) stops the
|
|
128
|
+
backend and removes the container. The backend runs as a background child that the shell
|
|
129
|
+
`wait`s on, so a signal runs the trap at once instead of after the backend exits.
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
source <worktree>/.cache/ios-env.sh
|
|
133
|
+
umask 077
|
|
134
|
+
RUN_DIR="$(mktemp -d "$PWD/.cache/tmp/ios-db.XXXXXX")"
|
|
135
|
+
DB_ENV="$PWD/.cache/ios-db-env.sh"
|
|
136
|
+
BACKEND_PID=
|
|
137
|
+
bounded() {
|
|
138
|
+
node --input-type=module -e '
|
|
139
|
+
import { spawnSync } from "node:child_process";
|
|
140
|
+
const [command, ...args] = process.argv.slice(1);
|
|
141
|
+
const result = spawnSync(command, args, { stdio: "inherit", timeout: 30000 });
|
|
142
|
+
if (result.error) console.error(result.error.message);
|
|
143
|
+
process.exit(result.error?.code === "ETIMEDOUT" ? 124 : (result.status ?? 1));
|
|
144
|
+
' -- "$@"
|
|
145
|
+
}
|
|
146
|
+
cleanup() {
|
|
147
|
+
status=$?
|
|
148
|
+
trap - EXIT
|
|
149
|
+
cleanup_status=0
|
|
150
|
+
if test -n "$BACKEND_PID" && kill -TERM "$BACKEND_PID" 2>/dev/null; then
|
|
151
|
+
for _ in 1 2 3 4 5 6 7 8 9 10; do kill -0 "$BACKEND_PID" 2>/dev/null || break; sleep 1; done
|
|
152
|
+
if kill -0 "$BACKEND_PID" 2>/dev/null; then kill -KILL "$BACKEND_PID"; cleanup_status=1; fi
|
|
153
|
+
wait "$BACKEND_PID" 2>/dev/null || true
|
|
154
|
+
fi
|
|
155
|
+
if test -s "$RUN_DIR/postgres.cid"; then
|
|
156
|
+
bounded docker rm --force "$(< "$RUN_DIR/postgres.cid")" || cleanup_status=$?
|
|
157
|
+
fi
|
|
158
|
+
rm -f "$DB_ENV"
|
|
159
|
+
echo "original_stage_exit=$status cleanup_exit=$cleanup_status"
|
|
160
|
+
test "$status" -ne 0 || status=$cleanup_status
|
|
161
|
+
exit "$status"
|
|
162
|
+
}
|
|
163
|
+
trap cleanup EXIT
|
|
164
|
+
trap 'exit 130' INT
|
|
165
|
+
trap 'exit 143' TERM
|
|
166
|
+
bounded docker run --detach --cidfile "$RUN_DIR/postgres.cid" \
|
|
167
|
+
--publish 127.0.0.1::5432 --env POSTGRES_USER=postgres \
|
|
168
|
+
--env POSTGRES_PASSWORD=postgres --env POSTGRES_DB=postgres postgres:<version>
|
|
169
|
+
CID="$(< "$RUN_DIR/postgres.cid")"
|
|
170
|
+
DB_PORT="$(bounded docker port "$CID" 5432/tcp | awk -F: '{print $NF}')"
|
|
171
|
+
ready=
|
|
172
|
+
for _ in $(seq 1 30); do
|
|
173
|
+
if bounded docker exec "$CID" pg_isready -U postgres; then ready=1; break
|
|
174
|
+
else attempt_status=$?; test "$attempt_status" -ne 124 || exit 124; fi
|
|
175
|
+
sleep 1
|
|
176
|
+
done
|
|
177
|
+
test -n "$ready"
|
|
178
|
+
export "$DB_URL_VAR=postgresql://postgres:postgres@127.0.0.1:$DB_PORT/postgres"
|
|
179
|
+
export "$DB_NAME_VAR=${DB_NAME_PREFIX}ios_$(date +%s)"
|
|
180
|
+
export DATABASE_URL="postgresql://postgres:postgres@127.0.0.1:$DB_PORT/${!DB_NAME_VAR}"
|
|
181
|
+
export TEST_DATABASE_URL="$DATABASE_URL"
|
|
182
|
+
printf 'export %s=%q\n' "$DB_URL_VAR" "${!DB_URL_VAR}" "$DB_NAME_VAR" "${!DB_NAME_VAR}" \
|
|
183
|
+
DATABASE_URL "$DATABASE_URL" TEST_DATABASE_URL "$DATABASE_URL" > "$DB_ENV"
|
|
184
|
+
node <path/to/device-harness.mjs> init > "$RUN_DIR/seed.log"
|
|
185
|
+
# Backend env: loopback host, the reserved port, a disposable auth secret, and whatever
|
|
186
|
+
# flag the repo uses to capture verification codes in the database.
|
|
187
|
+
export HOST=127.0.0.1 PORT="$IOS_BACKEND_PORT" NODE_ENV=development
|
|
188
|
+
<backend-env-exports>
|
|
189
|
+
node <path/to/backend-server.js> > .cache/logs/backend.log 2>&1 &
|
|
190
|
+
BACKEND_PID=$!
|
|
191
|
+
wait "$BACKEND_PID"
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Read the fixture user's email from the harness output or its fixture table. Never point
|
|
195
|
+
these variables at development, production or another worker's database.
|
|
196
|
+
|
|
197
|
+
## 7. Metro and launch
|
|
198
|
+
|
|
199
|
+
In its own background shell:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
source <worktree>/.cache/ios-env.sh
|
|
203
|
+
EXPO_PUBLIC_API_URL="http://127.0.0.1:$IOS_BACKEND_PORT" \
|
|
204
|
+
pnpm --filter "$APP_FILTER" exec expo start --localhost --port "$IOS_METRO_PORT" \
|
|
205
|
+
> .cache/logs/metro.log 2>&1
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Then point only the owned simulator at that Metro port and launch:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
source <worktree>/.cache/ios-env.sh
|
|
212
|
+
xcrun simctl spawn "$IOS_SIMULATOR_UDID" defaults write "$IOS_BUNDLE_ID" \
|
|
213
|
+
RCT_jsLocation -string "127.0.0.1:$IOS_METRO_PORT"
|
|
214
|
+
xcrun simctl launch "$IOS_SIMULATOR_UDID" "$IOS_BUNDLE_ID"
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## 8. Login smoke
|
|
218
|
+
|
|
219
|
+
After tapping Send in the app with the fixture user's email, read the code from the
|
|
220
|
+
disposable database with the repo's helper (step 6 wrote its connection to
|
|
221
|
+
`.cache/ios-db-env.sh` and removes it on cleanup):
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
source <worktree>/.cache/ios-env.sh
|
|
225
|
+
source <worktree>/.cache/ios-db-env.sh
|
|
226
|
+
node <path/to/otp-helper.mjs> '<fixture user email>'
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Enter the code in the simulator. Never record or publish codes, cookies, verification rows
|
|
230
|
+
or session material.
|
|
231
|
+
|
|
232
|
+
## 9. Cleanup
|
|
233
|
+
|
|
234
|
+
Stop the backend command (its trap stops the backend and removes the container) and the
|
|
235
|
+
Metro command, then remove only the owned simulator:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
source <worktree>/.cache/ios-env.sh
|
|
239
|
+
xcrun simctl shutdown "$IOS_SIMULATOR_UDID"
|
|
240
|
+
xcrun simctl delete "$IOS_SIMULATOR_UDID"
|
|
241
|
+
lsof -nP -iTCP:"$IOS_BACKEND_PORT" -iTCP:"$IOS_METRO_PORT" -sTCP:LISTEN || echo "ports free"
|
|
242
|
+
git status --short # restore Expo rewrites; never commit .xcode.env.local or a loopback mirror URL
|
|
243
|
+
```
|
|
@@ -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. */ }
|