@gotgenes/pi-permission-system 39.1.1 → 40.0.0
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/CHANGELOG.md +28 -0
- package/dist/public.d.ts +36 -0
- package/docs/configuration.md +36 -0
- package/docs/cross-extension-api.md +11 -10
- package/docs/subagent-integration.md +1 -0
- package/package.json +1 -1
- package/src/access-intent/bash/bash-path-resolver.ts +85 -16
- package/src/access-intent/bash/command-enumeration.ts +77 -17
- package/src/access-intent/bash/program.ts +34 -8
- package/src/access-intent/bash/token-collection.ts +47 -10
- package/src/authority/forwarded-request-server.ts +6 -1
- package/src/authority/forwarding-io.ts +44 -0
- package/src/authority/permission-forwarding.ts +9 -0
- package/src/handlers/gates/bash-command.ts +28 -3
- package/src/handlers/gates/tool.ts +15 -1
- package/src/logging/command-redaction.ts +1 -0
- package/src/policy/permission-manager.ts +44 -11
- package/src/policy/serving-policy.ts +40 -1
- package/src/presentation/dialog-renderer.ts +3 -0
- package/src/presentation/forwarded-ask-payload.ts +1 -0
- package/src/presentation/path-ask-payload.ts +2 -0
- package/src/presentation/prompt-payload.ts +11 -0
- package/src/presentation/review-log-renderer.ts +1 -0
- package/src/presentation/skill-ask-payload.ts +1 -0
- package/src/presentation/tool-ask-payload.ts +1 -0
- package/src/service/bash-advisory-check.ts +16 -5
- package/src/service/permissions-service.ts +6 -1
- package/src/types.ts +23 -0
- package/src/access-intent/bash/sync-commands.ts +0 -43
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type BashCommand,
|
|
3
|
-
collectCommands,
|
|
4
|
-
collectSalvagedCommands,
|
|
5
|
-
} from "./command-enumeration";
|
|
6
|
-
import { WordReader } from "./node-text";
|
|
7
|
-
import { getWarmBashParser } from "./parser";
|
|
8
|
-
import { ShellVariables } from "./shell-variable-expansion";
|
|
9
|
-
import { withSalvagedRoots } from "./unresolved-salvage";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Synchronously enumerate the command-pattern units of a bash command using the
|
|
13
|
-
* warmed tree-sitter parser.
|
|
14
|
-
*
|
|
15
|
-
* Returns `null` when the parser has not been warmed yet (the pre-warm window),
|
|
16
|
-
* so the caller can fall back to whole-string matching rather than block. Once
|
|
17
|
-
* warm it mirrors the enumeration the gate performs (`BashProgram.commands()`):
|
|
18
|
-
* chains split, nested substitutions/subshells descend, opaque wrappers flagged
|
|
19
|
-
* (#306). Only the command-pattern surface is produced — no path slices, so no
|
|
20
|
-
* `PathNormalizer` is needed.
|
|
21
|
-
*
|
|
22
|
-
* An unparseable command yields an empty array (the caller's decompose path
|
|
23
|
-
* fails it closed via `resolveBashCommandCheck`, #452).
|
|
24
|
-
*/
|
|
25
|
-
export function parseBashCommandsSync(command: string): BashCommand[] | null {
|
|
26
|
-
const parser = getWarmBashParser();
|
|
27
|
-
if (!parser) return null;
|
|
28
|
-
const tree = parser.parse(command);
|
|
29
|
-
if (!tree) return [];
|
|
30
|
-
try {
|
|
31
|
-
return withSalvagedRoots(tree.rootNode, parser, (salvaged) => {
|
|
32
|
-
const words = new WordReader(
|
|
33
|
-
ShellVariables.scan([tree.rootNode, ...salvaged]),
|
|
34
|
-
);
|
|
35
|
-
return [
|
|
36
|
-
...collectCommands(tree.rootNode, words),
|
|
37
|
-
...salvaged.flatMap((root) => collectSalvagedCommands(root, words)),
|
|
38
|
-
];
|
|
39
|
-
});
|
|
40
|
-
} finally {
|
|
41
|
-
tree.delete();
|
|
42
|
-
}
|
|
43
|
-
}
|