@lark-project/cli
Version:
飞书项目插件开发工具
39 lines (38 loc) • 1.53 kB
TypeScript
import type { PeekOptions } from '../types';
type JsonValue = string | number | boolean | null | JsonValue[] | {
[k: string]: JsonValue;
};
/**
* Peek a JSON file by symbol/path with optional $ref follow.
*
* Why this shape:
* - Schemas we ship (point-schema.json) are often 1000+ lines with heavy $ref
* indirection. `jq` + manual $ref chasing is what AI has to do today.
* - --index gives AI a lightweight TOC for "which point types exist".
* - follow + cycle detection lets AI get a *self-contained* slice in one call.
*/
export declare function peekJson(file: string, name: string | undefined, opts: PeekOptions): void;
/**
* Shared entrypoint used by both JSON and YAML peekers so YAML can hand off
* after parsing to js-yaml.
*/
export declare function peekJsonValue(root: JsonValue, name: string | undefined, opts: PeekOptions, file: string): void;
export interface PathSegment {
name: string;
filter?: {
field: string;
value: string;
};
}
/**
* Evaluate a `[field=value]` bracket predicate against an element. Applies the
* `point_type` local-name → backend-wire alias so AI skills can use one
* vocabulary (`page` / `liteAppComponent`…) across schema and draft JSON.
*/
export declare function matchFilterValue(actual: unknown, filter: {
field: string;
value: string;
}): boolean;
export declare function parseSegments(path: string): PathSegment[];
export declare function followSegments(root: JsonValue, segs: PathSegment[]): JsonValue | undefined;
export {};