typeglish 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.
- package/LICENSE +201 -0
- package/NOTICE +13 -0
- package/README.md +301 -0
- package/dist/chunk-3NQ3VYO6.js +566 -0
- package/dist/chunk-3NQ3VYO6.js.map +1 -0
- package/dist/chunk-KRYC4OTL.js +3573 -0
- package/dist/chunk-KRYC4OTL.js.map +1 -0
- package/dist/chunk-NLQIL5WD.js +25 -0
- package/dist/chunk-NLQIL5WD.js.map +1 -0
- package/dist/chunk-PR4QN5HX.js +39 -0
- package/dist/chunk-PR4QN5HX.js.map +1 -0
- package/dist/chunk-PXAMTGYY.js +3 -0
- package/dist/chunk-PXAMTGYY.js.map +1 -0
- package/dist/chunk-VMACILYN.js +140 -0
- package/dist/chunk-VMACILYN.js.map +1 -0
- package/dist/chunk-Y64EAEYB.js +10919 -0
- package/dist/chunk-Y64EAEYB.js.map +1 -0
- package/dist/chunk-YH4ZLQ4G.js +4260 -0
- package/dist/chunk-YH4ZLQ4G.js.map +1 -0
- package/dist/chunk-ZKMHZHID.js +56 -0
- package/dist/chunk-ZKMHZHID.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +447 -0
- package/dist/cli.js.map +1 -0
- package/dist/compile-DViQS2oG.d.ts +310 -0
- package/dist/diagnostics-BWJ_oMd8.d.ts +49 -0
- package/dist/exhaustiveness-VBVWCX5W.js +123 -0
- package/dist/exhaustiveness-VBVWCX5W.js.map +1 -0
- package/dist/index-Df_QnTgq.d.ts +313 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp.d.ts +11 -0
- package/dist/mcp.js +36378 -0
- package/dist/mcp.js.map +1 -0
- package/dist/monaco.css +46 -0
- package/dist/monaco.d.ts +43 -0
- package/dist/monaco.js +971 -0
- package/dist/monaco.js.map +1 -0
- package/dist/node.d.ts +21 -0
- package/dist/node.js +8 -0
- package/dist/node.js.map +1 -0
- package/dist/spell-node.d.ts +8 -0
- package/dist/spell-node.js +23 -0
- package/dist/spell-node.js.map +1 -0
- package/dist/spell.d.ts +18 -0
- package/dist/spell.js +4 -0
- package/dist/spell.js.map +1 -0
- package/dist/z3-MWU3GSVT.js +5 -0
- package/dist/z3-MWU3GSVT.js.map +1 -0
- package/package.json +160 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/codes.ts","../src/core/agent-doc.ts","../src/lib/build.ts","../src/lib/project.ts","../src/core/score.ts","../src/lib/score.ts"],"names":[],"mappings":";;;;;;;;;AA0BO,IAAM,gBAAA,GAA6C;AAAA,EACxD,mBAAA,EAAqB,EAAE,QAAA,EAAU,MAAA,EAAQ,SAAS,2DAAA,EAA4D;AAAA,EAC9G,mBAAA,EAAqB,EAAE,QAAA,EAAU,MAAA,EAAQ,SAAS,iDAAA,EAAkD;AAAA,EACpG,mBAAA,EAAqB,EAAE,QAAA,EAAU,MAAA,EAAQ,SAAS,mEAAA,EAAoE;AAAA,EACtH,yBAAA,EAA2B,EAAE,QAAA,EAAU,OAAA,EAAS,SAAS,8DAAA,EAA+D;AAAA,EACxH,4BAAA,EAA8B,EAAE,QAAA,EAAU,MAAA,EAAQ,SAAS,kHAAA,EAAmH;AAAA,EAC9K,sBAAA,EAAwB,EAAE,QAAA,EAAU,MAAA,EAAQ,SAAS,2FAAA,EAAuF;AAAA,EAC5I,qBAAA,EAAuB,EAAE,QAAA,EAAU,MAAA,EAAQ,SAAS,wGAAA,EAAyG;AAAA,EAC7J,sBAAA,EAAwB,EAAE,QAAA,EAAU,MAAA,EAAQ,SAAS,iDAAA,EAAkD;AAAA,EACvG,sBAAA,EAAwB,EAAE,QAAA,EAAU,MAAA,EAAQ,SAAS,6CAAA,EAA8C;AAAA,EACnG,qBAAA,EAAuB,EAAE,QAAA,EAAU,MAAA,EAAQ,SAAS,+CAAA,EAAgD;AAAA,EACpG,iBAAA,EAAmB,EAAE,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AAC,CAAA;AACpJ,IAAA,EAAA,GAAK,IAAA;AAAA,EACP;AAEA,EAAA,OAAO,EAAE,IAAA,EAAM,WAAA,CAAY,MAAA,EAAQ,EAAE,WAAA,EAAa,CAAA,EAAG,KAAA,EAAO,EAAE,EAAA,EAAI,KAAA,EAAM,EAAE;AAC5E","file":"chunk-3NQ3VYO6.js","sourcesContent":["// ── The diagnostic-code registry — the SSOT for the rule TAXONOMY (CLAUDE.md invariant #1) ────────────\n// Every code the checker can emit, in one catalog: its canonical severity and a one-line summary. The check\n// LOGIC stays in its own module (structure.ts, logic.ts, charset.ts, ...) — a rule is a function, not data —\n// but the TAXONOMY lives here, so the codes stop being scattered string literals. The syntax page lists every\n// rule from this registry, and codes.test.ts scans the source and locks it: a code emitted without being\n// registered, or a registered code no longer emitted, fails CI. Same ratchet as the lexicon.\n//\n// MESSAGE DOCTRINE — every human-facing string (a diagnostic `message`, a hover row, a panel line) must\n// answer, in the message itself: WHAT fired, WHY it matters (what the compiler can or cannot do because\n// of it), and — when a rewrite exists — WHAT TO DO. The reader is as often an agent mid-edit as a person:\n// it acts on exactly what the text says, so a term of art (residual, entailment, ablation Δ) never\n// appears without its plain-English meaning in the same clause. If explaining a message requires the\n// docs, the message is wrong.\nimport type { DocTable } from './lexicon';\n\nexport type Severity = 'error' | 'warn' | 'info';\n\nexport interface CodeInfo {\n /** Canonical severity. `error` gates wellFormed and caps the grade at F; `warn` / `info` advise only.\n * (A few emit sites pick severity dynamically; this records the typical value.) */\n severity: Severity;\n /** One line: what the rule flags. */\n summary: string;\n}\n\n/** Every diagnostic code, by category. Locked to the compiler's emitted codes by codes.test.ts. */\nexport const DIAGNOSTIC_CODES: Record<string, CodeInfo> = {\n 'clarity/dead-rule': { severity: 'warn', summary: 'A rule whose condition can never hold, so it never fires.' },\n 'clarity/duplicate': { severity: 'warn', summary: 'Two rules say the same thing; one is redundant.' },\n 'config/bad-number': { severity: 'warn', summary: 'A numeric config param (max_tokens, temperature) is not a number.' },\n 'config/dangling-service': { severity: 'error', summary: \"A config param's `via` names a $SERVICE that is not defined.\" },\n 'config/missing-conditional': { severity: 'warn', summary: 'A glish cross-field rule ($REQUIRE X when Y is Z) is unmet: the condition holds but the required kind is absent.' },\n 'config/missing-param': { severity: 'warn', summary: \"A config kind is missing a required param (e.g. model's via) — a nudge, not a block.\" },\n 'config/out-of-range': { severity: 'warn', summary: \"A config param value violates its declared refinement (a numeric range, character length, or pattern).\" },\n 'config/unknown-model': { severity: 'warn', summary: 'The $CONFIG model is not a recognized model id.' },\n 'config/unknown-param': { severity: 'info', summary: \"A config param is not in the kind's schema.\" },\n 'grammar/double-word': { severity: 'warn', summary: 'A word repeated back-to-back, like \"the the\".' },\n 'grammar/spacing': { severity: 'info', summary: 'Irregular spacing around punctuation.' },\n 'grammar/standalone-i': { severity: 'warn', summary: 'Lowercase \"i\" as a pronoun; write \"I\".' },\n 'import/cycle': { severity: 'error', summary: 'Two $IMPORT files reference each other in a loop.' },\n 'import/missing-export': { severity: 'error', summary: 'An imported section or anchor does not exist in the target file.' },\n 'import/missing-file': { severity: 'error', summary: 'An $IMPORT file path resolves to no file.' },\n 'import/missing-section': { severity: 'error', summary: 'A {file.section} reference names a section the file lacks.' },\n 'import/nested': { severity: 'error', summary: 'An imported file itself imports another; nesting is not allowed.' },\n 'import/unfilled-requirement': { severity: 'warn', summary: 'An imported file needs a variable the import site did not fill.' },\n 'import/unused-file': { severity: 'warn', summary: 'An $IMPORT file is declared but never referenced.' },\n 'logic/action-count': { severity: 'error', summary: 'One action is given two different counts (call five tools vs call six tools).' },\n 'logic/cardinality': { severity: 'error', summary: 'Two counts for one set cannot both hold (there is only one X vs there are many Xs).' },\n 'logic/contradiction': { severity: 'error', summary: 'Two rules provably conflict, like MUST X versus NEVER X.' },\n 'logic/definite-ambiguous': { severity: 'error', summary: 'A definite \"the <symbol>\" is bound to two or more different declared symbols.' },\n 'logic/definite-undeclared': { severity: 'error', summary: 'A definite \"the <symbol>\" names a symbol kind the file never declares.' },\n 'logic/exclusivity': { severity: 'error', summary: 'An \"only\" rule is exclusive, but another rule adds a member outside it.' },\n 'logic/insufficient-set': { severity: 'error', summary: 'A directive needs more items than the declared set holds (call five tools vs there is only one tool).' },\n 'logic/majority': { severity: 'error', summary: 'Two \"most\" claims about the same set cannot both hold.' },\n 'logic/numeric': { severity: 'error', summary: 'A numeric impossibility (at most 3 vs at least 5), proven by Z3.' },\n 'logic/order': { severity: 'error', summary: 'Steps require an impossible ordering.' },\n 'logic/quantifier': { severity: 'error', summary: 'Quantified statements provably conflict (all / some / no, or a universal vs a specific case).' },\n 'logic/quantifier-strength': { severity: 'error', summary: 'One quantity per fact — a quantified claim restates one it already entails (all vs some).' },\n 'logic/redeclaration': { severity: 'error', summary: 'A name is bound to two conflicting values.' },\n 'logic/syllogism': { severity: 'error', summary: 'A transitive quantifier chain is contradictory (all A are B, all B are C, no A is C).' },\n 'prompt/determinable-expect': { severity: 'info', summary: 'A judge-scored expectation that has an exact deterministic form.' },\n 'prompt/hedging': { severity: 'info', summary: 'A hedge (try to, if possible) softens an instruction; commit to a modal.' },\n 'prompt/unmeasurable': { severity: 'warn', summary: 'A rule with no concrete, checkable action or bound.' },\n 'prompt/untested-rule': { severity: 'info', summary: 'No $TEST case exercises this rule, so its behavioral impact cannot be measured.' },\n 'prompt/vague': { severity: 'info', summary: 'Vague wording the model can read many ways.' },\n 'security/injection': { severity: 'warn', summary: 'Text resembling a prompt-injection pattern.' },\n 'security/leaked-secret': { severity: 'error', summary: 'A credential literal in the prompt; secrets never live in the file.' },\n 'spelling/typo': { severity: 'warn', summary: 'A likely misspelling, with a suggested correction.' },\n 'spelling/unknown-word': { severity: 'info', summary: 'A word the dictionary does not recognize.' },\n 'structure/bad-indent': { severity: 'error', summary: 'Indentation does not mirror the section nesting (2 spaces per level).' },\n 'structure/bare-tool-ref': { severity: 'error', summary: 'An exact tool name in bare prose; point it with @[name], or quote it to speak the name as text.' },\n 'structure/curly-quote': { severity: 'error', summary: 'A curly quote or apostrophe; only ASCII quotes bind.' },\n 'structure/duplicate-term': { severity: 'warn', summary: 'A definition term repeats within one list.' },\n 'structure/em-dash': { severity: 'error', summary: 'An em or en dash splices a line; split it or use a comma.' },\n 'structure/half-quoted-literal': { severity: 'error', summary: 'A literal-zone tag missing one of its quotes; the name is quoted whole: <\"name\">.' },\n 'structure/heading-outside-section': { severity: 'warn', summary: 'A # heading sits outside the XML sections the prompt uses.' },\n 'structure/inline-marker': { severity: 'error', summary: 'A \"::\" definition marker used inline; it opens an entry at a line head — nest it as a \"- \" sub-definition, or quote it as a sample.' },\n 'structure/loose-content': { severity: 'warn', summary: 'Content outside any section once XML tags are used.' },\n 'structure/misplaced-annotation': { severity: 'warn', summary: 'A @@ note trailing after content instead of above it.' },\n 'structure/missing-period': { severity: 'error', summary: 'An unterminated statement; end with . ! ? or a lead-in colon.' },\n 'structure/one-of-colon': { severity: 'error', summary: '\"one of\" took a colon; the quantifier never does.' },\n 'structure/phantom-column': { severity: 'error', summary: 'A run of two or more interior spaces doing alignment structure.' },\n 'structure/retired-brace-ref': { severity: 'error', summary: 'Bare {braces} / [squares] are prose now: use @{name} to reference a declared name or import.' },\n 'structure/retired-literal-sigil': { severity: 'error', summary: 'The old <=name> literal-zone spelling; the sigil is the quote pair now: <\"name\">.' },\n 'structure/special-character': { severity: 'error', summary: 'A typographic or decorative codepoint outside the ASCII plane.' },\n 'structure/stacked-annotation': { severity: 'error', summary: 'A @@ note directly above another @@ note.' },\n 'structure/tab': { severity: 'error', summary: 'A tab; the indent unit is 2 spaces.' },\n 'structure/trailing-space': { severity: 'error', summary: 'Trailing whitespace at the end of a line.' },\n 'structure/unattached-annotation': { severity: 'error', summary: 'A @@ note whose next line is not a statement.' },\n 'structure/undefined-ref': { severity: 'error', summary: 'An @{name} pointer resolving to nothing declared.' },\n 'structure/undefined-tool-inline': { severity: 'error', summary: 'A tool used inline but never imported or defined.' },\n 'structure/wrapped-definition': { severity: 'error', summary: 'A hard-wrapped definition continuation; one statement per line.' },\n 'structure/wrapped-fragment': { severity: 'warn', summary: 'A line that reads as a hard-wrapped continuation of the one above.' },\n 'style/quoted-prose': { severity: 'warn', summary: 'A whole-line quote hides a statement from the checker.' },\n 'style/wordy': { severity: 'info', summary: 'Wordy phrasing a tighter form would carry.' },\n 'testfile/duplicate-case': { severity: 'error', summary: 'A case id is defined both inline and in the sibling .test.tg.' },\n 'testfile/empty': { severity: 'warn', summary: 'A discovered .test.tg declares no $TEST or $EXAMPLE blocks.' },\n 'testfile/missing-prompt': { severity: 'error', summary: 'A .test.tg has no sibling .tg prompt to test.' },\n 'typeglish/if-then': { severity: 'warn', summary: 'A conditional (IF / WHEN / UNLESS / WHILE / …) opened without its THEN.' },\n};\n\n/** True when a code gates the compile (grade F). Derived — errors block, warnings and info advise. */\nexport function blocks(code: string): boolean {\n return DIAGNOSTIC_CODES[code]?.severity === 'error';\n}\n\n/** The reference-page view — GENERATED into public/syntax.html (syntax-doc.ts) from the registry above. */\nexport const DIAGNOSTICS_DOC: DocTable = {\n id: 'diagnostics',\n title: 'Diagnostics',\n lead:\n 'Every check the compiler can emit. **Errors** gate compilation and cap the grade at F; **warnings** and **info** advise but never block. The check logic lives in the compiler; this catalog is generated from the code registry (`src/core/codes.ts`) and locked to the codes the source actually emits.',\n headers: ['Code', 'Level', 'Flags'],\n rows: Object.entries(DIAGNOSTIC_CODES)\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([code, info]): [string, string, string] => [`\\`${code}\\``, info.severity, info.summary]),\n};\n","// The agent-facing language reference — GENERATED from the SSOT modules, exactly like syntax-doc.ts:\n// the lexicon (operators + doc tables + authoring snippets), guards.ts (conditional-keyword semantics),\n// type-system.ts (the type grammar), config-schema.ts ($CONFIG kinds), charset.ts (the ASCII rules), and\n// codes.ts (the gating diagnostics). One markdown document a coding agent reads to WRITE valid TypeGlish\n// and to run the author → check → score → build → deploy loop.\n//\n// `scripts/gen-agent-docs.ts` writes the committed copies (the Claude Code plugin skill's reference and\n// docs/agents/TYPEGLISH.md); agent-doc.test.ts freshness-locks both and welds the content to the SSOTs.\n// `typeglish reference` prints this at runtime — which is why the canonical example is EMBEDDED (the\n// shipped bin has no eval/ corpus) and drift-locked against the corpus file by the test instead.\n\nimport { CHARSET_DOC } from './charset';\nimport { DIAGNOSTIC_CODES, blocks } from './codes';\nimport { BUILTIN_CONFIG_SCHEMA } from './config-schema';\nimport { GUARDS } from './guards';\nimport {\n BLOCK_SNIPPETS,\n DIRECTIVE_SNIPPETS,\n DOC_TABLES,\n OPERATOR_GROUPS,\n STATEMENT_SNIPPETS,\n type DocTable,\n type Snippet,\n} from './lexicon';\nimport { PRIM_TYPES, REFINEMENT_KEYWORDS } from './type-system';\n\n/** Markdown-table cells: the one construct that breaks on a raw pipe. */\nconst cell = (s: string): string => s.replace(/\\|/g, '\\\\|');\n\n/** LSP snippet template → readable fill-in form: `PREFER ${1:this} OVER ${2:that}` → `PREFER <this> OVER <that>`. */\nconst template = (s: string): string => s.replace(/\\$\\{\\d+:([^}]*)\\}/g, '<$1>').replace(/\\\\\\$/g, '$').replace(/\\\\\\}/g, '}');\n\nfunction mdTable(t: DocTable): string {\n const out: string[] = [`## ${t.title}`, ''];\n if (t.lead !== undefined) out.push(t.lead, '');\n out.push(`| ${t.headers.map(cell).join(' | ')} |`);\n out.push(`|${t.headers.map(() => '---').join('|')}|`);\n for (const r of t.rows) out.push(`| ${r.map(cell).join(' | ')} |`);\n return out.join('\\n');\n}\n\nfunction operators(): string {\n const out: string[] = [\n '## Operators',\n '',\n '**Every operator is case-insensitive** (`must` = `MUST` = `Must`). Case is never the operator/prose distinction — quote a word to keep it literal prose.',\n '',\n ];\n for (const g of OPERATOR_GROUPS) {\n out.push(`- **${g.label}** — ${g.tokens.map((t) => `\\`${t}\\``).join(' ')}`);\n out.push(` ${g.description} Example: ${g.example}`);\n }\n return out.join('\\n');\n}\n\nfunction conditionalKeywords(): string {\n const byRole = (role: string): string[] => Object.entries(GUARDS).filter(([, g]) => g.role === role).map(([k]) => k);\n const openers = Object.entries(GUARDS).filter(([, g]) => g.role === 'guard' && g.negate !== true).map(([k]) => k);\n const negated = Object.entries(GUARDS).filter(([, g]) => g.role === 'guard' && g.negate === true).map(([k]) => k);\n return [\n '## Conditional keywords (the prose plane)',\n '',\n 'A bare-prose conditional is a statement the MODEL weighs at runtime; a `$IF` chain (see the table above) is resolved by the COMPILER and losing arms never reach the model. The keywords and what each builds:',\n '',\n `- Open a guard: ${openers.map((k) => `\\`${k}\\``).join(' ')}`,\n `- Open a NEGATED guard (\\`UNLESS x\\` = \\`IF NOT x\\`): ${negated.map((k) => `\\`${k}\\``).join(' ')}`,\n `- Consequence separator: ${byRole('separator').map((k) => `\\`${k}\\``).join(' ')}`,\n `- Else-branch: ${byRole('else').map((k) => `\\`${k}\\``).join(' ')}`,\n `- Iterate: ${byRole('iterate').map((k) => `\\`${k}\\``).join(' ')}`,\n ].join('\\n');\n}\n\nfunction types(): string {\n return [\n '## Types (machine-plane domains)',\n '',\n 'One shared English type grammar for `$TOOL` params and `$REQUIRE variable` domains:',\n '',\n `- Base types (one spelling each): ${[...PRIM_TYPES].map((t) => `\\`${t}\\``).join(' ')}`,\n '- Composites: `one of a, b` (pick one) · `any of a, b` (pick many) · `list of strings` (open array) · `optional …` · `default to 10`',\n `- Refinements: ${REFINEMENT_KEYWORDS.map((k) => `\\`${k}\\``).join(' ')} — \\`number between 0 and 2\\`, \\`string up to 80 characters\\`, \\`string matching /^[A-Z]{2}$/\\``,\n ].join('\\n');\n}\n\nfunction configKinds(): string {\n const out: string[] = [\n '## Built-in `$CONFIG` kinds',\n '',\n 'A project `glish.tgc` (discovered by walking up from the `.tg` file) can extend these; unknown kinds are open, not errors.',\n '',\n ];\n for (const [kind, schema] of Object.entries(BUILTIN_CONFIG_SCHEMA)) {\n const value = schema.values !== undefined ? `one of ${schema.values.join(', ')}` : (schema.placeholder ?? 'value');\n out.push(`- \\`$CONFIG ${kind} ${value}\\` — ${schema.detail}`);\n for (const [param, p] of Object.entries(schema.params ?? {})) {\n out.push(` - \\`- ${param}:: …\\` — ${p.detail}${p.required === true ? ' (required)' : ''}`);\n }\n }\n return out.join('\\n');\n}\n\nfunction snippets(title: string, list: Snippet[]): string[] {\n return [`### ${title}`, '', ...list.map((s) => `- \\`${template(s.snippet ?? s.insert).replace(/\\n/g, '` ⏎ `')}\\` — ${s.detail}`)];\n}\n\nfunction authoringTemplates(): string {\n return [\n '## Authoring templates',\n '',\n 'Fill-in shapes (`<placeholder>` marks the blanks; `⏎` separates lines of one template):',\n '',\n ...snippets('Statements', STATEMENT_SNIPPETS),\n '',\n ...snippets('Blocks', BLOCK_SNIPPETS),\n '',\n ...snippets('Commands', DIRECTIVE_SNIPPETS),\n ].join('\\n');\n}\n\nfunction gatingCodes(): string {\n const rows = Object.entries(DIAGNOSTIC_CODES)\n .filter(([code]) => blocks(code))\n .sort(([a], [b]) => (a < b ? -1 : 1));\n return [\n '## Reading checker output — the codes that BLOCK compilation',\n '',\n 'Every diagnostic carries `{code, severity, range, message}` and often a machine-applicable `fix`. Errors below block `build`; warnings/info are advisory (list them with `typeglish --explain <category>`; explain any code with `typeglish --explain <code>`).',\n '',\n '| Code | What it proves |',\n '|---|---|',\n ...rows.map(([code, info]) => `| \\`${code}\\` | ${cell(info.summary)} |`),\n ].join('\\n');\n}\n\n/** The embedded canonical prompt — byte-identical to eval/score-corpus/good/support-agent.tg (the corpus file\n * the CI score gate dogfoods); agent-doc.test.ts locks the two together so neither can drift. Embedded rather\n * than read because `typeglish reference` ships in the bin, where no corpus exists. */\nexport const CANONICAL_EXAMPLE = `# Role\n@@ role: general Acme support, with hard pricing and escalation rails\nYou are a customer support agent for Acme, a SaaS analytics company.\n\n# Constraints\n@@ no_prices: quoted prices go stale and bind the company — never state one\n- NEVER state a specific price.\n@@ pricing_route: pricing intent belongs to sales\n- ALWAYS direct pricing questions to the sales team.\n@@ brevity: three sentences keeps support replies scannable\n- MUST keep every response to at most 3 sentences.\n@@ order_number: the order number unlocks account context\n- ALWAYS ask for the order number.\n@@ anger_escalation: a heated customer gets a human, not a chatbot\n- IF the customer is angry THEN escalate to a human agent.\n`;\n\n/** Render the complete agent reference. Deterministic — no timestamps — so the freshness gate is stable. */\nexport function renderAgentReference(): string {\n const parts: string[] = [\n '# TypeGlish — the agent language reference',\n '',\n '> GENERATED from the language SSOTs (`src/core/lexicon.ts` and friends) — run `npm run gen:agent-docs`; never hand-edit. `typeglish reference` prints this document.',\n '',\n 'TypeGlish is **typed English for prompts**: `.tg` files read as near-plain English, and the compiler checks them like code — provable defects (contradictions, dangling references, unsatisfiable bounds) are **errors** that block compilation; best-practice violations (vagueness, hedging, redundancy) **warn**. Anything the model reads is prose; operators and declarations are checked, then expanded or stripped. Plain ASCII only — the checker rewrites anything else.',\n '',\n '## The workflow',\n '',\n 'The `.tg` file is SOURCE (keep it in git); what a prompt-taking system receives is a BUILD ARTIFACT.',\n '',\n '1. Author `<name>.tg`.',\n '2. `typeglish check <name>.tg --json` — fix until 0 errors (`typeglish --explain <code>` explains any code; diagnostics carry a `fix` when one is mechanical).',\n '3. `typeglish score <name>.tg --min B` — the quality floor.',\n '4. `typeglish build <name>.tg` — writes `.typeglish/dist/<name>.txt` + the hash manifest (`.typeglish/build-manifest.json`). A file with a blocking error refuses to build.',\n '5. Deploy the artifact **verbatim** — never the `.tg`, never a hand-edit. To change a deployed prompt: edit the `.tg`, re-run the loop.',\n '',\n mdTable(DOC_TABLES.find((t) => t.id === 'statements') as DocTable),\n '',\n operators(),\n '',\n ...DOC_TABLES.filter((t) => t.id !== 'statements').flatMap((t) => [mdTable(t), '']),\n conditionalKeywords(),\n '',\n types(),\n '',\n configKinds(),\n '',\n mdTable(CHARSET_DOC),\n '',\n authoringTemplates(),\n '',\n gatingCodes(),\n '',\n '## A canonical prompt',\n '',\n 'Compiles clean and scores A on the TG score — the shape to imitate (`@@` lines are authoring annotations for the line below; they never reach the model):',\n '',\n '```typeglish',\n CANONICAL_EXAMPLE.trimEnd(),\n '```',\n '',\n ];\n return parts.join('\\n');\n}\n","// ── typeglish build — the artifact + provenance layer ───────────────────────────────────────────────────\n// A `.tg` file is SOURCE; what a prompt-taking system (Voiceflow, a system prompt, an assistant API) receives\n// is a BUILD ARTIFACT: `compile(source).xml`, written to disk only when the full check passes. Every build is\n// recorded in a manifest (`.typeglish/build-manifest.json`) keyed by content hashes, which is what makes the\n// gate MECHANICAL: a deploy hook can prove \"this exact payload came out of a passing compile\" by hashing the\n// payload and looking it up — no trust in the model required.\n//\n// Pure module: no fs, no process (path math only). The heads (cli.ts, the MCP server) own reading files and\n// writing artifacts; tests call these functions directly with fixed inputs and a fixed clock (the\n// cli-format.ts pattern).\n\nimport { createHash } from 'node:crypto';\nimport { basename, relative, sep } from 'node:path';\n\nimport { compile, resolve as resolveTg } from '../core/compile';\nimport type { Bag } from '../core/compile';\nimport { report } from '../core/report';\nimport type { ReportCompileOptions, StrictnessPolicy, TgReport } from '../core/report';\nimport { MissingSolverError, reportFull } from '../core/report-full';\n\n/** Canonicalization v1 — applied before hashing on BOTH sides (build and the deploy gate), so a CRLF or\n * trailing-newline mangle between build and deploy never breaks the match while every real byte still counts. */\nexport function canonicalize(text: string): string {\n return text.replace(/\\r\\n/g, '\\n').replace(/\\n+$/, '');\n}\n\nexport function sha256(text: string): string {\n return createHash('sha256').update(text).digest('hex');\n}\n\n/** One build, recorded. `builtAt` sits OUTSIDE the hashes — two builds of identical content hash identically. */\nexport interface ManifestEntry {\n /** The `.tg` source, cwd-relative with forward slashes. */\n source: string;\n /** sha256 of the canonicalized source — the staleness signal (source edited after the build?). */\n sourceSha256: string;\n /** The artifact path, cwd-relative with forward slashes. */\n artifact: string;\n /** sha256 of the canonicalized artifact — the deploy gate's membership key. */\n artifactSha256: string;\n /** The input bag the conditionals were resolved with, or null for a template build (unbound switches\n * render as conditional prose; runtime `{curly}` variables pass through either way). */\n vars: Bag | null;\n /** The compiler version that produced the artifact. */\n typeglish: string;\n /** 'full' = Z3 tier included; 'sync' = z3-solver absent, synchronous tier only. */\n checkMode: 'full' | 'sync';\n /** The verdict the artifact shipped under — ok is always true for a written entry; counts keep the warns visible. */\n report: { ok: boolean; counts: TgReport['counts']; strict: boolean };\n builtAt: string;\n}\n\nexport interface BuildManifest {\n version: 1;\n builds: ManifestEntry[];\n}\n\n/** The manifest's project-relative path — one spelling for the CLI, the hooks, and the docs. */\nexport const MANIFEST_FILE = '.typeglish/build-manifest.json';\n\n/** The default artifact directory, cwd-relative. */\nexport const DEFAULT_OUT_DIR = '.typeglish/dist';\n\nexport const toPosix = (p: string): string => p.split(sep).join('/');\n\n/** The source's cwd-relative manifest key (posix slashes); a source outside the cwd falls back to its\n * basename. EVERY head must key builds identically — the gate's hash lookup depends on it. */\nexport function sourceKey(cwd: string, absFile: string): string {\n const rel = relative(cwd, absFile);\n return rel === '' || rel.startsWith('..') ? basename(absFile) : toPosix(rel);\n}\n\n/** The artifact's cwd-relative path for a source key: mirrors the source tree under outDir, `.txt` extension. */\nexport function artifactPathFor(srcKey: string, outDir: string): string {\n return toPosix(`${outDir.replace(/\\/+$/, '')}/${srcKey.replace(/\\.tg$/i, '.txt')}`);\n}\n\nexport interface BuildOutcome {\n /** True when the check passed and an artifact was produced. */\n ok: boolean;\n report: TgReport;\n checkMode: 'full' | 'sync';\n /** A non-diagnostic refusal (e.g. unknown --vars keys) — actionable, agent-readable. */\n error?: string;\n /** The artifact text (canonicalized + one trailing newline), present when ok. */\n artifact?: string;\n /** The manifest entry to upsert, present when ok. */\n entry?: ManifestEntry;\n /** The AgentBundle sidecar JSON (pretty-printed), present when ok and requested. */\n agentJson?: string;\n}\n\nexport interface BuildOptions {\n vars?: Bag;\n strict?: boolean;\n glishConfig?: string;\n /** The compiler version stamped into the manifest entry. */\n version: string;\n /** Injectable clock (ISO string) — tests fix it; the CLI passes the real one. */\n now?: () => string;\n /** Also produce the AgentBundle sidecar (config + model + tools). */\n bundle?: boolean;\n}\n\n/** The full check with the CLI's degradation contract: Z3 when the optional peer is present, the synchronous\n * tier otherwise — and ONLY on the missing peer (a solver crash propagates; see MissingSolverError). */\nexport async function checkSource(\n source: string,\n policy: StrictnessPolicy,\n compileOpts?: ReportCompileOptions,\n): Promise<{ report: TgReport; checkMode: 'full' | 'sync' }> {\n try {\n return { report: await reportFull(source, { policy, compile: compileOpts }), checkMode: 'full' };\n } catch (err) {\n if (err instanceof MissingSolverError) {\n return { report: report(source, { policy, compile: compileOpts }), checkMode: 'sync' };\n }\n throw err;\n }\n}\n\n/**\n * Compile one source into its deployable artifact + manifest entry. Refuses (ok: false, nothing produced)\n * when the check finds a blocking diagnostic under the active policy or when `vars` names an undeclared\n * input — the manifest is a provenance claim, so nothing failing may enter it.\n */\nexport async function buildPrompt(source: string, paths: { source: string; artifact: string }, opts: BuildOptions): Promise<BuildOutcome> {\n const policy: StrictnessPolicy = opts.strict ? { escalateImportance: 'important' } : {};\n const compileOpts: ReportCompileOptions | undefined = opts.glishConfig === undefined ? undefined : { glishConfig: opts.glishConfig };\n const { report: rep, checkMode } = await checkSource(source, policy, compileOpts);\n if (!rep.ok) return { ok: false, report: rep, checkMode };\n\n const vars = opts.vars ?? null;\n if (vars !== null) {\n const declared = new Set(rep.program.inputs.map((i) => i.name));\n const unknown = Object.keys(vars).filter((k) => !declared.has(k));\n if (unknown.length > 0) {\n const inputs = rep.program.inputs.map((i) => i.name);\n return {\n ok: false,\n report: rep,\n checkMode,\n error: `unknown --vars key${unknown.length === 1 ? '' : 's'}: ${unknown.join(', ')} — declared inputs: ${inputs.length > 0 ? inputs.join(', ') : '(none)'}`,\n };\n }\n }\n\n // The deployable prompt: the checked source's own xml for a template build; with vars, the conditionals\n // are compiled away FIRST (resolve), then the usual compile — resolve.ts's documented contract.\n const artifactBody = vars === null ? rep.xml : compile(resolveTg(source, vars), compileOpts).xml;\n const canonical = canonicalize(artifactBody);\n const entry: ManifestEntry = {\n source: paths.source,\n sourceSha256: sha256(canonicalize(source)),\n artifact: paths.artifact,\n artifactSha256: sha256(canonical),\n vars,\n typeglish: opts.version,\n checkMode,\n report: { ok: rep.ok, counts: rep.counts, strict: opts.strict === true },\n builtAt: opts.now?.() ?? new Date().toISOString(),\n };\n return {\n ok: true,\n report: rep,\n checkMode,\n artifact: `${canonical}\\n`,\n entry,\n ...(opts.bundle === true ? { agentJson: `${JSON.stringify(compile(source, compileOpts).agent, null, 2)}\\n` } : {}),\n };\n}\n\n/** Upsert by artifact path; entries stay sorted by artifact so the manifest diffs deterministically. */\nexport function upsertManifest(existing: BuildManifest | null, entry: ManifestEntry): BuildManifest {\n const builds = (existing?.builds ?? []).filter((b) => b.artifact !== entry.artifact);\n builds.push(entry);\n builds.sort((a, b) => (a.artifact < b.artifact ? -1 : a.artifact > b.artifact ? 1 : 0));\n return { version: 1, builds };\n}\n\n/** Parse a manifest file's text; malformed or wrong-version input counts as absent (fail open into rebuild). */\nexport function parseManifest(text: string | null): BuildManifest | null {\n if (text === null) return null;\n try {\n const parsed = JSON.parse(text) as BuildManifest;\n if (parsed.version !== 1 || !Array.isArray(parsed.builds)) return null;\n return parsed;\n } catch {\n return null;\n }\n}\n","// ── Project discovery — the ambient-config walk-up, shared by every Node head ───────────────────────────\n// The LSP established the rule (lsp/server.ts glishSourceFor): walk up from a file's directory to the nearest\n// `glish.tgc` and thread its raw source into compile, so project config is honored identically everywhere.\n// The CLI (`check` / `build`), the Claude Code hooks, and the MCP server all reuse this one implementation —\n// the discovery rule is part of the language contract, not a per-head behavior.\n\nimport { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\n\n/** Walk up from `fromDir` to the filesystem root; return the first `fileName` hit, or null. */\nexport function findUp(fileName: string, fromDir: string): string | null {\n for (let cur = fromDir, prev = ''; cur !== prev; prev = cur, cur = dirname(cur)) {\n const candidate = join(cur, fileName);\n if (existsSync(candidate)) return candidate;\n }\n return null;\n}\n\n/** The nearest `glish.tgc`'s raw source (the project config layer), or undefined — zero-config still works. */\nexport function loadGlishConfig(fromDir: string): string | undefined {\n const path = findUp('glish.tgc', fromDir);\n if (path === null) return undefined;\n try {\n return readFileSync(path, 'utf8');\n } catch {\n return undefined;\n }\n}\n","// ── The TG score — a pure fold over what the compiler already proved ────────────────────────────────\n// One comparable number per prompt, computed ONLY from counts of cited findings and positive measures\n// the compiler produces — never emitted by a judge (judge detection is reliable; judge scoring is not).\n// Design rules, in force order:\n//\n// GATE — a proven error (logic/*, structure/*, security/leaked-secret) caps the grade at F. A prompt\n// that provably contradicts itself is not \"a 72\"; averaging would hide the proof. Warnings grade,\n// errors gate — the compiler discipline, one level up.\n//\n// POSITIVE MEASURES — defect counting alone rewards prompts the checker can't see into (20 lines of\n// vague prose produce zero findings). Enforceability measures the checker's own visibility: how much\n// of the prompt lowers into checkable rules, and how many of those parse proof-grade. Density (the\n// advisory tier's residual/overlap) measures information per token. High scores require positive\n// evidence, not just absence of defects.\n//\n// ADVISORY STAYS ADVISORY — the semantic facet can move the number, never the gate. Same rule the\n// semantic tier already lives by (\"can never flip the compile verdict\"), one level up: the\n// deterministic score is bit-reproducible and CI-gateable; `--full` adds Density.\n//\n// NORMALIZE PER STATEMENT — deduction facets are defect RATES over content statements, so long\n// prompts aren't punished for having more lines and corpus-scale comparison means something.\n//\n// Every deducted point traces to a diagnostic (the LEDGER) — the score is a view over findings, never\n// a new oracle, and the ledger doubles as the sorted to-do list (fix the top item first).\nimport { TAG_ONLY_LINE, configSectionMask, displayLine, examplesMask, hasTrailingAnnotation, isAnnotationLine, lineOrdinals, toolBlockMask } from './clause';\nimport { ruleCoverage } from './coverage';\nimport type { Diagnostic } from './diagnostics';\nimport { parseLine } from './grammar';\nimport { renderLines } from './highlight';\nimport { lower } from './ir';\nimport type { IR } from './ir';\nimport { proseExemptLines } from './predicate';\nimport type { SemanticReport } from './semantic/types';\nimport { buildStructure } from './structure';\nimport type { StructuredDoc } from './structure';\nimport { parseSwitches } from './switch';\nimport { extractSuite } from './testblock';\n\nexport type FacetKey = 'enforceability' | 'consistency' | 'structure' | 'annotation' | 'style' | 'security' | 'density';\nexport type Grade = 'A' | 'B' | 'C' | 'D' | 'F';\n\n/** v1 weights — opinions, exported as data so recalibration against behavioral pass rates is a\n * one-table change. Absent facets (no rules → no Enforceability; no semantic report → no Density)\n * renormalize over the rest. */\nexport const FACET_WEIGHTS: Record<FacetKey, number> = {\n enforceability: 0.25,\n density: 0.2,\n consistency: 0.2,\n structure: 0.15,\n annotation: 0.15,\n style: 0.1,\n security: 0.1,\n};\n\n/** Severity → deduction weight. Errors also gate; they stay in the fold so the number reflects\n * severity even on a gated prompt. */\nconst SEV_POINTS: Record<Diagnostic['severity'], number> = { info: 0.25, warn: 1, error: 2 };\n\n/** One warn per K statements zeroes a deduction facet. */\nconst RATE_SCALE = 3;\n\n/** Grade bands. A requires positive evidence too — see Enforceability/Density above. */\nfunction toGrade(n: number): Grade {\n if (n >= 90) return 'A';\n if (n >= 80) return 'B';\n if (n >= 65) return 'C';\n if (n >= 50) return 'D';\n return 'F';\n}\n\n/** Word-based token approximation — measured r=0.987 against the NLI tokenizer at prompt/section\n * granularity (eval/spikes/SPIKES.md, Spike B). Per-LINE counts are approximate; label them so. */\nexport function approxTokens(text: string): number {\n const words = text.split(/\\s+/).filter(Boolean).length;\n return Math.round(words * 1.33);\n}\n\nexport interface Deduction {\n source: string;\n line: number;\n /** Char span of the underlying diagnostic — carried so a ledger fix is directly applyFix-able\n * (the fix list is the sorted to-do list; its one-click fixes need the coordinates). */\n start: number;\n end: number;\n points: number;\n message: string;\n fix?: Diagnostic['fix'];\n}\n\nexport interface FacetScore {\n key: FacetKey;\n /** 0–100. */\n score: number;\n /** Effective weight after renormalization (0 when the facet is absent). */\n weight: number;\n /** True when the facet is model-backed (Density) — may move the number, never the gate. */\n advisory?: boolean;\n deductions: Deduction[];\n /** Positive sub-measures (rates 0–1, counts) behind the score — the receipt. */\n measures?: Record<string, number>;\n}\n\nexport interface SectionScore {\n tag: string;\n name: string;\n startLine: number;\n endLine: number;\n /** Deduction-facet score for the lines of this section (positive facets are whole-prompt). */\n score: number;\n deductions: number;\n}\n\nexport interface ScoreCard {\n grade: Grade;\n /** 0–100 weighted facet fold. Computed even when gated (the gate forces the GRADE, not the math). */\n number: number;\n gate: { pass: boolean; reasons: string[] };\n facets: FacetScore[];\n /** Every deduction, most points first — the sorted to-do list. */\n ledger: Deduction[];\n /** Content statements the rates normalize over. */\n statements: number;\n perSection: SectionScore[];\n /** Approximate prompt tokens (words × 1.33 — see approxTokens). */\n tokens: number;\n}\n\nexport interface ScoreInputs {\n diagnostics: Diagnostic[];\n /** Computed from source when omitted. */\n ir?: IR;\n structure?: StructuredDoc;\n /** The advisory tier's report — presence turns the Density facet on. */\n semantic?: SemanticReport;\n}\n\n/** Which deduction facet a diagnostic namespace feeds. */\nfunction facetOf(source: string): Exclude<FacetKey, 'enforceability' | 'density'> | null {\n if (source.startsWith('logic/') || source.startsWith('clarity/')) return 'consistency';\n if (source.startsWith('structure/') || source.startsWith('typeglish/')) return 'structure';\n if (source.startsWith('security/')) return 'security';\n if (\n source.startsWith('style/') ||\n source.startsWith('prompt/') ||\n source.startsWith('spelling/') ||\n source.startsWith('grammar/')\n )\n return 'style';\n return null; // semantic/* informs Density via the report, not the ledger\n}\n\nconst clamp01 = (x: number): number => Math.max(0, Math.min(1, x));\n\nexport function scorePrompt(source: string, inputs: ScoreInputs): ScoreCard {\n const rawLines = source.replace(/\\r\\n/g, '\\n').split('\\n');\n const render = renderLines(rawLines);\n const structure = inputs.structure ?? buildStructure(rawLines);\n // Tool bodies are schemas, not conversation rules — the IR reads the tool-scoped source (the\n // same blanking the logic tiers use) so a \"MUST retry\" in a tool description never counts as a rule.\n const toolMask = toolBlockMask(rawLines);\n // Literal zones (<examples> / <\"name\">) are illustration/reference, not rules — blank them for the IR\n // too, so a sample \"MUST …\" inside a cheat-sheet never counts toward (or drags) Enforceability.\n const exampleMask = examplesMask(rawLines);\n const ir =\n inputs.ir ?? lower(rawLines.map((l, i) => (toolMask[i] || exampleMask[i] ? '' : l)).join('\\n'), { tools: structure.index.tools });\n const diagnostics = inputs.diagnostics;\n // Gate receipts name lines in GUTTER numbers — the same numbers the editor shows.\n const ordinals = lineOrdinals(rawLines);\n const dispL = (i: number): number => displayLine(ordinals, i);\n\n // ── Statements: the normalizer. Content lines that aren't headings/fences/scaffolding\n // ($IMPORT/$CONFIG manifests, $TEST blocks, $TOOL bodies, <$CONFIG> sections) — and not structure\n // or metadata either: a line that is ONLY section tags (`<identity>` / `</identity>`) is structure,\n // and a `@@` statement annotation is documentation OF a statement, never a statement itself.\n const cfgMask = configSectionMask(rawLines);\n const contentLines: number[] = [];\n rawLines.forEach((raw, i) => {\n const r = render[i];\n if (!r || r.kind !== 'content' || r.lineClass === 'md-code' || r.lineClass === 'md-heading') return;\n if (structure.importLines.has(i) || structure.configLines.has(i) || structure.testLines.has(i) || toolMask[i] || cfgMask[i]) return;\n if (isAnnotationLine(raw) || TAG_ONLY_LINE.test(raw)) return;\n contentLines.push(i);\n });\n const statements = Math.max(1, contentLines.length);\n\n // ── The gate: proven errors cap the grade. ──\n const gateReasons = diagnostics\n .filter(\n (d) =>\n d.severity === 'error' &&\n (d.source.startsWith('logic/') || d.source.startsWith('structure/') || d.source === 'security/leaked-secret'),\n )\n .map((d) => `L${dispL(d.line)} ${d.source}: ${d.message}`);\n const gate = { pass: gateReasons.length === 0, reasons: gateReasons };\n\n // ── Deduction facets: severity-weighted defect rate per statement. ──\n const byFacet = new Map<FacetKey, Deduction[]>();\n for (const d of diagnostics) {\n const facet = facetOf(d.source);\n if (!facet) continue;\n const list = byFacet.get(facet) ?? [];\n list.push({ source: d.source, line: d.line, start: d.start, end: d.end, points: SEV_POINTS[d.severity], message: d.message, fix: d.fix });\n byFacet.set(facet, list);\n }\n const deductionFacet = (key: Exclude<FacetKey, 'enforceability' | 'density'>): FacetScore => {\n const deductions = byFacet.get(key) ?? [];\n const rate = deductions.reduce((s, x) => s + x.points, 0) / statements;\n return { key, score: Math.round(100 * (1 - clamp01(rate * RATE_SCALE))), weight: 0, deductions };\n };\n\n // ── Enforceability: the checker's own visibility, as a positive measure. ──\n const deontic = ir.nodes.filter((n) => n.kind === 'directive');\n const hardRules = deontic.filter((n) => n.deontic === 'obligate' || n.deontic === 'prohibit');\n const irLines = new Set(deontic.map((n) => n.line));\n // Candidate rule lines — the denominator of \"how much of this prompt can the checker see\":\n // lines that lowered into the IR, lines flagged unmeasurable, and LIST ITEMS outside prose\n // blocks. A bulleted line under # Constraints was authored as a rule; when it doesn't lower,\n // that is precisely lost enforceability, not neutral prose.\n const unmeasurable = diagnostics.filter((d) => d.source === 'prompt/unmeasurable');\n const exempt = proseExemptLines(rawLines);\n const candidateLines = new Set<number>([...irLines, ...unmeasurable.map((d) => d.line)]);\n for (const i of contentLines) {\n if (exempt.has(i)) continue;\n if (exampleMask[i]) continue; // a literal-zone or definition-list row is reference, never an authored rule\n if (parseLine(rawLines[i] ?? '').list !== 'none') candidateLines.add(i);\n }\n let enforceability: FacetScore | null = null;\n if (candidateLines.size > 0) {\n const irVisible = irLines.size / candidateLines.size;\n const proofGrade =\n hardRules.length === 0\n ? 1\n : hardRules.filter((n) => n.predicate?.confidence === 'lexicon' || n.numeric !== null).length / hardRules.length;\n const measurable = 1 - unmeasurable.length / Math.max(1, hardRules.length + unmeasurable.length);\n const score = Math.round(100 * clamp01(0.5 * irVisible + 0.3 * proofGrade + 0.2 * measurable));\n const measures: Record<string, number> = {\n rules: deontic.length,\n hardRules: hardRules.length,\n irVisibleRate: irVisible,\n proofGradeRate: proofGrade,\n measurableRate: measurable,\n };\n // When the file carries its own $TEST suite, report rule coverage beside the parse measures —\n // a receipt, not (yet) a score term; the calibration corpus decides if it earns weight later.\n const suite = extractSuite(source);\n if (suite.testCases.length > 0) measures.coveredRate = ruleCoverage(ir, suite).coveredRate;\n enforceability = { key: 'enforceability', score, weight: 0, deductions: [], measures };\n }\n\n // ── Annotation: statement-documentation coverage, as a positive measure. Every statement should\n // carry a `@@` annotation — the note that says what the statement is FOR (and, as `@@ name:`, names\n // it). Coverage = annotated statements / eligible statements: a statement counts as annotated when a\n // leading `@@` line sits directly above it (blank lines and // comments may intervene — the same\n // attachment rule the diagnostics use) or a trailing `@@` note rides the line itself (misplaced, but\n // still documentation). Exempt: `<examples>` interiors (samples are illustration, not statements to\n // document) and chain arm lines (IF/ELSE IF/ELSE branches are limbs of ONE decision statement — the\n // annotation above the first arm documents the chain; a `@@` between arms would be arm body).\n // Like Enforceability, this is positive evidence: absence of annotations is a real deficit, so the\n // facet is present whenever the prompt has eligible statements at all. ──\n // A chain's LATER arms are exempt; its FIRST arm stays eligible — it is the chain's one\n // annotatable statement (the `@@` above it documents the whole decision). A `$SWITCH ON` block's\n // arms are ALL exempt: the block has a real header line, and the `@@` above THAT documents the\n // whole switch (arm rows are its limbs, exactly like a chain's later arms).\n const chainBlocks = parseSwitches(rawLines).filter((b) => b.error === null);\n const laterArmLines = new Set(chainBlocks.flatMap((b) => (b.form === 'block' ? b.arms : b.arms.slice(1)).map((a) => a.headerLine)));\n const eligible = contentLines.filter((i) => !exampleMask[i] && !laterArmLines.has(i));\n let annotation: FacetScore | null = null;\n if (eligible.length > 0) {\n const isAnnotated = (line: number): boolean => {\n if (hasTrailingAnnotation(rawLines[line] ?? '')) return true;\n for (let j = line - 1; j >= 0; j -= 1) {\n const raw = rawLines[j] ?? '';\n if (isAnnotationLine(raw)) return true;\n if (raw.trim() === '' || /^\\s*\\/\\//.test(raw)) continue; // blanks/comments don't break attachment\n return false; // any other line (a statement, a tag, a heading) does\n }\n return false;\n };\n const annotated = eligible.filter(isAnnotated).length;\n const annotatedRate = annotated / eligible.length;\n annotation = {\n key: 'annotation',\n score: Math.round(100 * annotatedRate),\n weight: 0,\n deductions: [],\n measures: { eligibleStatements: eligible.length, annotatedStatements: annotated, annotatedRate },\n };\n }\n\n // ── Density (advisory): residual value + non-redundancy from the semantic tier. ──\n let density: FacetScore | null = null;\n if (inputs.semantic) {\n const lines = inputs.semantic.lines;\n if (lines.length > 0) {\n const residualMean = lines.reduce((s, l) => s + l.residual, 0) / lines.length;\n const removableRate = lines.filter((l) => l.proposedRemovable).length / lines.length;\n const score = Math.round(100 * clamp01(0.6 * residualMean + 0.4 * (1 - removableRate)));\n density = {\n key: 'density',\n score,\n weight: 0,\n advisory: true,\n deductions: [],\n measures: { residualMean, removableRate, linesAudited: lines.length },\n };\n }\n }\n\n // ── Fold: renormalize weights over the facets that exist. ──\n const facets: FacetScore[] = [\n ...(enforceability ? [enforceability] : []),\n deductionFacet('consistency'),\n deductionFacet('structure'),\n ...(annotation ? [annotation] : []),\n deductionFacet('style'),\n deductionFacet('security'),\n ...(density ? [density] : []),\n ];\n const totalWeight = facets.reduce((s, f) => s + FACET_WEIGHTS[f.key], 0);\n let number = 0;\n for (const f of facets) {\n f.weight = totalWeight === 0 ? 0 : FACET_WEIGHTS[f.key] / totalWeight;\n number += f.weight * f.score;\n }\n number = Math.round(number);\n\n const ledger = facets\n .flatMap((f) => f.deductions)\n .sort((a, b) => b.points - a.points || a.line - b.line);\n\n // ── Per-section: the same deduction fold, filtered to each section's line range. ──\n const perSection: SectionScore[] = structure.sections.map((s) => {\n const inRange = (line: number): boolean => line >= s.startLine && line < s.endLine;\n const secDeductions = ledger.filter((d) => inRange(d.line));\n const secStatements = Math.max(1, contentLines.filter(inRange).length);\n const rate = secDeductions.reduce((sum, d) => sum + d.points, 0) / secStatements;\n return {\n tag: s.tag,\n name: s.name,\n startLine: s.startLine,\n endLine: s.endLine,\n score: Math.round(100 * (1 - clamp01(rate * RATE_SCALE))),\n deductions: secDeductions.length,\n };\n });\n\n return {\n grade: gate.pass ? toGrade(number) : 'F',\n number,\n gate,\n facets,\n ledger,\n statements,\n perSection,\n tokens: approxTokens(rawLines.join(' ')),\n };\n}\n","// ── typeglish score — the shipped, deterministic grade ──────────────────────────────────────────────────\n// The bin's score is the CI-gateable tier ONLY: compile diagnostics + the optional proof tiers that happen\n// to be installed (Z3 numerics, the spell dictionaries), folded exactly like the dev CLI — minus the\n// advisory semantic facet (model-backed, .env-gated; that stays in `npm run score -- --full`). Degradation\n// follows the package's one rule: a MISSING optional peer degrades silently and is reported in `tiers`;\n// a peer that loaded but then crashed propagates.\n\nimport { numericDiagnostics } from '../core/compile';\nimport { runDiagnostics } from '../core/diagnostics';\nimport type { SpellChecker } from '../core/diagnostics';\nimport { scorePrompt } from '../core/score';\nimport type { Grade, ScoreCard } from '../core/score';\n\nexport const GRADE_FLOOR: Record<Grade, number> = { A: 90, B: 80, C: 65, D: 50, F: 0 };\n\n/** `--min` accepts a grade (A–F) or a number; throws an actionable error otherwise. */\nexport function parseMin(v: string): number {\n const upper = v.toUpperCase();\n if (/^[ABCDF]$/.test(upper)) return GRADE_FLOOR[upper as Grade];\n const n = Number.parseInt(v, 10);\n if (Number.isFinite(n)) return n;\n throw new Error(`--min expects a grade (A–F) or a number, got \"${v}\"`);\n}\n\nexport interface ScoreOutcome {\n card: ScoreCard;\n /** Which optional proof tiers actually ran — agents read this to know what the number is backed by. */\n tiers: { z3: boolean; spell: boolean };\n}\n\n/** Score a source with every installed tier: deterministic base + Z3 + spell when their peers are present. */\nexport async function scoreSource(source: string, opts: { glishConfig?: string } = {}): Promise<ScoreOutcome> {\n let isWord: SpellChecker | undefined;\n let spell = false;\n try {\n const { loadDictionary } = await import('./spell-node');\n isWord = (await loadDictionary()).isWord;\n spell = true;\n } catch {\n // Optional peers (nspell + dictionaries) absent — the deterministic base still scores.\n }\n\n const diagnostics = runDiagnostics(source.split('\\n'), [], { isWord, glishConfig: opts.glishConfig });\n\n let checkNumeric: ((source: string) => Promise<unknown>) | undefined;\n try {\n checkNumeric = (await import('../core/solver/z3')).checkNumeric;\n } catch {\n // Optional peer (z3-solver) absent. Only the IMPORT is guarded: a solver that loaded but crashes below propagates.\n }\n let z3 = false;\n if (checkNumeric !== undefined) {\n diagnostics.push(...numericDiagnostics((await checkNumeric(source)) as Awaited<ReturnType<typeof import('../core/solver/z3').checkNumeric>>, source));\n z3 = true;\n }\n\n return { card: scorePrompt(source, { diagnostics }), tiers: { z3, spell } };\n}\n"]}
|