@eldrforge/git-tools 0.1.7 → 0.1.10
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/index.d.ts +2 -254
- package/dist/index.js +1400 -4
- package/dist/index.js.map +1 -1
- package/dist/src/child.d.ts +57 -0
- package/dist/src/child.d.ts.map +1 -0
- package/dist/src/git.d.ts +128 -0
- package/dist/src/git.d.ts.map +1 -0
- package/dist/src/index.d.ts +14 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/logger.d.ts +33 -0
- package/dist/src/logger.d.ts.map +1 -0
- package/dist/src/validation.d.ts +20 -0
- package/dist/src/validation.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/child.js +0 -220
- package/dist/child.js.map +0 -1
- package/dist/git.js +0 -1027
- package/dist/git.js.map +0 -1
- package/dist/logger.js +0 -83
- package/dist/logger.js.map +0 -1
- package/dist/validation.js +0 -55
- package/dist/validation.js.map +0 -1
package/dist/child.js
DELETED
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import { spawn, exec } from 'child_process';
|
|
2
|
-
import util from 'util';
|
|
3
|
-
import { getLogger } from './logger.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Escapes shell arguments to prevent command injection
|
|
7
|
-
*/ function escapeShellArg(arg) {
|
|
8
|
-
// For Windows, we need different escaping
|
|
9
|
-
if (process.platform === 'win32') {
|
|
10
|
-
// Escape double quotes and backslashes
|
|
11
|
-
return `"${arg.replace(/[\\"]/g, '\\$&')}"`;
|
|
12
|
-
} else {
|
|
13
|
-
// For Unix-like systems, escape single quotes
|
|
14
|
-
return `'${arg.replace(/'/g, "'\\''")}'`;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Validates git references to prevent injection
|
|
19
|
-
*/ function validateGitRef(ref) {
|
|
20
|
-
// Git refs can contain letters, numbers, hyphens, underscores, slashes, and dots
|
|
21
|
-
// But cannot contain certain dangerous characters
|
|
22
|
-
const validRefPattern = /^[a-zA-Z0-9._/-]+$/;
|
|
23
|
-
const invalidPatterns = [
|
|
24
|
-
/\.\./,
|
|
25
|
-
/^-/,
|
|
26
|
-
/[\s;<>|&`$(){}[\]]/ // No shell metacharacters
|
|
27
|
-
];
|
|
28
|
-
if (!validRefPattern.test(ref)) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
return !invalidPatterns.some((pattern)=>pattern.test(ref));
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Validates file paths to prevent injection
|
|
35
|
-
*/ function validateFilePath(filePath) {
|
|
36
|
-
// Basic validation - no shell metacharacters
|
|
37
|
-
const invalidChars = /[;<>|&`$(){}[\]]/;
|
|
38
|
-
return !invalidChars.test(filePath);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Securely executes a command with arguments array (no shell injection risk)
|
|
42
|
-
*/ async function runSecure(command, args = [], options = {}) {
|
|
43
|
-
const logger = getLogger();
|
|
44
|
-
return new Promise((resolve, reject)=>{
|
|
45
|
-
logger.verbose(`Executing command securely: ${command} ${args.join(' ')}`);
|
|
46
|
-
logger.verbose(`Working directory: ${(options === null || options === void 0 ? void 0 : options.cwd) || process.cwd()}`);
|
|
47
|
-
const child = spawn(command, args, {
|
|
48
|
-
...options,
|
|
49
|
-
shell: false,
|
|
50
|
-
stdio: 'pipe'
|
|
51
|
-
});
|
|
52
|
-
let stdout = '';
|
|
53
|
-
let stderr = '';
|
|
54
|
-
if (child.stdout) {
|
|
55
|
-
child.stdout.on('data', (data)=>{
|
|
56
|
-
stdout += data.toString();
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
if (child.stderr) {
|
|
60
|
-
child.stderr.on('data', (data)=>{
|
|
61
|
-
stderr += data.toString();
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
child.on('close', (code)=>{
|
|
65
|
-
if (code === 0) {
|
|
66
|
-
logger.verbose(`Command completed successfully`);
|
|
67
|
-
logger.verbose(`stdout: ${stdout}`);
|
|
68
|
-
if (stderr) {
|
|
69
|
-
logger.verbose(`stderr: ${stderr}`);
|
|
70
|
-
}
|
|
71
|
-
resolve({
|
|
72
|
-
stdout,
|
|
73
|
-
stderr
|
|
74
|
-
});
|
|
75
|
-
} else {
|
|
76
|
-
logger.error(`Command failed with exit code ${code}`);
|
|
77
|
-
logger.error(`stdout: ${stdout}`);
|
|
78
|
-
logger.error(`stderr: ${stderr}`);
|
|
79
|
-
reject(new Error(`Command "${[
|
|
80
|
-
command,
|
|
81
|
-
...args
|
|
82
|
-
].join(' ')}" failed with exit code ${code}`));
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
child.on('error', (error)=>{
|
|
86
|
-
logger.error(`Command failed to start: ${error.message}`);
|
|
87
|
-
reject(error);
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Securely executes a command with inherited stdio (no shell injection risk)
|
|
93
|
-
*/ async function runSecureWithInheritedStdio(command, args = [], options = {}) {
|
|
94
|
-
const logger = getLogger();
|
|
95
|
-
return new Promise((resolve, reject)=>{
|
|
96
|
-
logger.verbose(`Executing command securely with inherited stdio: ${command} ${args.join(' ')}`);
|
|
97
|
-
logger.verbose(`Working directory: ${(options === null || options === void 0 ? void 0 : options.cwd) || process.cwd()}`);
|
|
98
|
-
const child = spawn(command, args, {
|
|
99
|
-
...options,
|
|
100
|
-
shell: false,
|
|
101
|
-
stdio: 'inherit'
|
|
102
|
-
});
|
|
103
|
-
child.on('close', (code)=>{
|
|
104
|
-
if (code === 0) {
|
|
105
|
-
logger.verbose(`Command completed successfully with code ${code}`);
|
|
106
|
-
resolve();
|
|
107
|
-
} else {
|
|
108
|
-
logger.error(`Command failed with exit code ${code}`);
|
|
109
|
-
reject(new Error(`Command "${[
|
|
110
|
-
command,
|
|
111
|
-
...args
|
|
112
|
-
].join(' ')}" failed with exit code ${code}`));
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
child.on('error', (error)=>{
|
|
116
|
-
logger.error(`Command failed to start: ${error.message}`);
|
|
117
|
-
reject(error);
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
async function run(command, options = {}) {
|
|
122
|
-
const logger = getLogger();
|
|
123
|
-
const execPromise = util.promisify(exec);
|
|
124
|
-
// Extract our custom option and pass the rest to exec
|
|
125
|
-
const { suppressErrorLogging = false, ...execOptions } = options || {};
|
|
126
|
-
// Ensure encoding is set to 'utf8' to get string output instead of Buffer
|
|
127
|
-
const finalOptions = {
|
|
128
|
-
encoding: 'utf8',
|
|
129
|
-
...execOptions
|
|
130
|
-
};
|
|
131
|
-
logger.verbose(`Executing command: ${command}`);
|
|
132
|
-
logger.verbose(`Working directory: ${(finalOptions === null || finalOptions === void 0 ? void 0 : finalOptions.cwd) || process.cwd()}`);
|
|
133
|
-
logger.verbose(`Environment variables: ${Object.keys((finalOptions === null || finalOptions === void 0 ? void 0 : finalOptions.env) || process.env).length} variables`);
|
|
134
|
-
try {
|
|
135
|
-
const result = await execPromise(command, finalOptions);
|
|
136
|
-
logger.verbose(`Command completed successfully`);
|
|
137
|
-
logger.verbose(`stdout: ${result.stdout}`);
|
|
138
|
-
if (result.stderr) {
|
|
139
|
-
logger.verbose(`stderr: ${result.stderr}`);
|
|
140
|
-
}
|
|
141
|
-
// Ensure result is properly typed as strings
|
|
142
|
-
return {
|
|
143
|
-
stdout: String(result.stdout),
|
|
144
|
-
stderr: String(result.stderr)
|
|
145
|
-
};
|
|
146
|
-
} catch (error) {
|
|
147
|
-
if (!suppressErrorLogging) {
|
|
148
|
-
logger.error(`Command failed: ${command}`);
|
|
149
|
-
logger.error(`Error: ${error.message}`);
|
|
150
|
-
logger.error(`Exit code: ${error.code}`);
|
|
151
|
-
logger.error(`Signal: ${error.signal}`);
|
|
152
|
-
if (error.stdout) {
|
|
153
|
-
logger.error(`stdout: ${error.stdout}`);
|
|
154
|
-
}
|
|
155
|
-
if (error.stderr) {
|
|
156
|
-
logger.error(`stderr: ${error.stderr}`);
|
|
157
|
-
}
|
|
158
|
-
} else {
|
|
159
|
-
// Still log at verbose level for debugging
|
|
160
|
-
logger.verbose(`Command exited with non-zero code (suppressed): ${command}`);
|
|
161
|
-
logger.verbose(`Exit code: ${error.code}`);
|
|
162
|
-
}
|
|
163
|
-
throw error;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* @deprecated Use runSecureWithInheritedStdio instead for better security
|
|
168
|
-
* Legacy function for backward compatibility - parses shell command string
|
|
169
|
-
*/ async function runWithInheritedStdio(command, options = {}) {
|
|
170
|
-
// Parse command to extract command and arguments safely
|
|
171
|
-
const parts = command.trim().split(/\s+/);
|
|
172
|
-
if (parts.length === 0) {
|
|
173
|
-
throw new Error('Empty command provided');
|
|
174
|
-
}
|
|
175
|
-
const cmd = parts[0];
|
|
176
|
-
const args = parts.slice(1);
|
|
177
|
-
// Use the secure version
|
|
178
|
-
return runSecureWithInheritedStdio(cmd, args, options);
|
|
179
|
-
}
|
|
180
|
-
async function runWithDryRunSupport(command, isDryRun, options = {}, useInheritedStdio = false) {
|
|
181
|
-
const logger = getLogger();
|
|
182
|
-
if (isDryRun) {
|
|
183
|
-
logger.info(`DRY RUN: Would execute command: ${command}`);
|
|
184
|
-
return {
|
|
185
|
-
stdout: '',
|
|
186
|
-
stderr: ''
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
if (useInheritedStdio) {
|
|
190
|
-
await runWithInheritedStdio(command, options);
|
|
191
|
-
return {
|
|
192
|
-
stdout: '',
|
|
193
|
-
stderr: ''
|
|
194
|
-
}; // No output captured when using inherited stdio
|
|
195
|
-
}
|
|
196
|
-
return run(command, options);
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Secure version of runWithDryRunSupport using argument arrays
|
|
200
|
-
*/ async function runSecureWithDryRunSupport(command, args = [], isDryRun, options = {}, useInheritedStdio = false) {
|
|
201
|
-
const logger = getLogger();
|
|
202
|
-
if (isDryRun) {
|
|
203
|
-
logger.info(`DRY RUN: Would execute command: ${command} ${args.join(' ')}`);
|
|
204
|
-
return {
|
|
205
|
-
stdout: '',
|
|
206
|
-
stderr: ''
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
if (useInheritedStdio) {
|
|
210
|
-
await runSecureWithInheritedStdio(command, args, options);
|
|
211
|
-
return {
|
|
212
|
-
stdout: '',
|
|
213
|
-
stderr: ''
|
|
214
|
-
}; // No output captured when using inherited stdio
|
|
215
|
-
}
|
|
216
|
-
return runSecure(command, args, options);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
export { escapeShellArg, run, runSecure, runSecureWithDryRunSupport, runSecureWithInheritedStdio, runWithDryRunSupport, runWithInheritedStdio, validateFilePath, validateGitRef };
|
|
220
|
-
//# sourceMappingURL=child.js.map
|
package/dist/child.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"child.js","sources":["../src/child.ts"],"sourcesContent":["#!/usr/bin/env node\nimport child_process, { exec, spawn } from 'child_process';\nimport util from 'util';\nimport { getLogger } from './logger';\n\n/**\n * Escapes shell arguments to prevent command injection\n */\nfunction escapeShellArg(arg: string): string {\n // For Windows, we need different escaping\n if (process.platform === 'win32') {\n // Escape double quotes and backslashes\n return `\"${arg.replace(/[\\\\\"]/g, '\\\\$&')}\"`;\n } else {\n // For Unix-like systems, escape single quotes\n return `'${arg.replace(/'/g, \"'\\\\''\")}'`;\n }\n}\n\n/**\n * Validates git references to prevent injection\n */\nfunction validateGitRef(ref: string): boolean {\n // Git refs can contain letters, numbers, hyphens, underscores, slashes, and dots\n // But cannot contain certain dangerous characters\n const validRefPattern = /^[a-zA-Z0-9._/-]+$/;\n const invalidPatterns = [\n /\\.\\./, // No double dots (directory traversal)\n /^-/, // Cannot start with dash (flag injection)\n /[\\s;<>|&`$(){}[\\]]/ // No shell metacharacters\n ];\n\n if (!validRefPattern.test(ref)) {\n return false;\n }\n\n return !invalidPatterns.some(pattern => pattern.test(ref));\n}\n\n/**\n * Validates file paths to prevent injection\n */\nfunction validateFilePath(filePath: string): boolean {\n // Basic validation - no shell metacharacters\n const invalidChars = /[;<>|&`$(){}[\\]]/;\n return !invalidChars.test(filePath);\n}\n\n/**\n * Securely executes a command with arguments array (no shell injection risk)\n */\nexport async function runSecure(\n command: string,\n args: string[] = [],\n options: child_process.SpawnOptions = {}\n): Promise<{ stdout: string; stderr: string }> {\n const logger = getLogger();\n\n return new Promise((resolve, reject) => {\n logger.verbose(`Executing command securely: ${command} ${args.join(' ')}`);\n logger.verbose(`Working directory: ${options?.cwd || process.cwd()}`);\n\n const child = spawn(command, args, {\n ...options,\n shell: false, // CRITICAL: Never use shell for user input\n stdio: 'pipe'\n });\n\n let stdout = '';\n let stderr = '';\n\n if (child.stdout) {\n child.stdout.on('data', (data) => {\n stdout += data.toString();\n });\n }\n\n if (child.stderr) {\n child.stderr.on('data', (data) => {\n stderr += data.toString();\n });\n }\n\n child.on('close', (code) => {\n if (code === 0) {\n logger.verbose(`Command completed successfully`);\n logger.verbose(`stdout: ${stdout}`);\n if (stderr) {\n logger.verbose(`stderr: ${stderr}`);\n }\n resolve({ stdout, stderr });\n } else {\n logger.error(`Command failed with exit code ${code}`);\n logger.error(`stdout: ${stdout}`);\n logger.error(`stderr: ${stderr}`);\n reject(new Error(`Command \"${[command, ...args].join(' ')}\" failed with exit code ${code}`));\n }\n });\n\n child.on('error', (error) => {\n logger.error(`Command failed to start: ${error.message}`);\n reject(error);\n });\n });\n}\n\n/**\n * Securely executes a command with inherited stdio (no shell injection risk)\n */\nexport async function runSecureWithInheritedStdio(\n command: string,\n args: string[] = [],\n options: child_process.SpawnOptions = {}\n): Promise<void> {\n const logger = getLogger();\n\n return new Promise((resolve, reject) => {\n logger.verbose(`Executing command securely with inherited stdio: ${command} ${args.join(' ')}`);\n logger.verbose(`Working directory: ${options?.cwd || process.cwd()}`);\n\n const child = spawn(command, args, {\n ...options,\n shell: false, // CRITICAL: Never use shell for user input\n stdio: 'inherit'\n });\n\n child.on('close', (code) => {\n if (code === 0) {\n logger.verbose(`Command completed successfully with code ${code}`);\n resolve();\n } else {\n logger.error(`Command failed with exit code ${code}`);\n reject(new Error(`Command \"${[command, ...args].join(' ')}\" failed with exit code ${code}`));\n }\n });\n\n child.on('error', (error) => {\n logger.error(`Command failed to start: ${error.message}`);\n reject(error);\n });\n });\n}\n\nexport interface RunOptions extends child_process.ExecOptions {\n /** If true, suppresses error logging for non-zero exits (useful when non-zero exit is expected behavior) */\n suppressErrorLogging?: boolean;\n}\n\nexport async function run(command: string, options: RunOptions = {}): Promise<{ stdout: string; stderr: string }> {\n const logger = getLogger();\n const execPromise = util.promisify(exec);\n\n // Extract our custom option and pass the rest to exec\n const { suppressErrorLogging = false, ...execOptions } = options || {};\n\n // Ensure encoding is set to 'utf8' to get string output instead of Buffer\n const finalOptions = { encoding: 'utf8' as const, ...execOptions };\n\n logger.verbose(`Executing command: ${command}`);\n logger.verbose(`Working directory: ${finalOptions?.cwd || process.cwd()}`);\n logger.verbose(`Environment variables: ${Object.keys(finalOptions?.env || process.env).length} variables`);\n\n try {\n const result = await execPromise(command, finalOptions);\n logger.verbose(`Command completed successfully`);\n logger.verbose(`stdout: ${result.stdout}`);\n if (result.stderr) {\n logger.verbose(`stderr: ${result.stderr}`);\n }\n // Ensure result is properly typed as strings\n return {\n stdout: String(result.stdout),\n stderr: String(result.stderr)\n };\n } catch (error: any) {\n if (!suppressErrorLogging) {\n logger.error(`Command failed: ${command}`);\n logger.error(`Error: ${error.message}`);\n logger.error(`Exit code: ${error.code}`);\n logger.error(`Signal: ${error.signal}`);\n if (error.stdout) {\n logger.error(`stdout: ${error.stdout}`);\n }\n if (error.stderr) {\n logger.error(`stderr: ${error.stderr}`);\n }\n } else {\n // Still log at verbose level for debugging\n logger.verbose(`Command exited with non-zero code (suppressed): ${command}`);\n logger.verbose(`Exit code: ${error.code}`);\n }\n throw error;\n }\n}\n\n/**\n * @deprecated Use runSecureWithInheritedStdio instead for better security\n * Legacy function for backward compatibility - parses shell command string\n */\nexport async function runWithInheritedStdio(command: string, options: child_process.ExecOptions = {}): Promise<void> {\n\n // Parse command to extract command and arguments safely\n const parts = command.trim().split(/\\s+/);\n if (parts.length === 0) {\n throw new Error('Empty command provided');\n }\n\n const cmd = parts[0];\n const args = parts.slice(1);\n\n // Use the secure version\n return runSecureWithInheritedStdio(cmd, args, options);\n}\n\nexport async function runWithDryRunSupport(\n command: string,\n isDryRun: boolean,\n options: child_process.ExecOptions = {},\n useInheritedStdio: boolean = false\n): Promise<{ stdout: string; stderr: string }> {\n const logger = getLogger();\n\n if (isDryRun) {\n logger.info(`DRY RUN: Would execute command: ${command}`);\n return { stdout: '', stderr: '' };\n }\n\n if (useInheritedStdio) {\n await runWithInheritedStdio(command, options);\n return { stdout: '', stderr: '' }; // No output captured when using inherited stdio\n }\n\n return run(command, options);\n}\n\n/**\n * Secure version of runWithDryRunSupport using argument arrays\n */\nexport async function runSecureWithDryRunSupport(\n command: string,\n args: string[] = [],\n isDryRun: boolean,\n options: child_process.SpawnOptions = {},\n useInheritedStdio: boolean = false\n): Promise<{ stdout: string; stderr: string }> {\n const logger = getLogger();\n\n if (isDryRun) {\n logger.info(`DRY RUN: Would execute command: ${command} ${args.join(' ')}`);\n return { stdout: '', stderr: '' };\n }\n\n if (useInheritedStdio) {\n await runSecureWithInheritedStdio(command, args, options);\n return { stdout: '', stderr: '' }; // No output captured when using inherited stdio\n }\n\n return runSecure(command, args, options);\n}\n\n// Export validation functions for use in other modules\nexport { validateGitRef, validateFilePath, escapeShellArg };\n\n"],"names":["escapeShellArg","arg","process","platform","replace","validateGitRef","ref","validRefPattern","invalidPatterns","test","some","pattern","validateFilePath","filePath","invalidChars","runSecure","command","args","options","logger","getLogger","Promise","resolve","reject","verbose","join","cwd","child","spawn","shell","stdio","stdout","stderr","on","data","toString","code","error","Error","message","runSecureWithInheritedStdio","run","execPromise","util","promisify","exec","suppressErrorLogging","execOptions","finalOptions","encoding","Object","keys","env","length","result","String","signal","runWithInheritedStdio","parts","trim","split","cmd","slice","runWithDryRunSupport","isDryRun","useInheritedStdio","info","runSecureWithDryRunSupport"],"mappings":";;;;AAKA;;IAGA,SAASA,eAAeC,GAAW,EAAA;;IAE/B,IAAIC,OAAAA,CAAQC,QAAQ,KAAK,OAAA,EAAS;;QAE9B,OAAO,CAAC,CAAC,EAAEF,GAAAA,CAAIG,OAAO,CAAC,QAAA,EAAU,MAAA,CAAA,CAAQ,CAAC,CAAC;IAC/C,CAAA,MAAO;;QAEH,OAAO,CAAC,CAAC,EAAEH,GAAAA,CAAIG,OAAO,CAAC,IAAA,EAAM,OAAA,CAAA,CAAS,CAAC,CAAC;AAC5C,IAAA;AACJ;AAEA;;IAGA,SAASC,eAAeC,GAAW,EAAA;;;AAG/B,IAAA,MAAMC,eAAAA,GAAkB,oBAAA;AACxB,IAAA,MAAMC,eAAAA,GAAkB;AACpB,QAAA,MAAA;AACA,QAAA,IAAA;AACA,QAAA,oBAAA;AACH,KAAA;AAED,IAAA,IAAI,CAACD,eAAAA,CAAgBE,IAAI,CAACH,GAAAA,CAAAA,EAAM;QAC5B,OAAO,KAAA;AACX,IAAA;IAEA,OAAO,CAACE,gBAAgBE,IAAI,CAACC,CAAAA,OAAAA,GAAWA,OAAAA,CAAQF,IAAI,CAACH,GAAAA,CAAAA,CAAAA;AACzD;AAEA;;IAGA,SAASM,iBAAiBC,QAAgB,EAAA;;AAEtC,IAAA,MAAMC,YAAAA,GAAe,kBAAA;IACrB,OAAO,CAACA,YAAAA,CAAaL,IAAI,CAACI,QAAAA,CAAAA;AAC9B;AAEA;;IAGO,eAAeE,SAAAA,CAClBC,OAAe,EACfC,OAAiB,EAAE,EACnBC,OAAAA,GAAsC,EAAE,EAAA;AAExC,IAAA,MAAMC,MAAAA,GAASC,SAAAA,EAAAA;IAEf,OAAO,IAAIC,OAAAA,CAAQ,CAACC,OAAAA,EAASC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