@yasaswy.nagavolu/agents 0.33.0 → 0.35.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 +12 -1
- package/content/manifest.json +56 -0
- package/content/manifest.schema.json +23 -0
- package/content/proxy/register_mem_sampler.ps1 +6 -0
- package/content/skills/README.md +4 -0
- package/content/skills/expo-release/SKILL.md +67 -0
- package/content/skills/expo-release/expo_release.py +204 -0
- package/content/skills/expo-release/templates/gitlab-ci.yml.tmpl +63 -0
- package/content/skills/expo-release/templates/release-kit.yml.tmpl +7 -0
- package/content/skills/expo-release/tests/test_expo_release.py +173 -0
- package/content/skills/gmail-reader/README.md +1 -0
- package/content/skills/gmail-reader/SKILL.md +3 -1
- package/content/skills/gmail-reader/gmail_reader/htmltext.py +23 -3
- package/content/skills/gmail-reader/gmail_reader/purchases/__init__.py +2 -2
- package/content/skills/gmail-reader/gmail_reader/purchases/data/vendors.json +3 -0
- package/content/skills/gmail-reader/gmail_reader/purchases/parse.py +148 -19
- package/content/skills/gmail-reader/gmail_reader/purchases/proof.py +27 -3
- package/content/skills/gmail-reader/gmail_reader/purchases/scan.py +20 -13
- package/content/skills/gmail-reader/gmail_reader/version.py +1 -1
- package/content/skills/gmail-reader/tests/conftest.py +1 -19
- package/content/skills/gmail-reader/tests/gmail_home_guard.py +19 -0
- package/content/skills/gmail-reader/tests/test_purchase_parsers.py +65 -0
- package/content/skills/gmail-reader/tests/test_returns.py +106 -0
- package/content/skills/gmail-reader/tests/test_scan.py +1 -1
- package/content/skills/gmail-reader/tests/test_secrets_isolation.py +3 -3
- package/content/skills/gmail-reader/tests/test_split_orders.py +120 -0
- package/content/skills/html-mocker/audit.js +10 -4
- package/content/skills/html-mocker/tests/test_audit.py +15 -0
- package/content/skills/low-ram-advisor/handlecount.py +32 -17
- package/content/skills/low-ram-advisor/tests/test_handlecount.py +16 -0
- package/content/skills/make-space/tests/conftest.py +1 -96
- package/content/skills/make-space/tests/make_space_support.py +99 -0
- package/content/skills/make-space/tests/test_make_space.py +2 -2
- package/content/skills/make-space/tests/test_scratch_cleanup.py +1 -1
- package/content/skills/make-space/tests/test_worktree_audit.py +1 -1
- package/content/skills/publish-article/SKILL.md +6 -1
- package/content/skills/publish-article/publish_article.py +38 -1
- package/content/skills/publish-article/released_bundles.py +56 -0
- package/content/skills/publish-article/skill_drift.py +42 -0
- package/content/skills/publish-article/tests/test_publish_article.py +212 -0
- package/content/skills/resale/CONTRACTS.md +52 -8
- package/content/skills/resale/README.md +132 -12
- package/content/skills/resale/SKILL.md +16 -7
- package/content/skills/resale/container/docker-compose.yml +14 -1
- package/content/skills/resale/prompts/comps_review.md +19 -0
- package/content/skills/resale/resale/analysis/bundle.py +63 -0
- package/content/skills/resale/resale/analysis/commands.py +30 -1
- package/content/skills/resale/resale/analysis/gather.py +8 -6
- package/content/skills/resale/resale/analysis/runner.py +19 -2
- package/content/skills/resale/resale/analysis/stats.py +15 -0
- package/content/skills/resale/resale/api_client.py +34 -0
- package/content/skills/resale/resale/cadence/__init__.py +2 -2
- package/content/skills/resale/resale/cadence/budget.py +37 -6
- package/content/skills/resale/resale/comps/commands.py +86 -0
- package/content/skills/resale/resale/comps/market_value.py +8 -4
- package/content/skills/resale/resale/comps/ranking.py +4 -2
- package/content/skills/resale/resale/comps/relevance.py +53 -2
- package/content/skills/resale/resale/comps/review_runner.py +197 -0
- package/content/skills/resale/resale/comps/specs.py +122 -0
- package/content/skills/resale/resale/conditions.py +12 -0
- package/content/skills/resale/resale/contracts/__init__.py +11 -1
- package/content/skills/resale/resale/contracts/amazon_orders.schema.json +52 -0
- package/content/skills/resale/resale/contracts/comp_decisions.schema.json +22 -0
- package/content/skills/resale/resale/contracts/item_specs.schema.json +29 -0
- package/content/skills/resale/resale/db/migrations/0011_item_images.sql +25 -0
- package/content/skills/resale/resale/db/migrations/0012_page_images.sql +6 -0
- package/content/skills/resale/resale/db/migrations/0013_display_name_inbox.sql +9 -0
- package/content/skills/resale/resale/db/migrations/0014_listing_drafts.sql +16 -0
- package/content/skills/resale/resale/db/migrations/0015_post_kit.sql +14 -0
- package/content/skills/resale/resale/db/migrations/0016_comps_review.sql +12 -0
- package/content/skills/resale/resale/db/migrations/0017_search_terms.sql +1 -0
- package/content/skills/resale/resale/db/single_writer.py +2 -1
- package/content/skills/resale/resale/http_util.py +22 -0
- package/content/skills/resale/resale/portal/bundles.py +71 -10
- package/content/skills/resale/resale/portal/layout.py +123 -10
- package/content/skills/resale/resale/portal/market_cells.py +62 -8
- package/content/skills/resale/resale/portal/names.py +35 -0
- package/content/skills/resale/resale/portal/panel.py +73 -0
- package/content/skills/resale/resale/portal/photos.py +111 -0
- package/content/skills/resale/resale/portal/tablesort.py +3 -2
- package/content/skills/resale/resale/portal/views_analysis.py +82 -9
- package/content/skills/resale/resale/portal/views_items.py +239 -126
- package/content/skills/resale/resale/portal/views_misc.py +35 -3
- package/content/skills/resale/resale/portal/views_postkit.py +237 -0
- package/content/skills/resale/resale/portal/views_reader.py +15 -3
- package/content/skills/resale/resale/portal/views_search.py +5 -4
- package/content/skills/resale/resale/postkit/__init__.py +5 -0
- package/content/skills/resale/resale/postkit/drafts.py +222 -0
- package/content/skills/resale/resale/postkit/groups.py +45 -0
- package/content/skills/resale/resale/postkit/platforms.py +113 -0
- package/content/skills/resale/resale/postkit/posting.py +65 -0
- package/content/skills/resale/resale/postkit/pricing.py +87 -0
- package/content/skills/resale/resale/postkit/text.py +224 -0
- package/content/skills/resale/resale/publisher/pricing.py +2 -0
- package/content/skills/resale/resale/publisher/review.py +8 -1
- package/content/skills/resale/resale/receipts/amazon_history.py +208 -0
- package/content/skills/resale/resale/receipts/commands.py +15 -0
- package/content/skills/resale/resale/receipts/intake.py +18 -4
- package/content/skills/resale/resale/receipts/links.py +61 -0
- package/content/skills/resale/resale/receipts/reader_link.py +1 -1
- package/content/skills/resale/resale/receipts/review.py +2 -2
- package/content/skills/resale/resale/receipts/store.py +189 -38
- package/content/skills/resale/resale/service/app.py +12 -5
- package/content/skills/resale/resale/service/backup.py +362 -52
- package/content/skills/resale/resale/service/commands.py +98 -5
- package/content/skills/resale/resale/service/comp_gate.py +98 -0
- package/content/skills/resale/resale/service/comps_refresh.py +16 -0
- package/content/skills/resale/resale/service/comps_review.py +191 -0
- package/content/skills/resale/resale/service/comps_sanity.py +31 -0
- package/content/skills/resale/resale/service/comps_service.py +18 -10
- package/content/skills/resale/resale/service/display_names.py +69 -0
- package/content/skills/resale/resale/service/drafts.py +170 -0
- package/content/skills/resale/resale/service/ebay_follow.py +19 -0
- package/content/skills/resale/resale/service/ebay_poller.py +73 -21
- package/content/skills/resale/resale/service/fetch.py +80 -0
- package/content/skills/resale/resale/service/inventory_ops.py +47 -17
- package/content/skills/resale/resale/service/market.py +23 -14
- package/content/skills/resale/resale/service/multipart.py +13 -7
- package/content/skills/resale/resale/service/pageimage.py +83 -0
- package/content/skills/resale/resale/service/photo_inbox.py +141 -0
- package/content/skills/resale/resale/service/photos.py +138 -0
- package/content/skills/resale/resale/service/queries.py +94 -2
- package/content/skills/resale/resale/service/reader_state.py +2 -1
- package/content/skills/resale/resale/service/scheduler.py +46 -3
- package/content/skills/resale/resale/service/search_terms_plan.py +80 -0
- package/content/skills/resale/resale/service/server.py +258 -22
- package/content/skills/resale/resale/service/stock_photos.py +207 -0
- package/content/skills/resale/resale/settings.py +40 -0
- package/content/skills/resale/resale/sources/__init__.py +1 -0
- package/content/skills/resale/resale/sources/amazon_orders.py +260 -0
- package/content/skills/resale/resale/sources/amazon_reader.py +245 -0
- package/content/skills/resale/resale/sources/astromart.py +37 -9
- package/content/skills/resale/resale/sources/client.py +8 -0
- package/content/skills/resale/resale/sources/commands.py +55 -5
- package/content/skills/resale/resale/sources/craigslist.py +8 -2
- package/content/skills/resale/resale/sources/ebay.py +8 -4
- package/content/skills/resale/resale/sources/guards.py +3 -3
- package/content/skills/resale/resale/sources/httppage.py +15 -0
- package/content/skills/resale/resale/sources/logins.py +5 -1
- package/content/skills/resale/resale/sources/model.py +4 -0
- package/content/skills/resale/resale/sources/readonly_lint.py +1 -1
- package/content/skills/resale/resale/sources/runner.py +66 -21
- package/content/skills/resale/settings.example.env +20 -1
- package/content/skills/resale/tasks/comps_review_task.py +21 -0
- package/content/skills/resale/tasks/task_items.json +21 -2
- package/content/skills/resale/tests/conftest.py +1 -19
- package/content/skills/resale/tests/fixtures/amazon/captcha.html +2 -0
- package/content/skills/resale/tests/fixtures/amazon/history_2023.html +6 -0
- package/content/skills/resale/tests/fixtures/amazon/history_empty.html +1 -0
- package/content/skills/resale/tests/fixtures/amazon/order_cancelled_returned.html +16 -0
- package/content/skills/resale/tests/fixtures/amazon/order_discount_single.html +10 -0
- package/content/skills/resale/tests/fixtures/amazon/order_new_layout.html +38 -0
- package/content/skills/resale/tests/fixtures/amazon/order_not_found.html +1 -0
- package/content/skills/resale/tests/fixtures/amazon/order_old_layout.html +33 -0
- package/content/skills/resale/tests/fixtures/amazon/signin.html +1 -0
- package/content/skills/resale/tests/postkit_support.py +58 -0
- package/content/skills/resale/tests/resale_home_guard.py +19 -0
- package/content/skills/resale/tests/service_support.py +18 -2
- package/content/skills/resale/tests/test_amazon_history.py +249 -0
- package/content/skills/resale/tests/test_amazon_orders_parse.py +76 -0
- package/content/skills/resale/tests/test_amazon_reader.py +240 -0
- package/content/skills/resale/tests/test_amazon_service_and_login.py +131 -0
- package/content/skills/resale/tests/test_analysis_service.py +7 -5
- package/content/skills/resale/tests/test_backup.py +351 -0
- package/content/skills/resale/tests/test_bundle.py +332 -0
- package/content/skills/resale/tests/test_cadence.py +29 -0
- package/content/skills/resale/tests/test_candidates_review.py +11 -0
- package/content/skills/resale/tests/test_comps_relevance.py +10 -0
- package/content/skills/resale/tests/test_comps_review.py +443 -0
- package/content/skills/resale/tests/test_comps_review_task.py +216 -0
- package/content/skills/resale/tests/test_comps_specs.py +74 -0
- package/content/skills/resale/tests/test_conditions.py +7 -0
- package/content/skills/resale/tests/test_db.py +15 -0
- package/content/skills/resale/tests/test_display_names_apply.py +79 -0
- package/content/skills/resale/tests/test_ebay_live_quality.py +224 -0
- package/content/skills/resale/tests/test_founder_hide.py +50 -4
- package/content/skills/resale/tests/test_isolation.py +3 -3
- package/content/skills/resale/tests/test_market_service.py +9 -6
- package/content/skills/resale/tests/test_market_trust.py +7 -4
- package/content/skills/resale/tests/test_market_value.py +11 -1
- package/content/skills/resale/tests/test_photo_inbox.py +147 -0
- package/content/skills/resale/tests/test_photos_fetch.py +84 -0
- package/content/skills/resale/tests/test_photos_service.py +264 -0
- package/content/skills/resale/tests/test_portal_bundle_fold.py +125 -0
- package/content/skills/resale/tests/test_portal_bundles.py +57 -4
- package/content/skills/resale/tests/test_portal_candidates.py +5 -5
- package/content/skills/resale/tests/test_portal_inplace.py +126 -0
- package/content/skills/resale/tests/test_portal_layout.py +111 -0
- package/content/skills/resale/tests/test_portal_market.py +41 -15
- package/content/skills/resale/tests/test_portal_names.py +86 -0
- package/content/skills/resale/tests/test_portal_photos.py +150 -0
- package/content/skills/resale/tests/test_portal_postkit.py +181 -0
- package/content/skills/resale/tests/test_portal_sort.py +5 -4
- package/content/skills/resale/tests/test_portal_split.py +227 -0
- package/content/skills/resale/tests/test_portal_theme.py +11 -3
- package/content/skills/resale/tests/test_postkit.py +538 -0
- package/content/skills/resale/tests/test_publisher_api.py +3 -1
- package/content/skills/resale/tests/test_publisher_commands.py +2 -0
- package/content/skills/resale/tests/test_publisher_pricing.py +5 -2
- package/content/skills/resale/tests/test_publisher_review.py +23 -1
- package/content/skills/resale/tests/test_reader_live_pages.py +2 -2
- package/content/skills/resale/tests/test_reader_notify.py +2 -2
- package/content/skills/resale/tests/test_reader_parsers.py +34 -0
- package/content/skills/resale/tests/test_reader_query.py +63 -0
- package/content/skills/resale/tests/test_reader_runner.py +171 -27
- package/content/skills/resale/tests/test_reader_state_portal.py +33 -4
- package/content/skills/resale/tests/test_receipts_intake.py +95 -0
- package/content/skills/resale/tests/test_receipts_split_orders.py +115 -0
- package/content/skills/resale/tests/test_returns_intake.py +69 -0
- package/content/skills/resale/tests/test_search_terms.py +71 -0
- package/content/skills/resale/tests/test_search_terms_apply.py +76 -0
- package/content/skills/resale/tests/test_service_ebay.py +5 -4
- package/content/skills/resale/tests/test_service_http.py +79 -4
- package/content/skills/resale/tests/test_single_writer.py +9 -2
- package/content/skills/ship-the-code/SKILL.md +1 -1
- package/content/skills/ship-the-code/ship.py +47 -12
- package/content/skills/ship-the-code/tests/test_ship_worktree_push.py +191 -0
- package/lib/bundleBackup.js +84 -0
- package/lib/bundleHeartbeat.js +41 -0
- package/lib/bundleRuntime.js +11 -2
- package/lib/bundleRuntimeStep.js +1 -0
- package/lib/containerItems.js +15 -3
- package/lib/hiddenTask/register_hidden_task.ps1 +8 -0
- package/lib/manifest.js +9 -0
- package/lib/memSafety.js +6 -3
- package/lib/taskItems.js +6 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -435,7 +435,7 @@ are declared in `manifest.json` and work for any bundle:
|
|
|
435
435
|
| Declaration | What `install` / `update` does | Uninstall | `doctor` |
|
|
436
436
|
|---|---|---|---|
|
|
437
437
|
| `kind: "container"` item, wiring `{project, containers[], envFile?, healthTimeoutS?}` | `docker compose -p <project> -f <deployed compose file> up -d --build`, then waits for the named containers to be running and healthy. The compose file must set `restart: unless-stopped` (or `always`) so Docker brings it back after a reboot. | `docker compose down` first, named volumes kept | docker engine, Docker Desktop start-at-sign-in, per container state, health and restart policy |
|
|
438
|
-
| `kind: "task"` item, wiring `{name, exe, args[], workingDirectory?, description?, logonDelay?, repeat?, keepRunning?}` | Registers a hidden Windows logon task (no elevation, `conhost --headless`, never a window) through `lib/hiddenTask/register_hidden_task.ps1`. Idempotent; windows and the default `~/.claude` install only. | task removed | task exists, enabled, same command line, running when `keepRunning` |
|
|
438
|
+
| `kind: "task"` item, wiring `{name, exe, args[], workingDirectory?, description?, logonDelay?, repeat?, keepRunning?}` | Registers a hidden Windows logon task (no elevation, `conhost --headless`, never a window) through `lib/hiddenTask/register_hidden_task.ps1`. A task with `repeat` gets a logon trigger plus a time trigger that starts at registration, so the repeat runs at once and not only after the next sign-in; `doctor` flags a task without the time trigger and `install`/`update` re-register it. Idempotent; windows and the default `~/.claude` install only. | task removed | task exists, enabled, same command line, running when `keepRunning` |
|
|
439
439
|
| bundle `settings: {example, target}` | The shipped example file (`KEY=default`, the comment above a key is its prompt, `(optional)` in it marks the key optional) is copied to `<target-dir>/<target>` once, each value is prompted in a terminal (Enter keeps), new example keys are appended on later runs, values you set are never overwritten. `--no-secrets` skips the prompts. | file kept | file exists, required keys have a value |
|
|
440
440
|
| secret `type: "file"` (plus `fileName`, `required`) | You give a path; a copy is stored owner-only in `<target-dir>/secret-files/` and its path is recorded under the secret name in `agents.env`. Non-interactive: pipe the path into `agents-cli secrets --set <NAME>`. | `secrets --remove <NAME>` also deletes the stored copy | listed in `secrets --list` and doctor, file existence checked |
|
|
441
441
|
|
|
@@ -457,6 +457,17 @@ values exist. The compose process sees the install base as
|
|
|
457
457
|
every secret the bundle declares as an environment variable, so a compose file
|
|
458
458
|
can use `${NAME}` interpolation.
|
|
459
459
|
|
|
460
|
+
**Backup.** A bundle whose service writes a nightly backup declares
|
|
461
|
+
`"backup": {"dirSetting", "defaultDir", "pattern", "maxAgeHours"}` in the manifest. `dirSetting` is the key in the bundle's
|
|
462
|
+
settings file that holds the host folder (`~` expands; empty falls back to `<install base>/<defaultDir>`). Install creates
|
|
463
|
+
the folder (default install only) and compose receives it as `AGENTS_BUNDLE_BACKUP_DIR` to bind-mount; compose also gets
|
|
464
|
+
the PC's IANA time zone as `AGENTS_HOST_TZ`. `doctor` reports a finding when the folder is missing, holds no file matching
|
|
465
|
+
`pattern`, or the newest match is older than `maxAgeHours`.
|
|
466
|
+
|
|
467
|
+
**Heartbeat.** A bundle whose hidden task keeps a state file declares
|
|
468
|
+
`"heartbeat": {"label", "file", "maxAgeHours"}` (`file` relative to the install base). `doctor` reports a finding when
|
|
469
|
+
the file is missing, older than `maxAgeHours`, or its `last_status` is `failed` (with `last_error`).
|
|
470
|
+
|
|
460
471
|
**Switches.** `--no-containers` (or `AGENTS_CLI_NO_CONTAINERS=1`) and
|
|
461
472
|
`--no-scheduled-tasks` (or `AGENTS_CLI_NO_SCHEDULED_TASKS=1`). Containers and
|
|
462
473
|
tasks are machine-wide, so they are only managed for the default `~/.claude`
|
package/content/manifest.json
CHANGED
|
@@ -263,6 +263,26 @@
|
|
|
263
263
|
"deps": [],
|
|
264
264
|
"secrets": []
|
|
265
265
|
},
|
|
266
|
+
{
|
|
267
|
+
"key": "expo-release",
|
|
268
|
+
"title": "Expo Release Pipeline",
|
|
269
|
+
"summary": "Adopt and audit a self-hosted Expo (React Native) Android and iOS release pipeline on your own GitLab runners with no EAS cloud build: seven fail-closed stages (validate, version, preflight, build, submit, verify, release), a scaffold for the pipeline files, an offline audit of a repo against the contract, and thin delegation to a pinned release kit",
|
|
270
|
+
"profile": "public",
|
|
271
|
+
"advanced": false,
|
|
272
|
+
"items": [
|
|
273
|
+
{
|
|
274
|
+
"path": "skills/expo-release",
|
|
275
|
+
"kind": "skill"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"path": "proxy/headless_process.py",
|
|
279
|
+
"kind": "hook",
|
|
280
|
+
"note": "Shared no-visible-window subprocess wrapper imported by expo_release.py - not wired to an event itself."
|
|
281
|
+
}
|
|
282
|
+
],
|
|
283
|
+
"deps": [],
|
|
284
|
+
"secrets": []
|
|
285
|
+
},
|
|
266
286
|
{
|
|
267
287
|
"key": "heavy-gate-runner",
|
|
268
288
|
"title": "Heavy Gate Runner",
|
|
@@ -2599,6 +2619,22 @@
|
|
|
2599
2619
|
},
|
|
2600
2620
|
"note": "Hidden Windows logon task; the script is shipped by the skill item above."
|
|
2601
2621
|
},
|
|
2622
|
+
{
|
|
2623
|
+
"path": "skills/resale/tasks/comps_review_task.py",
|
|
2624
|
+
"kind": "task",
|
|
2625
|
+
"wiring": {
|
|
2626
|
+
"name": "ResaleCompsReview",
|
|
2627
|
+
"exe": "pythonw",
|
|
2628
|
+
"args": [
|
|
2629
|
+
"{{TARGET}}/skills/resale/tasks/comps_review_task.py"
|
|
2630
|
+
],
|
|
2631
|
+
"workingDirectory": "{{TARGET}}/skills/resale",
|
|
2632
|
+
"description": "Resale comps review: headless Claude (no tools) judges new comps whenever comps wait and the last review is 30 minutes old (hidden)",
|
|
2633
|
+
"logonDelay": "PT5M",
|
|
2634
|
+
"repeat": "PT15M"
|
|
2635
|
+
},
|
|
2636
|
+
"note": "Hidden Windows logon task; the script is shipped by the skill item above. Needs the claude CLI on PATH; without it comps stay awaiting review and prices stay pending."
|
|
2637
|
+
},
|
|
2602
2638
|
{
|
|
2603
2639
|
"path": "skills/resale/tasks/notifier_task.py",
|
|
2604
2640
|
"kind": "task",
|
|
@@ -2727,6 +2763,17 @@
|
|
|
2727
2763
|
"example": "skills/resale/settings.example.env",
|
|
2728
2764
|
"target": "resale/settings.env"
|
|
2729
2765
|
},
|
|
2766
|
+
"backup": {
|
|
2767
|
+
"dirSetting": "RESALE_BACKUP_DIR",
|
|
2768
|
+
"defaultDir": "resale/backups",
|
|
2769
|
+
"pattern": "^resale-\\d{8}-\\d{4}\\.zip$",
|
|
2770
|
+
"maxAgeHours": 26
|
|
2771
|
+
},
|
|
2772
|
+
"heartbeat": {
|
|
2773
|
+
"label": "resale comps review task (ResaleCompsReview)",
|
|
2774
|
+
"file": "resale/data/comps_review.json",
|
|
2775
|
+
"maxAgeHours": 3
|
|
2776
|
+
},
|
|
2730
2777
|
"prerequisites": [
|
|
2731
2778
|
{
|
|
2732
2779
|
"name": "Python with the Playwright package (the host reader and edit script)",
|
|
@@ -2737,6 +2784,15 @@
|
|
|
2737
2784
|
],
|
|
2738
2785
|
"hint": "python -m pip install playwright"
|
|
2739
2786
|
},
|
|
2787
|
+
{
|
|
2788
|
+
"name": "Claude Code CLI (the comps review task runs headless claude)",
|
|
2789
|
+
"anyPath": [
|
|
2790
|
+
"%APPDATA%\\npm\\claude.cmd",
|
|
2791
|
+
"%USERPROFILE%\\.local\\bin\\claude.exe",
|
|
2792
|
+
"%USERPROFILE%\\.local\\bin\\claude"
|
|
2793
|
+
],
|
|
2794
|
+
"hint": "install Claude Code (npm install -g @anthropic-ai/claude-code) so claude is on PATH"
|
|
2795
|
+
},
|
|
2740
2796
|
{
|
|
2741
2797
|
"name": "Google Chrome installed (the reader drives the installed Chrome)",
|
|
2742
2798
|
"platforms": [
|
|
@@ -74,6 +74,29 @@
|
|
|
74
74
|
"target": { "type": "string", "minLength": 1, "description": "Path relative to the install base, POSIX separators, e.g. resale/settings.env." }
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
|
+
"backup": {
|
|
78
|
+
"description": "Nightly backup the bundle's service writes into a host folder. `dirSetting` is the key in the bundle's settings file that holds the folder (default `defaultDir` under the install base); install creates the folder and the compose file bind-mounts it through AGENTS_BUNDLE_BACKUP_DIR; doctor warns when no file matching `pattern` is newer than `maxAgeHours`.",
|
|
79
|
+
"type": "object",
|
|
80
|
+
"additionalProperties": false,
|
|
81
|
+
"required": ["dirSetting", "defaultDir", "pattern", "maxAgeHours"],
|
|
82
|
+
"properties": {
|
|
83
|
+
"dirSetting": { "type": "string", "pattern": "^[A-Z][A-Z0-9_]*$" },
|
|
84
|
+
"defaultDir": { "type": "string", "minLength": 1, "description": "Path relative to the install base, POSIX separators, e.g. resale/backups." },
|
|
85
|
+
"pattern": { "type": "string", "minLength": 1, "description": "Regular expression a backup file name must match." },
|
|
86
|
+
"maxAgeHours": { "type": "number", "exclusiveMinimum": 0 }
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"heartbeat": {
|
|
90
|
+
"description": "A host task that rewrites a small JSON state file on every tick; doctor warns when the file is missing, older than `maxAgeHours`, or its `last_status` is failed.",
|
|
91
|
+
"type": "object",
|
|
92
|
+
"additionalProperties": false,
|
|
93
|
+
"required": ["label", "file", "maxAgeHours"],
|
|
94
|
+
"properties": {
|
|
95
|
+
"label": { "type": "string", "minLength": 1 },
|
|
96
|
+
"file": { "type": "string", "minLength": 1, "description": "Path relative to the install base, POSIX separators, e.g. resale/data/comps_review.json." },
|
|
97
|
+
"maxAgeHours": { "type": "number", "exclusiveMinimum": 0 }
|
|
98
|
+
}
|
|
99
|
+
},
|
|
77
100
|
"prerequisites": {
|
|
78
101
|
"description": "Machine requirements the install checks and doctor re-checks, reported with the hint, never installed or blocking: each is a `command` (+ `args`) that must exit 0, or `anyPath` (any one existing file; %VAR% expanded). `platforms` limits it to process.platform values.",
|
|
79
102
|
"type": "array",
|
|
@@ -68,6 +68,12 @@ if ($PSCmdlet.ShouldProcess($TaskName, "Register hidden logon task running pytho
|
|
|
68
68
|
$trigger.Repetition.Interval = "PT5M"
|
|
69
69
|
$trigger.Enabled = $true
|
|
70
70
|
|
|
71
|
+
# A logon trigger arms its repeat only at the next sign-in; this time trigger starts the repeat at registration.
|
|
72
|
+
$trigger2 = $task.Triggers.Create(1)
|
|
73
|
+
$trigger2.StartBoundary = (Get-Date).AddMinutes(-1).ToString("yyyy-MM-dd'T'HH:mm:ss")
|
|
74
|
+
$trigger2.Repetition.Interval = "PT5M"
|
|
75
|
+
$trigger2.Enabled = $true
|
|
76
|
+
|
|
71
77
|
$action = $task.Actions.Create(0)
|
|
72
78
|
$action.Path = $pythonw
|
|
73
79
|
$action.Arguments = $arguments
|
package/content/skills/README.md
CHANGED
|
@@ -13,6 +13,7 @@ Global Claude Code skills. Installed to `~/.claude/skills/` — each subdirector
|
|
|
13
13
|
| `ram` | `/ram` · "optimize RAM" · "clear RAM" · "free up memory" | Skill |
|
|
14
14
|
| `low-ram-advisor` | no slash command · started in code by any free-RAM check · "free up RAM" · "what can I close" · "what's my RAM" · "should I restart" | Skill |
|
|
15
15
|
| `android-emulator` | no slash command · "start an emulator" · "emulator on the GPU" | Skill |
|
|
16
|
+
| `expo-release` | no slash command · "Expo build pipeline" · "avoid EAS builds" · "release the mobile app from CI" · "check my release pipeline" | Skill |
|
|
16
17
|
| `make-space` | "make space" · "make-space" · "disk critically low" · "free up space" · "we are out of space" | Skill |
|
|
17
18
|
| `mattpocock-codebase-design` | `/codebase-design` · "design this module's interface" · "find a deepening opportunity" · "where should this seam go" | Skill |
|
|
18
19
|
| `mattpocock-domain-modeling` | `/domain-modeling` · "pin down this term" · "record an ADR" · "sharpen the ubiquitous language" | Skill |
|
|
@@ -42,6 +43,9 @@ Project-agnostic image generation behind one provider interface. Default provide
|
|
|
42
43
|
### android-emulator
|
|
43
44
|
Local headless emulator launcher for the Windows host. `emulator_launch.py start --avd NAME` tries `-accel on -gpu host`, then the AVD's own mode; a mode that exits or never reaches `sys.boot_completed` is stopped and the next one runs on the same port. Modes the installed emulator build rejects in a user-supplied chain (36.4.9 drops `angle_indirect`) are skipped, and a `host` request that silently lands on a software renderer is reported as `downgraded`. The result carries the emulator log line and the guest GLES renderer as proof. CI and non-Windows hosts keep the AVD default. Override with env `ANDROID_EMULATOR_GPU_CHAIN`. Stdlib only; tests in `skills/android-emulator/tests`.
|
|
44
45
|
|
|
46
|
+
### expo-release
|
|
47
|
+
Adopt and audit a self-hosted Expo (React Native) release pipeline on your own GitLab runners, with no EAS cloud build. Seven stages, each with fail-closed gates: validate, version, preflight, build, submit, verify, release. `expo_release.py stages` prints them; `check --repo DIR` audits a repo offline (pinned kit tag, include ref equals `MRK_KIT_REF`, stage order, committed `android/` with an executable `gradlew`, no placeholders, no `eas` cloud call, manual fail-closed release job) and lists the GitLab variables to confirm by hand; `init` scaffolds `release-kit.yml` and `.gitlab-ci.yml` (dry run unless `--write`, never overwrites); `kit-fetch` clones the release kit at a pinned tag; `kit-run` delegates to the kit scripts (preflight, version, 16 KB alignment, store track check). Gate logic stays in the kit; the skill is a thin wrapper. The kit covers Android; iOS stages are per project. Pairs with `ci-runner` for the runners. Stdlib only; tests in `skills/expo-release/tests`.
|
|
48
|
+
|
|
45
49
|
### low-ram-advisor
|
|
46
50
|
Suggest-only RAM triage, the memory analogue of `make-space`, run on demand. `deep_report.py start` writes a report of commit, pagefile, kernel pool leaks, WSL/Docker VM, GPU and CI findings; `advisor.py` is the ranking library that groups Claude sessions, Metro/node, Gradle/Java, Maestro, emulator, browsers, WSL/Docker, local proxies and IDEs with owner, safe-to-stop, RAM freed and a graceful pwsh stop command. The code has no kill/suspend path; tests assert it. `ramstatus.py` prints a 10-line live RAM summary and an OK / RESTART SOON / RESTART NOW verdict (thresholds in `ram_thresholds.py`); run it on demand. Alerts never enter a chat: the sampler writes a `soon` or `now` verdict to the one-line statusline file `~/.claude/state/ram-alert.txt` through `ram_notice.py`.
|
|
47
51
|
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: expo-release
|
|
3
|
+
description: Set up and audit a self-hosted Expo (React Native) Android and iOS release pipeline on your own GitLab runners, with no EAS cloud build. Use when the user says "Expo build pipeline", "build Expo on our own runners", "avoid EAS builds", "release the mobile app from CI", "add Play and TestFlight CI", "mobile release pipeline", or "check my release pipeline". Thin wrapper over expo_release.py and a pinned release kit; all mechanics live in code.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# expo-release
|
|
7
|
+
|
|
8
|
+
Goal: an Expo project builds, signs, submits, verifies and releases from CI on own runners, with fail-closed gates at every stage.
|
|
9
|
+
This skill calls `expo_release.py` and the pinned kit and reports their JSON. The kit owns the gate logic. The skill never re-implements it.
|
|
10
|
+
|
|
11
|
+
## Rules
|
|
12
|
+
|
|
13
|
+
- Never read, print or ask for a keystore, store key or token. Signing and store values are protected CI variables the user sets in GitLab.
|
|
14
|
+
- Run every command headless; never open a window.
|
|
15
|
+
- Pin the kit to a `vX.Y.Z` tag. Never use a branch.
|
|
16
|
+
- The pipeline builds the committed `android/` and `ios/` trees. It never runs `expo prebuild` and never calls `eas build`, `eas submit` or `eas update`.
|
|
17
|
+
- Report each result once. Exit codes: 0 ok, 1 a check failed (read `findings`), 2 usage error.
|
|
18
|
+
|
|
19
|
+
## Commands
|
|
20
|
+
|
|
21
|
+
`PY = python <skills>/expo-release/expo_release.py`
|
|
22
|
+
|
|
23
|
+
| Situation | Command |
|
|
24
|
+
|---|---|
|
|
25
|
+
| Show the stages and gates | `PY stages` |
|
|
26
|
+
| New project, no pipeline files | `PY init --kit-project group/name --kit-ref vX.Y.Z --package com.example.app --offset N` (dry run), then add `--write` |
|
|
27
|
+
| Audit an existing pipeline | `PY check --repo <dir>` |
|
|
28
|
+
| Kit is not on this machine | `PY kit-fetch --url <kit git url> --ref vX.Y.Z` (url or `MRK_KIT_URL`) |
|
|
29
|
+
| Check a tag and versionCode | `PY kit-run version -- --tag v1.2.3 --offset N --channel-count 100` |
|
|
30
|
+
| Check a built bundle | `PY kit-run alignment -- --aab app-release.aab` |
|
|
31
|
+
| Run the preflight locally | `PY kit-run preflight -- --mode release --repo-root <dir> --tag <tag>` |
|
|
32
|
+
|
|
33
|
+
`init` never overwrites a file. `--offset` is the highest versionCode ever uploaded to the store; read it from the store first. `check` is offline and static; its `remote_checks_needed` list is for the user to confirm in GitLab.
|
|
34
|
+
|
|
35
|
+
## Stages (code decides; tests assert this list equals `PY stages`)
|
|
36
|
+
|
|
37
|
+
```yaml
|
|
38
|
+
stages: [validate, version, preflight, build, submit, verify, release]
|
|
39
|
+
release_gates:
|
|
40
|
+
validate: [lint, typecheck, unit tests, kit ref parity]
|
|
41
|
+
version: [tag is the only version source]
|
|
42
|
+
preflight: [no placeholders, keystore opens, versionCode above floor, channel variables equal job values, no debug signing]
|
|
43
|
+
build: [16 KB page alignment, artifact identity, sha256 and mapping kept]
|
|
44
|
+
submit: [channel file matches lane, plain X.Y.Z version name]
|
|
45
|
+
verify: [versionCode on store track, iOS build valid]
|
|
46
|
+
release: [manual job, fails closed on channel and source track]
|
|
47
|
+
versioncode: "(OFFSET + MAJOR*1e6 + MINOR*1e3 + PATCH) * 100 + SLOT"
|
|
48
|
+
slots: {production_tag: 0, tester_prerelease_tag_N: N}
|
|
49
|
+
platforms:
|
|
50
|
+
android: {runner_tags: [android, release], image: pinned, caches: host volumes}
|
|
51
|
+
ios: {runner_tags: [macos], executor: shell, signing: read-only match, build_number: next store build number}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Flow
|
|
55
|
+
|
|
56
|
+
1. `PY check` on the repo. Fix every `error` first. `warn` items are advice.
|
|
57
|
+
2. No pipeline yet: `init` dry run, show the plan, then `--write`. Replace nothing by hand except the verify polling and the `validate` commands for the app.
|
|
58
|
+
3. Runners: `ci-runner` skill (`runner install`, `runner attach`). The release runner takes protected refs only.
|
|
59
|
+
4. Confirm `remote_checks_needed` with the user in the GitLab variable list.
|
|
60
|
+
5. First tester tag: build, submit, verify must all pass before a production tag.
|
|
61
|
+
|
|
62
|
+
## Notes
|
|
63
|
+
|
|
64
|
+
- iOS: the kit covers Android only. The iOS stages (`macos` shell runner, read-only code signing, store build number, processing wait) are written per project. `check` validates stage names and the release gate for both.
|
|
65
|
+
- A project that already has a project-level skill named `mobile-release` keeps it. That skill runs one project's release; this one adopts and audits the pipeline in any project. The names differ on purpose, since a global skill of the same name would shadow the project one.
|
|
66
|
+
- The kit is not bundled. Fetch it by tag from the user's git host. If it lives in a private group, the consuming project needs job-token access to it.
|
|
67
|
+
- First build after an image change is slow (the image and caches fill once); later builds reuse host cache volumes.
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""expo-release: adopt and audit a self-hosted Expo (React Native) release pipeline. Stdlib only."""
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import json
|
|
7
|
+
import os
|
|
8
|
+
import re
|
|
9
|
+
import sys
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "proxy"))
|
|
13
|
+
from headless_process import headless_run # noqa: E402
|
|
14
|
+
|
|
15
|
+
TEMPLATES = Path(__file__).resolve().parent / "templates"
|
|
16
|
+
TAG_REF = re.compile(r"^v\d+\.\d+\.\d+$")
|
|
17
|
+
PLACEHOLDER = re.compile(r"REPLACE_WITH_[A-Z0-9_]+")
|
|
18
|
+
|
|
19
|
+
STAGES = [
|
|
20
|
+
{"stage": "validate", "gates": ["lint", "typecheck", "unit tests", "kit ref parity (include ref equals MRK_KIT_REF)"]},
|
|
21
|
+
{"stage": "version", "gates": ["tag is the only version source", "no hand-edited version files"]},
|
|
22
|
+
{"stage": "preflight", "gates": ["runner online", "no REPLACE_WITH placeholders", "committed android/ tree", "package name matches", "no debug signing", "tag shape", "signing variables set", "keystore opens", "versionCode above floor", "channel variables equal job values"]},
|
|
23
|
+
{"stage": "build", "gates": ["16 KB page alignment", "artifact identity (name, version, channel)", "sha256 and mapping kept", "no EAS cloud call"]},
|
|
24
|
+
{"stage": "submit", "gates": ["channel file matches lane", "plain X.Y.Z version name", "service account present"]},
|
|
25
|
+
{"stage": "verify", "gates": ["versionCode visible on the store track", "iOS build processed and valid"]},
|
|
26
|
+
{"stage": "release", "gates": ["manual job", "fails closed unless channel is production and versionCode is on the source track"]},
|
|
27
|
+
]
|
|
28
|
+
STAGE_NAMES = [s["stage"] for s in STAGES]
|
|
29
|
+
KIT_SCRIPTS = {
|
|
30
|
+
"preflight": "preflight.py",
|
|
31
|
+
"version": "version.py",
|
|
32
|
+
"alignment": "check_16k_alignment.py",
|
|
33
|
+
"track-code": "verify_track_version_code.py",
|
|
34
|
+
"load-config": "load_release_kit.py",
|
|
35
|
+
}
|
|
36
|
+
REMOTE_CHECKS = [
|
|
37
|
+
"MRK_KIT_REF must NOT exist as a project CI variable (it overrides the YAML pin)",
|
|
38
|
+
"MRK_VERSIONCODE_FLOOR is set (protected) from the highest versionCode ever uploaded",
|
|
39
|
+
"signing and store variables are protected: MRK_ANDROID_KEYSTORE_B64, MRK_ANDROID_KEYSTORE_PASSWORD, MRK_ANDROID_KEY_ALIAS, MRK_ANDROID_KEY_PASSWORD, MRK_PLAY_SERVICE_ACCOUNT_JSON",
|
|
40
|
+
"release runner takes protected refs only; the build image is built on the runner host",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _read(path: Path) -> str:
|
|
45
|
+
return path.read_text(encoding="utf-8") if path.is_file() else ""
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _stage_list(ci: str) -> list[str]:
|
|
49
|
+
m = re.search(r"^stages:\s*\[(.*?)\]", ci, re.M)
|
|
50
|
+
if m:
|
|
51
|
+
return [x.strip().strip("'\"") for x in m.group(1).split(",") if x.strip()]
|
|
52
|
+
m = re.search(r"^stages:\s*\n((?:[ \t]*-[^\n]*\n?)+)", ci, re.M)
|
|
53
|
+
return [ln.strip()[1:].strip().strip("'\"") for ln in m.group(1).splitlines() if ln.strip()] if m else []
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _is_subsequence(want: list[str], have: list[str]) -> bool:
|
|
57
|
+
it = iter(have)
|
|
58
|
+
return all(any(w == h for h in it) for w in want)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _gradlew_mode(repo: Path) -> str | None:
|
|
62
|
+
r = headless_run(["git", "-C", str(repo), "ls-files", "-s", "android/gradlew"], capture_output=True, text=True)
|
|
63
|
+
if r.returncode != 0 or not r.stdout.strip():
|
|
64
|
+
return None
|
|
65
|
+
return r.stdout.split()[0]
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def check(repo: Path) -> dict:
|
|
69
|
+
findings: list[dict] = []
|
|
70
|
+
|
|
71
|
+
def add(fid: str, severity: str, msg: str) -> None:
|
|
72
|
+
findings.append({"id": fid, "severity": severity, "msg": msg})
|
|
73
|
+
|
|
74
|
+
cfg, ci = _read(repo / "release-kit.yml"), _read(repo / ".gitlab-ci.yml")
|
|
75
|
+
if not cfg:
|
|
76
|
+
add("kit-config-missing", "error", "release-kit.yml not found at the repo root")
|
|
77
|
+
for key in ("android_package", "versioncode_offset"):
|
|
78
|
+
if cfg and not re.search(rf"^{key}:\s*\S+", cfg, re.M):
|
|
79
|
+
add("kit-config-key", "error", f"release-kit.yml has no value for {key}")
|
|
80
|
+
if not ci:
|
|
81
|
+
add("ci-missing", "error", ".gitlab-ci.yml not found at the repo root")
|
|
82
|
+
for name, text in (("release-kit.yml", cfg), (".gitlab-ci.yml", ci)):
|
|
83
|
+
for ph in sorted(set(PLACEHOLDER.findall(text))):
|
|
84
|
+
add("placeholder", "error", f"{name} still contains {ph}")
|
|
85
|
+
if not (repo / "android" / "gradlew").is_file():
|
|
86
|
+
add("android-tree", "error", "android/ with gradlew is not committed; the pipeline never runs expo prebuild")
|
|
87
|
+
else:
|
|
88
|
+
mode = _gradlew_mode(repo)
|
|
89
|
+
if mode and mode != "100755":
|
|
90
|
+
add("gradlew-exec", "error", f"android/gradlew is mode {mode} in git, needs 100755 (git update-index --chmod=+x android/gradlew)")
|
|
91
|
+
if ci:
|
|
92
|
+
inc = re.search(r"project:\s*(\S+)\s*\n\s*ref:\s*['\"]?([^\s'\"#]+)", ci)
|
|
93
|
+
pin = re.search(r"^\s*MRK_KIT_REF:\s*['\"]?([^\s'\"#]+)", ci, re.M)
|
|
94
|
+
if not inc:
|
|
95
|
+
add("kit-include", "error", "no kit include with project and ref found")
|
|
96
|
+
elif not TAG_REF.match(inc.group(2)):
|
|
97
|
+
add("kit-ref-pinned", "error", f"include ref '{inc.group(2)}' is not a vX.Y.Z tag; pin a tag, never a branch")
|
|
98
|
+
if not pin:
|
|
99
|
+
add("kit-ref-parity", "error", "variables: MRK_KIT_REF is not set next to the include ref")
|
|
100
|
+
elif inc and pin.group(1) != inc.group(2):
|
|
101
|
+
add("kit-ref-parity", "error", f"MRK_KIT_REF {pin.group(1)} differs from include ref {inc.group(2)}")
|
|
102
|
+
stages = _stage_list(ci)
|
|
103
|
+
if not _is_subsequence(STAGE_NAMES, stages):
|
|
104
|
+
add("stage-order", "error", f"stages {stages or '(none)'} must contain, in order: {STAGE_NAMES}")
|
|
105
|
+
if "when: manual" not in ci and "promote_production" not in ci:
|
|
106
|
+
add("release-manual", "error", "no manual release gate; the release job must be manual")
|
|
107
|
+
if "promote_production" not in ci:
|
|
108
|
+
add("release-fail-closed", "warn", "release job does not extend .mrk:android:promote_production (kit channel and track check)")
|
|
109
|
+
if "needs:" not in ci:
|
|
110
|
+
add("release-needs", "warn", "no needs: found; release must need the production build artifact")
|
|
111
|
+
if re.search(r"\beas\s+(build|submit|update)\b", ci):
|
|
112
|
+
add("cloud-build", "error", "CI calls an EAS cloud command; the pipeline builds on own runners")
|
|
113
|
+
errors = sum(f["severity"] == "error" for f in findings)
|
|
114
|
+
return {"ok": errors == 0, "errors": errors, "findings": findings, "remote_checks_needed": REMOTE_CHECKS}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def init(repo: Path, args: argparse.Namespace) -> dict:
|
|
118
|
+
values = {"KIT_PROJECT": args.kit_project, "KIT_REF": args.kit_ref, "PACKAGE": args.package,
|
|
119
|
+
"OFFSET": str(args.offset), "PRERELEASE_ID": args.prerelease_id or ""}
|
|
120
|
+
plan = []
|
|
121
|
+
for src, dst in (("release-kit.yml.tmpl", "release-kit.yml"), ("gitlab-ci.yml.tmpl", ".gitlab-ci.yml")):
|
|
122
|
+
text = (TEMPLATES / src).read_text(encoding="utf-8")
|
|
123
|
+
for k, v in values.items():
|
|
124
|
+
text = text.replace("{{" + k + "}}", v)
|
|
125
|
+
exists = (repo / dst).exists()
|
|
126
|
+
plan.append({"file": dst, "action": "skip-exists" if exists else "write", "text": text})
|
|
127
|
+
if args.write:
|
|
128
|
+
for p in plan:
|
|
129
|
+
if p["action"] == "write":
|
|
130
|
+
(repo / p["file"]).write_text(p["text"], encoding="utf-8", newline="\n")
|
|
131
|
+
return {"ok": True, "written": bool(args.write), "plan": [{"file": p["file"], "action": p["action"]} for p in plan]}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def kit_fetch(url: str, ref: str, dest: Path) -> dict:
|
|
135
|
+
if not TAG_REF.match(ref):
|
|
136
|
+
return {"ok": False, "error": f"kit ref '{ref}' must be a vX.Y.Z tag"}
|
|
137
|
+
if dest.exists():
|
|
138
|
+
return {"ok": False, "error": f"{dest} exists; remove it or pick another --dest"}
|
|
139
|
+
r = headless_run(["git", "clone", "--depth", "1", "--branch", ref, url, str(dest)], capture_output=True, text=True)
|
|
140
|
+
return {"ok": r.returncode == 0, "dest": str(dest), "ref": ref, "error": r.stderr.strip() if r.returncode else ""}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def kit_run(kit_dir: Path, name: str, extra: list[str]) -> int:
|
|
144
|
+
script = kit_dir / "scripts" / KIT_SCRIPTS[name]
|
|
145
|
+
if not script.is_file():
|
|
146
|
+
print(json.dumps({"ok": False, "error": f"{script} not found; run kit-fetch or set MRK_KIT_DIR"}))
|
|
147
|
+
return 1
|
|
148
|
+
return headless_run([sys.executable, "-I", str(script), *extra]).returncode
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
152
|
+
p = argparse.ArgumentParser(prog="expo_release.py", description=__doc__)
|
|
153
|
+
sub = p.add_subparsers(dest="cmd", required=True)
|
|
154
|
+
sub.add_parser("stages", help="print the stage and gate list as JSON")
|
|
155
|
+
c = sub.add_parser("check", help="audit a repo against the pipeline contract (offline)")
|
|
156
|
+
c.add_argument("--repo", type=Path, default=Path("."))
|
|
157
|
+
i = sub.add_parser("init", help="scaffold release-kit.yml and .gitlab-ci.yml (dry run unless --write; never overwrites)")
|
|
158
|
+
i.add_argument("--repo", type=Path, default=Path("."))
|
|
159
|
+
i.add_argument("--kit-project", required=True, help="GitLab path of the kit project, group/name")
|
|
160
|
+
i.add_argument("--kit-ref", required=True, help="kit tag, vX.Y.Z")
|
|
161
|
+
i.add_argument("--package", required=True, help="Android application id")
|
|
162
|
+
i.add_argument("--offset", type=int, required=True, help="highest versionCode ever uploaded to the store")
|
|
163
|
+
i.add_argument("--prerelease-id", default="")
|
|
164
|
+
i.add_argument("--write", action="store_true")
|
|
165
|
+
f = sub.add_parser("kit-fetch", help="clone the kit at a pinned tag")
|
|
166
|
+
f.add_argument("--url", default=os.environ.get("MRK_KIT_URL", ""))
|
|
167
|
+
f.add_argument("--ref", required=True)
|
|
168
|
+
f.add_argument("--dest", type=Path, default=Path.home() / ".mobile-release-kit")
|
|
169
|
+
k = sub.add_parser("kit-run", help="run one kit script; arguments after -- go to it")
|
|
170
|
+
k.add_argument("name", choices=sorted(KIT_SCRIPTS))
|
|
171
|
+
k.add_argument("--kit-dir", type=Path, default=Path(os.environ.get("MRK_KIT_DIR") or Path.home() / ".mobile-release-kit"))
|
|
172
|
+
k.add_argument("extra", nargs=argparse.REMAINDER)
|
|
173
|
+
return p
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def main(argv: list[str] | None = None) -> int:
|
|
177
|
+
a = build_parser().parse_args(argv)
|
|
178
|
+
if a.cmd == "stages":
|
|
179
|
+
print(json.dumps(STAGES))
|
|
180
|
+
return 0
|
|
181
|
+
if a.cmd == "check":
|
|
182
|
+
res = check(a.repo)
|
|
183
|
+
print(json.dumps(res))
|
|
184
|
+
return 0 if res["ok"] else 1
|
|
185
|
+
if a.cmd == "init":
|
|
186
|
+
ok = TAG_REF.match(a.kit_ref) and re.fullmatch(r"[\w.-]+/[\w./-]+", a.kit_project) and re.fullmatch(r"[A-Za-z]\w*(\.[A-Za-z]\w*)+", a.package)
|
|
187
|
+
if not ok:
|
|
188
|
+
print(json.dumps({"ok": False, "error": "bad --kit-ref (vX.Y.Z), --kit-project (group/name) or --package (a.b.c)"}))
|
|
189
|
+
return 2
|
|
190
|
+
print(json.dumps(init(a.repo, a)))
|
|
191
|
+
return 0
|
|
192
|
+
if a.cmd == "kit-fetch":
|
|
193
|
+
if not a.url:
|
|
194
|
+
print(json.dumps({"ok": False, "error": "pass --url or set MRK_KIT_URL"}))
|
|
195
|
+
return 2
|
|
196
|
+
res = kit_fetch(a.url, a.ref, a.dest)
|
|
197
|
+
print(json.dumps(res))
|
|
198
|
+
return 0 if res["ok"] else 1
|
|
199
|
+
extra = a.extra[1:] if a.extra[:1] == ["--"] else a.extra
|
|
200
|
+
return kit_run(a.kit_dir, a.name, extra)
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
if __name__ == "__main__":
|
|
204
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
include:
|
|
2
|
+
- project: {{KIT_PROJECT}}
|
|
3
|
+
ref: {{KIT_REF}}
|
|
4
|
+
file:
|
|
5
|
+
- ci/base.yml
|
|
6
|
+
- ci/android.yml
|
|
7
|
+
|
|
8
|
+
variables:
|
|
9
|
+
MRK_KIT_REF: "{{KIT_REF}}"
|
|
10
|
+
MRK_PRERELEASE_ID: "{{PRERELEASE_ID}}"
|
|
11
|
+
MRK_ANDROID_CHANNEL_COUNT: "100"
|
|
12
|
+
MRK_ANDROID_CHANNEL_INDEX: "0"
|
|
13
|
+
|
|
14
|
+
stages: [validate, version, preflight, build, submit, verify, release]
|
|
15
|
+
|
|
16
|
+
validate:checks:
|
|
17
|
+
stage: validate
|
|
18
|
+
image: node:20
|
|
19
|
+
script:
|
|
20
|
+
- npm ci
|
|
21
|
+
- npm run lint
|
|
22
|
+
- npm run typecheck
|
|
23
|
+
- npm test
|
|
24
|
+
|
|
25
|
+
version:tag:
|
|
26
|
+
stage: version
|
|
27
|
+
image: node:20
|
|
28
|
+
rules:
|
|
29
|
+
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
30
|
+
script:
|
|
31
|
+
- npx semantic-release
|
|
32
|
+
|
|
33
|
+
preflight:release:
|
|
34
|
+
extends: .mrk:android:preflight_release
|
|
35
|
+
stage: preflight
|
|
36
|
+
|
|
37
|
+
android:build:
|
|
38
|
+
extends: .mrk:android:build
|
|
39
|
+
stage: build
|
|
40
|
+
needs: ["preflight:release"]
|
|
41
|
+
|
|
42
|
+
android:submit:
|
|
43
|
+
extends: .mrk:android:submit_internal
|
|
44
|
+
stage: submit
|
|
45
|
+
needs: ["android:build", "preflight:release"]
|
|
46
|
+
|
|
47
|
+
android:verify:
|
|
48
|
+
extends: .mrk:android_runner
|
|
49
|
+
stage: verify
|
|
50
|
+
needs: ["android:submit", "preflight:release"]
|
|
51
|
+
rules:
|
|
52
|
+
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/'
|
|
53
|
+
script:
|
|
54
|
+
- source "$MRK_KIT_DIR/scripts/secrets.sh"
|
|
55
|
+
- mrk_materialise_secret "$MRK_PLAY_SERVICE_ACCOUNT_JSON" "$CI_PROJECT_DIR/.mrk-secrets/play-sa.json"
|
|
56
|
+
- export MRK_PLAY_SERVICE_ACCOUNT_JSON="$CI_PROJECT_DIR/.mrk-secrets/play-sa.json"
|
|
57
|
+
- (cd "$MRK_KIT_DIR" && bundle exec fastlane android fetch_track_version_codes track:"${MRK_PLAY_TRACK:-internal}")
|
|
58
|
+
- python3 "$MRK_KIT_DIR/scripts/verify_track_version_code.py" --codes-file "$MRK_KIT_DIR/fastlane/track_version_codes.txt" --expected "$MRK_VERSION_CODE"
|
|
59
|
+
|
|
60
|
+
android:release:
|
|
61
|
+
extends: .mrk:android:promote_production
|
|
62
|
+
stage: release
|
|
63
|
+
needs: ["android:build", "android:verify", "preflight:release"]
|