Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions skills/create-app/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The platform gains module types, manifest fields, SDK methods and scopes over ti
| [building-app/user-interface.md](https://crowdin.github.io/serverless-apps/building-app/user-interface.md) | The UI kit |
| [building-app/i18n.md](https://crowdin.github.io/serverless-apps/building-app/i18n.md) | Localization |
| [development/troubleshooting.md](https://crowdin.github.io/serverless-apps/development/troubleshooting.md) | Known failures |
| [understanding-scopes](https://support.crowdin.com/developer/understanding-scopes/) | The scope catalogue |
| [understanding-scopes](https://support.crowdin.com/developer/understanding-scopes/) | What each scope grants |
| [llms-full.txt](https://crowdin.github.io/serverless-apps/llms-full.txt) | Everything, one fetch |

The division of labour: **the docs are authoritative on what exists, this skill on what order to do it in and what breaks.** When a list here disagrees with the docs, the docs win and the list here is stale - reach for a capability the docs describe even if it is absent from these pages. When something works but breaks in a way the docs do not mention, that is what this skill is for.
Expand Down Expand Up @@ -66,7 +66,7 @@ If they send nothing, the CLI's own state file holds the edition after login: `~

## Ask sparingly, and only in their words

**Derive, do not ask:** who the user is, what data the app touches, the `scopes` ([scopes.md](references/scopes.md)), the edition and project (from their link), editor `modes` (declare **every mode the docs list** by default, so the panel is there wherever the user happens to be working - narrow it only if they ask, because a module is simply absent from any mode its manifest omits and the user has no way to know why), and a sensible app name. The template is fixed: always `projects-dashboard-cli`.
**Derive, do not ask:** who the user is, what data the app touches, the `scopes` (an output of the green gate, not an input to the brief - [scopes.md](references/scopes.md)), the edition and project (from their link), editor `modes` (declare **every mode the docs list** by default, so the panel is there wherever the user happens to be working - narrow it only if they ask, because a module is simply absent from any mode its manifest omits and the user has no way to know why), and a sensible app name. The template is fixed: always `projects-dashboard-cli`.

**State, do not ask:** put everything you derived into a short brief and let them correct it. Write it in the language they wrote to you in, and in plain words - "a panel on the right in the editor, next to the string", never "editor-right-panel, modes translate/review". A list of claims is easier to object to than a list of questions.

Expand Down Expand Up @@ -177,7 +177,9 @@ pnpm typecheck && pnpm lint
npx crowdin-serverless-apps manifest validate
```

Do not hand code over while any of the three is red. `typecheck` catches invented SDK APIs; neither it nor `lint` reads `manifest.json`, which is what `manifest validate` is for. Validation is offline - no login, no app link, not even `node_modules` - so run it the moment the manifest changes. It exits 1 on an invalid manifest or malformed JSON, groups problems by section and prints a `fix` line under each; read that hint, it spells out the accepted values.
Do not hand code over while any of the three is red. `typecheck` catches invented SDK APIs; neither it nor `lint` reads `manifest.json`, which is what `manifest validate` is for. It checks the file against the schema, and it checks `scopes` against the code: every call the app makes through the API client is matched to the scope that method needs, `createStorage()` to `application.storage`, and the result compared with the manifest. A call the manifest does not cover is a problem with the exact string to add; a declared scope no call uses is a note. Validation is offline - no login, no app link - but the scope half reads the packages in `node_modules`, so run it after `pnpm install` and again whenever the manifest or the API calls change. It exits 1 on a problem, groups problems by section and prints a `fix` line under each; read that hint, it spells out the accepted values, scope strings included.

A green run that carries a `scope check skipped` note has not looked at the scopes. Do what the note says - `pnpm install`, or `pnpm update @crowdin/serverless-apps-cli @crowdin/crowdin-api-client` in an app that predates the check - and run it again ([scopes.md](references/scopes.md)).

Passing does not mean Crowdin will accept the manifest, only that the cheap mistakes are gone.

Expand Down Expand Up @@ -248,8 +250,9 @@ Never ask for a token in chat. On a machine with no browser at all, `CROWDIN_PER
| Blank iframe, or the host reports the app did not start | Manifest type, `prepare*` and `context.app.type` disagree, or a registration is not at the top level, or two modules of one type without keys. |
| App published but absent from the UI slot | `manifest push` skipped, or a string-based project without `stringBasedAvailable`. |
| App opens but shows nothing | Empty data, or the first-project fallback landed somewhere with no glossary/TM/strings. Check before blaming the code. |
| 403 or an empty list at runtime, all checks green | A scope. See [scopes.md](references/scopes.md), including the read-looking calls that need the bare scope. |
| Every storage call rejected | `application.storage` missing from the manifest `scopes`, or the manifest change not pushed. |
| 403 `Endpoint isn't allowed for token scopes.` at runtime | A manifest scope. Run `manifest validate`: it names the call and the string to add. If validate is green, run `manifest status` - the scope is on disk but not pushed. If it printed `scope check skipped`, do what the note says first; a green run with that note has not looked at the scopes ([scopes.md](references/scopes.md)). |
| Any other 403, or an empty list, all checks green | The viewer's own rights, not the manifest: calls run as whoever opened the app, and no check can see that. Build for what that person may do, or narrow the audience. |
| Every storage call rejected | `application.storage` missing from the manifest `scopes` - `manifest validate` names the `createStorage()` call that needs it - or, if validate is green, the manifest change not pushed. |
| `kv.user.*` throws while shared keys work | The viewer is anonymous - no user identity. Check `user.id` in the context before offering per-user features. |
| A write under `module:...:` rejected | The key names a module other than the one the app is currently running as, or an unknown one. On reads the same situation is silent: `get` resolves `undefined`, listings skip the records. |
| `You have no accessible projects to preview this module in.` | Either no project access, or a crowdsource module needing a public project. |
Expand All @@ -263,5 +266,5 @@ Never ask for a token in chat. On a machine with no browser at all, `CROWDIN_PER

- [references/modules.md](references/modules.md) - every module type: placement, `prepare*`, manifest fields, edition lock, what `preview` can open
- [references/sdk.md](references/sdk.md) - verified SDK snippets and the traps types do not catch
- [references/scopes.md](references/scopes.md) - the scope catalogue and the read-needs-write cases
- [references/scopes.md](references/scopes.md) - how `manifest validate` derives the scopes from the code, and what it cannot see
- [references/cli.md](references/cli.md) - command and flag reference, env vars, what each command writes
28 changes: 26 additions & 2 deletions skills/create-app/evals/evals.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@
"name": "who-did-how-much",
"group": "scopes",
"prompt": "An app that shows which translator did how many strings this month, per language.",
"tests": "report and member scopes; a wrong scope only fails at runtime inside the iframe",
"pass": "Scopes taken from the catalogue rather than invented, and the app verified as rendering real data - not declared done on green typecheck and a printed URL."
"tests": "report and member scopes; the manifest follows manifest validate, not memory",
"pass": "Scopes come from manifest validate - the strings it names are added, nothing more, and no scope check skipped note is left standing - and the app is verified as rendering real data, not declared done on green typecheck and a printed URL."
},
{
"id": 28,
Expand Down Expand Up @@ -318,6 +318,30 @@
"prompt": "Our three admins push finished translations to our in-house CMS. Make us an admins-only page with a \"Send to CMS\" button - the CMS API token is one for the whole team, and I don't want us pasting it in every time.",
"tests": "a team credential - a module-scoped secret on a restricted module",
"pass": "The token is entered once on the admins-only page and stored under that module's module: prefix with secret: true, so the platform serves it only on that module's surface and encrypts it at rest. Says plainly that all admins who can open the page can read the token - acceptable here because it is theirs to hold. A plain shared key fails (the whole app audience could read it), per-user records fail (each admin would paste it separately), and the token is never accepted in chat or baked into the bundle."
},
{
"id": 38,
"name": "write-scope-for-a-search",
"group": "scopes",
"prompt": "Add a search box to my panel so I can look up a word in the project glossary while I translate.",
"tests": "a feature that only reads may need a write scope: implemented with the project-level concordance search, manifest validate asks for glossary:write",
"pass": "Adds exactly the string the validator names, whichever form it is, without arguing that a search is read-only and without reaching for *. Pushes the manifest before publishing, and the search works for a translator."
},
{
"id": 39,
"name": "feature-removed-scope-left-behind",
"group": "scopes",
"prompt": "Take the \"approve all\" button out again, we decided against it.",
"tests": "removing calls leaves a declared scope behind; the validator notes it as unused",
"pass": "Removes the now-unused scope the validator notes along with the code, pushes the manifest before publishing, and says in one plain sentence that the app now asks for less than before."
},
{
"id": 40,
"name": "older-app-skipped-check",
"group": "scopes",
"prompt": "Here's the app you built me in the spring - can you add a tab with the project's glossary terms?",
"tests": "an existing app pinned to an older api-client or CLI; manifest validate prints scope check skipped, or nothing about scopes at all",
"pass": "Reads the note rather than the green tick: updates the CLI and api-client together (pnpm update @crowdin/serverless-apps-cli @crowdin/crowdin-api-client) so the installed toolchain carries the check, validates again, and only then trusts the scopes. Never reports the scopes as verified on a run that skipped them."
}
]
}
4 changes: 2 additions & 2 deletions skills/create-app/references/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ What you do have to handle: commands that need an answer will still wait for one
| `list` | `--print`, `--json`. Lists your apps. Doubles as a read-only auth probe. |
| `link` | `--app-id <id>`. Links the working directory to an app that already exists. |
| `manifest status` | Diffs local `manifest.json` against Crowdin. **Exit code 1 means they differ**, which makes it a check you can act on. |
| `manifest validate` | Checks `manifest.json` against the manifest schema, plus forbidden root keys, unknown module types and duplicate keys. Offline: no login, no app link, no `node_modules`. **Exit code 1** when invalid or not valid JSON. Run it after every manifest edit, before `push`. |
| `manifest validate` | Checks `manifest.json` against the manifest schema, plus forbidden root keys, unknown module types and duplicate keys - and checks `scopes` against the API calls in `src/`, read through the TypeScript compiler and the `@requiredScope` tag of each method in the app's installed `@crowdin/crowdin-api-client`. Offline: no login, no app link; the scope check needs `node_modules` and is skipped with a note without them. **Exit code 1** when invalid, not valid JSON, or a call lacks its scope. Run it after every manifest edit and after writing API calls, before `push`. |
| `manifest push` | Applies the local manifest to Crowdin. |
| `manifest pull` | Overwrites the local manifest from Crowdin. |
| `login` | `--file-storage`, `--port <n>` (one of 26140-26144). OAuth in the browser; stores the token. |
Expand Down Expand Up @@ -89,4 +89,4 @@ pnpm format
pnpm typecheck # tsc --noEmit
```

There are no tests in the scaffold, so `typecheck` plus `lint` is the whole automated safety net. Both must be green before the app goes to the user.
There are no tests in the scaffold, so `typecheck`, `lint` and `manifest validate` are the whole automated safety net. All three must be green before the app goes to the user.
2 changes: 1 addition & 1 deletion skills/create-app/references/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ If no registration matches what the host sent, the SDK deliberately does not cal

`name`, `description`, `logo`, `bundle` (managed by the CLI), `scopes`, `stringBasedAvailable`, and `default_permissions`.

`scopes` are the Crowdin REST scopes the host will allow, evaluated against the session of the user who opened the app; calls outside them are rejected. Narrow with `:read` or `:write` postfixes, and note `:write` does not imply read. Keep the list to what the app's calls actually need - a reviewer sees this list, and so does every admin who installs the app. The scaffold ships a realistic example:
`scopes` are the Crowdin REST scopes the host will allow, evaluated against the session of the user who opened the app; calls outside them are rejected. `manifest validate` derives the list from the app's calls and names what is missing or unused - see [scopes.md](scopes.md). The scaffold ships a realistic example:

```json
"scopes": ["project.settings:read", "project.status.progress:read", "group:read"]
Expand Down
Loading
Loading