codemerge-cli 1.0.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.
Files changed (47) hide show
  1. package/README.md +72 -0
  2. package/bin/codemerge.js +3 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +33 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/commands/init.d.ts +6 -0
  8. package/dist/commands/init.d.ts.map +1 -0
  9. package/dist/commands/init.js +37 -0
  10. package/dist/commands/init.js.map +1 -0
  11. package/dist/commands/use.d.ts +6 -0
  12. package/dist/commands/use.d.ts.map +1 -0
  13. package/dist/commands/use.js +36 -0
  14. package/dist/commands/use.js.map +1 -0
  15. package/dist/core/codeMerger.d.ts +11 -0
  16. package/dist/core/codeMerger.d.ts.map +1 -0
  17. package/dist/core/codeMerger.js +85 -0
  18. package/dist/core/codeMerger.js.map +1 -0
  19. package/dist/core/config.d.ts +11 -0
  20. package/dist/core/config.d.ts.map +1 -0
  21. package/dist/core/config.js +69 -0
  22. package/dist/core/config.js.map +1 -0
  23. package/dist/core/fileGenerator.d.ts +12 -0
  24. package/dist/core/fileGenerator.d.ts.map +1 -0
  25. package/dist/core/fileGenerator.js +39 -0
  26. package/dist/core/fileGenerator.js.map +1 -0
  27. package/dist/core/fileTemplates.d.ts +2 -0
  28. package/dist/core/fileTemplates.d.ts.map +1 -0
  29. package/dist/core/fileTemplates.js +2 -0
  30. package/dist/core/fileTemplates.js.map +1 -0
  31. package/dist/types.d.ts +31 -0
  32. package/dist/types.d.ts.map +1 -0
  33. package/dist/types.js +2 -0
  34. package/dist/types.js.map +1 -0
  35. package/dist/utils/fileUtils.d.ts +9 -0
  36. package/dist/utils/fileUtils.d.ts.map +1 -0
  37. package/dist/utils/fileUtils.js +28 -0
  38. package/dist/utils/fileUtils.js.map +1 -0
  39. package/dist/utils/logger.d.ts +8 -0
  40. package/dist/utils/logger.d.ts.map +1 -0
  41. package/dist/utils/logger.js +19 -0
  42. package/dist/utils/logger.js.map +1 -0
  43. package/dist/utils/pathUtils.d.ts +8 -0
  44. package/dist/utils/pathUtils.d.ts.map +1 -0
  45. package/dist/utils/pathUtils.js +19 -0
  46. package/dist/utils/pathUtils.js.map +1 -0
  47. package/package.json +48 -0
package/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # CodeMerge
2
+
3
+ AI-focused code and data preparation utility.
4
+
5
+ ## Bootstrap (Create New Project)
6
+
7
+ To create a new CodeMerge project from scratch:
8
+
9
+ ```bash
10
+ # Using bootstrap script
11
+ node bootstrap.js [target-directory] [--force]
12
+
13
+ # Examples
14
+ node bootstrap.js
15
+ node bootstrap.js ./my-project
16
+ node bootstrap.js . --force
17
+ ```
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install -g codemerge
23
+ ```
24
+
25
+ ## Quick Start
26
+
27
+ ```bash
28
+ # Merge current directory
29
+ codemerge use
30
+
31
+ # Merge specific directory
32
+ codemerge use ./src
33
+
34
+ # Custom output
35
+ codemerge use --output ai-digest.txt
36
+
37
+ # With filters
38
+ codemerge use --ignore "*.log,*.test.ts"
39
+ codemerge use --include "**/*.ts,**/*.js"
40
+ ```
41
+
42
+ ## Configuration
43
+
44
+ Create `codemerge.json` in your project root:
45
+
46
+ ```json
47
+ {
48
+ "outputPath": "ai-digest.txt",
49
+ "ignorePatterns": ["node_modules/**", "dist/**"],
50
+ "includePatterns": ["**/*.ts", "**/*.js"]
51
+ }
52
+ ```
53
+
54
+ ## Development
55
+
56
+ ```bash
57
+ # Install dependencies
58
+ npm install
59
+
60
+ # Build
61
+ npm run build
62
+
63
+ # Development mode
64
+ npm run dev
65
+
66
+ # Run locally
67
+ npm start use
68
+ ```
69
+
70
+ ## License
71
+
72
+ MIT
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ import '../dist/cli.js';
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import { readFileSync } from 'fs';
4
+ import { dirname, join } from 'path';
5
+ import { fileURLToPath } from 'url';
6
+ import { UseCommand } from './commands/use.js';
7
+ import { InitCommand } from './commands/init.js';
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = dirname(__filename);
10
+ class CLI {
11
+ constructor() {
12
+ this.program = new Command();
13
+ this.setupProgram();
14
+ this.registerCommands();
15
+ }
16
+ setupProgram() {
17
+ const packagePath = join(__dirname, '../package.json');
18
+ const packageJson = JSON.parse(readFileSync(packagePath, 'utf-8'));
19
+ this.program.name('codemerge').description('AI-focused code and data preparation utility').version(packageJson.version);
20
+ }
21
+ registerCommands() {
22
+ const useCommand = new UseCommand();
23
+ useCommand.register(this.program);
24
+ const initCommand = new InitCommand();
25
+ initCommand.register(this.program);
26
+ }
27
+ run() {
28
+ this.program.parse(process.argv);
29
+ }
30
+ }
31
+ const cli = new CLI();
32
+ cli.run();
33
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,MAAM,GAAG;IAGP;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAEO,YAAY;QAClB,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;QACvD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;QAEnE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC,8CAA8C,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC1H,CAAC;IAEO,gBAAgB;QACtB,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;QACpC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAElC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;QACtC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAEM,GAAG;QACR,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;CACF;AAED,MAAM,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;AACtB,GAAG,CAAC,GAAG,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Command } from 'commander';
2
+ export declare class InitCommand {
3
+ register(program: Command): void;
4
+ private execute;
5
+ }
6
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,qBAAa,WAAW;IACf,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;YAIzB,OAAO;CA4BtB"}
@@ -0,0 +1,37 @@
1
+ import { FileGenerator } from '../core/fileGenerator.js';
2
+ import { Logger } from '../utils/logger.js';
3
+ import { PathUtils } from '../utils/pathUtils.js';
4
+ export class InitCommand {
5
+ register(program) {
6
+ program.command('init').description('Initialize CodeMerge project structure').argument('[path]', 'Target directory', '.').option('-f, --force', 'Overwrite existing files').action(this.execute.bind(this));
7
+ }
8
+ async execute(targetPath, options) {
9
+ try {
10
+ Logger.info('Initializing CodeMerge project...');
11
+ const resolvedPath = PathUtils.resolve(targetPath);
12
+ const generator = new FileGenerator(resolvedPath);
13
+ const result = generator.generate(options.force || false);
14
+ if (result.success) {
15
+ Logger.success('Created ' + result.filesCreated + ' files successfully');
16
+ Logger.plain('');
17
+ Logger.plain('Next steps:');
18
+ Logger.plain(' 1. npm install');
19
+ Logger.plain(' 2. npm run build');
20
+ Logger.plain(' 3. npm start use');
21
+ }
22
+ else {
23
+ Logger.warning('Created ' + result.filesCreated + ' files with ' + result.errors.length + ' errors:');
24
+ result.errors.forEach(error => Logger.error(' ' + error));
25
+ if (!options.force) {
26
+ Logger.plain('');
27
+ Logger.plain('Use --force to overwrite existing files');
28
+ }
29
+ }
30
+ }
31
+ catch (error) {
32
+ Logger.error(error instanceof Error ? error.message : 'Unexpected error occurred');
33
+ process.exit(1);
34
+ }
35
+ }
36
+ }
37
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAMlD,MAAM,OAAO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K,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC;gBAC3D,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;oBACnB,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;oBACjB,MAAM,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;gBAC1D,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC;YACnF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ import { Command } from 'commander';
2
+ export declare class UseCommand {
3
+ register(program: Command): void;
4
+ private execute;
5
+ }
6
+ //# sourceMappingURL=use.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../src/commands/use.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,qBAAa,UAAU;IACd,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;YAIzB,OAAO;CA4BtB"}
@@ -0,0 +1,36 @@
1
+ import { CodeMerger } from '../core/codeMerger.js';
2
+ import { Config } from '../core/config.js';
3
+ import { Logger } from '../utils/logger.js';
4
+ export class UseCommand {
5
+ register(program) {
6
+ program.command('use').description('Merge code files into a single output file').argument('[path]', 'Input path to scan', '.').option('-o, --output <path>', 'Output file path').option('-w, --watch', 'Watch for file changes').option('--ignore <patterns>', 'Additional ignore patterns (comma-separated)').option('--include <patterns>', 'Include patterns (comma-separated)').action(this.execute.bind(this));
7
+ }
8
+ async execute(inputPath, options) {
9
+ try {
10
+ Logger.info('Starting code merge...');
11
+ const config = Config.load(inputPath);
12
+ const mergeOptions = Config.merge(config, {
13
+ inputPath,
14
+ outputPath: options.output,
15
+ watch: options.watch,
16
+ ignorePatterns: options.ignore ? options.ignore.split(',') : undefined,
17
+ includePatterns: options.include ? options.include.split(',') : undefined
18
+ });
19
+ const merger = new CodeMerger(mergeOptions);
20
+ const result = await merger.execute();
21
+ if (result.success) {
22
+ Logger.success('Merged ' + result.filesProcessed + ' files into ' + result.outputPath);
23
+ }
24
+ else {
25
+ Logger.error('Merge failed:');
26
+ result.errors.forEach(error => Logger.error(' ' + error));
27
+ process.exit(1);
28
+ }
29
+ }
30
+ catch (error) {
31
+ Logger.error(error instanceof Error ? error.message : 'Unexpected error occurred');
32
+ process.exit(1);
33
+ }
34
+ }
35
+ }
36
+ //# sourceMappingURL=use.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use.js","sourceRoot":"","sources":["../../src/commands/use.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAI5C,MAAM,OAAO,UAAU;IACd,QAAQ,CAAC,OAAgB;QAC9B,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,4CAA4C,CAAC,CAAC,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,qBAAqB,EAAE,kBAAkB,CAAC,CAAC,MAAM,CAAC,aAAa,EAAE,wBAAwB,CAAC,CAAC,MAAM,CAAC,qBAAqB,EAAE,8CAA8C,CAAC,CAAC,MAAM,CAAC,sBAAsB,EAAE,oCAAoC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACtZ,CAAC;IAEO,KAAK,CAAC,OAAO,CAAC,SAAiB,EAAE,OAAuB;Q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CAAC,2BAA2B,CAAC,CAAC;YACnF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ import type { MergeOptions, MergeResult } from '../types';
2
+ export declare class CodeMerger {
3
+ private options;
4
+ constructor(options: MergeOptions);
5
+ execute(): Promise<MergeResult>;
6
+ private collectFiles;
7
+ private mergeFiles;
8
+ private generateHeader;
9
+ private writeOutput;
10
+ }
11
+ //# sourceMappingURL=codeMerger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codeMerger.d.ts","sourceRoot":"","sources":["../../src/core/codeMerger.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAY,MAAM,UAAU,CAAC;AAEpE,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAe;gBAElB,OAAO,EAAE,YAAY;IAIpB,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC;YAsB9B,YAAY;IA8B1B,OAAO,CAAC,UAAU;IAmBlB,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,WAAW;CAGpB"}
@@ -0,0 +1,85 @@
1
+ import { resolve, relative } from 'path';
2
+ import { glob } from 'glob';
3
+ import { FileUtils } from '../utils/fileUtils.js';
4
+ export class CodeMerger {
5
+ constructor(options) {
6
+ this.options = options;
7
+ }
8
+ async execute() {
9
+ try {
10
+ const files = await this.collectFiles();
11
+ const content = this.mergeFiles(files);
12
+ this.writeOutput(content);
13
+ return {
14
+ success: true,
15
+ outputPath: this.options.outputPath,
16
+ filesProcessed: files.length,
17
+ errors: []
18
+ };
19
+ }
20
+ catch (error) {
21
+ return {
22
+ success: false,
23
+ outputPath: this.options.outputPath,
24
+ filesProcessed: 0,
25
+ errors: [error instanceof Error ? error.message : 'Unknown error']
26
+ };
27
+ }
28
+ }
29
+ async collectFiles() {
30
+ const files = [];
31
+ const inputPath = resolve(this.options.inputPath);
32
+ for (const pattern of this.options.includePatterns) {
33
+ const matchedFiles = await glob(pattern, {
34
+ cwd: inputPath,
35
+ ignore: this.options.ignorePatterns,
36
+ nodir: true
37
+ });
38
+ for (const file of matchedFiles) {
39
+ const fullPath = resolve(inputPath, file);
40
+ if (FileUtils.exists(fullPath) && FileUtils.isTextFile(fullPath)) {
41
+ try {
42
+ files.push({
43
+ path: fullPath,
44
+ content: FileUtils.read(fullPath),
45
+ relativePath: relative(inputPath, fullPath)
46
+ });
47
+ }
48
+ catch (error) {
49
+ continue;
50
+ }
51
+ }
52
+ }
53
+ }
54
+ return files.sort((a, b) => a.relativePath.localeCompare(b.relativePath));
55
+ }
56
+ mergeFiles(files) {
57
+ const header = this.generateHeader(files.length);
58
+ const separator = '='.repeat(80);
59
+ const mergedContent = files.map(file => {
60
+ const fileSeparator = '-'.repeat(40);
61
+ return [
62
+ 'STARTOFFILE: ' + file.relativePath,
63
+ fileSeparator,
64
+ file.content,
65
+ fileSeparator,
66
+ 'ENDOFFILE: ' + file.relativePath,
67
+ ''
68
+ ].join('\n');
69
+ }).join('\n');
70
+ return [header, separator, '', mergedContent].join('\n');
71
+ }
72
+ generateHeader(fileCount) {
73
+ const timestamp = new Date().toISOString();
74
+ return [
75
+ '# Code Merge Output',
76
+ 'Generated at: ' + timestamp,
77
+ 'Source path: ' + this.options.inputPath,
78
+ 'Files processed: ' + fileCount
79
+ ].join('\n');
80
+ }
81
+ writeOutput(content) {
82
+ FileUtils.write(this.options.outputPath, content);
83
+ }
84
+ }
85
+ //# sourceMappingURL=codeMerger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codeMerger.js","sourceRoot":"","sources":["../../src/core/codeMerger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAKlD,MAAM,OAAO,UAAU;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,CAAC;IAC3D,CAAC;IAEO,cAAc,CAAC,SAAiB;QACtC,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAC3C,OAAO;YACL,qBAAqB;YACrB,gBAAgB,GAAG,SAAS;YAC5B,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS;YACxC,mBAAmB,GAAG,SAAS;SAChC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IAEO,WAAW,CAAC,OAAe;QACjC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ import type { ConfigFile, MergeOptions } from '../types';
2
+ export declare class Config {
3
+ private static readonly CONFIG_FILENAMES;
4
+ private static readonly DEFAULT_IGNORE_PATTERNS;
5
+ private static readonly DEFAULT_INCLUDE_PATTERNS;
6
+ static load(basePath: string): ConfigFile;
7
+ private static parseConfigFile;
8
+ private static loadPackageJsonConfig;
9
+ static merge(config: ConfigFile, options: Partial<MergeOptions>): MergeOptions;
10
+ }
11
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEzD,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAGtC;IAEF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAW7C;IAEF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAO9C;WAEY,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU;IAahD,OAAO,CAAC,MAAM,CAAC,eAAe;IAQ9B,OAAO,CAAC,MAAM,CAAC,qBAAqB;WAYtB,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY;CAStF"}
@@ -0,0 +1,69 @@
1
+ import { join } from 'path';
2
+ import { FileUtils } from '../utils/fileUtils.js';
3
+ import { PathUtils } from '../utils/pathUtils.js';
4
+ export class Config {
5
+ static load(basePath) {
6
+ const resolvedPath = PathUtils.resolve(basePath);
7
+ for (const filename of this.CONFIG_FILENAMES) {
8
+ const configPath = join(resolvedPath, filename);
9
+ if (FileUtils.exists(configPath)) {
10
+ return this.parseConfigFile(configPath);
11
+ }
12
+ }
13
+ return this.loadPackageJsonConfig(resolvedPath);
14
+ }
15
+ static parseConfigFile(path) {
16
+ try {
17
+ return FileUtils.readJson(path);
18
+ }
19
+ catch {
20
+ return {};
21
+ }
22
+ }
23
+ static loadPackageJsonConfig(basePath) {
24
+ const packagePath = join(basePath, 'package.json');
25
+ if (!FileUtils.exists(packagePath))
26
+ return {};
27
+ try {
28
+ const pkg = FileUtils.readJson(packagePath);
29
+ return pkg.codemergeConfig || {};
30
+ }
31
+ catch {
32
+ return {};
33
+ }
34
+ }
35
+ static merge(config, options) {
36
+ return {
37
+ inputPath: options.inputPath || process.cwd(),
38
+ outputPath: options.outputPath || config.outputPath || 'merged-output.txt',
39
+ watch: options.watch ?? config.watch ?? false,
40
+ ignorePatterns: options.ignorePatterns || config.ignorePatterns || this.DEFAULT_IGNORE_PATTERNS,
41
+ includePatterns: options.includePatterns || config.includePatterns || this.DEFAULT_INCLUDE_PATTERNS
42
+ };
43
+ }
44
+ }
45
+ Config.CONFIG_FILENAMES = [
46
+ 'codemerge.json',
47
+ 'codemerge.config.json'
48
+ ];
49
+ Config.DEFAULT_IGNORE_PATTERNS = [
50
+ 'node_modules/**',
51
+ '.git/**',
52
+ 'dist/**',
53
+ 'build/**',
54
+ '**/*.log',
55
+ '.env*',
56
+ '**/.DS_Store',
57
+ 'coverage/**',
58
+ '.next/**',
59
+ '.nuxt/**'
60
+ ];
61
+ Config.DEFAULT_INCLUDE_PATTERNS = [
62
+ '**/*.ts',
63
+ '**/*.js',
64
+ '**/*.tsx',
65
+ '**/*.jsx',
66
+ '**/*.json',
67
+ '**/*.md'
68
+ ];
69
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIlD,MAAM,OAAO,MAAM;IA4BV,MAAM,CAAC,IAAI,CAAC,QAAgB;QACjC,MAAM,YAAY,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEjD,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC7C,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;YAChD,IAAI,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;gBACjC,OAAO,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAC;IAClD,CAAC;IAEO,MAAM,CAAC,eAAe,CAAC,IAAY;QACzC,IAAI,CAAC;YACH,OAAO,SAAS,CAAC,QAAQ,CAAa,IAAI,CAAC,CAAC;QAC9C,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAEO,MAAM,CAAC,qBAAqB,CAAC,QAAgB;QACnD,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;QACnD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC;YAAE,OAAO,EAAE,CAAC;QAE9C,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,SAAS,CAAC,QAAQ,CAAM,WAAW,CAAC,CAAC;YACjD,OAAO,GAAG,CAAC,eAAe,IAAI,EAAE,CAAC;QACnC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,MAAkB,EAAE,OAA8B;QACpE,OAAO;YACL,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,EAAE;YAC7C,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,IAAI,mBAAmB;YAC1E,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,IAAI,KAAK;YAC7C,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,MAAM,CAAC,cAAc,IAAI,IAAI,CAAC,uBAAuB;YAC/F,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,MAAM,CAAC,eAAe,IAAI,IAAI,CAAC,wBAAwB;SACpG,CAAC;IACJ,CAAC;;AApEuB,uBAAgB,GAAG;IACzC,gBAAgB;IAChB,uBAAuB;CACxB,CAAC;AAEsB,8BAAuB,GAAG;IAChD,iBAAiB;IACjB,SAAS;IACT,SAAS;IACT,UAAU;IACV,UAAU;IACV,OAAO;IACP,cAAc;IACd,aAAa;IACb,UAAU;IACV,UAAU;CACX,CAAC;AAEsB,+BAAwB,GAAG;IACjD,SAAS;IACT,SAAS;IACT,UAAU;IACV,UAAU;IACV,WAAW;IACX,SAAS;CACV,CAAC"}
@@ -0,0 +1,12 @@
1
+ export interface GenerateResult {
2
+ success: boolean;
3
+ filesCreated: number;
4
+ errors: string[];
5
+ }
6
+ export declare class FileGenerator {
7
+ private basePath;
8
+ constructor(basePath: string);
9
+ generate(force?: boolean): GenerateResult;
10
+ private ensureDirectory;
11
+ }
12
+ //# sourceMappingURL=fileGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileGenerator.d.ts","sourceRoot":"","sources":["../../src/core/fileGenerator.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAS;gBAEb,QAAQ,EAAE,MAAM;IAIrB,QAAQ,CAAC,KAAK,GAAE,OAAe,GAAG,cAAc;IA2BvD,OAAO,CAAC,eAAe;CAKxB"}
@@ -0,0 +1,39 @@
1
+ import { mkdirSync } from 'fs';
2
+ import { join, dirname } from 'path';
3
+ import { FileUtils } from '../utils/fileUtils.js';
4
+ import { FILE_TEMPLATES } from './fileTemplates.js';
5
+ export class FileGenerator {
6
+ constructor(basePath) {
7
+ this.basePath = basePath;
8
+ }
9
+ generate(force = false) {
10
+ const filesCreated = [];
11
+ const errors = [];
12
+ for (const [filePath, content] of Object.entries(FILE_TEMPLATES)) {
13
+ try {
14
+ const fullPath = join(this.basePath, filePath);
15
+ if (!force && FileUtils.exists(fullPath)) {
16
+ errors.push('File already exists: ' + filePath);
17
+ continue;
18
+ }
19
+ this.ensureDirectory(dirname(fullPath));
20
+ FileUtils.write(fullPath, content);
21
+ filesCreated.push(filePath);
22
+ }
23
+ catch (error) {
24
+ errors.push('Failed to create ' + filePath + ': ' + (error instanceof Error ? error.message : 'Unknown error'));
25
+ }
26
+ }
27
+ return {
28
+ success: errors.length === 0,
29
+ filesCreated: filesCreated.length,
30
+ errors
31
+ };
32
+ }
33
+ ensureDirectory(dirPath) {
34
+ if (!FileUtils.exists(dirPath)) {
35
+ mkdirSync(dirPath, { recursive: true });
36
+ }
37
+ }
38
+ }
39
+ //# sourceMappingURL=fileGenerator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileGenerator.js","sourceRoot":"","sources":["../../src/core/fileGenerator.ts"],"names":[],"mappings":"A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AAO,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;YAC5B,YAAY,EAAE,YAAY,CAAC,MAAM;YACjC,MAAM;SACP,CAAC;IACJ,CAAC;IAEO,eAAe,CAAC,OAAe;QACrC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;YAC/B,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export declare const FILE_TEMPLATES: {};
2
+ //# sourceMappingURL=fileTemplates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileTemplates.d.ts","sourceRoot":"","sources":["../../src/core/fileTemplates.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,IAAK,CAAC"}
@@ -0,0 +1,2 @@
1
+ export const FILE_TEMPLATES = {};
2
+ //# sourceMappingURL=fileTemplates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileTemplates.js","sourceRoot":"","sources":["../../src/core/fileTemplates.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC"}
@@ -0,0 +1,31 @@
1
+ export interface MergeOptions {
2
+ inputPath: string;
3
+ outputPath: string;
4
+ watch: boolean;
5
+ ignorePatterns: string[];
6
+ includePatterns: string[];
7
+ }
8
+ export interface ConfigFile {
9
+ outputPath?: string;
10
+ watch?: boolean;
11
+ ignorePatterns?: string[];
12
+ includePatterns?: string[];
13
+ }
14
+ export interface FileData {
15
+ path: string;
16
+ content: string;
17
+ relativePath: string;
18
+ }
19
+ export interface MergeResult {
20
+ success: boolean;
21
+ outputPath: string;
22
+ filesProcessed: number;
23
+ errors: string[];
24
+ }
25
+ export interface CommandOptions {
26
+ output?: string;
27
+ watch?: boolean;
28
+ ignore?: string;
29
+ include?: string;
30
+ }
31
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ export declare class FileUtils {
2
+ private static readonly BINARY_EXTENSIONS;
3
+ static read(path: string): string;
4
+ static write(path: string, content: string): void;
5
+ static exists(path: string): boolean;
6
+ static isTextFile(filePath: string): boolean;
7
+ static readJson<T>(path: string): T;
8
+ }
9
+ //# sourceMappingURL=fileUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileUtils.d.ts","sourceRoot":"","sources":["../../src/utils/fileUtils.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAMvC;WAEY,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;WAI1B,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;WAI1C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;WAI7B,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;WAKrC,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;CAI3C"}
@@ -0,0 +1,28 @@
1
+ import { readFileSync, writeFileSync, existsSync } from 'fs';
2
+ export class FileUtils {
3
+ static read(path) {
4
+ return readFileSync(path, 'utf-8');
5
+ }
6
+ static write(path, content) {
7
+ writeFileSync(path, content, 'utf-8');
8
+ }
9
+ static exists(path) {
10
+ return existsSync(path);
11
+ }
12
+ static isTextFile(filePath) {
13
+ const lowerPath = filePath.toLowerCase();
14
+ return !this.BINARY_EXTENSIONS.some(ext => lowerPath.endsWith(ext));
15
+ }
16
+ static readJson(path) {
17
+ const content = this.read(path);
18
+ return JSON.parse(content);
19
+ }
20
+ }
21
+ FileUtils.BINARY_EXTENSIONS = [
22
+ '.png', '.jpg', '.jpeg', '.gif', '.ico', '.bmp', '.svg',
23
+ '.pdf', '.zip', '.tar', '.gz', '.rar', '.7z',
24
+ '.exe', '.dll', '.so', '.dylib',
25
+ '.mp3', '.mp4', '.avi', '.mov', '.wmv',
26
+ '.ttf', '.woff', '.woff2', '.eot'
27
+ ];
28
+ //# sourceMappingURL=fileUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileUtils.js","sourceRoot":"","sources":["../../src/utils/fileUtils.ts"],"names":[],"mappings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+ static success(message: string): void;
4
+ static error(message: string): void;
5
+ static warning(message: string): void;
6
+ static plain(message: string): void;
7
+ }
8
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAEA,qBAAa,MAAM;WACH,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;WAI3B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;WAI9B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;WAI5B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;WAI9B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAG3C"}
@@ -0,0 +1,19 @@
1
+ import chalk from 'chalk';
2
+ export class Logger {
3
+ static info(message) {
4
+ console.log(chalk.cyan('ℹ'), message);
5
+ }
6
+ static success(message) {
7
+ console.log(chalk.green('✅'), message);
8
+ }
9
+ static error(message) {
10
+ console.error(chalk.red('❌'), message);
11
+ }
12
+ static warning(message) {
13
+ console.log(chalk.yellow('⚠️'), message);
14
+ }
15
+ static plain(message) {
16
+ console.log(message);
17
+ }
18
+ }
19
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,OAAO,MAAM;IACV,MAAM,CAAC,IAAI,CAAC,OAAe;QAChC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAEM,MAAM,CAAC,OAAO,CAAC,OAAe;QACnC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,OAAe;QACjC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;IAEM,MAAM,CAAC,OAAO,CAAC,OAAe;QACnC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,OAAe;QACjC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ export declare class PathUtils {
2
+ static resolve(path: string): string;
3
+ static relative(from: string, to: string): string;
4
+ static normalize(path: string): string;
5
+ static join(...paths: string[]): string;
6
+ static isAbsolute(path: string): boolean;
7
+ }
8
+ //# sourceMappingURL=pathUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pathUtils.d.ts","sourceRoot":"","sources":["../../src/utils/pathUtils.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;WACN,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;WAI7B,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM;WAI1C,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;WAI/B,IAAI,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM;WAIhC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAGhD"}
@@ -0,0 +1,19 @@
1
+ import { resolve, relative, normalize, join } from 'path';
2
+ export class PathUtils {
3
+ static resolve(path) {
4
+ return resolve(path);
5
+ }
6
+ static relative(from, to) {
7
+ return relative(from, to);
8
+ }
9
+ static normalize(path) {
10
+ return normalize(path);
11
+ }
12
+ static join(...paths) {
13
+ return join(...paths);
14
+ }
15
+ static isAbsolute(path) {
16
+ return resolve(path) === normalize(path);
17
+ }
18
+ }
19
+ //# sourceMappingURL=pathUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pathUtils.js","sourceRoot":"","sources":["../../src/utils/pathUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE1D,MAAM,OAAO,SAAS;IACb,MAAM,CAAC,OAAO,CAAC,IAAY;QAChC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,IAAY,EAAE,EAAU;QAC7C,OAAO,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC5B,CAAC;IAEM,MAAM,CAAC,SAAS,CAAC,IAAY;QAClC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAEM,MAAM,CAAC,IAAI,CAAC,GAAG,KAAe;QACnC,OAAO,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;IACxB,CAAC;IAEM,MAAM,CAAC,UAAU,CAAC,IAAY;QACnC,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;CACF"}
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "codemerge-cli",
3
+ "version": "1.0.0",
4
+ "description": "AI-focused code and data preparation utility",
5
+ "license": "MIT",
6
+ "author": "CodeMerge Team",
7
+ "type": "module",
8
+ "main": "dist/index.js",
9
+ "bin": {
10
+ "codemerge": "bin/codemerge.js"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/yourusername/codemerge.git"
15
+ },
16
+ "keywords": [
17
+ "ai",
18
+ "code",
19
+ "merge",
20
+ "preparation",
21
+ "cli",
22
+ "developer-tools"
23
+ ],
24
+ "scripts": {
25
+ "build": "tsc",
26
+ "dev": "tsx watch src/cli.ts",
27
+ "start": "node dist/cli.js",
28
+ "prepublishOnly": "npm run build"
29
+ },
30
+ "dependencies": {
31
+ "chalk": "^5.4.1",
32
+ "chokidar": "^3.6.0",
33
+ "commander": "^11.1.0",
34
+ "glob": "^10.3.10"
35
+ },
36
+ "devDependencies": {
37
+ "@types/node": "^20.10.0",
38
+ "tsx": "^4.7.0",
39
+ "typescript": "^5.3.3"
40
+ },
41
+ "engines": {
42
+ "node": ">=16.0.0"
43
+ },
44
+ "files": [
45
+ "dist/**/*",
46
+ "bin/**/*"
47
+ ]
48
+ }