@lifeaitools/rdc-skills 0.34.0 → 0.35.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/.claude-plugin/plugin.json +284 -1
- package/VALIDATOR-ARCHITECTURE.md +534 -0
- package/commands/analyze-tests.md +11 -0
- package/commands/check-clean-code.md +11 -0
- package/commands/check-packages.md +10 -0
- package/commands/compare-compliance.md +14 -0
- package/commands/full-analysis.md +50 -0
- package/commands/get-refactoring-plan.md +13 -0
- package/commands/quick-check.md +13 -0
- package/commands/recover.md +149 -0
- package/commands/review-arch.md +12 -0
- package/commands/review.md +12 -113
- package/commands/suggest-patterns.md +11 -0
- package/commands/validate-solid.md +11 -0
- package/package.json +14 -2
- package/scripts/architecture-score.mjs +157 -0
- package/scripts/clean-code-score.mjs +177 -0
- package/scripts/duplication-score.mjs +66 -0
- package/scripts/lib/architecture-scoring.mjs +695 -0
- package/scripts/lib/clean-code-scoring.mjs +258 -0
- package/scripts/lib/duplication-scoring.mjs +238 -0
- package/scripts/lib/language-plugin.mjs +82 -0
- package/scripts/lib/package-metrics.mjs +439 -0
- package/scripts/lib/pattern-scoring.mjs +351 -0
- package/scripts/lib/plugins/treesitter.mjs +1182 -0
- package/scripts/lib/plugins/typescript.mjs +672 -0
- package/scripts/lib/refactoring-scoring.mjs +307 -0
- package/scripts/lib/solid-scoring.mjs +101 -0
- package/scripts/lib/test-smell-scoring.mjs +581 -0
- package/scripts/lib/vendor/codeflow-parser/.source-commit +1 -0
- package/scripts/lib/vendor/codeflow-parser/grammars.d.ts +23 -0
- package/scripts/lib/vendor/codeflow-parser/grammars.js +57 -0
- package/scripts/lib/vendor/codeflow-parser/memberFacts.d.ts +274 -0
- package/scripts/lib/vendor/codeflow-parser/memberFacts.js +1117 -0
- package/scripts/lib/vendor/codeflow-parser/nativeParser.d.ts +115 -0
- package/scripts/lib/vendor/codeflow-parser/nativeParser.js +759 -0
- package/scripts/lib/vendor/codeflow-parser/package.json +3 -0
- package/scripts/lib/vendor/codeflow-parser/xmlParser.d.ts +77 -0
- package/scripts/lib/vendor/codeflow-parser/xmlParser.js +400 -0
- package/scripts/package-metrics-cli.mjs +112 -0
- package/scripts/pattern-score.mjs +143 -0
- package/scripts/refactoring-score.mjs +253 -0
- package/scripts/solid-score.mjs +337 -0
- package/skills/architecture-reviewer/SKILL.md +287 -0
- package/skills/clean-code-analyzer/SKILL.md +147 -0
- package/skills/package-design/SKILL.md +118 -0
- package/skills/pattern-advisor/SKILL.md +237 -0
- package/skills/pattern-refactoring-guide/SKILL.md +262 -0
- package/skills/review/SKILL.md +29 -0
- package/skills/solid-validator/SKILL.md +92 -0
- package/skills/testing-strategy/SKILL.md +132 -0
- package/tests/lib/architecture-scoring.test.mjs +335 -0
- package/tests/lib/clean-code-scoring.test.mjs +241 -0
- package/tests/lib/duplication-scoring.test.mjs +144 -0
- package/tests/lib/fixtures.mjs +58 -0
- package/tests/lib/package-metrics.test.mjs +241 -0
- package/tests/lib/pattern-scoring.test.mjs +251 -0
- package/tests/lib/refactoring-scoring.test.mjs +264 -0
- package/tests/lib/solid-scoring.test.mjs +291 -0
- package/tests/lib/test-smell-scoring.test.mjs +281 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* nativeParser.ts — LanguageParser implementation via pre-built tree-sitter WASM.
|
|
3
|
+
*
|
|
4
|
+
* Implements the LanguageParser contract from @regen/codeflow using the native
|
|
5
|
+
* web-tree-sitter bindings. Extracts symbols, interfaces, calls, and imports
|
|
6
|
+
* from TypeScript, JavaScript, Python, C, C++, and C# source files.
|
|
7
|
+
*
|
|
8
|
+
* Design decisions:
|
|
9
|
+
* D2 — parser topology: native node-tree-sitter in PM2 service
|
|
10
|
+
* D3 — rich CALLS edge (call_line, receiver, resolved, arity, count)
|
|
11
|
+
* D10 — types live in @regen/codeflow (no new shared package)
|
|
12
|
+
* A2 — resolution_confidence scale per phase-f
|
|
13
|
+
* A3 — parse_status enum for false-RED guard
|
|
14
|
+
*/
|
|
15
|
+
import { type ParsedMember, type ParsedUnit, type SymbolReference } from './memberFacts.js';
|
|
16
|
+
export type { DeclaredName, MagicNumber, OverrideShape, ParsedMember, ParsedUnit, SwitchFact, SymbolReference, } from './memberFacts.js';
|
|
17
|
+
export interface ParseFileInput {
|
|
18
|
+
path: string;
|
|
19
|
+
content: string;
|
|
20
|
+
language: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ParsedSymbol {
|
|
23
|
+
name: string;
|
|
24
|
+
kind: string;
|
|
25
|
+
exported: boolean;
|
|
26
|
+
start_line: number;
|
|
27
|
+
end_line: number;
|
|
28
|
+
signature?: string;
|
|
29
|
+
return_type?: string;
|
|
30
|
+
decorators?: string[];
|
|
31
|
+
complexity?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface ParsedInterface {
|
|
34
|
+
name: string;
|
|
35
|
+
kind: string;
|
|
36
|
+
exported: boolean;
|
|
37
|
+
start_line: number;
|
|
38
|
+
end_line: number;
|
|
39
|
+
}
|
|
40
|
+
export interface ParsedCall {
|
|
41
|
+
caller: string;
|
|
42
|
+
callee: string;
|
|
43
|
+
call_line: number;
|
|
44
|
+
receiver?: string;
|
|
45
|
+
resolved: boolean;
|
|
46
|
+
resolution_confidence: number;
|
|
47
|
+
arity: number;
|
|
48
|
+
count?: number;
|
|
49
|
+
}
|
|
50
|
+
export interface ParsedImport {
|
|
51
|
+
source: string;
|
|
52
|
+
specifiers: string[];
|
|
53
|
+
line: number;
|
|
54
|
+
}
|
|
55
|
+
export type ParseStatus = 'parsed' | 'no_grammar' | 'parse_error' | 'legitimately_empty';
|
|
56
|
+
export interface ParseFileResult {
|
|
57
|
+
path: string;
|
|
58
|
+
language: string;
|
|
59
|
+
symbols: ParsedSymbol[];
|
|
60
|
+
interfaces: ParsedInterface[];
|
|
61
|
+
calls: ParsedCall[];
|
|
62
|
+
imports: ParsedImport[];
|
|
63
|
+
parse_status: ParseStatus;
|
|
64
|
+
/**
|
|
65
|
+
* True when at least one function body hit `maxCallsPerFunction` and its
|
|
66
|
+
* remaining calls were dropped.
|
|
67
|
+
*
|
|
68
|
+
* Without this, a capped file is INDISTINGUISHABLE from a fully-parsed one,
|
|
69
|
+
* so any coverage figure computed over these results silently reports
|
|
70
|
+
* truncated data as complete. The cap differs by surface on purpose
|
|
71
|
+
* (local-index 50 for editor latency, hydration 200, evidence 500), which
|
|
72
|
+
* makes the ambiguity worse, not better — the same file yields different
|
|
73
|
+
* call counts depending on who parsed it, with nothing in the result saying so.
|
|
74
|
+
*/
|
|
75
|
+
calls_truncated: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* One entry per callable body — free function, class method, constructor,
|
|
78
|
+
* accessor, lambda, nested helper — carrying the structural facts a
|
|
79
|
+
* SOLID/Clean-Code/patterns/refactoring scorer reads.
|
|
80
|
+
*
|
|
81
|
+
* This is the surface that did not exist. `symbols`/`calls`/`imports` above
|
|
82
|
+
* are the coarse view CodeFlow's graph consumes and are unchanged in shape.
|
|
83
|
+
*/
|
|
84
|
+
members: ParsedMember[];
|
|
85
|
+
/** One entry per class declared in the file. */
|
|
86
|
+
units: ParsedUnit[];
|
|
87
|
+
/**
|
|
88
|
+
* For each symbol this file exports: how many times it is referenced in the
|
|
89
|
+
* OTHER files of the same `parse()` batch, and which files those are.
|
|
90
|
+
* `count: 0` with `files: []` is the dead-export signal.
|
|
91
|
+
*/
|
|
92
|
+
references: SymbolReference[];
|
|
93
|
+
/**
|
|
94
|
+
* False when this language has no hand-written node-type profile and fell
|
|
95
|
+
* back to the C-like defaults.
|
|
96
|
+
*
|
|
97
|
+
* A scorer must be able to tell "this member genuinely has no branches" from
|
|
98
|
+
* "we asked a grammar the wrong node-type names and it truthfully answered
|
|
99
|
+
* zero". That distinction is invisible in the numbers themselves, which is
|
|
100
|
+
* precisely how python and csharp carried 0 CALLS for months while looking
|
|
101
|
+
* like clean, call-free code.
|
|
102
|
+
*/
|
|
103
|
+
profile_complete: boolean;
|
|
104
|
+
}
|
|
105
|
+
export interface LanguageParser {
|
|
106
|
+
readonly id: string;
|
|
107
|
+
readonly languages: string[];
|
|
108
|
+
parse(files: ParseFileInput[]): Promise<ParseFileResult[]>;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Create a native tree-sitter LanguageParser.
|
|
112
|
+
*/
|
|
113
|
+
export declare function createNativeParser(opts?: {
|
|
114
|
+
maxCallsPerFunction?: number;
|
|
115
|
+
}): LanguageParser;
|