npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@spences10/pi-project-trust

v0.0.19

Published

Shared trust-policy helpers for Pi extensions that need consistent project resource safety checks

Readme

@spences10/pi-project-trust

built with Vite+ tested with Vitest npm version license

my-pi package preview

Share one trust policy across Pi extensions that touch project files or resources. pi-project-trust helps extensions consistently decide when a path, command, or project-owned resource is safe to use.

Use this package when an extension needs to decide whether to load repo-controlled resources that can execute code or influence model context, such as project MCP config, hook config, or project-local LSP binaries.

Relationship to upstream Pi

Audit baseline: upstream Pi 0.80.10 owns whole-project trust for .pi/settings.json, standard .pi resources, and project .agents/skills. It exposes that decision to extensions through ctx.isProjectTrusted(). Pi also owns project package/resource overrides, including autoload: false; this package does not wrap those settings.

pi-project-trust remains additive for individual resources Pi does not discover or hash, including root mcp.json, hook commands, and project-local executables. It supports per-subject hashes, allow-once decisions, environment policy, and global fallbacks. These records stay in the global my-pi-settings.json store so a project cannot grant trust to its own resources through .pi/settings.json. Callers whose resources are already fully covered by Pi's project trust should use ctx.isProjectTrusted() instead of adding another prompt.

Usage

import { resolve_project_trust } from '@spences10/pi-project-trust';

const decision = await resolve_project_trust(
	{
		kind: 'mcp-config',
		id: '/repo/mcp.json',
		hash: 'sha256',
		store_key: '/repo/mcp.json',
		env_key: 'MY_PI_MCP_PROJECT_CONFIG',
		prompt_title:
			'Project mcp.json can spawn local commands. Trust this config?',
		summary_lines: ['- sqlite: npx mcp-sqlite-tools'],
	},
	{
		has_ui: ctx.hasUI,
		select: ctx.hasUI ? ctx.ui.select : undefined,
	},
);

Reusable trust wrappers

Use create_project_trust_wrapper() when several subject-specific functions need the same store handling. The wrapper constructs the store path, checks current entries, optionally checks a legacy entry, and delegates persistence. Kinds, ids, hashes, environment keys, prompt copy, fallbacks, and choice labels remain in the caller.

import { create_project_trust_wrapper } from '@spences10/pi-project-trust';

const project_config_trust = create_project_trust_wrapper({
	store_filename: 'trusted-example-projects.json',
	legacy_matcher: (entry, subject) => {
		const legacy = entry as { path?: unknown; hash?: unknown };
		return (
			legacy?.path === subject.id && legacy.hash === subject.hash
		);
	},
});

Decisions

Environment values are normalized consistently across extensions:

  • 1, true, yes, allow — allow once for this run
  • trust — persist trust for this resource
  • 0, false, no, skip, disable — skip the resource
  • global, global-only — use the configured global fallback when a subject supports one

Allow-once is intentionally not trust. Callers can use decision.metadata_trusted to keep untrusted model-facing metadata suppressed while still allowing a resource for the current run.

Untrusted repo defaults

apply_project_trust_untrusted_defaults() sets conservative defaults for project resources without overriding explicit operator choices:

  • MY_PI_MCP_PROJECT_CONFIG=skip
  • MY_PI_HOOKS_CONFIG=skip
  • MY_PI_LSP_PROJECT_BINARY=global
  • MY_PI_PROMPT_PRESETS_PROJECT=skip
  • MY_PI_PROJECT_SKILLS=skip

Trust stores

Built-in trust store names are persisted under the trust section of global my-pi-settings.json; unrecognized custom store names retain standalone JSON-file behavior for API compatibility. The default store directory comes from @spences10/pi-settings, which already delegates agent directory normalization to upstream Pi.

Hash-based subjects are invalidated when their hash changes. Path-only subjects are supported for current LSP binary trust semantics.

Development

Package scripts build transitive workspace dependencies first, then run local tools through Vite+ with vp exec.

pnpm --filter @spences10/pi-project-trust run check
pnpm --filter @spences10/pi-project-trust run test
pnpm --filter @spences10/pi-project-trust run build

License

MIT