feat: vendor permission system source

This commit is contained in:
云服务部-叶林立
2026-08-19 14:35:19 +08:00
parent 198584daf8
commit 410c50a3e5
809 changed files with 157793 additions and 139 deletions
@@ -0,0 +1,28 @@
import type { TSNode } from "#src/access-intent/bash/parser";
/**
* Build a fake {@link TSNode} for testing the pure AST helpers without paying
* for a real tree-sitter parse.
*
* Fills only the fields those helpers read; `children` drives both `childCount`
* and `child(i)`, so a node's structural shape (delimiters plus a
* `variable_name`, a quoted string's inner content) can be expressed directly.
*
* Prefer a real parse (`getParser()`) when the test's subject is the AST shape
* tree-sitter actually produces; use this when the subject is the helper's
* behavior given a shape.
*/
export function makeTSNode(
type: string,
text: string,
children: TSNode[] = [],
): TSNode {
return {
type,
text,
startIndex: 0,
childCount: children.length,
isNamed: true,
child: (i) => children[i] ?? null,
};
}