@mark1russell7/workflow-github 0.0.0-bootstrap.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/inject.ts","../src/language.ts","../src/expression.ts","../src/yaml.ts","../src/index.ts"],"sourcesContent":["import { isRecord } from \"@mark1russell7/coeval\";\nimport { type EditResult, type WorkflowIssue, getIn, setIn } from \"@mark1russell7/workflow\";\n\n/**\n * The script injection rule of GitHub. GitHub puts the value of each `${{ }}` into the text of a script before the\n * shell reads it. A value that a person outside the repository writes (the title of an issue, the name of a branch)\n * can thus become a command. The safe form reads the value from an environment variable.\n */\n\ntype Key = string | number;\ntype Rec = Record<string, unknown>;\n\n/**\n * The reads that are safe in a script: numbers, hashes, ids and names that GitHub limits to safe characters. Each other\n * read is not safe. The list has full paths, because a person can write any key under `github.event.inputs`.\n */\nconst TRUSTED_READS: ReadonlySet<string> = new Set([\n \"github.sha\",\n \"github.run_id\",\n \"github.run_number\",\n \"github.run_attempt\",\n \"github.repository\",\n \"github.repository_id\",\n \"github.repository_owner\",\n \"github.repository_owner_id\",\n \"github.event_name\",\n \"github.workflow_sha\",\n \"github.job\",\n \"github.workspace\",\n \"github.action_path\",\n \"github.server_url\",\n \"github.api_url\",\n \"github.graphql_url\",\n \"github.retention_days\",\n \"github.actor\",\n \"github.actor_id\",\n \"github.triggering_actor\",\n \"github.event.number\",\n \"github.event.issue.number\",\n \"github.event.pull_request.number\",\n \"github.event.pull_request.head.sha\",\n \"github.event.pull_request.base.sha\",\n \"github.event.before\",\n \"github.event.after\",\n \"runner.os\",\n \"runner.arch\",\n \"runner.temp\",\n \"runner.tool_cache\",\n \"strategy.job-index\",\n \"strategy.job-total\",\n]);\n\n/** The trust of a read in a script: safe, written by a person outside the repository, or not known. */\nexport type ReadTrust = \"trusted\" | \"outside\" | \"unknown\";\n\n/**\n * This function gives the trust of a reference in a script. A read of the list `TRUSTED_READS` is safe. A read of\n * `github.event` or `github.head_ref` comes from outside. Each other read is not known: an input, the output of a step,\n * a value of `env` or the name of a branch.\n *\n * @param path - The path of the reference, for example `[\"names\", \"github\", \"event\", \"issue\", \"title\"]`.\n * @returns The trust.\n */\nexport function readTrust(path: readonly unknown[]): ReadTrust {\n if (path[0] === \"names\" && TRUSTED_READS.has(path.slice(1).map(String).join(\".\"))) return \"trusted\";\n if (path[0] === \"names\" && path[1] === \"github\" && (path[2] === \"event\" || path[2] === \"head_ref\")) return \"outside\";\n return \"unknown\";\n}\n\n/** This function gives the references in a document that are not safe in a script. */\nfunction unsafeRefs(doc: unknown, out: unknown[][] = []): unknown[][] {\n if (Array.isArray(doc)) for (const item of doc) unsafeRefs(item, out);\n else if (isRecord(doc)) {\n const record = doc as Rec;\n if (record[\"type\"] === \"ref\" && Array.isArray(record[\"value\"])) {\n if (readTrust(record[\"value\"]) !== \"trusted\") out.push(record[\"value\"]);\n } else for (const value of Object.values(record)) unsafeRefs(value, out);\n }\n return out;\n}\n\n/** The language of a script: a POSIX shell, PowerShell or JavaScript. */\ntype ScriptLanguage = \"sh\" | \"pwsh\" | \"js\";\n\n/** A place where text becomes code: the script of a step, and its language or the reason why it has no safe form. */\ninterface ScriptPlace {\n readonly at: readonly Key[];\n readonly script: unknown;\n readonly language: ScriptLanguage | { readonly why: string };\n}\n\nconst SHELL_LANGUAGES: Readonly<Record<string, ScriptLanguage>> = { bash: \"sh\", sh: \"sh\", pwsh: \"pwsh\", powershell: \"pwsh\" };\n\n/** The parts of each language that the quote scanner does not read. Before such a part, the move refuses. */\nconst UNREAD_PARTS: Readonly<Record<ScriptLanguage, RegExp>> = {\n sh: /<<|\\$'|`|\\$\\(/,\n pwsh: /@'|@\"|\\$\\(|<#/,\n js: /\\$\\{/,\n};\n\n/**\n * This function gives the open quote at the end of a text, or `\"\"` outside a quote and in a comment. A part that the\n * scanner does not read gives a refusal: a heredoc, a `$'...'` text, a command in a text, or a regular expression.\n */\nfunction openQuote(language: ScriptLanguage, text: string): string | { readonly why: string } {\n if (UNREAD_PARTS[language].test(text)) {\n return { why: \"The script has a part before the value that the move does not read: a heredoc, a command in a text or a nested template. Move the value by hand.\" };\n }\n const quotes = language === \"js\" ? \"'\\\"`\" : \"'\\\"\";\n const escape = language === \"pwsh\" ? \"`\" : \"\\\\\";\n let open = \"\";\n for (let i = 0; i < text.length; i++) {\n const char = text[i] as string;\n if (open === \"\") {\n const comment = language === \"js\" ? (text.startsWith(\"//\", i) ? \"\\n\" : text.startsWith(\"/*\", i) ? \"*/\" : undefined) : char === \"#\" && (i === 0 || /\\s/.test(text[i - 1] as string)) ? \"\\n\" : undefined;\n if (comment !== undefined) {\n const end = text.indexOf(comment, i + 2);\n if (end < 0) return \"\";\n i = end + comment.length - 1;\n continue;\n }\n if (language === \"js\" && char === \"/\") return { why: \"The script has a / before the value. It can be a regular expression, which the move does not read. Move the value by hand.\" };\n if (char === escape) i++;\n else if (quotes.includes(char)) open = char;\n } else if (char === escape && (open !== \"'\" || language === \"js\")) i++;\n else if (char === open) open = \"\";\n }\n return open;\n}\n\n/**\n * This function gives the code that reads a variable at a place in a script, by the open quote there. A shell reads\n * the variable in double quotes, thus the shell does not split the value. The result `undefined` means no safe form.\n */\nfunction readAt(language: ScriptLanguage, quote: string, name: string): string | undefined {\n if (language === \"sh\") return quote === '\"' ? `\\${${name}}` : quote === \"'\" ? `'\"\\${${name}}\"'` : `\"\\${${name}}\"`;\n if (language === \"pwsh\") return quote === '\"' ? `\\${env:${name}}` : quote === \"'\" ? undefined : `\"\\${env:${name}}\"`;\n if (quote === \"`\") return `\\${process.env.${name}}`;\n return quote === \"\" ? `process.env.${name}` : `${quote} + process.env.${name} + ${quote}`;\n}\n\n/** This function gives the shell of a step: its own, the default of its job or of the workflow, or the default of the runner. */\nfunction shellOf(doc: unknown, job: unknown, step: unknown): string | undefined {\n const named = [getIn(step, [\"value\", \"do\", \"value\", \"shell\"]), getIn(job, [\"value\", \"layers\", \"github\", \"keys\", \"defaults\", \"run\", \"shell\"]), getIn(doc, [\"value\", \"layers\", \"github\", \"keys\", \"defaults\", \"run\", \"shell\"])].find(\n (shell) => shell !== undefined,\n );\n if (named !== undefined) return typeof named === \"string\" ? (named.trim().split(/\\s+/)[0] ?? \"\") : undefined;\n const runsOn = getIn(job, [\"value\", \"layers\", \"github\", \"keys\", \"runs-on\"]);\n if (typeof runsOn !== \"string\" || runsOn.includes(\"${{\")) return undefined;\n return /windows/i.test(runsOn) ? \"pwsh\" : \"bash\";\n}\n\n/** This function gives each script of a workflow: the `run` of a step, and the `script` input of `actions/github-script`. */\nfunction scriptPlaces(doc: unknown): ScriptPlace[] {\n const places: ScriptPlace[] = [];\n const jobs = getIn(doc, [\"value\", \"jobs\"]);\n if (!isRecord(jobs)) return places;\n for (const [id, job] of Object.entries(jobs as Rec)) {\n const steps = getIn(job, [\"value\", \"steps\"]);\n if (!Array.isArray(steps)) continue;\n steps.forEach((step, index) => {\n const at: Key[] = [\"value\", \"jobs\", id, \"value\", \"steps\", index];\n const kind = getIn(step, [\"value\", \"do\", \"type\"]);\n const call = Array.isArray(kind) ? kind[1] : undefined;\n if (call === \"run\") {\n const shell = shellOf(doc, job, step);\n const language =\n shell === undefined\n ? { why: \"Set the shell of the step: the runner of the job is not a fixed text.\" }\n : (SHELL_LANGUAGES[shell] ?? { why: `The move knows no safe form of an environment variable in the shell ${shell}.` });\n places.push({ at: [...at, \"value\", \"do\", \"value\", \"script\"], script: getIn(step, [\"value\", \"do\", \"value\", \"script\"]), language });\n } else if (call === \"action\") {\n const uses = getIn(step, [\"value\", \"do\", \"value\", \"uses\"]);\n if (typeof uses === \"string\" && uses.startsWith(\"actions/github-script@\")) {\n places.push({ at: [...at, \"value\", \"do\", \"value\", \"with\", \"script\"], script: getIn(step, [\"value\", \"do\", \"value\", \"with\", \"script\"]), language: \"js\" });\n }\n }\n });\n }\n return places;\n}\n\nconst refPathText = (path: readonly unknown[]): string => path.slice(1).map(String).join(\".\");\nconst samePath = (a: readonly Key[], b: readonly Key[]): boolean => a.length === b.length && a.every((key, index) => key === b[index]);\n\n/** This function tells if a script has a text part with `${{`: an expression that no reader read. */\nfunction hasRawExpression(script: unknown): boolean {\n if (typeof script === \"string\") return script.includes(\"${{\");\n if (isRecord(script) && (script as Rec)[\"type\"] === \"template\" && Array.isArray((script as Rec)[\"value\"])) {\n return ((script as Rec)[\"value\"] as unknown[]).some((part) => typeof part === \"string\" && part.includes(\"${{\"));\n }\n return false;\n}\n\n/**\n * This function finds each script that reads an unsafe value with `${{ }}`. A read from outside the repository\n * (`github.event`, `github.head_ref`) is an error. A read that is not known is a warning. Each problem has the code\n * `script-injection`, and `moveToEnv` corrects it.\n *\n * A script with a text `${{` that no reader read is also an error, with the code `raw-expression`. The export\n * writes it as an expression, but the check did not see it. A typed script with an open `${{` gives this error.\n *\n * @param doc - The workflow document.\n * @returns The problems.\n */\nexport function scriptInjections(doc: unknown): WorkflowIssue[] {\n const places = scriptPlaces(doc);\n const issues: WorkflowIssue[] = places.flatMap((place) => {\n const refs = unsafeRefs(place.script);\n if (refs.length === 0) return [];\n const outside = refs.some((ref) => readTrust(ref) === \"outside\");\n const names = [...new Set(refs.map(refPathText))].join(\", \");\n const issue: WorkflowIssue = {\n level: outside ? \"error\" : \"warning\",\n code: \"script-injection\",\n at: place.at,\n message: outside\n ? `The script reads ${names} with \\${{ }}. A person outside the repository can write this value as a command. Move the value to env.`\n : `The script reads ${names} with \\${{ }}. If a person outside the repository sets this value, it becomes a command. Move the value to env.`,\n };\n return [issue];\n });\n for (const place of places.filter((item) => hasRawExpression(item.script))) {\n issues.push({\n level: \"error\",\n code: \"raw-expression\",\n at: place.at,\n message: \"This text has ${{ that no reader read. The export writes it as an expression that the check did not see. Correct the expression.\",\n });\n }\n return issues;\n}\n\nconst RESERVED = /^(GITHUB_|RUNNER_|ACTIONS_|CI$|HOME$|PATH$|[0-9])/;\n\n/** This function gives the name of a variable for a reference: its last two keys, in upper case, not taken and not reserved. */\nfunction variableName(path: readonly unknown[], taken: ReadonlySet<string>): string {\n const keys = path.slice(2).filter((key): key is string => typeof key === \"string\" && key !== \"event\" && key !== \"outputs\");\n let base = (keys.slice(-2).join(\"_\") || \"VALUE\").toUpperCase().replace(/[^A-Z0-9_]/g, \"_\");\n if (RESERVED.test(base)) base = `V_${base}`;\n if (!taken.has(base)) return base;\n for (let n = 2; ; n++) if (!taken.has(`${base}_${String(n)}`)) return `${base}_${String(n)}`;\n}\n\nconst keysAt = (doc: unknown, at: readonly Key[]): string[] => {\n const value = getIn(doc, at);\n return isRecord(value) ? Object.keys(value) : [];\n};\n\n/**\n * This function moves each unsafe value of a script to `env` of its step. The script then reads the variable, and\n * the shell does not read the value as code. The same value gets one variable. A new name is not a name of `env` of\n * the job or of the workflow, thus the move hides no value.\n *\n * @param doc - The workflow document.\n * @param at - The JSON path of the script, as the problem of `scriptInjections` gives it.\n * @returns The new document, or the reason of a refusal.\n */\nexport function moveToEnv(doc: unknown, at: readonly Key[]): EditResult {\n const place = scriptPlaces(doc).find((item) => samePath(item.at, at));\n if (place === undefined) return { ok: false, why: \"This path is not a script of a step.\" };\n const language = place.language;\n if (typeof language !== \"string\") return { ok: false, why: language.why };\n const stepAt = at.slice(0, at.indexOf(\"steps\") + 2);\n const envAt = [...stepAt, \"value\", \"env\"];\n const env: Rec = { ...(isRecord(getIn(doc, envAt)) ? (getIn(doc, envAt) as Rec) : {}) };\n const byDoc = new Map<string, string>();\n for (const [name, value] of Object.entries(env)) byDoc.set(JSON.stringify(value), name);\n const taken = new Set([...Object.keys(env), ...keysAt(doc, [...at.slice(0, 4), \"env\"]), ...keysAt(doc, [\"value\", \"env\"])]);\n let before = \"\";\n let refused: string | undefined;\n const replace = (part: unknown): unknown => {\n const refs = unsafeRefs(part);\n if (refs.length === 0) {\n before += \"\\u0000\";\n return part;\n }\n const quote = openQuote(language, before);\n const key = JSON.stringify(part);\n const name = byDoc.get(key) ?? variableName(refs[0] as unknown[], taken);\n const code = typeof quote === \"string\" ? readAt(language, quote, name) : undefined;\n if (code === undefined) {\n refused ??= typeof quote === \"string\" ? \"The value is in a quote that does not read variables. Close the quote around the value first.\" : quote.why;\n return part;\n }\n if (!byDoc.has(key)) {\n taken.add(name);\n byDoc.set(key, name);\n env[name] = part;\n }\n before += \"\\u0000\";\n return code;\n };\n const script = place.script;\n let next: unknown;\n if (isRecord(script) && (script as Rec)[\"type\"] === \"template\" && Array.isArray((script as Rec)[\"value\"])) {\n const parts = ((script as Rec)[\"value\"] as unknown[]).map((part) => {\n if (typeof part !== \"string\") return replace(part);\n before += part;\n return part;\n });\n next = parts.every((part) => typeof part === \"string\") ? parts.join(\"\") : { type: \"template\", value: parts };\n } else next = replace(script);\n if (refused !== undefined) return { ok: false, why: refused };\n if (next === script) return { ok: true, doc };\n return { ok: true, doc: setIn(setIn(doc, at, next), envAt, env) };\n}\n","import {\n type Evaluator,\n type FormulaProfile,\n type Language,\n type Machine,\n type Namespace,\n type OpFn,\n type PartShape as Shape,\n type Signature,\n defineLanguage,\n fail,\n isRecord,\n} from \"@mark1russell7/coeval\";\nimport { type RefChoice, WORKFLOW_OPS, isSecretRef, workflowMachineWith } from \"@mark1russell7/workflow\";\n\n/** The version of the GitHub add-on language. */\nexport const GITHUB_VERSION = \"0.1.0\";\n\nconst text: Shape = { shape: \"text\" };\nconst term: Shape = { shape: \"term\", of: \"lit\" };\nconst terms: Shape = { shape: \"map\", item: term };\n\n/** This function stops an operation that only a GitHub runner can evaluate. */\nconst hostOnly = (name: string): OpFn => () => {\n throw new TypeError(`${name} reads the state of a GitHub run. Only GitHub evaluates it.`);\n};\n\n/**\n * The operations of GitHub beside the operations of the workflow language. They are an index into a value, the filter `.*`\n * and the functions that read the state of a run on GitHub.\n */\nconst OPS: Readonly<Record<string, OpFn>> = {\n at: ((...args: unknown[]) => {\n const [value, key] = args;\n if (isSecretRef(value)) throw new TypeError(\"The operation at cannot read a secret.\");\n if (Array.isArray(value) && typeof key === \"number\") return value[key] ?? null;\n if (isRecord(value) && (typeof key === \"string\" || typeof key === \"number\")) {\n // GitHub reads the keys of an object without case.\n const name = String(key).toLowerCase();\n const found = Object.keys(value).find((own) => own.toLowerCase() === name);\n return found === undefined ? null : value[found];\n }\n return null;\n }) as OpFn,\n pluck: ((...args: unknown[]) => {\n const [value, ...path] = args;\n const items = Array.isArray(value) ? value : isRecord(value) ? Object.values(value) : [];\n return items.map((item) => path.reduce<unknown>((at, key) => (isRecord(at) ? (at[String(key)] ?? null) : null), item));\n }) as OpFn,\n hashFiles: hostOnly(\"hashFiles\"),\n success: hostOnly(\"success\"),\n always: hostOnly(\"always\"),\n cancelled: hostOnly(\"cancelled\"),\n failure: hostOnly(\"failure\"),\n};\n\nconst SIGS: Readonly<Record<string, Signature>> = {\n at: { params: [\"unknown\", \"unknown\"], to: \"unknown\" },\n pluck: { params: [\"unknown\"], rest: \"unknown\", to: \"unknown\" },\n hashFiles: { params: [], rest: \"text\", to: \"text\" },\n success: { params: [], to: \"bool\" },\n always: { params: [], to: \"bool\" },\n cancelled: { params: [], to: \"bool\" },\n failure: { params: [], to: \"bool\" },\n format: { params: [\"text\"], rest: \"unknown\", to: \"text\" },\n};\n\n/** The formula profile of GitHub: the operations of the workflow language and the operations of GitHub. */\nexport const GITHUB_OPS: FormulaProfile = {\n ops: { ...WORKFLOW_OPS.ops, ...OPS },\n ...(WORKFLOW_OPS.lazy === undefined ? {} : { lazy: WORKFLOW_OPS.lazy }),\n sigs: { ...WORKFLOW_OPS.sigs, ...SIGS },\n pure: WORKFLOW_OPS.pure === true ? true : [...(WORKFLOW_OPS.pure ?? []), \"at\", \"pluck\"],\n};\n\n/**\n * The namespace `github`: the calls that only GitHub runs. The runner of the core runs only procedure calls, thus an\n * evaluation of these kinds stops with `#CALC!`.\n */\nconst GITHUB: Namespace = {\n kinds: {\n action: {\n verbs: { eval: \"github.host\" },\n parts: { shape: \"record\", fields: { uses: text, with: terms }, required: [\"uses\"], closed: true },\n summary: \"A step that runs an action of GitHub, with its inputs.\",\n },\n run: {\n verbs: { eval: \"github.host\" },\n parts: { shape: \"record\", fields: { script: term, shell: term, cwd: term }, closed: true },\n summary: \"A step that runs a script in the shell of a GitHub runner.\",\n },\n workflow: {\n verbs: { eval: \"github.host\" },\n parts: { shape: \"record\", fields: { uses: text, with: terms, secrets: terms, inherit: { shape: \"none\" } }, required: [\"uses\"], closed: true },\n summary: \"A job that calls a reusable workflow of GitHub, with its inputs and secrets.\",\n },\n },\n};\n\nconst EVALUATORS: Readonly<Record<string, Evaluator>> = {\n \"github.host\": () => fail(\"#CALC!\", \"Only GitHub runs this step.\"),\n};\n\n/** The GitHub add-on language: the namespace `github`. */\nexport const GITHUB_LANGUAGE: Language = defineLanguage({\n name: \"workflow-github\",\n version: GITHUB_VERSION,\n world: { kinds: { github: GITHUB } },\n code: { evaluators: EVALUATORS },\n});\n\n/**\n * This function gives the machine of a GitHub workflow: the workflow language with the GitHub profile and the\n * namespace `github`.\n *\n * @param more - The languages of other add-ons, in order.\n * @returns The machine.\n */\nexport function githubMachine(...more: readonly Language[]): Machine {\n return workflowMachineWith(GITHUB_OPS, GITHUB_LANGUAGE, ...more);\n}\n\n/** The contexts of GitHub that an expression can read, beside the names of the workflow language. */\nexport const GITHUB_NAMES: readonly string[] = [\"github\", \"vars\", \"runner\", \"strategy\"];\n\n/** The call namespaces of GitHub: an input of such a call can hold a secret. */\nexport const GITHUB_CALLS: readonly string[] = [\"github\"];\n\n/** The values of the GitHub contexts that a builder offers at each position, as reference documents. */\nexport const GITHUB_CONTEXT_CHOICES: readonly RefChoice[] = [\n [\"github\", \"event_name\"],\n [\"github\", \"ref\"],\n [\"github\", \"ref_name\"],\n [\"github\", \"sha\"],\n [\"github\", \"actor\"],\n [\"github\", \"repository\"],\n [\"github\", \"run_id\"],\n [\"github\", \"event\", \"pull_request\", \"number\"],\n [\"github\", \"workspace\"],\n [\"runner\", \"os\"],\n [\"runner\", \"temp\"],\n].map((path) => ({ group: String(path[0]), label: path.join(\".\"), doc: { type: \"ref\", value: [\"names\", ...path] } }));\n","import { isEnvelope, isRecord } from \"@mark1russell7/coeval\";\n\n/**\n * The GitHub expression grammar, as documents of the formula kit.\n *\n * The add-on has its own parser until W8. The syntax kit of the kernel has no index step, no `-` in a name, no\n * function names without case and no filter step `.*`. The roadmap row W8 adds them, and then this grammar becomes a\n * profile of the syntax kit.\n */\n\n/** A problem of an expression text: its offset in the text, and a message. */\nexport interface ExpressionIssue {\n readonly offset: number;\n readonly message: string;\n}\n\n/** The result of `parseExpression`. */\nexport type ExpressionResult = { readonly ok: true; readonly doc: unknown } | { readonly ok: false; readonly issue: ExpressionIssue };\n\n/** The functions of GitHub, by their names in lower case. The value is the name of the operation. */\nexport const GITHUB_FUNCTIONS: Readonly<Record<string, string>> = {\n contains: \"contains\",\n startswith: \"startsWith\",\n endswith: \"endsWith\",\n format: \"format\",\n join: \"join\",\n tojson: \"toJSON\",\n fromjson: \"fromJSON\",\n hashfiles: \"hashFiles\",\n success: \"success\",\n always: \"always\",\n cancelled: \"cancelled\",\n failure: \"failure\",\n};\n\nconst BINARY: Readonly<Record<string, { readonly prec: number; readonly kind: string }>> = {\n \"||\": { prec: 1, kind: \"or\" },\n \"&&\": { prec: 2, kind: \"and\" },\n \"==\": { prec: 3, kind: \"eq\" },\n \"!=\": { prec: 3, kind: \"ne\" },\n \"<\": { prec: 4, kind: \"lt\" },\n \"<=\": { prec: 4, kind: \"le\" },\n \">\": { prec: 4, kind: \"gt\" },\n \">=\": { prec: 4, kind: \"ge\" },\n};\nconst SYMBOL_OF: Readonly<Record<string, string>> = Object.fromEntries(Object.entries(BINARY).map(([symbol, { kind }]) => [kind, symbol]));\nconst PREC_NOT = 5;\nconst PREC_POSTFIX = 6;\n\ntype Token =\n | { readonly t: \"num\"; readonly v: number; readonly at: number }\n | { readonly t: \"str\"; readonly v: string; readonly at: number }\n | { readonly t: \"id\"; readonly v: string; readonly at: number }\n | { readonly t: \"op\"; readonly v: string; readonly at: number }\n | { readonly t: \"end\"; readonly at: number };\n\nclass Stop extends Error {\n readonly issue: ExpressionIssue;\n constructor(issue: ExpressionIssue) {\n super(issue.message);\n this.issue = issue;\n }\n}\n\nconst NAME = /^[A-Za-z_][A-Za-z0-9_-]*$/;\n\nfunction tokenize(text: string): Token[] {\n const out: Token[] = [];\n let i = 0;\n while (i < text.length) {\n const c = text[i] as string;\n if (/\\s/.test(c)) {\n i++;\n continue;\n }\n const rest = text.slice(i);\n const number = /^(0x[0-9a-fA-F]+|-?(\\d+\\.?\\d*|\\.\\d+)([eE][+-]?\\d+)?)/.exec(rest);\n if (number !== null && (c !== \"-\" || /^-[\\d.]/.test(rest))) {\n out.push({ t: \"num\", v: Number(number[0]), at: i });\n i += number[0].length;\n continue;\n }\n if (c === \"'\") {\n let value = \"\";\n let j = i + 1;\n for (;;) {\n if (j >= text.length) throw new Stop({ offset: i, message: \"A text has no end quote.\" });\n if (text[j] === \"'\") {\n if (text[j + 1] === \"'\") {\n value += \"'\";\n j += 2;\n continue;\n }\n break;\n }\n value += text[j];\n j++;\n }\n out.push({ t: \"str\", v: value, at: i });\n i = j + 1;\n continue;\n }\n const name = /^[A-Za-z_][A-Za-z0-9_-]*/.exec(rest);\n if (name !== null) {\n out.push({ t: \"id\", v: name[0], at: i });\n i += name[0].length;\n continue;\n }\n const op = [\"&&\", \"||\", \"==\", \"!=\", \"<=\", \">=\", \"<\", \">\", \"!\", \"(\", \")\", \"[\", \"]\", \".\", \",\", \"*\"].find((symbol) => rest.startsWith(symbol));\n if (op === undefined) throw new Stop({ offset: i, message: `The character ${JSON.stringify(c)} is not part of an expression.` });\n out.push({ t: \"op\", v: op, at: i });\n i += op.length;\n }\n out.push({ t: \"end\", at: text.length });\n return out;\n}\n\nconst refDoc = (path: readonly unknown[]): unknown => ({ type: \"ref\", value: [\"names\", ...path] });\nconst op = (name: string, args: readonly unknown[]): unknown => ({ type: [\"ops\", name], value: args });\nconst isRef = (doc: unknown): doc is { type: \"ref\"; value: unknown[] } => isEnvelope(doc) && doc.type === \"ref\" && Array.isArray(doc.value);\n\nclass Parser {\n private i = 0;\n private readonly tokens: readonly Token[];\n constructor(tokens: readonly Token[]) {\n this.tokens = tokens;\n }\n\n private peek(): Token {\n return this.tokens[this.i] as Token;\n }\n private next(): Token {\n return this.tokens[this.i++] as Token;\n }\n private isOp(symbol: string): boolean {\n const token = this.peek();\n return token.t === \"op\" && token.v === symbol;\n }\n private expect(symbol: string): void {\n const token = this.next();\n if (token.t !== \"op\" || token.v !== symbol) throw new Stop({ offset: token.at, message: `The expression needs ${symbol} here.` });\n }\n\n parse(): unknown {\n const doc = this.binary(1);\n const token = this.peek();\n if (token.t !== \"end\") throw new Stop({ offset: token.at, message: \"The expression has more text after its end.\" });\n return doc;\n }\n\n private binary(min: number): unknown {\n let left = this.unary();\n for (;;) {\n const token = this.peek();\n const info = token.t === \"op\" ? BINARY[token.v] : undefined;\n if (info === undefined || info.prec < min) return left;\n this.next();\n const right = this.binary(info.prec + 1);\n if (info.kind === \"and\" || info.kind === \"or\") {\n // A chain of one logical operator is one document with each term.\n const terms = isEnvelope(left) && left.type === info.kind && Array.isArray(left.value) && !(left as { group?: true }).group ? [...left.value, right] : [left, right];\n left = { type: info.kind, value: terms };\n } else left = op(info.kind, [left, right]);\n }\n }\n\n private unary(): unknown {\n if (this.isOp(\"!\")) {\n this.next();\n return op(\"not\", [this.unary()]);\n }\n return this.postfix(this.primary());\n }\n\n private postfix(start: unknown): unknown {\n let doc = start;\n let pluck: unknown[] | undefined;\n for (;;) {\n if (this.isOp(\".\")) {\n this.next();\n const token = this.next();\n if (token.t === \"op\" && token.v === \"*\") {\n pluck = [doc];\n doc = op(\"pluck\", pluck);\n continue;\n }\n if (token.t !== \"id\") throw new Stop({ offset: token.at, message: \"A name or * comes after a dot.\" });\n doc = this.step(doc, token.v, pluck);\n continue;\n }\n if (this.isOp(\"[\")) {\n this.next();\n const index = this.binary(1);\n this.expect(\"]\");\n pluck = undefined;\n doc = typeof index === \"string\" || typeof index === \"number\" ? this.step(doc, index, undefined) : op(\"at\", [doc, index]);\n continue;\n }\n return doc;\n }\n }\n\n private step(doc: unknown, key: string | number, pluck: unknown[] | undefined): unknown {\n if (pluck !== undefined) {\n pluck.push(key);\n return doc;\n }\n if (isRef(doc)) return { type: \"ref\", value: [...doc.value, key] };\n return op(\"at\", [doc, key]);\n }\n\n private primary(): unknown {\n const token = this.next();\n switch (token.t) {\n case \"num\":\n case \"str\":\n return token.v;\n case \"id\": {\n if (this.isOp(\"(\")) {\n const name = GITHUB_FUNCTIONS[token.v.toLowerCase()];\n if (name === undefined) throw new Stop({ offset: token.at, message: `GitHub has no function ${token.v}.` });\n this.next();\n const args: unknown[] = [];\n if (!this.isOp(\")\")) {\n args.push(this.binary(1));\n while (this.isOp(\",\")) {\n this.next();\n args.push(this.binary(1));\n }\n }\n this.expect(\")\");\n return op(name, args);\n }\n if (token.v === \"true\") return true;\n if (token.v === \"false\") return false;\n if (token.v === \"null\") return null;\n return refDoc([token.v]);\n }\n case \"op\":\n if (token.v === \"(\") {\n const doc = this.binary(1);\n this.expect(\")\");\n // A group stops the merge of a chain: (a && b) && c keeps its group in the text.\n return isEnvelope(doc) && (doc.type === \"and\" || doc.type === \"or\") ? Object.defineProperty({ ...doc }, \"group\", { value: true, enumerable: false }) : doc;\n }\n throw new Stop({ offset: token.at, message: `The expression cannot start with ${token.v} here.` });\n default:\n throw new Stop({ offset: token.at, message: \"The expression has no term here.\" });\n }\n }\n}\n\n/** This function changes a reference `secrets.NAME` into a secret document, at each depth of a document. */\nfunction secretsOf(doc: unknown): unknown {\n if (Array.isArray(doc)) return doc.map(secretsOf);\n if (!isRecord(doc)) return doc;\n if (isRef(doc) && doc.value.length === 3 && doc.value[1] === \"secrets\" && typeof doc.value[2] === \"string\") return { type: \"secret\", value: doc.value[2] };\n if (isEnvelope(doc)) return { type: doc.type, value: secretsOf(doc.value) };\n return doc;\n}\n\n/**\n * This function reads a GitHub expression, the text between `${{` and `}}`, into a document of the formula kit.\n *\n * - A context is a reference from `names`, for example `inputs.version` gives `[\"names\", \"inputs\", \"version\"]`.\n * - `secrets.NAME` gives the secret document `{ type: \"secret\", value: \"NAME\" }`.\n * - The operators give `and`, `or` and the operations `not`, `eq`, `ne`, `lt`, `le`, `gt` and `ge`.\n * - An index of a value that is not a reference gives the operation `at`, and `.*` gives the operation `pluck`.\n * - A literal at the top gives a `lit` document, thus a text part of a template stays different from a literal.\n *\n * @param text - The text of the expression.\n * @returns The document, or the problem with its offset.\n */\nexport function parseExpression(text: string): ExpressionResult {\n try {\n const doc = secretsOf(new Parser(tokenize(text)).parse());\n return { ok: true, doc: isEnvelope(doc) ? doc : { type: \"lit\", value: doc } };\n } catch (error) {\n if (error instanceof Stop) return { ok: false, issue: error.issue };\n throw error;\n }\n}\n\nfunction literal(value: unknown): string {\n if (typeof value === \"string\") return `'${value.replace(/'/g, \"''\")}'`;\n if (typeof value === \"number\" || typeof value === \"boolean\" || value === null) return String(value);\n throw new TypeError(`The value ${JSON.stringify(value)} has no text in a GitHub expression.`);\n}\n\nfunction pathKeyText(key: unknown): string {\n return typeof key === \"string\" && NAME.test(key) ? `.${key}` : `[${literal(key)}]`;\n}\n\nfunction printGitHubExpr(doc: unknown, min: number): string {\n if (!isEnvelope(doc)) return literal(doc);\n const type = Array.isArray(doc.type) ? doc.type.join(\".\") : String(doc.type);\n const args = Array.isArray(doc.value) ? doc.value : [];\n const group = (prec: number, text: string): string => (prec < min ? `(${text})` : text);\n switch (type) {\n case \"lit\":\n return literal(doc.value);\n case \"ref\": {\n const [, root, ...steps] = args;\n return `${String(root)}${steps.map(pathKeyText).join(\"\")}`;\n }\n case \"secret\":\n return `secrets${pathKeyText(doc.value)}`;\n case \"and\":\n case \"or\": {\n const prec = type === \"and\" ? 2 : 1;\n return group(prec, args.map((arg) => printGitHubExpr(arg, prec + 1)).join(type === \"and\" ? \" && \" : \" || \"));\n }\n case \"ops.not\":\n return group(PREC_NOT, `!${printGitHubExpr(args[0], PREC_NOT)}`);\n case \"ops.at\":\n return `${printGitHubExpr(args[0], PREC_POSTFIX)}${isEnvelope(args[1]) ? `[${printGitHubExpr(args[1], 1)}]` : pathKeyText(args[1])}`;\n case \"ops.pluck\":\n return `${printGitHubExpr(args[0], PREC_POSTFIX)}.*${args.slice(1).map(pathKeyText).join(\"\")}`;\n default: {\n const kind = type.startsWith(\"ops.\") ? type.slice(4) : type;\n const symbol = SYMBOL_OF[kind];\n if (symbol !== undefined) {\n const prec = (BINARY[symbol] as { prec: number }).prec;\n return group(prec, `${printGitHubExpr(args[0], prec)} ${symbol} ${printGitHubExpr(args[1], prec + 1)}`);\n }\n if (type.startsWith(\"ops.\")) return `${kind}(${args.map((arg) => printGitHubExpr(arg, 1)).join(\", \")})`;\n throw new TypeError(`The kind ${type} has no text in a GitHub expression.`);\n }\n }\n}\n\n/**\n * This function writes a document of the formula kit as a GitHub expression, without `${{` and `}}`. The text is\n * the canonical text: one space around each operator, and the GitHub names of the functions.\n *\n * @param doc - The document.\n * @returns The text.\n */\nexport function printExpression(doc: unknown): string {\n return printGitHubExpr(doc, 1);\n}\n\n/** One part of a text with expressions: a text part, or an expression with its source text. */\nexport type TextPart = { readonly text: string } | { readonly source: string; readonly offset: number };\n\n/**\n * This function splits a text at each `${{ ... }}`. The end of an expression is the first `}}` outside a quoted text.\n *\n * @param text - The text.\n * @returns The parts, or `undefined` when an expression has no end.\n */\nexport function splitText(text: string): TextPart[] | undefined {\n const parts: TextPart[] = [];\n let i = 0;\n while (i < text.length) {\n const start = text.indexOf(\"${{\", i);\n if (start < 0) {\n parts.push({ text: text.slice(i) });\n break;\n }\n if (start > i) parts.push({ text: text.slice(i, start) });\n let j = start + 3;\n let quoted = false;\n while (j < text.length) {\n if (text[j] === \"'\") quoted = !quoted;\n else if (!quoted && text.startsWith(\"}}\", j)) break;\n j++;\n }\n if (j >= text.length) return undefined;\n parts.push({ source: text.slice(start + 3, j), offset: start + 3 });\n i = j + 2;\n }\n return parts;\n}\n","import { isEnvelope, isRecord } from \"@mark1russell7/coeval\";\nimport { type Document, isAlias, isScalar, isSeq, parseDocument, stringify, visit } from \"yaml\";\nimport { parseExpression, printExpression, splitText } from \"./expression.ts\";\n\n/** The name of the format of the layer of the add-on. */\nexport const GITHUB_LAYER = \"github/1\";\n\n/** A problem of an import, at the path of its value in the YAML. */\nexport interface ImportIssue {\n readonly level: \"error\" | \"warning\";\n readonly at: readonly (string | number)[];\n readonly message: string;\n}\n\n/** The result of `fromGitHub`: the workflow document, and the problems of the import. */\nexport interface ImportResult {\n /** `false` when the text is not a workflow. Then the document is absent. */\n readonly ok: boolean;\n readonly doc?: { readonly type: \"workflow\"; readonly value: Record<string, unknown> };\n readonly issues: readonly ImportIssue[];\n}\n\n/** The options of `fromGitHub`. */\nexport interface ImportOptions {\n /** The name of the file. A workflow without a name gets it. */\n readonly file?: string;\n /** The id of the workspace of the workflow. The default is `default`. */\n readonly workspace?: string;\n}\n\ntype Rec = Record<string, unknown>;\ntype Path = readonly (string | number)[];\n\n/** The kernel test of a record, with a type that the import can change. */\nconst isPlain = (value: unknown): value is Rec => isRecord(value);\n\nconst defined = (record: Rec): Rec => Object.fromEntries(Object.entries(record).filter(([, value]) => value !== undefined));\nconst nonEmpty = (record: Rec): Rec | undefined => (Object.keys(record).length > 0 ? record : undefined);\n\n/** This function tells if two JSON values are equal. The order of the keys of a record does not count. */\nexport function sameJson(a: unknown, b: unknown): boolean {\n if (a === b) return true;\n if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((item, index) => sameJson(item, b[index]));\n if (isPlain(a) && isPlain(b)) {\n const keys = Object.keys(a);\n return keys.length === Object.keys(b).length && keys.every((key) => Object.hasOwn(b, key) && sameJson(a[key], b[key]));\n }\n return Number.isNaN(a) && Number.isNaN(b);\n}\n\n// === Texts with expressions ===\n\n/** The import state: the problems and the source texts of the expressions. */\ninterface In {\n readonly issues: ImportIssue[];\n /** The source text of each value with an expression, by the canonical JSON of its document, in the order of the file. */\n readonly texts: Record<string, string[]>;\n}\n\n/** The value of a text of GitHub: a text, or the document of its expressions, and the problems of the read. */\nexport interface TextValue {\n readonly value: unknown;\n readonly problems: readonly string[];\n}\n\n/**\n * This function reads a text value of GitHub. A text without `${{` stays a text, unless it is a condition. A text that\n * is one expression gives its document. Another text with expressions gives a `template`. A text with a bad expression\n * stays a text, with a problem.\n *\n * @param text - The text.\n * @param condition - `true` for the text of `if`, which is an expression without `${{ }}`.\n * @returns The value and the problems.\n */\nexport function readText(text: string, condition = false): TextValue {\n const problems: string[] = [];\n const value = textValueOf(text, condition, problems);\n return { value: value === undefined ? text : value, problems };\n}\n\n/** This function gives the document of a text, or `undefined` when the text stays a text. */\nfunction textValueOf(text: string, condition: boolean, problems: string[]): unknown {\n const parts = splitText(text);\n if (parts === undefined) {\n problems.push(\"An expression has no end }}. The value stays a text.\");\n return undefined;\n }\n const read = (source: string, offset: number): unknown => {\n const result = parseExpression(source);\n if (result.ok) return result.doc;\n problems.push(`At ${offset + result.issue.offset}: ${result.issue.message} The value stays a text.`);\n return undefined;\n };\n let doc: unknown;\n const only = parts.length === 1 ? parts[0] : undefined;\n if (only !== undefined && \"source\" in only) doc = read(only.source, only.offset);\n else if (parts.every((part) => \"text\" in part)) {\n if (!condition) return undefined;\n doc = read(text, 0);\n } else {\n const value: unknown[] = [];\n for (const part of parts) {\n if (\"text\" in part) value.push(part.text);\n else {\n const expr = read(part.source, part.offset);\n if (expr === undefined) return undefined;\n value.push(expr);\n }\n }\n doc = { type: \"template\", value };\n }\n return doc;\n}\n\n/** This function reads a YAML text value of a file, and keeps its source text for the export. */\nfunction textDoc(state: In, text: string, condition: boolean, at: Path): unknown {\n const problems: string[] = [];\n const doc = textValueOf(text, condition, problems);\n for (const message of problems) state.issues.push({ level: \"warning\", at, message });\n if (doc === undefined) return text;\n (state.texts[JSON.stringify(doc)] ??= []).push(text);\n return doc;\n}\n\nconst termOf = (state: In, value: unknown, at: Path, condition = false): unknown => (typeof value === \"string\" ? textDoc(state, value, condition, at) : value);\nconst termsOf = (state: In, record: Rec, at: Path): Rec => Object.fromEntries(Object.entries(record).map(([key, value]) => [key, termOf(state, value, [...at, key])]));\n\n/** The export state: the source texts, and the number of the texts that the export used for each document. */\ninterface Out {\n readonly texts: Readonly<Record<string, readonly string[]>>;\n readonly used: Record<string, number>;\n}\n\n/** This function writes a document as a YAML value: the source text when the document did not change, else new text. */\nfunction plainOf(state: Out, value: unknown, condition = false): unknown {\n if (!isEnvelope(value)) return value;\n const key = JSON.stringify(value);\n const texts = state.texts[key];\n if (texts !== undefined && texts.length > 0) {\n const index = state.used[key] ?? 0;\n state.used[key] = index + 1;\n return texts[Math.min(index, texts.length - 1)];\n }\n if (value.type === \"template\" && Array.isArray(value.value)) {\n return value.value.map((part) => (typeof part === \"string\" ? part : `\\${{ ${printExpression(part)} }}`)).join(\"\");\n }\n const text = printExpression(value);\n return condition && !text.startsWith(\"!\") ? text : `\\${{ ${text} }}`;\n}\n\nconst plainsOf = (state: Out, record: unknown): Rec | undefined =>\n isPlain(record) ? Object.fromEntries(Object.entries(record).map(([key, value]) => [key, plainOf(state, value)])) : undefined;\n\n// === Minutes ===\n\n/** This function gives the seconds of a count of minutes when the conversion back is exact. */\nfunction secondsOf(minutes: unknown): number | undefined {\n return typeof minutes === \"number\" && Number.isFinite(minutes) && (minutes * 60) / 60 === minutes ? minutes * 60 : undefined;\n}\n\n// === Import ===\n\nfunction layerOf(record: Rec): Rec | undefined {\n const github = nonEmpty(defined(record));\n return github === undefined ? undefined : { github };\n}\n\nfunction stepOf(state: In, step: unknown, at: Path): unknown {\n if (!isPlain(step)) {\n state.issues.push({ level: \"warning\", at, message: \"A step is not a map. The layer keeps it.\" });\n return { type: \"step\", value: { do: { type: [\"github\", \"run\"], value: {} }, layers: { github: { raw: step } } } };\n }\n const { id, name, if: condition, uses, with: inputs, run, shell, \"working-directory\": cwd, env, \"continue-on-error\": goOn, \"timeout-minutes\": minutes, ...rest } = step;\n const gh: Rec = {};\n let call: unknown;\n if (uses !== undefined) {\n if (shell !== undefined) rest[\"shell\"] = shell;\n if (cwd !== undefined) rest[\"working-directory\"] = cwd;\n if (run !== undefined) rest[\"run\"] = run;\n if (typeof uses !== \"string\") gh[\"uses\"] = uses;\n if (inputs !== undefined && !isPlain(inputs)) gh[\"with\"] = inputs;\n call = {\n type: [\"github\", \"action\"],\n value: defined({ uses: typeof uses === \"string\" ? uses : undefined, with: isPlain(inputs) ? termsOf(state, inputs, [...at, \"with\"]) : undefined }),\n };\n } else {\n if (inputs !== undefined) rest[\"with\"] = inputs;\n if (run === undefined) gh[\"noRun\"] = true;\n call = {\n type: [\"github\", \"run\"],\n value: defined({\n script: run === undefined ? undefined : termOf(state, run, [...at, \"run\"]),\n shell: shell === undefined ? undefined : termOf(state, shell, [...at, \"shell\"]),\n cwd: cwd === undefined ? undefined : termOf(state, cwd, [...at, \"working-directory\"]),\n }),\n };\n }\n if (id !== undefined && typeof id !== \"string\") gh[\"id\"] = id;\n if (name !== undefined && typeof name !== \"string\") gh[\"name\"] = name;\n if (env !== undefined && !isPlain(env)) gh[\"env\"] = env;\n if (goOn !== undefined && typeof goOn !== \"boolean\") gh[\"continue\"] = goOn;\n const timeout = secondsOf(minutes);\n if (minutes !== undefined && timeout === undefined) gh[\"timeout\"] = minutes;\n gh[\"keys\"] = nonEmpty(rest);\n return {\n type: \"step\",\n value: defined({\n id: typeof id === \"string\" ? id : undefined,\n name: typeof name === \"string\" ? name : undefined,\n if: condition === undefined ? undefined : termOf(state, condition, [...at, \"if\"], true),\n do: call,\n env: isPlain(env) ? termsOf(state, env, [...at, \"env\"]) : undefined,\n continue: typeof goOn === \"boolean\" ? goOn : undefined,\n timeout,\n layers: layerOf(gh),\n }),\n };\n}\n\nfunction matrixOf(state: In, matrix: unknown, parallel: unknown, at: Path): { doc: unknown; parallelUsed: boolean } {\n if (!isPlain(matrix)) return { doc: termOf(state, matrix, at), parallelUsed: false };\n const { include, exclude, ...axes } = matrix;\n const whole = typeof parallel === \"number\" && Number.isInteger(parallel) && parallel >= 1;\n return {\n doc: {\n type: \"matrix\",\n value: defined({\n axes: termsOf(state, axes, at),\n include: include === undefined ? undefined : termOf(state, include, [...at, \"include\"]),\n exclude: exclude === undefined ? undefined : termOf(state, exclude, [...at, \"exclude\"]),\n parallel: whole ? parallel : undefined,\n }),\n },\n parallelUsed: whole,\n };\n}\n\nfunction jobOf(state: In, job: unknown, at: Path): unknown {\n if (!isPlain(job)) {\n state.issues.push({ level: \"warning\", at, message: \"A job is not a map. The layer keeps it.\" });\n return { type: \"job\", value: { steps: [], layers: { github: { raw: job } } } };\n }\n const { name, needs, if: condition, env, outputs, \"timeout-minutes\": minutes, strategy, steps, uses, with: inputs, secrets, ...rest } = job;\n const gh: Rec = {};\n let stepDocs: unknown[];\n if (Array.isArray(steps)) {\n if (uses !== undefined) rest[\"uses\"] = uses;\n if (inputs !== undefined) rest[\"with\"] = inputs;\n if (secrets !== undefined) rest[\"secrets\"] = secrets;\n stepDocs = steps.map((step, index) => stepOf(state, step, [...at, \"steps\", index]));\n } else if (typeof uses === \"string\") {\n gh[\"reusable\"] = true;\n if (steps !== undefined) gh[\"steps\"] = steps;\n if (inputs !== undefined && !isPlain(inputs)) gh[\"with\"] = inputs;\n if (secrets !== undefined && secrets !== \"inherit\" && !isPlain(secrets)) gh[\"secrets\"] = secrets;\n const call = {\n type: [\"github\", \"workflow\"],\n value: defined({\n uses,\n with: isPlain(inputs) ? termsOf(state, inputs, [...at, \"with\"]) : undefined,\n secrets: isPlain(secrets) ? termsOf(state, secrets, [...at, \"secrets\"]) : undefined,\n inherit: secrets === \"inherit\" ? true : undefined,\n }),\n };\n stepDocs = [{ type: \"step\", value: { do: call } }];\n } else {\n if (uses !== undefined) rest[\"uses\"] = uses;\n if (inputs !== undefined) rest[\"with\"] = inputs;\n if (secrets !== undefined) rest[\"secrets\"] = secrets;\n if (steps !== undefined) gh[\"steps\"] = steps;\n gh[\"noSteps\"] = true;\n stepDocs = [];\n }\n let needList: string[] | undefined;\n if (typeof needs === \"string\") {\n needList = [needs];\n gh[\"needsText\"] = true;\n } else if (Array.isArray(needs) && needs.every((need) => typeof need === \"string\")) needList = needs as string[];\n else if (needs !== undefined) gh[\"needs\"] = needs;\n let matrix: unknown;\n if (strategy !== undefined) {\n if (isPlain(strategy)) {\n const { matrix: m, \"max-parallel\": parallel, ...others } = strategy;\n const strategyRest: Rec = { ...others };\n if (m !== undefined) {\n const read = matrixOf(state, m, parallel, [...at, \"strategy\", \"matrix\"]);\n matrix = read.doc;\n if (!read.parallelUsed && parallel !== undefined) strategyRest[\"max-parallel\"] = parallel;\n } else if (parallel !== undefined) strategyRest[\"max-parallel\"] = parallel;\n gh[\"strategy\"] = strategyRest;\n } else gh[\"strategyRaw\"] = strategy;\n }\n if (name !== undefined && typeof name !== \"string\") gh[\"name\"] = name;\n if (env !== undefined && !isPlain(env)) gh[\"env\"] = env;\n if (outputs !== undefined && !isPlain(outputs)) gh[\"outputs\"] = outputs;\n const timeout = secondsOf(minutes);\n if (minutes !== undefined && timeout === undefined) gh[\"timeout\"] = minutes;\n gh[\"keys\"] = nonEmpty(rest);\n return {\n type: \"job\",\n value: defined({\n name: typeof name === \"string\" ? name : undefined,\n needs: needList,\n if: condition === undefined ? undefined : termOf(state, condition, [...at, \"if\"], true),\n matrix,\n env: isPlain(env) ? termsOf(state, env, [...at, \"env\"]) : undefined,\n steps: stepDocs,\n outputs: isPlain(outputs) ? termsOf(state, outputs, [...at, \"outputs\"]) : undefined,\n timeout,\n layers: layerOf(gh),\n }),\n };\n}\n\nconst TRIGGER_KIND: Readonly<Record<string, string>> = { workflow_dispatch: \"manual\", workflow_call: \"call\", schedule: \"schedule\" };\n\ninterface Triggers {\n readonly triggers: unknown[];\n readonly inputs: Rec;\n secrets?: Rec;\n outputs?: Rec;\n}\n\nfunction addInputs(found: Triggers, kind: string, inputs: Rec, layer: Rec): void {\n for (const [name, def] of Object.entries(inputs)) {\n const known = found.inputs[name];\n if (known === undefined) found.inputs[name] = { ...(isPlain(def) ? def : { value: def }), on: [kind] };\n else if (isPlain(known) && isPlain(def) && sameJson({ ...known, on: undefined }, { ...def, on: undefined }) && Array.isArray(known[\"on\"])) known[\"on\"].push(kind);\n else ((layer[\"inputs\"] ??= {}) as Rec)[name] = def;\n }\n}\n\nfunction triggersOf(state: In, on: unknown, gh: Rec): Triggers {\n const found: Triggers = { triggers: [], inputs: {} };\n let entries: [string, unknown][];\n if (typeof on === \"string\") {\n gh[\"on\"] = \"text\";\n entries = [[on, undefined]];\n } else if (Array.isArray(on)) {\n gh[\"on\"] = \"list\";\n entries = on.map((event) => [String(event), undefined]);\n } else if (isPlain(on)) entries = Object.entries(on);\n else {\n gh[\"on\"] = on === undefined ? \"none\" : \"raw\";\n if (on !== undefined) gh[\"onRaw\"] = on;\n entries = [];\n }\n for (const [event, config] of entries) {\n const at = [\"on\", event];\n const layer: Rec = { event };\n const kind = TRIGGER_KIND[event] ?? \"event\";\n if (kind === \"schedule\" && Array.isArray(config) && config.every((item) => isPlain(item) && typeof item[\"cron\"] === \"string\")) {\n config.forEach((item, index) => {\n const { cron, ...more } = item as Rec;\n found.triggers.push({ type: [\"trigger\", \"schedule\"], value: defined({ cron, layers: layerOf({ event, index, keys: nonEmpty(more) }) }) });\n });\n if (config.length === 0) found.triggers.push({ type: [\"trigger\", \"event\"], value: { event, layers: { github: { event, config } } } });\n continue;\n }\n const value: Rec = {};\n if (config === null) layer[\"config\"] = null;\n else if (isPlain(config)) {\n const rest: Rec = { ...config };\n if ((kind === \"manual\" || kind === \"call\") && isPlain(rest[\"inputs\"]) && Object.keys(rest[\"inputs\"]).length > 0) {\n addInputs(found, kind, rest[\"inputs\"], layer);\n delete rest[\"inputs\"];\n }\n if (kind === \"call\" && isPlain(rest[\"secrets\"])) {\n found.secrets = rest[\"secrets\"];\n delete rest[\"secrets\"];\n }\n if (kind === \"call\" && isPlain(rest[\"outputs\"]) && Object.values(rest[\"outputs\"]).every((def) => isPlain(def) && \"value\" in def)) {\n const outputs: Rec = {};\n const meta: Rec = {};\n for (const [name, def] of Object.entries(rest[\"outputs\"] as Record<string, Rec>)) {\n const { value: expr, ...more } = def;\n outputs[name] = termOf(state, expr, [...at, \"outputs\", name, \"value\"]);\n meta[name] = more;\n }\n found.outputs = outputs;\n layer[\"outputs\"] = meta;\n delete rest[\"outputs\"];\n }\n if (kind === \"event\" && Array.isArray(rest[\"types\"]) && rest[\"types\"].every((type) => typeof type === \"string\")) {\n value[\"types\"] = rest[\"types\"];\n delete rest[\"types\"];\n }\n layer[\"config\"] = rest;\n } else if (config !== undefined) layer[\"raw\"] = config;\n if (kind === \"event\") value[\"event\"] = event;\n found.triggers.push({ type: [\"trigger\", kind], value: { ...value, layers: { github: layer } } });\n }\n return found;\n}\n\n/**\n * This function reads the YAML of a GitHub workflow into a workflow document. It does not throw.\n *\n * - The parser is the `yaml` package. A text with anchors or aliases is refused.\n * - Each expression becomes a document, and the layer keeps its source text.\n * - Each key that the core does not model stays in the layer `github` of its workflow, job, step or trigger.\n * - The layer of the workflow keeps the source text, thus `toGitHub` changes only the edited values.\n *\n * @param text - The YAML text.\n * @param options - The name of the file and the workspace.\n * @returns The document and the problems.\n */\nexport function fromGitHub(text: string, options: ImportOptions = {}): ImportResult {\n const issues: ImportIssue[] = [];\n const parsed = parseDocument(text, { prettyErrors: false });\n for (const error of parsed.errors) issues.push({ level: \"error\", at: [], message: error.message });\n if (parsed.errors.length > 0) return { ok: false, issues };\n let shared = false;\n visit(parsed, (_key, node) => {\n if (isAlias(node) || (typeof node === \"object\" && node !== null && \"anchor\" in node && typeof node.anchor === \"string\" && node.anchor !== \"\")) {\n shared = true;\n return visit.BREAK;\n }\n return undefined;\n });\n if (shared) return { ok: false, issues: [{ level: \"error\", at: [], message: \"The workflow has YAML anchors or aliases. Version 1 of the add-on does not read them.\" }] };\n const source = parsed.toJS() as unknown;\n if (!isPlain(source)) return { ok: false, issues: [{ level: \"error\", at: [], message: \"A workflow is a map at the top.\" }] };\n const state: In = { issues, texts: {} };\n const { name, on, env, jobs, ...rest } = source;\n const gh: Rec = { format: GITHUB_LAYER };\n if (name === undefined) gh[\"unnamed\"] = true;\n else if (typeof name !== \"string\") gh[\"name\"] = name;\n const found = triggersOf(state, on, gh);\n const jobDocs: Rec = {};\n if (isPlain(jobs)) for (const [id, job] of Object.entries(jobs)) jobDocs[id] = jobOf(state, job, [\"jobs\", id]);\n else if (jobs !== undefined) gh[\"jobs\"] = jobs;\n else gh[\"noJobs\"] = true;\n if (env !== undefined && !isPlain(env)) gh[\"env\"] = env;\n gh[\"keys\"] = nonEmpty(rest);\n gh[\"texts\"] = state.texts;\n gh[\"source\"] = text;\n const value = defined({\n name: typeof name === \"string\" ? name : (options.file ?? \"workflow\"),\n workspace: options.workspace ?? \"default\",\n triggers: found.triggers,\n inputs: nonEmpty(found.inputs),\n secrets: found.secrets,\n env: isPlain(env) ? termsOf(state, env, [\"env\"]) : undefined,\n jobs: jobDocs,\n outputs: found.outputs,\n layers: { github: defined(gh) },\n });\n return { ok: true, doc: { type: \"workflow\", value }, issues };\n}\n\n// === Export ===\n\nconst githubOf = (value: unknown): Rec => {\n const layers = isPlain(value) ? value[\"layers\"] : undefined;\n const github = isPlain(layers) ? layers[\"github\"] : undefined;\n return isPlain(github) ? github : {};\n};\nconst valueOf = (doc: unknown): Rec => (isEnvelope(doc) && isPlain(doc.value) ? doc.value : {});\n\nfunction stepOut(state: Out, step: unknown): unknown {\n const value = valueOf(step);\n const gh = githubOf(value);\n if (\"raw\" in gh) return gh[\"raw\"];\n const call = valueOf(value[\"do\"]);\n const kind = isEnvelope(value[\"do\"]) && Array.isArray(value[\"do\"].type) ? value[\"do\"].type[1] : undefined;\n const out: Rec = {};\n if (value[\"id\"] !== undefined || gh[\"id\"] !== undefined) out[\"id\"] = value[\"id\"] ?? gh[\"id\"];\n if (value[\"name\"] !== undefined || gh[\"name\"] !== undefined) out[\"name\"] = value[\"name\"] ?? gh[\"name\"];\n if (value[\"if\"] !== undefined) out[\"if\"] = plainOf(state, value[\"if\"], true);\n if (kind === \"action\") {\n out[\"uses\"] = call[\"uses\"] ?? gh[\"uses\"];\n const inputs = plainsOf(state, call[\"with\"]) ?? gh[\"with\"];\n if (inputs !== undefined) out[\"with\"] = inputs;\n } else {\n if (call[\"script\"] !== undefined) out[\"run\"] = plainOf(state, call[\"script\"]);\n if (call[\"shell\"] !== undefined) out[\"shell\"] = plainOf(state, call[\"shell\"]);\n if (call[\"cwd\"] !== undefined) out[\"working-directory\"] = plainOf(state, call[\"cwd\"]);\n }\n const env = plainsOf(state, value[\"env\"]) ?? gh[\"env\"];\n if (env !== undefined) out[\"env\"] = env;\n if (value[\"continue\"] !== undefined || gh[\"continue\"] !== undefined) out[\"continue-on-error\"] = value[\"continue\"] ?? gh[\"continue\"];\n if (typeof value[\"timeout\"] === \"number\") out[\"timeout-minutes\"] = value[\"timeout\"] / 60;\n else if (gh[\"timeout\"] !== undefined) out[\"timeout-minutes\"] = gh[\"timeout\"];\n return { ...out, ...(isPlain(gh[\"keys\"]) ? gh[\"keys\"] : {}) };\n}\n\nfunction matrixOut(state: Out, matrix: unknown): { matrix: unknown; parallel?: unknown } {\n if (!isEnvelope(matrix) || matrix.type !== \"matrix\") return { matrix: plainOf(state, matrix) };\n const value = valueOf(matrix);\n const out: Rec = { ...(plainsOf(state, value[\"axes\"]) ?? {}) };\n if (value[\"include\"] !== undefined) out[\"include\"] = plainOf(state, value[\"include\"]);\n if (value[\"exclude\"] !== undefined) out[\"exclude\"] = plainOf(state, value[\"exclude\"]);\n return value[\"parallel\"] === undefined ? { matrix: out } : { matrix: out, parallel: value[\"parallel\"] };\n}\n\nfunction jobOut(state: Out, job: unknown): unknown {\n const value = valueOf(job);\n const gh = githubOf(value);\n if (\"raw\" in gh) return gh[\"raw\"];\n const out: Rec = {};\n if (value[\"name\"] !== undefined || gh[\"name\"] !== undefined) out[\"name\"] = value[\"name\"] ?? gh[\"name\"];\n if (Array.isArray(value[\"needs\"])) out[\"needs\"] = gh[\"needsText\"] === true && value[\"needs\"].length === 1 ? value[\"needs\"][0] : value[\"needs\"];\n else if (gh[\"needs\"] !== undefined) out[\"needs\"] = gh[\"needs\"];\n if (value[\"if\"] !== undefined) out[\"if\"] = plainOf(state, value[\"if\"], true);\n if (value[\"matrix\"] !== undefined || isPlain(gh[\"strategy\"])) {\n const strategy: Rec = { ...(isPlain(gh[\"strategy\"]) ? gh[\"strategy\"] : {}) };\n if (value[\"matrix\"] !== undefined) {\n const read = matrixOut(state, value[\"matrix\"]);\n strategy[\"matrix\"] = read.matrix;\n if (read.parallel !== undefined) strategy[\"max-parallel\"] = read.parallel;\n }\n out[\"strategy\"] = strategy;\n } else if (gh[\"strategyRaw\"] !== undefined) out[\"strategy\"] = gh[\"strategyRaw\"];\n const env = plainsOf(state, value[\"env\"]) ?? gh[\"env\"];\n if (env !== undefined) out[\"env\"] = env;\n const steps = Array.isArray(value[\"steps\"]) ? value[\"steps\"] : [];\n if (gh[\"reusable\"] === true && steps.length === 1) {\n const call = valueOf(valueOf(steps[0])[\"do\"]);\n out[\"uses\"] = call[\"uses\"];\n const inputs = plainsOf(state, call[\"with\"]) ?? gh[\"with\"];\n if (inputs !== undefined) out[\"with\"] = inputs;\n if (call[\"inherit\"] === true) out[\"secrets\"] = \"inherit\";\n else if (call[\"secrets\"] !== undefined) out[\"secrets\"] = plainsOf(state, call[\"secrets\"]);\n else if (gh[\"secrets\"] !== undefined) out[\"secrets\"] = gh[\"secrets\"];\n if (gh[\"steps\"] !== undefined) out[\"steps\"] = gh[\"steps\"];\n } else if (gh[\"noSteps\"] === true && steps.length === 0) {\n if (gh[\"steps\"] !== undefined) out[\"steps\"] = gh[\"steps\"];\n } else out[\"steps\"] = steps.map((step) => stepOut(state, step));\n const outputs = plainsOf(state, value[\"outputs\"]) ?? gh[\"outputs\"];\n if (outputs !== undefined) out[\"outputs\"] = outputs;\n if (typeof value[\"timeout\"] === \"number\") out[\"timeout-minutes\"] = value[\"timeout\"] / 60;\n else if (gh[\"timeout\"] !== undefined) out[\"timeout-minutes\"] = gh[\"timeout\"];\n return { ...out, ...(isPlain(gh[\"keys\"]) ? gh[\"keys\"] : {}) };\n}\n\nconst EVENT_OF: Readonly<Record<string, string>> = { manual: \"workflow_dispatch\", call: \"workflow_call\", schedule: \"schedule\" };\n\nfunction onOut(state: Out, workflow: Rec, gh: Rec): unknown {\n if (gh[\"on\"] === \"raw\") return gh[\"onRaw\"];\n const triggers = Array.isArray(workflow[\"triggers\"]) ? workflow[\"triggers\"] : [];\n const on: Rec = {};\n const inputs = isPlain(workflow[\"inputs\"]) ? workflow[\"inputs\"] : {};\n for (const trigger of triggers) {\n if (!isEnvelope(trigger) || !Array.isArray(trigger.type)) continue;\n const kind = String(trigger.type[1]);\n const value = valueOf(trigger);\n const layer = githubOf(value);\n const event = typeof layer[\"event\"] === \"string\" ? layer[\"event\"] : kind === \"event\" ? String(value[\"event\"]) : (EVENT_OF[kind] ?? kind);\n if (kind === \"schedule\") {\n const list = Array.isArray(on[event]) ? (on[event] as unknown[]) : [];\n list.push({ cron: value[\"cron\"], ...(isPlain(layer[\"keys\"]) ? layer[\"keys\"] : {}) });\n on[event] = list;\n continue;\n }\n if (\"raw\" in layer) {\n on[event] = layer[\"raw\"];\n continue;\n }\n const config: Rec = isPlain(layer[\"config\"]) ? { ...layer[\"config\"] } : {};\n if (Array.isArray(value[\"types\"])) config[\"types\"] = value[\"types\"];\n if (kind === \"manual\" || kind === \"call\") {\n const own: Rec = {};\n for (const [name, def] of Object.entries(inputs)) {\n if (!isPlain(def)) continue;\n const { on: takers, ...rest } = def;\n if (takers === undefined || (Array.isArray(takers) && takers.includes(kind))) own[name] = \"value\" in rest && Object.keys(rest).length === 1 ? rest[\"value\"] : rest;\n }\n Object.assign(own, isPlain(layer[\"inputs\"]) ? layer[\"inputs\"] : {});\n if (Object.keys(own).length > 0) config[\"inputs\"] = own;\n }\n if (kind === \"call\") {\n if (workflow[\"secrets\"] !== undefined) config[\"secrets\"] = workflow[\"secrets\"];\n if (isPlain(workflow[\"outputs\"])) {\n const meta = isPlain(layer[\"outputs\"]) ? layer[\"outputs\"] : {};\n config[\"outputs\"] = Object.fromEntries(\n Object.entries(workflow[\"outputs\"]).map(([name, expr]) => [name, { ...(isPlain(meta[name]) ? meta[name] : {}), value: plainOf(state, expr) }]),\n );\n }\n }\n on[event] = layer[\"config\"] === null && Object.keys(config).length === 0 ? null : layer[\"config\"] === undefined && Object.keys(config).length === 0 ? null : config;\n }\n if (gh[\"on\"] === \"text\" || gh[\"on\"] === \"list\") {\n const events = Object.keys(on);\n if (events.every((event) => on[event] === null)) return gh[\"on\"] === \"text\" && events.length === 1 ? events[0] : events;\n }\n return on;\n}\n\n/**\n * This function writes a workflow document as the plain value of a GitHub workflow: the value that the YAML of the\n * file gives. Each expression gives its source text when its document did not change.\n *\n * @param doc - The workflow document.\n * @returns The value.\n */\nexport function toGitHubObject(doc: unknown): Rec {\n const workflow = valueOf(doc);\n const gh = githubOf(workflow);\n const state: Out = { texts: isPlain(gh[\"texts\"]) ? (gh[\"texts\"] as Record<string, string[]>) : {}, used: {} };\n const out: Rec = {};\n if (gh[\"unnamed\"] !== true) out[\"name\"] = gh[\"name\"] ?? workflow[\"name\"];\n if (gh[\"on\"] !== \"none\") out[\"on\"] = onOut(state, workflow, gh);\n Object.assign(out, isPlain(gh[\"keys\"]) ? gh[\"keys\"] : {});\n const env = plainsOf(state, workflow[\"env\"]) ?? gh[\"env\"];\n if (env !== undefined) out[\"env\"] = env;\n if (gh[\"noJobs\"] !== true) {\n out[\"jobs\"] = isPlain(workflow[\"jobs\"]) ? Object.fromEntries(Object.entries(workflow[\"jobs\"]).map(([id, job]) => [id, jobOut(state, job)])) : gh[\"jobs\"];\n }\n return out;\n}\n\n/** This function changes the YAML tree at a path from the value `before` to the value `after`, and keeps the rest. */\nfunction patch(tree: Document, path: Path, before: unknown, after: unknown): void {\n if (sameJson(before, after)) return;\n if (isPlain(before) && isPlain(after)) {\n for (const key of Object.keys(before)) if (!Object.hasOwn(after, key)) tree.deleteIn([...path, key]);\n for (const [key, value] of Object.entries(after)) {\n if (Object.hasOwn(before, key)) patch(tree, [...path, key], before[key], value);\n else tree.setIn([...path, key], tree.createNode(value));\n }\n return;\n }\n const node = path.length === 0 ? tree.contents : tree.getIn(path, true);\n if (Array.isArray(before) && Array.isArray(after) && isSeq(node)) {\n let head = 0;\n while (head < before.length && head < after.length && sameJson(before[head], after[head])) head++;\n let tail = 0;\n while (tail < before.length - head && tail < after.length - head && sameJson(before[before.length - 1 - tail], after[after.length - 1 - tail])) tail++;\n const removed = before.length - head - tail;\n const added = after.length - head - tail;\n if (removed === added) {\n for (let index = head; index < head + added; index++) patch(tree, [...path, index], before[index], after[index]);\n return;\n }\n node.items.splice(head, removed, ...after.slice(head, head + added).map((item) => tree.createNode(item)));\n return;\n }\n if (isScalar(node) && !isPlain(after) && !Array.isArray(after)) {\n node.value = after;\n return;\n }\n if (path.length === 0) tree.contents = tree.createNode(after);\n else tree.setIn(path, tree.createNode(after));\n}\n\n/**\n * This function writes a workflow document as the YAML of a GitHub workflow.\n *\n * - A document from `fromGitHub` keeps its source text in its layer. When the document did not change, the result is\n * that text, byte for byte.\n * - After an edit, the export changes only the edited values of the source tree. The comments and the forms of the\n * other values stay.\n * - A document with no source text gives new YAML.\n *\n * @param doc - The workflow document.\n * @returns The YAML text.\n */\nexport function toGitHub(doc: unknown): string {\n const gh = githubOf(valueOf(doc));\n const after = toGitHubObject(doc);\n if (typeof gh[\"source\"] === \"string\") {\n const tree = parseDocument(gh[\"source\"]);\n const before = tree.toJS() as unknown;\n if (sameJson(before, after)) return gh[\"source\"];\n patch(tree, [], before, after);\n return tree.toString({ lineWidth: 0, nullStr: \"\" });\n }\n return stringify(after, { lineWidth: 0, nullStr: \"\" });\n}\n","import { type WorkflowCheckOptions, type WorkflowIssue, checkWorkflow } from \"@mark1russell7/workflow\";\nimport { scriptInjections } from \"./inject.ts\";\nimport { GITHUB_CALLS, GITHUB_NAMES, githubMachine } from \"./language.ts\";\n\nexport { type ReadTrust, moveToEnv, readTrust, scriptInjections } from \"./inject.ts\";\nexport { GITHUB_FUNCTIONS, parseExpression, printExpression, splitText } from \"./expression.ts\";\nexport type { ExpressionIssue, ExpressionResult, TextPart } from \"./expression.ts\";\nexport { GITHUB_CALLS, GITHUB_CONTEXT_CHOICES, GITHUB_LANGUAGE, GITHUB_NAMES, GITHUB_OPS, GITHUB_VERSION, githubMachine } from \"./language.ts\";\nexport { GITHUB_LAYER, fromGitHub, readText, sameJson, toGitHub, toGitHubObject } from \"./yaml.ts\";\nexport type { ImportIssue, ImportOptions, ImportResult, TextValue } from \"./yaml.ts\";\n\n/**\n * This function checks a workflow from GitHub with the machine of the add-on. The contexts of GitHub are names, an\n * input of a `github` call can hold a secret, and the secrets of the repository need no declaration. A script that\n * reads an untrusted value with `${{ }}` is an error (`scriptInjections`).\n *\n * @param doc - The workflow document.\n * @param options - More options of `checkWorkflow`.\n * @returns The problems.\n */\nexport function checkGitHub(doc: unknown, options: WorkflowCheckOptions = {}): readonly WorkflowIssue[] {\n const issues = checkWorkflow(doc, {\n machine: githubMachine(),\n openSecrets: true,\n ...options,\n hostNames: [...GITHUB_NAMES, ...(options.hostNames ?? [])],\n callNamespaces: [...GITHUB_CALLS, ...(options.callNamespaces ?? [])],\n });\n return [...issues, ...scriptInjections(doc)];\n}\n"],"mappings":";;;;;;;;AAgBA,MAAM,gCAAqC,IAAI,IAAI;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;;;;;AAaD,SAAgB,UAAU,MAAqC;CAC7D,IAAI,KAAK,OAAO,WAAW,cAAc,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,KAAK,GAAG,CAAC,GAA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7/workflow-github",
3
- "version": "0.0.0-bootstrap.0",
4
- "description": "A placeholder that lets npm trust the release workflow of mark1russell7/coeval. Use a later version.",
4
+ "version": "0.1.0",
5
+ "type": "module",
6
+ "main": "./build/index.js",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./build/index.d.ts",
10
+ "default": "./build/index.js"
11
+ },
12
+ "./package.json": "./package.json"
13
+ },
14
+ "files": [
15
+ "build",
16
+ "src",
17
+ "!src/**/*.test.ts"
18
+ ],
19
+ "sideEffects": false,
20
+ "devDependencies": {
21
+ "@mark1russell7/cue": "^2.1.1",
22
+ "@types/node": "^26.6.4",
23
+ "@vitest/coverage-v8": "^5.0.3",
24
+ "typescript": "^7.0.2",
25
+ "vitest": "^5.0.3"
26
+ },
27
+ "description": "The GitHub Actions add-on of the workflow language: it reads and writes the YAML of GitHub, and each GitHub expression becomes a document.",
28
+ "dependencies": {
29
+ "@mark1russell7/coeval": "0.39.1",
30
+ "@mark1russell7/workflow": "0.1.0",
31
+ "yaml": "^2.9.1"
32
+ },
33
+ "license": "MIT",
5
34
  "repository": {
6
35
  "type": "git",
7
- "url": "git+https://github.com/mark1russell7/coeval.git"
36
+ "url": "git+https://github.com/mark1russell7/coeval.git",
37
+ "directory": "packages/workflow-github"
8
38
  },
9
- "license": "MIT",
10
39
  "publishConfig": {
11
40
  "access": "public"
12
- }
13
- }
41
+ },
42
+ "scripts": {
43
+ "build": "tsdown",
44
+ "test": "vitest run",
45
+ "test:watch": "vitest",
46
+ "typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.test.json"
47
+ },
48
+ "types": "./build/index.d.ts"
49
+ }