write_project_files
Write a project's source tree and nerdit.toml in one all-or-nothing batch, creating or editing the workspace, so you can declare services and then apply the project.
Instructions
Write a project's source tree (its nerdit.toml included), then apply_project.
Exactly ``write_app_files`` on the workspace named after the project:
same all-or-nothing batch, same text-only rule, same caps, and
``list_app_files`` / ``read_app_file`` read it back under the project
name. One tree holds EVERY service; a service built from a subfolder
says so with ``build_settings.subdir``. The root ``nerdit.toml`` is the
declaration::
[project]
name = "asso"
[services.web]
port = 3000
[services.api]
port = 8000
build_settings = { subdir = "apps/api" }
[vars]
required = ["API_KEY"]
``[services.<name>]`` takes the ``[deploy]`` keys except ``name``: the
service ``web`` is served under the project name (``asso``), any other
under ``<service>--<project>`` (``api--asso``), and that label is the
name every other tool takes. ``[ai.*]`` / ``[db.*]`` bindings stay
top-level tables shared by every service; a declaration cannot create
a database (``create_database`` first, then bind it). WARNING: file
contents you pass here transit this agent's transcript in plaintext;
never write secrets into project files.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | Workspace-relative path -> that file's full UTF-8 text; a write replaces the file whole. Paths are relative with no ``..``; ``.git``, ``node_modules``, ``__pycache__``, ``.venv``, ``data/`` and ``*.pyc`` are refused, and ``.env`` / ``.env.*`` by name. Text only (NUL or non-UTF-8 is refused). Caps: 256 KiB per file, 10 MiB and 500 files per workspace. | |
| delete | No | Workspace-relative paths to remove, applied with the writes in the same all-or-nothing batch. Omit (null) to delete nothing; a path that does not exist is a no-op; a path may not be in both ``files`` and ``delete``. | |
| project | Yes | Project name: the ONE source tree of the project, a workspace of the same name. A new name creates the workspace; an existing one is edited in place. It must equal ``[project].name`` in the tree's ``nerdit.toml``. | |
| idempotency_key | No | Caller-chosen key: a retry with the same key replays the first result instead of acting twice. Omit and a fresh key is minted per call, so each call acts. |