aiwg
Version:
Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo
79 lines • 2.77 kB
TypeScript
/**
* Cross-Graph Set Queries
*
* Provides neighbor lookup and set operations (intersection, union, difference)
* across dependency graphs. Supports typed edge filtering and cross-graph joins.
*
* @implements #725
* @source @src/artifacts/types.ts
* @tests @test/unit/artifacts/graph-query.test.ts
*/
import type { DependencyGraph, GraphType } from './types.js';
export interface NeighborsOptions {
/** Graph to query */
graph: GraphType;
/** Node identifier (file path or REF-XXX) */
node: string;
/** Direction: in (upstream/cited-by), out (downstream/cites), or both */
direction?: 'in' | 'out' | 'both';
/** Filter by edge type (e.g., "cites", "depends-on") */
edgeType?: string;
/** Output format */
json?: boolean;
}
export interface SetQueryOptions {
/** Graph to query */
graph: GraphType;
/** Set operation */
op: 'intersection' | 'union' | 'difference';
/** First operand: neighbors of this node */
nodeA: string;
/** Second operand: neighbors of this node */
nodeB: string;
/** Direction for neighbor lookup */
direction?: 'in' | 'out';
/** Filter by edge type */
edgeType?: string;
/** Output format */
json?: boolean;
}
/**
* Get neighbors of a node in a dependency graph.
*
* @param graph - Loaded dependency graph
* @param node - Node path to look up
* @param direction - "in" (upstream), "out" (downstream), or "both"
* @param edgeType - Optional filter by edge type
* @returns Array of neighbor paths
*/
export declare function getNeighbors(graph: DependencyGraph, node: string, direction?: 'in' | 'out' | 'both', edgeType?: string): string[];
/**
* Resolve a node identifier to a graph key.
*
* Supports:
* - Exact path match ("documentation/citations/REF-008-citations.md")
* - REF-XXX shorthand — finds the first key containing the REF identifier
* - Partial path match — finds the first key ending with the given string
*/
export declare function resolveNode(graph: DependencyGraph, node: string): string | null;
/**
* Set intersection of two arrays
*/
export declare function setIntersection(a: string[], b: string[]): string[];
/**
* Set union of two arrays
*/
export declare function setUnion(a: string[], b: string[]): string[];
/**
* Set difference: elements in a but not in b
*/
export declare function setDifference(a: string[], b: string[]): string[];
/**
* Execute the `neighbors` subcommand
*/
export declare function showNeighbors(cwd: string, options: NeighborsOptions): Promise<void>;
/**
* Execute a set query (intersection, union, difference) on neighbor sets
*/
export declare function executeSetQuery(cwd: string, options: SetQueryOptions): Promise<void>;
//# sourceMappingURL=graph-query.d.ts.map