gennady 0.7.0 → 0.8.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/ai/directives/coding/result-conventions.xml +25 -7
- package/ai/directives/sdd/audit.directive.xml +1 -1
- package/ai/directives/sdd/critic-protocol.xml +78 -0
- package/ai/directives/sdd/critic.directive.xml +158 -0
- package/ai/directives/sdd/phase-execution-protocol.xml +11 -9
- package/ai/skills/alt-opinion/SKILL.md +79 -0
- package/ai/skills/alt-opinion/opinion.prompt.md +11 -0
- package/ai/skills/alt-opinion/synth.prompt.md +8 -0
- package/ai/skills/sdd-audit/SKILL.md +13 -0
- package/ai/skills/sdd-check/SKILL.md +139 -0
- package/ai/skills/sdd-continue/SKILL.md +13 -0
- package/ai/skills/sdd-critic/SKILL.md +12 -0
- package/ai/skills/sdd-discover/SKILL.md +13 -0
- package/ai/skills/sdd-execute/SKILL.md +205 -0
- package/ai/skills/sdd-execute/scripts/README.md +84 -0
- package/ai/skills/sdd-execute/scripts/check-blockers.sh +158 -0
- package/ai/skills/sdd-execute/scripts/classify-scripts.js +111 -0
- package/ai/skills/sdd-execute/scripts/classify-scripts.ts +133 -0
- package/ai/skills/sdd-execute/scripts/extract-section.sh +219 -0
- package/ai/skills/sdd-execute/scripts/lint-artifacts.sh +143 -0
- package/ai/skills/sdd-execute/scripts/scan.sh +385 -0
- package/ai/skills/sdd-execute/scripts/sdd +114 -0
- package/ai/skills/sdd-execute/scripts/verify.sh +139 -0
- package/ai/skills/sdd-execute-batch/SKILL.md +213 -0
- package/ai/skills/sdd-fix/SKILL.md +13 -0
- package/ai/skills/sdd-infra/SKILL.md +13 -0
- package/ai/skills/sdd-module-decomposition/SKILL.md +13 -0
- package/ai/skills/sdd-scaffold/SKILL.md +13 -0
- package/ai/skills/sdd-setup/SKILL.md +13 -0
- package/dist/ai/directives/coding/result-conventions.xml +25 -7
- package/dist/ai/directives/sdd/audit.directive.xml +1 -1
- package/dist/ai/directives/sdd/critic-protocol.xml +78 -0
- package/dist/ai/directives/sdd/critic.directive.xml +158 -0
- package/dist/ai/directives/sdd/phase-execution-protocol.xml +11 -9
- package/dist/ai/skills/alt-opinion/SKILL.md +79 -0
- package/dist/ai/skills/alt-opinion/opinion.prompt.md +11 -0
- package/dist/ai/skills/alt-opinion/synth.prompt.md +8 -0
- package/dist/ai/skills/sdd-audit/SKILL.md +13 -0
- package/dist/ai/skills/sdd-check/SKILL.md +139 -0
- package/dist/ai/skills/sdd-continue/SKILL.md +13 -0
- package/dist/ai/skills/sdd-critic/SKILL.md +12 -0
- package/dist/ai/skills/sdd-discover/SKILL.md +13 -0
- package/dist/ai/skills/sdd-execute/SKILL.md +205 -0
- package/dist/ai/skills/sdd-execute/scripts/README.md +84 -0
- package/dist/ai/skills/sdd-execute/scripts/check-blockers.sh +158 -0
- package/dist/ai/skills/sdd-execute/scripts/classify-scripts.js +111 -0
- package/dist/ai/skills/sdd-execute/scripts/classify-scripts.ts +133 -0
- package/dist/ai/skills/sdd-execute/scripts/extract-section.sh +219 -0
- package/dist/ai/skills/sdd-execute/scripts/lint-artifacts.sh +143 -0
- package/dist/ai/skills/sdd-execute/scripts/scan.sh +385 -0
- package/dist/ai/skills/sdd-execute/scripts/sdd +114 -0
- package/dist/ai/skills/sdd-execute/scripts/verify.sh +139 -0
- package/dist/ai/skills/sdd-execute-batch/SKILL.md +213 -0
- package/dist/ai/skills/sdd-fix/SKILL.md +13 -0
- package/dist/ai/skills/sdd-infra/SKILL.md +13 -0
- package/dist/ai/skills/sdd-module-decomposition/SKILL.md +13 -0
- package/dist/ai/skills/sdd-scaffold/SKILL.md +13 -0
- package/dist/ai/skills/sdd-setup/SKILL.md +13 -0
- package/dist/chunks/_commonjsHelpers-DaMA6jEr.js +8 -0
- package/dist/chunks/{devtools-B-7ugZhF.js → devtools-CPZ0IUNM.js} +1 -1
- package/dist/chunks/help-5qCaicff.js +6 -0
- package/dist/chunks/help-B2ETH0j6.js +6 -0
- package/dist/chunks/help-BCDURaCQ.js +6 -0
- package/dist/chunks/help-BvgYOSyQ.js +6 -0
- package/dist/chunks/help-CSPhOoI9.js +8 -0
- package/dist/chunks/help-CV1vpwrh.js +6 -0
- package/dist/chunks/help-CaBNA6Qr.js +12 -0
- package/dist/chunks/help-CjkR6SB9.js +6 -0
- package/dist/chunks/help-Coi1l5u9.js +8 -0
- package/dist/chunks/help-CsuLpZn-.js +8 -0
- package/dist/chunks/help-DL_QBMwy.js +8 -0
- package/dist/chunks/help-DqBZ2xcp.js +6 -0
- package/dist/chunks/help-_Y_TN4DZ.js +6 -0
- package/dist/chunks/{help.cmd-B_G7EWzF.js → help.cmd-BseRtoBF.js} +10 -2
- package/dist/chunks/{index-zBnnuvLA.js → index-BU1AXJGA.js} +12 -7
- package/dist/chunks/{index-CXuhZzS3.js → index-BXWDYM_9.js} +1 -1
- package/dist/chunks/index-BgKyH0dB.js +658 -0
- package/dist/chunks/{index-CaahtXiM.js → index-BghL1-Nk.js} +2 -2
- package/dist/chunks/{index-BeL1Zcbg.js → index-BlqEQEGy.js} +1 -1
- package/dist/chunks/{index-D1qsi0Uc.js → index-CDM74qdR.js} +3 -3
- package/dist/chunks/{index-D9ceRUyB.js → index-CGsIRefC.js} +2 -2
- package/dist/chunks/{index-CiEM-8nJ.js → index-CIvkaAQ3.js} +2 -2
- package/dist/chunks/{index-UbHoePfr.js → index-CkczJ__m.js} +10 -10
- package/dist/chunks/index-CtJKSOL0.js +21 -0
- package/dist/chunks/index-DEzym4Ae.js +369 -0
- package/dist/chunks/{index-CVR66voe.js → index-DoaxOhQ8.js} +401 -393
- package/dist/chunks/index-Du1xR-qO.js +752 -0
- package/dist/chunks/{index-DU6jD7SS.js → index-OtehG7uM.js} +1 -1
- package/dist/chunks/index-ZM_FonZj.js +156 -0
- package/dist/chunks/{index-g1LXlp77.js → index-k0nToACp.js} +2 -2
- package/dist/chunks/{run-review-command.logic-DpkRoEi8.js → run-review-command.logic-BeYQin-I.js} +9 -9
- package/dist/chunks/services-IgZptnTi.js +2732 -0
- package/dist/chunks/shared-DL_1LG0K.js +753 -0
- package/dist/cli/cmd/agent-mon/help.d.ts +4 -0
- package/dist/cli/cmd/agents-rules/agents-rules.cmd.d.ts +8 -0
- package/dist/cli/cmd/agents-rules/index.d.ts +1 -0
- package/dist/cli/cmd/alt-opinion/help.d.ts +4 -0
- package/dist/cli/cmd/cat/help.d.ts +4 -0
- package/dist/cli/cmd/commit/help.d.ts +4 -0
- package/dist/cli/cmd/lint/checks/anchor-class-body.check.d.ts +11 -0
- package/dist/cli/cmd/lint/checks/invariant-count.check.d.ts +11 -0
- package/dist/cli/cmd/lint/checks/utils/glob-match.d.ts +15 -0
- package/dist/cli/cmd/lint/checks/utils/strip-strings-comments.d.ts +7 -0
- package/dist/cli/cmd/lint/help.d.ts +4 -0
- package/dist/cli/cmd/lint/lint.cmd.d.ts +1 -1
- package/dist/cli/cmd/lint/lint.types.d.ts +6 -0
- package/dist/cli/cmd/orient/core/build-index.d.ts +8 -0
- package/dist/cli/cmd/orient/core/damerau-levenshtein.d.ts +26 -0
- package/dist/cli/cmd/orient/core/extract-header.d.ts +8 -0
- package/dist/cli/cmd/orient/core/hints.d.ts +9 -0
- package/dist/cli/cmd/orient/core/query-consumer.d.ts +10 -0
- package/dist/cli/cmd/orient/core/query-entity.d.ts +11 -0
- package/dist/cli/cmd/orient/core/query-graph.d.ts +18 -0
- package/dist/cli/cmd/orient/core/query-keyword.d.ts +10 -0
- package/dist/cli/cmd/orient/core/query-spec.d.ts +15 -0
- package/dist/cli/cmd/orient/core/query-task.d.ts +8 -0
- package/dist/cli/cmd/orient/core/scan-files.d.ts +8 -0
- package/dist/cli/cmd/orient/help.d.ts +5 -0
- package/dist/cli/cmd/orient/index.d.ts +1 -0
- package/dist/cli/cmd/orient/orient.cmd.d.ts +7 -0
- package/dist/cli/cmd/orient/orient.types.d.ts +136 -0
- package/dist/cli/cmd/orient/render/render-detail.d.ts +10 -0
- package/dist/cli/cmd/orient/render/render-file-list.d.ts +15 -0
- package/dist/cli/cmd/orient/render/render-graph.d.ts +13 -0
- package/dist/cli/cmd/orient/render/render-search.d.ts +8 -0
- package/dist/cli/cmd/orient/render/render-specs.d.ts +13 -0
- package/dist/cli/cmd/orient/render/render-tree.d.ts +13 -0
- package/dist/cli/cmd/remote-console/help.d.ts +4 -0
- package/dist/cli/cmd/resolve-conflicts/help.d.ts +4 -0
- package/dist/cli/cmd/review/help.d.ts +4 -0
- package/dist/cli/cmd/review-issues/help.d.ts +4 -0
- package/dist/cli/cmd/review-verify/help.d.ts +4 -0
- package/dist/cli/cmd/sync/help.d.ts +4 -0
- package/dist/cli/cmd/sync/sync-core.d.ts +3 -2
- package/dist/cli/cmd/sync/sync-formatter.d.ts +8 -9
- package/dist/cli/cmd/sync/sync.cmd.d.ts +2 -21
- package/dist/cli/cmd/sync-skills/index.d.ts +1 -0
- package/dist/cli/cmd/sync-skills/sync-skills-core.d.ts +50 -0
- package/dist/cli/cmd/sync-skills/sync-skills-formatter.d.ts +13 -0
- package/dist/cli/cmd/sync-skills/sync-skills.cmd.d.ts +14 -0
- package/dist/cli/cmd/sync-skills/sync-skills.types.d.ts +56 -0
- package/dist/cli/cmd/vcs-reply/help.d.ts +4 -0
- package/dist/gennady.js +73 -18
- package/dist/index.js +5 -5
- package/dist/services/dbc/linter/implementations/ts/dbc-ts-ast-adapter.d.ts +3 -2
- package/dist/shared/common/sync/path-normalizer.d.ts +22 -0
- package/dist/shared/common/sync/sync-core.shared.d.ts +14 -0
- package/dist/shared/common/sync/sync-deps.type.d.ts +66 -0
- package/dist/shared/common/sync/sync-formatter.shared.d.ts +19 -0
- package/package.json +6 -5
- package/dist/chunks/index-DJpVmyp2.js +0 -176
- package/dist/chunks/index-KxSZKmZn.js +0 -540
- package/dist/chunks/services-CaLOhuLV.js +0 -2889
- package/dist/chunks/shared-Bjy30TeM.js +0 -665
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @purpose Prints agent-facing orient documentation from the gennady package README.md.
|
|
3
|
+
* @invariant Never modifies the filesystem.
|
|
4
|
+
* @param _argv CLI arguments (ignored).
|
|
5
|
+
* @returns Promise<void> — ends with process.exit(0) on success, process.exit(1) on error.
|
|
6
|
+
* @sideEffect stdout: README.md content on success; stderr: error message on failure.
|
|
7
|
+
*/
|
|
8
|
+
export declare function run(_argv: string[]): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LintError } from '../lint.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @purpose Detects #region START / #endregion END at class body level.
|
|
4
|
+
* Regions are allowed only inside method bodies (brace depth >= 2 inside a class)
|
|
5
|
+
* and at top-level (no enclosing class). Regions at class body level (between
|
|
6
|
+
* member declarations) are forbidden.
|
|
7
|
+
* @param content Source text to validate.
|
|
8
|
+
* @param filePath File path for error messages.
|
|
9
|
+
* @returns List of lint errors, empty when all regions are correctly placed.
|
|
10
|
+
*/
|
|
11
|
+
export declare function check(content: string, filePath: string): LintError[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LintError } from '../lint.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @purpose Streams through the file tracking brace depth and current enclosing entity.
|
|
4
|
+
* Counts @invariant JSDoc tags and invariant: region comments per entity.
|
|
5
|
+
* When an entity body closes, checks threshold and emits error if exceeded.
|
|
6
|
+
* @param content Source text to validate.
|
|
7
|
+
* @param filePath File path for error messages.
|
|
8
|
+
* @param maxInvariants Threshold — entities with more invariants trigger an error.
|
|
9
|
+
* @returns List of lint errors, empty when all entities are within limit.
|
|
10
|
+
*/
|
|
11
|
+
export declare function check(content: string, filePath: string, maxInvariants: number): LintError[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @purpose Converts a glob pattern to a RegExp for matching file paths.
|
|
3
|
+
* Supports: ** (any depth), * (single segment), ? (single char), [abc] (char class).
|
|
4
|
+
* @param pattern Glob pattern string.
|
|
5
|
+
* @returns RegExp that matches paths against the pattern.
|
|
6
|
+
*/
|
|
7
|
+
export declare function globToRegex(pattern: string): RegExp;
|
|
8
|
+
/**
|
|
9
|
+
* @purpose Checks whether a file path matches any of the given glob patterns.
|
|
10
|
+
* @param filePath Relative file path to check.
|
|
11
|
+
* @param patterns Array of glob patterns (already compiled or string).
|
|
12
|
+
* @param [compiled] Optional pre-compiled regexes for performance.
|
|
13
|
+
* @returns True if the path matches any pattern.
|
|
14
|
+
*/
|
|
15
|
+
export declare function matchesAnyGlob(filePath: string, patterns: string[], compiled?: RegExp[]): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @purpose Strips string literals (single/double/template) and line/block comments from a source line,
|
|
3
|
+
* returning only the structural characters ({, }) for brace-depth tracking.
|
|
4
|
+
* @param line Source code line.
|
|
5
|
+
* @returns Line with strings and comments removed, keeping only code-level braces.
|
|
6
|
+
*/
|
|
7
|
+
export declare function stripStringsAndComments(line: string): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LintReport } from './lint.types.js';
|
|
2
2
|
import type { LintError } from './lint.types.js';
|
|
3
3
|
/**
|
|
4
|
-
* @purpose Execute the gennady lint command — collect files, run
|
|
4
|
+
* @purpose Execute the gennady lint command — collect files, run 7 checks, output ESLint-format report.
|
|
5
5
|
* @implements {LintCommand} in specs/cli/lint/lint.spec.md
|
|
6
6
|
* @param rawArgs Raw command-line arguments (process.argv).
|
|
7
7
|
* @returns LintReport with aggregated errors and exit code.
|
|
@@ -70,3 +70,9 @@ export declare const ERR_CLI_LINT_STAGED_CONFLICT: "ERR_CLI_LINT_STAGED_CONFLICT
|
|
|
70
70
|
export declare const ERR_CLI_LINT_UNAUTHORIZED_DISABLE: "ERR_CLI_LINT_UNAUTHORIZED_DISABLE";
|
|
71
71
|
/** @purpose TypeScript / linter disable comment has a D-NNN reference but lacks a purpose explanation. | @invariant Implements D-007 contract tightening (TSK-52): >= 8 non-whitespace characters of purpose must remain after stripping the comment opener, the marker, and the D-NNN token. */
|
|
72
72
|
export declare const ERR_CLI_LINT_DISABLE_MISSING_PURPOSE: "ERR_CLI_LINT_DISABLE_MISSING_PURPOSE";
|
|
73
|
+
/** @purpose Entity has more invariants than the configured threshold — contract may be overloaded. | @invariant Counts both @invariant JSDoc tags and invariant: in region comments. */
|
|
74
|
+
export declare const ERR_CLI_LINT_TOO_MANY_INVARIANTS: "ERR_CLI_LINT_TOO_MANY_INVARIANTS";
|
|
75
|
+
/** @purpose #region START / #endregion END found at class body level — regions must not separate class members. */
|
|
76
|
+
export declare const ERR_CLI_LINT_ANCHOR_AT_CLASS_BODY: "ERR_CLI_LINT_ANCHOR_AT_CLASS_BODY";
|
|
77
|
+
/** @purpose Two #region START at the same brace depth without an intervening #endregion END — merge or close the first region. */
|
|
78
|
+
export declare const ERR_CLI_LINT_ANCHOR_CONSECUTIVE_START: "ERR_CLI_LINT_ANCHOR_CONSECUTIVE_START";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FileWordRef, ScannedFile } from '../orient.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @purpose Build an inverted index: word -> Set of {file, source, entity?} references.
|
|
4
|
+
* @invariant Words lowercased, split on non-alphanumeric boundaries, extracted from @file: value and entity @purpose text.
|
|
5
|
+
* @param files Scanned files with parsed headers and exports.
|
|
6
|
+
* @returns Map from normalized word to matching FileWordRef set.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildIndex(files: ScannedFile[]): Map<string, Set<FileWordRef>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @purpose Compute the Damerau-Levenshtein distance between two strings.
|
|
3
|
+
* @invariant Supports insertion, deletion, substitution, transposition; distance 0 for identical strings.
|
|
4
|
+
* @param a First string.
|
|
5
|
+
* @param b Second string.
|
|
6
|
+
* @returns Edit distance (non-negative integer).
|
|
7
|
+
*/
|
|
8
|
+
export declare function damerauLevenshtein(a: string, b: string): number;
|
|
9
|
+
/**
|
|
10
|
+
* @purpose Determine if two strings match within the fuzzy threshold.
|
|
11
|
+
* @invariant Threshold <=2 for strings of length <=5; <=3 for length >5.
|
|
12
|
+
* @param query Requested term.
|
|
13
|
+
* @param candidate Indexed term to compare against.
|
|
14
|
+
* @returns True when DL distance is within the applicable threshold.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isFuzzyMatch(query: string, candidate: string): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* @purpose Compute DL distance and return it with the match verdict.
|
|
19
|
+
* @param query Requested term.
|
|
20
|
+
* @param candidate Indexed term to compare against.
|
|
21
|
+
* @returns Distance value and whether it is within the threshold.
|
|
22
|
+
*/
|
|
23
|
+
export declare function fuzzyDistance(query: string, candidate: string): {
|
|
24
|
+
distance: number;
|
|
25
|
+
match: boolean;
|
|
26
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FileHeader } from '../orient.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @purpose Parse // @tag: directives from file content before the first import.
|
|
4
|
+
* @invariant Scans only lines before the first `import ` statement.
|
|
5
|
+
* @param content Raw file content.
|
|
6
|
+
* @returns Parsed FileHeader with file, tasks, and consumers fields.
|
|
7
|
+
*/
|
|
8
|
+
export declare function extractHeader(content: string): FileHeader;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { OrientArgs } from '../orient.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @purpose Generate up to 4 contextual hints based on the current query mode.
|
|
4
|
+
* @invariant Hints use the syntax `<cmd> --flag=<value>` or `--flag`.
|
|
5
|
+
* @invariant `<cmd>` is replaced with `orient`.
|
|
6
|
+
* @param args Parsed CLI arguments.
|
|
7
|
+
* @returns Array of hint strings (max 4).
|
|
8
|
+
*/
|
|
9
|
+
export declare function generateHints(args: OrientArgs): string[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ScannedFile, ConsumerQueryResult } from '../orient.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @purpose Find all files whose @consumers: header contains the given consumer name.
|
|
4
|
+
* @invariant Supports exact match, substring match, and fuzzy (--fuzzy) via DL distance.
|
|
5
|
+
* @param files All scanned project files.
|
|
6
|
+
* @param consumerNames One or more consumer names to search for.
|
|
7
|
+
* @param useFuzzy When true, use Damerau-Levenshtein for fuzzy matching.
|
|
8
|
+
* @returns Grouped query results per consumer name.
|
|
9
|
+
*/
|
|
10
|
+
export declare function queryConsumer(files: ScannedFile[], consumerNames: string[], useFuzzy: boolean): ConsumerQueryResult[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ScannedFile, EntityMatch } from '../orient.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @purpose Find exported entities by name — exact match or fuzzy via DL distance.
|
|
4
|
+
* @invariant Only exported entities are matched — class methods are NOT included.
|
|
5
|
+
* @invariant Fuzzy threshold: <=2 for short (<=5 chars), <=3 for long (>5).
|
|
6
|
+
* @param files All scanned project files.
|
|
7
|
+
* @param entityNames One or more entity names to search for.
|
|
8
|
+
* @param useFuzzy When true, use DL for fuzzy matching.
|
|
9
|
+
* @returns Matched entities with their file and contract info.
|
|
10
|
+
*/
|
|
11
|
+
export declare function queryEntity(files: ScannedFile[], entityNames: string[], useFuzzy: boolean): EntityMatch[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ScannedFile, GraphNode } from '../orient.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @purpose Build a consumer dependency graph from scanned files.
|
|
4
|
+
* @invariant Consumer names are extracted from @consumers: headers.
|
|
5
|
+
* @invariant Consumer name matching a file name resolves to that file; otherwise it is a text node.
|
|
6
|
+
* @param files All scanned project files.
|
|
7
|
+
* @returns Map of consumer name to GraphNode.
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildGraph(files: ScannedFile[]): Map<string, GraphNode>;
|
|
10
|
+
/**
|
|
11
|
+
* @purpose Build a recursive dependency tree from the flat graph.
|
|
12
|
+
* @invariant Detects and marks circular dependencies with `[circular]`.
|
|
13
|
+
* @param graph Flat graph map from buildGraph.
|
|
14
|
+
* @param rootConsumer Root consumer name to start from.
|
|
15
|
+
* @param maxDepth Maximum recursion depth.
|
|
16
|
+
* @returns Indented tree lines.
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildRecursiveTree(graph: Map<string, GraphNode>, rootConsumer: string, maxDepth: number): string[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ScannedFile, KeywordMatch, FileWordRef } from '../orient.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @purpose Search files by keyword with three-level scoring: exact (+10), prefix (+5), fuzzy (+3).
|
|
4
|
+
* @invariant AND semantics across tokens; scoring: exact (+10) > prefix (+5) > fuzzy (+3).
|
|
5
|
+
* @param files All scanned project files.
|
|
6
|
+
* @param index Inverted word index built by buildIndex.
|
|
7
|
+
* @param query Lowercased keyword query.
|
|
8
|
+
* @returns Scored keyword matches sorted by relevance descending.
|
|
9
|
+
*/
|
|
10
|
+
export declare function queryKeyword(files: ScannedFile[], index: Map<string, Set<FileWordRef>>, query: string): KeywordMatch[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SpecOverview } from '../orient.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @purpose Scan specs/ directory and build overview of spec files with their task references.
|
|
4
|
+
* @invariant Recursively walks specs/, parses task files to link specs to task IDs.
|
|
5
|
+
* @param projectRoot Absolute project root path.
|
|
6
|
+
* @returns Array of SpecOverview entries.
|
|
7
|
+
*/
|
|
8
|
+
export declare function loadSpecOverview(projectRoot: string): SpecOverview[];
|
|
9
|
+
/**
|
|
10
|
+
* @purpose Search for a specific spec file by name and return its tasks-to-files mapping.
|
|
11
|
+
* @param projectRoot Absolute project root path.
|
|
12
|
+
* @param specName Spec file name to search for.
|
|
13
|
+
* @returns Spec overview entry or null if not found.
|
|
14
|
+
*/
|
|
15
|
+
export declare function searchSpec(projectRoot: string, specName: string): SpecOverview | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ScannedFile, TaskQueryResult } from '../orient.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @purpose Find all files tagged with the given task ID in their @tasks: header.
|
|
4
|
+
* @param files All scanned project files.
|
|
5
|
+
* @param taskIds One or more task IDs to search for.
|
|
6
|
+
* @returns Grouped query results per task ID.
|
|
7
|
+
*/
|
|
8
|
+
export declare function queryTask(files: ScannedFile[], taskIds: string[]): TaskQueryResult[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @purpose Scan a directory recursively for .ts/.tsx files, excluding system dirs.
|
|
3
|
+
* @invariant Excludes hidden dirs (starts with `.`), EXCLUDED_DIRS, symlinks.
|
|
4
|
+
* @invariant EACCES errors are silently skipped — scan continues.
|
|
5
|
+
* @param dir Absolute or relative directory path to scan.
|
|
6
|
+
* @returns Sorted array of absolute file paths.
|
|
7
|
+
*/
|
|
8
|
+
export declare function scanFiles(dir: string): string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './orient.cmd.ts';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @purpose CLI entry point for gennady orient: routes to S1-S9 handlers based on parsed args.
|
|
3
|
+
* @param rawArgs Raw process.argv array.
|
|
4
|
+
* @returns Promise<void> — resolves after all console output is written.
|
|
5
|
+
* @sideEffect File system: reads .ts files via scanFiles; console output via render functions.
|
|
6
|
+
*/
|
|
7
|
+
export declare function run(rawArgs: string[]): Promise<void>;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import type { DbcSchema } from '../../../services/dbc/parser/dbc-parser.types.js';
|
|
2
|
+
/** @purpose Parsed file header tags extracted from top-of-file // @tag: comments. */
|
|
3
|
+
export type FileHeader = {
|
|
4
|
+
/** @purpose Value of // @file: directive */
|
|
5
|
+
file: string;
|
|
6
|
+
/** @purpose Task IDs from // @tasks: directive */
|
|
7
|
+
tasks: string[];
|
|
8
|
+
/** @purpose Consumer names from // @consumers: directive */
|
|
9
|
+
consumers: string[];
|
|
10
|
+
};
|
|
11
|
+
/** @purpose Single exported entity with its JSDoc contract and source location. */
|
|
12
|
+
export type ExportedEntity = {
|
|
13
|
+
/** @purpose Entity name (function name, class name, type name, const name) */
|
|
14
|
+
name: string;
|
|
15
|
+
/** @purpose Entity kind — class, function, const, type, interface, enum */
|
|
16
|
+
kind: 'class' | 'function' | 'const' | 'type' | 'interface' | 'enum';
|
|
17
|
+
/** @purpose Parsed DBC contract schema from JSDoc */
|
|
18
|
+
contract: DbcSchema;
|
|
19
|
+
/** @purpose Raw JSDoc text block */
|
|
20
|
+
rawJsdoc: string;
|
|
21
|
+
};
|
|
22
|
+
/** @purpose A file scanned by orient with its header, exports, and path. */
|
|
23
|
+
export type ScannedFile = {
|
|
24
|
+
/** @purpose Absolute path to the file */
|
|
25
|
+
absPath: string;
|
|
26
|
+
/** @purpose Parsed file header */
|
|
27
|
+
header: FileHeader;
|
|
28
|
+
/** @purpose Exported entities with DBC contracts */
|
|
29
|
+
exports: ExportedEntity[];
|
|
30
|
+
};
|
|
31
|
+
/** @purpose Reference from a word in @file:/@purpose back to a file and optional entity. */
|
|
32
|
+
export type FileWordRef = {
|
|
33
|
+
/** @purpose Absolute file path */
|
|
34
|
+
file: string;
|
|
35
|
+
/** @purpose Source tag — 'file' (@file:) or 'entity' (@purpose) */
|
|
36
|
+
source: 'file' | 'entity';
|
|
37
|
+
/** @purpose Entity name when source is 'entity' */
|
|
38
|
+
entity?: string;
|
|
39
|
+
};
|
|
40
|
+
/** @purpose CLI argument bundle parsed from raw args. */
|
|
41
|
+
export type OrientArgs = {
|
|
42
|
+
/** @purpose Positional arguments (keywords for S4 search) */
|
|
43
|
+
_: string[];
|
|
44
|
+
/** @purpose File paths for S5 detailed view (repeatable) */
|
|
45
|
+
file: string[];
|
|
46
|
+
/** @purpose Directory to limit scanning scope */
|
|
47
|
+
dir: string;
|
|
48
|
+
/** @purpose Task IDs for S2 file lookup (repeatable) */
|
|
49
|
+
task: string[];
|
|
50
|
+
/** @purpose Consumer names for S3 lookup (repeatable) */
|
|
51
|
+
consumer: string[];
|
|
52
|
+
/** @purpose Entity names for S6 search (repeatable) */
|
|
53
|
+
entity: string[];
|
|
54
|
+
/** @purpose Trigger S7 dependency graph mode */
|
|
55
|
+
graph: boolean;
|
|
56
|
+
/** @purpose Expand graph recursively */
|
|
57
|
+
recursive: boolean;
|
|
58
|
+
/** @purpose Trigger S8 specs overview mode */
|
|
59
|
+
specs: boolean;
|
|
60
|
+
/** @purpose Specific spec name for S9 search */
|
|
61
|
+
spec: string;
|
|
62
|
+
/** @purpose Include DBC contract details in output */
|
|
63
|
+
detail: boolean;
|
|
64
|
+
/** @purpose Enable fuzzy matching for --entity and --consumer */
|
|
65
|
+
fuzzy: boolean;
|
|
66
|
+
/** @purpose Maximum tree or graph depth */
|
|
67
|
+
depth: number;
|
|
68
|
+
/** @purpose Maximum files shown before overflow indicator */
|
|
69
|
+
maxResults: number;
|
|
70
|
+
};
|
|
71
|
+
/** @purpose Query result from a task search (S2). */
|
|
72
|
+
export type TaskQueryResult = {
|
|
73
|
+
/** @purpose Task ID that was searched */
|
|
74
|
+
taskId: string;
|
|
75
|
+
/** @purpose Matching files */
|
|
76
|
+
files: ScannedFile[];
|
|
77
|
+
};
|
|
78
|
+
/** @purpose Query result from a consumer search (S3). */
|
|
79
|
+
export type ConsumerQueryResult = {
|
|
80
|
+
/** @purpose Consumer name that was searched */
|
|
81
|
+
consumerName: string;
|
|
82
|
+
/** @purpose Matching files */
|
|
83
|
+
files: ScannedFile[];
|
|
84
|
+
};
|
|
85
|
+
/** @purpose Single keyword match with score for ranking. */
|
|
86
|
+
export type KeywordMatch = {
|
|
87
|
+
/** @purpose File reference */
|
|
88
|
+
file: ScannedFile;
|
|
89
|
+
/** @purpose Match score — higher = more relevant */
|
|
90
|
+
score: number;
|
|
91
|
+
/** @purpose Matched entity name when match is in @purpose */
|
|
92
|
+
entityName?: string;
|
|
93
|
+
};
|
|
94
|
+
/** @purpose Entity search match. */
|
|
95
|
+
export type EntityMatch = {
|
|
96
|
+
/** @purpose Entity name */
|
|
97
|
+
name: string;
|
|
98
|
+
/** @purpose Entity kind */
|
|
99
|
+
kind: string;
|
|
100
|
+
/** @purpose File where found */
|
|
101
|
+
filePath: string;
|
|
102
|
+
/** @purpose DBC contract entries */
|
|
103
|
+
contract: DbcSchema;
|
|
104
|
+
/** @purpose Whether match was fuzzy */
|
|
105
|
+
fuzzy: boolean;
|
|
106
|
+
/** @purpose DL distance when fuzzy */
|
|
107
|
+
distance?: number;
|
|
108
|
+
};
|
|
109
|
+
/** @purpose Consumer dependency edge in the architecture graph. */
|
|
110
|
+
export type GraphNode = {
|
|
111
|
+
/** @purpose Consumer name */
|
|
112
|
+
consumer: string;
|
|
113
|
+
/** @purpose Files that declare this consumer */
|
|
114
|
+
files: string[];
|
|
115
|
+
/** @purpose Consumer nodes that consume THIS consumer (reverse — who depends on this) */
|
|
116
|
+
consumedBy: string[];
|
|
117
|
+
/** @purpose Is this consumer unresolved (not matching a real file)? */
|
|
118
|
+
unresolved: boolean;
|
|
119
|
+
};
|
|
120
|
+
/** @purpose Spec overview entry for S8/S9. */
|
|
121
|
+
export type SpecOverview = {
|
|
122
|
+
/** @purpose Spec file path */
|
|
123
|
+
specPath: string;
|
|
124
|
+
/** @purpose Task IDs referenced by this spec's tasks */
|
|
125
|
+
taskIds: string[];
|
|
126
|
+
/** @purpose Whether this is a library-level spec (no own tasks, has sub-specs) */
|
|
127
|
+
isLibraryLevel: boolean;
|
|
128
|
+
/** @purpose Sub-spec paths for library-level specs */
|
|
129
|
+
subSpecs: string[];
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* @purpose Parse raw CLI args into a typed OrientArgs struct.
|
|
133
|
+
* @param rawArgs Raw process.argv array.
|
|
134
|
+
* @returns Fully populated OrientArgs with defaults.
|
|
135
|
+
*/
|
|
136
|
+
export declare function parseOrientArgs(rawArgs: string[]): OrientArgs;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ScannedFile } from '../orient.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @purpose Render a detailed view of one or more files with full DBC contracts.
|
|
4
|
+
* @invariant Renders file header block, then each exported entity with all DBC tags.
|
|
5
|
+
* @invariant Functions show signatures; classes show methods.
|
|
6
|
+
* @param files Scanned files to render in detail.
|
|
7
|
+
* @param projectRoot Absolute project root.
|
|
8
|
+
* @returns Array of formatted output lines.
|
|
9
|
+
*/
|
|
10
|
+
export declare function renderDetail(files: ScannedFile[], projectRoot: string): string[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ScannedFile } from '../orient.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @purpose Format a single file line in universal format.
|
|
4
|
+
* @param file Scanned file with header and exports.
|
|
5
|
+
* @param projectRoot Absolute project root for relative path display.
|
|
6
|
+
* @returns Formatted line string.
|
|
7
|
+
*/
|
|
8
|
+
export declare function renderFileLine(file: ScannedFile, projectRoot: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* @purpose Render a list of files in universal format.
|
|
11
|
+
* @param files Scanned files to render.
|
|
12
|
+
* @param projectRoot Absolute project root for relative path display.
|
|
13
|
+
* @returns Array of formatted lines.
|
|
14
|
+
*/
|
|
15
|
+
export declare function renderFileList(files: ScannedFile[], projectRoot: string): string[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { GraphNode } from '../orient.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @purpose Render a flat consumer dependency graph.
|
|
4
|
+
* @param graph Map of consumer name to GraphNode.
|
|
5
|
+
* @returns Array of formatted output lines.
|
|
6
|
+
*/
|
|
7
|
+
export declare function renderGraph(graph: Map<string, GraphNode>): string[];
|
|
8
|
+
/**
|
|
9
|
+
* @purpose Render a recursive dependency graph as indented tree.
|
|
10
|
+
* @param treeLines Pre-computed recursive tree lines.
|
|
11
|
+
* @returns Array of formatted output lines.
|
|
12
|
+
*/
|
|
13
|
+
export declare function renderRecursiveGraph(treeLines: string[]): string[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { KeywordMatch } from '../orient.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @purpose Render keyword search results sorted by score.
|
|
4
|
+
* @param matches Scored keyword matches.
|
|
5
|
+
* @param projectRoot Absolute project root.
|
|
6
|
+
* @returns Array of formatted output lines.
|
|
7
|
+
*/
|
|
8
|
+
export declare function renderSearch(matches: KeywordMatch[], projectRoot: string): string[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SpecOverview } from '../orient.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @purpose Render a list of all specs with their task-to-file mappings.
|
|
4
|
+
* @param overviews All spec overview entries.
|
|
5
|
+
* @returns Array of formatted output lines.
|
|
6
|
+
*/
|
|
7
|
+
export declare function renderSpecsOverview(overviews: SpecOverview[]): string[];
|
|
8
|
+
/**
|
|
9
|
+
* @purpose Render a single spec's task-to-file details.
|
|
10
|
+
* @param overview Single spec overview entry.
|
|
11
|
+
* @returns Array of formatted output lines.
|
|
12
|
+
*/
|
|
13
|
+
export declare function renderSpecSearch(overview: SpecOverview): string[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ScannedFile } from '../orient.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @purpose Render a directory tree of scanned files with annotations and depth control.
|
|
4
|
+
* @invariant Directories show `... N more dirs/dir, M files/file` when depth is exceeded.
|
|
5
|
+
* @invariant Singular/plural distinction for count indicators.
|
|
6
|
+
* @param files Scanned files.
|
|
7
|
+
* @param projectRoot Absolute project root.
|
|
8
|
+
* @param maxDepth Maximum tree depth (1-indexed).
|
|
9
|
+
* @param showDetail When true, include entity details under each file.
|
|
10
|
+
* @param maxResults Maximum files to show before overflow indicator.
|
|
11
|
+
* @returns Array of formatted output lines.
|
|
12
|
+
*/
|
|
13
|
+
export declare function renderTree(files: ScannedFile[], projectRoot: string, maxDepth: number, showDetail: boolean, maxResults: number): string[];
|
|
@@ -43,11 +43,12 @@ export interface SyncCoreDeps {
|
|
|
43
43
|
cwd: string;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
|
-
* @purpose
|
|
46
|
+
* @purpose Locate ai/directives/ in the installed gennady package. Delegates to shared resolvePackageDir.
|
|
47
47
|
* @param cwd Current working directory.
|
|
48
|
+
* @param [subdir] Subdirectory inside gennady package (defaults to 'ai/directives').
|
|
48
49
|
* @returns Absolute path to ai/directives/ or null if the package is not found.
|
|
49
50
|
*/
|
|
50
|
-
export declare function resolvePackageDir(cwd: string): string | null;
|
|
51
|
+
export declare function resolvePackageDir(cwd: string, subdir?: string): string | null;
|
|
51
52
|
/**
|
|
52
53
|
* @purpose Recursively collect a list of files in sourceDir with filter and exclusion support.
|
|
53
54
|
* @param sourceDir Source directory to scan.
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { SyncFileEntry } from './sync.types.js';
|
|
2
|
-
|
|
3
|
-
dryRun?: boolean;
|
|
4
|
-
}
|
|
2
|
+
export { formatSyncOutput } from '../../../shared/common/sync/sync-formatter.shared.js';
|
|
5
3
|
/**
|
|
6
|
-
* @purpose
|
|
7
|
-
* @param entries List of sync file entries
|
|
8
|
-
* @param [opts] Formatting options
|
|
9
|
-
* @returns Array of formatted lines
|
|
4
|
+
* @purpose Backward-compat alias for shared formatSyncOutput.
|
|
5
|
+
* @param entries List of sync file entries.
|
|
6
|
+
* @param [opts] Formatting options.
|
|
7
|
+
* @returns Array of formatted stdout lines.
|
|
10
8
|
*/
|
|
11
|
-
export declare function formatEntries(entries: SyncFileEntry[], opts?:
|
|
12
|
-
|
|
9
|
+
export declare function formatEntries(entries: SyncFileEntry[], opts?: {
|
|
10
|
+
dryRun?: boolean;
|
|
11
|
+
}): string[];
|
|
@@ -1,24 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/** @purpose Injectable dependencies for the sync CLI command — enables testing without real FS. */
|
|
4
|
-
export type SyncCmdDeps = {
|
|
5
|
-
/** @purpose Read file from disk. */
|
|
6
|
-
readFile?: typeof readFileSync;
|
|
7
|
-
/** @purpose Write file to disk. */
|
|
8
|
-
writeFile?: typeof writeFileSync;
|
|
9
|
-
/** @purpose Create directory. */
|
|
10
|
-
mkdir?: typeof mkdirSync;
|
|
11
|
-
/** @purpose Get file stats. */
|
|
12
|
-
stat?: typeof statSync;
|
|
13
|
-
/** @purpose List directory contents. */
|
|
14
|
-
readdir?: typeof readdirSync;
|
|
15
|
-
/** @purpose Resolve package directory. */
|
|
16
|
-
resolvePackageDir?: typeof resolvePackageDir;
|
|
17
|
-
/** @purpose Standard output stream. */
|
|
18
|
-
stdout?: NodeJS.WriteStream;
|
|
19
|
-
/** @purpose Standard error stream. */
|
|
20
|
-
stderr?: NodeJS.WriteStream;
|
|
21
|
-
};
|
|
1
|
+
import type { SyncCmdDeps } from '../../../shared/common/sync/sync-deps.type.js';
|
|
2
|
+
export type { SyncCmdDeps } from '../../../shared/common/sync/sync-deps.type.js';
|
|
22
3
|
/**
|
|
23
4
|
* @purpose CLI entry point for the sync command.
|
|
24
5
|
* *
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|