@1aboveio/skills 1.0.10 → 1.0.12
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/.codex-plugin/plugin.json +1 -1
- package/.codex-plugin/resources.json +298 -216
- package/README.md +3 -3
- package/package.json +10 -8
- package/skills/app-dev/airflow/SKILL.md +1 -1
- package/skills/app-dev/android-foundation/SKILL.md +35 -37
- package/skills/app-dev/android-foundation/references/delivery-focus.md +4 -2
- package/skills/app-dev/android-foundation/references/feature-work.md +50 -0
- package/skills/app-dev/android-foundation/references/setup.md +24 -9
- package/skills/app-dev/android-foundation/references/workspace.md +81 -0
- package/skills/app-dev/android-foundation/scripts/workspace-runtime/bin/workspaces.mjs +52 -0
- package/skills/app-dev/android-foundation/scripts/workspace-runtime/native-workspace.mjs +239 -0
- package/skills/app-dev/android-foundation/scripts/workspace-runtime/workspace-lifecycle.mjs +2154 -0
- package/skills/app-dev/app-debug/SKILL.md +1 -1
- package/skills/app-dev/better-auth/SKILL.md +1 -1
- package/skills/app-dev/data-catalog/SKILL.md +1 -1
- package/skills/app-dev/data-quality/SKILL.md +1 -1
- package/skills/app-dev/ios-foundation/SKILL.md +15 -10
- package/skills/app-dev/ios-foundation/references/setup.md +25 -9
- package/skills/app-dev/ios-foundation/references/workspace.md +82 -0
- package/skills/app-dev/ios-foundation/scripts/workspace-runtime/bin/workspaces.mjs +52 -0
- package/skills/app-dev/ios-foundation/scripts/workspace-runtime/native-workspace.mjs +239 -0
- package/skills/app-dev/ios-foundation/scripts/workspace-runtime/workspace-lifecycle.mjs +2154 -0
- package/skills/app-dev/monorepo/SKILL.md +1 -1
- package/skills/app-dev/nextjs-fullstack/SKILL.md +1 -1
- package/skills/app-dev/prisma-setup/SKILL.md +1 -1
- package/skills/app-dev/pyspark/SKILL.md +1 -1
- package/skills/app-dev/python-backend/SKILL.md +1 -1
- package/skills/app-dev/shadcn/SKILL.md +1 -1
- package/skills/app-dev/zod-v4/SKILL.md +1 -1
- package/skills/cicd/cloud-build/SKILL.md +1 -1
- package/skills/cicd/cloud-debug/SKILL.md +1 -1
- package/skills/cicd/cloud-deploy/SKILL.md +1 -1
- package/skills/cicd/docker/SKILL.md +1 -1
- package/skills/cicd/github-actions/SKILL.md +1 -1
- package/skills/cicd/github-flow/SKILL.md +1 -1
- package/skills/cicd/google-cloud/SKILL.md +1 -1
- package/skills/cicd/mergify/SKILL.md +1 -1
- package/skills/cicd/podman/SKILL.md +1 -1
- package/skills/content/article-review/SKILL.md +1 -1
- package/skills/content/article-to-image/SKILL.md +1 -1
- package/skills/content/flowchart-svg/SKILL.md +1 -1
- package/skills/content/image-gen/SKILL.md +1 -1
- package/skills/content/mermaid/SKILL.md +1 -1
- package/skills/content/wechat-article-writer/SKILL.md +1 -1
- package/skills/content/wechat-publisher/SKILL.md +1 -1
- package/skills/content/wechat-search/SKILL.md +1 -1
- package/skills/content/xai-search/SKILL.md +1 -1
- package/skills/core/distill-writing/SKILL.md +3 -3
- package/skills/core/distill-writing/references/extraction.md +1 -1
- package/skills/core/doc-to-md/SKILL.md +1 -1
- package/skills/core/editorial-review/SKILL.md +82 -12
- package/skills/core/editorial-review/references/checklist.md +26 -1
- package/skills/core/house-style/SKILL.md +8 -3
- package/skills/core/house-style/references/analytical-reporting.md +123 -0
- package/skills/core/house-style/references/analytical-writing-patterns.md +79 -0
- package/skills/core/house-style/references/analytical-writing-research.md +129 -0
- package/skills/core/{write-doc → house-style}/references/bilingual.md +7 -5
- package/skills/core/house-style/references/definitions-and-metrics.md +86 -0
- package/skills/core/house-style/references/document-workflow.md +193 -0
- package/skills/core/house-style/references/initialization.md +66 -0
- package/skills/core/house-style/references/persistence.md +9 -4
- package/skills/core/house-style/references/rules.md +11 -4
- package/skills/core/house-style/scripts/init-guidance.mjs +213 -0
- package/skills/core/house-style/templates/analytical-report.md +54 -0
- package/skills/core/house-style/templates/gap-analysis.md +1 -1
- package/skills/core/plain-language/SKILL.md +2 -2
- package/skills/core/polish-cn/SKILL.md +9 -2
- package/skills/core/reg-parser/SKILL.md +3 -3
- package/skills/core/terminology/SKILL.md +8 -4
- package/skills/core/write-doc/SKILL.md +40 -151
- package/skills/core/write-report/SKILL.md +129 -0
- package/skills/core/{write-doc → write-report}/references/compliance-reports.md +4 -4
- package/skills/engineering/better-review/SKILL.md +37 -37
- package/skills/engineering/better-review/references/passes.md +35 -41
- package/skills/engineering/better-review/references/result.md +10 -9
- package/skills/engineering/e2e-test/SKILL.md +17 -17
- package/skills/engineering/e2e-test/references/authoring/playwright-config.md +11 -13
- package/skills/engineering/e2e-test/references/presentation-sweep.md +7 -7
- package/skills/engineering/e2e-test/references/reviewing.md +9 -11
- package/skills/engineering/e2e-test/references/route-manifest.md +1 -1
- package/skills/engineering/engineering/SKILL.md +201 -0
- package/skills/engineering/engineering/references/engineering-conventions.md +32 -0
- package/skills/engineering/engineering/references/feature-delivery.md +8 -0
- package/skills/engineering/engineering/references/init-scope.md +45 -0
- package/skills/engineering/engineering/references/scope-management.md +85 -0
- package/skills/engineering/engineering/scripts/init.mjs +160 -0
- package/skills/engineering/{contributing → engineering}/scripts/persist-conventions.mjs +1 -1
- package/skills/engineering/engineering-runtime/SKILL.md +1 -1
- package/skills/engineering/engineering-runtime/coherence/workflow.json +19 -19
- package/skills/engineering/engineering-runtime/scripts/workflow-policy.mjs +1 -1
- package/skills/engineering/ensure-coverage/SKILL.md +22 -109
- package/skills/engineering/ensure-coverage/references/breadth/coverage-ledger.md +7 -5
- package/skills/engineering/ensure-coverage/references/breadth/surface-baseline.md +4 -4
- package/skills/engineering/ensure-coverage/references/breadth/surface-discovery.md +3 -3
- package/skills/engineering/ensure-coverage/references/depth/characterization.md +4 -65
- package/skills/engineering/ensure-coverage/references/depth/grading.md +5 -7
- package/skills/engineering/ensure-coverage/references/depth/mock-policy.md +6 -12
- package/skills/engineering/ensure-coverage/references/enforcement/ci-contract.md +1 -1
- package/skills/engineering/ensure-coverage/references/presentation/axis.md +6 -6
- package/skills/engineering/ensure-coverage/references/process/audit-mode.md +7 -23
- package/skills/engineering/ensure-coverage/references/process/output-template.md +18 -133
- package/skills/engineering/ensure-coverage/references/process/test-strategy.md +7 -12
- package/skills/engineering/ensure-coverage/scripts/README.md +12 -4
- package/skills/engineering/golden-path/SKILL.md +1 -1
- package/skills/engineering/harness-runtime/SKILL.md +3 -1
- package/skills/engineering/harness-runtime/bin/workspaces.mjs +52 -0
- package/skills/engineering/harness-runtime/native-workspace.mjs +239 -0
- package/skills/engineering/harness-runtime/references/workspaces.md +78 -0
- package/skills/engineering/harness-runtime/workspace-lifecycle.mjs +2154 -0
- package/skills/engineering/resolve-issues/SKILL.md +40 -61
- package/skills/engineering/resolve-issues/references/ci.md +13 -3
- package/skills/engineering/resolve-issues/references/delivery-progress.md +4 -3
- package/skills/engineering/resolve-issues/references/done.md +11 -2
- package/skills/engineering/resolve-issues/references/expire.md +9 -2
- package/skills/engineering/resolve-issues/references/implementation.md +33 -17
- package/skills/engineering/resolve-issues/references/preflight.md +3 -1
- package/skills/engineering/resolve-issues/references/principles.md +52 -0
- package/skills/engineering/resolve-issues/references/review.md +25 -15
- package/skills/engineering/resolve-issues/references/task-plan.md +64 -27
- package/skills/engineering/resolve-issues/references/workspaces.md +164 -0
- package/skills/engineering/resolve-issues/scripts/cleanup-runs.mjs +185 -317
- package/skills/engineering/resolve-issues/scripts/next-actions.mjs +44 -7
- package/skills/engineering/resolve-issues/scripts/rehydrate.mjs +36 -2
- package/skills/engineering/resolve-issues/scripts/review-verdict.mjs +9 -8
- package/skills/engineering/resolve-issues/scripts/workspace-lifecycle.mjs +1 -0
- package/skills/engineering/resolve-release/SKILL.md +1 -1
- package/skills/engineering/rush-issues/SKILL.md +7 -5
- package/skills/engineering/rush-release/SKILL.md +1 -1
- package/skills/engineering/test-quality/SKILL.md +19 -4
- package/skills/engineering/test-quality/references/lint.md +1 -1
- package/skills/engineering/test-quality/references/principles.md +2 -2
- package/skills/engineering/test-quality/references/testing-conventions.md +1 -1
- package/skills/risk-compliance/compliance-audit/SKILL.md +4 -8
- package/skills/risk-compliance/compliance-audit/references/audience-and-reports.md +12 -0
- package/skills/risk-compliance/contract-compare/SKILL.md +17 -1
- package/skills/risk-compliance/contract-review/SKILL.md +6 -1
- package/skills/risk-compliance/contract-review/references/report-stage.md +17 -0
- package/skills/risk-compliance/doc-authenticity/SKILL.md +11 -1
- package/skills/risk-compliance/fraud-detection/LICENSE +3 -0
- package/skills/risk-compliance/fraud-detection/SKILL.md +148 -0
- package/skills/risk-compliance/{fraud-analysis → fraud-detection}/references/archetypes/first-party-fraud.md +3 -2
- package/skills/risk-compliance/fraud-detection/references/archetypes/third-party-fraud.md +47 -0
- package/skills/risk-compliance/fraud-detection/references/collection-payout-features.md +151 -0
- package/skills/risk-compliance/{fraud-analysis → fraud-detection}/references/contexts/bank-transfer.md +4 -3
- package/skills/risk-compliance/fraud-detection/references/contexts/card-payment.md +70 -0
- package/skills/risk-compliance/fraud-detection/references/contexts/payment-collection.md +34 -0
- package/skills/risk-compliance/fraud-detection/references/contexts/payout.md +34 -0
- package/skills/risk-compliance/fraud-detection/references/enrichment.md +74 -0
- package/skills/risk-compliance/fraud-detection/references/entities.md +48 -0
- package/skills/risk-compliance/{fraud-analysis → fraud-detection}/references/feature-engineering.md +69 -33
- package/skills/risk-compliance/fraud-detection/references/feature-sql.md +150 -0
- package/skills/risk-compliance/{fraud-analysis → fraud-detection}/references/report-rationale.md +4 -2
- package/skills/risk-compliance/{fraud-analysis → fraud-detection}/references/report-template.md +45 -23
- package/skills/risk-compliance/{fraud-analysis → fraud-detection}/references/review-checklist.md +60 -20
- package/skills/risk-compliance/fraud-detection/references/workflow.md +216 -0
- package/skills/risk-compliance/fraud-detection/release-check.mjs +95 -0
- package/skills/risk-compliance/payment-analysis/SKILL.md +36 -17
- package/skills/risk-compliance/payment-analysis/references/auth-rate-actions.md +2 -2
- package/skills/risk-compliance/payment-analysis/references/report-template.md +10 -2
- package/skills/risk-compliance/payment-analysis/references/visualization.md +11 -1
- package/skills/risk-compliance/portfolio-payment-analysis/LICENSE +3 -0
- package/skills/risk-compliance/portfolio-payment-analysis/SKILL.md +170 -0
- package/skills/risk-compliance/portfolio-payment-analysis/references/identity-and-reconciliation.md +46 -0
- package/skills/risk-compliance/portfolio-payment-analysis/references/metrics-and-reporting.md +170 -0
- package/skills/risk-compliance/portfolio-payment-analysis/references/risk-history.md +89 -0
- package/skills/risk-compliance/portfolio-payment-analysis/release-check.mjs +95 -0
- package/skills/risk-compliance/portfolio-payment-analysis/scripts/analyze.py +636 -0
- package/skills/risk-compliance/portfolio-payment-analysis/scripts/build_report.py +386 -0
- package/skills/risk-compliance/portfolio-payment-analysis/scripts/comparison_charts.py +425 -0
- package/skills/risk-compliance/portfolio-payment-analysis/scripts/csv_export.py +52 -0
- package/skills/risk-compliance/portfolio-payment-analysis/scripts/render.py +160 -0
- package/skills/risk-compliance/portfolio-payment-analysis/scripts/risk_history.py +435 -0
- package/skills/risk-compliance/similar-domain/SKILL.md +9 -4
- package/skills/risk-compliance/tld-detection/SKILL.md +124 -239
- package/skills/risk-compliance/tld-detection/agents/openai.yaml +1 -1
- package/skills/risk-compliance/tld-detection/references/clean.md +18 -51
- package/skills/risk-compliance/tld-detection/references/fx-conversion.md +56 -219
- package/skills/risk-compliance/tld-detection/references/metric-contract.md +109 -0
- package/skills/risk-compliance/tld-detection/references/pattern.md +99 -0
- package/skills/risk-compliance/tld-detection/references/report-template.md +49 -272
- package/skills/risk-compliance/tld-detection/scripts/detect_ladders.py +46 -13
- package/skills/risk-compliance/tld-detection/scripts/detect_patterns.py +346 -0
- package/skills/risk-compliance/tld-detection/scripts/detect_streams.py +51 -19
- package/skills/risk-compliance/tld-detection/scripts/profile_groups.py +109 -0
- package/skills/risk-compliance/tld-detection/scripts/render_charts.py +218 -0
- package/skills/risk-compliance/tld-detection/scripts/tld_common.py +243 -0
- package/skills/engineering/contributing/SKILL.md +0 -70
- package/skills/risk-compliance/fraud-analysis/SKILL.md +0 -114
- package/skills/risk-compliance/fraud-analysis/references/archetypes/third-party-fraud.md +0 -27
- package/skills/risk-compliance/fraud-analysis/references/contexts/card-payment.md +0 -30
- package/skills/risk-compliance/fraud-analysis/references/contexts/payment-collection.md +0 -20
- package/skills/risk-compliance/fraud-analysis/references/contexts/payout.md +0 -20
- package/skills/risk-compliance/fraud-analysis/references/workflow.md +0 -175
- package/skills/risk-compliance/tld-detection/references/chinese-polish.md +0 -55
- package/skills/risk-compliance/tld-detection/references/clustering.md +0 -235
- package/skills/risk-compliance/tld-detection/references/decision.md +0 -189
- package/skills/risk-compliance/tld-detection/references/streams.md +0 -141
- package/skills/risk-compliance/tld-detection/references/terminology.md +0 -95
- package/skills/risk-compliance/tld-detection/references/workflow.md +0 -95
- /package/skills/{engineering/contributing → core/write-report}/LICENSE +0 -0
- /package/skills/core/{write-doc → write-report}/references/reports/audit-report-template.md +0 -0
- /package/skills/core/{write-doc → write-report}/references/reports/external-assessment-template.md +0 -0
- /package/skills/core/{write-doc → write-report}/references/reports/management-report-template.md +0 -0
- /package/skills/core/{write-doc → write-report}/references/reports/vars-report-template.md +0 -0
- /package/skills/{engineering/contributing → core/write-report}/release-check.mjs +0 -0
- /package/skills/{risk-compliance/fraud-analysis → engineering/engineering}/LICENSE +0 -0
- /package/skills/engineering/{contributing → engineering}/references/tracker-conventions.md +0 -0
- /package/skills/{risk-compliance/fraud-analysis → engineering/engineering}/release-check.mjs +0 -0
- /package/skills/engineering/{contributing → engineering}/scripts/persist-conventions-core.mjs +0 -0
- /package/skills/risk-compliance/{fraud-analysis → fraud-detection}/references/archetypes/authorized-payment-scam.md +0 -0
- /package/skills/risk-compliance/{fraud-analysis → fraud-detection}/references/mechanisms/account-takeover.md +0 -0
- /package/skills/risk-compliance/{fraud-analysis → fraud-detection}/references/taxonomy.md +0 -0
- /package/skills/risk-compliance/{fraud-analysis → fraud-detection}/references/terminology.md +0 -0
package/README.md
CHANGED
|
@@ -49,11 +49,11 @@ See https://github.com/1aboveio/ai/blob/main/docs/native-codex.md for prerequisi
|
|
|
49
49
|
|
|
50
50
|
| Package | Also published as | Skills |
|
|
51
51
|
|---|---|---|
|
|
52
|
-
| `core` | `@1aboveio/core-skills` | distill-writing, doc-to-md, editorial-review, house-style, plain-language, polish-cn, reg-parser, terminology, write-doc |
|
|
53
|
-
| `engineering` | `@1aboveio/engineering-skills` | better-review,
|
|
52
|
+
| `core` | `@1aboveio/core-skills` | distill-writing, doc-to-md, editorial-review, house-style, plain-language, polish-cn, reg-parser, terminology, write-doc, write-report |
|
|
53
|
+
| `engineering` | `@1aboveio/engineering-skills` | better-review, e2e-test, engineering, engineering-runtime, ensure-coverage, golden-path, harness-runtime, resolve-issues, resolve-release, rush-issues, rush-release, test-quality |
|
|
54
54
|
| `cicd` | `@1aboveio/cicd-skills` | cloud-build, cloud-debug, cloud-deploy, docker, github-actions, github-flow, google-cloud, mergify, podman |
|
|
55
55
|
| `app-dev` | `@1aboveio/app-dev-skills` | airflow, android-foundation, app-debug, better-auth, data-catalog, data-quality, ios-foundation, monorepo, nextjs-fullstack, prisma-setup, pyspark, python-backend, shadcn, zod-v4 |
|
|
56
|
-
| `risk-compliance` | `@1aboveio/risk-compliance-skills` | compliance-audit, contract-compare, contract-review, doc-authenticity, fraud-analysis, payment-analysis, similar-domain, tld-detection |
|
|
56
|
+
| `risk-compliance` | `@1aboveio/risk-compliance-skills` | compliance-audit, contract-compare, contract-review, doc-authenticity, fraud-detection, payment-analysis, portfolio-payment-analysis, similar-domain, tld-detection |
|
|
57
57
|
| `content` | `@1aboveio/content-skills` | article-review, article-to-image, flowchart-svg, image-gen, mermaid, wechat-article-writer, wechat-publisher, wechat-search, xai-search |
|
|
58
58
|
|
|
59
59
|
## Third-party sources
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1aboveio/skills",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "Every 1aboveio skill package in one: install once, then choose which packages Pi loads with npx @1aboveio/skills select.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"nativeCodex": {
|
|
29
29
|
"schemaVersion": 1,
|
|
30
30
|
"metadataPath": ".codex-plugin/resources.json",
|
|
31
|
-
"metadataDigest": "
|
|
32
|
-
"releaseIdentity": "
|
|
31
|
+
"metadataDigest": "cfec0dbb2a45072ce16f0733139e1730ba67f7fe064f1da5d68182068eaaac95",
|
|
32
|
+
"releaseIdentity": "ce2cf9ba70959f8293367fbeacc76aae45340883cc856a0a16e3c85009eb506c"
|
|
33
33
|
},
|
|
34
34
|
"pi": {
|
|
35
35
|
"skills": [
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
{
|
|
46
46
|
"id": "core",
|
|
47
47
|
"packageName": "@1aboveio/core-skills",
|
|
48
|
-
"description": "Shared writing and document foundation: house style, plain-language replies, editorial review, Chinese polish, terminology, write-doc, distill-writing, doc-to-md and reg-parser.",
|
|
48
|
+
"description": "Shared writing and document foundation: house style, plain-language replies, editorial review, Chinese polish, terminology, write-doc, write-report, distill-writing, doc-to-md and reg-parser.",
|
|
49
49
|
"needsCore": false,
|
|
50
50
|
"skills": [
|
|
51
51
|
"distill-writing",
|
|
@@ -56,7 +56,8 @@
|
|
|
56
56
|
"polish-cn",
|
|
57
57
|
"reg-parser",
|
|
58
58
|
"terminology",
|
|
59
|
-
"write-doc"
|
|
59
|
+
"write-doc",
|
|
60
|
+
"write-report"
|
|
60
61
|
]
|
|
61
62
|
},
|
|
62
63
|
{
|
|
@@ -66,8 +67,8 @@
|
|
|
66
67
|
"needsCore": false,
|
|
67
68
|
"skills": [
|
|
68
69
|
"better-review",
|
|
69
|
-
"contributing",
|
|
70
70
|
"e2e-test",
|
|
71
|
+
"engineering",
|
|
71
72
|
"engineering-runtime",
|
|
72
73
|
"ensure-coverage",
|
|
73
74
|
"golden-path",
|
|
@@ -128,8 +129,9 @@
|
|
|
128
129
|
"contract-compare",
|
|
129
130
|
"contract-review",
|
|
130
131
|
"doc-authenticity",
|
|
131
|
-
"fraud-
|
|
132
|
+
"fraud-detection",
|
|
132
133
|
"payment-analysis",
|
|
134
|
+
"portfolio-payment-analysis",
|
|
133
135
|
"similar-domain",
|
|
134
136
|
"tld-detection"
|
|
135
137
|
]
|
|
@@ -258,7 +260,7 @@
|
|
|
258
260
|
]
|
|
259
261
|
}
|
|
260
262
|
],
|
|
261
|
-
"digest": "
|
|
263
|
+
"digest": "5253ec62b19b6f208d90dc8ccc9002ede0fbef6488803ddd8ac678a2a73aff58"
|
|
262
264
|
},
|
|
263
265
|
"publishConfig": {
|
|
264
266
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: airflow
|
|
3
3
|
description: Airflow DAG architecture and conventions. Use when designing, writing, reviewing, testing, or debugging Airflow DAGs and tasks, including TaskGroups, data intervals, timezone-aware date parameters, CLI validation, environment-based scheduling, and pytest integrity tests.
|
|
4
4
|
user-invocable: true
|
|
5
|
-
release-version: 0.
|
|
5
|
+
release-version: 0.45.1
|
|
6
6
|
---
|
|
7
7
|
**Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
|
|
8
8
|
# Airflow DAG Development Patterns
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: android-foundation
|
|
3
|
-
description: "Prove and debug Expo / React Native apps on an owned Android emulator. Use for stuck Android debugging, post-deploy startup or rendering failures, Metro answering while the app does not render, UiAutomator failures, missing controls, ADB drops, harness-test failures, APK builds, fresh SDK/NDK/JDK
|
|
4
|
-
release-version: 0.
|
|
3
|
+
description: "Prove and debug Expo / React Native apps on an owned Android emulator. Use for stuck Android debugging, post-deploy startup or rendering failures, Metro answering while the app does not render, UiAutomator failures, missing controls, ADB drops, harness-test failures, APK builds, assigned or fresh SDK/NDK/JDK workspace setup, and native journey validation. Before fixing and rerunning or redispatching a failed Android CI job, reproduce its failing checkpoint off CI: a rerun is not a debugger. Diagnose existing setups without rebuilding the whole environment. NOT for workflow YAML, CI speed or runner design (github-actions), browser tests (e2e-test), iOS (ios-foundation), plain Jest component tests, or signing and store release."
|
|
4
|
+
release-version: 0.45.1
|
|
5
5
|
---
|
|
6
6
|
**Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
|
|
7
7
|
# Android foundation
|
|
@@ -18,14 +18,15 @@ Pick the mode first:
|
|
|
18
18
|
- **Setup proof:** a new workspace or CI job, or a toolchain, dependency or native
|
|
19
19
|
change that invalidates setup. Run every stage and write the
|
|
20
20
|
[evidence record](#evidence-record).
|
|
21
|
-
- **Feature work:**
|
|
22
|
-
|
|
21
|
+
- **Feature work:** validating a product change in a workspace already set up. Follow
|
|
22
|
+
[Feature work](#feature-work): focused checks per candidate, targeted device checks
|
|
23
|
+
where needed, and integrated journeys at explicit checkpoints.
|
|
23
24
|
|
|
24
25
|
## Routing
|
|
25
26
|
|
|
26
27
|
| Step | Read |
|
|
27
28
|
| --- | --- |
|
|
28
|
-
|
|
|
29
|
+
| Workspace resolution, then shell snippets for every stage | [references/workspace.md](references/workspace.md), [references/setup.md](references/setup.md) |
|
|
29
30
|
| Stages 6–8 in one command | [scripts/device-run.sh](scripts/device-run.sh) |
|
|
30
31
|
| Adding the Android job to CI | [references/ci.md](references/ci.md), template [assets/android-ci-job.yml](assets/android-ci-job.yml) |
|
|
31
32
|
| Proving a product change on the emulator | [Feature work](#feature-work) |
|
|
@@ -34,10 +35,11 @@ Pick the mode first:
|
|
|
34
35
|
|
|
35
36
|
## Rules
|
|
36
37
|
|
|
37
|
-
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
- Resolve the workspace first; [references/workspace.md](references/workspace.md) owns
|
|
39
|
+
precedence: an assigned isolated workspace and candidate HEAD win, feature work, fixes and
|
|
40
|
+
diagnosis reuse the owned workspace, and standalone setup creates one managed workspace
|
|
41
|
+
only with no usable assignment. Read its actual HEAD; never substitute `origin/main`, a new
|
|
42
|
+
branch or another checkout, mutate a peer's checkout or symlink its writable `node_modules`.
|
|
41
43
|
- Tool shells keep no variables, functions or traps between calls. Write the environment
|
|
42
44
|
to `.cache/android-env.sh` once and source it at the start of every command. Use the
|
|
43
45
|
repo's existing owned-resource launcher. For a new local setup without one, use
|
|
@@ -66,9 +68,12 @@ Pick the mode first:
|
|
|
66
68
|
|
|
67
69
|
## Stages
|
|
68
70
|
|
|
69
|
-
|
|
71
|
+
These are the full setup-proof stages, not a per-candidate checklist. For established
|
|
72
|
+
workspaces, select checks under [Feature work](#feature-work). Run the selected stages
|
|
73
|
+
in dependency order. Stop at the first failure and triage it.
|
|
70
74
|
|
|
71
|
-
1. **
|
|
75
|
+
1. **Workspace and environment.** Resolve the assigned or standalone workspace
|
|
76
|
+
([references/workspace.md](references/workspace.md)) and export the private cache paths,
|
|
72
77
|
`JAVA_HOME` (JDK 17), `ANDROID_HOME` and `ANDROID_SDK_ROOT`. Print the versions of
|
|
73
78
|
node, pnpm, java, python3, adb and the emulator. Assert that each SDK component
|
|
74
79
|
directory exists. Read the journey wrapper and device harness for the names they expect:
|
|
@@ -113,9 +118,10 @@ Run them in this order. Stop at the first failure and triage it.
|
|
|
113
118
|
## Owned-resource cleanup
|
|
114
119
|
|
|
115
120
|
- Clean up only what this run started: the emulator child PID, the container ID from the
|
|
116
|
-
CID file, and the named database
|
|
117
|
-
|
|
118
|
-
|
|
121
|
+
CID file, and the named database; these are short-lived, unlike the development workspace
|
|
122
|
+
and its private caches. Signal the PID with `TERM`, wait up to 10 seconds, then `KILL`.
|
|
123
|
+
Then `wait` for it and confirm nothing is left. Count wait status 0 or 143 (ended by your
|
|
124
|
+
`TERM`) as a clean stop; count a needed `KILL` or any other status as a failure.
|
|
119
125
|
- Never use broad `pkill`, `docker system prune` or a shared `adb kill-server` for cleanup.
|
|
120
126
|
Use the live child's process owner, not an ADB serial that may be reused. A numeric
|
|
121
127
|
PID can also be reused after exit; it is not durable ownership evidence.
|
|
@@ -148,6 +154,14 @@ Follow the procedure below and [references/diagnosis.md](references/diagnosis.md
|
|
|
148
154
|
`diagnosing-bugs`, when available, can help with deeper hypothesis testing; it is not
|
|
149
155
|
required to use this skill.
|
|
150
156
|
|
|
157
|
+
The developer owns technical diagnosis. The coordinator owns its scope and broader
|
|
158
|
+
acceptance scheduling. Failures in focused implementation validation stay with the
|
|
159
|
+
developer within that task's scope. Failures after review handoff or in broader
|
|
160
|
+
acceptance get a separate bounded diagnosis assignment, which may use the same developer:
|
|
161
|
+
name the failed checkpoint, retained evidence, next question and return condition.
|
|
162
|
+
Return scope growth or inconclusive evidence to the coordinator; do not silently extend
|
|
163
|
+
implementation into a full acceptance campaign. Independent review checks the fix.
|
|
164
|
+
|
|
151
165
|
1. Record the failed SHA, actual checkout, build variant, device type and retained
|
|
152
166
|
evidence. Locate the earliest failing stage: build/install → launch → load code/assets
|
|
153
167
|
→ initialize → render → interact. Distinguish host/CI, harness, transport and product
|
|
@@ -164,7 +178,9 @@ required to use this skill.
|
|
|
164
178
|
4. Keep the first exception and its evidence separate from cleanup errors. Bound the
|
|
165
179
|
full command and each subprocess wait, allowing the resource owner time to clean up.
|
|
166
180
|
A live worker or an outstanding tool call is not evidence of progress.
|
|
167
|
-
5. Verify the fix at the failing checkpoint, then run the
|
|
181
|
+
5. Verify the fix at the failing checkpoint, then run the affected validation once.
|
|
182
|
+
Broader acceptance belongs to its scheduled integration or release checkpoint, not
|
|
183
|
+
automatically to this diagnosis assignment. Preserve any explicitly required gate.
|
|
168
184
|
Report local reproduction, source CI and post-deploy acceptance separately. A local
|
|
169
185
|
result on another API/ABI or a copied APK is not proof of the original CI artifact.
|
|
170
186
|
|
|
@@ -208,33 +224,15 @@ build is reliable.
|
|
|
208
224
|
|
|
209
225
|
## Feature work
|
|
210
226
|
|
|
211
|
-
-
|
|
212
|
-
|
|
213
|
-
- Build the emulator ABI when its inputs changed and run the repo's owned journey
|
|
214
|
-
command once per candidate HEAD. A reused APK needs the source/configuration checks
|
|
215
|
-
the repo requires; record its hash and any provenance gap during diagnosis.
|
|
216
|
-
- After a failed journey, local or a CI dispatch, enter Diagnosis mode and reproduce the
|
|
217
|
-
failing checkpoint off CI before running it again. A fake UI can reproduce a harness
|
|
218
|
-
navigation/scrolling bug; it cannot prove that the app loaded a bundle or rendered.
|
|
219
|
-
Show the fix passes at the appropriate seam, then run the journey once to confirm.
|
|
220
|
-
Never send a guessed fix to CI to see whether it passes. Use the Diagnosis continuation
|
|
221
|
-
rule for unreproduced or intermittent failures; report uncertainty until evidence
|
|
222
|
-
supports the cause.
|
|
223
|
-
- For a passing feature run, report the source SHA, journey command, `PASS` markers and
|
|
224
|
-
cleanup exit. For a failure, also name the earliest failing checkpoint, link retained
|
|
225
|
-
evidence and state what remains unproved; use the diagnosis report instead of hiding
|
|
226
|
-
the failed attempts.
|
|
227
|
-
- Integrated device acceptance (all ABIs, tablet, TalkBack, physical devices, a release
|
|
228
|
-
device campaign) runs at the release or campaign gate the spec or repo assigns it. Do
|
|
229
|
-
not recreate it per feature. Record it once, as pending, in its owning issue, never as
|
|
230
|
-
passed.
|
|
227
|
+
Read [references/feature-work.md](references/feature-work.md) before validating a
|
|
228
|
+
product change in an established workspace. Preserve required CI and acceptance gates.
|
|
231
229
|
|
|
232
230
|
## Evidence record
|
|
233
231
|
|
|
234
232
|
For setup proof only. Record:
|
|
235
233
|
|
|
236
|
-
- Source SHA
|
|
237
|
-
emulator versions.
|
|
234
|
+
- Source SHA and the workspace root/path/base/branch/owner from the lifecycle record; host OS
|
|
235
|
+
and architecture, the Expo SDK, and the node, pnpm, JDK, Python and emulator versions.
|
|
238
236
|
- System image API, image type and ABI. The AVD name, serial and ports are run
|
|
239
237
|
identifiers, not shared resources.
|
|
240
238
|
- Each stage's exit status and duration.
|
|
@@ -9,8 +9,10 @@ its own checkpoint, so this does not serialize unrelated work.
|
|
|
9
9
|
one already exists. Do not start a baseline campaign or count that old artifact as proof
|
|
10
10
|
of the candidate. Reuse caches and valid results under the repo's ownership rules.
|
|
11
11
|
- Run the smallest test that reaches the failing behavior. After it supports the fix,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
complete focused validation and hand off to independent review. Run affected integrated
|
|
13
|
+
acceptance at its explicit plan checkpoint and preserve required CI; do not repeatedly
|
|
14
|
+
rebuild the full campaign to discover the next local defect or defer all journeys to
|
|
15
|
+
the final task.
|
|
14
16
|
- Before adding a service, transport or test abstraction, state which existing criterion
|
|
15
17
|
needs it, why the current path cannot answer the question and the smallest alternative.
|
|
16
18
|
Make routine choices within authorization; preserve shared-resource and acceptance
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Feature work
|
|
2
|
+
|
|
3
|
+
Read the repository's validation and delivery policy first. Preserve required CI and
|
|
4
|
+
acceptance gates; this skill does not authorize skipping them or rewriting project
|
|
5
|
+
policy. Keep validation early without repeating the entire campaign per candidate.
|
|
6
|
+
|
|
7
|
+
| Stage | Scope | Ownership |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| Every candidate | Relevant tests, typecheck and applicable build/export checks; targeted device checks for runtime-sensitive behavior. | Developer validates, reports evidence and gaps, then hands off to independent review. |
|
|
10
|
+
| Integration checkpoint | Affected journeys through combined changes. | Coordinator schedules a separate validation task as soon as its prerequisites are ready. |
|
|
11
|
+
| Final acceptance | Remaining cross-feature, device-matrix and release obligations, plus checks invalidated by later changes. | Coordinator accounts for all required gates, reusing earlier evidence only within its proven scope. |
|
|
12
|
+
|
|
13
|
+
- Name focused checks and integrated journey checkpoints in the plan before implementation,
|
|
14
|
+
with real prerequisites, an owner and observable results. Do not put all device testing
|
|
15
|
+
in the last task. Start independent ready work concurrently within device/host capacity
|
|
16
|
+
and existing ownership boundaries.
|
|
17
|
+
- Choose the smallest check that proves the affected behavior. Host tests can prove logic
|
|
18
|
+
or a harness correction; native integration, navigation, keyboard, lifecycle and
|
|
19
|
+
accessibility changes need targeted owned-device evidence where host tests cannot prove
|
|
20
|
+
runtime behavior. A successful build/export alone is not device proof.
|
|
21
|
+
- Use existing supported journey selectors. If the harness cannot select the affected
|
|
22
|
+
flow, report that limitation and schedule the smallest existing journey that covers it.
|
|
23
|
+
Do not invent a flag, weaken assertions or silently omit device validation. For example,
|
|
24
|
+
a filter change needs open/edit/apply/result evidence, not an unrelated payment campaign.
|
|
25
|
+
- Reuse the workspace's private caches, venv and AVD configuration. Rerun setup stages only
|
|
26
|
+
when their assumptions change. Rebuild when build inputs change, using the emulator ABI
|
|
27
|
+
for focused work only where repository policy permits it. Do not require a fresh full
|
|
28
|
+
build or full journey solely because the candidate HEAD changed. APK reuse still needs
|
|
29
|
+
the source/configuration and artifact checks the repo requires; never relabel an old
|
|
30
|
+
artifact or result as current-source proof.
|
|
31
|
+
- At each checkpoint, state what changed and which earlier evidence that change invalidates.
|
|
32
|
+
Reuse evidence only while source, configuration, artifact and environment remain applicable
|
|
33
|
+
to the claimed behavior. Required current-source CI still runs; evidence reuse cannot
|
|
34
|
+
replace a gate that requires a new run.
|
|
35
|
+
- After a failed journey, local or a CI dispatch, enter Diagnosis mode and reproduce the
|
|
36
|
+
failing checkpoint off CI before running it again. A fake UI can reproduce a harness
|
|
37
|
+
navigation/scrolling bug; it cannot prove that the app loaded a bundle or rendered.
|
|
38
|
+
Show the fix passes at the appropriate boundary, then rerun the affected check once.
|
|
39
|
+
Never send a guessed fix to CI to see whether it passes. Use the Diagnosis continuation
|
|
40
|
+
rule for unreproduced or intermittent failures; report uncertainty until evidence
|
|
41
|
+
supports the cause.
|
|
42
|
+
- Report source SHA, commands, results and remaining gaps at review handoff. For device
|
|
43
|
+
checks, include the selected scenarios, `PASS` markers and cleanup exit. For a failure,
|
|
44
|
+
name the earliest failing checkpoint and link retained evidence; preserve failed attempts.
|
|
45
|
+
Separate build duration, device-check duration and total worker time when discussing cost.
|
|
46
|
+
- Broader device acceptance (all ABIs, tablet, TalkBack, physical devices, a release device
|
|
47
|
+
campaign) runs at the integration, release or campaign checkpoint the spec or repo assigns
|
|
48
|
+
it. Do not recreate it per feature or postpone affected runtime checks until release.
|
|
49
|
+
Record outstanding criteria as pending in their owning task or issue, never as passed.
|
|
50
|
+
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
# Android foundation: shell snippets
|
|
2
2
|
|
|
3
3
|
Replace each `<placeholder>` with the repo's real value. Tool shells do not keep variables,
|
|
4
|
-
functions or traps between calls: step 1
|
|
5
|
-
|
|
6
|
-
`scripts/device-run.sh`.
|
|
4
|
+
functions or traps between calls: step 1 resolves the workspace and writes
|
|
5
|
+
`.cache/android-env.sh`, which also `cd`s into it; every later block starts by sourcing it by
|
|
6
|
+
absolute path, and steps 6–8 run as one command through the bundled `scripts/device-run.sh`.
|
|
7
7
|
|
|
8
|
-
## 1.
|
|
8
|
+
## 1. Workspace and environment
|
|
9
|
+
|
|
10
|
+
Workspace precedence is owned by [workspace.md](workspace.md). Do not create a worktree,
|
|
11
|
+
switch branch, fetch or reset when the caller supplied an isolated workspace.
|
|
9
12
|
|
|
10
13
|
```bash
|
|
11
14
|
set -euo pipefail
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
ASSIGNED_WORKSPACE=<assigned-workspace-or-empty>
|
|
16
|
+
CANDIDATE_HEAD=<candidate-head-or-empty>
|
|
17
|
+
WORKSPACE="${ASSIGNED_WORKSPACE:?use the caller assignment or native-start result from workspace.md}"
|
|
18
|
+
test -d "$WORKSPACE"
|
|
19
|
+
git -C "$WORKSPACE" rev-parse --is-inside-work-tree >/dev/null
|
|
20
|
+
cd "$WORKSPACE"
|
|
21
|
+
actual_head="$(git rev-parse HEAD)"
|
|
22
|
+
test -z "$CANDIDATE_HEAD" || test "$actual_head" = "$(git rev-parse "$CANDIDATE_HEAD^{commit}")" || {
|
|
23
|
+
echo "workspace HEAD $actual_head != candidate $CANDIDATE_HEAD; report it; do not switch" >&2
|
|
24
|
+
exit 1
|
|
25
|
+
}
|
|
16
26
|
mkdir -p .cache
|
|
17
|
-
{ echo 'set -euo pipefail'; printf 'cd %q\n' "$PWD"; } > .cache/android-env.sh
|
|
27
|
+
{ echo 'set -euo pipefail'; printf 'cd %q\n' "$PWD"; printf 'export ANDROID_SOURCE_HEAD=%q\n' "$actual_head"; } > .cache/android-env.sh
|
|
18
28
|
cat >> .cache/android-env.sh <<'ENV'
|
|
19
29
|
|
|
20
30
|
# Repo-specific names, read from the repo's journey wrapper and device harness.
|
|
@@ -65,6 +75,11 @@ for component in platforms/android-<api> build-tools/<build-tools> ndk/<ndk> cma
|
|
|
65
75
|
done
|
|
66
76
|
```
|
|
67
77
|
|
|
78
|
+
The recorded standalone path is reused on retries; verify its lifecycle record names this
|
|
79
|
+
run, branch and base. If an assigned path is missing, is not a Git worktree, or is at another
|
|
80
|
+
revision, stop and report instead of creating another checkout. Never fall back to
|
|
81
|
+
`../<repo>-android-setup`.
|
|
82
|
+
|
|
68
83
|
If the wrapper reads ports or Python under other names, export aliases in
|
|
69
84
|
`android-env.sh` **as well as** the bundled runner's required names. For example,
|
|
70
85
|
`export APP_METRO_PORT="$ANDROID_METRO_PORT"`; both must select the same port. Adapt
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Android workspace lifecycle
|
|
2
|
+
|
|
3
|
+
The coordinator or caller owns workspace selection. Resolve it once, before any setup stage,
|
|
4
|
+
and record the result. This reference owns only that lifecycle: private caches, SDK isolation,
|
|
5
|
+
emulator ownership and process cleanup stay in [setup.md](setup.md) and
|
|
6
|
+
[Owned-resource cleanup](../SKILL.md#owned-resource-cleanup).
|
|
7
|
+
|
|
8
|
+
## Precedence
|
|
9
|
+
|
|
10
|
+
1. **Assigned workspace and candidate HEAD.** When the caller supplies an isolated workspace
|
|
11
|
+
and a candidate HEAD, use that workspace and that revision. Do not create a worktree or
|
|
12
|
+
branch, fetch, reset or switch revisions. Read `git rev-parse HEAD` and report it as the
|
|
13
|
+
source SHA. If it differs from the candidate HEAD, stop and report the mismatch; never
|
|
14
|
+
switch the workspace to match.
|
|
15
|
+
2. **Existing owned workspace.** Feature work, fixes and diagnosis reuse the workspace this
|
|
16
|
+
run or unit already owns, with its private caches, venv and AVD profile. Do not make a
|
|
17
|
+
second workspace for a retry, a correction or a read-only investigation.
|
|
18
|
+
3. **Standalone fresh setup.** Only when the coordinator reports no usable assignment. Create
|
|
19
|
+
one managed workspace at
|
|
20
|
+
`<repo>/.resolve-issues/rush/<run-id>/units/native`. Never create a sibling checkout such
|
|
21
|
+
as `../<repo>-android-setup`, and never add a second managed path for a retry.
|
|
22
|
+
|
|
23
|
+
Android and iOS setup in the same run share that one managed workspace; their private cache
|
|
24
|
+
subdirectories and short-lived processes stay separate.
|
|
25
|
+
|
|
26
|
+
An assigned path that is missing, is not a Git worktree, or is at another revision is not an
|
|
27
|
+
invitation to substitute a fresh checkout: stop and report it. For diagnosis, name the actual
|
|
28
|
+
checkout and HEAD and confirm it contains the failing code; the repository root or another
|
|
29
|
+
checkout may lag the candidate.
|
|
30
|
+
|
|
31
|
+
## Record before creating
|
|
32
|
+
|
|
33
|
+
The bundled `scripts/workspace-runtime` is generated from the shared lifecycle
|
|
34
|
+
engine and ships with this skill. Only for standalone fresh setup, run:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
node <skill-base-dir>/scripts/workspace-runtime/bin/workspaces.mjs native-start --repo <canonical-root> \
|
|
38
|
+
--platform android --target <verified-target-branch> --base <candidate-SHA> --json
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The command records root, owner, exact base, branch, workspace and disposable cache
|
|
42
|
+
paths before creating anything. Use its returned `workspace` as `ASSIGNED_WORKSPACE`
|
|
43
|
+
and `sourceSha` as `CANDIDATE_HEAD` in setup. Keep `run` and `runId`; repeat with
|
|
44
|
+
`--run-id <returned-run-id>` and the same base, target and kind for retries. Never
|
|
45
|
+
invoke it inside a coordinator-assigned unit. It never substitutes `origin/main`
|
|
46
|
+
for the requested source or resets an existing workspace.
|
|
47
|
+
For a package below the root, pass `--native-dir <package-root-containing-android>`.
|
|
48
|
+
Declare other installs or build directories before use with repeated
|
|
49
|
+
`--disposable <exact-workspace-relative-path>`, including package-local `node_modules`.
|
|
50
|
+
|
|
51
|
+
## Development workspace vs short-lived processes
|
|
52
|
+
|
|
53
|
+
The workspace, its private caches under `.cache/`, its venv and its AVD profile are
|
|
54
|
+
development resources: retain them across retries and fixes, and keep them private to this
|
|
55
|
+
workspace. Never relocate them to a global cache or share them with a concurrent owner.
|
|
56
|
+
|
|
57
|
+
Emulators, containers, databases, Metro and ADB endpoints are short-lived: start only those
|
|
58
|
+
the selected checks need and stop only the ones this run started, under the existing
|
|
59
|
+
[cleanup rules](../SKILL.md#owned-resource-cleanup). Never delete a worktree, remove a cache
|
|
60
|
+
with a chmod or `rm` pattern, or use a broad kill to end a process.
|
|
61
|
+
|
|
62
|
+
A read-only diagnosis does not require a clean environment. Reuse the owned workspace and its
|
|
63
|
+
caches, create only the services the observation needs, and preserve the failed environment's
|
|
64
|
+
evidence. Do not rebuild, reinstall or re-provision merely because the failure is being
|
|
65
|
+
investigated.
|
|
66
|
+
|
|
67
|
+
## Completion
|
|
68
|
+
|
|
69
|
+
At the end of the assignment, return the workspace, its cache paths and any retained process
|
|
70
|
+
records to the coordinator for final cleanup. The coordinator owns deletion and retention.
|
|
71
|
+
Register the path with the run's cleanup owner so final cleanup can tell a delivered
|
|
72
|
+
standalone run from unfinished or unpublished work.
|
|
73
|
+
|
|
74
|
+
- A successful, delivered standalone run must not retain an unbounded cache: mark the
|
|
75
|
+
workspace and its disposable caches for final cleanup. After stopping its owned
|
|
76
|
+
services, run `node <skill-base-dir>/scripts/workspace-runtime/bin/workspaces.mjs native-finish --run <run> --json`
|
|
77
|
+
from the owner checkout. This uses the same cleanup engine as issue workflows.
|
|
78
|
+
- Unfinished or unpublished standalone work keeps the workspace and caches for the next
|
|
79
|
+
attempt; report what is retained and why.
|
|
80
|
+
|
|
81
|
+
The parent lifecycle record is authoritative for ownership, retention and final cleanup.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { execFileSync } from 'node:child_process'
|
|
3
|
+
import { prepare, cleanup, recover, inventory } from '../workspace-lifecycle.mjs'
|
|
4
|
+
import { nativeStart, nativeFinish } from '../native-workspace.mjs'
|
|
5
|
+
|
|
6
|
+
const allowed = {
|
|
7
|
+
prepare: ['run', 'unit', 'revision', 'apply', 'json'],
|
|
8
|
+
cleanup: ['run', 'unit', 'revision', 'apply', 'json'],
|
|
9
|
+
recover: ['repo', 'json'],
|
|
10
|
+
inventory: ['repo', 'root', 'max-entries', 'max-depth', 'json'],
|
|
11
|
+
'native-start': ['repo', 'run-id', 'base', 'branch', 'target', 'platform', 'kind', 'native-dir', 'disposable', 'json'],
|
|
12
|
+
'native-finish': ['run', 'json'],
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function options(command, args) {
|
|
16
|
+
if (!Object.hasOwn(allowed, command)) throw new Error('expected prepare, cleanup, recover, inventory, native-start or native-finish')
|
|
17
|
+
const out = {}
|
|
18
|
+
for (let index = 0; index < args.length; index++) {
|
|
19
|
+
const name = args[index].replace(/^--/, '')
|
|
20
|
+
if (!args[index].startsWith('--') || !allowed[command].includes(name)) throw new Error(`invalid ${command} option: ${args[index]}`)
|
|
21
|
+
const key = name.replace(/-([a-z])/g, (_, value) => value.toUpperCase())
|
|
22
|
+
if (Object.hasOwn(out, key) && name !== 'disposable') throw new Error(`duplicate option: --${name}`)
|
|
23
|
+
if (name === 'apply' || name === 'json') { out[key] = true; continue }
|
|
24
|
+
const value = args[++index]
|
|
25
|
+
if (value === undefined || value.startsWith('--')) throw new Error(`--${name} needs a value`)
|
|
26
|
+
if (name === 'disposable') (out[key] ??= []).push(value)
|
|
27
|
+
else out[key] = value
|
|
28
|
+
}
|
|
29
|
+
for (const key of ['revision', 'maxEntries', 'maxDepth']) {
|
|
30
|
+
if (out[key] === undefined) continue
|
|
31
|
+
if (!/^\d+$/.test(out[key]) || !Number.isSafeInteger(Number(out[key]))) throw new Error(`invalid ${key}`)
|
|
32
|
+
out[key] = Number(out[key])
|
|
33
|
+
}
|
|
34
|
+
return out
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
const [command, ...args] = process.argv.slice(2)
|
|
39
|
+
const opts = options(command, args)
|
|
40
|
+
let result
|
|
41
|
+
if (command === 'native-start') result = nativeStart(opts)
|
|
42
|
+
else if (command === 'native-finish') result = nativeFinish(opts)
|
|
43
|
+
else if (command === 'prepare') result = prepare(opts)
|
|
44
|
+
else if (command === 'cleanup') result = cleanup({ ...opts, runGh: (argv) => execFileSync('gh', argv, { encoding: 'utf8', timeout: 30_000, maxBuffer: 4 * 1024 * 1024, stdio: ['ignore', 'pipe', 'pipe'] }) })
|
|
45
|
+
else if (command === 'recover') result = recover(opts)
|
|
46
|
+
else result = inventory(opts)
|
|
47
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`)
|
|
48
|
+
process.exitCode = result.ok === false ? 1 : 0
|
|
49
|
+
} catch (error) {
|
|
50
|
+
process.stderr.write(`${error.message}\n`)
|
|
51
|
+
process.exitCode = 2
|
|
52
|
+
}
|