@nahisaho/musubix-codegraph 2.3.2 → 2.3.4

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 (41) hide show
  1. package/dist/cli.d.ts +13 -0
  2. package/dist/cli.d.ts.map +1 -0
  3. package/dist/cli.js +318 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +8 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/pr/errors.d.ts +63 -0
  10. package/dist/pr/errors.d.ts.map +1 -0
  11. package/dist/pr/errors.js +116 -0
  12. package/dist/pr/errors.js.map +1 -0
  13. package/dist/pr/git-operations.d.ts +186 -0
  14. package/dist/pr/git-operations.d.ts.map +1 -0
  15. package/dist/pr/git-operations.js +441 -0
  16. package/dist/pr/git-operations.js.map +1 -0
  17. package/dist/pr/github-adapter.d.ts +163 -0
  18. package/dist/pr/github-adapter.d.ts.map +1 -0
  19. package/dist/pr/github-adapter.js +467 -0
  20. package/dist/pr/github-adapter.js.map +1 -0
  21. package/dist/pr/index.d.ts +20 -0
  22. package/dist/pr/index.d.ts.map +1 -0
  23. package/dist/pr/index.js +26 -0
  24. package/dist/pr/index.js.map +1 -0
  25. package/dist/pr/pr-creator.d.ts +173 -0
  26. package/dist/pr/pr-creator.d.ts.map +1 -0
  27. package/dist/pr/pr-creator.js +468 -0
  28. package/dist/pr/pr-creator.js.map +1 -0
  29. package/dist/pr/pr-template.d.ts +105 -0
  30. package/dist/pr/pr-template.d.ts.map +1 -0
  31. package/dist/pr/pr-template.js +273 -0
  32. package/dist/pr/pr-template.js.map +1 -0
  33. package/dist/pr/refactoring-applier.d.ts +143 -0
  34. package/dist/pr/refactoring-applier.d.ts.map +1 -0
  35. package/dist/pr/refactoring-applier.js +412 -0
  36. package/dist/pr/refactoring-applier.js.map +1 -0
  37. package/dist/pr/types.d.ts +362 -0
  38. package/dist/pr/types.d.ts.map +1 -0
  39. package/dist/pr/types.js +63 -0
  40. package/dist/pr/types.js.map +1 -0
  41. package/package.json +11 -2
package/dist/cli.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @nahisaho/musubix-codegraph CLI
4
+ *
5
+ * Command-line interface for CodeGraph operations
6
+ *
7
+ * @packageDocumentation
8
+ * @module @nahisaho/musubix-codegraph/cli
9
+ *
10
+ * @see REQ-CG-PR-009 - CLI Integration
11
+ */
12
+ export {};
13
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;GASG"}
package/dist/cli.js ADDED
@@ -0,0 +1,318 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @nahisaho/musubix-codegraph CLI
4
+ *
5
+ * Command-line interface for CodeGraph operations
6
+ *
7
+ * @packageDocumentation
8
+ * @module @nahisaho/musubix-codegraph/cli
9
+ *
10
+ * @see REQ-CG-PR-009 - CLI Integration
11
+ */
12
+ import { program } from 'commander';
13
+ import { readFileSync, existsSync } from 'node:fs';
14
+ import { resolve } from 'node:path';
15
+ // Read package.json for version
16
+ const packageJsonPath = new URL('../package.json', import.meta.url);
17
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
18
+ program
19
+ .name('cg')
20
+ .description('MUSUBIX CodeGraph - Code Graph Analysis CLI')
21
+ .version(packageJson.version);
22
+ // ============================================================================
23
+ // Index Command (v2.3.4 NEW)
24
+ // @see REQ-CG-v234-002, DES-CG-v234-002, TSK-v234-005
25
+ // ============================================================================
26
+ program
27
+ .command('index <path>')
28
+ .description('Index a codebase for graph analysis')
29
+ .option('-d, --depth <n>', 'Maximum directory depth (for future use)', '3')
30
+ .option('--json', 'Output as JSON')
31
+ .option('--languages <langs>', 'Target languages (comma-separated, for future use)')
32
+ .action(async (targetPath, options) => {
33
+ try {
34
+ const { CodeGraph } = await import('./codegraph.js');
35
+ const resolvedPath = resolve(targetPath);
36
+ const cg = new CodeGraph({ storage: 'memory' });
37
+ console.log(`šŸ” Indexing ${resolvedPath}...`);
38
+ const startTime = Date.now();
39
+ const result = await cg.index(resolvedPath);
40
+ const elapsed = ((Date.now() - startTime) / 1000).toFixed(2);
41
+ if (options.json) {
42
+ console.log(JSON.stringify({
43
+ success: result.success,
44
+ entitiesIndexed: result.entitiesIndexed,
45
+ relationsIndexed: result.relationsIndexed,
46
+ filesProcessed: result.filesProcessed,
47
+ durationMs: result.durationMs,
48
+ elapsedSeconds: parseFloat(elapsed)
49
+ }, null, 2));
50
+ }
51
+ else {
52
+ console.log(`āœ… Indexing complete in ${elapsed}s`);
53
+ console.log(` Entities: ${result.entitiesIndexed}`);
54
+ console.log(` Relations: ${result.relationsIndexed}`);
55
+ console.log(` Files: ${result.filesProcessed}`);
56
+ }
57
+ await cg.close();
58
+ }
59
+ catch (error) {
60
+ console.error('āŒ Error:', error instanceof Error ? error.message : error);
61
+ process.exit(1);
62
+ }
63
+ });
64
+ // ============================================================================
65
+ // Query Command (v2.3.4 NEW)
66
+ // @see REQ-CG-v234-002, DES-CG-v234-002, TSK-v234-006
67
+ // ============================================================================
68
+ program
69
+ .command('query <query>')
70
+ .description('Query entities in the code graph')
71
+ .option('--type <type>', 'Entity type filter (function, class, method, etc.)')
72
+ .option('--limit <n>', 'Maximum results', '10')
73
+ .option('--json', 'Output as JSON')
74
+ .action(async (queryText, options) => {
75
+ try {
76
+ const { CodeGraph } = await import('./codegraph.js');
77
+ const cg = new CodeGraph({ storage: 'memory' });
78
+ const limit = parseInt(options.limit, 10);
79
+ // Build query object
80
+ const graphQuery = options.type
81
+ ? { textSearch: queryText, entityType: options.type, limit }
82
+ : { textSearch: queryText, limit };
83
+ const result = await cg.query(graphQuery);
84
+ if (options.json) {
85
+ console.log(JSON.stringify(result, null, 2));
86
+ }
87
+ else {
88
+ if (result.entities.length === 0) {
89
+ console.log(`No entities found for "${queryText}"`);
90
+ }
91
+ else {
92
+ console.log(`Found ${result.entities.length} entities (total: ${result.totalCount}):`);
93
+ result.entities.slice(0, limit).forEach((e, i) => {
94
+ console.log(` ${i + 1}. ${e.name} (${e.type})${e.filePath ? ` - ${e.filePath}` : ''}`);
95
+ });
96
+ if (result.hasMore) {
97
+ console.log(` ... and ${result.totalCount - result.entities.length} more`);
98
+ }
99
+ }
100
+ }
101
+ await cg.close();
102
+ }
103
+ catch (error) {
104
+ console.error('āŒ Error:', error instanceof Error ? error.message : error);
105
+ process.exit(1);
106
+ }
107
+ });
108
+ // ============================================================================
109
+ // Stats Command (v2.3.4 NEW)
110
+ // @see REQ-CG-v234-002, DES-CG-v234-002, TSK-v234-007
111
+ // ============================================================================
112
+ program
113
+ .command('stats')
114
+ .description('Show code graph statistics')
115
+ .option('--json', 'Output as JSON')
116
+ .action(async (options) => {
117
+ try {
118
+ const { CodeGraph } = await import('./codegraph.js');
119
+ const cg = new CodeGraph({ storage: 'memory' });
120
+ const stats = await cg.getStats();
121
+ if (options.json) {
122
+ console.log(JSON.stringify(stats, null, 2));
123
+ }
124
+ else {
125
+ console.log('šŸ“Š Graph Statistics:');
126
+ console.log(` Entities: ${stats.entityCount}`);
127
+ console.log(` Relations: ${stats.relationCount}`);
128
+ console.log(` Files: ${stats.fileCount}`);
129
+ if (stats.languages && stats.languages.length > 0) {
130
+ console.log(` Languages: ${stats.languages.join(', ')}`);
131
+ }
132
+ }
133
+ await cg.close();
134
+ }
135
+ catch (error) {
136
+ console.error('āŒ Error:', error instanceof Error ? error.message : error);
137
+ process.exit(1);
138
+ }
139
+ });
140
+ // ============================================================================
141
+ // PR Commands
142
+ // ============================================================================
143
+ const prCommand = program
144
+ .command('pr')
145
+ .description('PR creation from refactoring suggestions');
146
+ /**
147
+ * cg pr create
148
+ */
149
+ prCommand
150
+ .command('create <suggestionFile>')
151
+ .description('Create a PR from a refactoring suggestion JSON file')
152
+ .option('-b, --branch <name>', 'Custom branch name')
153
+ .option('-t, --title <title>', 'Custom PR title')
154
+ .option('--base <branch>', 'Base branch (default: main/master)')
155
+ .option('-l, --labels <labels>', 'Comma-separated labels')
156
+ .option('-r, --reviewers <reviewers>', 'Comma-separated reviewers')
157
+ .option('-a, --assignees <assignees>', 'Comma-separated assignees')
158
+ .option('--draft', 'Create as draft PR')
159
+ .option('--dry-run', 'Preview changes without creating PR')
160
+ .option('--repo <path>', 'Repository path (default: current directory)')
161
+ .action(async (suggestionFile, options) => {
162
+ try {
163
+ const { createPRCreator } = await import('./pr/index.js');
164
+ // Read suggestion file
165
+ const filePath = resolve(suggestionFile);
166
+ if (!existsSync(filePath)) {
167
+ console.error(`āŒ Suggestion file not found: ${filePath}`);
168
+ process.exit(1);
169
+ }
170
+ const suggestion = JSON.parse(readFileSync(filePath, 'utf-8'));
171
+ const repoPath = options.repo ?? process.cwd();
172
+ console.log('šŸš€ Initializing PR Creator...');
173
+ const creator = createPRCreator(repoPath);
174
+ // Event listeners for progress
175
+ creator.on('pr:start', () => console.log('šŸ“‹ Starting PR creation...'));
176
+ creator.on('pr:branch', ({ name }) => console.log(`🌿 Creating branch: ${name}`));
177
+ creator.on('pr:applying', ({ file }) => console.log(`šŸ“ Applying changes to: ${file}`));
178
+ creator.on('pr:commit', ({ message }) => console.log(`šŸ’¾ Committing: ${message.split('\n')[0]}`));
179
+ creator.on('pr:push', ({ branch }) => console.log(`ā¬†ļø Pushing branch: ${branch}`));
180
+ creator.on('pr:created', ({ pr }) => console.log(`āœ… PR created: ${pr.url}`));
181
+ const initResult = await creator.initialize();
182
+ if (!initResult.success) {
183
+ console.error(`āŒ Initialization failed: ${initResult.error}`);
184
+ process.exit(1);
185
+ }
186
+ const result = await creator.create({
187
+ suggestion,
188
+ branchName: options.branch,
189
+ title: options.title,
190
+ baseBranch: options.base,
191
+ labels: options.labels?.split(',').map((s) => s.trim()),
192
+ reviewers: options.reviewers?.split(',').map((s) => s.trim()),
193
+ assignees: options.assignees?.split(',').map((s) => s.trim()),
194
+ draft: options.draft,
195
+ dryRun: options.dryRun,
196
+ });
197
+ if (result.success) {
198
+ if (options.dryRun) {
199
+ console.log('\nšŸ“‹ Dry Run Preview:');
200
+ console.log(` Branch: ${result.branchName}`);
201
+ console.log(` Files: ${result.filesChanged.length}`);
202
+ console.log(` +${result.linesAdded} / -${result.linesDeleted} lines`);
203
+ if (result.preview) {
204
+ console.log(`\nšŸ“ PR Title: ${result.preview.title}`);
205
+ console.log(`\nšŸ“„ Commit Message:\n${result.preview.commitMessage}`);
206
+ }
207
+ }
208
+ else {
209
+ console.log('\nšŸŽ‰ PR created successfully!');
210
+ console.log(` URL: ${result.pr?.url}`);
211
+ console.log(` Branch: ${result.branchName}`);
212
+ console.log(` Commit: ${result.commitHash}`);
213
+ }
214
+ }
215
+ else {
216
+ console.error(`\nāŒ PR creation failed: ${result.error}`);
217
+ process.exit(1);
218
+ }
219
+ if (result.warnings && result.warnings.length > 0) {
220
+ console.log('\nāš ļø Warnings:');
221
+ result.warnings.forEach(w => console.log(` - ${w}`));
222
+ }
223
+ }
224
+ catch (error) {
225
+ console.error('āŒ Error:', error instanceof Error ? error.message : error);
226
+ process.exit(1);
227
+ }
228
+ });
229
+ /**
230
+ * cg pr preview
231
+ */
232
+ prCommand
233
+ .command('preview <suggestionFile>')
234
+ .description('Preview PR changes without creating')
235
+ .option('--repo <path>', 'Repository path (default: current directory)')
236
+ .option('--json', 'Output as JSON')
237
+ .action(async (suggestionFile, options) => {
238
+ try {
239
+ const { createPRCreator } = await import('./pr/index.js');
240
+ // Read suggestion file
241
+ const filePath = resolve(suggestionFile);
242
+ if (!existsSync(filePath)) {
243
+ console.error(`āŒ Suggestion file not found: ${filePath}`);
244
+ process.exit(1);
245
+ }
246
+ const suggestion = JSON.parse(readFileSync(filePath, 'utf-8'));
247
+ const repoPath = options.repo ?? process.cwd();
248
+ const creator = createPRCreator(repoPath);
249
+ const initResult = await creator.initialize();
250
+ if (!initResult.success) {
251
+ console.error(`āŒ Initialization failed: ${initResult.error}`);
252
+ process.exit(1);
253
+ }
254
+ const preview = await creator.preview({ suggestion });
255
+ if (options.json) {
256
+ console.log(JSON.stringify(preview, null, 2));
257
+ }
258
+ else {
259
+ console.log('šŸ“‹ PR Preview\n');
260
+ console.log(`Branch: ${preview.branchName}`);
261
+ console.log(`Title: ${preview.title}`);
262
+ console.log(`\nšŸ“ Commit Message:\n${preview.commitMessage}`);
263
+ console.log(`\nšŸ“„ Files Changed (${preview.diffs.length}):`);
264
+ for (const diff of preview.diffs) {
265
+ console.log(` ${diff.changeType === 'added' ? 'āž•' : 'šŸ“'} ${diff.filePath} (+${diff.additions}/-${diff.deletions})`);
266
+ }
267
+ console.log('\nšŸ“‹ PR Body Preview:\n');
268
+ console.log(preview.body.slice(0, 500) + (preview.body.length > 500 ? '...' : ''));
269
+ }
270
+ }
271
+ catch (error) {
272
+ console.error('āŒ Error:', error instanceof Error ? error.message : error);
273
+ process.exit(1);
274
+ }
275
+ });
276
+ /**
277
+ * cg pr validate
278
+ */
279
+ prCommand
280
+ .command('validate <suggestionFile>')
281
+ .description('Validate that a suggestion can be applied')
282
+ .option('--repo <path>', 'Repository path (default: current directory)')
283
+ .action(async (suggestionFile, options) => {
284
+ try {
285
+ const { createPRCreator } = await import('./pr/index.js');
286
+ // Read suggestion file
287
+ const filePath = resolve(suggestionFile);
288
+ if (!existsSync(filePath)) {
289
+ console.error(`āŒ Suggestion file not found: ${filePath}`);
290
+ process.exit(1);
291
+ }
292
+ const suggestion = JSON.parse(readFileSync(filePath, 'utf-8'));
293
+ const repoPath = options.repo ?? process.cwd();
294
+ const creator = createPRCreator(repoPath);
295
+ const initResult = await creator.initialize();
296
+ if (!initResult.success) {
297
+ console.error(`āŒ Initialization failed: ${initResult.error}`);
298
+ process.exit(1);
299
+ }
300
+ const result = creator.validate(suggestion);
301
+ if (result.valid) {
302
+ console.log('āœ… Suggestion is valid and can be applied');
303
+ }
304
+ else {
305
+ console.error(`āŒ Suggestion validation failed: ${result.reason}`);
306
+ process.exit(1);
307
+ }
308
+ }
309
+ catch (error) {
310
+ console.error('āŒ Error:', error instanceof Error ? error.message : error);
311
+ process.exit(1);
312
+ }
313
+ });
314
+ // ============================================================================
315
+ // Parse and Execute
316
+ // ============================================================================
317
+ program.parse();
318
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;GASG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,gCAAgC;AAChC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpE,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;AAEvE,OAAO;KACJ,IAAI,CAAC,IAAI,CAAC;KACV,WAAW,CAAC,6CAA6C,CAAC;KAC1D,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AAEhC,+EAA+E;AAC/E,6BAA6B;AAC7B,sDAAsD;AACtD,+EAA+E;AAE/E,OAAO;KACJ,OAAO,CAAC,cAAc,CAAC;KACvB,WAAW,CAAC,qCAAqC,CAAC;KAClD,MAAM,CAAC,iBAAiB,EAAE,0CAA0C,EAAE,GAAG,CAAC;KAC1E,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;KAClC,MAAM,CAAC,qBAAqB,EAAE,oDAAoD,CAAC;KACnF,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE;IACpC,IAAI,CAAC;QACH,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;QACrD,M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AAC,0CAA0C,CAAC,CAAC;QAC1D,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,mCAAmC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;YAClE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC1E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E,OAAO,CAAC,KAAK,EAAE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -15,4 +15,5 @@ export { CodeGraph, createCodeGraph } from './codegraph.js';
15
15
  export { TypedEventEmitter, CodeGraphEventEmitter, } from './events/index.js';
16
16
  export type { Language, EntityType, Entity, EntityInput, RelationType, Relation, RelationInput, CodeGraphOptions, ParserOptions, GraphOptions, IndexerOptions, GraphRAGOptions, StorageAdapter, StorageStats, CodeGraphEvents, IndexProgress, QueryResult, IndexResult, CallPath, ModuleAnalysis, CodeSnippet, FileStructure, SearchResult, Community, GraphStatistics, ParseResult, GraphQuery, DependencyOptions, LocalSearchOptions, GlobalSearchOptions, } from './types.js';
17
17
  export { LANGUAGE_EXTENSIONS, DEFAULT_CODEGRAPH_OPTIONS, generateEntityId, generateRelationId, isSupportedLanguage, getLanguageFromExtension, } from './types.js';
18
+ export { createPRCreator, PRCreator, GitOperations, GitHubAdapter, RefactoringApplier, PRTemplateGenerator, type RefactoringSuggestion, type CodeChange, type PRCreateOptions, type PRCreateResult, type PRPreview, type GitHubConfig, type PRInfo, type FileDiff, type PRCreatorEvents, generateBranchName, generateCommitMessage, } from './pr/index.js';
18
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAG5D,OAAO,EACL,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAG3B,YAAY,EAEV,QAAQ,EAGR,UAAU,EACV,MAAM,EACN,WAAW,EAGX,YAAY,EACZ,QAAQ,EACR,aAAa,EAGb,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,cAAc,EACd,eAAe,EAGf,cAAc,EACd,YAAY,EAGZ,eAAe,EACf,aAAa,EAGb,WAAW,EACX,WAAW,EACX,QAAQ,EACR,cAAc,EACd,WAAW,EACX,aAAa,EACb,YAAY,EACZ,SAAS,EACT,eAAe,EACf,WAAW,EAGX,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAG5D,OAAO,EACL,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAG3B,YAAY,EAEV,QAAQ,EAGR,UAAU,EACV,MAAM,EACN,WAAW,EAGX,YAAY,EACZ,QAAQ,EACR,aAAa,EAGb,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,cAAc,EACd,eAAe,EAGf,cAAc,EACd,YAAY,EAGZ,eAAe,EACf,aAAa,EAGb,WAAW,EACX,WAAW,EACX,QAAQ,EACR,cAAc,EACd,WAAW,EACX,aAAa,EACb,YAAY,EACZ,SAAS,EACT,eAAe,EACf,WAAW,EAGX,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAEL,eAAe,EAGf,SAAS,EACT,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EAGnB,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,eAAe,EAGpB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -17,4 +17,12 @@ export { CodeGraph, createCodeGraph } from './codegraph.js';
17
17
  export { TypedEventEmitter, CodeGraphEventEmitter, } from './events/index.js';
18
18
  // Constants
19
19
  export { LANGUAGE_EXTENSIONS, DEFAULT_CODEGRAPH_OPTIONS, generateEntityId, generateRelationId, isSupportedLanguage, getLanguageFromExtension, } from './types.js';
20
+ // PR Creation Module (v2.3.3 NEW!)
21
+ export {
22
+ // Main factory
23
+ createPRCreator,
24
+ // Classes
25
+ PRCreator, GitOperations, GitHubAdapter, RefactoringApplier, PRTemplateGenerator,
26
+ // Utilities
27
+ generateBranchName, generateCommitMessage, } from './pr/index.js';
20
28
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,cAAc;AACd,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE5D,eAAe;AACf,OAAO,EACL,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAmD3B,YAAY;AACZ,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,cAAc;AACd,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE5D,eAAe;AACf,OAAO,EACL,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAmD3B,YAAY;AACZ,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAEpB,mCAAmC;AACnC,OAAO;AACL,eAAe;AACf,eAAe;AAEf,UAAU;AACV,SAAS,EACT,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,mBAAmB;AAanB,YAAY;AACZ,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,eAAe,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * @nahisaho/musubix-codegraph/pr - Error Definitions
3
+ *
4
+ * Custom error classes for PR creation operations
5
+ *
6
+ * @packageDocumentation
7
+ * @module @nahisaho/musubix-codegraph/pr
8
+ *
9
+ * @see REQ-CG-v234-004 - Error Message Improvement
10
+ * @see DES-CG-v234-004 - Error Class Design
11
+ */
12
+ /**
13
+ * Error codes for PRCreator operations
14
+ * @see DES-CG-v234-004
15
+ */
16
+ export type PRErrorCode = 'NOT_INITIALIZED' | 'OFFLINE_MODE' | 'AUTH_FAILED' | 'REPO_NOT_FOUND' | 'REMOTE_PARSE_FAILED' | 'APPLY_FAILED' | 'BRANCH_EXISTS' | 'PUSH_FAILED' | 'PR_CREATE_FAILED';
17
+ /**
18
+ * Error message definitions with actionable suggestions
19
+ * @see REQ-CG-v234-004
20
+ */
21
+ export declare const PRErrorMessages: Record<PRErrorCode, {
22
+ message: string;
23
+ suggestion: string;
24
+ }>;
25
+ /**
26
+ * Custom error class for PRCreator operations
27
+ *
28
+ * Includes error code and actionable suggestion for resolution
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * throw new PRCreatorError(
33
+ * 'PRCreator is not initialized',
34
+ * 'NOT_INITIALIZED',
35
+ * 'Call initializeOffline() for preview'
36
+ * );
37
+ * ```
38
+ *
39
+ * @see REQ-CG-v234-004
40
+ * @see DES-CG-v234-004
41
+ */
42
+ export declare class PRCreatorError extends Error {
43
+ readonly code: PRErrorCode;
44
+ readonly suggestion?: string | undefined;
45
+ /**
46
+ * Create a new PRCreatorError
47
+ * @param message - Error message
48
+ * @param code - Error code for programmatic handling
49
+ * @param suggestion - Actionable suggestion for resolution
50
+ */
51
+ constructor(message: string, code: PRErrorCode, suggestion?: string | undefined);
52
+ /**
53
+ * Get formatted error message with suggestion
54
+ */
55
+ getFullMessage(): string;
56
+ /**
57
+ * Create error from error code
58
+ * @param code - Error code
59
+ * @param additionalInfo - Optional additional context
60
+ */
61
+ static fromCode(code: PRErrorCode, additionalInfo?: string): PRCreatorError;
62
+ }
63
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/pr/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH;;;GAGG;AACH,MAAM,MAAM,WAAW,GACnB,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,qBAAqB,GACrB,cAAc,GACd,eAAe,GACf,aAAa,GACb,kBAAkB,CAAC;AAMvB;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,WAAW,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAqCxF,CAAC;AAMF;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,cAAe,SAAQ,KAAK;aASrB,IAAI,EAAE,WAAW;aACjB,UAAU,CAAC,EAAE,MAAM;IATrC;;;;;OAKG;gBAED,OAAO,EAAE,MAAM,EACC,IAAI,EAAE,WAAW,EACjB,UAAU,CAAC,EAAE,MAAM,YAAA;IASrC;;OAEG;IACH,cAAc,IAAI,MAAM;IAOxB;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,cAAc;CAO5E"}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * @nahisaho/musubix-codegraph/pr - Error Definitions
3
+ *
4
+ * Custom error classes for PR creation operations
5
+ *
6
+ * @packageDocumentation
7
+ * @module @nahisaho/musubix-codegraph/pr
8
+ *
9
+ * @see REQ-CG-v234-004 - Error Message Improvement
10
+ * @see DES-CG-v234-004 - Error Class Design
11
+ */
12
+ // ============================================================================
13
+ // Error Messages with Suggestions
14
+ // ============================================================================
15
+ /**
16
+ * Error message definitions with actionable suggestions
17
+ * @see REQ-CG-v234-004
18
+ */
19
+ export const PRErrorMessages = {
20
+ NOT_INITIALIZED: {
21
+ message: 'PRCreator is not initialized',
22
+ suggestion: 'Call initializeOffline() for preview or initialize() for full functionality',
23
+ },
24
+ OFFLINE_MODE: {
25
+ message: 'Cannot perform this operation in offline mode',
26
+ suggestion: 'Call initialize() to authenticate with GitHub',
27
+ },
28
+ AUTH_FAILED: {
29
+ message: 'GitHub authentication failed',
30
+ suggestion: "Run 'gh auth login' or set GITHUB_TOKEN environment variable. For preview-only, use initializeOffline() instead",
31
+ },
32
+ REPO_NOT_FOUND: {
33
+ message: 'Git repository not found',
34
+ suggestion: 'Ensure the path is a valid git repository (contains .git directory)',
35
+ },
36
+ REMOTE_PARSE_FAILED: {
37
+ message: 'Could not parse GitHub owner/repo from remote URL',
38
+ suggestion: 'Ensure the remote URL is a valid GitHub URL (e.g., git@github.com:owner/repo.git)',
39
+ },
40
+ APPLY_FAILED: {
41
+ message: 'Failed to apply refactoring changes',
42
+ suggestion: 'Check file permissions and ensure target files exist',
43
+ },
44
+ BRANCH_EXISTS: {
45
+ message: 'Branch already exists',
46
+ suggestion: 'Use a different branch name or delete the existing branch',
47
+ },
48
+ PUSH_FAILED: {
49
+ message: 'Failed to push changes to remote',
50
+ suggestion: 'Check your network connection and repository permissions',
51
+ },
52
+ PR_CREATE_FAILED: {
53
+ message: 'Failed to create pull request on GitHub',
54
+ suggestion: 'Verify your GitHub token has repo permissions and the base branch exists',
55
+ },
56
+ };
57
+ // ============================================================================
58
+ // Error Class
59
+ // ============================================================================
60
+ /**
61
+ * Custom error class for PRCreator operations
62
+ *
63
+ * Includes error code and actionable suggestion for resolution
64
+ *
65
+ * @example
66
+ * ```typescript
67
+ * throw new PRCreatorError(
68
+ * 'PRCreator is not initialized',
69
+ * 'NOT_INITIALIZED',
70
+ * 'Call initializeOffline() for preview'
71
+ * );
72
+ * ```
73
+ *
74
+ * @see REQ-CG-v234-004
75
+ * @see DES-CG-v234-004
76
+ */
77
+ export class PRCreatorError extends Error {
78
+ code;
79
+ suggestion;
80
+ /**
81
+ * Create a new PRCreatorError
82
+ * @param message - Error message
83
+ * @param code - Error code for programmatic handling
84
+ * @param suggestion - Actionable suggestion for resolution
85
+ */
86
+ constructor(message, code, suggestion) {
87
+ super(message);
88
+ this.code = code;
89
+ this.suggestion = suggestion;
90
+ this.name = 'PRCreatorError';
91
+ // Ensure proper prototype chain
92
+ Object.setPrototypeOf(this, PRCreatorError.prototype);
93
+ }
94
+ /**
95
+ * Get formatted error message with suggestion
96
+ */
97
+ getFullMessage() {
98
+ if (this.suggestion) {
99
+ return `${this.message}\n\nšŸ’” Suggestion: ${this.suggestion}`;
100
+ }
101
+ return this.message;
102
+ }
103
+ /**
104
+ * Create error from error code
105
+ * @param code - Error code
106
+ * @param additionalInfo - Optional additional context
107
+ */
108
+ static fromCode(code, additionalInfo) {
109
+ const errorDef = PRErrorMessages[code];
110
+ const message = additionalInfo
111
+ ? `${errorDef.message}: ${additionalInfo}`
112
+ : errorDef.message;
113
+ return new PRCreatorError(message, code, errorDef.suggestion);
114
+ }
115
+ }
116
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/pr/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAqBH,+EAA+E;AAC/E,kCAAkC;AAClC,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAiE;IAC3F,eAAe,EAAE;QACf,OAAO,EAAE,8BAA8B;QACvC,UAAU,EAAE,6EAA6E;KAC1F;IACD,YAAY,EAAE;QACZ,OAAO,EAAE,+CAA+C;QACxD,UAAU,EAAE,+CAA+C;KAC5D;IACD,WAAW,EAAE;QACX,OAAO,EAAE,8BAA8B;QACvC,UAAU,EAAE,iHAAiH;KAC9H;IACD,cAAc,EAAE;QACd,OAAO,EAAE,0BAA0B;QACnC,UAAU,EAAE,qEAAqE;KAClF;IACD,mBAAmB,EAAE;QACnB,OAAO,EAAE,mDAAmD;QAC5D,UAAU,EAAE,mFAAmF;KAChG;IACD,YAAY,EAAE;QACZ,OAAO,EAAE,qCAAqC;QAC9C,UAAU,EAAE,sDAAsD;KACnE;IACD,aAAa,EAAE;QACb,OAAO,EAAE,uBAAuB;QAChC,UAAU,EAAE,2DAA2D;KACxE;IACD,WAAW,EAAE;QACX,OAAO,EAAE,kCAAkC;QAC3C,UAAU,EAAE,0DAA0D;KACvE;IACD,gBAAgB,EAAE;QAChB,OAAO,EAAE,yCAAyC;QAClD,UAAU,EAAE,0EAA0E;KACvF;CACF,CAAC;AAEF,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IASrB;IACA;IATlB;;;;;OAKG;IACH,YACE,OAA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