Sasha MCP reference

Editing the source of a Sasha App

This is the apps-authoring section of the usage guide. Call getDocs with { "section": "apps-authoring" } to read it on an instance.

Available only when listAppFiles, readAppFile, writeAppFile, editAppFile, deleteAppFile and checkApp are in your tool list: the apps:write scope, an admin or staff user, and manage access on the app. They edit the LIVE package under the apps root. There is no draft, no preview and no undo. A change is live the moment the package validates.

The loop:

  1. listAppFiles to see the package and its status; readAppFile the files you will change (APP.md first: it declares tables, actions and the entry file).
  2. editAppFile for a passage, writeAppFile to create or replace a whole file, deleteAppFile to remove one. Every mutation takes the version you last read as expectedVersion (omit it only to CREATE). A stale version is refused.
  3. Read the returned status. When status.ok is false the app is not usable until every diagnostic is fixed: each names the package file, the line when known, the error code and a reason token (for example APP.md:4 APP_MANIFEST_INVALID unknown_field:bogus). Fix the file, then checkApp. When status.ok is true the app is live at status.revision.

Schema changes: never edit a migration that this instance has already applied. The diagnostics say migration_already_applied_here. Add a new migrations/NNN-*.sql and change schema.sql so replaying all migrations matches it exactly. Allowed files: .md .html .css .js .sql .yaml .yml .json .txt .svg, 1 MiB each, 64 files per package. Once a bundled app is edited here it is yours: the next upgrade preserves it and no longer refreshes it.

Before changing an app, read the app-builder skill in the knowledge base for the package contract (APP.md fields, the window.Sasha façade, App Actions).

Built with BernardCookie settings