Scaffold explicit query placement and authored GraphQL documents

This commit is contained in:
Timothy J. Aveni
2026-09-21 01:30:57 -07:00
parent 20ef63007c
commit 01a3ec5ae2
4 changed files with 157 additions and 5 deletions
+4 -1
View File
@@ -12,6 +12,7 @@ import type { StructuralRequest } from "./structural-plan.js";
import { addImplementation } from "./implementation-edit.js";
import { reactPlatformTypes } from "../bindings/react-platform.js";
import { executionScaffold, isExecutionScaffold } from "./execution-scaffold.js";
import { scaffoldQuery } from "./query-scaffold.js";
type Source = { repository: string; commit: string };
type PackageEditModel = {
@@ -29,6 +30,7 @@ export type ScaffoldRecipe = {
id?: string;
revision?: string;
declaration?: string;
queryDocument?: string;
/** Initial authored files for a composed recipe; only used for a new package. */
initialFiles?: Record<string, string>;
tools?: { quixos: Source; protocol: Source; helpers: Source; sdk: Source };
@@ -71,7 +73,7 @@ const ownedJson = async <T>(root: string, file: string): Promise<T> => {
* Implementation files are created once; later edits preserve authored wiring. */
export const scaffoldRecipe = async (
root: string,
command: "package" | "function" | "migration" | "refresh",
command: "package" | "function" | "migration" | "refresh" | "query",
spec: ScaffoldRecipe,
): Promise<StructuralRequest> => {
if (command === "refresh")
@@ -82,6 +84,7 @@ export const scaffoldRecipe = async (
if (spec.directory && !/^[A-Za-z0-9_-][A-Za-z0-9_.-]*(?:\/[A-Za-z0-9_-][A-Za-z0-9_.-]*)*$/.test(spec.directory))
throw new Error("Scaffold directory must be contained");
const prefix = spec.directory ? `${spec.directory}/` : "";
if (command === "query") return scaffoldQuery(root, prefix, spec);
if (
spec.template === "typescript-execution" ||
(command !== "package" && (await isExecutionScaffold(root, prefix)))