@principal-ai/codebase-composition 0.2.22 → 0.2.25
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/dist/helpers/QualityMetricsCalculator.d.ts +26 -7
- package/dist/helpers/QualityMetricsCalculator.d.ts.map +1 -1
- package/dist/helpers/QualityMetricsCalculator.js +149 -107
- package/dist/helpers/QualityMetricsCalculator.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/PackageLayerModule.d.ts.map +1 -1
- package/dist/modules/PackageLayerModule.js +169 -3
- package/dist/modules/PackageLayerModule.js.map +1 -1
- package/dist/strategies/go-tools.d.ts +27 -0
- package/dist/strategies/go-tools.d.ts.map +1 -0
- package/dist/strategies/go-tools.js +184 -0
- package/dist/strategies/go-tools.js.map +1 -0
- package/dist/strategies/index.d.ts +37 -0
- package/dist/strategies/index.d.ts.map +1 -0
- package/dist/strategies/index.js +73 -0
- package/dist/strategies/index.js.map +1 -0
- package/dist/strategies/node-tools.d.ts +21 -0
- package/dist/strategies/node-tools.d.ts.map +1 -0
- package/dist/strategies/node-tools.js +141 -0
- package/dist/strategies/node-tools.js.map +1 -0
- package/dist/strategies/python-tools.d.ts +25 -0
- package/dist/strategies/python-tools.d.ts.map +1 -0
- package/dist/strategies/python-tools.js +191 -0
- package/dist/strategies/python-tools.js.map +1 -0
- package/dist/strategies/rust-tools.d.ts +23 -0
- package/dist/strategies/rust-tools.d.ts.map +1 -0
- package/dist/strategies/rust-tools.js +176 -0
- package/dist/strategies/rust-tools.js.map +1 -0
- package/dist/strategies/tool-detection.d.ts +137 -0
- package/dist/strategies/tool-detection.d.ts.map +1 -0
- package/dist/strategies/tool-detection.js +13 -0
- package/dist/strategies/tool-detection.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rust Tool Detection Strategy
|
|
3
|
+
*
|
|
4
|
+
* Handles detection for the Rust ecosystem:
|
|
5
|
+
* - clippy and rustfmt are rustup components (part of toolchain)
|
|
6
|
+
* - cargo test is built into Cargo
|
|
7
|
+
* - Some tools are cargo-installed binaries (cargo-nextest, cargo-llvm-cov)
|
|
8
|
+
* - Some are dev-dependencies in Cargo.toml [dev-dependencies]
|
|
9
|
+
* - Config in rustfmt.toml, clippy.toml, or Cargo.toml sections
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Tool metadata for Rust ecosystem
|
|
13
|
+
*/
|
|
14
|
+
const RUST_TOOLS = {
|
|
15
|
+
clippy: {
|
|
16
|
+
toolId: 'clippy',
|
|
17
|
+
displayName: 'Clippy',
|
|
18
|
+
packageName: 'clippy', // rustup component name
|
|
19
|
+
isRustupComponent: true,
|
|
20
|
+
configPatterns: ['clippy.toml', '.clippy.toml'],
|
|
21
|
+
configAlternatives: ['Cargo.toml [lints.clippy]'],
|
|
22
|
+
defaultCommand: 'cargo clippy -- -D warnings',
|
|
23
|
+
},
|
|
24
|
+
rustfmt: {
|
|
25
|
+
toolId: 'rustfmt',
|
|
26
|
+
displayName: 'rustfmt',
|
|
27
|
+
packageName: 'rustfmt', // rustup component name
|
|
28
|
+
isRustupComponent: true,
|
|
29
|
+
configPatterns: ['rustfmt.toml', '.rustfmt.toml'],
|
|
30
|
+
defaultCommand: 'cargo fmt --check',
|
|
31
|
+
},
|
|
32
|
+
'cargo-test': {
|
|
33
|
+
toolId: 'cargo-test',
|
|
34
|
+
displayName: 'Cargo Test',
|
|
35
|
+
packageName: 'cargo', // Built into Cargo
|
|
36
|
+
configPatterns: [],
|
|
37
|
+
defaultCommand: 'cargo test',
|
|
38
|
+
},
|
|
39
|
+
'cargo-nextest': {
|
|
40
|
+
toolId: 'cargo-nextest',
|
|
41
|
+
displayName: 'cargo-nextest',
|
|
42
|
+
packageName: 'cargo-nextest',
|
|
43
|
+
configPatterns: ['.config/nextest.toml'],
|
|
44
|
+
defaultCommand: 'cargo nextest run',
|
|
45
|
+
},
|
|
46
|
+
'cargo-llvm-cov': {
|
|
47
|
+
toolId: 'cargo-llvm-cov',
|
|
48
|
+
displayName: 'cargo-llvm-cov',
|
|
49
|
+
packageName: 'cargo-llvm-cov',
|
|
50
|
+
configPatterns: [],
|
|
51
|
+
defaultCommand: 'cargo llvm-cov',
|
|
52
|
+
},
|
|
53
|
+
'cargo-audit': {
|
|
54
|
+
toolId: 'cargo-audit',
|
|
55
|
+
displayName: 'cargo-audit',
|
|
56
|
+
packageName: 'cargo-audit',
|
|
57
|
+
configPatterns: [],
|
|
58
|
+
defaultCommand: 'cargo audit',
|
|
59
|
+
},
|
|
60
|
+
'cargo-deny': {
|
|
61
|
+
toolId: 'cargo-deny',
|
|
62
|
+
displayName: 'cargo-deny',
|
|
63
|
+
packageName: 'cargo-deny',
|
|
64
|
+
configPatterns: ['deny.toml'],
|
|
65
|
+
defaultCommand: 'cargo deny check',
|
|
66
|
+
},
|
|
67
|
+
'cargo-machete': {
|
|
68
|
+
toolId: 'cargo-machete',
|
|
69
|
+
displayName: 'cargo-machete',
|
|
70
|
+
packageName: 'cargo-machete',
|
|
71
|
+
configPatterns: [],
|
|
72
|
+
defaultCommand: 'cargo machete',
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Tools that are rustup components
|
|
77
|
+
*/
|
|
78
|
+
const RUSTUP_COMPONENTS = new Set(['clippy', 'rustfmt']);
|
|
79
|
+
/**
|
|
80
|
+
* Tools that are built into Cargo
|
|
81
|
+
*/
|
|
82
|
+
const CARGO_BUILTINS = new Set(['cargo-test']);
|
|
83
|
+
export class RustToolDetection {
|
|
84
|
+
ecosystem = 'rust';
|
|
85
|
+
displayName = 'Rust';
|
|
86
|
+
detectToolAvailability(toolId, packageData, configFiles) {
|
|
87
|
+
const tool = RUST_TOOLS[toolId];
|
|
88
|
+
// Built-in Cargo tools are always available if Cargo is installed
|
|
89
|
+
if (CARGO_BUILTINS.has(toolId)) {
|
|
90
|
+
return {
|
|
91
|
+
installed: true,
|
|
92
|
+
configured: true, // No config needed
|
|
93
|
+
hasRunCommand: true,
|
|
94
|
+
source: 'toolchain',
|
|
95
|
+
details: 'Built into Cargo',
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
// Rustup components (clippy, rustfmt) are typically available
|
|
99
|
+
// They come with the Rust toolchain, though technically optional
|
|
100
|
+
if (RUSTUP_COMPONENTS.has(toolId)) {
|
|
101
|
+
const configFile = configFiles[toolId];
|
|
102
|
+
const configured = configFile?.exists ?? false;
|
|
103
|
+
return {
|
|
104
|
+
installed: true, // Assume available with standard toolchain
|
|
105
|
+
configured,
|
|
106
|
+
hasRunCommand: true,
|
|
107
|
+
source: 'toolchain',
|
|
108
|
+
details: 'Available via rustup component',
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
// Check if tool is in dev-dependencies
|
|
112
|
+
let installed = false;
|
|
113
|
+
let version;
|
|
114
|
+
const packageName = tool?.packageName ?? toolId;
|
|
115
|
+
if (packageData.devDependencies[packageName]) {
|
|
116
|
+
installed = true;
|
|
117
|
+
version = packageData.devDependencies[packageName];
|
|
118
|
+
}
|
|
119
|
+
// Check if config exists (which suggests the tool is used)
|
|
120
|
+
const configFile = configFiles[toolId];
|
|
121
|
+
const configured = configFile?.exists ?? false;
|
|
122
|
+
// For cargo-installed tools, if config exists, assume tool is installed
|
|
123
|
+
if (configured && !installed) {
|
|
124
|
+
installed = true;
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
installed,
|
|
128
|
+
configured,
|
|
129
|
+
hasRunCommand: installed,
|
|
130
|
+
source: installed && version ? 'dependency' : 'binary',
|
|
131
|
+
version,
|
|
132
|
+
details: version ? 'In dev-dependencies' : 'Cargo-installed binary',
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
getInstallInstructions(toolId, _packageManager) {
|
|
136
|
+
const tool = RUST_TOOLS[toolId];
|
|
137
|
+
if (CARGO_BUILTINS.has(toolId)) {
|
|
138
|
+
return {
|
|
139
|
+
command: 'Built into Cargo - no installation needed',
|
|
140
|
+
notes: 'This tool is part of the Rust toolchain',
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
if (RUSTUP_COMPONENTS.has(toolId)) {
|
|
144
|
+
return {
|
|
145
|
+
command: `rustup component add ${tool?.packageName ?? toolId}`,
|
|
146
|
+
notes: 'This is a rustup component, typically included with rustup default',
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
const packageName = tool?.packageName ?? toolId;
|
|
150
|
+
return {
|
|
151
|
+
command: `cargo install ${packageName}`,
|
|
152
|
+
alternatives: {
|
|
153
|
+
'cargo-binstall': `cargo binstall ${packageName}`,
|
|
154
|
+
},
|
|
155
|
+
notes: 'cargo-binstall is faster if you have it installed (downloads pre-built binaries)',
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
getDefaultCommand(toolId) {
|
|
159
|
+
const tool = RUST_TOOLS[toolId];
|
|
160
|
+
return tool?.defaultCommand ?? toolId;
|
|
161
|
+
}
|
|
162
|
+
isToolchainTool(toolId) {
|
|
163
|
+
return RUSTUP_COMPONENTS.has(toolId) || CARGO_BUILTINS.has(toolId);
|
|
164
|
+
}
|
|
165
|
+
getToolIdFromPackage(packageName) {
|
|
166
|
+
// Check if this is a known tool package
|
|
167
|
+
for (const [toolId, tool] of Object.entries(RUST_TOOLS)) {
|
|
168
|
+
if (tool.packageName === packageName) {
|
|
169
|
+
return [toolId];
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return [packageName];
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
export const rustToolDetection = new RustToolDetection();
|
|
176
|
+
//# sourceMappingURL=rust-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rust-tools.js","sourceRoot":"","sources":["../../src/strategies/rust-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAWH;;GAEG;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AE,WAAW,IAAI,MAAM,CAAC;QAEhD,OAAO;YACL,OAAO,EAAE,iBAAiB,WAAW,EAAE;YACvC,YAAY,EAAE;gBACZ,gBAAgB,EAAE,kBAAkB,WAAW,EAAE;aAClD;YACD,KAAK,EAAE,kFAAkF;SAC1F,CAAC;IACJ,CAAC;IAED,iBAAiB,CAAC,MAAc;QAC9B,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;QAChC,OAAO,IAAI,EAAE,cAAc,IAAI,MAAM,CAAC;IACxC,CAAC;IAED,eAAe,CAAC,MAAc;QAC5B,OAAO,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACrE,CAAC;IAED,oBAAoB,CAAC,WAAmB;QACtC,wCAAwC;QACxC,KAAK,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;YACxD,IAAI,IAAI,CAAC,WAAW,KAAK,WAAW,EAAE,CAAC;gBACrC,OAAO,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC;QACH,CAAC;QACD,OAAO,CAAC,WAAW,CAAC,CAAC;IACvB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Detection Strategy Pattern
|
|
3
|
+
*
|
|
4
|
+
* Provides ecosystem-specific logic for detecting tool availability,
|
|
5
|
+
* generating install instructions, and determining how to run tools.
|
|
6
|
+
*
|
|
7
|
+
* Each ecosystem (Node, Python, Go, Rust) has different conventions for:
|
|
8
|
+
* - Where dev tools are declared (package.json vs pyproject.toml vs go.mod vs Cargo.toml)
|
|
9
|
+
* - How tools are installed (npm vs pip vs go install vs cargo/rustup)
|
|
10
|
+
* - Where scripts/commands are defined (npm scripts vs Makefile vs cargo aliases)
|
|
11
|
+
*/
|
|
12
|
+
import type { ConfigFile, PackageCommand } from '../types/layer-types';
|
|
13
|
+
/**
|
|
14
|
+
* Supported package ecosystems
|
|
15
|
+
*/
|
|
16
|
+
export type Ecosystem = 'node' | 'python' | 'go' | 'rust';
|
|
17
|
+
/**
|
|
18
|
+
* How a tool is made available in the ecosystem
|
|
19
|
+
*/
|
|
20
|
+
export type ToolSource = 'dependency' | 'toolchain' | 'binary' | 'dev-group' | 'unknown';
|
|
21
|
+
/**
|
|
22
|
+
* Result of checking if a tool is available
|
|
23
|
+
*/
|
|
24
|
+
export interface ToolAvailability {
|
|
25
|
+
/** Whether the tool package/binary is available */
|
|
26
|
+
installed: boolean;
|
|
27
|
+
/** Whether configuration exists for this tool */
|
|
28
|
+
configured: boolean;
|
|
29
|
+
/** Whether there's a command/script to run this tool */
|
|
30
|
+
hasRunCommand: boolean;
|
|
31
|
+
/** How the tool was detected */
|
|
32
|
+
source: ToolSource;
|
|
33
|
+
/** Version if known */
|
|
34
|
+
version?: string;
|
|
35
|
+
/** Additional details about detection */
|
|
36
|
+
details?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Unified package data passed to detection strategies
|
|
40
|
+
*/
|
|
41
|
+
export interface PackageData {
|
|
42
|
+
/** Package name */
|
|
43
|
+
name: string;
|
|
44
|
+
/** Package ecosystem */
|
|
45
|
+
ecosystem: Ecosystem;
|
|
46
|
+
/** Path to the package root */
|
|
47
|
+
path: string;
|
|
48
|
+
/** Production dependencies */
|
|
49
|
+
dependencies: Record<string, string>;
|
|
50
|
+
/** Development dependencies */
|
|
51
|
+
devDependencies: Record<string, string>;
|
|
52
|
+
/** All dependency groups (Python optional-dependencies, etc.) */
|
|
53
|
+
dependencyGroups?: Record<string, Record<string, string>>;
|
|
54
|
+
/** Available commands/scripts */
|
|
55
|
+
commands: PackageCommand[];
|
|
56
|
+
/** Detected package manager */
|
|
57
|
+
packageManager: string;
|
|
58
|
+
/** Raw manifest content for ecosystem-specific parsing */
|
|
59
|
+
manifestContent?: unknown;
|
|
60
|
+
/** Path to tools.go file (Go only) */
|
|
61
|
+
toolsGoPath?: string;
|
|
62
|
+
/** Content of tools.go if it exists (Go only) */
|
|
63
|
+
toolsGoContent?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Install instruction with ecosystem-appropriate commands
|
|
67
|
+
*/
|
|
68
|
+
export interface InstallInstruction {
|
|
69
|
+
/** Primary install command */
|
|
70
|
+
command: string;
|
|
71
|
+
/** Alternative commands for different package managers */
|
|
72
|
+
alternatives?: Record<string, string>;
|
|
73
|
+
/** Additional setup steps if needed */
|
|
74
|
+
additionalSteps?: string[];
|
|
75
|
+
/** Notes about the installation */
|
|
76
|
+
notes?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Strategy interface for ecosystem-specific tool detection
|
|
80
|
+
*/
|
|
81
|
+
export interface ToolDetectionStrategy {
|
|
82
|
+
/** Which ecosystem this strategy handles */
|
|
83
|
+
ecosystem: Ecosystem;
|
|
84
|
+
/** Human-readable name for this ecosystem */
|
|
85
|
+
displayName: string;
|
|
86
|
+
/**
|
|
87
|
+
* Check if a tool is available for use in this package
|
|
88
|
+
*/
|
|
89
|
+
detectToolAvailability(toolId: string, packageData: PackageData, configFiles: Record<string, ConfigFile | undefined>): ToolAvailability;
|
|
90
|
+
/**
|
|
91
|
+
* Generate ecosystem-appropriate install instructions
|
|
92
|
+
*/
|
|
93
|
+
getInstallInstructions(toolId: string, packageManager?: string): InstallInstruction;
|
|
94
|
+
/**
|
|
95
|
+
* Get the default command to run this tool
|
|
96
|
+
* Used when no explicit script is defined
|
|
97
|
+
*/
|
|
98
|
+
getDefaultCommand(toolId: string): string;
|
|
99
|
+
/**
|
|
100
|
+
* Check if this tool is part of the language toolchain
|
|
101
|
+
* (e.g., gofmt for Go, rustfmt for Rust)
|
|
102
|
+
*/
|
|
103
|
+
isToolchainTool(toolId: string): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Get the canonical tool ID for a given package name
|
|
106
|
+
* Handles aliases (e.g., 'ruff' package provides 'ruff' and 'ruff-format')
|
|
107
|
+
*/
|
|
108
|
+
getToolIdFromPackage(packageName: string): string[];
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Metadata for a tool within an ecosystem
|
|
112
|
+
*/
|
|
113
|
+
export interface ToolMetadata {
|
|
114
|
+
/** Tool identifier */
|
|
115
|
+
toolId: string;
|
|
116
|
+
/** Human-readable name */
|
|
117
|
+
displayName: string;
|
|
118
|
+
/** Package name to install (may differ from toolId) */
|
|
119
|
+
packageName: string;
|
|
120
|
+
/** For Go: full module path */
|
|
121
|
+
goModule?: string;
|
|
122
|
+
/** For Rust: whether it's a rustup component */
|
|
123
|
+
isRustupComponent?: boolean;
|
|
124
|
+
/** Config file patterns to look for */
|
|
125
|
+
configPatterns: string[];
|
|
126
|
+
/** Alternative config locations (e.g., pyproject.toml section) */
|
|
127
|
+
configAlternatives?: string[];
|
|
128
|
+
/** Default command to run the tool */
|
|
129
|
+
defaultCommand: string;
|
|
130
|
+
/** Minimum recommended version */
|
|
131
|
+
minVersion?: string;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Registry mapping tool IDs to their metadata per ecosystem
|
|
135
|
+
*/
|
|
136
|
+
export type ToolRegistry = Record<Ecosystem, Record<string, ToolMetadata>>;
|
|
137
|
+
//# sourceMappingURL=tool-detection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-detection.d.ts","sourceRoot":"","sources":["../../src/strategies/tool-detection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEvE;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,IAAI,GAAG,MAAM,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,UAA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,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Detection Strategy Pattern
|
|
3
|
+
*
|
|
4
|
+
* Provides ecosystem-specific logic for detecting tool availability,
|
|
5
|
+
* generating install instructions, and determining how to run tools.
|
|
6
|
+
*
|
|
7
|
+
* Each ecosystem (Node, Python, Go, Rust) has different conventions for:
|
|
8
|
+
* - Where dev tools are declared (package.json vs pyproject.toml vs go.mod vs Cargo.toml)
|
|
9
|
+
* - How tools are installed (npm vs pip vs go install vs cargo/rustup)
|
|
10
|
+
* - Where scripts/commands are defined (npm scripts vs Makefile vs cargo aliases)
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=tool-detection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-detection.js","sourceRoot":"","sources":["../../src/strategies/tool-detection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@principal-ai/codebase-composition",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.25",
|
|
4
4
|
"description": "Codebase decomposition into semantic layers",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"prepare": "husky"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@principal-ai/codebase-quality-lenses": "^0.1.
|
|
23
|
+
"@principal-ai/codebase-quality-lenses": "^0.1.45",
|
|
24
24
|
"@principal-ai/repository-abstraction": "^0.2.2",
|
|
25
25
|
"ignore": "^5.3.0",
|
|
26
26
|
"js-toml": "^1.0.0",
|