editor/reference/context.md
konstantin-paulus b9f3aafd96 Update dapi context command documentation and implementation
- Revised the `dapi context` command description in `README.md`, `index.ts`, and `projects.ts` to clarify its purpose in reporting the current project and playhead position.
- Enhanced the `handleContextGet` function to return detailed project information, including project ID, name, directory, and frame rate.
- Updated the API response structure in `context.ts` to reflect the new project context format, ensuring accurate data representation for users.
- Improved documentation in `context.md` and `README.md` to provide clearer guidance on the command's functionality and expected output.
2026-08-24 09:48:15 +02:00

1.1 KiB

dapi context

Summary of app state. Alias: ctx.

Input

None.

Output

One JSON object:

{
  project: {
    id:         string;   // package.json `projectId`, stable across renames
    name:       string;   // package.json `displayName`, what the user calls it
    dir:        string;   // absolute project folder — where the JSX being edited lives
  };
  currentTime:  number | null;   // playhead in the active scene, in seconds; null if no scene is active
  fontFamilies: string[];        // families registered in the running world, valid as `fontFamily`
}

currentTime is local to the active scene, the same origin a clip's start and end are placed against, and in the same unit.

project.dir is the folder the app is editing, which is not necessarily the one a command was run from: check it before writing to source files.

fontFamilies is what text can be drawn with right now — loaded into the world, not merely named in the source — and always includes the editor default. For every family installed on the machine, see dapi fonts.