feat(path-access): add alwaysScope to save 'always' grants globally#35
Open
yonilerner wants to merge 1 commit intoaliou:mainfrom
Open
feat(path-access): add alwaysScope to save 'always' grants globally#35yonilerner wants to merge 1 commit intoaliou:mainfrom
yonilerner wants to merge 1 commit intoaliou:mainfrom
Conversation
By default, the path-access prompt's 'Allow ... always' options save the grant to the project-local guardrails config. This adds a new 'pathAccess.alwaysScope' setting (default 'local', for backward compat) that lets users save those grants to the user-wide config instead, so the same grant applies in every project. The allowedPaths merge in afterMerge already supports global scope, so this only changes where new grants are written. Setting is exposed in the settings UI under Path Access > Always-grant scope.
Author
|
sorry pi got a little ahead of itself, i havent even tested it yet. closing for now |
Author
|
Well it seems like it works. I dont really understand the changeset system so not sure if that addition makes any sense |
Owner
|
Hey @yonilerner thanks for the PR! I'm in the process of rewriting the extension so not going to merge this. There's a good chance this will be handled in that rewrite; but I'm going to leave the PR open to not forget about it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
pathAccess.alwaysScope("local" | "global", default"local") so users can choose where the path-access prompt's "Allow … always" grants are persisted.Today, picking "Allow file always" or "Allow directory always" in the outside-workspace prompt always saves the grant to the project-local config (
{project}/.pi/extensions/guardrails.json). For paths that are universally fine across every project —~/.nvm/versions/node/...,~/.config/<tool>, shared library checkouts — having to re-grant them in every project is repetitive.The merge logic in
afterMergealready supports global-scopeallowedPaths(additive acrossglobal > local > memory), so this PR only changes where new grants from the prompt are written. No change to existing configs.Behaviour
alwaysScope: "local") — unchanged from today.alwaysScope: "global"— "Allow … always" writes to~/.pi/agent/extensions/guardrails.json, applying the grant in every project.alwaysScope.alwaysScopeitself can be set per-scope; resolution ismemory > local > global(matching the rest of the config).UI
Exposed in
/guardrails:settingsunder Path Access → Always-grant scope with the same enum-select UX aspathAccess.mode.Tests
Added
src/hooks/path-access.test.tscovering:allow-file-always→localby defaultallow-file-always→globalwhenalwaysScope: "global"allow-dir-always→global(with parent-dir + trailing-slash behaviour preserved)alwaysScopepnpm test→ 180/180 passing.pnpm typecheckclean.pnpm lintclean.Docs / changeset
README.md— updated Path Access section.docs/defaults.md— added the new default and a description..changeset/path-access-always-scope.md— minor bump.Backward compatibility
Default value
"local"matches current behaviour exactly. Existing configs withoutalwaysScopeare unaffected. The merge already handled the global scope; only the persistence destination of new grants changes when the user opts in.