
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
@promptc/ir
Advanced tools
@promptc/irThe typed prompt intermediate representation (IR) and core utilities for promptc — a deterministic, LM-free compiler for prompts.
This package defines the IR that the rest of the @promptc/* toolchain
operates on:
@promptc/parser produces a PromptIR from markdown / XML / plain input.@promptc/passes runs optimization passes against a PromptIR.@promptc/codegen emits a surface-format string from a PromptIR.@promptc/cli wires them together as the promptc command.If you want to write your own passes, custom parsers, or alternative codegen for the promptc pipeline, this is the package you import.
bun add @promptc/ir
# or
npm install @promptc/ir
import {
buildPromptIR,
addSection,
addInstruction,
validateIR,
serializeIR,
deserializeIR,
type PromptIR,
} from "@promptc/ir";
// Build an IR from scratch.
let ir = buildPromptIR({ sourceFormat: "markdown" });
ir = addSection(ir, { kind: "task", title: "Task" });
ir = addInstruction(ir, { sectionId: /* ... */, kind: "directive", text: "Summarize." });
// Validate it.
const outcome = validateIR(ir);
if (!outcome.valid) throw new Error(outcome.errors[0]?.message);
// Snapshot / restore.
const json = serializeIR(ir);
const round = deserializeIR(json);
PromptIR, Section, Instruction, Example, Slot,
OutputSchema, Pass, PassResult, etc. (canonical definitions for the
whole compiler).buildPromptIR,
addSection, addInstruction, ...) used by the parser and by tests.IRValidationError.validateIR(ir) runs invariant checks (no orphan nodes,
no duplicate ids, etc.).Every entry point is a pure function of its inputs — no I/O, no clock, no RNG. Same inputs in produces same outputs out, bit-for-bit. This is the foundation of the promptc compile-path determinism guarantee.
promptcDESIGN.mddocs/IR.mdApache-2.0. See LICENSE.
FAQs
Prompt IR types and utilities for promptc.
We found that @promptc/ir demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.