@eldrforge/kodrdriv 1.2.29 → 1.2.123
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/application.js +16 -13
- package/dist/application.js.map +1 -1
- package/dist/arguments.js +5 -5
- package/dist/arguments.js.map +1 -1
- package/dist/commands/audio-review.js +2 -5
- package/dist/commands/audio-review.js.map +1 -1
- package/dist/commands/clean.js +2 -4
- package/dist/commands/clean.js.map +1 -1
- package/dist/commands/commit.js +3 -6
- package/dist/commands/commit.js.map +1 -1
- package/dist/commands/development.js +7 -7
- package/dist/commands/development.js.map +1 -1
- package/dist/commands/link.js +3 -7
- package/dist/commands/link.js.map +1 -1
- package/dist/commands/precommit.js +99 -0
- package/dist/commands/precommit.js.map +1 -0
- package/dist/commands/publish.js +47 -32
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/release.js +3 -7
- package/dist/commands/release.js.map +1 -1
- package/dist/commands/review.js +4 -6
- package/dist/commands/review.js.map +1 -1
- package/dist/commands/tree.js +213 -84
- package/dist/commands/tree.js.map +1 -1
- package/dist/commands/unlink.js +3 -7
- package/dist/commands/unlink.js.map +1 -1
- package/dist/commands/updates.js +2 -4
- package/dist/commands/updates.js.map +1 -1
- package/dist/commands/versions.js +3 -7
- package/dist/commands/versions.js.map +1 -1
- package/dist/constants.js +4 -2
- package/dist/constants.js.map +1 -1
- package/dist/content/files.js +2 -4
- package/dist/content/files.js.map +1 -1
- package/dist/execution/CommandValidator.js +33 -1
- package/dist/execution/CommandValidator.js.map +1 -1
- package/dist/execution/ResourceMonitor.js +26 -1
- package/dist/execution/ResourceMonitor.js.map +1 -1
- package/dist/execution/TreeExecutionAdapter.js +2 -2
- package/dist/execution/TreeExecutionAdapter.js.map +1 -1
- package/dist/util/checkpointManager.js +2 -4
- package/dist/util/checkpointManager.js.map +1 -1
- package/dist/util/dependencyGraph.js +2 -4
- package/dist/util/dependencyGraph.js.map +1 -1
- package/dist/util/general.js +7 -107
- package/dist/util/general.js.map +1 -1
- package/dist/util/gitMutex.js +63 -18
- package/dist/util/gitMutex.js.map +1 -1
- package/dist/util/precommitOptimizations.js +310 -0
- package/dist/util/precommitOptimizations.js.map +1 -0
- package/dist/util/storageAdapter.js +2 -6
- package/dist/util/storageAdapter.js.map +1 -1
- package/dist/utils/branchState.js +178 -45
- package/dist/utils/branchState.js.map +1 -1
- package/package.json +6 -5
- package/AI-FRIENDLY-LOGGING-GUIDE.md +0 -237
- package/AI-LOGGING-MIGRATION-COMPLETE.md +0 -371
- package/ALREADY-PUBLISHED-PACKAGES-FIX.md +0 -264
- package/AUDIT-BRANCHES-PROGRESS-FIX.md +0 -90
- package/AUDIT-EXAMPLE-OUTPUT.md +0 -113
- package/CHECKPOINT-RECOVERY-FIX.md +0 -450
- package/LOGGING-MIGRATION-STATUS.md +0 -186
- package/MONOREPO-PUBLISH-IMPROVEMENTS.md +0 -281
- package/PARALLEL-EXECUTION-FIXES.md +0 -132
- package/PARALLEL-PUBLISH-DEBUGGING-GUIDE.md +0 -441
- package/PARALLEL-PUBLISH-FIXES-IMPLEMENTED.md +0 -405
- package/PARALLEL-PUBLISH-IMPROVEMENTS-IMPLEMENTED.md +0 -439
- package/PARALLEL-PUBLISH-LOGGING-FIXES.md +0 -274
- package/PARALLEL-PUBLISH-QUICK-REFERENCE.md +0 -375
- package/PARALLEL_EXECUTION_FIX.md +0 -146
- package/PUBLISH_IMPROVEMENTS_IMPLEMENTED.md +0 -294
- package/RECOVERY-FIXES.md +0 -72
- package/SUBMODULE-LOCK-FIX.md +0 -132
- package/VERSION-AUDIT-FIX.md +0 -333
- package/WORKFLOW-PRECHECK-IMPLEMENTATION.md +0 -239
- package/WORKFLOW-SKIP-SUMMARY.md +0 -121
- package/dist/util/safety.js +0 -166
- package/dist/util/safety.js.map +0 -1
- package/dist/util/stdin.js +0 -133
- package/dist/util/stdin.js.map +0 -1
- package/dist/util/storage.js +0 -187
- package/dist/util/storage.js.map +0 -1
package/dist/util/safety.js
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import path__default from 'path';
|
|
2
|
-
import { getLogger } from '../logging.js';
|
|
3
|
-
import { safeJsonParse, validatePackageJson } from '@eldrforge/git-tools';
|
|
4
|
-
|
|
5
|
-
const EXCLUDED_DIRECTORIES = [
|
|
6
|
-
'node_modules',
|
|
7
|
-
'dist',
|
|
8
|
-
'build',
|
|
9
|
-
'coverage',
|
|
10
|
-
'.git',
|
|
11
|
-
'.next',
|
|
12
|
-
'.nuxt',
|
|
13
|
-
'out',
|
|
14
|
-
'public',
|
|
15
|
-
'static',
|
|
16
|
-
'assets'
|
|
17
|
-
];
|
|
18
|
-
const findAllPackageJsonFiles = async (rootDir, storage)=>{
|
|
19
|
-
const logger = getLogger();
|
|
20
|
-
const packageJsonFiles = [];
|
|
21
|
-
const scanDirectory = async (currentDir, depth = 0)=>{
|
|
22
|
-
// Prevent infinite recursion and overly deep scanning
|
|
23
|
-
if (depth > 5) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
try {
|
|
27
|
-
if (!await storage.exists(currentDir) || !await storage.isDirectory(currentDir)) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const items = await storage.listFiles(currentDir);
|
|
31
|
-
// Check for package.json in current directory
|
|
32
|
-
if (items.includes('package.json')) {
|
|
33
|
-
const packageJsonPath = path__default.join(currentDir, 'package.json');
|
|
34
|
-
try {
|
|
35
|
-
const packageJsonContent = await storage.readFile(packageJsonPath, 'utf-8');
|
|
36
|
-
const parsed = safeJsonParse(packageJsonContent, packageJsonPath);
|
|
37
|
-
const packageJson = validatePackageJson(parsed, packageJsonPath);
|
|
38
|
-
const relativePath = path__default.relative(rootDir, currentDir);
|
|
39
|
-
packageJsonFiles.push({
|
|
40
|
-
path: packageJsonPath,
|
|
41
|
-
packageJson,
|
|
42
|
-
relativePath: relativePath || '.'
|
|
43
|
-
});
|
|
44
|
-
logger.debug(`Found package.json at: ${relativePath || '.'}`);
|
|
45
|
-
} catch (error) {
|
|
46
|
-
logger.debug(`Skipped invalid package.json at ${packageJsonPath}: ${error.message}`);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
// Scan subdirectories, excluding build/generated directories
|
|
50
|
-
for (const item of items){
|
|
51
|
-
if (EXCLUDED_DIRECTORIES.includes(item)) {
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
const itemPath = path__default.join(currentDir, item);
|
|
55
|
-
try {
|
|
56
|
-
if (await storage.isDirectory(itemPath)) {
|
|
57
|
-
await scanDirectory(itemPath, depth + 1);
|
|
58
|
-
}
|
|
59
|
-
} catch (error) {
|
|
60
|
-
// Skip directories that can't be accessed
|
|
61
|
-
logger.debug(`Skipped directory ${itemPath}: ${error.message}`);
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
} catch (error) {
|
|
66
|
-
logger.debug(`Failed to scan directory ${currentDir}: ${error.message}`);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
await scanDirectory(rootDir);
|
|
70
|
-
logger.debug(`Found ${packageJsonFiles.length} package.json file(s) in directory tree`);
|
|
71
|
-
return packageJsonFiles;
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* Checks for file: dependencies in package.json files that should not be committed
|
|
75
|
-
* @param storage Storage utility instance
|
|
76
|
-
* @param rootDir Root directory to scan (defaults to current working directory)
|
|
77
|
-
* @returns Array of issues found, empty array if no issues
|
|
78
|
-
*/ const checkForFileDependencies = async (storage, rootDir = process.cwd())=>{
|
|
79
|
-
const logger = getLogger();
|
|
80
|
-
const issues = [];
|
|
81
|
-
try {
|
|
82
|
-
const packageJsonFiles = await findAllPackageJsonFiles(rootDir, storage);
|
|
83
|
-
for (const { packageJson, relativePath } of packageJsonFiles){
|
|
84
|
-
const fileDeps = [];
|
|
85
|
-
// Check all dependency types for file: paths
|
|
86
|
-
const dependencyChecks = [
|
|
87
|
-
{
|
|
88
|
-
deps: packageJson.dependencies,
|
|
89
|
-
type: 'dependencies'
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
deps: packageJson.devDependencies,
|
|
93
|
-
type: 'devDependencies'
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
deps: packageJson.peerDependencies,
|
|
97
|
-
type: 'peerDependencies'
|
|
98
|
-
}
|
|
99
|
-
];
|
|
100
|
-
for (const { deps, type } of dependencyChecks){
|
|
101
|
-
if (deps) {
|
|
102
|
-
for (const [name, version] of Object.entries(deps)){
|
|
103
|
-
if (version.startsWith('file:')) {
|
|
104
|
-
fileDeps.push({
|
|
105
|
-
name,
|
|
106
|
-
version,
|
|
107
|
-
dependencyType: type
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
if (fileDeps.length > 0) {
|
|
114
|
-
issues.push({
|
|
115
|
-
packagePath: relativePath,
|
|
116
|
-
dependencies: fileDeps
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
} catch (error) {
|
|
121
|
-
logger.debug(`Failed to check for file dependencies: ${error.message}`);
|
|
122
|
-
}
|
|
123
|
-
return issues;
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* Logs file dependency issues in a user-friendly format
|
|
127
|
-
* @param issues Array of file dependency issues
|
|
128
|
-
* @param context Context for the warning (e.g., 'commit', 'link check')
|
|
129
|
-
*/ const logFileDependencyWarning = (issues, context = 'operation')=>{
|
|
130
|
-
const logger = getLogger();
|
|
131
|
-
if (issues.length === 0) {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
logger.warn(`FILE_DEPS_WARNING: Found file: dependencies that should not be committed | Context: ${context} | Count: ${issues.length} | Impact: May cause build issues`);
|
|
135
|
-
for (const issue of issues){
|
|
136
|
-
logger.warn(`FILE_DEPS_PACKAGE: Package with file dependencies | Package: ${issue.packagePath}`);
|
|
137
|
-
for (const dep of issue.dependencies){
|
|
138
|
-
logger.warn(`FILE_DEPS_DETAIL: Dependency details | Name: ${dep.name} | Version: ${dep.version} | Type: ${dep.dependencyType}`);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
logger.warn('');
|
|
142
|
-
};
|
|
143
|
-
/**
|
|
144
|
-
* Provides suggestions for resolving file dependency issues
|
|
145
|
-
* @param hasUnlinkCapability Whether the current context supports unlinking
|
|
146
|
-
*/ const logFileDependencySuggestions = (hasUnlinkCapability = true)=>{
|
|
147
|
-
const logger = getLogger();
|
|
148
|
-
logger.warn('FILE_DEPS_RESOLUTION: Steps to resolve file dependency issues:');
|
|
149
|
-
if (hasUnlinkCapability) {
|
|
150
|
-
logger.warn(' STEP_1: Restore registry versions | Command: kodrdriv unlink');
|
|
151
|
-
logger.warn(' STEP_2: Complete commit operation | Command: git commit');
|
|
152
|
-
logger.warn(' STEP_3: Restore local development links | Command: kodrdriv link');
|
|
153
|
-
} else {
|
|
154
|
-
logger.warn(' STEP_1: Manually restore registry versions in package.json files');
|
|
155
|
-
logger.warn(' STEP_2: Complete commit operation | Command: git commit');
|
|
156
|
-
logger.warn(' STEP_3: Re-link local dependencies for development');
|
|
157
|
-
}
|
|
158
|
-
logger.warn('');
|
|
159
|
-
logger.warn('FILE_DEPS_BYPASS: Alternative bypass options:');
|
|
160
|
-
logger.warn(' OPTION_1: Skip file check | Flag: --skip-file-check');
|
|
161
|
-
logger.warn(' OPTION_2: Skip all hooks | Command: git commit --no-verify');
|
|
162
|
-
logger.warn('');
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
export { checkForFileDependencies, logFileDependencySuggestions, logFileDependencyWarning };
|
|
166
|
-
//# sourceMappingURL=safety.js.map
|
package/dist/util/safety.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"safety.js","sources":["../../src/util/safety.ts"],"sourcesContent":["import path from 'path';\nimport { getLogger } from '../logging';\nimport { safeJsonParse, validatePackageJson } from '@eldrforge/git-tools';\n\ninterface PackageJson {\n name?: string;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n}\n\ninterface PackageJsonLocation {\n path: string;\n packageJson: PackageJson;\n relativePath: string;\n}\n\ninterface FileDependencyIssue {\n packagePath: string;\n dependencies: Array<{\n name: string;\n version: string;\n dependencyType: 'dependencies' | 'devDependencies' | 'peerDependencies';\n }>;\n}\n\nconst EXCLUDED_DIRECTORIES = [\n 'node_modules',\n 'dist',\n 'build',\n 'coverage',\n '.git',\n '.next',\n '.nuxt',\n 'out',\n 'public',\n 'static',\n 'assets'\n];\n\nconst findAllPackageJsonFiles = async (rootDir: string, storage: any): Promise<PackageJsonLocation[]> => {\n const logger = getLogger();\n const packageJsonFiles: PackageJsonLocation[] = [];\n\n const scanDirectory = async (currentDir: string, depth: number = 0): Promise<void> => {\n // Prevent infinite recursion and overly deep scanning\n if (depth > 5) {\n return;\n }\n\n try {\n if (!await storage.exists(currentDir) || !await storage.isDirectory(currentDir)) {\n return;\n }\n\n const items = await storage.listFiles(currentDir);\n\n // Check for package.json in current directory\n if (items.includes('package.json')) {\n const packageJsonPath = path.join(currentDir, 'package.json');\n try {\n const packageJsonContent = await storage.readFile(packageJsonPath, 'utf-8');\n const parsed = safeJsonParse(packageJsonContent, packageJsonPath);\n const packageJson = validatePackageJson(parsed, packageJsonPath);\n const relativePath = path.relative(rootDir, currentDir);\n\n packageJsonFiles.push({\n path: packageJsonPath,\n packageJson,\n relativePath: relativePath || '.'\n });\n\n logger.debug(`Found package.json at: ${relativePath || '.'}`);\n } catch (error: any) {\n logger.debug(`Skipped invalid package.json at ${packageJsonPath}: ${error.message}`);\n }\n }\n\n // Scan subdirectories, excluding build/generated directories\n for (const item of items) {\n if (EXCLUDED_DIRECTORIES.includes(item)) {\n continue;\n }\n\n const itemPath = path.join(currentDir, item);\n try {\n if (await storage.isDirectory(itemPath)) {\n await scanDirectory(itemPath, depth + 1);\n }\n } catch (error: any) {\n // Skip directories that can't be accessed\n logger.debug(`Skipped directory ${itemPath}: ${error.message}`);\n continue;\n }\n }\n } catch (error: any) {\n logger.debug(`Failed to scan directory ${currentDir}: ${error.message}`);\n }\n };\n\n await scanDirectory(rootDir);\n\n logger.debug(`Found ${packageJsonFiles.length} package.json file(s) in directory tree`);\n return packageJsonFiles;\n};\n\n/**\n * Checks for file: dependencies in package.json files that should not be committed\n * @param storage Storage utility instance\n * @param rootDir Root directory to scan (defaults to current working directory)\n * @returns Array of issues found, empty array if no issues\n */\nexport const checkForFileDependencies = async (storage: any, rootDir: string = process.cwd()): Promise<FileDependencyIssue[]> => {\n const logger = getLogger();\n const issues: FileDependencyIssue[] = [];\n\n try {\n const packageJsonFiles = await findAllPackageJsonFiles(rootDir, storage);\n\n for (const { packageJson, relativePath } of packageJsonFiles) {\n const fileDeps: Array<{name: string, version: string, dependencyType: 'dependencies' | 'devDependencies' | 'peerDependencies'}> = [];\n\n // Check all dependency types for file: paths\n const dependencyChecks = [\n { deps: packageJson.dependencies, type: 'dependencies' as const },\n { deps: packageJson.devDependencies, type: 'devDependencies' as const },\n { deps: packageJson.peerDependencies, type: 'peerDependencies' as const }\n ];\n\n for (const { deps, type } of dependencyChecks) {\n if (deps) {\n for (const [name, version] of Object.entries(deps)) {\n if (version.startsWith('file:')) {\n fileDeps.push({ name, version, dependencyType: type });\n }\n }\n }\n }\n\n if (fileDeps.length > 0) {\n issues.push({\n packagePath: relativePath,\n dependencies: fileDeps\n });\n }\n }\n } catch (error: any) {\n logger.debug(`Failed to check for file dependencies: ${error.message}`);\n }\n\n return issues;\n};\n\n/**\n * Logs file dependency issues in a user-friendly format\n * @param issues Array of file dependency issues\n * @param context Context for the warning (e.g., 'commit', 'link check')\n */\nexport const logFileDependencyWarning = (issues: FileDependencyIssue[], context: string = 'operation'): void => {\n const logger = getLogger();\n\n if (issues.length === 0) {\n return;\n }\n\n logger.warn(`FILE_DEPS_WARNING: Found file: dependencies that should not be committed | Context: ${context} | Count: ${issues.length} | Impact: May cause build issues`);\n for (const issue of issues) {\n logger.warn(`FILE_DEPS_PACKAGE: Package with file dependencies | Package: ${issue.packagePath}`);\n for (const dep of issue.dependencies) {\n logger.warn(`FILE_DEPS_DETAIL: Dependency details | Name: ${dep.name} | Version: ${dep.version} | Type: ${dep.dependencyType}`);\n }\n }\n logger.warn('');\n};\n\n/**\n * Provides suggestions for resolving file dependency issues\n * @param hasUnlinkCapability Whether the current context supports unlinking\n */\nexport const logFileDependencySuggestions = (hasUnlinkCapability: boolean = true): void => {\n const logger = getLogger();\n\n logger.warn('FILE_DEPS_RESOLUTION: Steps to resolve file dependency issues:');\n if (hasUnlinkCapability) {\n logger.warn(' STEP_1: Restore registry versions | Command: kodrdriv unlink');\n logger.warn(' STEP_2: Complete commit operation | Command: git commit');\n logger.warn(' STEP_3: Restore local development links | Command: kodrdriv link');\n } else {\n logger.warn(' STEP_1: Manually restore registry versions in package.json files');\n logger.warn(' STEP_2: Complete commit operation | Command: git commit');\n logger.warn(' STEP_3: Re-link local dependencies for development');\n }\n logger.warn('');\n logger.warn('FILE_DEPS_BYPASS: Alternative bypass options:');\n logger.warn(' OPTION_1: Skip file check | Flag: --skip-file-check');\n logger.warn(' OPTION_2: Skip all hooks | Command: git commit --no-verify');\n logger.warn('');\n};\n"],"names":["EXCLUDED_DIRECTORIES","findAllPackageJsonFiles","rootDir","storage","logger","getLogger","packageJsonFiles","scanDirectory","currentDir","depth","exists","isDirectory","items","listFiles","includes","packageJsonPath","path","join","packageJsonContent","readFile","parsed","safeJsonParse","packageJson","validatePackageJson","relativePath","relative","push","debug","error","message","item","itemPath","length","checkForFileDependencies","process","cwd","issues","fileDeps","dependencyChecks","deps","dependencies","type","devDependencies","peerDependencies","name","version","Object","entries","startsWith","dependencyType","packagePath","logFileDependencyWarning","context","warn","issue","dep","logFileDependencySuggestions","hasUnlinkCapability"],"mappings":";;;;AA0BA,MAAMA,oBAAAA,GAAuB;AACzB,IAAA,cAAA;AACA,IAAA,MAAA;AACA,IAAA,OAA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7C,IAAAA,MAAAA,CAAOiD,IAAI,CAAC,EAAA,CAAA;AAChB;AAEA;;;AAGC,IACM,MAAMG,4BAAAA,GAA+B,CAACC,sBAA+B,IAAI,GAAA;AAC5E,IAAA,MAAMrD,MAAAA,GAASC,SAAAA,EAAAA;AAEfD,IAAAA,MAAAA,CAAOiD,IAAI,CAAC,gEAAA,CAAA;AACZ,IAAA,IAAII,mBAAAA,EAAqB;AACrBrD,QAAAA,MAAAA,CAAOiD,IAAI,CAAC,iEAAA,CAAA;AACZjD,QAAAA,MAAAA,CAAOiD,IAAI,CAAC,4DAAA,CAAA;AACZjD,QAAAA,MAAAA,CAAOiD,IAAI,CAAC,qEAAA,CAAA;IAChB,CAAA,MAAO;AACHjD,QAAAA,MAAAA,CAAOiD,IAAI,CAAC,qEAAA,CAAA;AACZjD,QAAAA,MAAAA,CAAOiD,IAAI,CAAC,4DAAA,CAAA;AACZjD,QAAAA,MAAAA,CAAOiD,IAAI,CAAC,uDAAA,CAAA;AAChB,IAAA;AACAjD,IAAAA,MAAAA,CAAOiD,IAAI,CAAC,EAAA,CAAA;AACZjD,IAAAA,MAAAA,CAAOiD,IAAI,CAAC,+CAAA,CAAA;AACZjD,IAAAA,MAAAA,CAAOiD,IAAI,CAAC,wDAAA,CAAA;AACZjD,IAAAA,MAAAA,CAAOiD,IAAI,CAAC,+DAAA,CAAA;AACZjD,IAAAA,MAAAA,CAAOiD,IAAI,CAAC,EAAA,CAAA;AAChB;;;;"}
|
package/dist/util/stdin.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
// Function to read from STDIN if available
|
|
2
|
-
async function readStdin() {
|
|
3
|
-
// In test environment, allow mocking to work by skipping TTY check
|
|
4
|
-
if (process.env.NODE_ENV === 'test' || process.env.VITEST === 'true') {
|
|
5
|
-
return new Promise((resolve)=>{
|
|
6
|
-
let input = '';
|
|
7
|
-
let hasData = false;
|
|
8
|
-
let resolved = false;
|
|
9
|
-
const timeout = setTimeout(()=>{
|
|
10
|
-
if (!hasData && !resolved) {
|
|
11
|
-
resolved = true;
|
|
12
|
-
cleanup();
|
|
13
|
-
resolve(null);
|
|
14
|
-
}
|
|
15
|
-
}, 10); // Very short timeout for tests
|
|
16
|
-
const onData = (chunk)=>{
|
|
17
|
-
hasData = true;
|
|
18
|
-
clearTimeout(timeout);
|
|
19
|
-
input += chunk;
|
|
20
|
-
};
|
|
21
|
-
const onEnd = ()=>{
|
|
22
|
-
if (!resolved) {
|
|
23
|
-
resolved = true;
|
|
24
|
-
cleanup();
|
|
25
|
-
resolve(input.trim() || null);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
const onError = ()=>{
|
|
29
|
-
if (!resolved) {
|
|
30
|
-
resolved = true;
|
|
31
|
-
clearTimeout(timeout);
|
|
32
|
-
cleanup();
|
|
33
|
-
resolve(null);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const cleanup = ()=>{
|
|
37
|
-
process.stdin.removeListener('data', onData);
|
|
38
|
-
process.stdin.removeListener('end', onEnd);
|
|
39
|
-
process.stdin.removeListener('error', onError);
|
|
40
|
-
process.stdin.pause();
|
|
41
|
-
};
|
|
42
|
-
process.stdin.setEncoding('utf8');
|
|
43
|
-
process.stdin.on('data', onData);
|
|
44
|
-
process.stdin.on('end', onEnd);
|
|
45
|
-
process.stdin.on('error', onError);
|
|
46
|
-
process.stdin.resume();
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
return new Promise((resolve)=>{
|
|
50
|
-
// Check if stdin is TTY (interactive terminal)
|
|
51
|
-
if (process.stdin.isTTY) {
|
|
52
|
-
resolve(null);
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
let input = '';
|
|
56
|
-
let hasData = false;
|
|
57
|
-
let resolved = false;
|
|
58
|
-
const timeout = setTimeout(()=>{
|
|
59
|
-
if (!hasData && !resolved) {
|
|
60
|
-
resolved = true;
|
|
61
|
-
cleanup();
|
|
62
|
-
resolve(null);
|
|
63
|
-
}
|
|
64
|
-
}, 100); // Short timeout to detect if data is available
|
|
65
|
-
const onData = (chunk)=>{
|
|
66
|
-
hasData = true;
|
|
67
|
-
clearTimeout(timeout);
|
|
68
|
-
input += chunk;
|
|
69
|
-
};
|
|
70
|
-
const onEnd = ()=>{
|
|
71
|
-
if (!resolved) {
|
|
72
|
-
resolved = true;
|
|
73
|
-
cleanup();
|
|
74
|
-
resolve(input.trim() || null);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
const onError = ()=>{
|
|
78
|
-
if (!resolved) {
|
|
79
|
-
resolved = true;
|
|
80
|
-
clearTimeout(timeout);
|
|
81
|
-
cleanup();
|
|
82
|
-
resolve(null);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
const cleanup = ()=>{
|
|
86
|
-
process.stdin.removeListener('data', onData);
|
|
87
|
-
process.stdin.removeListener('end', onEnd);
|
|
88
|
-
process.stdin.removeListener('error', onError);
|
|
89
|
-
process.stdin.pause();
|
|
90
|
-
};
|
|
91
|
-
process.stdin.setEncoding('utf8');
|
|
92
|
-
process.stdin.on('data', onData);
|
|
93
|
-
process.stdin.on('end', onEnd);
|
|
94
|
-
process.stdin.on('error', onError);
|
|
95
|
-
// If no data comes in quickly, assume no stdin
|
|
96
|
-
process.stdin.resume();
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
// Function to prompt user for confirmation (y/n)
|
|
100
|
-
async function promptConfirmation(message) {
|
|
101
|
-
// In test environment, return true by default
|
|
102
|
-
if (process.env.NODE_ENV === 'test' || process.env.VITEST === 'true') {
|
|
103
|
-
return true;
|
|
104
|
-
}
|
|
105
|
-
// Use process.stdout.write instead of console.log to avoid linter issues
|
|
106
|
-
process.stdout.write(message + '\n');
|
|
107
|
-
process.stdout.write('Please enter "y" for yes or "n" for no: ');
|
|
108
|
-
return new Promise((resolve)=>{
|
|
109
|
-
const handleInput = (chunk)=>{
|
|
110
|
-
const input = chunk.toString().trim().toLowerCase();
|
|
111
|
-
if (input === 'y' || input === 'yes') {
|
|
112
|
-
cleanup();
|
|
113
|
-
resolve(true);
|
|
114
|
-
} else if (input === 'n' || input === 'no') {
|
|
115
|
-
cleanup();
|
|
116
|
-
resolve(false);
|
|
117
|
-
} else {
|
|
118
|
-
process.stdout.write('Please enter "y" for yes or "n" for no: ');
|
|
119
|
-
// Continue listening for input
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
const cleanup = ()=>{
|
|
123
|
-
process.stdin.removeListener('data', handleInput);
|
|
124
|
-
process.stdin.pause();
|
|
125
|
-
};
|
|
126
|
-
process.stdin.setEncoding('utf8');
|
|
127
|
-
process.stdin.on('data', handleInput);
|
|
128
|
-
process.stdin.resume();
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export { promptConfirmation, readStdin };
|
|
133
|
-
//# sourceMappingURL=stdin.js.map
|
package/dist/util/stdin.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stdin.js","sources":["../../src/util/stdin.ts"],"sourcesContent":["\n// Function to read from STDIN if available\nexport async function readStdin(): Promise<string | null> {\n // In test environment, allow mocking to work by skipping TTY check\n if (process.env.NODE_ENV === 'test' || process.env.VITEST === 'true') {\n return new Promise((resolve) => {\n let input = '';\n let hasData = false;\n let resolved = false;\n\n const timeout = setTimeout(() => {\n if (!hasData && !resolved) {\n resolved = true;\n cleanup();\n resolve(null);\n }\n }, 10); // Very short timeout for tests\n\n const onData = (chunk: string) => {\n hasData = true;\n clearTimeout(timeout);\n input += chunk;\n };\n\n const onEnd = () => {\n if (!resolved) {\n resolved = true;\n cleanup();\n resolve(input.trim() || null);\n }\n };\n\n const onError = () => {\n if (!resolved) {\n resolved = true;\n clearTimeout(timeout);\n cleanup();\n resolve(null);\n }\n };\n\n const cleanup = () => {\n process.stdin.removeListener('data', onData);\n process.stdin.removeListener('end', onEnd);\n process.stdin.removeListener('error', onError);\n process.stdin.pause();\n };\n\n process.stdin.setEncoding('utf8');\n process.stdin.on('data', onData);\n process.stdin.on('end', onEnd);\n process.stdin.on('error', onError);\n process.stdin.resume();\n });\n }\n\n return new Promise((resolve) => {\n // Check if stdin is TTY (interactive terminal)\n if (process.stdin.isTTY) {\n resolve(null);\n return;\n }\n\n let input = '';\n let hasData = false;\n let resolved = false;\n\n const timeout = setTimeout(() => {\n if (!hasData && !resolved) {\n resolved = true;\n cleanup();\n resolve(null);\n }\n }, 100); // Short timeout to detect if data is available\n\n const onData = (chunk: string) => {\n hasData = true;\n clearTimeout(timeout);\n input += chunk;\n };\n\n const onEnd = () => {\n if (!resolved) {\n resolved = true;\n cleanup();\n resolve(input.trim() || null);\n }\n };\n\n const onError = () => {\n if (!resolved) {\n resolved = true;\n clearTimeout(timeout);\n cleanup();\n resolve(null);\n }\n };\n\n const cleanup = () => {\n process.stdin.removeListener('data', onData);\n process.stdin.removeListener('end', onEnd);\n process.stdin.removeListener('error', onError);\n process.stdin.pause();\n };\n\n process.stdin.setEncoding('utf8');\n process.stdin.on('data', onData);\n process.stdin.on('end', onEnd);\n process.stdin.on('error', onError);\n\n // If no data comes in quickly, assume no stdin\n process.stdin.resume();\n });\n}\n\n// Function to prompt user for confirmation (y/n)\nexport async function promptConfirmation(message: string): Promise<boolean> {\n // In test environment, return true by default\n if (process.env.NODE_ENV === 'test' || process.env.VITEST === 'true') {\n return true;\n }\n\n // Use process.stdout.write instead of console.log to avoid linter issues\n process.stdout.write(message + '\\n');\n process.stdout.write('Please enter \"y\" for yes or \"n\" for no: ');\n\n return new Promise((resolve) => {\n const handleInput = (chunk: string) => {\n const input = chunk.toString().trim().toLowerCase();\n\n if (input === 'y' || input === 'yes') {\n cleanup();\n resolve(true);\n } else if (input === 'n' || input === 'no') {\n cleanup();\n resolve(false);\n } else {\n process.stdout.write('Please enter \"y\" for yes or \"n\" for no: ');\n // Continue listening for input\n }\n };\n\n const cleanup = () => {\n process.stdin.removeListener('data', handleInput);\n process.stdin.pause();\n };\n\n process.stdin.setEncoding('utf8');\n process.stdin.on('data', handleInput);\n process.stdin.resume();\n });\n} "],"names":["readStdin","process","env","NODE_ENV","VITEST","Promise","resolve","input","hasData","resolved","timeout","setTimeout","cleanup","onData","chunk","clearTimeout","onEnd","trim","onError","stdin","removeListener","pause","setEncoding","on","resume","isTTY","promptConfirmation","message","stdout","write","handleInput","toString","toLowerCase"],"mappings":"AACA;AACO,eAAeA,SAAAA,GAAAA;;IAElB,IAAIC,OAAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,MAAA,IAAUF,OAAAA,CAAQC,GAAG,CAACE,MAAM,KAAK,MAAA,EAAQ;QAClE,OAAO,IAAIC,QAAQ,CAACC,OAAAA,GAAAA;AAChB,YAAA,IAAIC,KAAAA,GAAQ,EAAA;AACZ,YAAA,IAAIC,OAAAA,GAAU,KAAA;AACd,YAAA,IAAIC,QAAAA,GAAW,KAAA;AAEf,YAAA,MAAMC,UAAUC,UAAAA,CAAW,IAAA;gBACvB,IAAI,CAACH,OAAAA,IAAW,CAACC,QAAAA,EAAU;oBACvBA,QAAAA,GAAW,IAAA;AACXG,oBAAAA,OAAAA,EAAAA;oBACAN,OAAAA,CAAQ,IAAA,CAAA;AACZ,gBAAA;AACJ,YAAA,CAAA,EAAG;AAEH,YAAA,MAAMO,SAAS,CAACC,KAAAA,GAAAA;gBACZN,OAAAA,GAAU,IAAA;gBACVO,YAAAA,CAAaL,OAAAA,CAAAA;gBACbH,KAAAA,IAASO,KAAAA;AACb,YAAA,CAAA;AAEA,YAAA,MAAME,KAAAA,GAAQ,IAAA;AACV,gBAAA,IAAI,CAACP,QAAAA,EAAU;oBACXA,QAAAA,GAAW,IAAA;AACXG,oBAAAA,OAAAA,EAAAA;oBACAN,OAAAA,CAAQC,KAAAA,CAAMU,IAAI,EAAA,IAAM,IAAA,CAAA;AAC5B,gBAAA;AACJ,YAAA,CAAA;AAEA,YAAA,MAAMC,OAAAA,GAAU,IAAA;AACZ,gBAAA,IAAI,CAACT,QAAAA,EAAU;oBACXA,QAAAA,G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AA,OAAAA,CAAQkB,KAAK,CAACC,cAAc,CAAC,MAAA,EAAQU,WAAAA,CAAAA;YACrC7B,OAAAA,CAAQkB,KAAK,CAACE,KAAK,EAAA;AACvB,QAAA,CAAA;QAEApB,OAAAA,CAAQkB,KAAK,CAACG,WAAW,CAAC,MAAA,CAAA;AAC1BrB,QAAAA,OAAAA,CAAQkB,KAAK,CAACI,EAAE,CAAC,MAAA,EAAQO,WAAAA,CAAAA;QACzB7B,OAAAA,CAAQkB,KAAK,CAACK,MAAM,EAAA;AACxB,IAAA,CAAA,CAAA;AACJ;;;;"}
|
package/dist/util/storage.js
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import { glob } from 'glob';
|
|
3
|
-
import path__default from 'path';
|
|
4
|
-
import crypto from 'crypto';
|
|
5
|
-
|
|
6
|
-
// eslint-disable-next-line no-restricted-imports
|
|
7
|
-
const create = (params)=>{
|
|
8
|
-
// eslint-disable-next-line no-console
|
|
9
|
-
const log = params.log || console.log;
|
|
10
|
-
const exists = async (path)=>{
|
|
11
|
-
try {
|
|
12
|
-
await fs.promises.stat(path);
|
|
13
|
-
return true;
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15
|
-
} catch (error) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
const isDirectory = async (path)=>{
|
|
20
|
-
const stats = await fs.promises.stat(path);
|
|
21
|
-
if (!stats.isDirectory()) {
|
|
22
|
-
// Log at debug level since this is expected when scanning directories
|
|
23
|
-
// that contain both files and directories
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
return true;
|
|
27
|
-
};
|
|
28
|
-
const isFile = async (path)=>{
|
|
29
|
-
const stats = await fs.promises.stat(path);
|
|
30
|
-
if (!stats.isFile()) {
|
|
31
|
-
// Log removed since this is expected when checking file types
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
return true;
|
|
35
|
-
};
|
|
36
|
-
const isReadable = async (path)=>{
|
|
37
|
-
try {
|
|
38
|
-
await fs.promises.access(path, fs.constants.R_OK);
|
|
39
|
-
} catch (error) {
|
|
40
|
-
log(`${path} is not readable: %s %s`, error.message, error.stack);
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
return true;
|
|
44
|
-
};
|
|
45
|
-
const isWritable = async (path)=>{
|
|
46
|
-
try {
|
|
47
|
-
await fs.promises.access(path, fs.constants.W_OK);
|
|
48
|
-
} catch (error) {
|
|
49
|
-
log(`${path} is not writable: %s %s`, error.message, error.stack);
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
return true;
|
|
53
|
-
};
|
|
54
|
-
const isFileReadable = async (path)=>{
|
|
55
|
-
return await exists(path) && await isFile(path) && await isReadable(path);
|
|
56
|
-
};
|
|
57
|
-
const isDirectoryWritable = async (path)=>{
|
|
58
|
-
return await exists(path) && await isDirectory(path) && await isWritable(path);
|
|
59
|
-
};
|
|
60
|
-
const isDirectoryReadable = async (path)=>{
|
|
61
|
-
return await exists(path) && await isDirectory(path) && await isReadable(path);
|
|
62
|
-
};
|
|
63
|
-
const createDirectory = async (path)=>{
|
|
64
|
-
try {
|
|
65
|
-
await fs.promises.mkdir(path, {
|
|
66
|
-
recursive: true
|
|
67
|
-
});
|
|
68
|
-
} catch (mkdirError) {
|
|
69
|
-
throw new Error(`Failed to create output directory ${path}: ${mkdirError.message} ${mkdirError.stack}`);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
const ensureDirectory = async (path)=>{
|
|
73
|
-
if (!await exists(path)) {
|
|
74
|
-
// Before creating the directory, check if any parent directory is blocked by a file
|
|
75
|
-
try {
|
|
76
|
-
await fs.promises.mkdir(path, {
|
|
77
|
-
recursive: true
|
|
78
|
-
});
|
|
79
|
-
} catch (mkdirError) {
|
|
80
|
-
// If mkdir fails with ENOTDIR, it means a parent directory is actually a file
|
|
81
|
-
if (mkdirError.code === 'ENOTDIR') {
|
|
82
|
-
// Find which parent directory is the problem
|
|
83
|
-
const pathParts = path.split('/').filter((p)=>p !== '');
|
|
84
|
-
let currentPath = '';
|
|
85
|
-
for (const part of pathParts){
|
|
86
|
-
currentPath = currentPath ? `${currentPath}/${part}` : part;
|
|
87
|
-
if (await exists(currentPath) && !await isDirectory(currentPath)) {
|
|
88
|
-
throw new Error(`Cannot create directory at ${path}: a file exists at ${currentPath} blocking the path`);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
// Re-throw the original error if it's not the file-blocking-path issue or we couldn't find the blocking file
|
|
93
|
-
throw new Error(`Failed to create output directory ${path}: ${mkdirError.message} ${mkdirError.stack}`);
|
|
94
|
-
}
|
|
95
|
-
} else {
|
|
96
|
-
// Path exists, but we need to check if it's actually a directory
|
|
97
|
-
if (!await isDirectory(path)) {
|
|
98
|
-
// Path exists but is not a directory (likely a file)
|
|
99
|
-
throw new Error(`Cannot create directory at ${path}: a file already exists at this location`);
|
|
100
|
-
}
|
|
101
|
-
// If we reach here, the directory already exists, so nothing to do
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
const removeDirectory = async (path)=>{
|
|
105
|
-
try {
|
|
106
|
-
if (await exists(path)) {
|
|
107
|
-
await fs.promises.rm(path, {
|
|
108
|
-
recursive: true,
|
|
109
|
-
force: true
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
} catch (rmError) {
|
|
113
|
-
throw new Error(`Failed to remove directory ${path}: ${rmError.message} ${rmError.stack}`);
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
const readFile = async (path, encoding)=>{
|
|
117
|
-
return await fs.promises.readFile(path, {
|
|
118
|
-
encoding: encoding
|
|
119
|
-
});
|
|
120
|
-
};
|
|
121
|
-
const writeFile = async (path, data, encoding)=>{
|
|
122
|
-
await fs.promises.writeFile(path, data, {
|
|
123
|
-
encoding: encoding
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
const rename = async (oldPath, newPath)=>{
|
|
127
|
-
await fs.promises.rename(oldPath, newPath);
|
|
128
|
-
};
|
|
129
|
-
const deleteFile = async (path)=>{
|
|
130
|
-
try {
|
|
131
|
-
if (await exists(path)) {
|
|
132
|
-
await fs.promises.unlink(path);
|
|
133
|
-
}
|
|
134
|
-
} catch (deleteError) {
|
|
135
|
-
throw new Error(`Failed to delete file ${path}: ${deleteError.message} ${deleteError.stack}`);
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
const forEachFileIn = async (directory, callback, options = {
|
|
139
|
-
pattern: '*.*'
|
|
140
|
-
})=>{
|
|
141
|
-
try {
|
|
142
|
-
const files = await glob(options.pattern, {
|
|
143
|
-
cwd: directory,
|
|
144
|
-
nodir: true
|
|
145
|
-
});
|
|
146
|
-
for (const file of files){
|
|
147
|
-
await callback(path__default.join(directory, file));
|
|
148
|
-
}
|
|
149
|
-
} catch (err) {
|
|
150
|
-
throw new Error(`Failed to glob pattern ${options.pattern} in ${directory}: ${err.message}`);
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
const readStream = async (path)=>{
|
|
154
|
-
return fs.createReadStream(path);
|
|
155
|
-
};
|
|
156
|
-
const hashFile = async (path, length)=>{
|
|
157
|
-
const file = await readFile(path, 'utf8');
|
|
158
|
-
return crypto.createHash('sha256').update(file).digest('hex').slice(0, length);
|
|
159
|
-
};
|
|
160
|
-
const listFiles = async (directory)=>{
|
|
161
|
-
return await fs.promises.readdir(directory);
|
|
162
|
-
};
|
|
163
|
-
return {
|
|
164
|
-
exists,
|
|
165
|
-
isDirectory,
|
|
166
|
-
isFile,
|
|
167
|
-
isReadable,
|
|
168
|
-
isWritable,
|
|
169
|
-
isFileReadable,
|
|
170
|
-
isDirectoryWritable,
|
|
171
|
-
isDirectoryReadable,
|
|
172
|
-
createDirectory,
|
|
173
|
-
ensureDirectory,
|
|
174
|
-
readFile,
|
|
175
|
-
readStream,
|
|
176
|
-
writeFile,
|
|
177
|
-
rename,
|
|
178
|
-
deleteFile,
|
|
179
|
-
forEachFileIn,
|
|
180
|
-
hashFile,
|
|
181
|
-
listFiles,
|
|
182
|
-
removeDirectory
|
|
183
|
-
};
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
export { create };
|
|
187
|
-
//# sourceMappingURL=storage.js.map
|
package/dist/util/storage.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sources":["../../src/util/storage.ts"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport * as fs from 'fs';\nimport { glob } from 'glob';\nimport path from 'path';\nimport crypto from 'crypto';\n/**\n * This module exists to isolate filesystem operations from the rest of the codebase.\n * This makes testing easier by avoiding direct fs mocking in jest configuration.\n *\n * Additionally, abstracting storage operations allows for future flexibility -\n * this export utility may need to work with storage systems other than the local filesystem\n * (e.g. S3, Google Cloud Storage, etc).\n */\n\nexport interface Utility {\n exists: (path: string) => Promise<boolean>;\n isDirectory: (path: string) => Promise<boolean>;\n isFile: (path: string) => Promise<boolean>;\n isReadable: (path: string) => Promise<boolean>;\n isWritable: (path: string) => Promise<boolean>;\n isFileReadable: (path: string) => Promise<boolean>;\n isDirectoryWritable: (path: string) => Promise<boolean>;\n isDirectoryReadable: (path: string) => Promise<boolean>;\n createDirectory: (path: string) => Promise<void>;\n ensureDirectory: (path: string) => Promise<void>;\n readFile: (path: string, encoding: string) => Promise<string>;\n readStream: (path: string) => Promise<fs.ReadStream>;\n writeFile: (path: string, data: string | Buffer, encoding: string) => Promise<void>;\n rename: (oldPath: string, newPath: string) => Promise<void>;\n deleteFile: (path: string) => Promise<void>;\n forEachFileIn: (directory: string, callback: (path: string) => Promise<void>, options?: { pattern: string }) => Promise<void>;\n hashFile: (path: string, length: number) => Promise<string>;\n listFiles: (directory: string) => Promise<string[]>;\n removeDirectory: (path: string) => Promise<void>;\n}\n\nexport const create = (params: { log?: (message: string, ...args: any[]) => void }): Utility => {\n\n // eslint-disable-next-line no-console\n const log = params.log || console.log;\n\n const exists = async (path: string): Promise<boolean> => {\n try {\n await fs.promises.stat(path);\n return true;\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (error: any) {\n return false;\n }\n }\n\n const isDirectory = async (path: string): Promise<boolean> => {\n const stats = await fs.promises.stat(path);\n if (!stats.isDirectory()) {\n // Log at debug level since this is expected when scanning directories\n // that contain both files and directories\n return false;\n }\n return true;\n }\n\n const isFile = async (path: string): Promise<boolean> => {\n const stats = await fs.promises.stat(path);\n if (!stats.isFile()) {\n // Log removed since this is expected when checking file types\n return false;\n }\n return true;\n }\n\n const isReadable = async (path: string): Promise<boolean> => {\n try {\n await fs.promises.access(path, fs.constants.R_OK);\n } catch (error: any) {\n log(`${path} is not readable: %s %s`, error.message, error.stack);\n return false;\n }\n return true;\n }\n\n const isWritable = async (path: string): Promise<boolean> => {\n try {\n await fs.promises.access(path, fs.constants.W_OK);\n } catch (error: any) {\n log(`${path} is not writable: %s %s`, error.message, error.stack);\n return false;\n }\n return true;\n }\n\n const isFileReadable = async (path: string): Promise<boolean> => {\n return await exists(path) && await isFile(path) && await isReadable(path);\n }\n\n const isDirectoryWritable = async (path: string): Promise<boolean> => {\n return await exists(path) && await isDirectory(path) && await isWritable(path);\n }\n\n const isDirectoryReadable = async (path: string): Promise<boolean> => {\n return await exists(path) && await isDirectory(path) && await isReadable(path);\n }\n\n const createDirectory = async (path: string): Promise<void> => {\n try {\n await fs.promises.mkdir(path, { recursive: true });\n } catch (mkdirError: any) {\n throw new Error(`Failed to create output directory ${path}: ${mkdirError.message} ${mkdirError.stack}`);\n }\n }\n\n const ensureDirectory = async (path: string): Promise<void> => {\n if (!(await exists(path))) {\n // Before creating the directory, check if any parent directory is blocked by a file\n try {\n await fs.promises.mkdir(path, { recursive: true });\n } catch (mkdirError: any) {\n // If mkdir fails with ENOTDIR, it means a parent directory is actually a file\n if (mkdirError.code === 'ENOTDIR') {\n // Find which parent directory is the problem\n const pathParts = path.split('/').filter(p => p !== '');\n let currentPath = '';\n for (const part of pathParts) {\n currentPath = currentPath ? `${currentPath}/${part}` : part;\n if (await exists(currentPath) && !(await isDirectory(currentPath))) {\n throw new Error(`Cannot create directory at ${path}: a file exists at ${currentPath} blocking the path`);\n }\n }\n }\n // Re-throw the original error if it's not the file-blocking-path issue or we couldn't find the blocking file\n throw new Error(`Failed to create output directory ${path}: ${mkdirError.message} ${mkdirError.stack}`);\n }\n } else {\n // Path exists, but we need to check if it's actually a directory\n if (!(await isDirectory(path))) {\n // Path exists but is not a directory (likely a file)\n throw new Error(`Cannot create directory at ${path}: a file already exists at this location`);\n }\n // If we reach here, the directory already exists, so nothing to do\n }\n }\n\n const removeDirectory = async (path: string): Promise<void> => {\n try {\n if (await exists(path)) {\n await fs.promises.rm(path, { recursive: true, force: true });\n }\n } catch (rmError: any) {\n throw new Error(`Failed to remove directory ${path}: ${rmError.message} ${rmError.stack}`);\n }\n }\n\n const readFile = async (path: string, encoding: string): Promise<string> => {\n return await fs.promises.readFile(path, { encoding: encoding as BufferEncoding });\n }\n\n const writeFile = async (path: string, data: string | Buffer, encoding: string): Promise<void> => {\n await fs.promises.writeFile(path, data, { encoding: encoding as BufferEncoding });\n }\n\n const rename = async (oldPath: string, newPath: string): Promise<void> => {\n await fs.promises.rename(oldPath, newPath);\n }\n\n const deleteFile = async (path: string): Promise<void> => {\n try {\n if (await exists(path)) {\n await fs.promises.unlink(path);\n }\n } catch (deleteError: any) {\n throw new Error(`Failed to delete file ${path}: ${deleteError.message} ${deleteError.stack}`);\n }\n }\n\n const forEachFileIn = async (directory: string, callback: (file: string) => Promise<void>, options: { pattern: string | string[] } = { pattern: '*.*' }): Promise<void> => {\n try {\n const files = await glob(options.pattern, { cwd: directory, nodir: true });\n for (const file of files) {\n await callback(path.join(directory, file));\n }\n } catch (err: any) {\n throw new Error(`Failed to glob pattern ${options.pattern} in ${directory}: ${err.message}`);\n }\n }\n\n const readStream = async (path: string): Promise<fs.ReadStream> => {\n return fs.createReadStream(path);\n }\n\n const hashFile = async (path: string, length: number): Promise<string> => {\n const file = await readFile(path, 'utf8');\n return crypto.createHash('sha256').update(file).digest('hex').slice(0, length);\n }\n\n const listFiles = async (directory: string): Promise<string[]> => {\n return await fs.promises.readdir(directory);\n }\n\n return {\n exists,\n isDirectory,\n isFile,\n isReadable,\n isWritable,\n isFileReadable,\n isDirectoryWritable,\n isDirectoryReadable,\n createDirectory,\n ensureDirectory,\n readFile,\n readStream,\n writeFile,\n rename,\n deleteFile,\n forEachFileIn,\n hashFile,\n listFiles,\n removeDirectory,\n };\n}\n"],"names":["create","params","log","console","exists","path","fs","promises","stat","error","isDirectory","stats","isFile","isReadable","access","constants","R_OK","message","stack","isWritable","W_OK","isFileReadable","isDirectoryWritable","isDirectoryReadable","createDirectory","mkdir","recursive","mkdirError","Error","ensureDirectory","code","pathParts","split","filter","p","currentPath","part","removeDirectory","rm","force","rmError","readFile","encoding","writeFile","data","rename","oldPath","newPath","deleteFile","unlink","deleteError","forEachFileIn","directory","callback","options","pattern","files","glob","cwd","nodir","file","join","err","readStream","createReadStream","hashFile","length","crypto","createHash","update","digest","slice","listFiles","readdir"],"mappings":";;;;;AAAA;AAoCO,MAAMA,SAAS,CAACC,MAAAA,GAAAA;;AAGnB,IAAA,MAAMC,GAAAA,GAAMD,MAAAA,CAAOC,GAAG,IAAIC,QAAQD,GAAG;AAErC,IAAA,MAAME,SAAS,OAAOC,IAAAA,GAAAA;QAClB,IAAI;AACA,YAAA,MAAMC,EAAAA,CAAGC,QAAQ,CAACC,IAAI,CAACH,IAAAA,CAAAA;YACvB,OAAO,IAAA;;AAEX,QAAA,CAAA,CAAE,OAAOI,KAAAA,EAAY;YACjB,OAAO,KAAA;AACX,QAAA;AACJ,IAAA,CAAA;AAEA,IAAA,MAAMC,cAAc,OAAOL,IAAAA,GAAAA;AACvB,QAAA,MAAMM,QAAQ,MAAML,EAAAA,CAAGC,QAAQ,CAACC,IAAI,CAACH,IAAAA,CAAAA;QACrC,IAAI,CAACM,KAAAA,CAAMD,W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