@usepipr/cli 0.3.0 → 0.3.1

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/dist/main.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env bun
2
- import { inspect } from "node:util";
3
2
  import * as core from "@actions/core";
4
3
  import { PublicationError, runActionCommand, runDryRunCommand, runInitCommand, runInspectCommand, runLocalReviewCommand, runValidateCommand, supportedOfficialInitAdapters, supportedOfficialInitRecipes } from "@usepipr/runtime";
4
+ import { inspect } from "node:util";
5
5
  import { Command } from "commander";
6
6
  import { chmod, lstat, mkdir, mkdtemp, open, readdir, rename, rm } from "node:fs/promises";
7
7
  import os from "node:os";
8
8
  import path from "node:path";
9
9
  import { createHash } from "node:crypto";
10
10
  //#region package.json
11
- var version = "0.3.0";
11
+ var version = "0.3.1";
12
12
  //#endregion
13
13
  //#region src/skill-catalog.ts
14
14
  const bundledSkillName = "pipr-setup";
@@ -310,6 +310,30 @@ async function runPiprUpdate(options) {
310
310
  if (createdTemp && !replaced) await rm(tempPath, { force: true });
311
311
  }
312
312
  }
313
+ async function availablePiprUpdateNotice(options) {
314
+ if (!isStableSemver(options.currentVersion)) return;
315
+ const release = await latestRelease(withFetchTimeout(options.fetch ?? globalThis.fetch.bind(globalThis), options.timeoutMs));
316
+ if (compareSemver(release.version, options.currentVersion) <= 0) return;
317
+ return {
318
+ currentVersion: options.currentVersion,
319
+ latestVersion: release.version
320
+ };
321
+ }
322
+ function withFetchTimeout(fetchRelease, timeoutMs) {
323
+ if (timeoutMs === void 0) return fetchRelease;
324
+ return async (url, init) => {
325
+ const controller = new AbortController();
326
+ const timeout = setTimeout(() => controller.abort(), timeoutMs);
327
+ try {
328
+ return await fetchRelease(url, {
329
+ ...init,
330
+ signal: controller.signal
331
+ });
332
+ } finally {
333
+ clearTimeout(timeout);
334
+ }
335
+ };
336
+ }
313
337
  async function latestRelease(fetchRelease) {
314
338
  const response = await fetchRelease(`https://api.github.com/repos/${officialRepo}/releases/latest`);
315
339
  if (!response.ok) throw new Error(`failed to fetch latest release metadata: HTTP ${response.status}`);
@@ -385,14 +409,16 @@ function compareSemver(left, right) {
385
409
  return 0;
386
410
  }
387
411
  //#endregion
388
- //#region src/main.ts
389
- async function main() {
412
+ //#region src/runner.ts
413
+ async function runMain(options = {}) {
414
+ const argv = options.argv ?? process.argv;
415
+ await writeAvailableUpdateNotice(options);
390
416
  const program = createProgram();
391
- if (process.argv.length <= 2) {
417
+ if (argv.length <= 2) {
392
418
  program.outputHelp();
393
419
  return;
394
420
  }
395
- await program.parseAsync(process.argv);
421
+ await program.parseAsync(argv);
396
422
  }
397
423
  function createProgram() {
398
424
  const program = new Command();
@@ -589,6 +615,28 @@ async function runUpdate() {
589
615
  }
590
616
  console.log(`updated pipr from ${result.previousVersion} to ${result.version}`);
591
617
  }
618
+ async function writeAvailableUpdateNotice(options) {
619
+ if (shouldSkipUpdateNotice(options.env ?? process.env)) return;
620
+ try {
621
+ const notice = await availablePiprUpdateNotice({
622
+ currentVersion: version,
623
+ fetch: options.updateNoticeFetch,
624
+ timeoutMs: 750
625
+ });
626
+ if (notice) (options.writeUpdateNotice ?? console.error)(formatUpdateNotice(notice));
627
+ } catch {
628
+ return;
629
+ }
630
+ }
631
+ function shouldSkipUpdateNotice(env) {
632
+ if (env.PIPR_UPDATE_NOTICE === "0") return true;
633
+ if (env.PIPR_UPDATE_NOTICE === "1") return false;
634
+ const ci = env.CI?.trim().toLowerCase();
635
+ return ci !== void 0 && ci !== "" && ci !== "0" && ci !== "false" || env.GITHUB_ACTIONS !== void 0;
636
+ }
637
+ function formatUpdateNotice(notice) {
638
+ return `pipr ${notice.latestVersion} is available (current ${notice.currentVersion}). Run \`pipr update\` for release binaries, or reinstall @usepipr/cli with npm/Bun.`;
639
+ }
592
640
  async function runLocalReview(options) {
593
641
  if (!options.base) throw new Error("pipr review requires --base <sha>");
594
642
  writeLocalReviewResult(await runLocalReviewCommand({
@@ -722,7 +770,9 @@ async function runDryRun(options) {
722
770
  colors: false
723
771
  }));
724
772
  }
725
- main().catch((error) => {
773
+ //#endregion
774
+ //#region src/main.ts
775
+ runMain().catch((error) => {
726
776
  if (error instanceof PublicationError && error.result) {
727
777
  core.setOutput("publication", JSON.stringify(error.result));
728
778
  core.error(`pipr publication metadata: ${JSON.stringify(error.result)}`);
package/dist/main.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.mjs","names":["cliPackage.version","cliPackage.version"],"sources":["../package.json","../src/skill-catalog.ts","../src/skills.ts","../src/release/targets.ts","../src/update.ts","../src/main.ts"],"sourcesContent":["","import { readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport const bundledSkillName = \"pipr-setup\";\nconst bundledSkillFilePaths = new Set([\n \"SKILL.md\",\n \"references/config-patterns.md\",\n \"references/recipes.md\",\n]);\n\nexport type BundledSkillFile = {\n path: string;\n contents: string;\n};\n\nexport type BundledSkill = {\n name: string;\n description: string;\n files: BundledSkillFile[];\n};\n\nexport type BundledSkillCatalog = {\n skills: BundledSkill[];\n};\n\nexport function singleBundledSkill(catalog: BundledSkillCatalog): BundledSkill {\n const [skill] = catalog.skills;\n if (catalog.skills.length !== 1 || skill?.name !== bundledSkillName) {\n throw new Error(\n `Expected exactly one bundled skill named '${bundledSkillName}', found: ${catalog.skills\n .map((item) => item.name)\n .join(\", \")}`,\n );\n }\n return skill;\n}\n\nexport function containedSkillFilePath(root: string, relativePath: string): string {\n if (path.isAbsolute(relativePath)) {\n throw new Error(`Bundled skill file path must be relative: ${relativePath}`);\n }\n const resolvedRoot = path.resolve(root);\n const target = path.resolve(resolvedRoot, relativePath);\n if (target !== resolvedRoot && !target.startsWith(`${resolvedRoot}${path.sep}`)) {\n throw new Error(`Bundled skill file path escapes the skill directory: ${relativePath}`);\n }\n return target;\n}\n\nexport async function readBundledSkillCatalog(skillsRoot: string): Promise<BundledSkillCatalog> {\n const entries = await readdir(skillsRoot, { withFileTypes: true });\n const skills = await Promise.all(\n entries\n .filter((entry) => entry.isDirectory())\n .map(async (entry) => {\n const skillDir = path.join(skillsRoot, entry.name);\n const files = await readSkillFiles(skillDir);\n validateBundledSkillFiles(entry.name, files);\n const skillMd = files.find((file) => file.path === \"SKILL.md\");\n if (!skillMd) {\n throw new Error(`${skillDir}: missing SKILL.md`);\n }\n return {\n name: entry.name,\n description: frontmatterDescription(skillMd.contents),\n files,\n };\n }),\n );\n const catalog = { skills: skills.sort((left, right) => left.name.localeCompare(right.name)) };\n singleBundledSkill(catalog);\n return catalog;\n}\n\nasync function readSkillFiles(skillDir: string, prefix = \"\"): Promise<BundledSkillFile[]> {\n const entries = await readdir(path.join(skillDir, prefix), { withFileTypes: true });\n const files = await Promise.all(\n entries\n .filter((entry) => !entry.name.startsWith(\".\"))\n .sort((left, right) => left.name.localeCompare(right.name))\n .map(async (entry) => {\n const relativePath = prefix ? path.join(prefix, entry.name) : entry.name;\n if (entry.isDirectory()) {\n return await readSkillFiles(skillDir, relativePath);\n }\n if (!entry.isFile()) {\n return [];\n }\n const contents = await Bun.file(path.join(skillDir, relativePath)).text();\n return [{ path: relativePath.split(path.sep).join(\"/\"), contents }];\n }),\n );\n return files.flat();\n}\n\nfunction frontmatterDescription(contents: string): string {\n const frontmatter = contents.match(/^---\\n(?<body>[\\s\\S]*?)\\n---/u)?.groups?.body;\n const description = frontmatter\n ?.split(\"\\n\")\n .find((line) => line.startsWith(\"description:\"))\n ?.replace(/^description:\\s*/u, \"\")\n .trim()\n .replace(/^[\"']|[\"']$/gu, \"\");\n if (!description) {\n throw new Error(\"Bundled skill SKILL.md is missing a description\");\n }\n return description;\n}\n\nfunction validateBundledSkillFiles(skillName: string, files: BundledSkillFile[]): void {\n if (skillName !== bundledSkillName) {\n return;\n }\n const found = new Set(files.map((file) => file.path));\n const unexpected = [...found].filter((filePath) => !bundledSkillFilePaths.has(filePath));\n const missing = [...bundledSkillFilePaths].filter((filePath) => !found.has(filePath));\n if (unexpected.length > 0 || missing.length > 0) {\n throw new Error(\n `${bundledSkillName} bundled files must match the release allowlist; ` +\n `unexpected: ${unexpected.join(\", \") || \"-\"}; missing: ${missing.join(\", \") || \"-\"}`,\n );\n }\n}\n","import { lstat, mkdir, mkdtemp, readdir, rename, rm } from \"node:fs/promises\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport cliPackage from \"../package.json\" with { type: \"json\" };\nimport {\n type BundledSkill,\n type BundledSkillCatalog,\n type BundledSkillFile,\n bundledSkillName,\n containedSkillFilePath,\n readBundledSkillCatalog,\n singleBundledSkill,\n} from \"./skill-catalog.js\";\n\ndeclare const PIPR_EMBEDDED_SKILLS: string | undefined;\n\nlet skillPromise: Promise<BundledSkill> | undefined;\n\ntype SkillCatalogAttempt =\n | { catalog: BundledSkillCatalog; skillsRoot: string }\n | { error: string; skillsRoot: string };\n\nexport async function resolveBundledSkill(): Promise<BundledSkill> {\n skillPromise ??= loadBundledSkill();\n return await skillPromise;\n}\n\nexport function formatBundledSkill(skill: BundledSkill): string {\n const files = [...skill.files].sort(compareSkillFiles);\n return [\n `# ${skill.name}`,\n \"\",\n skill.description,\n \"\",\n ...files.flatMap((file) => [\n `----- BEGIN SKILL FILE: ${file.path} -----`,\n file.contents.trimEnd(),\n `----- END SKILL FILE: ${file.path} -----`,\n \"\",\n ]),\n ].join(\"\\n\");\n}\n\nfunction compareSkillFiles(left: BundledSkillFile, right: BundledSkillFile): number {\n if (left.path === \"SKILL.md\") {\n return -1;\n }\n if (right.path === \"SKILL.md\") {\n return 1;\n }\n return left.path.localeCompare(right.path);\n}\n\nexport async function materializeBundledSkill(): Promise<string> {\n const skill = await resolveBundledSkill();\n const versionDir = path.join(skillCacheRoot(), cliPackage.version);\n const skillDir = path.join(versionDir, skill.name);\n await mkdir(versionDir, { recursive: true });\n const stagingDir = await mkdtemp(path.join(versionDir, `${bundledSkillName}-`));\n try {\n for (const file of skill.files) {\n await writeSkillFile(stagingDir, file);\n }\n if (await skillDirectoryMatches(skillDir, skill.files)) {\n await rm(stagingDir, { recursive: true, force: true });\n return skillDir;\n }\n await rm(skillDir, { recursive: true, force: true });\n await renameSkillDirectory(stagingDir, skillDir, skill.files);\n } catch (error) {\n await rm(stagingDir, { recursive: true, force: true });\n throw error;\n }\n return skillDir;\n}\n\nasync function loadBundledSkill(): Promise<BundledSkill> {\n const embedded = embeddedSkillCatalog();\n return singleBundledSkill(embedded ?? (await loadFilesystemSkillCatalog()));\n}\n\nasync function loadFilesystemSkillCatalog(): Promise<BundledSkillCatalog> {\n const attempts = await Promise.all(skillRootCandidates().map(readSkillCatalogAttempt));\n const loaded = attempts.find(\n (attempt): attempt is Extract<SkillCatalogAttempt, { catalog: BundledSkillCatalog }> =>\n \"catalog\" in attempt,\n );\n if (loaded) {\n return loaded.catalog;\n }\n throw new Error(\n `Unable to load bundled Pipr skills.\\n${attempts\n .map((attempt) => `${attempt.skillsRoot}: ${\"error\" in attempt ? attempt.error : \"loaded\"}`)\n .join(\"\\n\")}`,\n );\n}\n\nasync function readSkillCatalogAttempt(skillsRoot: string): Promise<SkillCatalogAttempt> {\n try {\n return { skillsRoot, catalog: await readBundledSkillCatalog(skillsRoot) };\n } catch (error) {\n return { skillsRoot, error: error instanceof Error ? error.message : String(error) };\n }\n}\n\nfunction embeddedSkillCatalog(): BundledSkillCatalog | undefined {\n if (typeof PIPR_EMBEDDED_SKILLS !== \"string\" || PIPR_EMBEDDED_SKILLS.length === 0) {\n return undefined;\n }\n return JSON.parse(PIPR_EMBEDDED_SKILLS) as BundledSkillCatalog;\n}\n\nfunction skillRootCandidates(): string[] {\n const here = import.meta.dirname;\n return [path.join(here, \"skills\"), path.resolve(here, \"../../../skills\")];\n}\n\nasync function writeSkillFile(skillDir: string, file: BundledSkillFile): Promise<void> {\n const target = containedSkillFilePath(skillDir, file.path);\n await mkdir(path.dirname(target), { recursive: true });\n await Bun.write(target, file.contents);\n}\n\nasync function renameSkillDirectory(\n stagingDir: string,\n skillDir: string,\n files: BundledSkillFile[],\n): Promise<void> {\n try {\n await rename(stagingDir, skillDir);\n } catch (error) {\n if (isExistingDirectoryError(error) && (await skillDirectoryMatches(skillDir, files))) {\n await rm(stagingDir, { recursive: true, force: true });\n return;\n }\n throw error;\n }\n}\n\nasync function skillDirectoryMatches(\n skillDir: string,\n files: BundledSkillFile[],\n): Promise<boolean> {\n try {\n return (\n (await skillDirectoryPathsMatch(skillDir, files)) &&\n (await skillDirectoryContentsMatch(skillDir, files))\n );\n } catch {\n return false;\n }\n}\n\nasync function skillDirectoryPathsMatch(\n skillDir: string,\n files: BundledSkillFile[],\n): Promise<boolean> {\n return samePaths(\n await listSkillDirectoryEntries(skillDir),\n files.map((file) => file.path).sort(),\n );\n}\n\nasync function skillDirectoryContentsMatch(\n skillDir: string,\n files: BundledSkillFile[],\n): Promise<boolean> {\n for (const file of files) {\n if (!(await skillFileMatches(skillDir, file))) {\n return false;\n }\n }\n return true;\n}\n\nasync function skillFileMatches(skillDir: string, file: BundledSkillFile): Promise<boolean> {\n const target = containedSkillFilePath(skillDir, file.path);\n return (await lstat(target)).isFile() && (await Bun.file(target).text()) === file.contents;\n}\n\nasync function listSkillDirectoryEntries(skillDir: string, prefix = \"\"): Promise<string[]> {\n const entries = await readdir(path.join(skillDir, prefix), { withFileTypes: true });\n const paths = await Promise.all(\n entries\n .filter((entry) => !entry.name.startsWith(\".\"))\n .map(async (entry) => {\n const relativePath = prefix ? path.join(prefix, entry.name) : entry.name;\n if (entry.isDirectory()) {\n return await listSkillDirectoryEntries(skillDir, relativePath);\n }\n return [relativePath.split(path.sep).join(\"/\")];\n }),\n );\n return paths.flat().sort();\n}\n\nfunction samePaths(left: string[], right: string[]): boolean {\n return left.length === right.length && left.every((value, index) => value === right[index]);\n}\n\nconst existingDirectoryErrorCodes = new Set([\"EEXIST\", \"ENOTEMPTY\"]);\n\nfunction isExistingDirectoryError(error: unknown): boolean {\n return existingDirectoryErrorCodes.has((error as { code?: string } | undefined)?.code ?? \"\");\n}\n\nfunction skillCacheRoot(): string {\n const override = process.env.PIPR_SKILL_CACHE_DIR;\n if (override && override.trim().length > 0) {\n return path.resolve(override);\n }\n const cacheHome = process.env.XDG_CACHE_HOME || path.join(os.homedir(), \".cache\");\n return path.join(cacheHome, \"pipr\", \"skills\");\n}\n","export type ReleasePlatform = {\n platform: NodeJS.Platform;\n arch: NodeJS.Architecture;\n};\n\nexport type ReleaseTarget = ReleasePlatform & {\n target: string;\n outfile: string;\n};\n\nexport const releaseTargets: ReleaseTarget[] = [\n { platform: \"linux\", arch: \"x64\", target: \"bun-linux-x64-baseline\", outfile: \"pipr-linux-x64\" },\n { platform: \"linux\", arch: \"arm64\", target: \"bun-linux-arm64\", outfile: \"pipr-linux-arm64\" },\n { platform: \"darwin\", arch: \"x64\", target: \"bun-darwin-x64\", outfile: \"pipr-darwin-x64\" },\n {\n platform: \"darwin\",\n arch: \"arm64\",\n target: \"bun-darwin-arm64\",\n outfile: \"pipr-darwin-arm64\",\n },\n];\n\nexport function releaseTargetForPlatform(platform: ReleasePlatform): ReleaseTarget | undefined {\n return releaseTargets.find(\n (target) => target.platform === platform.platform && target.arch === platform.arch,\n );\n}\n\nexport function releaseAssetForPlatform(platform: ReleasePlatform): string {\n const target = releaseTargetForPlatform(platform);\n if (target) {\n return target.outfile;\n }\n if (!releaseTargets.some((item) => item.platform === platform.platform)) {\n throw new Error(`pipr update unsupported OS: ${platform.platform}`);\n }\n throw new Error(`pipr update unsupported architecture: ${platform.arch}`);\n}\n","import { createHash } from \"node:crypto\";\nimport { chmod, mkdtemp, open, rename, rm } from \"node:fs/promises\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport type { ReleasePlatform } from \"./release/targets.js\";\nimport { releaseAssetForPlatform } from \"./release/targets.js\";\n\nexport { releaseAssetForPlatform } from \"./release/targets.js\";\n\nexport type UpdateResult =\n | { kind: \"up-to-date\"; version: string }\n | { kind: \"updated\"; previousVersion: string; version: string };\n\ntype UpdateOptions = {\n currentVersion: string;\n executablePath: string;\n fetch?: (url: string) => Promise<Response>;\n platform?: ReleasePlatform;\n};\n\ntype LatestRelease = {\n tag_name?: unknown;\n};\n\nconst officialRepo = \"somus/pipr\";\nconst packageManagerUpdateHelp = [\n \"pipr update only supports compiled GitHub Release binaries.\",\n \"If you installed with npm, run: npm install -g @usepipr/cli@latest\",\n \"If you installed with Bun, run: bun install -g @usepipr/cli@latest\",\n \"If you installed from source, pull the repository and rebuild the CLI.\",\n].join(\"\\n\");\n\nexport function resolveCurrentExecutablePath(\n options: { argv?: string[]; execPath?: string } = {},\n): string {\n const execPath = options.execPath ?? process.execPath;\n const argv = options.argv ?? process.argv;\n const execName = path.basename(execPath).toLowerCase();\n const scriptPath = argv[1];\n if (\n execName === \"bun\" ||\n execName.startsWith(\"bun-\") ||\n execName === \"node\" ||\n execName.startsWith(\"node-\") ||\n scriptPath?.endsWith(\".ts\") ||\n scriptPath?.endsWith(\".mjs\")\n ) {\n throw new Error(packageManagerUpdateHelp);\n }\n return execPath;\n}\n\nexport async function runPiprUpdate(options: UpdateOptions): Promise<UpdateResult> {\n if (!isStableSemver(options.currentVersion)) {\n throw new Error(\n `current pipr version is not a stable semver version: ${options.currentVersion}`,\n );\n }\n const fetchRelease = options.fetch ?? globalThis.fetch.bind(globalThis);\n const platform = options.platform ?? { platform: process.platform, arch: process.arch };\n const asset = releaseAssetForPlatform(platform);\n const release = await latestRelease(fetchRelease);\n const version = release.version;\n if (compareSemver(version, options.currentVersion) <= 0) {\n return { kind: \"up-to-date\", version: options.currentVersion };\n }\n const [binary, checksums] = await Promise.all([\n downloadBytes(fetchRelease, releaseDownloadUrl(release.tag, asset)),\n downloadText(fetchRelease, releaseDownloadUrl(release.tag, \"SHA256SUMS\")),\n ]);\n verifyChecksum(binary, expectedChecksum(checksums, asset), asset);\n\n const tempPath = path.join(\n path.dirname(options.executablePath),\n `.pipr-update-${process.pid}-${Date.now()}`,\n );\n let createdTemp = false;\n let replaced = false;\n try {\n const tempFile = await open(tempPath, \"wx\", 0o700);\n createdTemp = true;\n try {\n await tempFile.writeFile(binary);\n } finally {\n await tempFile.close();\n }\n await chmod(tempPath, 0o755);\n const binaryVersion = await downloadedVersion(tempPath);\n if (!isStableSemver(binaryVersion)) {\n throw new Error(`downloaded pipr binary reported invalid version: ${binaryVersion}`);\n }\n if (binaryVersion !== version) {\n throw new Error(\n `downloaded pipr binary reported ${binaryVersion}, expected latest ${version}`,\n );\n }\n await rename(tempPath, options.executablePath);\n replaced = true;\n return { kind: \"updated\", previousVersion: options.currentVersion, version };\n } finally {\n if (createdTemp && !replaced) {\n await rm(tempPath, { force: true });\n }\n }\n}\n\nasync function latestRelease(fetchRelease: (url: string) => Promise<Response>): Promise<{\n tag: string;\n version: string;\n}> {\n const response = await fetchRelease(\n `https://api.github.com/repos/${officialRepo}/releases/latest`,\n );\n if (!response.ok) {\n throw new Error(`failed to fetch latest release metadata: HTTP ${response.status}`);\n }\n const release = (await response.json()) as LatestRelease;\n if (typeof release.tag_name !== \"string\") {\n throw new Error(\"latest release metadata is missing tag_name\");\n }\n const version = release.tag_name.replace(/^v/, \"\");\n if (!isStableSemver(version)) {\n throw new Error(`latest release tag is not a stable semver version: ${release.tag_name}`);\n }\n return { tag: release.tag_name, version };\n}\n\nfunction releaseDownloadUrl(tag: string, asset: string): string {\n return `https://github.com/${officialRepo}/releases/download/${tag}/${asset}`;\n}\n\nasync function downloadBytes(\n fetchRelease: (url: string) => Promise<Response>,\n url: string,\n): Promise<Buffer> {\n const response = await fetchRelease(url);\n if (!response.ok) {\n throw new Error(`failed to download ${url}: HTTP ${response.status}`);\n }\n return Buffer.from(await response.arrayBuffer());\n}\n\nasync function downloadText(\n fetchRelease: (url: string) => Promise<Response>,\n url: string,\n): Promise<string> {\n const response = await fetchRelease(url);\n if (!response.ok) {\n throw new Error(`failed to download ${url}: HTTP ${response.status}`);\n }\n return await response.text();\n}\n\nfunction expectedChecksum(checksums: string, asset: string): string {\n for (const line of checksums.split(/\\r?\\n/)) {\n const [checksum, name] = line.trim().split(/\\s+/);\n if (name === asset && checksum) {\n return checksum;\n }\n }\n throw new Error(`checksum for ${asset} not found`);\n}\n\nfunction verifyChecksum(binary: Buffer, expected: string, asset: string): void {\n const actual = createHash(\"sha256\").update(binary).digest(\"hex\");\n if (actual !== expected) {\n throw new Error(`checksum mismatch for ${asset}`);\n }\n}\n\nasync function downloadedVersion(executablePath: string): Promise<string> {\n const validationCwd = await mkdtemp(path.join(os.tmpdir(), \"pipr-update-version-\"));\n try {\n const process = Bun.spawn([executablePath, \"--version\"], {\n cwd: validationCwd,\n env: {\n HOME: validationCwd,\n PATH: \"/usr/bin:/bin\",\n TMPDIR: validationCwd,\n },\n stderr: \"pipe\",\n stdout: \"pipe\",\n });\n const [exitCode, stdout, stderr] = await Promise.all([\n process.exited,\n process.stdout ? new Response(process.stdout).text() : \"\",\n process.stderr ? new Response(process.stderr).text() : \"\",\n ]);\n if (exitCode !== 0) {\n throw new Error(\n `downloaded pipr binary failed --version: ${stderr.trim() || stdout.trim() || exitCode}`,\n );\n }\n return stdout.trim();\n } finally {\n await rm(validationCwd, { force: true, recursive: true });\n }\n}\n\nfunction isStableSemver(version: string): boolean {\n return /^\\d+\\.\\d+\\.\\d+$/.test(version);\n}\n\nfunction compareSemver(left: string, right: string): number {\n const leftParts = left.split(\".\").map(Number);\n const rightParts = right.split(\".\").map(Number);\n for (let index = 0; index < 3; index += 1) {\n const difference = leftParts[index] - rightParts[index];\n if (difference !== 0) {\n return difference;\n }\n }\n return 0;\n}\n","#!/usr/bin/env bun\nimport { inspect } from \"node:util\";\nimport * as core from \"@actions/core\";\nimport {\n type ActionCommandResult,\n type ActionLogRecord,\n type ActionLogSink,\n PublicationError,\n runActionCommand,\n runDryRunCommand,\n runInitCommand,\n runInspectCommand,\n runLocalReviewCommand,\n runValidateCommand,\n supportedOfficialInitAdapters,\n supportedOfficialInitRecipes,\n} from \"@usepipr/runtime\";\nimport { Command } from \"commander\";\nimport cliPackage from \"../package.json\" with { type: \"json\" };\nimport { formatBundledSkill, materializeBundledSkill, resolveBundledSkill } from \"./skills.js\";\nimport { resolveCurrentExecutablePath, runPiprUpdate } from \"./update.js\";\n\ntype ActionOptions = Parameters<typeof runActionCommand>[0];\n\ntype CliOptions = {\n configDir: string;\n event?: string;\n force?: boolean;\n adapters?: string;\n recipe?: string;\n minimal?: boolean;\n requireEnv?: boolean;\n base?: string;\n head?: string;\n piExecutable?: string;\n json?: boolean;\n};\n\nasync function main(): Promise<void> {\n const program = createProgram();\n if (process.argv.length <= 2) {\n program.outputHelp();\n return;\n }\n await program.parseAsync(process.argv);\n}\n\nfunction createProgram(): Command {\n const program = new Command();\n program.name(\"pipr\").version(cliPackage.version).showHelpAfterError();\n program.addHelpText(\"after\", agentHelpText);\n\n program\n .command(\"init\")\n .description(\"Create editable TypeScript config\")\n .option(\"--config-dir <dir>\", \"Config directory\", \".pipr\")\n .option(\n \"--adapters <adapters>\",\n `Adapters to initialize (${supportedOfficialInitAdapters.join(\", \")}; use 'none' to skip adapter files)`,\n )\n .option(\"--recipe <recipe>\", `Starter recipe (${supportedOfficialInitRecipes.join(\", \")})`)\n .option(\"--minimal\", \"Scaffold a single-file .pipr/config.ts without package.json\")\n .option(\"--force\", \"Overwrite existing pipr files\")\n .action(runInit);\n\n program\n .command(\"action\")\n .description(\"Run inside GitHub Docker Action\")\n .option(\"--config-dir <dir>\", \"Config directory\", \".pipr\")\n .action(runAction);\n\n program\n .command(\"check\")\n .description(\"Type-load config and validate the runtime plan\")\n .option(\"--config-dir <dir>\", \"Config directory\", \".pipr\")\n .option(\"--require-env\", \"Require configured provider env vars\")\n .action(runCheck);\n\n program\n .command(\"dry-run\")\n .description(\"Load config and event without publishing\")\n .requiredOption(\"--event <path>\", \"GitHub event JSON path\")\n .option(\"--config-dir <dir>\", \"Config directory\", \".pipr\")\n .action(runDryRun);\n\n program\n .command(\"inspect\")\n .description(\"Print models, agents, tasks, commands, and tools\")\n .option(\"--config-dir <dir>\", \"Config directory\", \".pipr\")\n .action(runInspect);\n\n program\n .command(\"review\")\n .description(\"Run configured change-request review tasks locally without publishing\")\n .option(\"--base <sha>\", \"Base commit SHA\")\n .option(\"--head <sha>\", \"Head commit SHA or ref; omitted reviews the working tree\")\n .option(\"--config-dir <dir>\", \"Config directory\", \".pipr\")\n .option(\"--pi-executable <path>\", \"Pi executable path\")\n .option(\"--json\", \"Print structured JSON output\")\n .action(runLocalReview);\n\n program.command(\"version\").description(\"Print the CLI version\").action(runVersion);\n\n program.command(\"update\").description(\"Update a GitHub Release binary install\").action(runUpdate);\n\n const skill = program\n .command(\"skill\")\n .description(\"Print the bundled Pipr setup skill\")\n .action(runSkillGet);\n skill\n .command(\"path\")\n .description(\"Materialize the bundled Pipr setup skill and print its directory path\")\n .action(runSkillPath);\n\n return program;\n}\n\nconst agentHelpText = `\n\nStart here (for AI agents):\n pipr skill\n\nThe Pipr setup skill ships with the CLI and is version-matched to this release.\nPrefer it over guessing commands or config shape from memory.\n\n skill Print the bundled setup skill and references\n skill path Materialize the setup skill and print its directory path\n`;\n\nasync function runAction(options: CliOptions): Promise<void> {\n writeActionResult(await runActionCommand(actionOptions(options)));\n}\n\nfunction actionOptions(options: CliOptions): ActionOptions {\n const eventPath = process.env.GITHUB_EVENT_PATH;\n if (!eventPath) {\n throw new Error(\"GITHUB_EVENT_PATH is required for pipr action\");\n }\n return {\n rootDir: process.env.GITHUB_WORKSPACE ?? process.cwd(),\n configDir: process.env[\"INPUT_CONFIG-DIR\"] || options.configDir,\n env: process.env,\n eventPath,\n dryRun: process.env.PIPR_DRY_RUN === \"1\",\n logSink: githubActionsLogSink,\n };\n}\n\nconst githubActionsLogSink: ActionLogSink = {\n log(record) {\n githubActionLogWriters[record.level](formatGitHubActionLogRecord(record));\n },\n async group(name, run) {\n return await core.group(name, run);\n },\n};\n\nconst githubActionLogWriters = {\n info: core.info,\n notice: core.notice,\n warning: core.warning,\n error: core.error,\n debug: core.debug,\n} satisfies Record<ActionLogRecord[\"level\"], (message: string) => void>;\n\nfunction formatGitHubActionLogRecord(record: ActionLogRecord): string {\n const line = JSON.stringify({\n level: record.level,\n event: record.event,\n ...record.fields,\n });\n return record.text === undefined ? line : `${line}\\n${record.text}`;\n}\n\nfunction writeActionResult(result: ActionCommandResult): void {\n if (result.kind === \"ignored\") {\n core.info(`pipr ignored event: ${result.reason}`);\n return;\n }\n writeLoadedActionResult(result);\n}\n\ntype LoadedActionResult = Exclude<ActionCommandResult, { kind: \"ignored\" }>;\ntype PublishedActionResult = Exclude<LoadedActionResult, { kind: \"dry-run\" }>;\ntype CommandActionResult = Extract<\n PublishedActionResult,\n { kind: \"command-help\" | \"command-response\" }\n>;\ntype ReviewWorkflowActionResult = Exclude<PublishedActionResult, CommandActionResult>;\n\nfunction writeLoadedActionResult(result: LoadedActionResult): void {\n core.info(\n `pipr loaded change #${result.event.change.number} for ${result.event.repository.slug}`,\n );\n core.info(`pipr config source: ${result.configSource}`);\n if (result.kind === \"dry-run\") {\n writeDryRunActionResult(result);\n return;\n }\n writePublishedActionResult(result);\n}\n\nfunction writePublishedActionResult(result: PublishedActionResult): void {\n if (result.kind === \"command-help\" || result.kind === \"command-response\") {\n writeCommandActionResult(result);\n return;\n }\n writeReviewWorkflowActionResult(result);\n}\n\nfunction writeCommandActionResult(result: CommandActionResult): void {\n switch (result.kind) {\n case \"command-help\":\n writeCommandHelpActionResult(result);\n break;\n case \"command-response\":\n writeCommandResponseActionResult(result);\n break;\n default:\n result satisfies never;\n }\n}\n\nfunction writeReviewWorkflowActionResult(result: ReviewWorkflowActionResult): void {\n switch (result.kind) {\n case \"review\":\n writeReviewActionResult(result);\n break;\n case \"verifier\":\n writeVerifierActionResult(result);\n break;\n default:\n result satisfies never;\n }\n}\n\nfunction writeDryRunActionResult(result: Extract<ActionCommandResult, { kind: \"dry-run\" }>): void {\n void result;\n core.info(\"PIPR_DRY_RUN=1; stopping before review runtime, model, or GitHub publishing calls\");\n}\n\nfunction writeCommandHelpActionResult(\n result: Extract<ActionCommandResult, { kind: \"command-help\" }>,\n): void {\n core.info(`pipr command help: ${result.reason}`);\n core.setOutput(\"main-comment\", result.body);\n}\n\nfunction writeCommandResponseActionResult(\n result: Extract<ActionCommandResult, { kind: \"command-response\" }>,\n): void {\n core.info(\n `pipr command '${result.command}' published response comment (${result.publication.action})`,\n );\n core.setOutput(\"main-comment\", result.response.body);\n core.setOutput(\"publication\", JSON.stringify(result.publication));\n}\n\nfunction writeVerifierActionResult(\n result: Extract<ActionCommandResult, { kind: \"verifier\" }>,\n): void {\n core.info(\n `pipr verifier processed review comment reply with ${result.errors.length} publication error(s)`,\n );\n warnInlineResolutionErrors(result.errors);\n core.setOutput(\"publication\", JSON.stringify({ inlineResolutionErrors: result.errors }));\n}\n\nfunction writeReviewActionResult(result: Extract<ActionCommandResult, { kind: \"review\" }>): void {\n core.info(\n `pipr review produced ${result.review.validated.validFindings.length} valid inline finding(s), ` +\n `${result.review.validated.droppedFindings.length} dropped finding(s)`,\n );\n core.info(\n `pipr published main comment (${result.publication.mainComment.action}) and ` +\n `${result.publication.inlineComments.posted} inline comment(s); ` +\n `${result.publication.inlineComments.skipped} skipped`,\n );\n warnInlineResolutionErrors(result.publication.metadata.inlineResolutionErrors);\n if (result.review.repairAttempted) {\n core.info(\"pipr repaired reviewer JSON once before validation\");\n }\n core.setOutput(\"main-comment\", result.review.mainComment);\n core.setOutput(\"inline-comments\", JSON.stringify(result.review.inlineCommentDrafts));\n core.setOutput(\"dropped-findings\", JSON.stringify(result.review.validated.droppedFindings));\n core.setOutput(\"publication\", JSON.stringify(result.publication));\n}\n\nfunction warnInlineResolutionErrors(errors: string[]): void {\n for (const error of errors) {\n core.warning(`pipr inline resolution failed: ${error}`);\n }\n}\n\nasync function runInit(options: CliOptions): Promise<void> {\n const result = await runInitCommand({\n rootDir: process.cwd(),\n configDir: options.configDir,\n force: options.force === true,\n adapters: parseInitAdapters(options.adapters),\n recipe: options.recipe,\n minimal: options.minimal === true,\n });\n console.log(\n `created ${result.created.length} file(s)` +\n (result.overwritten.length > 0 ? `; overwrote ${result.overwritten.length}` : \"\"),\n );\n if (options.minimal === true) {\n console.log(\n \"For editor types, install @usepipr/sdk at the repo root: npm install -D @usepipr/sdk\",\n );\n }\n}\n\nfunction parseInitAdapters(adapters: string | undefined): string[] | undefined {\n return adapters?.split(\",\").map((adapter) => adapter.trim());\n}\n\nasync function runCheck(options: CliOptions): Promise<void> {\n const settings = await runValidateCommand({\n rootDir: process.cwd(),\n configDir: options.configDir,\n env: process.env,\n requireProviderEnv: options.requireEnv === true,\n });\n console.log(`valid: ${settings.source}`);\n for (const warning of settings.warnings) {\n console.log(`warning: ${warning}`);\n }\n}\n\nasync function runInspect(options: CliOptions): Promise<void> {\n const result = await runInspectCommand({\n rootDir: process.cwd(),\n configDir: options.configDir,\n env: process.env,\n });\n console.log(inspect(result, { depth: 8, colors: false }));\n}\n\nasync function runSkillGet(): Promise<void> {\n console.log(formatBundledSkill(await resolveBundledSkill()));\n}\n\nasync function runSkillPath(): Promise<void> {\n console.log(await materializeBundledSkill());\n}\n\nfunction runVersion(): void {\n console.log(cliPackage.version);\n}\n\nasync function runUpdate(): Promise<void> {\n const result = await runPiprUpdate({\n currentVersion: cliPackage.version,\n executablePath: resolveCurrentExecutablePath(),\n });\n if (result.kind === \"up-to-date\") {\n console.log(`pipr ${result.version} is already up to date`);\n return;\n }\n console.log(`updated pipr from ${result.previousVersion} to ${result.version}`);\n}\n\nasync function runLocalReview(options: CliOptions): Promise<void> {\n if (!options.base) {\n throw new Error(\"pipr review requires --base <sha>\");\n }\n const result = await runLocalReviewCommand({\n rootDir: process.cwd(),\n configDir: options.configDir,\n env: process.env,\n baseSha: options.base,\n headSha: options.head,\n piExecutable: options.piExecutable,\n logSink: localConsoleLogSink,\n taskLog: stderrTaskLog,\n });\n writeLocalReviewResult(result, options.json === true);\n}\n\ntype LocalReviewResult = Awaited<ReturnType<typeof runLocalReviewCommand>>;\n\nconst stderrTaskLog = {\n info(message: string) {\n console.error(`[info] ${message}`);\n },\n warn(message: string) {\n console.error(`[warn] ${message}`);\n },\n error(message: string) {\n console.error(`[error] ${message}`);\n },\n};\n\nconst localConsoleLogSink: ActionLogSink = {\n log(record) {\n console.error(formatLocalLogRecord(record));\n },\n async group(_name, run) {\n return await run();\n },\n};\n\nfunction formatLocalLogRecord(record: ActionLogRecord): string {\n const fields = Object.entries(record.fields)\n .map(([key, value]) => formatLocalLogField(key, value))\n .filter((field): field is string => field !== undefined);\n const prefix = formatLocalLogPrefix(record);\n const formatted = [...prefix, ...fields].join(\" \");\n return record.text === undefined ? formatted : `${formatted}\\n${record.text}`;\n}\n\nfunction formatLocalLogPrefix(record: ActionLogRecord): string[] {\n return [\"pipr\", localLogPlainLevels.has(record.level) ? \"\" : record.level, record.event].filter(\n Boolean,\n );\n}\n\nconst localLogNumberFields: Record<string, (value: number) => string> = {\n additions: (value) => `+${value}`,\n deletions: (value) => `-${value}`,\n durationMs: (value) =>\n `duration=${value < 1000 ? `${value}ms` : `${(value / 1000).toFixed(1)}s`}`,\n promptBytes: (value) => `prompt=${value}B`,\n stderrBytes: (value) => `stderr=${value}B`,\n stdoutBytes: (value) => `stdout=${value}B`,\n};\n\nconst localLogPlainLevels = new Set([\"info\", \"notice\"]);\n\nfunction formatLocalLogField(key: string, value: unknown): string | undefined {\n if (value == null) {\n return undefined;\n }\n\n return formatLocalLogFieldValue(key, value);\n}\n\nfunction formatLocalLogFieldValue(key: string, value: unknown): string {\n const formattedNumber =\n typeof value === \"number\" ? localLogNumberFields[key]?.(value) : undefined;\n return formattedNumber ?? `${key}=${formatLocalLogValue(value)}`;\n}\n\nconst localLogValueFormatters: Record<string, (value: unknown) => string> = {\n boolean: String,\n number: String,\n object: (value) =>\n Array.isArray(value)\n ? value.length === 0\n ? \"-\"\n : value.map(formatLocalLogValue).join(\",\")\n : JSON.stringify(value),\n string: (value) => {\n const text = String(value);\n return /\\s/.test(text) ? JSON.stringify(text) : text;\n },\n};\n\nfunction formatLocalLogValue(value: unknown): string {\n return (localLogValueFormatters[typeof value] ?? JSON.stringify)(value);\n}\n\nfunction writeLocalReviewResult(result: LocalReviewResult, json: boolean): void {\n if (json) {\n console.log(JSON.stringify(localReviewJson(result), null, 2));\n return;\n }\n if (result.kind === \"skipped\") {\n console.log(`skipped: ${result.skipReason ?? \"no task matched\"}`);\n return;\n }\n console.log(formatLocalReview(result));\n}\n\nfunction formatLocalReview(result: Extract<LocalReviewResult, { kind: \"review\" }>): string {\n const mainComment = stripMainCommentMarker(result.mainComment);\n const inlineFindings = result.inlineCommentDrafts.map((draft, index) => {\n const range =\n draft.startLine === draft.endLine\n ? `${draft.path}:${draft.startLine}`\n : `${draft.path}:${draft.startLine}-${draft.endLine}`;\n return [\n `${index + 1}. ${range}`,\n `Range: ${draft.finding.rangeId ?? \"-\"}`,\n draft.finding.body,\n ].join(\"\\n\");\n });\n return inlineFindings.length === 0\n ? mainComment\n : [mainComment.trimEnd(), \"\", \"## Inline Findings\", \"\", inlineFindings.join(\"\\n\\n\")].join(\"\\n\");\n}\n\nfunction stripMainCommentMarker(comment: string): string {\n return comment\n .split(\"\\n\")\n .filter((line) => !line.startsWith(\"<!-- pipr:main-comment \"))\n .join(\"\\n\")\n .trimStart();\n}\n\nfunction localReviewJson(result: LocalReviewResult) {\n return {\n kind: result.kind,\n ...(result.kind === \"skipped\" ? { skipReason: result.skipReason } : {}),\n mainComment: result.mainComment,\n inlineFindings: result.inlineCommentDrafts,\n droppedFindings: result.validated.droppedFindings,\n taskChecks: result.taskChecks,\n provider: result.provider,\n providerModels: result.publicationPlan.metadata.providerModels ?? [result.provider.model],\n repairAttempted: result.repairAttempted,\n };\n}\n\nasync function runDryRun(options: CliOptions): Promise<void> {\n if (!options.event) {\n throw new Error(\"dry-run requires --event <path>\");\n }\n const result = await runDryRunCommand({\n rootDir: process.cwd(),\n configDir: options.configDir,\n env: process.env,\n eventPath: options.event,\n });\n console.log(\n inspect(\n {\n configSource: result.configSource,\n event: result.event,\n },\n { depth: 6, colors: false },\n ),\n );\n}\n\nmain().catch((error: unknown) => {\n if (error instanceof PublicationError && error.result) {\n core.setOutput(\"publication\", JSON.stringify(error.result));\n core.error(`pipr publication metadata: ${JSON.stringify(error.result)}`);\n }\n const message = error instanceof Error ? error.message : String(error);\n core.setFailed(message);\n process.exitCode = 1;\n});\n"],"mappings":";;;;;;;;;;;;;ACGA,MAAa,mBAAmB;AAChC,MAAM,wBAAwB,IAAI,IAAI;CACpC;CACA;CACA;AACF,CAAC;AAiBD,SAAgB,mBAAmB,SAA4C;CAC7E,MAAM,CAAC,SAAS,QAAQ;CACxB,IAAI,QAAQ,OAAO,WAAW,KAAK,OAAO,SAAA,cACxC,MAAM,IAAI,MACR,6CAA6C,iBAAiB,YAAY,QAAQ,OAC/E,KAAK,SAAS,KAAK,IAAI,CAAC,CACxB,KAAK,IAAI,GACd;CAEF,OAAO;AACT;AAEA,SAAgB,uBAAuB,MAAc,cAA8B;CACjF,IAAI,KAAK,WAAW,YAAY,GAC9B,MAAM,IAAI,MAAM,6CAA6C,cAAc;CAE7E,MAAM,eAAe,KAAK,QAAQ,IAAI;CACtC,MAAM,SAAS,KAAK,QAAQ,cAAc,YAAY;CACtD,IAAI,WAAW,gBAAgB,CAAC,OAAO,WAAW,GAAG,eAAe,KAAK,KAAK,GAC5E,MAAM,IAAI,MAAM,wDAAwD,cAAc;CAExF,OAAO;AACT;AAEA,eAAsB,wBAAwB,YAAkD;CAC9F,MAAM,UAAU,MAAM,QAAQ,YAAY,EAAE,eAAe,KAAK,CAAC;CAmBjE,MAAM,UAAU,EAAE,SAAQ,MAlBL,QAAQ,IAC3B,QACG,QAAQ,UAAU,MAAM,YAAY,CAAC,CAAC,CACtC,IAAI,OAAO,UAAU;EACpB,MAAM,WAAW,KAAK,KAAK,YAAY,MAAM,IAAI;EACjD,MAAM,QAAQ,MAAM,eAAe,QAAQ;EAC3C,0BAA0B,MAAM,MAAM,KAAK;EAC3C,MAAM,UAAU,MAAM,MAAM,SAAS,KAAK,SAAS,UAAU;EAC7D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uB,SAAyB;CACvD,OAAO,QACJ,MAAM,IAAI,CAAC,CACX,QAAQ,SAAS,CAAC,KAAK,WAAW,yBAAyB,CAAC,CAAC,CAC7D,KAAK,IAAI,CAAC,CACV,UAAU;AACf;AAEA,SAAS,gBAAgB,QAA2B;CAClD,OAAO;EACL,MAAM,OAAO;EACb,GAAI,OAAO,SAAS,YAAY,EAAE,YAAY,OAAO,WAAW,IAAI,CAAC;EACrE,aAAa,OAAO;EACpB,gBAAgB,OAAO;EACvB,iBAAiB,OAAO,UAAU;EAClC,YAAY,OAAO;EACnB,UAAU,OAAO;EACjB,gBAAgB,OAAO,gBAAgB,SAAS,kBAAkB,CAAC,OAAO,SAAS,KAAK;EACxF,iBAAiB,OAAO;CAC1B;AACF;AAEA,eAAe,UAAU,SAAoC;CAC3D,IAAI,CAAC,QAAQ,OACX,MAAM,IAAI,MAAM,iCAAiC;CAEnD,MAAM,SAAS,MAAM,iBAAiB;EACpC,SAAS,QAAQ,IAAI;EACrB,WAAW,QAAQ;EACnB,KAAK,QAAQ;EACb,WAAW,QAAQ;CACrB,CAAC;CACD,QAAQ,IACN,QACE;EACE,cAAc,OAAO;EACrB,OAAO,OAAO;CAChB,GACA;EAAE,OAAO;EAAG,QAAQ;CAAM,CAC5B,CACF;AACF;AAEA,KAAK,CAAC,CAAC,OAAO,UAAmB;CAC/B,IAAI,iBAAiB,oBAAoB,MAAM,QAAQ;EACrD,KAAK,UAAU,eAAe,KAAK,UAAU,MAAM,MAAM,CAAC;EAC1D,KAAK,MAAM,8BAA8B,KAAK,UAAU,MAAM,MAAM,GAAG;CACzE;CACA,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CACrE,KAAK,UAAU,OAAO;CACtB,QAAQ,WAAW;AACrB,CAAC"}
1
+ {"version":3,"file":"main.mjs","names":["cliPackage.version","cliPackage.version"],"sources":["../package.json","../src/skill-catalog.ts","../src/skills.ts","../src/release/targets.ts","../src/update.ts","../src/runner.ts","../src/main.ts"],"sourcesContent":["","import { readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport const bundledSkillName = \"pipr-setup\";\nconst bundledSkillFilePaths = new Set([\n \"SKILL.md\",\n \"references/config-patterns.md\",\n \"references/recipes.md\",\n]);\n\nexport type BundledSkillFile = {\n path: string;\n contents: string;\n};\n\nexport type BundledSkill = {\n name: string;\n description: string;\n files: BundledSkillFile[];\n};\n\nexport type BundledSkillCatalog = {\n skills: BundledSkill[];\n};\n\nexport function singleBundledSkill(catalog: BundledSkillCatalog): BundledSkill {\n const [skill] = catalog.skills;\n if (catalog.skills.length !== 1 || skill?.name !== bundledSkillName) {\n throw new Error(\n `Expected exactly one bundled skill named '${bundledSkillName}', found: ${catalog.skills\n .map((item) => item.name)\n .join(\", \")}`,\n );\n }\n return skill;\n}\n\nexport function containedSkillFilePath(root: string, relativePath: string): string {\n if (path.isAbsolute(relativePath)) {\n throw new Error(`Bundled skill file path must be relative: ${relativePath}`);\n }\n const resolvedRoot = path.resolve(root);\n const target = path.resolve(resolvedRoot, relativePath);\n if (target !== resolvedRoot && !target.startsWith(`${resolvedRoot}${path.sep}`)) {\n throw new Error(`Bundled skill file path escapes the skill directory: ${relativePath}`);\n }\n return target;\n}\n\nexport async function readBundledSkillCatalog(skillsRoot: string): Promise<BundledSkillCatalog> {\n const entries = await readdir(skillsRoot, { withFileTypes: true });\n const skills = await Promise.all(\n entries\n .filter((entry) => entry.isDirectory())\n .map(async (entry) => {\n const skillDir = path.join(skillsRoot, entry.name);\n const files = await readSkillFiles(skillDir);\n validateBundledSkillFiles(entry.name, files);\n const skillMd = files.find((file) => file.path === \"SKILL.md\");\n if (!skillMd) {\n throw new Error(`${skillDir}: missing SKILL.md`);\n }\n return {\n name: entry.name,\n description: frontmatterDescription(skillMd.contents),\n files,\n };\n }),\n );\n const catalog = { skills: skills.sort((left, right) => left.name.localeCompare(right.name)) };\n singleBundledSkill(catalog);\n return catalog;\n}\n\nasync function readSkillFiles(skillDir: string, prefix = \"\"): Promise<BundledSkillFile[]> {\n const entries = await readdir(path.join(skillDir, prefix), { withFileTypes: true });\n const files = await Promise.all(\n entries\n .filter((entry) => !entry.name.startsWith(\".\"))\n .sort((left, right) => left.name.localeCompare(right.name))\n .map(async (entry) => {\n const relativePath = prefix ? path.join(prefix, entry.name) : entry.name;\n if (entry.isDirectory()) {\n return await readSkillFiles(skillDir, relativePath);\n }\n if (!entry.isFile()) {\n return [];\n }\n const contents = await Bun.file(path.join(skillDir, relativePath)).text();\n return [{ path: relativePath.split(path.sep).join(\"/\"), contents }];\n }),\n );\n return files.flat();\n}\n\nfunction frontmatterDescription(contents: string): string {\n const frontmatter = contents.match(/^---\\n(?<body>[\\s\\S]*?)\\n---/u)?.groups?.body;\n const description = frontmatter\n ?.split(\"\\n\")\n .find((line) => line.startsWith(\"description:\"))\n ?.replace(/^description:\\s*/u, \"\")\n .trim()\n .replace(/^[\"']|[\"']$/gu, \"\");\n if (!description) {\n throw new Error(\"Bundled skill SKILL.md is missing a description\");\n }\n return description;\n}\n\nfunction validateBundledSkillFiles(skillName: string, files: BundledSkillFile[]): void {\n if (skillName !== bundledSkillName) {\n return;\n }\n const found = new Set(files.map((file) => file.path));\n const unexpected = [...found].filter((filePath) => !bundledSkillFilePaths.has(filePath));\n const missing = [...bundledSkillFilePaths].filter((filePath) => !found.has(filePath));\n if (unexpected.length > 0 || missing.length > 0) {\n throw new Error(\n `${bundledSkillName} bundled files must match the release allowlist; ` +\n `unexpected: ${unexpected.join(\", \") || \"-\"}; missing: ${missing.join(\", \") || \"-\"}`,\n );\n }\n}\n","import { lstat, mkdir, mkdtemp, readdir, rename, rm } from \"node:fs/promises\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport cliPackage from \"../package.json\" with { type: \"json\" };\nimport {\n type BundledSkill,\n type BundledSkillCatalog,\n type BundledSkillFile,\n bundledSkillName,\n containedSkillFilePath,\n readBundledSkillCatalog,\n singleBundledSkill,\n} from \"./skill-catalog.js\";\n\ndeclare const PIPR_EMBEDDED_SKILLS: string | undefined;\n\nlet skillPromise: Promise<BundledSkill> | undefined;\n\ntype SkillCatalogAttempt =\n | { catalog: BundledSkillCatalog; skillsRoot: string }\n | { error: string; skillsRoot: string };\n\nexport async function resolveBundledSkill(): Promise<BundledSkill> {\n skillPromise ??= loadBundledSkill();\n return await skillPromise;\n}\n\nexport function formatBundledSkill(skill: BundledSkill): string {\n const files = [...skill.files].sort(compareSkillFiles);\n return [\n `# ${skill.name}`,\n \"\",\n skill.description,\n \"\",\n ...files.flatMap((file) => [\n `----- BEGIN SKILL FILE: ${file.path} -----`,\n file.contents.trimEnd(),\n `----- END SKILL FILE: ${file.path} -----`,\n \"\",\n ]),\n ].join(\"\\n\");\n}\n\nfunction compareSkillFiles(left: BundledSkillFile, right: BundledSkillFile): number {\n if (left.path === \"SKILL.md\") {\n return -1;\n }\n if (right.path === \"SKILL.md\") {\n return 1;\n }\n return left.path.localeCompare(right.path);\n}\n\nexport async function materializeBundledSkill(): Promise<string> {\n const skill = await resolveBundledSkill();\n const versionDir = path.join(skillCacheRoot(), cliPackage.version);\n const skillDir = path.join(versionDir, skill.name);\n await mkdir(versionDir, { recursive: true });\n const stagingDir = await mkdtemp(path.join(versionDir, `${bundledSkillName}-`));\n try {\n for (const file of skill.files) {\n await writeSkillFile(stagingDir, file);\n }\n if (await skillDirectoryMatches(skillDir, skill.files)) {\n await rm(stagingDir, { recursive: true, force: true });\n return skillDir;\n }\n await rm(skillDir, { recursive: true, force: true });\n await renameSkillDirectory(stagingDir, skillDir, skill.files);\n } catch (error) {\n await rm(stagingDir, { recursive: true, force: true });\n throw error;\n }\n return skillDir;\n}\n\nasync function loadBundledSkill(): Promise<BundledSkill> {\n const embedded = embeddedSkillCatalog();\n return singleBundledSkill(embedded ?? (await loadFilesystemSkillCatalog()));\n}\n\nasync function loadFilesystemSkillCatalog(): Promise<BundledSkillCatalog> {\n const attempts = await Promise.all(skillRootCandidates().map(readSkillCatalogAttempt));\n const loaded = attempts.find(\n (attempt): attempt is Extract<SkillCatalogAttempt, { catalog: BundledSkillCatalog }> =>\n \"catalog\" in attempt,\n );\n if (loaded) {\n return loaded.catalog;\n }\n throw new Error(\n `Unable to load bundled Pipr skills.\\n${attempts\n .map((attempt) => `${attempt.skillsRoot}: ${\"error\" in attempt ? attempt.error : \"loaded\"}`)\n .join(\"\\n\")}`,\n );\n}\n\nasync function readSkillCatalogAttempt(skillsRoot: string): Promise<SkillCatalogAttempt> {\n try {\n return { skillsRoot, catalog: await readBundledSkillCatalog(skillsRoot) };\n } catch (error) {\n return { skillsRoot, error: error instanceof Error ? error.message : String(error) };\n }\n}\n\nfunction embeddedSkillCatalog(): BundledSkillCatalog | undefined {\n if (typeof PIPR_EMBEDDED_SKILLS !== \"string\" || PIPR_EMBEDDED_SKILLS.length === 0) {\n return undefined;\n }\n return JSON.parse(PIPR_EMBEDDED_SKILLS) as BundledSkillCatalog;\n}\n\nfunction skillRootCandidates(): string[] {\n const here = import.meta.dirname;\n return [path.join(here, \"skills\"), path.resolve(here, \"../../../skills\")];\n}\n\nasync function writeSkillFile(skillDir: string, file: BundledSkillFile): Promise<void> {\n const target = containedSkillFilePath(skillDir, file.path);\n await mkdir(path.dirname(target), { recursive: true });\n await Bun.write(target, file.contents);\n}\n\nasync function renameSkillDirectory(\n stagingDir: string,\n skillDir: string,\n files: BundledSkillFile[],\n): Promise<void> {\n try {\n await rename(stagingDir, skillDir);\n } catch (error) {\n if (isExistingDirectoryError(error) && (await skillDirectoryMatches(skillDir, files))) {\n await rm(stagingDir, { recursive: true, force: true });\n return;\n }\n throw error;\n }\n}\n\nasync function skillDirectoryMatches(\n skillDir: string,\n files: BundledSkillFile[],\n): Promise<boolean> {\n try {\n return (\n (await skillDirectoryPathsMatch(skillDir, files)) &&\n (await skillDirectoryContentsMatch(skillDir, files))\n );\n } catch {\n return false;\n }\n}\n\nasync function skillDirectoryPathsMatch(\n skillDir: string,\n files: BundledSkillFile[],\n): Promise<boolean> {\n return samePaths(\n await listSkillDirectoryEntries(skillDir),\n files.map((file) => file.path).sort(),\n );\n}\n\nasync function skillDirectoryContentsMatch(\n skillDir: string,\n files: BundledSkillFile[],\n): Promise<boolean> {\n for (const file of files) {\n if (!(await skillFileMatches(skillDir, file))) {\n return false;\n }\n }\n return true;\n}\n\nasync function skillFileMatches(skillDir: string, file: BundledSkillFile): Promise<boolean> {\n const target = containedSkillFilePath(skillDir, file.path);\n return (await lstat(target)).isFile() && (await Bun.file(target).text()) === file.contents;\n}\n\nasync function listSkillDirectoryEntries(skillDir: string, prefix = \"\"): Promise<string[]> {\n const entries = await readdir(path.join(skillDir, prefix), { withFileTypes: true });\n const paths = await Promise.all(\n entries\n .filter((entry) => !entry.name.startsWith(\".\"))\n .map(async (entry) => {\n const relativePath = prefix ? path.join(prefix, entry.name) : entry.name;\n if (entry.isDirectory()) {\n return await listSkillDirectoryEntries(skillDir, relativePath);\n }\n return [relativePath.split(path.sep).join(\"/\")];\n }),\n );\n return paths.flat().sort();\n}\n\nfunction samePaths(left: string[], right: string[]): boolean {\n return left.length === right.length && left.every((value, index) => value === right[index]);\n}\n\nconst existingDirectoryErrorCodes = new Set([\"EEXIST\", \"ENOTEMPTY\"]);\n\nfunction isExistingDirectoryError(error: unknown): boolean {\n return existingDirectoryErrorCodes.has((error as { code?: string } | undefined)?.code ?? \"\");\n}\n\nfunction skillCacheRoot(): string {\n const override = process.env.PIPR_SKILL_CACHE_DIR;\n if (override && override.trim().length > 0) {\n return path.resolve(override);\n }\n const cacheHome = process.env.XDG_CACHE_HOME || path.join(os.homedir(), \".cache\");\n return path.join(cacheHome, \"pipr\", \"skills\");\n}\n","export type ReleasePlatform = {\n platform: NodeJS.Platform;\n arch: NodeJS.Architecture;\n};\n\nexport type ReleaseTarget = ReleasePlatform & {\n target: string;\n outfile: string;\n};\n\nexport const releaseTargets: ReleaseTarget[] = [\n { platform: \"linux\", arch: \"x64\", target: \"bun-linux-x64-baseline\", outfile: \"pipr-linux-x64\" },\n { platform: \"linux\", arch: \"arm64\", target: \"bun-linux-arm64\", outfile: \"pipr-linux-arm64\" },\n { platform: \"darwin\", arch: \"x64\", target: \"bun-darwin-x64\", outfile: \"pipr-darwin-x64\" },\n {\n platform: \"darwin\",\n arch: \"arm64\",\n target: \"bun-darwin-arm64\",\n outfile: \"pipr-darwin-arm64\",\n },\n];\n\nexport function releaseTargetForPlatform(platform: ReleasePlatform): ReleaseTarget | undefined {\n return releaseTargets.find(\n (target) => target.platform === platform.platform && target.arch === platform.arch,\n );\n}\n\nexport function releaseAssetForPlatform(platform: ReleasePlatform): string {\n const target = releaseTargetForPlatform(platform);\n if (target) {\n return target.outfile;\n }\n if (!releaseTargets.some((item) => item.platform === platform.platform)) {\n throw new Error(`pipr update unsupported OS: ${platform.platform}`);\n }\n throw new Error(`pipr update unsupported architecture: ${platform.arch}`);\n}\n","import { createHash } from \"node:crypto\";\nimport { chmod, mkdtemp, open, rename, rm } from \"node:fs/promises\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport type { ReleasePlatform } from \"./release/targets.js\";\nimport { releaseAssetForPlatform } from \"./release/targets.js\";\n\nexport { releaseAssetForPlatform } from \"./release/targets.js\";\n\nexport type UpdateResult =\n | { kind: \"up-to-date\"; version: string }\n | { kind: \"updated\"; previousVersion: string; version: string };\n\nexport type UpdateNotice = {\n currentVersion: string;\n latestVersion: string;\n};\n\ntype ReleaseFetch = (url: string, init?: RequestInit) => Promise<Response>;\n\ntype UpdateOptions = {\n currentVersion: string;\n executablePath: string;\n fetch?: ReleaseFetch;\n platform?: ReleasePlatform;\n};\n\ntype UpdateNoticeOptions = {\n currentVersion: string;\n fetch?: ReleaseFetch;\n timeoutMs?: number;\n};\n\ntype LatestRelease = {\n tag_name?: unknown;\n};\n\nconst officialRepo = \"somus/pipr\";\nconst packageManagerUpdateHelp = [\n \"pipr update only supports compiled GitHub Release binaries.\",\n \"If you installed with npm, run: npm install -g @usepipr/cli@latest\",\n \"If you installed with Bun, run: bun install -g @usepipr/cli@latest\",\n \"If you installed from source, pull the repository and rebuild the CLI.\",\n].join(\"\\n\");\n\nexport function resolveCurrentExecutablePath(\n options: { argv?: string[]; execPath?: string } = {},\n): string {\n const execPath = options.execPath ?? process.execPath;\n const argv = options.argv ?? process.argv;\n const execName = path.basename(execPath).toLowerCase();\n const scriptPath = argv[1];\n if (\n execName === \"bun\" ||\n execName.startsWith(\"bun-\") ||\n execName === \"node\" ||\n execName.startsWith(\"node-\") ||\n scriptPath?.endsWith(\".ts\") ||\n scriptPath?.endsWith(\".mjs\")\n ) {\n throw new Error(packageManagerUpdateHelp);\n }\n return execPath;\n}\n\nexport async function runPiprUpdate(options: UpdateOptions): Promise<UpdateResult> {\n if (!isStableSemver(options.currentVersion)) {\n throw new Error(\n `current pipr version is not a stable semver version: ${options.currentVersion}`,\n );\n }\n const fetchRelease = options.fetch ?? globalThis.fetch.bind(globalThis);\n const platform = options.platform ?? { platform: process.platform, arch: process.arch };\n const asset = releaseAssetForPlatform(platform);\n const release = await latestRelease(fetchRelease);\n const version = release.version;\n if (compareSemver(version, options.currentVersion) <= 0) {\n return { kind: \"up-to-date\", version: options.currentVersion };\n }\n const [binary, checksums] = await Promise.all([\n downloadBytes(fetchRelease, releaseDownloadUrl(release.tag, asset)),\n downloadText(fetchRelease, releaseDownloadUrl(release.tag, \"SHA256SUMS\")),\n ]);\n verifyChecksum(binary, expectedChecksum(checksums, asset), asset);\n\n const tempPath = path.join(\n path.dirname(options.executablePath),\n `.pipr-update-${process.pid}-${Date.now()}`,\n );\n let createdTemp = false;\n let replaced = false;\n try {\n const tempFile = await open(tempPath, \"wx\", 0o700);\n createdTemp = true;\n try {\n await tempFile.writeFile(binary);\n } finally {\n await tempFile.close();\n }\n await chmod(tempPath, 0o755);\n const binaryVersion = await downloadedVersion(tempPath);\n if (!isStableSemver(binaryVersion)) {\n throw new Error(`downloaded pipr binary reported invalid version: ${binaryVersion}`);\n }\n if (binaryVersion !== version) {\n throw new Error(\n `downloaded pipr binary reported ${binaryVersion}, expected latest ${version}`,\n );\n }\n await rename(tempPath, options.executablePath);\n replaced = true;\n return { kind: \"updated\", previousVersion: options.currentVersion, version };\n } finally {\n if (createdTemp && !replaced) {\n await rm(tempPath, { force: true });\n }\n }\n}\n\nexport async function availablePiprUpdateNotice(\n options: UpdateNoticeOptions,\n): Promise<UpdateNotice | undefined> {\n if (!isStableSemver(options.currentVersion)) {\n return undefined;\n }\n const fetchRelease = withFetchTimeout(\n options.fetch ?? globalThis.fetch.bind(globalThis),\n options.timeoutMs,\n );\n const release = await latestRelease(fetchRelease);\n if (compareSemver(release.version, options.currentVersion) <= 0) {\n return undefined;\n }\n return { currentVersion: options.currentVersion, latestVersion: release.version };\n}\n\nfunction withFetchTimeout(fetchRelease: ReleaseFetch, timeoutMs: number | undefined): ReleaseFetch {\n if (timeoutMs === undefined) {\n return fetchRelease;\n }\n return async (url, init) => {\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), timeoutMs);\n try {\n return await fetchRelease(url, { ...init, signal: controller.signal });\n } finally {\n clearTimeout(timeout);\n }\n };\n}\n\nasync function latestRelease(fetchRelease: ReleaseFetch): Promise<{\n tag: string;\n version: string;\n}> {\n const response = await fetchRelease(\n `https://api.github.com/repos/${officialRepo}/releases/latest`,\n );\n if (!response.ok) {\n throw new Error(`failed to fetch latest release metadata: HTTP ${response.status}`);\n }\n const release = (await response.json()) as LatestRelease;\n if (typeof release.tag_name !== \"string\") {\n throw new Error(\"latest release metadata is missing tag_name\");\n }\n const version = release.tag_name.replace(/^v/, \"\");\n if (!isStableSemver(version)) {\n throw new Error(`latest release tag is not a stable semver version: ${release.tag_name}`);\n }\n return { tag: release.tag_name, version };\n}\n\nfunction releaseDownloadUrl(tag: string, asset: string): string {\n return `https://github.com/${officialRepo}/releases/download/${tag}/${asset}`;\n}\n\nasync function downloadBytes(\n fetchRelease: (url: string) => Promise<Response>,\n url: string,\n): Promise<Buffer> {\n const response = await fetchRelease(url);\n if (!response.ok) {\n throw new Error(`failed to download ${url}: HTTP ${response.status}`);\n }\n return Buffer.from(await response.arrayBuffer());\n}\n\nasync function downloadText(\n fetchRelease: (url: string) => Promise<Response>,\n url: string,\n): Promise<string> {\n const response = await fetchRelease(url);\n if (!response.ok) {\n throw new Error(`failed to download ${url}: HTTP ${response.status}`);\n }\n return await response.text();\n}\n\nfunction expectedChecksum(checksums: string, asset: string): string {\n for (const line of checksums.split(/\\r?\\n/)) {\n const [checksum, name] = line.trim().split(/\\s+/);\n if (name === asset && checksum) {\n return checksum;\n }\n }\n throw new Error(`checksum for ${asset} not found`);\n}\n\nfunction verifyChecksum(binary: Buffer, expected: string, asset: string): void {\n const actual = createHash(\"sha256\").update(binary).digest(\"hex\");\n if (actual !== expected) {\n throw new Error(`checksum mismatch for ${asset}`);\n }\n}\n\nasync function downloadedVersion(executablePath: string): Promise<string> {\n const validationCwd = await mkdtemp(path.join(os.tmpdir(), \"pipr-update-version-\"));\n try {\n const process = Bun.spawn([executablePath, \"--version\"], {\n cwd: validationCwd,\n env: {\n HOME: validationCwd,\n PATH: \"/usr/bin:/bin\",\n TMPDIR: validationCwd,\n },\n stderr: \"pipe\",\n stdout: \"pipe\",\n });\n const [exitCode, stdout, stderr] = await Promise.all([\n process.exited,\n process.stdout ? new Response(process.stdout).text() : \"\",\n process.stderr ? new Response(process.stderr).text() : \"\",\n ]);\n if (exitCode !== 0) {\n throw new Error(\n `downloaded pipr binary failed --version: ${stderr.trim() || stdout.trim() || exitCode}`,\n );\n }\n return stdout.trim();\n } finally {\n await rm(validationCwd, { force: true, recursive: true });\n }\n}\n\nfunction isStableSemver(version: string): boolean {\n return /^\\d+\\.\\d+\\.\\d+$/.test(version);\n}\n\nfunction compareSemver(left: string, right: string): number {\n const leftParts = left.split(\".\").map(Number);\n const rightParts = right.split(\".\").map(Number);\n for (let index = 0; index < 3; index += 1) {\n const difference = leftParts[index] - rightParts[index];\n if (difference !== 0) {\n return difference;\n }\n }\n return 0;\n}\n","import { inspect } from \"node:util\";\nimport * as core from \"@actions/core\";\nimport {\n type ActionCommandResult,\n type ActionLogRecord,\n type ActionLogSink,\n runActionCommand,\n runDryRunCommand,\n runInitCommand,\n runInspectCommand,\n runLocalReviewCommand,\n runValidateCommand,\n supportedOfficialInitAdapters,\n supportedOfficialInitRecipes,\n} from \"@usepipr/runtime\";\nimport { Command } from \"commander\";\nimport cliPackage from \"../package.json\" with { type: \"json\" };\nimport { formatBundledSkill, materializeBundledSkill, resolveBundledSkill } from \"./skills.js\";\nimport {\n availablePiprUpdateNotice,\n resolveCurrentExecutablePath,\n runPiprUpdate,\n type UpdateNotice,\n} from \"./update.js\";\n\ntype ActionOptions = Parameters<typeof runActionCommand>[0];\n\ntype CliOptions = {\n configDir: string;\n event?: string;\n force?: boolean;\n adapters?: string;\n recipe?: string;\n minimal?: boolean;\n requireEnv?: boolean;\n base?: string;\n head?: string;\n piExecutable?: string;\n json?: boolean;\n};\n\ntype MainOptions = {\n argv?: string[];\n env?: NodeJS.ProcessEnv;\n updateNoticeFetch?: typeof fetch;\n writeUpdateNotice?: (message: string) => void;\n};\n\nexport async function runMain(options: MainOptions = {}): Promise<void> {\n const argv = options.argv ?? process.argv;\n await writeAvailableUpdateNotice(options);\n const program = createProgram();\n if (argv.length <= 2) {\n program.outputHelp();\n return;\n }\n await program.parseAsync(argv);\n}\n\nfunction createProgram(): Command {\n const program = new Command();\n program.name(\"pipr\").version(cliPackage.version).showHelpAfterError();\n program.addHelpText(\"after\", agentHelpText);\n\n program\n .command(\"init\")\n .description(\"Create editable TypeScript config\")\n .option(\"--config-dir <dir>\", \"Config directory\", \".pipr\")\n .option(\n \"--adapters <adapters>\",\n `Adapters to initialize (${supportedOfficialInitAdapters.join(\", \")}; use 'none' to skip adapter files)`,\n )\n .option(\"--recipe <recipe>\", `Starter recipe (${supportedOfficialInitRecipes.join(\", \")})`)\n .option(\"--minimal\", \"Scaffold a single-file .pipr/config.ts without package.json\")\n .option(\"--force\", \"Overwrite existing pipr files\")\n .action(runInit);\n\n program\n .command(\"action\")\n .description(\"Run inside GitHub Docker Action\")\n .option(\"--config-dir <dir>\", \"Config directory\", \".pipr\")\n .action(runAction);\n\n program\n .command(\"check\")\n .description(\"Type-load config and validate the runtime plan\")\n .option(\"--config-dir <dir>\", \"Config directory\", \".pipr\")\n .option(\"--require-env\", \"Require configured provider env vars\")\n .action(runCheck);\n\n program\n .command(\"dry-run\")\n .description(\"Load config and event without publishing\")\n .requiredOption(\"--event <path>\", \"GitHub event JSON path\")\n .option(\"--config-dir <dir>\", \"Config directory\", \".pipr\")\n .action(runDryRun);\n\n program\n .command(\"inspect\")\n .description(\"Print models, agents, tasks, commands, and tools\")\n .option(\"--config-dir <dir>\", \"Config directory\", \".pipr\")\n .action(runInspect);\n\n program\n .command(\"review\")\n .description(\"Run configured change-request review tasks locally without publishing\")\n .option(\"--base <sha>\", \"Base commit SHA\")\n .option(\"--head <sha>\", \"Head commit SHA or ref; omitted reviews the working tree\")\n .option(\"--config-dir <dir>\", \"Config directory\", \".pipr\")\n .option(\"--pi-executable <path>\", \"Pi executable path\")\n .option(\"--json\", \"Print structured JSON output\")\n .action(runLocalReview);\n\n program.command(\"version\").description(\"Print the CLI version\").action(runVersion);\n\n program.command(\"update\").description(\"Update a GitHub Release binary install\").action(runUpdate);\n\n const skill = program\n .command(\"skill\")\n .description(\"Print the bundled Pipr setup skill\")\n .action(runSkillGet);\n skill\n .command(\"path\")\n .description(\"Materialize the bundled Pipr setup skill and print its directory path\")\n .action(runSkillPath);\n\n return program;\n}\n\nconst agentHelpText = `\n\nStart here (for AI agents):\n pipr skill\n\nThe Pipr setup skill ships with the CLI and is version-matched to this release.\nPrefer it over guessing commands or config shape from memory.\n\n skill Print the bundled setup skill and references\n skill path Materialize the setup skill and print its directory path\n`;\n\nasync function runAction(options: CliOptions): Promise<void> {\n writeActionResult(await runActionCommand(actionOptions(options)));\n}\n\nfunction actionOptions(options: CliOptions): ActionOptions {\n const eventPath = process.env.GITHUB_EVENT_PATH;\n if (!eventPath) {\n throw new Error(\"GITHUB_EVENT_PATH is required for pipr action\");\n }\n return {\n rootDir: process.env.GITHUB_WORKSPACE ?? process.cwd(),\n configDir: process.env[\"INPUT_CONFIG-DIR\"] || options.configDir,\n env: process.env,\n eventPath,\n dryRun: process.env.PIPR_DRY_RUN === \"1\",\n logSink: githubActionsLogSink,\n };\n}\n\nconst githubActionsLogSink: ActionLogSink = {\n log(record) {\n githubActionLogWriters[record.level](formatGitHubActionLogRecord(record));\n },\n async group(name, run) {\n return await core.group(name, run);\n },\n};\n\nconst githubActionLogWriters = {\n info: core.info,\n notice: core.notice,\n warning: core.warning,\n error: core.error,\n debug: core.debug,\n} satisfies Record<ActionLogRecord[\"level\"], (message: string) => void>;\n\nfunction formatGitHubActionLogRecord(record: ActionLogRecord): string {\n const line = JSON.stringify({\n level: record.level,\n event: record.event,\n ...record.fields,\n });\n return record.text === undefined ? line : `${line}\\n${record.text}`;\n}\n\nfunction writeActionResult(result: ActionCommandResult): void {\n if (result.kind === \"ignored\") {\n core.info(`pipr ignored event: ${result.reason}`);\n return;\n }\n writeLoadedActionResult(result);\n}\n\ntype LoadedActionResult = Exclude<ActionCommandResult, { kind: \"ignored\" }>;\ntype PublishedActionResult = Exclude<LoadedActionResult, { kind: \"dry-run\" }>;\ntype CommandActionResult = Extract<\n PublishedActionResult,\n { kind: \"command-help\" | \"command-response\" }\n>;\ntype ReviewWorkflowActionResult = Exclude<PublishedActionResult, CommandActionResult>;\n\nfunction writeLoadedActionResult(result: LoadedActionResult): void {\n core.info(\n `pipr loaded change #${result.event.change.number} for ${result.event.repository.slug}`,\n );\n core.info(`pipr config source: ${result.configSource}`);\n if (result.kind === \"dry-run\") {\n writeDryRunActionResult(result);\n return;\n }\n writePublishedActionResult(result);\n}\n\nfunction writePublishedActionResult(result: PublishedActionResult): void {\n if (result.kind === \"command-help\" || result.kind === \"command-response\") {\n writeCommandActionResult(result);\n return;\n }\n writeReviewWorkflowActionResult(result);\n}\n\nfunction writeCommandActionResult(result: CommandActionResult): void {\n switch (result.kind) {\n case \"command-help\":\n writeCommandHelpActionResult(result);\n break;\n case \"command-response\":\n writeCommandResponseActionResult(result);\n break;\n default:\n result satisfies never;\n }\n}\n\nfunction writeReviewWorkflowActionResult(result: ReviewWorkflowActionResult): void {\n switch (result.kind) {\n case \"review\":\n writeReviewActionResult(result);\n break;\n case \"verifier\":\n writeVerifierActionResult(result);\n break;\n default:\n result satisfies never;\n }\n}\n\nfunction writeDryRunActionResult(result: Extract<ActionCommandResult, { kind: \"dry-run\" }>): void {\n void result;\n core.info(\"PIPR_DRY_RUN=1; stopping before review runtime, model, or GitHub publishing calls\");\n}\n\nfunction writeCommandHelpActionResult(\n result: Extract<ActionCommandResult, { kind: \"command-help\" }>,\n): void {\n core.info(`pipr command help: ${result.reason}`);\n core.setOutput(\"main-comment\", result.body);\n}\n\nfunction writeCommandResponseActionResult(\n result: Extract<ActionCommandResult, { kind: \"command-response\" }>,\n): void {\n core.info(\n `pipr command '${result.command}' published response comment (${result.publication.action})`,\n );\n core.setOutput(\"main-comment\", result.response.body);\n core.setOutput(\"publication\", JSON.stringify(result.publication));\n}\n\nfunction writeVerifierActionResult(\n result: Extract<ActionCommandResult, { kind: \"verifier\" }>,\n): void {\n core.info(\n `pipr verifier processed review comment reply with ${result.errors.length} publication error(s)`,\n );\n warnInlineResolutionErrors(result.errors);\n core.setOutput(\"publication\", JSON.stringify({ inlineResolutionErrors: result.errors }));\n}\n\nfunction writeReviewActionResult(result: Extract<ActionCommandResult, { kind: \"review\" }>): void {\n core.info(\n `pipr review produced ${result.review.validated.validFindings.length} valid inline finding(s), ` +\n `${result.review.validated.droppedFindings.length} dropped finding(s)`,\n );\n core.info(\n `pipr published main comment (${result.publication.mainComment.action}) and ` +\n `${result.publication.inlineComments.posted} inline comment(s); ` +\n `${result.publication.inlineComments.skipped} skipped`,\n );\n warnInlineResolutionErrors(result.publication.metadata.inlineResolutionErrors);\n if (result.review.repairAttempted) {\n core.info(\"pipr repaired reviewer JSON once before validation\");\n }\n core.setOutput(\"main-comment\", result.review.mainComment);\n core.setOutput(\"inline-comments\", JSON.stringify(result.review.inlineCommentDrafts));\n core.setOutput(\"dropped-findings\", JSON.stringify(result.review.validated.droppedFindings));\n core.setOutput(\"publication\", JSON.stringify(result.publication));\n}\n\nfunction warnInlineResolutionErrors(errors: string[]): void {\n for (const error of errors) {\n core.warning(`pipr inline resolution failed: ${error}`);\n }\n}\n\nasync function runInit(options: CliOptions): Promise<void> {\n const result = await runInitCommand({\n rootDir: process.cwd(),\n configDir: options.configDir,\n force: options.force === true,\n adapters: parseInitAdapters(options.adapters),\n recipe: options.recipe,\n minimal: options.minimal === true,\n });\n console.log(\n `created ${result.created.length} file(s)` +\n (result.overwritten.length > 0 ? `; overwrote ${result.overwritten.length}` : \"\"),\n );\n if (options.minimal === true) {\n console.log(\n \"For editor types, install @usepipr/sdk at the repo root: npm install -D @usepipr/sdk\",\n );\n }\n}\n\nfunction parseInitAdapters(adapters: string | undefined): string[] | undefined {\n return adapters?.split(\",\").map((adapter) => adapter.trim());\n}\n\nasync function runCheck(options: CliOptions): Promise<void> {\n const settings = await runValidateCommand({\n rootDir: process.cwd(),\n configDir: options.configDir,\n env: process.env,\n requireProviderEnv: options.requireEnv === true,\n });\n console.log(`valid: ${settings.source}`);\n for (const warning of settings.warnings) {\n console.log(`warning: ${warning}`);\n }\n}\n\nasync function runInspect(options: CliOptions): Promise<void> {\n const result = await runInspectCommand({\n rootDir: process.cwd(),\n configDir: options.configDir,\n env: process.env,\n });\n console.log(inspect(result, { depth: 8, colors: false }));\n}\n\nasync function runSkillGet(): Promise<void> {\n console.log(formatBundledSkill(await resolveBundledSkill()));\n}\n\nasync function runSkillPath(): Promise<void> {\n console.log(await materializeBundledSkill());\n}\n\nfunction runVersion(): void {\n console.log(cliPackage.version);\n}\n\nasync function runUpdate(): Promise<void> {\n const result = await runPiprUpdate({\n currentVersion: cliPackage.version,\n executablePath: resolveCurrentExecutablePath(),\n });\n if (result.kind === \"up-to-date\") {\n console.log(`pipr ${result.version} is already up to date`);\n return;\n }\n console.log(`updated pipr from ${result.previousVersion} to ${result.version}`);\n}\n\nasync function writeAvailableUpdateNotice(options: MainOptions): Promise<void> {\n const env = options.env ?? process.env;\n if (shouldSkipUpdateNotice(env)) {\n return;\n }\n try {\n const notice = await availablePiprUpdateNotice({\n currentVersion: cliPackage.version,\n fetch: options.updateNoticeFetch,\n timeoutMs: 750,\n });\n if (notice) {\n (options.writeUpdateNotice ?? console.error)(formatUpdateNotice(notice));\n }\n } catch {\n return;\n }\n}\n\nfunction shouldSkipUpdateNotice(env: NodeJS.ProcessEnv): boolean {\n if (env.PIPR_UPDATE_NOTICE === \"0\") {\n return true;\n }\n if (env.PIPR_UPDATE_NOTICE === \"1\") {\n return false;\n }\n\n const ci = env.CI?.trim().toLowerCase();\n return (\n (ci !== undefined && ci !== \"\" && ci !== \"0\" && ci !== \"false\") ||\n env.GITHUB_ACTIONS !== undefined\n );\n}\n\nfunction formatUpdateNotice(notice: UpdateNotice): string {\n return (\n `pipr ${notice.latestVersion} is available (current ${notice.currentVersion}). ` +\n \"Run `pipr update` for release binaries, or reinstall @usepipr/cli with npm/Bun.\"\n );\n}\n\nasync function runLocalReview(options: CliOptions): Promise<void> {\n if (!options.base) {\n throw new Error(\"pipr review requires --base <sha>\");\n }\n const result = await runLocalReviewCommand({\n rootDir: process.cwd(),\n configDir: options.configDir,\n env: process.env,\n baseSha: options.base,\n headSha: options.head,\n piExecutable: options.piExecutable,\n logSink: localConsoleLogSink,\n taskLog: stderrTaskLog,\n });\n writeLocalReviewResult(result, options.json === true);\n}\n\ntype LocalReviewResult = Awaited<ReturnType<typeof runLocalReviewCommand>>;\n\nconst stderrTaskLog = {\n info(message: string) {\n console.error(`[info] ${message}`);\n },\n warn(message: string) {\n console.error(`[warn] ${message}`);\n },\n error(message: string) {\n console.error(`[error] ${message}`);\n },\n};\n\nconst localConsoleLogSink: ActionLogSink = {\n log(record) {\n console.error(formatLocalLogRecord(record));\n },\n async group(_name, run) {\n return await run();\n },\n};\n\nfunction formatLocalLogRecord(record: ActionLogRecord): string {\n const fields = Object.entries(record.fields)\n .map(([key, value]) => formatLocalLogField(key, value))\n .filter((field): field is string => field !== undefined);\n const prefix = formatLocalLogPrefix(record);\n const formatted = [...prefix, ...fields].join(\" \");\n return record.text === undefined ? formatted : `${formatted}\\n${record.text}`;\n}\n\nfunction formatLocalLogPrefix(record: ActionLogRecord): string[] {\n return [\"pipr\", localLogPlainLevels.has(record.level) ? \"\" : record.level, record.event].filter(\n Boolean,\n );\n}\n\nconst localLogNumberFields: Record<string, (value: number) => string> = {\n additions: (value) => `+${value}`,\n deletions: (value) => `-${value}`,\n durationMs: (value) =>\n `duration=${value < 1000 ? `${value}ms` : `${(value / 1000).toFixed(1)}s`}`,\n promptBytes: (value) => `prompt=${value}B`,\n stderrBytes: (value) => `stderr=${value}B`,\n stdoutBytes: (value) => `stdout=${value}B`,\n};\n\nconst localLogPlainLevels = new Set([\"info\", \"notice\"]);\n\nfunction formatLocalLogField(key: string, value: unknown): string | undefined {\n if (value == null) {\n return undefined;\n }\n\n return formatLocalLogFieldValue(key, value);\n}\n\nfunction formatLocalLogFieldValue(key: string, value: unknown): string {\n const formattedNumber =\n typeof value === \"number\" ? localLogNumberFields[key]?.(value) : undefined;\n return formattedNumber ?? `${key}=${formatLocalLogValue(value)}`;\n}\n\nconst localLogValueFormatters: Record<string, (value: unknown) => string> = {\n boolean: String,\n number: String,\n object: (value) =>\n Array.isArray(value)\n ? value.length === 0\n ? \"-\"\n : value.map(formatLocalLogValue).join(\",\")\n : JSON.stringify(value),\n string: (value) => {\n const text = String(value);\n return /\\s/.test(text) ? JSON.stringify(text) : text;\n },\n};\n\nfunction formatLocalLogValue(value: unknown): string {\n return (localLogValueFormatters[typeof value] ?? JSON.stringify)(value);\n}\n\nfunction writeLocalReviewResult(result: LocalReviewResult, json: boolean): void {\n if (json) {\n console.log(JSON.stringify(localReviewJson(result), null, 2));\n return;\n }\n if (result.kind === \"skipped\") {\n console.log(`skipped: ${result.skipReason ?? \"no task matched\"}`);\n return;\n }\n console.log(formatLocalReview(result));\n}\n\nfunction formatLocalReview(result: Extract<LocalReviewResult, { kind: \"review\" }>): string {\n const mainComment = stripMainCommentMarker(result.mainComment);\n const inlineFindings = result.inlineCommentDrafts.map((draft, index) => {\n const range =\n draft.startLine === draft.endLine\n ? `${draft.path}:${draft.startLine}`\n : `${draft.path}:${draft.startLine}-${draft.endLine}`;\n return [\n `${index + 1}. ${range}`,\n `Range: ${draft.finding.rangeId ?? \"-\"}`,\n draft.finding.body,\n ].join(\"\\n\");\n });\n return inlineFindings.length === 0\n ? mainComment\n : [mainComment.trimEnd(), \"\", \"## Inline Findings\", \"\", inlineFindings.join(\"\\n\\n\")].join(\"\\n\");\n}\n\nfunction stripMainCommentMarker(comment: string): string {\n return comment\n .split(\"\\n\")\n .filter((line) => !line.startsWith(\"<!-- pipr:main-comment \"))\n .join(\"\\n\")\n .trimStart();\n}\n\nfunction localReviewJson(result: LocalReviewResult) {\n return {\n kind: result.kind,\n ...(result.kind === \"skipped\" ? { skipReason: result.skipReason } : {}),\n mainComment: result.mainComment,\n inlineFindings: result.inlineCommentDrafts,\n droppedFindings: result.validated.droppedFindings,\n taskChecks: result.taskChecks,\n provider: result.provider,\n providerModels: result.publicationPlan.metadata.providerModels ?? [result.provider.model],\n repairAttempted: result.repairAttempted,\n };\n}\n\nasync function runDryRun(options: CliOptions): Promise<void> {\n if (!options.event) {\n throw new Error(\"dry-run requires --event <path>\");\n }\n const result = await runDryRunCommand({\n rootDir: process.cwd(),\n configDir: options.configDir,\n env: process.env,\n eventPath: options.event,\n });\n console.log(\n inspect(\n {\n configSource: result.configSource,\n event: result.event,\n },\n { depth: 6, colors: false },\n ),\n );\n}\n","#!/usr/bin/env bun\nimport * as core from \"@actions/core\";\nimport { PublicationError } from \"@usepipr/runtime\";\nimport { runMain } from \"./runner.js\";\n\nrunMain().catch((error: unknown) => {\n if (error instanceof PublicationError && error.result) {\n core.setOutput(\"publication\", JSON.stringify(error.result));\n core.error(`pipr publication metadata: ${JSON.stringify(error.result)}`);\n }\n const message = error instanceof Error ? error.message : String(error);\n core.setFailed(message);\n process.exitCode = 1;\n});\n"],"mappings":";;;;;;;;;;;;;ACGA,MAAa,mBAAmB;AAChC,MAAM,wBAAwB,IAAI,IAAI;CACpC;CACA;CACA;AACF,CAAC;AAiBD,SAAgB,mBAAmB,SAA4C;CAC7E,MAAM,CAAC,SAAS,QAAQ;CACxB,IAAI,QAAQ,OAAO,WAAW,KAAK,OAAO,SAAA,cACxC,MAAM,IAAI,MACR,6CAA6C,iBAAiB,YAAY,QAAQ,OAC/E,KAAK,SAAS,KAAK,IAAI,CAAC,CACxB,KAAK,IAAI,GACd;CAEF,OAAO;AACT;AAEA,SAAgB,uBAAuB,MAAc,cAA8B;CACjF,IAAI,KAAK,WAAW,YAAY,GAC9B,MAAM,IAAI,MAAM,6CAA6C,cAAc;CAE7E,MAAM,eAAe,KAAK,QAAQ,IAAI;CACtC,MAAM,SAAS,KAAK,QAAQ,cAAc,YAAY;CACtD,IAAI,WAAW,gBAAgB,CAAC,OAAO,WAAW,GAAG,eAAe,KAAK,KAAK,GAC5E,MAAM,IAAI,MAAM,wDAAwD,cAAc;CAExF,OAAO;AACT;AAEA,eAAsB,wBAAwB,YAAkD;CAC9F,MAAM,UAAU,MAAM,QAAQ,YAAY,EAAE,eAAe,KAAK,CAAC;CAmBjE,MAAM,UAAU,EAAE,SAAQ,MAlBL,QAAQ,IAC3B,QACG,QAAQ,UAAU,MAAM,YAAY,CAAC,CAAC,CACtC,IAAI,OAAO,UAAU;EACpB,MAAM,WAAW,KAAK,KAAK,YAAY,MAAM,IAAI;EACjD,MAAM,QAAQ,MAAM,eAAe,QAAQ;EAC3C,0BAA0B,MAAM,MAAM,KAAK;EAC3C,MAAM,UAAU,MAAM,MAAM,SAAS,KAAK,SAAS,UAAU;EAC7D,IAAI,CAAC,SACH,MAAM,I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": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Command line interface for pipr pull request review automation",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -33,8 +33,8 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@actions/core": "3.0.1",
36
- "@usepipr/runtime": "0.3.0",
37
- "@usepipr/sdk": "0.3.0",
36
+ "@usepipr/runtime": "0.3.1",
37
+ "@usepipr/sdk": "0.3.1",
38
38
  "commander": "15.0.0"
39
39
  }
40
40
  }