Adapters for every AI tool from one source, tests and CI
- tools/gen-adapters.ts writes the Claude Code plugin + .mcp.json, Codex plugin, Gemini CLI extension + GEMINI.md, AGENTS.md, Copilot instructions and a Cursor rule from skills/ and docs/agents-core.md; --check fails on stale files - tests for adapters, MCP tools and JSON-RPC, validate rules, ASO, release notes, privacy manifest, release helpers, install merging, scrub - bun run ci: adapters check, tests, typecheck, secrets / personal data scrub - 0.2.0
This commit is contained in:
parent
25bc761a53
commit
e0a284d678
14 changed files with 950 additions and 16 deletions
|
|
@ -1,15 +1,22 @@
|
||||||
{
|
{
|
||||||
"name": "crtkafa",
|
"name": "crtkafa",
|
||||||
"description": "CRTkafa's open-sourced tools.",
|
"description": "CRTkafa's open-sourced tools.",
|
||||||
"owner": { "name": "CRTkafa" },
|
"owner": {
|
||||||
|
"name": "CRTkafa"
|
||||||
|
},
|
||||||
"plugins": [
|
"plugins": [
|
||||||
{
|
{
|
||||||
"name": "storebound",
|
"name": "storebound",
|
||||||
"source": ".",
|
"source": ".",
|
||||||
"description": "Ship mobile games to Google Play and the App Store: skills for every store step plus the storebound CLI.",
|
"description": "Ship mobile games to Google Play and the App Store: skills for every store step plus the storebound CLI and MCP server.",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"category": "development",
|
"category": "development",
|
||||||
"tags": ["mobile", "google-play", "app-store", "release"]
|
"tags": [
|
||||||
|
"mobile",
|
||||||
|
"google-play",
|
||||||
|
"app-store",
|
||||||
|
"release"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,23 @@
|
||||||
{
|
{
|
||||||
"name": "storebound",
|
"name": "storebound",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"description": "Ship mobile games to Google Play and the App Store: store listings, in-app products, data safety, screenshots, icons and first-release checklists, as skills plus a Bun CLI (storebound). CRTkafa's own toolchain, open-sourced.",
|
"description": "Ship mobile games to Google Play and the App Store: store listings, in-app products, data safety, screenshots, icons, release management and review checklists, as Agent Skills plus a Bun CLI and MCP server (storebound). CRTkafa's own toolchain, open-sourced.",
|
||||||
"author": { "name": "CRTkafa" },
|
"author": {
|
||||||
|
"name": "CRTkafa"
|
||||||
|
},
|
||||||
"homepage": "https://git.crt.fyi/CRT/storebound",
|
"homepage": "https://git.crt.fyi/CRT/storebound",
|
||||||
"repository": "https://git.crt.fyi/CRT/storebound.git",
|
"repository": "https://git.crt.fyi/CRT/storebound.git",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": ["google-play", "app-store", "app-store-connect", "mobile-games", "iap", "screenshots", "app-icons", "release"]
|
"keywords": [
|
||||||
|
"google-play",
|
||||||
|
"app-store",
|
||||||
|
"app-store-connect",
|
||||||
|
"mobile-games",
|
||||||
|
"iap",
|
||||||
|
"screenshots",
|
||||||
|
"app-icons",
|
||||||
|
"release",
|
||||||
|
"aso",
|
||||||
|
"mcp"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
24
.codex-plugin/plugin.json
Normal file
24
.codex-plugin/plugin.json
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"name": "storebound",
|
||||||
|
"version": "0.2.0",
|
||||||
|
"description": "Ship mobile games to Google Play and the App Store: store listings, in-app products, data safety, screenshots, icons, release management and review checklists, as Agent Skills plus a Bun CLI and MCP server (storebound). CRTkafa's own toolchain, open-sourced.",
|
||||||
|
"author": {
|
||||||
|
"name": "CRTkafa"
|
||||||
|
},
|
||||||
|
"homepage": "https://git.crt.fyi/CRT/storebound",
|
||||||
|
"repository": "https://git.crt.fyi/CRT/storebound.git",
|
||||||
|
"license": "MIT",
|
||||||
|
"keywords": [
|
||||||
|
"google-play",
|
||||||
|
"app-store",
|
||||||
|
"app-store-connect",
|
||||||
|
"mobile-games",
|
||||||
|
"iap",
|
||||||
|
"screenshots",
|
||||||
|
"app-icons",
|
||||||
|
"release",
|
||||||
|
"aso",
|
||||||
|
"mcp"
|
||||||
|
],
|
||||||
|
"skills": "./skills/"
|
||||||
|
}
|
||||||
51
.cursor/rules/storebound.mdc
Normal file
51
.cursor/rules/storebound.mdc
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
---
|
||||||
|
description: Shipping a mobile game to Google Play or the App Store with storebound (listings, IAPs, screenshots, releases, review, compliance)
|
||||||
|
alwaysApply: false
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- generated by tools/gen-adapters.ts from docs/agents-core.md and skills/*/SKILL.md; do not edit -->
|
||||||
|
|
||||||
|
These rules apply to every AI tool that uses storebound (skills, MCP server or the CLI in a terminal).
|
||||||
|
|
||||||
|
1. **The owner decides public and irreversible steps.** Submitting for review, releasing a version, resuming or
|
||||||
|
completing a rollout, canceling a submission, deleting products or listings, accepting agreements: explain what
|
||||||
|
will happen and let the owner do it (or run the command only after a clear yes in chat). storebound's MCP server
|
||||||
|
does not offer these at all.
|
||||||
|
2. **Dry run first.** Every write command has `--dry` (MCP: `dry_run`, default true). Show the dry run, then run it
|
||||||
|
for real only after the owner agrees.
|
||||||
|
3. **Read before you write.** `storebound check` (offline) and `storebound validate` (read-only, both stores) tell you
|
||||||
|
what is missing and in which order to fix it.
|
||||||
|
4. **Credentials only from the environment or `.storebound/`** in the project (gitignored). Never ask for keys,
|
||||||
|
passwords or tokens in chat, never print them, never write them into the config, docs or commits.
|
||||||
|
5. **Never answer a compliance question you cannot know.** Export compliance, Data safety, App Privacy, age rating,
|
||||||
|
target audience: ask the owner when the code does not prove the answer. A wrong "no" is worse than a slow "ask".
|
||||||
|
6. **Pick builds by explicit number.** Use the build number / versionCode you just uploaded, never "the latest".
|
||||||
|
7. **Long uploads run in the background with a log** (`storebound play images > .storebound/images.log 2>&1 &`) and
|
||||||
|
you report the progress lines, not guesses.
|
||||||
|
8. **No manipulative tactics** with reviewers, players or store policies: no fake reviews, no hidden features, no
|
||||||
|
misleading screenshots, no keyword stuffing.
|
||||||
|
|
||||||
|
## Tools
|
||||||
|
|
||||||
|
- CLI: `storebound <command>` (`storebound help`); config `storebound.config.ts`, credentials in env or `.storebound/`.
|
||||||
|
- MCP: `storebound mcp` (stdio). Write tools default to `dry_run: true`; submit / release / cancel / delete are not exposed.
|
||||||
|
- Readiness: `storebound check` (offline), `storebound validate` (read-only, both stores).
|
||||||
|
|
||||||
|
## Skills
|
||||||
|
|
||||||
|
- `skills/ads-levelplay-checks/SKILL.md`: Diagnose and verify ad mediation (Unity LevelPlay / ironSource and its networks like Unity Ads, InMobi, Liftoff, AdMob) in a mobile game before and after store release
|
||||||
|
- `skills/app-icons/SKILL.md`: Generate every app icon a mobile game needs from one artwork
|
||||||
|
- `skills/appstore-first-release/SKILL.md`: Step-by-step first (and later) App Store release of a mobile game
|
||||||
|
- `skills/aso-basics/SKILL.md`: App store optimization basics for a mobile game's text
|
||||||
|
- `skills/export-compliance/SKILL.md`: Answer App Store export compliance (encryption) for a mobile game correctly
|
||||||
|
- `skills/play-first-release/SKILL.md`: Step-by-step first (and later) Google Play release of a mobile game
|
||||||
|
- `skills/portfolio-originality/SKILL.md`: Originality gate for studios that ship many similar mobile games
|
||||||
|
- `skills/privacy-manifest/SKILL.md`: Add and check Apple privacy manifests (PrivacyInfo.xcprivacy) for an iOS game
|
||||||
|
- `skills/privacy-policy/SKILL.md`: Write and host one studio-wide privacy policy page for all of a developer's mobile games
|
||||||
|
- `skills/release-management/SKILL.md`: Ship updates safely after the first release
|
||||||
|
- `skills/review-rejections/SKILL.md`: Triage and answer an App Store or Google Play rejection, policy warning or strike for a mobile game
|
||||||
|
- `skills/store-declarations/SKILL.md`: Answer the store compliance forms for a mobile game
|
||||||
|
- `skills/store-iap-setup/SKILL.md`: Create and price in-app purchases (consumables, non-consumables like "remove ads", coin/gem packs, starter packs) on Google Play and App Store Connect from one product list
|
||||||
|
- `skills/store-preflight/SKILL.md`: Run and read the storebound readiness checks before submitting a mobile game
|
||||||
|
- `skills/store-screenshots/SKILL.md`: Produce store screenshots and the Play feature graphic for a mobile game in every required size and many languages
|
||||||
|
- `skills/whats-new/SKILL.md`: Write player-facing release notes ("What's new") for a mobile game update from the git log since the last tag
|
||||||
53
.github/copilot-instructions.md
vendored
Normal file
53
.github/copilot-instructions.md
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
<!-- generated by tools/gen-adapters.ts from docs/agents-core.md and skills/*/SKILL.md; do not edit -->
|
||||||
|
|
||||||
|
# storebound for GitHub Copilot
|
||||||
|
|
||||||
|
Mobile game store releases (Google Play, App Store). Skills live in `skills/<name>/SKILL.md` (Agent Skills format;
|
||||||
|
`storebound install --agent copilot` copies them to `.github/skills/` of a game project).
|
||||||
|
|
||||||
|
These rules apply to every AI tool that uses storebound (skills, MCP server or the CLI in a terminal).
|
||||||
|
|
||||||
|
1. **The owner decides public and irreversible steps.** Submitting for review, releasing a version, resuming or
|
||||||
|
completing a rollout, canceling a submission, deleting products or listings, accepting agreements: explain what
|
||||||
|
will happen and let the owner do it (or run the command only after a clear yes in chat). storebound's MCP server
|
||||||
|
does not offer these at all.
|
||||||
|
2. **Dry run first.** Every write command has `--dry` (MCP: `dry_run`, default true). Show the dry run, then run it
|
||||||
|
for real only after the owner agrees.
|
||||||
|
3. **Read before you write.** `storebound check` (offline) and `storebound validate` (read-only, both stores) tell you
|
||||||
|
what is missing and in which order to fix it.
|
||||||
|
4. **Credentials only from the environment or `.storebound/`** in the project (gitignored). Never ask for keys,
|
||||||
|
passwords or tokens in chat, never print them, never write them into the config, docs or commits.
|
||||||
|
5. **Never answer a compliance question you cannot know.** Export compliance, Data safety, App Privacy, age rating,
|
||||||
|
target audience: ask the owner when the code does not prove the answer. A wrong "no" is worse than a slow "ask".
|
||||||
|
6. **Pick builds by explicit number.** Use the build number / versionCode you just uploaded, never "the latest".
|
||||||
|
7. **Long uploads run in the background with a log** (`storebound play images > .storebound/images.log 2>&1 &`) and
|
||||||
|
you report the progress lines, not guesses.
|
||||||
|
8. **No manipulative tactics** with reviewers, players or store policies: no fake reviews, no hidden features, no
|
||||||
|
misleading screenshots, no keyword stuffing.
|
||||||
|
|
||||||
|
## Tools
|
||||||
|
|
||||||
|
- CLI: `storebound <command>` (`storebound help`); config `storebound.config.ts`, credentials in env or `.storebound/`.
|
||||||
|
- MCP: `storebound mcp` (stdio). Write tools default to `dry_run: true`; submit / release / cancel / delete are not exposed.
|
||||||
|
- Readiness: `storebound check` (offline), `storebound validate` (read-only, both stores).
|
||||||
|
|
||||||
|
## Skills
|
||||||
|
|
||||||
|
| skill | for |
|
||||||
|
|---|---|
|
||||||
|
| `ads-levelplay-checks` | Diagnose and verify ad mediation (Unity LevelPlay / ironSource and its networks like Unity Ads, InMobi, Liftoff, AdMob) in a mobile game before and after store release |
|
||||||
|
| `app-icons` | Generate every app icon a mobile game needs from one artwork |
|
||||||
|
| `appstore-first-release` | Step-by-step first (and later) App Store release of a mobile game |
|
||||||
|
| `aso-basics` | App store optimization basics for a mobile game's text |
|
||||||
|
| `export-compliance` | Answer App Store export compliance (encryption) for a mobile game correctly |
|
||||||
|
| `play-first-release` | Step-by-step first (and later) Google Play release of a mobile game |
|
||||||
|
| `portfolio-originality` | Originality gate for studios that ship many similar mobile games |
|
||||||
|
| `privacy-manifest` | Add and check Apple privacy manifests (PrivacyInfo.xcprivacy) for an iOS game |
|
||||||
|
| `privacy-policy` | Write and host one studio-wide privacy policy page for all of a developer's mobile games |
|
||||||
|
| `release-management` | Ship updates safely after the first release |
|
||||||
|
| `review-rejections` | Triage and answer an App Store or Google Play rejection, policy warning or strike for a mobile game |
|
||||||
|
| `store-declarations` | Answer the store compliance forms for a mobile game |
|
||||||
|
| `store-iap-setup` | Create and price in-app purchases (consumables, non-consumables like "remove ads", coin/gem packs, starter packs) on Google Play and App Store Connect from one product list |
|
||||||
|
| `store-preflight` | Run and read the storebound readiness checks before submitting a mobile game |
|
||||||
|
| `store-screenshots` | Produce store screenshots and the Play feature graphic for a mobile game in every required size and many languages |
|
||||||
|
| `whats-new` | Write player-facing release notes ("What's new") for a mobile game update from the git log since the last tag |
|
||||||
10
.mcp.json
Normal file
10
.mcp.json
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"mcpServers": {
|
||||||
|
"storebound": {
|
||||||
|
"command": "${CLAUDE_PLUGIN_ROOT}/bin/storebound",
|
||||||
|
"args": [
|
||||||
|
"mcp"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
57
AGENTS.md
Normal file
57
AGENTS.md
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
<!-- generated by tools/gen-adapters.ts from docs/agents-core.md and skills/*/SKILL.md; do not edit -->
|
||||||
|
|
||||||
|
# storebound
|
||||||
|
|
||||||
|
Toolchain for shipping mobile games to Google Play and the App Store. Before a store task, open the matching skill
|
||||||
|
file below and follow it step by step.
|
||||||
|
|
||||||
|
These rules apply to every AI tool that uses storebound (skills, MCP server or the CLI in a terminal).
|
||||||
|
|
||||||
|
1. **The owner decides public and irreversible steps.** Submitting for review, releasing a version, resuming or
|
||||||
|
completing a rollout, canceling a submission, deleting products or listings, accepting agreements: explain what
|
||||||
|
will happen and let the owner do it (or run the command only after a clear yes in chat). storebound's MCP server
|
||||||
|
does not offer these at all.
|
||||||
|
2. **Dry run first.** Every write command has `--dry` (MCP: `dry_run`, default true). Show the dry run, then run it
|
||||||
|
for real only after the owner agrees.
|
||||||
|
3. **Read before you write.** `storebound check` (offline) and `storebound validate` (read-only, both stores) tell you
|
||||||
|
what is missing and in which order to fix it.
|
||||||
|
4. **Credentials only from the environment or `.storebound/`** in the project (gitignored). Never ask for keys,
|
||||||
|
passwords or tokens in chat, never print them, never write them into the config, docs or commits.
|
||||||
|
5. **Never answer a compliance question you cannot know.** Export compliance, Data safety, App Privacy, age rating,
|
||||||
|
target audience: ask the owner when the code does not prove the answer. A wrong "no" is worse than a slow "ask".
|
||||||
|
6. **Pick builds by explicit number.** Use the build number / versionCode you just uploaded, never "the latest".
|
||||||
|
7. **Long uploads run in the background with a log** (`storebound play images > .storebound/images.log 2>&1 &`) and
|
||||||
|
you report the progress lines, not guesses.
|
||||||
|
8. **No manipulative tactics** with reviewers, players or store policies: no fake reviews, no hidden features, no
|
||||||
|
misleading screenshots, no keyword stuffing.
|
||||||
|
|
||||||
|
## Tools
|
||||||
|
|
||||||
|
- CLI: `storebound <command>` (`storebound help`); config `storebound.config.ts`, credentials in env or `.storebound/`.
|
||||||
|
- MCP: `storebound mcp` (stdio). Write tools default to `dry_run: true`; submit / release / cancel / delete are not exposed.
|
||||||
|
- Readiness: `storebound check` (offline), `storebound validate` (read-only, both stores).
|
||||||
|
|
||||||
|
## Skills
|
||||||
|
|
||||||
|
- `skills/ads-levelplay-checks/SKILL.md`: Diagnose and verify ad mediation (Unity LevelPlay / ironSource and its networks like Unity Ads, InMobi, Liftoff, AdMob) in a mobile game before and after store release
|
||||||
|
- `skills/app-icons/SKILL.md`: Generate every app icon a mobile game needs from one artwork
|
||||||
|
- `skills/appstore-first-release/SKILL.md`: Step-by-step first (and later) App Store release of a mobile game
|
||||||
|
- `skills/aso-basics/SKILL.md`: App store optimization basics for a mobile game's text
|
||||||
|
- `skills/export-compliance/SKILL.md`: Answer App Store export compliance (encryption) for a mobile game correctly
|
||||||
|
- `skills/play-first-release/SKILL.md`: Step-by-step first (and later) Google Play release of a mobile game
|
||||||
|
- `skills/portfolio-originality/SKILL.md`: Originality gate for studios that ship many similar mobile games
|
||||||
|
- `skills/privacy-manifest/SKILL.md`: Add and check Apple privacy manifests (PrivacyInfo.xcprivacy) for an iOS game
|
||||||
|
- `skills/privacy-policy/SKILL.md`: Write and host one studio-wide privacy policy page for all of a developer's mobile games
|
||||||
|
- `skills/release-management/SKILL.md`: Ship updates safely after the first release
|
||||||
|
- `skills/review-rejections/SKILL.md`: Triage and answer an App Store or Google Play rejection, policy warning or strike for a mobile game
|
||||||
|
- `skills/store-declarations/SKILL.md`: Answer the store compliance forms for a mobile game
|
||||||
|
- `skills/store-iap-setup/SKILL.md`: Create and price in-app purchases (consumables, non-consumables like "remove ads", coin/gem packs, starter packs) on Google Play and App Store Connect from one product list
|
||||||
|
- `skills/store-preflight/SKILL.md`: Run and read the storebound readiness checks before submitting a mobile game
|
||||||
|
- `skills/store-screenshots/SKILL.md`: Produce store screenshots and the Play feature graphic for a mobile game in every required size and many languages
|
||||||
|
- `skills/whats-new/SKILL.md`: Write player-facing release notes ("What's new") for a mobile game update from the git log since the last tag
|
||||||
|
|
||||||
|
## Working on storebound itself
|
||||||
|
|
||||||
|
- Bun + TypeScript strict, zero runtime dependencies. `bun run ci` must pass (adapters fresh, tests, typecheck, scrub).
|
||||||
|
- Skills are the single source: edit `skills/*/SKILL.md` or `docs/agents-core.md`, then `bun tools/gen-adapters.ts`.
|
||||||
|
- Never commit credentials, account / team / issuer / key / app ids or personal data; placeholders use example.com.
|
||||||
52
GEMINI.md
Normal file
52
GEMINI.md
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
<!-- generated by tools/gen-adapters.ts from docs/agents-core.md and skills/*/SKILL.md; do not edit -->
|
||||||
|
|
||||||
|
# storebound
|
||||||
|
|
||||||
|
This extension ships Agent Skills (skills/) and the storebound MCP server for mobile game store releases.
|
||||||
|
|
||||||
|
These rules apply to every AI tool that uses storebound (skills, MCP server or the CLI in a terminal).
|
||||||
|
|
||||||
|
1. **The owner decides public and irreversible steps.** Submitting for review, releasing a version, resuming or
|
||||||
|
completing a rollout, canceling a submission, deleting products or listings, accepting agreements: explain what
|
||||||
|
will happen and let the owner do it (or run the command only after a clear yes in chat). storebound's MCP server
|
||||||
|
does not offer these at all.
|
||||||
|
2. **Dry run first.** Every write command has `--dry` (MCP: `dry_run`, default true). Show the dry run, then run it
|
||||||
|
for real only after the owner agrees.
|
||||||
|
3. **Read before you write.** `storebound check` (offline) and `storebound validate` (read-only, both stores) tell you
|
||||||
|
what is missing and in which order to fix it.
|
||||||
|
4. **Credentials only from the environment or `.storebound/`** in the project (gitignored). Never ask for keys,
|
||||||
|
passwords or tokens in chat, never print them, never write them into the config, docs or commits.
|
||||||
|
5. **Never answer a compliance question you cannot know.** Export compliance, Data safety, App Privacy, age rating,
|
||||||
|
target audience: ask the owner when the code does not prove the answer. A wrong "no" is worse than a slow "ask".
|
||||||
|
6. **Pick builds by explicit number.** Use the build number / versionCode you just uploaded, never "the latest".
|
||||||
|
7. **Long uploads run in the background with a log** (`storebound play images > .storebound/images.log 2>&1 &`) and
|
||||||
|
you report the progress lines, not guesses.
|
||||||
|
8. **No manipulative tactics** with reviewers, players or store policies: no fake reviews, no hidden features, no
|
||||||
|
misleading screenshots, no keyword stuffing.
|
||||||
|
|
||||||
|
## Tools
|
||||||
|
|
||||||
|
- CLI: `storebound <command>` (`storebound help`); config `storebound.config.ts`, credentials in env or `.storebound/`.
|
||||||
|
- MCP: `storebound mcp` (stdio). Write tools default to `dry_run: true`; submit / release / cancel / delete are not exposed.
|
||||||
|
- Readiness: `storebound check` (offline), `storebound validate` (read-only, both stores).
|
||||||
|
|
||||||
|
## Skills
|
||||||
|
|
||||||
|
| skill | for |
|
||||||
|
|---|---|
|
||||||
|
| `ads-levelplay-checks` | Diagnose and verify ad mediation (Unity LevelPlay / ironSource and its networks like Unity Ads, InMobi, Liftoff, AdMob) in a mobile game before and after store release |
|
||||||
|
| `app-icons` | Generate every app icon a mobile game needs from one artwork |
|
||||||
|
| `appstore-first-release` | Step-by-step first (and later) App Store release of a mobile game |
|
||||||
|
| `aso-basics` | App store optimization basics for a mobile game's text |
|
||||||
|
| `export-compliance` | Answer App Store export compliance (encryption) for a mobile game correctly |
|
||||||
|
| `play-first-release` | Step-by-step first (and later) Google Play release of a mobile game |
|
||||||
|
| `portfolio-originality` | Originality gate for studios that ship many similar mobile games |
|
||||||
|
| `privacy-manifest` | Add and check Apple privacy manifests (PrivacyInfo.xcprivacy) for an iOS game |
|
||||||
|
| `privacy-policy` | Write and host one studio-wide privacy policy page for all of a developer's mobile games |
|
||||||
|
| `release-management` | Ship updates safely after the first release |
|
||||||
|
| `review-rejections` | Triage and answer an App Store or Google Play rejection, policy warning or strike for a mobile game |
|
||||||
|
| `store-declarations` | Answer the store compliance forms for a mobile game |
|
||||||
|
| `store-iap-setup` | Create and price in-app purchases (consumables, non-consumables like "remove ads", coin/gem packs, starter packs) on Google Play and App Store Connect from one product list |
|
||||||
|
| `store-preflight` | Run and read the storebound readiness checks before submitting a mobile game |
|
||||||
|
| `store-screenshots` | Produce store screenshots and the Play feature graphic for a mobile game in every required size and many languages |
|
||||||
|
| `whats-new` | Write player-facing release notes ("What's new") for a mobile game update from the git log since the last tag |
|
||||||
14
gemini-extension.json
Normal file
14
gemini-extension.json
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"name": "storebound",
|
||||||
|
"version": "0.2.0",
|
||||||
|
"description": "Ship mobile games to Google Play and the App Store: store listings, in-app products, data safety, screenshots, icons, release management and review checklists, as Agent Skills plus a Bun CLI and MCP server (storebound). CRTkafa's own toolchain, open-sourced.",
|
||||||
|
"contextFileName": "GEMINI.md",
|
||||||
|
"mcpServers": {
|
||||||
|
"storebound": {
|
||||||
|
"command": "${extensionPath}${/}bin${/}storebound",
|
||||||
|
"args": [
|
||||||
|
"mcp"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
53
package.json
53
package.json
|
|
@ -1,19 +1,56 @@
|
||||||
{
|
{
|
||||||
"name": "storebound",
|
"name": "storebound",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"description": "My toolchain for shipping mobile games to Google Play and the App Store: a Bun CLI plus Claude Code skills.",
|
"description": "My toolchain for shipping mobile games to Google Play and the App Store: a Bun CLI, an MCP server and Agent Skills for any AI coding tool.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "CRTkafa",
|
"author": "CRTkafa",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"repository": { "type": "git", "url": "https://git.crt.fyi/CRT/storebound.git" },
|
"repository": {
|
||||||
"keywords": ["google-play", "app-store-connect", "mobile-games", "store-listing", "in-app-purchases", "screenshots", "claude-code-plugin"],
|
"type": "git",
|
||||||
"bin": { "storebound": "./cli/index.ts" },
|
"url": "https://git.crt.fyi/CRT/storebound.git"
|
||||||
"exports": { ".": "./cli/lib/config.ts" },
|
},
|
||||||
"files": ["cli", "templates", "skills", "bin", ".claude-plugin", "README.md", "LICENSE", "CHANGELOG.md"],
|
"keywords": [
|
||||||
"engines": { "bun": ">=1.1" },
|
"google-play",
|
||||||
|
"app-store-connect",
|
||||||
|
"mobile-games",
|
||||||
|
"store-listing",
|
||||||
|
"in-app-purchases",
|
||||||
|
"screenshots",
|
||||||
|
"claude-code-plugin",
|
||||||
|
"agent-skills",
|
||||||
|
"mcp"
|
||||||
|
],
|
||||||
|
"bin": {
|
||||||
|
"storebound": "./cli/index.ts"
|
||||||
|
},
|
||||||
|
"exports": {
|
||||||
|
".": "./cli/lib/config.ts"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"cli",
|
||||||
|
"templates",
|
||||||
|
"skills",
|
||||||
|
"bin",
|
||||||
|
"docs",
|
||||||
|
".claude-plugin",
|
||||||
|
".codex-plugin",
|
||||||
|
".mcp.json",
|
||||||
|
"gemini-extension.json",
|
||||||
|
"GEMINI.md",
|
||||||
|
"AGENTS.md",
|
||||||
|
"README.md",
|
||||||
|
"LICENSE",
|
||||||
|
"CHANGELOG.md"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"bun": ">=1.1"
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "bun test",
|
"test": "bun test",
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
|
"adapters": "bun tools/gen-adapters.ts",
|
||||||
|
"scrub": "bun tools/scrub.ts",
|
||||||
|
"ci": "bun tools/ci.ts",
|
||||||
"check": "bun run typecheck && bun test"
|
"check": "bun run typecheck && bun test"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
||||||
421
tests/wave1.test.ts
Normal file
421
tests/wave1.test.ts
Normal file
|
|
@ -0,0 +1,421 @@
|
||||||
|
import { describe, expect, test } from 'bun:test';
|
||||||
|
import { mkdtempSync, readFileSync, writeFileSync, mkdirSync, existsSync } from 'node:fs';
|
||||||
|
import { tmpdir } from 'node:os';
|
||||||
|
import { join } from 'node:path';
|
||||||
|
import { generate, parseSkill, readSkills } from '../tools/gen-adapters';
|
||||||
|
import { scan } from '../tools/scrub';
|
||||||
|
import { FORBIDDEN_ARGS, listTools, TOOLS, toArgv, validateInput } from '../cli/mcp-tools';
|
||||||
|
import { handle, PROTOCOL } from '../cli/mcp';
|
||||||
|
import { auditAppleKeywords, auditAso, auditPlayListing, crossLocaleHint } from '../cli/lib/aso';
|
||||||
|
import { checkNotes, formatNotes, noteItems, setAppleWhatsNew, setPlayWhatsNew } from '../cli/lib/whats-new';
|
||||||
|
import { parseAppStoreListing, parsePlayListing } from '../cli/lib/copy';
|
||||||
|
import { evaluatePrivacyManifest, parseManifest, scanSources } from '../cli/lib/privacy-manifest';
|
||||||
|
import { type AppleSnapshot, appleRules, normAdsLine, type PlaySnapshot, playRules } from '../cli/lib/validate-rules';
|
||||||
|
import { classifyReviewState, compareBuild, nextBuildNumber, nextPollDelay, nextVersionCode, parseDuration, phasedRequest, rolloutReleases } from '../cli/lib/release';
|
||||||
|
import { AGENTS, mergeCodexToml, mergeJsonServer } from '../cli/lib/agents';
|
||||||
|
import { mcpCommand, run as install } from '../cli/install';
|
||||||
|
import { parseArgs } from '../cli/lib/args';
|
||||||
|
import { rolloutAction } from '../cli/play/rollout';
|
||||||
|
import { validateConfig } from '../cli/lib/config';
|
||||||
|
|
||||||
|
const ROOT = join(import.meta.dir, '..');
|
||||||
|
const T = join(ROOT, 'templates');
|
||||||
|
const tmp = () => mkdtempSync(join(tmpdir(), 'storebound-'));
|
||||||
|
|
||||||
|
describe('adapters', () => {
|
||||||
|
test('generation is deterministic and the committed files are fresh', () => {
|
||||||
|
const a = generate(ROOT);
|
||||||
|
const b = generate(ROOT);
|
||||||
|
expect([...a]).toEqual([...b]);
|
||||||
|
for (const [rel, text] of a) expect({ rel, fresh: existsSync(join(ROOT, rel)) && readFileSync(join(ROOT, rel), 'utf8') === text }).toEqual({ rel, fresh: true });
|
||||||
|
});
|
||||||
|
test('every adapter lists every skill and the manifests are valid JSON with the package version', () => {
|
||||||
|
const out = generate(ROOT);
|
||||||
|
const skills = readSkills(ROOT);
|
||||||
|
expect(skills.length).toBeGreaterThanOrEqual(16);
|
||||||
|
for (const f of ['AGENTS.md', 'GEMINI.md', '.github/copilot-instructions.md', '.cursor/rules/storebound.mdc'])
|
||||||
|
for (const s of skills) expect(out.get(f)!).toContain(s.name);
|
||||||
|
const version = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf8')).version;
|
||||||
|
for (const f of ['.claude-plugin/plugin.json', '.codex-plugin/plugin.json', 'gemini-extension.json']) expect(JSON.parse(out.get(f)!).version).toBe(version);
|
||||||
|
expect(JSON.parse(out.get('.codex-plugin/plugin.json')!).skills).toBe('./skills/');
|
||||||
|
expect(JSON.parse(out.get('.mcp.json')!).mcpServers.storebound).toEqual({ command: '${CLAUDE_PLUGIN_ROOT}/bin/storebound', args: ['mcp'] });
|
||||||
|
expect(JSON.parse(out.get('gemini-extension.json')!).mcpServers.storebound.command).toContain('${extensionPath}');
|
||||||
|
expect(out.get('.cursor/rules/storebound.mdc')!).toMatch(/^---\ndescription: .+\nalwaysApply: false\n---\n/);
|
||||||
|
});
|
||||||
|
test('skill frontmatter rules', () => {
|
||||||
|
expect(parseSkill('a-b', '---\nname: a-b\ndescription: x\n---\n')).toEqual({ name: 'a-b', description: 'x' });
|
||||||
|
expect(() => parseSkill('a-b', '---\nname: a-c\ndescription: x\n---\n')).toThrow('folder');
|
||||||
|
expect(() => parseSkill('Ab', '---\nname: Ab\ndescription: x\n---\n')).toThrow('lowercase');
|
||||||
|
expect(() => parseSkill('a', '---\nname: a\ndescription: x\nlicense: MIT\n---\n')).toThrow('only name + description');
|
||||||
|
expect(() => parseSkill('a', '---\nname: a\ndescription: \n---\n')).toThrow('1-1024');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('mcp tools', () => {
|
||||||
|
test('every write tool has dry_run defaulting to true and builds --dry', () => {
|
||||||
|
for (const t of TOOLS.filter(x => x.write)) {
|
||||||
|
const schema = listTools().find(x => x.name === t.name)!.inputSchema as { properties: Record<string, { default?: unknown }> };
|
||||||
|
expect(schema.properties.dry_run!.default).toBe(true);
|
||||||
|
const req = Object.fromEntries((t.required ?? []).map(r => [r, r === 'version' ? '1.0.0' : r === 'action' ? 'on' : 'x']));
|
||||||
|
expect(toArgv(t, req).argv).toContain('--dry');
|
||||||
|
expect(toArgv(t, { ...req, dry_run: false }).argv).not.toContain('--dry');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
test('annotations match the kind of tool', () => {
|
||||||
|
for (const t of listTools()) {
|
||||||
|
const a = t.annotations as Record<string, boolean>;
|
||||||
|
const def = TOOLS.find(x => x.name === t.name)!;
|
||||||
|
expect(a.readOnlyHint).toBe(!def.write);
|
||||||
|
if (!def.write) expect(a.destructiveHint).toBe(false);
|
||||||
|
expect(typeof a.openWorldHint).toBe('boolean');
|
||||||
|
expect((t.inputSchema as { additionalProperties: boolean }).additionalProperties).toBe(false);
|
||||||
|
expect(t.name).toMatch(/^[a-z0-9_]{1,64}$/);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
test('nothing public or irreversible is reachable', () => {
|
||||||
|
const names = TOOLS.map(t => t.name);
|
||||||
|
for (const bad of ['apple_submit', 'apple_release', 'apple_manual_release', 'play_rollout', 'apple_cancel_submission', 'play_release'])
|
||||||
|
expect(names).not.toContain(bad);
|
||||||
|
for (const t of TOOLS) {
|
||||||
|
const enums = Object.values(t.props ?? {}).flatMap(p => p.enum ?? []);
|
||||||
|
for (const combo of [{}, ...enums.map(e => Object.fromEntries(Object.entries(t.props ?? {}).filter(([, p]) => p.enum?.includes(e)).map(([k]) => [k, e])))]) {
|
||||||
|
const input: Record<string, unknown> = { ...Object.fromEntries((t.required ?? []).map(r => [r, r === 'action' ? 'on' : r === 'version' ? '1.0.0' : 'x'])), ...combo, dry_run: false };
|
||||||
|
const argv = toArgv(t, input).argv;
|
||||||
|
for (const f of FORBIDDEN_ARGS) expect({ tool: t.name, argv, hit: argv.includes(f) }).toEqual({ tool: t.name, argv, hit: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const phased = TOOLS.find(t => t.name === 'apple_phased_release')!;
|
||||||
|
expect(phased.props!.action!.enum).toEqual(['on', 'pause']);
|
||||||
|
expect(TOOLS.find(t => t.name === 'play_release_testing')!.props!.track!.enum).not.toContain('production');
|
||||||
|
});
|
||||||
|
test('input validation', () => {
|
||||||
|
const listing = TOOLS.find(t => t.name === 'apple_listing')!;
|
||||||
|
expect(validateInput(listing, {})).toEqual(['version: required']);
|
||||||
|
expect(validateInput(listing, { version: '1.0.0', nope: 1 })).toEqual(['nope: unknown argument']);
|
||||||
|
expect(validateInput(listing, { version: 'abc' })[0]).toContain('does not match');
|
||||||
|
expect(validateInput(listing, { version: '1.0', build: '--yes' })[0]).toContain('must not start with "-"');
|
||||||
|
expect(validateInput(listing, { version: '1.0', dry_run: 'no' })).toEqual(['dry_run: must be boolean']);
|
||||||
|
});
|
||||||
|
test('json-rpc handling', async () => {
|
||||||
|
const init = await handle({ jsonrpc: '2.0', id: 1, method: 'initialize', params: { protocolVersion: '2025-11-25' } });
|
||||||
|
expect((init!.result as { protocolVersion: string }).protocolVersion).toBe(PROTOCOL);
|
||||||
|
const old = await handle({ jsonrpc: '2.0', id: 2, method: 'initialize', params: { protocolVersion: '1999-01-01' } });
|
||||||
|
expect((old!.result as { protocolVersion: string }).protocolVersion).toBe(PROTOCOL);
|
||||||
|
expect(await handle({ jsonrpc: '2.0', method: 'notifications/initialized' })).toBeNull();
|
||||||
|
expect((await handle({ jsonrpc: '2.0', id: 3, method: 'ping' }))!.result).toEqual({});
|
||||||
|
expect(((await handle({ jsonrpc: '2.0', id: 4, method: 'nope' }))!.error as { code: number }).code).toBe(-32601);
|
||||||
|
expect(((await handle({ jsonrpc: '2.0', id: 5, method: 'tools/call', params: { name: 'apple_submit' } }))!.error as { code: number }).code).toBe(-32602);
|
||||||
|
let seen: string[] = [];
|
||||||
|
const fake = async (argv: string[]) => { seen = argv; return { code: 0, out: 'ok' }; };
|
||||||
|
const r = await handle({ jsonrpc: '2.0', id: 6, method: 'tools/call', params: { name: 'play_listing', arguments: { only: 'en-US' } } }, fake);
|
||||||
|
expect(seen).toEqual(['play', 'listing', '--only', 'en-US', '--dry']);
|
||||||
|
const res = r!.result as { isError: boolean; structuredContent: { dryRun: boolean; exitCode: number } };
|
||||||
|
expect(res.isError).toBe(false);
|
||||||
|
expect(res.structuredContent).toMatchObject({ dryRun: true, exitCode: 0 });
|
||||||
|
const bad = await handle({ jsonrpc: '2.0', id: 7, method: 'tools/call', params: { name: 'play_listing', arguments: { only: 1 } } }, fake);
|
||||||
|
expect((bad!.result as { isError: boolean }).isError).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('aso', () => {
|
||||||
|
test('keyword field rules', () => {
|
||||||
|
const f = auditAppleKeywords('en-US', { subtitle: 'Relaxing puzzle', keywords: 'match,puzzle,match,free game' }, 'Tile Match');
|
||||||
|
const text = f.map(x => `${x.level}:${x.msg}`).join('\n');
|
||||||
|
expect(text).toContain('warn:keywords: 28/100 used');
|
||||||
|
expect(text).toContain('"match" listed twice');
|
||||||
|
expect(text).toContain('repeat words from the name / subtitle (already indexed): match, puzzle');
|
||||||
|
expect(text).toContain('filler words that rarely help: free, game');
|
||||||
|
expect(auditAppleKeywords('en-US', { keywords: 'a, b' }, 'X').some(x => x.level === 'error' && /spaces/.test(x.msg))).toBe(true);
|
||||||
|
expect(auditAppleKeywords('en-US', { keywords: 'x'.repeat(101) }, 'X').some(x => x.level === 'error')).toBe(true);
|
||||||
|
expect(auditAppleKeywords('en-US', { keywords: Array.from({ length: 23 }, (_, i) => `w${String(i).padStart(2, '0')}`).join(',') }, 'Name').filter(x => x.level !== 'info')).toEqual([]);
|
||||||
|
});
|
||||||
|
test('play stuffing and claims', () => {
|
||||||
|
const full = Array.from({ length: 20 }, () => 'puzzle puzzle fun levels').join(' ');
|
||||||
|
const f = auditPlayListing({ lang: 'en-US', title: 'BEST PUZZLE', short: 'The #1 puzzle 🎉', full, whatsNew: '' });
|
||||||
|
const t = f.map(x => x.msg).join('\n');
|
||||||
|
expect(t).toContain('"puzzle" 40x');
|
||||||
|
expect(t).toContain('"best", "#1"');
|
||||||
|
expect(t).toContain('all caps');
|
||||||
|
expect(t).toContain('emoji');
|
||||||
|
});
|
||||||
|
test('cross-locale hint and template listings', () => {
|
||||||
|
expect(crossLocaleHint('US', ['en-US', 'es-MX'])!.msg).toContain('You fill en-US, es-MX');
|
||||||
|
expect(crossLocaleHint('ZZ', [])).toBeNull();
|
||||||
|
const apple = parseAppStoreListing(readFileSync(join(T, 'appstore.md'), 'utf8'));
|
||||||
|
const play = parsePlayListing(readFileSync(join(T, 'listing.md'), 'utf8'), 'Example Game');
|
||||||
|
expect(auditAso({ apple, play, appName: 'Example Game' }).filter(x => x.level === 'error')).toEqual([]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('whats-new', () => {
|
||||||
|
const subjects = ['feat: desert world with 20 levels (#41)', 'fix(ui): settings button overlapped the notch', 'chore: bump deps', 'Merge branch x',
|
||||||
|
'refactor: asset loader', 'perf: faster level loading', 'feat: desert world with 20 levels', 'docs: readme', '1.2.0', 'tweak shop layout [internal]'];
|
||||||
|
test('items: housekeeping dropped, prefixes stripped, deduped, new first', () => {
|
||||||
|
expect(noteItems(subjects)).toEqual([
|
||||||
|
{ kind: 'new', text: 'Desert world with 20 levels.' },
|
||||||
|
{ kind: 'better', text: 'Faster level loading.' },
|
||||||
|
{ kind: 'fix', text: 'Fixed: settings button overlapped the notch.' },
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
test('format within limits and checks', () => {
|
||||||
|
const notes = formatNotes(noteItems(subjects), { limit: 500 });
|
||||||
|
expect(notes.split('\n')[0]).toBe('New in this update:');
|
||||||
|
expect(notes).toContain('• Desert world with 20 levels.');
|
||||||
|
expect(checkNotes(notes, 'play')).toEqual([]);
|
||||||
|
const many = Array.from({ length: 60 }, (_, i) => ({ kind: 'fix' as const, text: `Fixed thing number ${i}.` }));
|
||||||
|
expect([...formatNotes(many, { limit: 500 })].length).toBeLessThanOrEqual(500);
|
||||||
|
expect(formatNotes([], { limit: 500 })).toBe('Bug fixes and performance improvements.');
|
||||||
|
expect(checkNotes('x'.repeat(501), 'play')[0]).toContain('501 > 500');
|
||||||
|
expect(checkNotes('bump version', 'apple')[0]).toContain('commit log');
|
||||||
|
});
|
||||||
|
test('writes into both listing files, keeping them parseable', () => {
|
||||||
|
const play = readFileSync(join(T, 'listing.md'), 'utf8');
|
||||||
|
const r = setPlayWhatsNew(play, 'en-US', 'New: desert world!');
|
||||||
|
expect(r.changed).toEqual(['en-US']);
|
||||||
|
const parsed = parsePlayListing(r.md, 'X');
|
||||||
|
expect(parsed.find(x => x.lang === 'en-US')!.whatsNew).toBe('New: desert world!');
|
||||||
|
expect(parsed.find(x => x.lang === 'tr-TR')!.whatsNew).toContain('İlk sürüm');
|
||||||
|
expect(setPlayWhatsNew(play, '*', 'A').changed).toEqual(['en-US', 'tr-TR']);
|
||||||
|
const apple = readFileSync(join(T, 'appstore.md'), 'utf8');
|
||||||
|
const a1 = setAppleWhatsNew(apple, 'tr', 'Yeni dünya!');
|
||||||
|
expect(parseAppStoreListing(a1.md).tr!.whatsNew).toBe('Yeni dünya!');
|
||||||
|
const a2 = setAppleWhatsNew(a1.md, 'tr', 'İkinci');
|
||||||
|
expect(parseAppStoreListing(a2.md).tr!.whatsNew).toBe('İkinci');
|
||||||
|
expect(parseAppStoreListing(a2.md)['en-US']!.whatsNew).toBeUndefined();
|
||||||
|
expect(setAppleWhatsNew(apple, 'de-DE', 'x').changed).toEqual([]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('privacy manifest', () => {
|
||||||
|
const xml = `<?xml version="1.0"?><plist version="1.0"><dict>
|
||||||
|
<key>NSPrivacyTracking</key><false/>
|
||||||
|
<key>NSPrivacyTrackingDomains</key><array/>
|
||||||
|
<key>NSPrivacyAccessedAPITypes</key><array>
|
||||||
|
<dict><key>NSPrivacyAccessedAPIType</key><string>NSPrivacyAccessedAPICategoryUserDefaults</string>
|
||||||
|
<key>NSPrivacyAccessedAPITypeReasons</key><array><string>CA92.1</string></array></dict>
|
||||||
|
<dict><key>NSPrivacyAccessedAPIType</key><string>NSPrivacyAccessedAPICategoryDiskSpace</string>
|
||||||
|
<key>NSPrivacyAccessedAPITypeReasons</key><array><string>ZZZZ.1</string></array></dict>
|
||||||
|
</array></dict></plist>`;
|
||||||
|
test('parse', () => {
|
||||||
|
const m = parseManifest('App/PrivacyInfo.xcprivacy', xml);
|
||||||
|
expect(m.tracking).toBe(false);
|
||||||
|
expect(m.apis).toEqual({ NSPrivacyAccessedAPICategoryUserDefaults: ['CA92.1'], NSPrivacyAccessedAPICategoryDiskSpace: ['ZZZZ.1'] });
|
||||||
|
});
|
||||||
|
test('evaluate', () => {
|
||||||
|
const hits = scanSources([{ path: 'App/Save.swift', text: 'UserDefaults.standard.set(1, forKey: "x")' }, { path: 'App/T.swift', text: 'let t = ProcessInfo.processInfo.systemUptime' }]);
|
||||||
|
const f = evaluatePrivacyManifest({ appManifest: parseManifest('p', xml), sourceHits: hits, asksTracking: true,
|
||||||
|
sdks: [{ name: 'FirebaseCore', path: 'Pods/FirebaseCore', hasManifest: false }, { name: 'SomeAds', path: 'Pods/SomeAds', hasManifest: false }, { name: 'Ok', path: 'x', hasManifest: true }] });
|
||||||
|
const t = f.map(x => `${x.level}:${x.msg}`);
|
||||||
|
expect(t.filter(x => x.startsWith('blocker')).length).toBe(2);
|
||||||
|
expect(t.some(x => x.startsWith('blocker:NSPrivacyAccessedAPICategorySystemBootTime used'))).toBe(true);
|
||||||
|
expect(t.some(x => x.startsWith('blocker:FirebaseCore'))).toBe(true);
|
||||||
|
expect(t.some(x => x.startsWith('warn:SomeAds'))).toBe(true);
|
||||||
|
expect(t.some(x => x.includes('unknown reason code(s) ZZZZ.1'))).toBe(false); // DiskSpace not used in sources -> info only
|
||||||
|
expect(t.some(x => x.startsWith('warn:Info.plist asks for tracking'))).toBe(true);
|
||||||
|
expect(evaluatePrivacyManifest({ appManifest: null, sourceHits: new Map(), sdks: [], asksTracking: false })[0]!.level).toBe('blocker');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const appleOk = (): AppleSnapshot => ({
|
||||||
|
version: { versionString: '1.1.0', state: 'PREPARE_FOR_SUBMISSION' },
|
||||||
|
build: { number: '42', processingState: 'VALID', usesNonExemptEncryption: false, declarationState: null },
|
||||||
|
expectedLocales: ['en-US', 'tr'],
|
||||||
|
locales: ['en-US', 'tr'].map(l => ({ locale: l, subtitle: 's', description: 'd', keywords: 'k', screenshots: { APP_IPHONE_67: 5 } })),
|
||||||
|
requiredDisplayTypes: ['APP_IPHONE_67'],
|
||||||
|
reviewDetail: { contactEmail: 'review@example.com', contactPhone: '+1 555 0100', contactFirstName: 'A', contactLastName: 'B', notes: 'n' },
|
||||||
|
ageRating: { advertising: true, gambling: false, kidsAgeBand: null },
|
||||||
|
priceSchedule: true, availability: true,
|
||||||
|
iaps: [{ productId: 'p1', state: 'READY_TO_SUBMIT', reviewScreenshot: true }], expectedProducts: ['p1'],
|
||||||
|
privacyUrl: { url: 'https://example.com/privacy', status: 200 },
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('validate rules', () => {
|
||||||
|
test('apple: all good', () => {
|
||||||
|
expect(appleRules(appleOk()).filter(f => f.level !== 'ok')).toEqual([]);
|
||||||
|
});
|
||||||
|
test('apple: ordered blockers', () => {
|
||||||
|
const s = appleOk();
|
||||||
|
s.build = { number: '42', processingState: 'PROCESSING', usesNonExemptEncryption: null, declarationState: null };
|
||||||
|
s.locales = [{ locale: 'en-US', description: 'd', keywords: '', screenshots: {} }];
|
||||||
|
s.reviewDetail = null;
|
||||||
|
s.ageRating = { gambling: null, kidsAgeBand: null };
|
||||||
|
s.availability = false;
|
||||||
|
s.iaps = [{ productId: 'p1', state: 'MISSING_METADATA', reviewScreenshot: false }];
|
||||||
|
s.expectedProducts = ['p1', 'p2'];
|
||||||
|
s.privacyUrl = { url: 'https://example.com/privacy', status: 404 };
|
||||||
|
const f = appleRules(s);
|
||||||
|
const codes = f.filter(x => x.level === 'blocker').map(x => x.code);
|
||||||
|
expect(codes).toEqual(['build', 'encryption', 'locale', 'metadata', 'screenshots', 'review-details', 'age-rating', 'availability', 'iap', 'iap', 'privacy-url']);
|
||||||
|
expect(f.find(x => x.code === 'metadata')!.msg).toBe('en-US: missing keywords, subtitle');
|
||||||
|
expect(f.find(x => x.code === 'availability')!.fix).toContain('Pricing and Availability');
|
||||||
|
expect(f.findIndex(x => x.level === 'ok')).toBeGreaterThan(f.findLastIndex(x => x.level === 'blocker'));
|
||||||
|
});
|
||||||
|
test('apple: non-exempt needs an approved declaration', () => {
|
||||||
|
const s = appleOk();
|
||||||
|
s.build = { ...s.build!, usesNonExemptEncryption: true, declarationState: 'IN_REVIEW' };
|
||||||
|
expect(appleRules(s).find(x => x.code === 'encryption')!.level).toBe('blocker');
|
||||||
|
s.build.declarationState = 'APPROVED';
|
||||||
|
expect(appleRules(s).find(x => x.code === 'encryption')!.level).toBe('ok');
|
||||||
|
});
|
||||||
|
const playOk = (): PlaySnapshot => ({
|
||||||
|
defaultLanguage: 'en-US', expectedLanguages: ['en-US', 'tr-TR'],
|
||||||
|
listings: ['en-US', 'tr-TR'].map(language => ({ language, title: 't', shortDescription: 's', fullDescription: 'f', images: { icon: 1, featureGraphic: 1, phoneScreenshots: 4 } })),
|
||||||
|
privacyUrl: { url: 'https://example.com/privacy', status: 200 }, website: 'https://example.com',
|
||||||
|
appAds: { url: 'https://example.com/app-ads.txt', status: 200, body: 'example-network.com, pub-1, DIRECT, abc\n# comment\n' },
|
||||||
|
appAdsLines: ['Example-Network.com,pub-1,DIRECT,abc'], adsLikely: true,
|
||||||
|
tracks: [{ track: 'production', releases: [{ status: 'completed', versionCodes: ['7'] }] }],
|
||||||
|
products: [{ productId: 'p1', states: ['ACTIVE'] }], expectedProducts: ['p1'],
|
||||||
|
});
|
||||||
|
test('play: all good, app-ads normalisation', () => {
|
||||||
|
expect(playRules(playOk()).filter(f => f.level !== 'ok')).toEqual([]);
|
||||||
|
expect(normAdsLine(' A.com , X , DIRECT # c')).toBe('a.com,x,direct');
|
||||||
|
});
|
||||||
|
test('play: blockers', () => {
|
||||||
|
const s = playOk();
|
||||||
|
s.listings = [{ language: 'en-US', title: 't', shortDescription: '', fullDescription: 'f', images: { icon: 1, featureGraphic: 0, phoneScreenshots: 1 } }];
|
||||||
|
s.appAds = { url: 'https://example.com/app-ads.txt', status: 200, body: 'other.com, 1, RESELLER\n' };
|
||||||
|
s.tracks = [];
|
||||||
|
s.products = [{ productId: 'p1', states: ['DRAFT'] }];
|
||||||
|
s.privacyUrl = { url: 'https://example.com/privacy', status: null, error: 'timeout' };
|
||||||
|
const codes = playRules(s).filter(x => x.level === 'blocker').map(x => `${x.code}:${x.msg}`);
|
||||||
|
expect(codes).toEqual([
|
||||||
|
'listing:tr-TR: no listing', 'listing:en-US: missing shortDescription', 'images:en-US: featureGraphic 0/1', 'images:en-US: phoneScreenshots 1/2',
|
||||||
|
'privacy-url:privacy policy https://example.com/privacy: unreachable (timeout)', 'app-ads:app-ads.txt lacks 1 line(s): Example-Network.com,pub-1,DIRECT,abc',
|
||||||
|
'tracks:no release on any track', 'products:p1: purchase option DRAFT']);
|
||||||
|
const h = playOk();
|
||||||
|
h.tracks = [{ track: 'production', releases: [{ status: 'halted', versionCodes: ['8'], userFraction: 0.1 }] }];
|
||||||
|
expect(playRules(h).find(x => x.code === 'tracks')!.level).toBe('warn');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('release helpers', () => {
|
||||||
|
test('review states and polling', () => {
|
||||||
|
expect(classifyReviewState('IN_REVIEW')).toBe('pending');
|
||||||
|
expect(classifyReviewState('PENDING_DEVELOPER_RELEASE')).toBe('approved');
|
||||||
|
expect(classifyReviewState('REJECTED')).toBe('rejected');
|
||||||
|
expect(classifyReviewState('PREPARE_FOR_SUBMISSION')).toBe('not-submitted');
|
||||||
|
expect(nextPollDelay(null)).toBe(60_000);
|
||||||
|
expect(nextPollDelay(60_000)).toBe(90_000);
|
||||||
|
expect(nextPollDelay(800_000)).toBe(900_000);
|
||||||
|
expect(parseDuration('48h')).toBe(172_800_000);
|
||||||
|
expect(parseDuration('90')).toBe(90_000);
|
||||||
|
expect(() => parseDuration('soon')).toThrow();
|
||||||
|
});
|
||||||
|
test('build numbers and version codes', () => {
|
||||||
|
expect(nextBuildNumber([])).toBe('1');
|
||||||
|
expect(nextBuildNumber(['3', '12', '9'])).toBe('13');
|
||||||
|
expect(nextBuildNumber(['1.0.9', '1.0.10'])).toBe('1.0.11');
|
||||||
|
expect(compareBuild('2', '10')).toBeLessThan(0);
|
||||||
|
expect(nextVersionCode(['5', 12, '7'])).toBe(13);
|
||||||
|
expect(nextVersionCode([])).toBe(1);
|
||||||
|
expect(() => nextVersionCode([2_100_000_000])).toThrow();
|
||||||
|
});
|
||||||
|
test('play rollout transitions', () => {
|
||||||
|
const base = [{ status: 'completed', versionCodes: ['6'] }, { status: 'inProgress', versionCodes: ['7'], userFraction: 0.05 }];
|
||||||
|
expect(rolloutReleases(base, { kind: 'fraction', value: 0.2 }).releases[1]).toMatchObject({ status: 'inProgress', userFraction: 0.2 });
|
||||||
|
expect(() => rolloutReleases(base, { kind: 'fraction', value: 0.01 })).toThrow('does not lower');
|
||||||
|
expect(() => rolloutReleases(base, { kind: 'fraction', value: 1 })).toThrow('--complete');
|
||||||
|
const halted = rolloutReleases(base, { kind: 'halt' }).releases;
|
||||||
|
expect(halted[1]!.status).toBe('halted');
|
||||||
|
expect(rolloutReleases(halted, { kind: 'resume' }).releases[1]).toMatchObject({ status: 'inProgress', userFraction: 0.05 });
|
||||||
|
expect(() => rolloutReleases(halted, { kind: 'fraction', value: 0.5 })).toThrow('halted');
|
||||||
|
const done = rolloutReleases(base, { kind: 'complete' }).releases;
|
||||||
|
expect(done).toEqual([{ status: 'completed', versionCodes: ['7'] }]);
|
||||||
|
expect(() => rolloutReleases([{ status: 'completed', versionCodes: ['6'] }], { kind: 'halt' })).toThrow('no staged rollout');
|
||||||
|
});
|
||||||
|
test('rollout args', () => {
|
||||||
|
expect(rolloutAction(parseArgs(['--fraction', '0.2']))).toEqual({ kind: 'fraction', value: 0.2 });
|
||||||
|
expect(rolloutAction(parseArgs(['--resume', '--fraction', '0.1']))).toEqual({ kind: 'resume', value: 0.1 });
|
||||||
|
expect(rolloutAction(parseArgs(['--halt']))).toEqual({ kind: 'halt' });
|
||||||
|
expect(() => rolloutAction(parseArgs(['--halt', '--complete']))).toThrow('pick one');
|
||||||
|
expect(() => rolloutAction(parseArgs([]))).toThrow('usage');
|
||||||
|
});
|
||||||
|
test('apple phased release transitions', () => {
|
||||||
|
expect(phasedRequest(null, 'on').method).toBe('POST');
|
||||||
|
expect(phasedRequest({ id: '1', state: 'INACTIVE' }, 'on').method).toBe('NONE');
|
||||||
|
expect(phasedRequest({ id: '1', state: 'ACTIVE' }, 'pause')).toMatchObject({ method: 'PATCH', state: 'PAUSED' });
|
||||||
|
expect(phasedRequest({ id: '1', state: 'PAUSED' }, 'resume')).toMatchObject({ method: 'PATCH', state: 'ACTIVE' });
|
||||||
|
expect(phasedRequest({ id: '1', state: 'ACTIVE' }, 'complete')).toMatchObject({ method: 'PATCH', state: 'COMPLETE' });
|
||||||
|
expect(() => phasedRequest(null, 'pause')).toThrow('--phased on');
|
||||||
|
expect(() => phasedRequest({ id: '1', state: 'INACTIVE' }, 'pause')).toThrow('ACTIVE');
|
||||||
|
expect(() => phasedRequest({ id: '1', state: 'COMPLETE' }, 'resume')).toThrow('COMPLETE');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('install', () => {
|
||||||
|
const cmd = { command: '/x/bin/storebound', args: ['mcp'] };
|
||||||
|
test('json merge keeps other entries and is idempotent', () => {
|
||||||
|
const cur = JSON.stringify({ mcpServers: { other: { command: 'o' } }, extra: 1 });
|
||||||
|
const r = mergeJsonServer(cur, 'mcpServers', cmd);
|
||||||
|
expect(JSON.parse(r.text)).toEqual({ mcpServers: { other: { command: 'o' }, storebound: cmd }, extra: 1 });
|
||||||
|
expect(r.changed).toBe(true);
|
||||||
|
expect(mergeJsonServer(r.text, 'mcpServers', cmd).changed).toBe(false);
|
||||||
|
expect(JSON.parse(mergeJsonServer(null, 'vscode', cmd).text)).toEqual({ servers: { storebound: { type: 'stdio', ...cmd } } });
|
||||||
|
expect(JSON.parse(mergeJsonServer(null, 'opencode', cmd).text)).toEqual({ $schema: 'https://opencode.ai/config.json', mcp: { storebound: { type: 'local', command: ['/x/bin/storebound', 'mcp'], enabled: true } } });
|
||||||
|
expect(() => mergeJsonServer('{nope', 'mcpServers', cmd)).toThrow('not valid JSON');
|
||||||
|
});
|
||||||
|
test('codex toml merge', () => {
|
||||||
|
const cur = 'model = "x"\n\n[mcp_servers.other]\ncommand = "o"\n\n[mcp_servers.storebound]\ncommand = "old"\n\n[mcp_servers.storebound.env]\nA = "1"\n\n[profiles.p]\nk = 1\n';
|
||||||
|
const r = mergeCodexToml(cur, cmd);
|
||||||
|
expect(r.changed).toBe(true);
|
||||||
|
expect(r.text).toContain('[mcp_servers.other]\ncommand = "o"');
|
||||||
|
expect(r.text).toContain('[mcp_servers.storebound]\ncommand = "/x/bin/storebound"\nargs = ["mcp"]');
|
||||||
|
expect(r.text).not.toContain('old');
|
||||||
|
expect(r.text).not.toContain('storebound.env');
|
||||||
|
expect(r.text).toContain('[profiles.p]\nk = 1');
|
||||||
|
expect(mergeCodexToml(r.text, cmd).changed).toBe(false);
|
||||||
|
expect(mergeCodexToml(null, cmd).text).toBe('[mcp_servers.storebound]\ncommand = "/x/bin/storebound"\nargs = ["mcp"]\n');
|
||||||
|
});
|
||||||
|
test('agent table covers every tool', () => {
|
||||||
|
expect(Object.keys(AGENTS).sort()).toEqual(['claude', 'codex', 'copilot', 'cursor', 'gemini', 'opencode', 'windsurf']);
|
||||||
|
const env = { home: '/h', exists: () => false };
|
||||||
|
expect(AGENTS.windsurf.mcpFile(env)).toBe('~/.config/devin/mcp_config.json');
|
||||||
|
expect(AGENTS.windsurf.mcpFile({ ...env, exists: p => p === '/h/.codeium/windsurf/mcp_config.json' })).toBe('~/.codeium/windsurf/mcp_config.json');
|
||||||
|
});
|
||||||
|
test('install into a project: dry writes nothing, real run is idempotent', async () => {
|
||||||
|
const dir = tmp();
|
||||||
|
const home = tmp();
|
||||||
|
delete process.env.XDG_CONFIG_HOME; // never touch the real user config from a test
|
||||||
|
mkdirSync(join(dir, '.vscode'));
|
||||||
|
writeFileSync(join(dir, '.vscode/mcp.json'), JSON.stringify({ servers: { keep: { type: 'stdio', command: 'k' } } }));
|
||||||
|
await install(parseArgs(['--agent', 'copilot,codex,windsurf', '--dir', dir, '--home', home, '--dry']));
|
||||||
|
expect(existsSync(join(dir, '.github/skills'))).toBe(false);
|
||||||
|
await install(parseArgs(['--agent', 'copilot,codex,windsurf', '--dir', dir, '--home', home]));
|
||||||
|
expect(existsSync(join(dir, '.github/skills/whats-new/SKILL.md'))).toBe(true);
|
||||||
|
expect(existsSync(join(dir, '.agents/skills/review-rejections/SKILL.md'))).toBe(true);
|
||||||
|
const vs = JSON.parse(readFileSync(join(dir, '.vscode/mcp.json'), 'utf8'));
|
||||||
|
expect(Object.keys(vs.servers)).toEqual(['keep', 'storebound']);
|
||||||
|
expect(readFileSync(join(dir, '.codex/config.toml'), 'utf8')).toContain('[mcp_servers.storebound]');
|
||||||
|
expect(JSON.parse(readFileSync(join(home, '.config/devin/mcp_config.json'), 'utf8')).mcpServers.storebound.args).toEqual(['mcp']);
|
||||||
|
const before = readFileSync(join(dir, '.vscode/mcp.json'), 'utf8');
|
||||||
|
await install(parseArgs(['--agent', 'copilot', '--dir', dir, '--home', home]));
|
||||||
|
expect(readFileSync(join(dir, '.vscode/mcp.json'), 'utf8')).toBe(before);
|
||||||
|
});
|
||||||
|
test('mcp command choice', () => {
|
||||||
|
const dir = tmp();
|
||||||
|
expect(mcpCommand(dir).command).toMatch(/bin\/storebound$/);
|
||||||
|
mkdirSync(join(dir, 'node_modules/storebound'), { recursive: true });
|
||||||
|
writeFileSync(join(dir, 'node_modules/storebound/package.json'), '{}');
|
||||||
|
expect(mcpCommand(dir)).toEqual({ command: 'bunx', args: ['storebound', 'mcp'] });
|
||||||
|
expect(mcpCommand(dir, 'npx -y storebound')).toEqual({ command: 'npx', args: ['-y', 'storebound', 'mcp'] });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('config + scrub', () => {
|
||||||
|
test('new config fields', () => {
|
||||||
|
const base = { app: { name: 'X', privacyPolicyUrl: 'https://a.b', supportUrl: 'https://a.b', website: 'https://a.b', contactEmail: 'a@example.com' }, languages: [{ id: 'en' }] };
|
||||||
|
expect(validateConfig({ ...base, apple: { bundleId: 'com.a.b', usesNonExemptEncryption: 'no', screenshotTypes: ['IPHONE'] } }).join('\n'))
|
||||||
|
.toMatch(/usesNonExemptEncryption[\s\S]*screenshotTypes/);
|
||||||
|
expect(validateConfig({ ...base, ads: { appAdsTxt: ['just-a-domain.com'] } })[0]).toContain('ads.appAdsTxt');
|
||||||
|
expect(validateConfig({ ...base, ads: { appAdsTxt: ['net.com, pub-1, DIRECT'] } })).toEqual([]);
|
||||||
|
});
|
||||||
|
test('scrub catches secrets and allows placeholders', () => {
|
||||||
|
const hits = scan([
|
||||||
|
{ path: 'a.md', text: `mail ${'someone'}@${'company'}.io and ok@example.com` },
|
||||||
|
{ path: 'templates/x.json', text: '{"k": "AB12CD34EF"}' },
|
||||||
|
{ path: 'cli/x.ts', text: `const ua = 'Chrome/126.0.0.0'; const host = '${[10, 1, 2, 3].join('.')}';` },
|
||||||
|
{ path: 'k.pem', text: '-----BEGIN PRIVATE ' + 'KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASC' },
|
||||||
|
]);
|
||||||
|
expect(hits.map(h => h.rule).sort()).toEqual(['apple-id-like', 'email', 'ip-address', 'private-key']);
|
||||||
|
});
|
||||||
|
});
|
||||||
17
tools/ci.ts
Normal file
17
tools/ci.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env bun
|
||||||
|
// Everything CI runs, in order; stops at the first failure. bun run ci
|
||||||
|
const steps: [string, string[]][] = [
|
||||||
|
['adapters', ['bun', 'tools/gen-adapters.ts', '--check']],
|
||||||
|
['tests', ['bun', 'test']],
|
||||||
|
['typecheck', ['bunx', 'tsc', '--noEmit']],
|
||||||
|
['scrub', ['bun', 'tools/scrub.ts']],
|
||||||
|
];
|
||||||
|
const root = new URL('..', import.meta.url).pathname;
|
||||||
|
for (const [name, cmd] of steps) {
|
||||||
|
const t = Date.now();
|
||||||
|
console.log(`\n== ${name}: ${cmd.join(' ')}`);
|
||||||
|
const r = Bun.spawnSync(cmd, { cwd: root, stdout: 'inherit', stderr: 'inherit' });
|
||||||
|
if (r.exitCode !== 0) { console.error(`\nci: ${name} failed (exit ${r.exitCode})`); process.exit(1); }
|
||||||
|
console.log(`== ${name} ok (${((Date.now() - t) / 1000).toFixed(1)}s)`);
|
||||||
|
}
|
||||||
|
console.log('\nci: all green');
|
||||||
122
tools/gen-adapters.ts
Normal file
122
tools/gen-adapters.ts
Normal file
|
|
@ -0,0 +1,122 @@
|
||||||
|
#!/usr/bin/env bun
|
||||||
|
// Generates every AI-tool adapter from the single sources: skills/*/SKILL.md, docs/agents-core.md, package.json.
|
||||||
|
// bun tools/gen-adapters.ts write the files
|
||||||
|
// bun tools/gen-adapters.ts --check exit 1 when a committed file is stale (CI)
|
||||||
|
// Outputs are committed so each tool works straight from a git checkout.
|
||||||
|
import { existsSync, readdirSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
||||||
|
import { dirname, join } from 'node:path';
|
||||||
|
|
||||||
|
export interface Skill { name: string; description: string }
|
||||||
|
|
||||||
|
const NAME_RE = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
||||||
|
|
||||||
|
/** Frontmatter of one SKILL.md, checked against the Agent Skills spec subset we use (name + description only). */
|
||||||
|
export function parseSkill(folder: string, text: string): Skill {
|
||||||
|
const m = /^---\n([\s\S]*?)\n---\n/.exec(text);
|
||||||
|
if (!m) throw new Error(`skills/${folder}/SKILL.md: no frontmatter`);
|
||||||
|
const fields: Record<string, string> = {};
|
||||||
|
for (const line of m[1]!.split('\n')) {
|
||||||
|
const kv = /^([A-Za-z-]+):\s*(.*)$/.exec(line);
|
||||||
|
if (!kv) throw new Error(`skills/${folder}/SKILL.md: frontmatter line "${line.slice(0, 40)}" is not "key: value" on one line`);
|
||||||
|
fields[kv[1]!] = kv[2]!.trim();
|
||||||
|
}
|
||||||
|
const extra = Object.keys(fields).filter(k => k !== 'name' && k !== 'description');
|
||||||
|
if (extra.length) throw new Error(`skills/${folder}/SKILL.md: only name + description allowed in frontmatter (found ${extra.join(', ')})`);
|
||||||
|
const { name = '', description = '' } = fields;
|
||||||
|
if (!NAME_RE.test(name) || name.length > 64) throw new Error(`skills/${folder}/SKILL.md: name "${name}" must be lowercase-hyphen, max 64`);
|
||||||
|
if (name !== folder) throw new Error(`skills/${folder}/SKILL.md: name "${name}" must equal the folder name`);
|
||||||
|
if (!description || description.length > 1024) throw new Error(`skills/${folder}/SKILL.md: description must be 1-1024 characters`);
|
||||||
|
return { name, description };
|
||||||
|
}
|
||||||
|
|
||||||
|
export function readSkills(root: string): Skill[] {
|
||||||
|
const dir = join(root, 'skills');
|
||||||
|
return readdirSync(dir).filter(n => existsSync(join(dir, n, 'SKILL.md'))).sort()
|
||||||
|
.map(n => parseSkill(n, readFileSync(join(dir, n, 'SKILL.md'), 'utf8')));
|
||||||
|
}
|
||||||
|
|
||||||
|
const json = (o: unknown) => JSON.stringify(o, null, 2) + '\n';
|
||||||
|
/** First sentence-ish part of a skill description for compact indexes. */
|
||||||
|
const short = (d: string) => d.split(' - ')[0]!.split('. Use when')[0]!.replace(/\.$/, '');
|
||||||
|
|
||||||
|
/** Every generated file: path -> content. Pure apart from reading the sources. */
|
||||||
|
export function generate(root: string): Map<string, string> {
|
||||||
|
const pkg = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')) as { version: string; description: string; license: string; keywords: string[] };
|
||||||
|
const core = readFileSync(join(root, 'docs', 'agents-core.md'), 'utf8').trim();
|
||||||
|
const coreBody = core.replace(/^# .*\n+/, '');
|
||||||
|
const skills = readSkills(root);
|
||||||
|
const out = new Map<string, string>();
|
||||||
|
const homepage = 'https://git.crt.fyi/CRT/storebound';
|
||||||
|
const repository = 'https://git.crt.fyi/CRT/storebound.git';
|
||||||
|
const description = 'Ship mobile games to Google Play and the App Store: store listings, in-app products, data safety, screenshots, icons, release management and review checklists, as Agent Skills plus a Bun CLI and MCP server (storebound). CRTkafa\'s own toolchain, open-sourced.';
|
||||||
|
const keywords = ['google-play', 'app-store', 'app-store-connect', 'mobile-games', 'iap', 'screenshots', 'app-icons', 'release', 'aso', 'mcp'];
|
||||||
|
|
||||||
|
// 1. Claude Code plugin + its MCP server + marketplace
|
||||||
|
out.set('.claude-plugin/plugin.json', json({ name: 'storebound', version: pkg.version, description, author: { name: 'CRTkafa' }, homepage, repository, license: pkg.license, keywords }));
|
||||||
|
out.set('.mcp.json', json({ mcpServers: { storebound: { command: '${CLAUDE_PLUGIN_ROOT}/bin/storebound', args: ['mcp'] } } }));
|
||||||
|
out.set('.claude-plugin/marketplace.json', json({ name: 'crtkafa', description: 'CRTkafa\'s open-sourced tools.', owner: { name: 'CRTkafa' },
|
||||||
|
plugins: [{ name: 'storebound', source: '.', description: 'Ship mobile games to Google Play and the App Store: skills for every store step plus the storebound CLI and MCP server.',
|
||||||
|
version: pkg.version, category: 'development', tags: ['mobile', 'google-play', 'app-store', 'release'] }] }));
|
||||||
|
|
||||||
|
// 2. OpenAI Codex plugin (skills; MCP via `storebound install --agent codex`)
|
||||||
|
out.set('.codex-plugin/plugin.json', json({ name: 'storebound', version: pkg.version, description, author: { name: 'CRTkafa' }, homepage, repository, license: pkg.license, keywords, skills: './skills/' }));
|
||||||
|
|
||||||
|
// 3. Gemini CLI extension
|
||||||
|
out.set('gemini-extension.json', json({ name: 'storebound', version: pkg.version, description, contextFileName: 'GEMINI.md',
|
||||||
|
mcpServers: { storebound: { command: '${extensionPath}${/}bin${/}storebound', args: ['mcp'] } } }));
|
||||||
|
|
||||||
|
const index = skills.map(s => `| \`${s.name}\` | ${short(s.description)} |`).join('\n');
|
||||||
|
const indexPaths = skills.map(s => `- \`skills/${s.name}/SKILL.md\`: ${short(s.description)}`).join('\n');
|
||||||
|
const generated = '<!-- generated by tools/gen-adapters.ts from docs/agents-core.md and skills/*/SKILL.md; do not edit -->';
|
||||||
|
const cli = [
|
||||||
|
'## Tools',
|
||||||
|
'',
|
||||||
|
'- CLI: `storebound <command>` (`storebound help`); config `storebound.config.ts`, credentials in env or `.storebound/`.',
|
||||||
|
'- MCP: `storebound mcp` (stdio). Write tools default to `dry_run: true`; submit / release / cancel / delete are not exposed.',
|
||||||
|
'- Readiness: `storebound check` (offline), `storebound validate` (read-only, both stores).',
|
||||||
|
].join('\n');
|
||||||
|
|
||||||
|
// 4. AGENTS.md (Codex, Cursor, Copilot, Windsurf, OpenCode, ...)
|
||||||
|
out.set('AGENTS.md', [generated, '', '# storebound', '',
|
||||||
|
'Toolchain for shipping mobile games to Google Play and the App Store. Before a store task, open the matching skill',
|
||||||
|
'file below and follow it step by step.', '', coreBody.replace(/^/, ''), '', cli, '', '## Skills', '', indexPaths, '',
|
||||||
|
'## Working on storebound itself', '',
|
||||||
|
'- Bun + TypeScript strict, zero runtime dependencies. `bun run ci` must pass (adapters fresh, tests, typecheck, scrub).',
|
||||||
|
'- Skills are the single source: edit `skills/*/SKILL.md` or `docs/agents-core.md`, then `bun tools/gen-adapters.ts`.',
|
||||||
|
'- Never commit credentials, account / team / issuer / key / app ids or personal data; placeholders use example.com.',
|
||||||
|
''].join('\n'));
|
||||||
|
|
||||||
|
// 5. GitHub Copilot repository instructions
|
||||||
|
out.set('.github/copilot-instructions.md', [generated, '', '# storebound for GitHub Copilot', '',
|
||||||
|
'Mobile game store releases (Google Play, App Store). Skills live in `skills/<name>/SKILL.md` (Agent Skills format;',
|
||||||
|
'`storebound install --agent copilot` copies them to `.github/skills/` of a game project).', '', coreBody, '', cli, '', '## Skills', '',
|
||||||
|
'| skill | for |', '|---|---|', index, ''].join('\n'));
|
||||||
|
|
||||||
|
// 6. Cursor project rule (agent-requested)
|
||||||
|
out.set('.cursor/rules/storebound.mdc', ['---',
|
||||||
|
'description: Shipping a mobile game to Google Play or the App Store with storebound (listings, IAPs, screenshots, releases, review, compliance)',
|
||||||
|
'alwaysApply: false', '---', '', generated, '', coreBody, '', cli, '', '## Skills', '', indexPaths, ''].join('\n'));
|
||||||
|
|
||||||
|
// 7. Gemini context file
|
||||||
|
out.set('GEMINI.md', [generated, '', '# storebound', '',
|
||||||
|
'This extension ships Agent Skills (skills/) and the storebound MCP server for mobile game store releases.', '',
|
||||||
|
coreBody, '', cli, '', '## Skills', '', '| skill | for |', '|---|---|', index, ''].join('\n'));
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (import.meta.main) {
|
||||||
|
const root = join(import.meta.dir, '..');
|
||||||
|
const check = process.argv.includes('--check');
|
||||||
|
const stale: string[] = [];
|
||||||
|
for (const [rel, text] of generate(root)) {
|
||||||
|
const p = join(root, rel);
|
||||||
|
const cur = existsSync(p) ? readFileSync(p, 'utf8') : null;
|
||||||
|
if (cur === text) continue;
|
||||||
|
if (check) { stale.push(rel); continue; }
|
||||||
|
mkdirSync(dirname(p), { recursive: true });
|
||||||
|
writeFileSync(p, text);
|
||||||
|
console.log(`wrote ${rel}`);
|
||||||
|
}
|
||||||
|
if (check && stale.length) { console.error(`stale adapters (run bun tools/gen-adapters.ts): ${stale.join(', ')}`); process.exit(1); }
|
||||||
|
if (check) console.log('adapters up to date');
|
||||||
|
}
|
||||||
56
tools/scrub.ts
Normal file
56
tools/scrub.ts
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
#!/usr/bin/env bun
|
||||||
|
// Secrets / personal data scrub over every tracked (and staged-new) text file. Fails on any hit.
|
||||||
|
// bun tools/scrub.ts
|
||||||
|
// Patterns are built from parts so this file does not match itself.
|
||||||
|
import { readFileSync } from 'node:fs';
|
||||||
|
import { join } from 'node:path';
|
||||||
|
|
||||||
|
export interface Rule { id: string; re: RegExp; files?: RegExp; allow?: (m: string, line: string) => boolean; wholeFile?: boolean }
|
||||||
|
|
||||||
|
const at = '@';
|
||||||
|
export const RULES: Rule[] = [
|
||||||
|
{ id: 'email', re: new RegExp(`[A-Za-z0-9._%+-]+${at}[A-Za-z0-9.-]+\\.[A-Za-z]{2,}`, 'g'),
|
||||||
|
allow: m => /@example\.(com|org|net)$/i.test(m) || /@users\.noreply\./.test(m) },
|
||||||
|
{ id: 'private-key', re: new RegExp('-----BEGIN [A-Z ]*PRIVATE ' + 'KEY-----\\s*[A-Za-z0-9+/=]{20,}', 'g'), wholeFile: true },
|
||||||
|
{ id: 'private_key-json', re: new RegExp('"private' + '_key"\\s*:\\s*"-----BEGIN', 'g') },
|
||||||
|
{ id: 'asc-key-file', re: new RegExp('AuthKey' + '_[A-Z0-9]{10}\\.p8', 'g') },
|
||||||
|
{ id: 'apple-id-like', re: /\b(?=[A-Z0-9]{10}\b)(?=[A-Z0-9]*\d)(?=[A-Z0-9]*[A-Z])[A-Z0-9]{10}\b/g,
|
||||||
|
files: /^(templates\/|.*\.config\.(ts|js|json)$|.*\.json$|.*\.toml$|.*\.plist$)/ },
|
||||||
|
{ id: 'issuer-uuid', re: /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/g,
|
||||||
|
allow: m => /^0{8}-0{4}-0{4}-0{4}-0{12}$/.test(m) },
|
||||||
|
{ id: 'ip-address', re: /(?<![\w.\-]|[A-Za-z]\/)(?:\d{1,3}\.){3}\d{1,3}(?![\w.\-])/g, allow: m => ['127.0.0.1', '0.0.0.0'].includes(m) },
|
||||||
|
{ id: 'private-name', re: new RegExp(['Yon', 'ga'].join(''), 'gi') },
|
||||||
|
{ id: 'google-api-key', re: new RegExp('AI' + 'za[0-9A-Za-z_-]{35}', 'g') },
|
||||||
|
];
|
||||||
|
|
||||||
|
const SKIP = /(^|\/)(bun\.lock|LICENSE)$|\.(png|jpe?g|webp|gif|ico|woff2?|ttf|otf|p8|p12|aab|ipa|zip)$/i;
|
||||||
|
|
||||||
|
export function scan(files: { path: string; text: string }[]): { file: string; line: number; rule: string; match: string }[] {
|
||||||
|
const hits: { file: string; line: number; rule: string; match: string }[] = [];
|
||||||
|
for (const f of files) {
|
||||||
|
if (SKIP.test(f.path)) continue;
|
||||||
|
const lines = f.text.split('\n');
|
||||||
|
for (const r of RULES) {
|
||||||
|
if (r.files && !r.files.test(f.path)) continue;
|
||||||
|
if (r.wholeFile) {
|
||||||
|
for (const m of f.text.matchAll(r.re)) hits.push({ file: f.path, line: f.text.slice(0, m.index).split('\n').length, rule: r.id, match: m[0] });
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
lines.forEach((line, i) => {
|
||||||
|
for (const m of line.matchAll(r.re)) if (!r.allow?.(m[0], line)) hits.push({ file: f.path, line: i + 1, rule: r.id, match: m[0] });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hits;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (import.meta.main) {
|
||||||
|
const root = join(import.meta.dir, '..');
|
||||||
|
const ls = Bun.spawnSync(['git', 'ls-files', '--cached', '--others', '--exclude-standard'], { cwd: root });
|
||||||
|
const paths = ls.stdout.toString().split('\n').filter(Boolean);
|
||||||
|
const files = paths.flatMap(p => { try { return [{ path: p, text: readFileSync(join(root, p), 'utf8') }]; } catch { return []; } });
|
||||||
|
const hits = scan(files);
|
||||||
|
for (const h of hits) console.error(`${h.file}:${h.line} ${h.rule} ${h.match.slice(0, 60)}`);
|
||||||
|
console.log(`scrub: ${files.length} files, ${hits.length} hits`);
|
||||||
|
if (hits.length) process.exit(1);
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue