← Catalog

@pi-in-go/pigpen-piglet-pig-extension-porter

Port a Pi TypeScript extension to a Go PiG extension: SDK gap check, tests first, differential equivalence against the original, mutation check, binary build and a Package with provenance.

PigletPigpen

Add this Piglet

Add the Piglet source

pig piglet add npm:@pi-in-go/pigpen-piglet-pig-extension-porter

PiG copies the Piglet source into ~/.pig/piglets/ and validates it. Start it with pig --piglet pig-extension-porter.

Review before installing

Piglets run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party Piglet. This one is published by the PiG project from the Pigpen repository; that is not a verification claim.

What this Piglet is

Pigpen index status: planned (it records no signed Binary release for this Piglet). Source in the Pigpen repository ↗

  • Not released yet: no signed Piglet Binary is published and no remote install command is offered. The source composition is in this repository; see RELEASE-BLOCKERS.md.
  • Go only. The focused porter for Pi TypeScript extensions: the strict porting Skill plus the equivalence harness as a fused Go extension. Run npm run stage before using its generated manifest under dist/staged.
  • Most users who port extensions want this Piglet rather than pig-porter, which extends it. Its Packages (extension-port, extension-equivalence) also install on their own with pig install.
  • A Piglet Binary builds locally from the staged manifest with PIG_SOURCE_ROOT set to a git checkout of the PiG source. No release is published; version 0.1.0 is a development default and only linux/amd64 has been built and run; linux/arm64, darwin/arm64, darwin/amd64 and windows/amd64 are listed in the manifest and compile-checked only; neither is a support claim.

Selects

Extensions (1)

  • extension-equivalence from package:extension-equivalence

Skills (1)

  • pigpen-pi-extension-port from package:extension-port

Packages it uses

Binary targets

linux/amd64linux/arm64darwin/arm64darwin/amd64windows/amd64

These are the targets the manifest lists for pig piglet build. Which of them have been built and run is in the notes above.

Signing

  • Signed Piglet Binary: none published. Nothing has been signed for this Piglet yet, so pig piglet pull has no release to pull.
  • npm package: 2 registry signatures.
piglet.yaml
# GENERATED by scripts/npm-piglets.mjs from piglets/pig-extension-porter/piglet.yaml. Do not edit.
name: pig-extension-porter
description: "Port a Pi TypeScript extension to a Go PiG extension: SDK gap check, tests first, differential equivalence against the original, mutation check, binary build and a Package with provenance."
release:
  version: 0.1.1
build:
  targets:
    - linux/amd64
    - linux/arm64
    - darwin/arm64
    - darwin/amd64
    - windows/amd64
  extensionRealization: fused
packages:
  extension-port: npm:@pi-in-go/pigpen-extension-port@^0.1.1
  extension-equivalence: npm:@pi-in-go/pigpen-extension-equivalence@^0.4.0
extensions:
  - name: extension-equivalence
    origins:
      - package:extension-equivalence
skills:
  - name: pigpen-pi-extension-port
    origins:
      - package:extension-port
discovery:
  extensions: []
  skills: []

PiG manifest JSON

The pig field of package.json.

{
  "piglet": "piglet.yaml"
}

README

Written by the package's publisher, shown as published in version 0.1.1 (README.md). PiG does not review it.

pig-extension-porter

The focused porter for Pi TypeScript extensions. Go only: it ports to a Go extension on PiG's public SDK, and everything it selects is a Go SDK extension or a Skill, so the Piglet builds a Binary with its extension fused.

Most people who port an extension want this Piglet. pig-porter extends it and is the umbrella for future porting work.

What it selects

ResourceFromRole
Skill pigpen-pi-extension-portPackage extension-portThe strict workflow: SDK gap check, tests first (fake host and scenarios), Go implementation, differential equivalence against the original, mutation check, binary build, Package with provenance. Includes the TypeScript-to-Go pattern catalog.
Extension extension-equivalence (Go, fused)Package extension-equivalenceTools equivalence_gaps (TypeScript or Go source), equivalence_run, equivalence_twins, equivalence_diff: the Skill's proof steps. The pigeq command line (session setup: pigeq env, pigeq source; pigeq llm) is built from a checkout with PIG_BIN=... npm run build:pigeq.

The built-in tools stay at PiG's defaults because porting reads and writes files and runs go, pig and pi. Discovery of ambient extensions and Skills is off. Model choice is left to the user.

Run from a checkout

npm ci --ignore-scripts
npm run stage
pig piglet validate dist/staged/piglets/pig-extension-porter/piglet.yaml
pig --piglet dist/staged/piglets/pig-extension-porter/piglet.yaml

Set up an isolated session first (pigeq env, see the Skill's "Set up the session"), then, in the session:

/skill:pigpen-pi-extension-port port <path-to-original.ts> to components/<name>

Build a Piglet Binary with one command from a checkout:

npm ci --ignore-scripts
PIG_BIN=/path/to/pig PIG_SOURCE_ROOT=/path/to/pig-git-checkout \
  npm run build:piglet -- pig-extension-porter --out ./pig-extension-porter

--out defaults to dist/bin/pig-extension-porter. PIG_SOURCE_ROOT is a git checkout of the PiG source that the pig was built from (PiG's native Binary builder compiles the Piglet against it). The command runs the quality gates, stages the Piglet, then runs pig piglet build dist/staged/piglets/pig-extension-porter/piglet.yaml --format binary --targets <os>/<arch>.

Do not point pig piglet build at piglets/pig-extension-porter/piglet.yaml. That authored manifest selects Packages in ../../components/, and PiG only accepts local Packages inside the Piglet's own directory (... escapes the Piglet anchor). npm run stage (called by the command above) copies the shared Packages next to the manifest and rewrites them to local:./packages/<alias>; the staged copy is what PiG builds. If you build by hand, run npm run stage first and use the path under dist/staged/.

build.extensionRealization: fused makes the build fail if the extension would be a subprocess, which keeps the Go-only rule enforced by PiG itself.

What it does not port

Packages whose function PiG has built in are skipped, not ported. The first example is MCP: it is built into PiG from 0.4.0, so pi-mcp-adapter is not ported and no Piglet here selects an MCP adapter. The Skill's section 0 carries the rule.

Worked example

components/dirty-repo-guard was ported with this workflow from Pi's dirty-repo-guard.ts example. Its port/PORT.md shows the mapping table, and its scenarios, Pi-recorded traces and mutation list are the evidence.

Requirements

go (source builds and the harness), node (the TypeScript lanes), a pi and a pig executable to compare (PIGEQ_PI, PIGEQ_PIG). The traces compare a real Pi with a real PiG; nothing is mocked.

Status

Source only. No Piglet Binary release and no supported platform. The manifest lists linux/amd64, linux/arm64, darwin/arm64, darwin/amd64 and windows/amd64, but only linux/amd64 has been built and run; the other four are compile-checked only. The version is a development default. Original composition: MIT; the Skill's provenance is in its Package.

Signed Binary

This npm package is the Piglet's source: pig piglet add npm:@pi-in-go/pigpen-piglet-pig-extension-porter registers it, and its Packages install from npm. The signed per-platform Binary is published separately on GitHub Releases (release pig-extension-porter/v0.1.1):

pig piglet pull 'github:MichaelKinsy/pigpen/pig-extension-porter@0.1.1'