feat: initial commit - Jhonny Editor
- Adicionado estrutura completa do projeto - Configurado MCP server para Premiere Pro - Adicionado documentação e skills - Configurado Gitignore para o projeto
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
import { createHash } from "node:crypto";
|
||||
import { readFile, writeFile } from "node:fs/promises";
|
||||
import { dirname, relative, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import ts from "typescript";
|
||||
|
||||
const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const stablePath = process.env.PREMIERE_BETA_RECTF_STABLE_DECLARATIONS_PATH ? resolve(process.env.PREMIERE_BETA_RECTF_STABLE_DECLARATIONS_PATH) : resolve(root, "node_modules/@adobe/premierepro/src/premierepro.d.ts");
|
||||
const betaPath = process.env.PREMIERE_BETA_RECTF_BETA_DECLARATIONS_PATH ? resolve(process.env.PREMIERE_BETA_RECTF_BETA_DECLARATIONS_PATH) : resolve(root, "node_modules/@adobe/premierepro-beta/src/premierepro.d.ts");
|
||||
const outputPath = resolve(root, "src/resources/adobe-beta-rectf-drift.json");
|
||||
const normalize = (text) => text.replaceAll("\r\n", "\n").replace(/\s+/g, " ").trim();
|
||||
const compare = (left, right) => left < right ? -1 : left > right ? 1 : 0;
|
||||
const parse = (text, path) => { const source = ts.createSourceFile(path, text, ts.ScriptTarget.Latest, true); if (source.parseDiagnostics.length) throw new Error(`Adobe RectF declaration parse failed: ${source.parseDiagnostics.map((item) => ts.flattenDiagnosticMessageText(item.messageText, " ")).join("; ")}`); return source; };
|
||||
const literal = (source, name) => { const declaration = source.statements.find((item) => ts.isTypeAliasDeclaration(item) && item.name.text === name); if (!declaration || !ts.isTypeLiteralNode(declaration.type)) throw new Error(`Adobe declarations must expose ${name} as a type literal.`); return declaration; };
|
||||
const binding = (rootDeclaration, source) => { const member = rootDeclaration.type.members.find((item) => ts.isPropertySignature(item) && item.name && ts.isIdentifier(item.name) && item.name.text === "RectF"); if (!member?.type) throw new Error("Adobe declarations must expose premierepro.RectF as a typed property."); return { symbol: "premierepro.RectF", kind: "property", signature: normalize(member.type.getText(source)) }; };
|
||||
const factories = (declaration, source, owner) => declaration.type.members.filter((item) => ts.isConstructSignatureDeclaration(item) || ts.isCallSignatureDeclaration(item)).map((item) => ({ symbol: `${owner}.${ts.isConstructSignatureDeclaration(item) ? "new" : "call"}`, kind: ts.isConstructSignatureDeclaration(item) ? "construct_signature" : "call_signature", signature: `() => ${normalize(item.type.getText(source))}` })).sort((a, b) => compare(a.symbol, b.symbol));
|
||||
const fields = (declaration, source) => declaration.type.members.filter((item) => ts.isPropertySignature(item)).map((item) => normalize(item.getText(source))).sort(compare);
|
||||
const [stablePackageText, betaPackageText, stableText, betaText] = await Promise.all([readFile(resolve(root, "node_modules/@adobe/premierepro/package.json"), "utf8"), readFile(resolve(root, "node_modules/@adobe/premierepro-beta/package.json"), "utf8"), readFile(stablePath, "utf8"), readFile(betaPath, "utf8")]);
|
||||
const stable = parse(stableText, stablePath), beta = parse(betaText, betaPath), stableRoot = literal(stable, "premierepro"), betaRoot = literal(beta, "premierepro"), stableRect = literal(stable, "RectF"), betaRect = literal(beta, "RectF"), betaStatic = literal(beta, "RectFStatic"), stableBinding = binding(stableRoot, stable), betaBinding = binding(betaRoot, beta), stableFactories = factories(stableRect, stable, "RectF"), betaFactories = factories(betaStatic, beta, "RectFStatic");
|
||||
if (stable.statements.some((item) => ts.isTypeAliasDeclaration(item) && item.name.text === "RectFStatic")) throw new Error("Pinned stable declarations unexpectedly expose RectFStatic.");
|
||||
if (stableBinding.signature !== "RectF" || betaBinding.signature !== "RectFStatic") throw new Error("Adobe beta declarations must move premierepro.RectF to RectFStatic.");
|
||||
if (JSON.stringify(stableFactories.map(({ kind, signature }) => ({ kind, signature }))) !== JSON.stringify(betaFactories.map(({ kind, signature }) => ({ kind, signature }))) || stableFactories.length !== 2) throw new Error("Adobe beta RectFStatic factory signatures must match stable RectF.");
|
||||
if (JSON.stringify(fields(stableRect, stable)) !== JSON.stringify(fields(betaRect, beta)) || JSON.stringify(fields(betaRect, beta)) !== JSON.stringify(["height: number;", "width: number;"])) throw new Error("Adobe beta RectF fields must retain width and height.");
|
||||
if (factories(betaRect, beta, "RectF").length) throw new Error("Adobe beta RectF must not retain factory signatures after the static-type migration.");
|
||||
const hash = (declaration, source) => createHash("sha256").update(normalize(declaration.getText(source))).digest("hex");
|
||||
const inventory = { schemaVersion: 1, scope: { declarations: ["premierepro.RectF", "RectF", "RectFStatic"], semantics: "This records the beta RectF factory-type migration against the pinned stable package. It is static declaration-drift accounting, not beta API support or a complete package diff.", doesNotEstablish: "It does not prove a beta host exposes RectFStatic, that a RectF can be constructed or used by another API, or that any MCP action is supported or licensed-host validated." }, sources: { stable: { package: "@adobe/premierepro", version: JSON.parse(stablePackageText).version, declarations: relative(root, stablePath).replaceAll("\\", "/"), rectDeclarationSha256: hash(stableRect, stable), staticFactoryPresent: false }, beta: { package: "@adobe/premierepro-beta", version: JSON.parse(betaPackageText).version, declarations: relative(root, betaPath).replaceAll("\\", "/"), rectDeclarationSha256: hash(betaRect, beta), staticDeclarationSha256: hash(betaStatic, beta), staticFactoryPresent: true } }, diff: { betaOnly: [{ symbol: "RectFStatic", kind: "type", signature: normalize(betaStatic.type.getText(beta)) }, ...betaFactories].sort((a, b) => compare(a.symbol, b.symbol)), stableOnly: [], changed: [{ symbol: "premierepro.RectF", stable: stableBinding, beta: betaBinding }, { symbol: "RectF.factorySignatures", stable: { owner: "RectF", entries: stableFactories.map(({ kind, signature }) => ({ kind, signature })) }, beta: { owner: "RectFStatic", entries: betaFactories.map(({ kind, signature }) => ({ kind, signature })) } }] } };
|
||||
const rendered = `${JSON.stringify(inventory, null, 2)}\n`;
|
||||
if (process.argv.includes("--validate-only")) console.log("Validated Adobe beta RectF declaration drift.");
|
||||
else if (process.argv.includes("--check")) { let current = ""; try { current = await readFile(outputPath, "utf8"); } catch {} if (current.replaceAll("\r\n", "\n") !== rendered) { console.error("Adobe beta RectF declaration drift inventory is stale. Run npm run adobe:beta-rectf-drift."); process.exitCode = 1; } else console.log("Adobe beta RectF declaration drift inventory is current: 3 beta-only and 2 changed symbols."); } else { await writeFile(outputPath, rendered); console.log("Wrote Adobe beta RectF declaration drift inventory: 3 beta-only and 2 changed symbols."); }
|
||||
Reference in New Issue
Block a user