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:
+31
@@ -0,0 +1,31 @@
|
||||
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_FRAME_RATE_STABLE_DECLARATIONS_PATH ? resolve(process.env.PREMIERE_BETA_FRAME_RATE_STABLE_DECLARATIONS_PATH) : resolve(root, "node_modules/@adobe/premierepro/src/premierepro.d.ts");
|
||||
const betaPath = process.env.PREMIERE_BETA_FRAME_RATE_BETA_DECLARATIONS_PATH ? resolve(process.env.PREMIERE_BETA_FRAME_RATE_BETA_DECLARATIONS_PATH) : resolve(root, "node_modules/@adobe/premierepro-beta/src/premierepro.d.ts");
|
||||
const outputPath = resolve(root, "src/resources/adobe-beta-frame-rate-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 FrameRate 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 === "FrameRate"); if (!member?.type) throw new Error("Adobe declarations must expose premierepro.FrameRate as a typed property."); return { symbol: "premierepro.FrameRate", 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) => { if (!item.type) throw new Error(`Adobe ${owner} factory signature is missing a return type.`); return { symbol: `${owner}.${ts.isConstructSignatureDeclaration(item) ? "new" : "call"}`, kind: ts.isConstructSignatureDeclaration(item) ? "construct_signature" : "call_signature", signature: `(${item.parameters.map((parameter) => normalize(parameter.getText(source))).join(", ")}) => ${normalize(item.type.getText(source))}` }; }).sort((left, right) => compare(left.symbol, right.symbol));
|
||||
const nonFactories = (declaration, source) => declaration.type.members.filter((item) => !ts.isConstructSignatureDeclaration(item) && !ts.isCallSignatureDeclaration(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"), stableFrameRate = literal(stable, "FrameRate"), betaFrameRate = literal(beta, "FrameRate"), stableStatic = literal(stable, "FrameRateStatic"), betaStatic = literal(beta, "FrameRateStatic"), stableBinding = binding(stableRoot, stable), betaBinding = binding(betaRoot, beta), stableFactories = factories(stableFrameRate, stable, "FrameRate"), betaFactories = factories(betaStatic, beta, "FrameRateStatic");
|
||||
if (stableBinding.signature !== "FrameRateStatic" || betaBinding.signature !== "FrameRateStatic") throw new Error("Adobe beta declarations must retain premierepro.FrameRate as FrameRateStatic.");
|
||||
if (factories(stableStatic, stable, "FrameRateStatic").length || factories(betaFrameRate, beta, "FrameRate").length) throw new Error("Adobe beta FrameRate factory signatures must move only from stable FrameRate to beta FrameRateStatic.");
|
||||
const stableShapes = stableFactories.map(({ kind, signature }) => ({ kind, signature })), betaShapes = betaFactories.map(({ kind, signature }) => ({ kind, signature }));
|
||||
if (stableFactories.length !== 2 || betaFactories.length !== 2 || JSON.stringify(stableShapes) !== JSON.stringify(betaShapes)) throw new Error("Adobe beta FrameRateStatic factory signatures must match stable FrameRate.");
|
||||
if (JSON.stringify(nonFactories(stableFrameRate, stable)) !== JSON.stringify(nonFactories(betaFrameRate, beta))) throw new Error("Adobe beta FrameRate non-factory members must match stable FrameRate.");
|
||||
if (JSON.stringify(nonFactories(stableStatic, stable)) !== JSON.stringify(nonFactories(betaStatic, beta))) throw new Error("Adobe beta FrameRateStatic non-factory members must match stable FrameRateStatic.");
|
||||
const hash = (declaration, source) => createHash("sha256").update(normalize(declaration.getText(source))).digest("hex");
|
||||
const inventory = { schemaVersion: 1, scope: { declarations: ["premierepro.FrameRate", "FrameRate", "FrameRateStatic"], semantics: "This records the beta FrameRate factory-placement 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 FrameRateStatic factory calls, that a FrameRate can be constructed or accepted by another API, that frame alignment or time conversion behavior is preserved, 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("\\", "/"), frameRateDeclarationSha256: hash(stableFrameRate, stable), frameRateStaticDeclarationSha256: hash(stableStatic, stable), rootBinding: stableBinding.signature }, beta: { package: "@adobe/premierepro-beta", version: JSON.parse(betaPackageText).version, declarations: relative(root, betaPath).replaceAll("\\", "/"), frameRateDeclarationSha256: hash(betaFrameRate, beta), frameRateStaticDeclarationSha256: hash(betaStatic, beta), rootBinding: betaBinding.signature } }, diff: { betaOnly: betaFactories, stableOnly: stableFactories, changed: [{ symbol: "FrameRate.factorySignaturePlacement", stable: { owner: "FrameRate", entries: stableShapes }, beta: { owner: "FrameRateStatic", entries: betaShapes } }] } };
|
||||
const rendered = `${JSON.stringify(inventory, null, 2)}\n`;
|
||||
if (process.argv.includes("--validate-only")) console.log("Validated Adobe beta FrameRate 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 FrameRate declaration drift inventory is stale. Run npm run adobe:beta-frame-rate-drift."); process.exitCode = 1; } else console.log("Adobe beta FrameRate declaration drift inventory is current: 2 beta-only, 2 stable-only, and 1 changed symbol."); }
|
||||
else { await writeFile(outputPath, rendered); console.log("Wrote Adobe beta FrameRate declaration drift inventory: 2 beta-only, 2 stable-only, and 1 changed symbol."); }
|
||||
Reference in New Issue
Block a user