cast-code 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.
- package/LICENSE +21 -0
- package/README.md +217 -0
- package/dist/app.module.js +45 -0
- package/dist/app.module.js.map +1 -0
- package/dist/common/common.module.js +49 -0
- package/dist/common/common.module.js.map +1 -0
- package/dist/common/constants/index.js +105 -0
- package/dist/common/constants/index.js.map +1 -0
- package/dist/common/index.js +24 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/services/config.service.js +119 -0
- package/dist/common/services/config.service.js.map +1 -0
- package/dist/common/services/llm.service.js +56 -0
- package/dist/common/services/llm.service.js.map +1 -0
- package/dist/common/services/markdown-parser.service.js +101 -0
- package/dist/common/services/markdown-parser.service.js.map +1 -0
- package/dist/common/services/markdown-renderer.service.js +220 -0
- package/dist/common/services/markdown-renderer.service.js.map +1 -0
- package/dist/common/services/multi-llm.service.js +115 -0
- package/dist/common/services/multi-llm.service.js.map +1 -0
- package/dist/common/types/index.js +20 -0
- package/dist/common/types/index.js.map +1 -0
- package/dist/common/types/markdown.types.js +6 -0
- package/dist/common/types/markdown.types.js.map +1 -0
- package/dist/main.js +84 -0
- package/dist/main.js.map +1 -0
- package/dist/modules/agents/agents.module.js +43 -0
- package/dist/modules/agents/agents.module.js.map +1 -0
- package/dist/modules/agents/definitions/architect.md +35 -0
- package/dist/modules/agents/definitions/backend.md +43 -0
- package/dist/modules/agents/definitions/coder.md +34 -0
- package/dist/modules/agents/definitions/devops.md +42 -0
- package/dist/modules/agents/definitions/frontend.md +46 -0
- package/dist/modules/agents/definitions/reviewer.md +35 -0
- package/dist/modules/agents/definitions/tester.md +41 -0
- package/dist/modules/agents/index.js +23 -0
- package/dist/modules/agents/index.js.map +1 -0
- package/dist/modules/agents/services/agent-loader.service.js +150 -0
- package/dist/modules/agents/services/agent-loader.service.js.map +1 -0
- package/dist/modules/agents/services/agent-registry.service.js +108 -0
- package/dist/modules/agents/services/agent-registry.service.js.map +1 -0
- package/dist/modules/agents/types/agent.types.js +6 -0
- package/dist/modules/agents/types/agent.types.js.map +1 -0
- package/dist/modules/agents/types/index.js +20 -0
- package/dist/modules/agents/types/index.js.map +1 -0
- package/dist/modules/config/config.module.js +38 -0
- package/dist/modules/config/config.module.js.map +1 -0
- package/dist/modules/config/index.js +24 -0
- package/dist/modules/config/index.js.map +1 -0
- package/dist/modules/config/services/config-commands.service.js +405 -0
- package/dist/modules/config/services/config-commands.service.js.map +1 -0
- package/dist/modules/config/services/config-manager.service.js +175 -0
- package/dist/modules/config/services/config-manager.service.js.map +1 -0
- package/dist/modules/config/services/init-config.service.js +238 -0
- package/dist/modules/config/services/init-config.service.js.map +1 -0
- package/dist/modules/config/types/config.types.js +163 -0
- package/dist/modules/config/types/config.types.js.map +1 -0
- package/dist/modules/config/types/index.js +20 -0
- package/dist/modules/config/types/index.js.map +1 -0
- package/dist/modules/core/core.module.js +60 -0
- package/dist/modules/core/core.module.js.map +1 -0
- package/dist/modules/core/index.js +22 -0
- package/dist/modules/core/index.js.map +1 -0
- package/dist/modules/core/services/deep-agent.service.js +575 -0
- package/dist/modules/core/services/deep-agent.service.js.map +1 -0
- package/dist/modules/core/services/plan-mode.service.js +225 -0
- package/dist/modules/core/services/plan-mode.service.js.map +1 -0
- package/dist/modules/git/git.module.js +48 -0
- package/dist/modules/git/git.module.js.map +1 -0
- package/dist/modules/git/index.js +23 -0
- package/dist/modules/git/index.js.map +1 -0
- package/dist/modules/git/services/code-review.service.js +330 -0
- package/dist/modules/git/services/code-review.service.js.map +1 -0
- package/dist/modules/git/services/commit-generator.service.js +403 -0
- package/dist/modules/git/services/commit-generator.service.js.map +1 -0
- package/dist/modules/git/services/index.js +21 -0
- package/dist/modules/git/services/index.js.map +1 -0
- package/dist/modules/git/services/monorepo-detector.service.js +338 -0
- package/dist/modules/git/services/monorepo-detector.service.js.map +1 -0
- package/dist/modules/git/services/pr-generator.service.js +429 -0
- package/dist/modules/git/services/pr-generator.service.js.map +1 -0
- package/dist/modules/git/services/release-notes.service.js +426 -0
- package/dist/modules/git/services/release-notes.service.js.map +1 -0
- package/dist/modules/git/types/git.types.js +6 -0
- package/dist/modules/git/types/git.types.js.map +1 -0
- package/dist/modules/git/types/index.js +20 -0
- package/dist/modules/git/types/index.js.map +1 -0
- package/dist/modules/mcp/catalog/mcp-templates.js +606 -0
- package/dist/modules/mcp/catalog/mcp-templates.js.map +1 -0
- package/dist/modules/mcp/index.js +23 -0
- package/dist/modules/mcp/index.js.map +1 -0
- package/dist/modules/mcp/mcp.module.js +35 -0
- package/dist/modules/mcp/mcp.module.js.map +1 -0
- package/dist/modules/mcp/services/mcp-client.service.js +289 -0
- package/dist/modules/mcp/services/mcp-client.service.js.map +1 -0
- package/dist/modules/mcp/services/mcp-registry.service.js +197 -0
- package/dist/modules/mcp/services/mcp-registry.service.js.map +1 -0
- package/dist/modules/mcp/types/index.js +20 -0
- package/dist/modules/mcp/types/index.js.map +1 -0
- package/dist/modules/mcp/types/mcp.types.js +6 -0
- package/dist/modules/mcp/types/mcp.types.js.map +1 -0
- package/dist/modules/memory/index.js +23 -0
- package/dist/modules/memory/index.js.map +1 -0
- package/dist/modules/memory/memory.module.js +35 -0
- package/dist/modules/memory/memory.module.js.map +1 -0
- package/dist/modules/memory/services/memory-tools.service.js +78 -0
- package/dist/modules/memory/services/memory-tools.service.js.map +1 -0
- package/dist/modules/memory/services/memory.service.js +169 -0
- package/dist/modules/memory/services/memory.service.js.map +1 -0
- package/dist/modules/memory/types/index.js +20 -0
- package/dist/modules/memory/types/index.js.map +1 -0
- package/dist/modules/memory/types/memory.types.js +6 -0
- package/dist/modules/memory/types/memory.types.js.map +1 -0
- package/dist/modules/mentions/index.js +22 -0
- package/dist/modules/mentions/index.js.map +1 -0
- package/dist/modules/mentions/mentions.module.js +32 -0
- package/dist/modules/mentions/mentions.module.js.map +1 -0
- package/dist/modules/mentions/services/mentions.service.js +336 -0
- package/dist/modules/mentions/services/mentions.service.js.map +1 -0
- package/dist/modules/mentions/types/index.js +20 -0
- package/dist/modules/mentions/types/index.js.map +1 -0
- package/dist/modules/mentions/types/mention.types.js +19 -0
- package/dist/modules/mentions/types/mention.types.js.map +1 -0
- package/dist/modules/permissions/index.js +23 -0
- package/dist/modules/permissions/index.js.map +1 -0
- package/dist/modules/permissions/permissions.module.js +35 -0
- package/dist/modules/permissions/permissions.module.js.map +1 -0
- package/dist/modules/permissions/services/permission.service.js +269 -0
- package/dist/modules/permissions/services/permission.service.js.map +1 -0
- package/dist/modules/permissions/services/prompt.service.js +116 -0
- package/dist/modules/permissions/services/prompt.service.js.map +1 -0
- package/dist/modules/permissions/types/permission.types.js +32 -0
- package/dist/modules/permissions/types/permission.types.js.map +1 -0
- package/dist/modules/project/index.js +24 -0
- package/dist/modules/project/index.js.map +1 -0
- package/dist/modules/project/project.module.js +38 -0
- package/dist/modules/project/project.module.js.map +1 -0
- package/dist/modules/project/services/project-analyzer.service.js +1063 -0
- package/dist/modules/project/services/project-analyzer.service.js.map +1 -0
- package/dist/modules/project/services/project-context.service.js +62 -0
- package/dist/modules/project/services/project-context.service.js.map +1 -0
- package/dist/modules/project/services/project-loader.service.js +147 -0
- package/dist/modules/project/services/project-loader.service.js.map +1 -0
- package/dist/modules/project/types/index.js +20 -0
- package/dist/modules/project/types/index.js.map +1 -0
- package/dist/modules/project/types/project.types.js +6 -0
- package/dist/modules/project/types/project.types.js.map +1 -0
- package/dist/modules/repl/index.js +21 -0
- package/dist/modules/repl/index.js.map +1 -0
- package/dist/modules/repl/repl.module.js +66 -0
- package/dist/modules/repl/repl.module.js.map +1 -0
- package/dist/modules/repl/services/commands/agent-commands.service.js +196 -0
- package/dist/modules/repl/services/commands/agent-commands.service.js.map +1 -0
- package/dist/modules/repl/services/commands/git-commands.service.js +500 -0
- package/dist/modules/repl/services/commands/git-commands.service.js.map +1 -0
- package/dist/modules/repl/services/commands/mcp-commands.service.js +579 -0
- package/dist/modules/repl/services/commands/mcp-commands.service.js.map +1 -0
- package/dist/modules/repl/services/commands/project-commands.service.js +226 -0
- package/dist/modules/repl/services/commands/project-commands.service.js.map +1 -0
- package/dist/modules/repl/services/commands/repl-commands.service.js +254 -0
- package/dist/modules/repl/services/commands/repl-commands.service.js.map +1 -0
- package/dist/modules/repl/services/repl.service.js +647 -0
- package/dist/modules/repl/services/repl.service.js.map +1 -0
- package/dist/modules/repl/services/smart-input.js +544 -0
- package/dist/modules/repl/services/smart-input.js.map +1 -0
- package/dist/modules/repl/services/welcome-screen.service.js +117 -0
- package/dist/modules/repl/services/welcome-screen.service.js.map +1 -0
- package/dist/modules/repl/utils/prompts-with-esc.js +187 -0
- package/dist/modules/repl/utils/prompts-with-esc.js.map +1 -0
- package/dist/modules/repl/utils/theme.js +185 -0
- package/dist/modules/repl/utils/theme.js.map +1 -0
- package/dist/modules/skills/definitions/general/file-operations.md +60 -0
- package/dist/modules/skills/definitions/general/git-operations.md +59 -0
- package/dist/modules/skills/definitions/general/planning.md +86 -0
- package/dist/modules/skills/definitions/general/search.md +59 -0
- package/dist/modules/skills/definitions/specialized/api-design.md +85 -0
- package/dist/modules/skills/definitions/specialized/database-operations.md +78 -0
- package/dist/modules/skills/definitions/specialized/frontend-bootstrap.md +71 -0
- package/dist/modules/skills/definitions/specialized/react-patterns.md +77 -0
- package/dist/modules/skills/definitions/specialized/testing-strategies.md +79 -0
- package/dist/modules/skills/index.js +23 -0
- package/dist/modules/skills/index.js.map +1 -0
- package/dist/modules/skills/services/skill-loader.service.js +130 -0
- package/dist/modules/skills/services/skill-loader.service.js.map +1 -0
- package/dist/modules/skills/services/skill-registry.service.js +96 -0
- package/dist/modules/skills/services/skill-registry.service.js.map +1 -0
- package/dist/modules/skills/skills.module.js +38 -0
- package/dist/modules/skills/skills.module.js.map +1 -0
- package/dist/modules/skills/types/index.js +20 -0
- package/dist/modules/skills/types/index.js.map +1 -0
- package/dist/modules/skills/types/skill.types.js +6 -0
- package/dist/modules/skills/types/skill.types.js.map +1 -0
- package/dist/modules/tasks/index.js +24 -0
- package/dist/modules/tasks/index.js.map +1 -0
- package/dist/modules/tasks/services/plan-executor.service.js +199 -0
- package/dist/modules/tasks/services/plan-executor.service.js.map +1 -0
- package/dist/modules/tasks/services/plan-mode.service.js +118 -0
- package/dist/modules/tasks/services/plan-mode.service.js.map +1 -0
- package/dist/modules/tasks/services/plan-persistence.service.js +148 -0
- package/dist/modules/tasks/services/plan-persistence.service.js.map +1 -0
- package/dist/modules/tasks/services/task-management.service.js +255 -0
- package/dist/modules/tasks/services/task-management.service.js.map +1 -0
- package/dist/modules/tasks/services/task-tools.service.js +270 -0
- package/dist/modules/tasks/services/task-tools.service.js.map +1 -0
- package/dist/modules/tasks/tasks.module.js +49 -0
- package/dist/modules/tasks/tasks.module.js.map +1 -0
- package/dist/modules/tasks/types/task.types.js +21 -0
- package/dist/modules/tasks/types/task.types.js.map +1 -0
- package/dist/modules/tools/index.js +24 -0
- package/dist/modules/tools/index.js.map +1 -0
- package/dist/modules/tools/services/filesystem-tools.service.js +450 -0
- package/dist/modules/tools/services/filesystem-tools.service.js.map +1 -0
- package/dist/modules/tools/services/search-tools.service.js +63 -0
- package/dist/modules/tools/services/search-tools.service.js.map +1 -0
- package/dist/modules/tools/services/shell-tools.service.js +194 -0
- package/dist/modules/tools/services/shell-tools.service.js.map +1 -0
- package/dist/modules/tools/services/tools-registry.service.js +83 -0
- package/dist/modules/tools/services/tools-registry.service.js.map +1 -0
- package/dist/modules/tools/tools.module.js +46 -0
- package/dist/modules/tools/tools.module.js.map +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "GitCommandsService", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return GitCommandsService;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _common = require("@nestjs/common");
|
|
12
|
+
const _theme = require("../../utils/theme");
|
|
13
|
+
const _commitgeneratorservice = require("../../../git/services/commit-generator.service");
|
|
14
|
+
const _monorepodetectorservice = require("../../../git/services/monorepo-detector.service");
|
|
15
|
+
const _prgeneratorservice = require("../../../git/services/pr-generator.service");
|
|
16
|
+
const _codereviewservice = require("../../../git/services/code-review.service");
|
|
17
|
+
const _releasenotesservice = require("../../../git/services/release-notes.service");
|
|
18
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
}
|
|
24
|
+
function _ts_metadata(k, v) {
|
|
25
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
26
|
+
}
|
|
27
|
+
let GitCommandsService = class GitCommandsService {
|
|
28
|
+
runGit(cmd) {
|
|
29
|
+
const { execSync } = require('child_process');
|
|
30
|
+
try {
|
|
31
|
+
const output = execSync(cmd, {
|
|
32
|
+
encoding: 'utf-8',
|
|
33
|
+
cwd: process.cwd()
|
|
34
|
+
}).trim();
|
|
35
|
+
process.stdout.write(output ? `\r\n${output}\r\n\r\n` : ` ${(0, _theme.colorize)('(no output)', 'muted')}\r\n`);
|
|
36
|
+
} catch (e) {
|
|
37
|
+
process.stdout.write(`${_theme.Colors.red} ${e.message}${_theme.Colors.reset}\r\n`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async cmdCommit(args, smartInput) {
|
|
41
|
+
const msg = args.join(' ');
|
|
42
|
+
if (!msg) {
|
|
43
|
+
await this.generateAndCommit(smartInput);
|
|
44
|
+
} else {
|
|
45
|
+
const { execSync } = require('child_process');
|
|
46
|
+
try {
|
|
47
|
+
execSync('git add -A', {
|
|
48
|
+
cwd: process.cwd()
|
|
49
|
+
});
|
|
50
|
+
execSync('git commit -F -', {
|
|
51
|
+
cwd: process.cwd(),
|
|
52
|
+
input: `${msg}\n`,
|
|
53
|
+
encoding: 'utf-8'
|
|
54
|
+
});
|
|
55
|
+
} catch {}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async generateAndCommit(smartInput) {
|
|
59
|
+
const w = (s)=>process.stdout.write(s);
|
|
60
|
+
if (!this.commitGenerator.hasChanges()) {
|
|
61
|
+
w(`${_theme.Colors.yellow} No changes to commit${_theme.Colors.reset}\r\n\r\n`);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
w(`\r\n${_theme.Colors.cyan}π€ Analyzing changes...${_theme.Colors.reset}\r\n`);
|
|
65
|
+
const message = await this.commitGenerator.generateCommitMessage();
|
|
66
|
+
if (!message) {
|
|
67
|
+
w(`${_theme.Colors.red} Failed to generate commit message${_theme.Colors.reset}\r\n\r\n`);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
w(`\r\n${_theme.Colors.green}β Generated:${_theme.Colors.reset} ${(0, _theme.colorize)(message, 'cyan')}\r\n\r\n`);
|
|
71
|
+
const confirm = await smartInput.askChoice('Commit?', [
|
|
72
|
+
{
|
|
73
|
+
key: 'y',
|
|
74
|
+
label: 'yes',
|
|
75
|
+
description: 'Commit with this message'
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
key: 'n',
|
|
79
|
+
label: 'no',
|
|
80
|
+
description: 'Cancel'
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
key: 'e',
|
|
84
|
+
label: 'edit',
|
|
85
|
+
description: 'Edit message'
|
|
86
|
+
}
|
|
87
|
+
]);
|
|
88
|
+
if (confirm === 'n') {
|
|
89
|
+
w((0, _theme.colorize)(' Cancelled\r\n\r\n', 'muted'));
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
let finalMessage = message;
|
|
93
|
+
if (confirm === 'e') {
|
|
94
|
+
const newMsg = await smartInput.question((0, _theme.colorize)(' Message: ', 'cyan'));
|
|
95
|
+
if (!newMsg.trim()) {
|
|
96
|
+
w((0, _theme.colorize)(' Cancelled\r\n\r\n', 'muted'));
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
finalMessage = newMsg.trim();
|
|
100
|
+
}
|
|
101
|
+
const success = this.commitGenerator.executeCommit(finalMessage);
|
|
102
|
+
if (success) {
|
|
103
|
+
w(`${_theme.Colors.green}β Committed${_theme.Colors.reset}\r\n\r\n`);
|
|
104
|
+
} else {
|
|
105
|
+
w(`${_theme.Colors.red}β Commit failed${_theme.Colors.reset}\r\n\r\n`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async cmdUp(smartInput) {
|
|
109
|
+
const w = (s)=>process.stdout.write(s);
|
|
110
|
+
if (!this.commitGenerator.hasChanges()) {
|
|
111
|
+
w(`${_theme.Colors.yellow} No changes to commit${_theme.Colors.reset}\r\n\r\n`);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const monorepoInfo = this.monorepoDetector.detectMonorepo(process.cwd());
|
|
115
|
+
if (monorepoInfo.isMonorepo) {
|
|
116
|
+
w(`\r\n${(0, _theme.colorize)('Monorepo:', 'muted')} ${monorepoInfo.modules.join(', ')}\r\n`);
|
|
117
|
+
}
|
|
118
|
+
w(`\r\n${_theme.Colors.cyan}π€ Analyzing changes...${_theme.Colors.reset}\r\n`);
|
|
119
|
+
const message = await this.commitGenerator.generateCommitMessage();
|
|
120
|
+
if (!message) {
|
|
121
|
+
w(`${_theme.Colors.red} Failed to generate commit message${_theme.Colors.reset}\r\n\r\n`);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
w(`\r\n${_theme.Colors.green}β Generated:${_theme.Colors.reset}\r\n ${(0, _theme.colorize)(message, 'cyan')}\r\n\r\n`);
|
|
125
|
+
const confirm = await smartInput.askChoice('Confirm and push?', [
|
|
126
|
+
{
|
|
127
|
+
key: 'y',
|
|
128
|
+
label: 'yes',
|
|
129
|
+
description: 'Commit and push'
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
key: 'n',
|
|
133
|
+
label: 'no',
|
|
134
|
+
description: 'Cancel'
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
key: 'e',
|
|
138
|
+
label: 'edit',
|
|
139
|
+
description: 'Edit message'
|
|
140
|
+
}
|
|
141
|
+
]);
|
|
142
|
+
if (confirm === 'n') {
|
|
143
|
+
w((0, _theme.colorize)(' Cancelled\r\n\r\n', 'muted'));
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
let finalMessage = message;
|
|
147
|
+
if (confirm === 'e') {
|
|
148
|
+
const instructions = await smartInput.question((0, _theme.colorize)(' Instructions for AI: ', 'cyan'));
|
|
149
|
+
if (!instructions.trim()) {
|
|
150
|
+
w((0, _theme.colorize)(' Cancelled\r\n\r\n', 'muted'));
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
w(`\r\n${_theme.Colors.cyan}π€ Regenerating...${_theme.Colors.reset}\r\n`);
|
|
154
|
+
const diffInfo = this.commitGenerator.getDiffInfo();
|
|
155
|
+
if (diffInfo) {
|
|
156
|
+
const refined = await this.commitGenerator.refineCommitMessage(message, instructions.trim(), diffInfo);
|
|
157
|
+
w(`\r\n${_theme.Colors.green}β Refined:${_theme.Colors.reset}\r\n ${(0, _theme.colorize)(refined, 'cyan')}\r\n\r\n`);
|
|
158
|
+
const confirmRefined = await smartInput.askChoice('Use this?', [
|
|
159
|
+
{
|
|
160
|
+
key: 'y',
|
|
161
|
+
label: 'yes',
|
|
162
|
+
description: 'Commit and push'
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
key: 'n',
|
|
166
|
+
label: 'no',
|
|
167
|
+
description: 'Cancel'
|
|
168
|
+
}
|
|
169
|
+
]);
|
|
170
|
+
if (confirmRefined === 'n') {
|
|
171
|
+
w((0, _theme.colorize)(' Cancelled\r\n\r\n', 'muted'));
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
finalMessage = refined;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
w((0, _theme.colorize)(' Committing...\r\n', 'muted'));
|
|
178
|
+
const commitSuccess = this.commitGenerator.executeCommit(finalMessage, true);
|
|
179
|
+
if (!commitSuccess) {
|
|
180
|
+
w(`${_theme.Colors.red} β Commit failed${_theme.Colors.reset}\r\n\r\n`);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
w(`${_theme.Colors.green} β Committed${_theme.Colors.reset}\r\n`);
|
|
184
|
+
w((0, _theme.colorize)(' Pushing...\r\n', 'muted'));
|
|
185
|
+
const pushResult = this.commitGenerator.executePush();
|
|
186
|
+
if (pushResult.success) {
|
|
187
|
+
w(`${_theme.Colors.green} β Pushed${_theme.Colors.reset}\r\n\r\n`);
|
|
188
|
+
} else {
|
|
189
|
+
w(`${_theme.Colors.red} β Push failed:${_theme.Colors.reset} ${pushResult.error}\r\n\r\n`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
async cmdSplitUp(smartInput) {
|
|
193
|
+
const w = (s)=>process.stdout.write(s);
|
|
194
|
+
if (!this.commitGenerator.hasChanges()) {
|
|
195
|
+
w(`${_theme.Colors.yellow} No changes to commit${_theme.Colors.reset}\r\n\r\n`);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
w(`\r\n${_theme.Colors.cyan}π€ Analyzing for split...${_theme.Colors.reset}\r\n`);
|
|
199
|
+
const proposedCommits = await this.commitGenerator.splitCommits();
|
|
200
|
+
const commits = (proposedCommits || []).filter((c)=>c.files && c.files.length > 0);
|
|
201
|
+
if (commits.length === 0) {
|
|
202
|
+
w(`${_theme.Colors.red} Failed to split commits${_theme.Colors.reset}\r\n\r\n`);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
w(`\r\n${_theme.Colors.green}β Proposed ${commits.length} commits:${_theme.Colors.reset}\r\n\r\n`);
|
|
206
|
+
for(let i = 0; i < commits.length; i++){
|
|
207
|
+
const commit = commits[i];
|
|
208
|
+
w(` ${(0, _theme.colorize)((i + 1).toString() + '.', 'cyan')} ${commit.message}\r\n`);
|
|
209
|
+
w(` ${(0, _theme.colorize)('Files: ' + commit.files.join(', '), 'muted')}\r\n`);
|
|
210
|
+
}
|
|
211
|
+
w('\r\n');
|
|
212
|
+
const confirm = await smartInput.askChoice('Execute these commits?', [
|
|
213
|
+
{
|
|
214
|
+
key: 'y',
|
|
215
|
+
label: 'yes',
|
|
216
|
+
description: `Commit all ${commits.length}`
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
key: 'n',
|
|
220
|
+
label: 'no',
|
|
221
|
+
description: 'Cancel'
|
|
222
|
+
}
|
|
223
|
+
]);
|
|
224
|
+
if (confirm !== 'y') {
|
|
225
|
+
w((0, _theme.colorize)(' Cancelled\r\n\r\n', 'muted'));
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
w((0, _theme.colorize)(' Executing...\r\n', 'muted'));
|
|
229
|
+
const result = this.commitGenerator.executeSplitCommits(commits);
|
|
230
|
+
if (result.success) {
|
|
231
|
+
w(`${_theme.Colors.green} β ${result.committed} commits executed${_theme.Colors.reset}\r\n\r\n`);
|
|
232
|
+
const { execSync } = require('child_process');
|
|
233
|
+
try {
|
|
234
|
+
const log = execSync(`git log --oneline -${result.committed}`, {
|
|
235
|
+
cwd: process.cwd(),
|
|
236
|
+
encoding: 'utf-8'
|
|
237
|
+
});
|
|
238
|
+
w((0, _theme.colorize)(' Commits criados:\r\n', 'bold'));
|
|
239
|
+
log.split('\n').filter((l)=>l.trim()).forEach((line)=>{
|
|
240
|
+
w(` ${(0, _theme.colorize)(line, 'muted')}\r\n`);
|
|
241
|
+
});
|
|
242
|
+
w('\r\n');
|
|
243
|
+
} catch {}
|
|
244
|
+
w((0, _theme.colorize)(' Pushing...\r\n', 'muted'));
|
|
245
|
+
const pushResult = this.commitGenerator.executePush();
|
|
246
|
+
if (pushResult.success) {
|
|
247
|
+
w(`${_theme.Colors.green} β Pushed${_theme.Colors.reset}\r\n\r\n`);
|
|
248
|
+
} else {
|
|
249
|
+
w(`${_theme.Colors.red} β Push failed:${_theme.Colors.reset} ${pushResult.error}\r\n\r\n`);
|
|
250
|
+
}
|
|
251
|
+
} else {
|
|
252
|
+
w(`${_theme.Colors.red} β Failed after ${result.committed} commit(s):${_theme.Colors.reset} ${result.error}\r\n`);
|
|
253
|
+
if (result.originalHead && result.committed > 0) {
|
|
254
|
+
w(`${(0, _theme.colorize)(' Rollback disponΓvel:', 'warning')}\r\n`);
|
|
255
|
+
w(` ${(0, _theme.colorize)(`git reset --soft ${result.originalHead}`, 'cyan')}\r\n\r\n`);
|
|
256
|
+
} else {
|
|
257
|
+
w('\r\n');
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
async cmdPr(smartInput) {
|
|
262
|
+
const w = (s)=>process.stdout.write(s);
|
|
263
|
+
const branch = this.prGenerator.getCurrentBranch();
|
|
264
|
+
if (branch === 'main' || branch === 'master' || branch === 'develop') {
|
|
265
|
+
w(`${_theme.Colors.yellow} Cannot create PR from ${branch} branch${_theme.Colors.reset}\r\n\r\n`);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
const detectedBase = this.prGenerator.detectDefaultBaseBranch();
|
|
269
|
+
const baseInput = await smartInput.question((0, _theme.colorize)(` Base branch (default: ${detectedBase}): `, 'cyan'));
|
|
270
|
+
const baseBranch = baseInput.trim() || detectedBase;
|
|
271
|
+
w(`\r\n${_theme.Colors.cyan}π Analyzing commits...${_theme.Colors.reset}\r\n`);
|
|
272
|
+
const commits = this.prGenerator.getCommitsNotInBase(baseBranch);
|
|
273
|
+
if (commits.length === 0) {
|
|
274
|
+
w(`${_theme.Colors.yellow} No commits found between ${branch} and ${baseBranch}${_theme.Colors.reset}\r\n\r\n`);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
w(`\r\n${_theme.Colors.green}β Found ${commits.length} commit(s):${_theme.Colors.reset}\r\n`);
|
|
278
|
+
for (const commit of commits){
|
|
279
|
+
w(` ${(0, _theme.colorize)(commit.hash.slice(0, 7), 'muted')} ${commit.message.slice(0, 50)}${commit.message.length > 50 ? '...' : ''}\r\n`);
|
|
280
|
+
}
|
|
281
|
+
w(`\r\n${_theme.Colors.cyan}π€ Generating PR description...${_theme.Colors.reset}\r\n`);
|
|
282
|
+
const prDescription = await this.prGenerator.generatePRDescription(branch, commits, baseBranch);
|
|
283
|
+
w(`\r\n${(0, _theme.colorize)('β'.repeat(50), 'subtle')}\r\n`);
|
|
284
|
+
w((0, _theme.colorize)('Pull Request Preview:', 'bold') + '\r\n');
|
|
285
|
+
w((0, _theme.colorize)('β'.repeat(50), 'subtle') + '\r\n\r\n');
|
|
286
|
+
w(`${(0, _theme.colorize)('Title:', 'bold')}\r\n ${(0, _theme.colorize)(prDescription.title, 'cyan')}\r\n\r\n`);
|
|
287
|
+
const descLines = prDescription.description.split('\n');
|
|
288
|
+
for (const line of descLines.slice(0, 25)){
|
|
289
|
+
w(` ${line}\r\n`);
|
|
290
|
+
}
|
|
291
|
+
if (descLines.length > 25) {
|
|
292
|
+
w(` ${(0, _theme.colorize)(`... (${descLines.length - 25} more lines)`, 'muted')}\r\n`);
|
|
293
|
+
}
|
|
294
|
+
w(`\r\n${(0, _theme.colorize)('β'.repeat(50), 'subtle')}\r\n\r\n`);
|
|
295
|
+
const confirm = await smartInput.askChoice('Create this PR?', [
|
|
296
|
+
{
|
|
297
|
+
key: 'y',
|
|
298
|
+
label: 'yes',
|
|
299
|
+
description: 'Create PR on GitHub'
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
key: 'n',
|
|
303
|
+
label: 'no',
|
|
304
|
+
description: 'Cancel'
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
key: 'e',
|
|
308
|
+
label: 'edit',
|
|
309
|
+
description: 'Edit title/description'
|
|
310
|
+
}
|
|
311
|
+
]);
|
|
312
|
+
if (confirm === 'n') {
|
|
313
|
+
w((0, _theme.colorize)(' Cancelled\r\n\r\n', 'muted'));
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
let finalTitle = prDescription.title;
|
|
317
|
+
let finalDescription = prDescription.description;
|
|
318
|
+
if (confirm === 'e') {
|
|
319
|
+
const newTitle = await smartInput.question((0, _theme.colorize)(' Title (empty to keep): ', 'cyan'));
|
|
320
|
+
if (newTitle.trim()) {
|
|
321
|
+
finalTitle = newTitle.trim();
|
|
322
|
+
}
|
|
323
|
+
const editDesc = await smartInput.askChoice('Edit description?', [
|
|
324
|
+
{
|
|
325
|
+
key: 'y',
|
|
326
|
+
label: 'yes',
|
|
327
|
+
description: 'Open in editor'
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
key: 'n',
|
|
331
|
+
label: 'no',
|
|
332
|
+
description: 'Keep as is'
|
|
333
|
+
}
|
|
334
|
+
]);
|
|
335
|
+
if (editDesc === 'y') {
|
|
336
|
+
const fs = require('fs');
|
|
337
|
+
const { execSync } = require('child_process');
|
|
338
|
+
const tempFile = `/tmp/pr-desc-${Date.now()}.md`;
|
|
339
|
+
fs.writeFileSync(tempFile, finalDescription);
|
|
340
|
+
const editor = process.env.EDITOR || 'nano';
|
|
341
|
+
try {
|
|
342
|
+
execSync(`${editor} "${tempFile}"`, {
|
|
343
|
+
stdio: 'inherit'
|
|
344
|
+
});
|
|
345
|
+
finalDescription = fs.readFileSync(tempFile, 'utf-8');
|
|
346
|
+
} catch {
|
|
347
|
+
w((0, _theme.colorize)(' Could not open editor\r\n', 'yellow'));
|
|
348
|
+
} finally{
|
|
349
|
+
try {
|
|
350
|
+
fs.unlinkSync(tempFile);
|
|
351
|
+
} catch {}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
const { platform } = this.prGenerator.detectPlatform();
|
|
356
|
+
if (platform === 'github') {
|
|
357
|
+
try {
|
|
358
|
+
const { execSync } = require('child_process');
|
|
359
|
+
execSync(`git push origin ${branch}`, {
|
|
360
|
+
cwd: process.cwd()
|
|
361
|
+
});
|
|
362
|
+
} catch {}
|
|
363
|
+
}
|
|
364
|
+
const result = await this.prGenerator.createPR(finalTitle, finalDescription, baseBranch);
|
|
365
|
+
if (result.success && result.url) {
|
|
366
|
+
w(`\r\n${_theme.Colors.green}β Pull Request created!${_theme.Colors.reset}\r\n`);
|
|
367
|
+
w(` ${(0, _theme.colorize)(result.url, 'cyan')}\r\n\r\n`);
|
|
368
|
+
} else {
|
|
369
|
+
if (result.description) {
|
|
370
|
+
const copied = this.prGenerator.copyToClipboard(result.description);
|
|
371
|
+
w(`\r\n${(0, _theme.colorize)('PR Description:', 'bold')}\r\n`);
|
|
372
|
+
w((0, _theme.colorize)('β'.repeat(50), 'subtle') + '\r\n');
|
|
373
|
+
w(result.description.split('\n').slice(0, 30).join('\r\n') + '\r\n');
|
|
374
|
+
w((0, _theme.colorize)('β'.repeat(50), 'subtle') + '\r\n\r\n');
|
|
375
|
+
if (copied) {
|
|
376
|
+
w(`${(0, _theme.colorize)('β', 'success')} Copied to clipboard\r\n`);
|
|
377
|
+
}
|
|
378
|
+
const createUrl = this.prGenerator.getPRCreateUrl(platform, baseBranch);
|
|
379
|
+
if (createUrl) {
|
|
380
|
+
w(`\r\n ${(0, _theme.colorize)('Open to create PR:', 'muted')}\r\n`);
|
|
381
|
+
w(` ${(0, _theme.colorize)(createUrl, 'cyan')}\r\n`);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
w('\r\n');
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
async cmdReview(args) {
|
|
388
|
+
const w = (s)=>process.stdout.write(s);
|
|
389
|
+
let files = [];
|
|
390
|
+
if (args.length > 0) {
|
|
391
|
+
files = args.filter((a)=>!a.startsWith('/'));
|
|
392
|
+
} else {
|
|
393
|
+
w(`\r\n${_theme.Colors.cyan}π Analyzing staged files...${_theme.Colors.reset}\r\n`);
|
|
394
|
+
files = this.codeReviewService['getChangedFiles'](true);
|
|
395
|
+
}
|
|
396
|
+
if (files.length === 0) {
|
|
397
|
+
w(`${_theme.Colors.yellow} No files to review${_theme.Colors.reset}\r\n\r\n`);
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
w(`\r\n${_theme.Colors.cyan}π€ Reviewing ${files.length} file(s)...${_theme.Colors.reset}\r\n`);
|
|
401
|
+
const results = await this.codeReviewService.reviewFiles(files);
|
|
402
|
+
let totalIssues = 0;
|
|
403
|
+
let totalScore = 0;
|
|
404
|
+
for (const result of results){
|
|
405
|
+
totalScore += result.score;
|
|
406
|
+
const errors = result.issues.filter((i)=>i.severity === 'error').length;
|
|
407
|
+
const warnings = result.issues.filter((i)=>i.severity === 'warning').length;
|
|
408
|
+
const suggestions = result.issues.filter((i)=>i.severity === 'suggestion').length;
|
|
409
|
+
totalIssues += result.issues.length;
|
|
410
|
+
const scoreColor = result.score >= 80 ? 'success' : result.score >= 60 ? 'warning' : 'error';
|
|
411
|
+
w(`\r\n${(0, _theme.colorize)(result.file, 'bold')} ${(0, _theme.colorize)(result.score + '/100', scoreColor)}\r\n`);
|
|
412
|
+
w(` ${(0, _theme.colorize)(result.summary, 'muted')}\r\n`);
|
|
413
|
+
if (errors > 0) w(` ${(0, _theme.colorize)('β ' + errors + ' errors', 'error')} `);
|
|
414
|
+
if (warnings > 0) w(`${(0, _theme.colorize)('β ' + warnings + ' warnings', 'warning')} `);
|
|
415
|
+
if (suggestions > 0) w(`${(0, _theme.colorize)('π‘ ' + suggestions + ' suggestions', 'muted')}`);
|
|
416
|
+
if (errors > 0 || warnings > 0 || suggestions > 0) w('\r\n');
|
|
417
|
+
const topIssues = result.issues.filter((i)=>i.severity !== 'praise').slice(0, 3);
|
|
418
|
+
for (const issue of topIssues){
|
|
419
|
+
const icon = issue.severity === 'error' ? 'β' : issue.severity === 'warning' ? 'β ' : 'π‘';
|
|
420
|
+
const color = issue.severity === 'error' ? 'error' : issue.severity === 'warning' ? 'warning' : 'muted';
|
|
421
|
+
const line = issue.line ? (0, _theme.colorize)(':' + issue.line, 'muted') : '';
|
|
422
|
+
w(` ${(0, _theme.colorize)(icon, color)} ${issue.message}${line}\r\n`);
|
|
423
|
+
}
|
|
424
|
+
if (result.issues.length > 3) {
|
|
425
|
+
w(` ${(0, _theme.colorize)('... and ' + (result.issues.length - 3) + ' more', 'muted')}\r\n`);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
const avgScore = Math.round(totalScore / results.length);
|
|
429
|
+
const avgColor = avgScore >= 80 ? 'success' : avgScore >= 60 ? 'warning' : 'error';
|
|
430
|
+
w(`\r\n${(0, _theme.colorize)('Summary:', 'bold')} ${(0, _theme.colorize)(avgScore + '/100', avgColor)} | ${totalIssues} issue(s)\r\n\r\n`);
|
|
431
|
+
}
|
|
432
|
+
async cmdFix(args) {
|
|
433
|
+
const w = (s)=>process.stdout.write(s);
|
|
434
|
+
if (args.length === 0) {
|
|
435
|
+
w(`${_theme.Colors.yellow} Usage: /fix <file>${_theme.Colors.reset}\r\n\r\n`);
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
const filePath = args[0];
|
|
439
|
+
w(`\r\n${_theme.Colors.cyan}π§ Fixing ${filePath}...${_theme.Colors.reset}\r\n`);
|
|
440
|
+
const result = await this.codeReviewService.fixFile(filePath);
|
|
441
|
+
if (result.success) {
|
|
442
|
+
w(`${_theme.Colors.green} β File fixed${_theme.Colors.reset}\r\n\r\n`);
|
|
443
|
+
} else {
|
|
444
|
+
w(`${_theme.Colors.red} β Failed: ${result.error}${_theme.Colors.reset}\r\n\r\n`);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
async cmdIdent() {
|
|
448
|
+
const w = (s)=>process.stdout.write(s);
|
|
449
|
+
w(`\r\n${_theme.Colors.cyan}π¨ Formatting code files...${_theme.Colors.reset}\r\n`);
|
|
450
|
+
const result = await this.codeReviewService.indentAll();
|
|
451
|
+
w(`${_theme.Colors.green} β ${result.success} file(s) formatted${_theme.Colors.reset}\r\n`);
|
|
452
|
+
if (result.failed > 0) {
|
|
453
|
+
w(`${_theme.Colors.yellow} β ${result.failed} file(s) failed${_theme.Colors.reset}\r\n`);
|
|
454
|
+
}
|
|
455
|
+
w('\r\n');
|
|
456
|
+
}
|
|
457
|
+
async cmdRelease(args) {
|
|
458
|
+
const w = (s)=>process.stdout.write(s);
|
|
459
|
+
const sinceTag = args[0];
|
|
460
|
+
w(`\r\n${_theme.Colors.cyan}π Generating release notes...${_theme.Colors.reset}\r\n`);
|
|
461
|
+
const result = await this.releaseNotesService.generateReleaseNotes(sinceTag);
|
|
462
|
+
if (result.success && result.filePath) {
|
|
463
|
+
w(`${_theme.Colors.green} β Release notes generated!${_theme.Colors.reset}\r\n`);
|
|
464
|
+
w(` ${(0, _theme.colorize)(result.filePath, 'accent')}\r\n\r\n`);
|
|
465
|
+
if (result.content) {
|
|
466
|
+
w(`${(0, _theme.colorize)('Preview:', 'bold')}\r\n`);
|
|
467
|
+
const lines = result.content.split('\n').slice(0, 15);
|
|
468
|
+
for (const line of lines){
|
|
469
|
+
w(` ${line}\r\n`);
|
|
470
|
+
}
|
|
471
|
+
if (result.content.split('\n').length > 15) {
|
|
472
|
+
w(` ${(0, _theme.colorize)('...', 'muted')}\r\n`);
|
|
473
|
+
}
|
|
474
|
+
w('\r\n');
|
|
475
|
+
}
|
|
476
|
+
} else {
|
|
477
|
+
w(`${_theme.Colors.red} β Failed: ${result.error}${_theme.Colors.reset}\r\n\r\n`);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
constructor(commitGenerator, monorepoDetector, prGenerator, codeReviewService, releaseNotesService){
|
|
481
|
+
this.commitGenerator = commitGenerator;
|
|
482
|
+
this.monorepoDetector = monorepoDetector;
|
|
483
|
+
this.prGenerator = prGenerator;
|
|
484
|
+
this.codeReviewService = codeReviewService;
|
|
485
|
+
this.releaseNotesService = releaseNotesService;
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
GitCommandsService = _ts_decorate([
|
|
489
|
+
(0, _common.Injectable)(),
|
|
490
|
+
_ts_metadata("design:type", Function),
|
|
491
|
+
_ts_metadata("design:paramtypes", [
|
|
492
|
+
typeof _commitgeneratorservice.CommitGeneratorService === "undefined" ? Object : _commitgeneratorservice.CommitGeneratorService,
|
|
493
|
+
typeof _monorepodetectorservice.MonorepoDetectorService === "undefined" ? Object : _monorepodetectorservice.MonorepoDetectorService,
|
|
494
|
+
typeof _prgeneratorservice.PrGeneratorService === "undefined" ? Object : _prgeneratorservice.PrGeneratorService,
|
|
495
|
+
typeof _codereviewservice.CodeReviewService === "undefined" ? Object : _codereviewservice.CodeReviewService,
|
|
496
|
+
typeof _releasenotesservice.ReleaseNotesService === "undefined" ? Object : _releasenotesservice.ReleaseNotesService
|
|
497
|
+
])
|
|
498
|
+
], GitCommandsService);
|
|
499
|
+
|
|
500
|
+
//# sourceMappingURL=git-commands.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/modules/repl/services/commands/git-commands.service.ts"],"sourcesContent":["import { Injectable } from '@nestjs/common';\nimport { Colors, colorize, Box, Icons } from '../../utils/theme';\nimport { CommitGeneratorService } from '../../../git/services/commit-generator.service';\nimport { MonorepoDetectorService } from '../../../git/services/monorepo-detector.service';\nimport { PrGeneratorService } from '../../../git/services/pr-generator.service';\nimport { CodeReviewService } from '../../../git/services/code-review.service';\nimport { ReleaseNotesService } from '../../../git/services/release-notes.service';\n\ninterface SmartInput {\n askChoice: (question: string, choices: { key: string; label: string; description: string }[]) => Promise<string>;\n question: (prompt: string) => Promise<string>;\n}\n\n@Injectable()\nexport class GitCommandsService {\n constructor(\n private readonly commitGenerator: CommitGeneratorService,\n private readonly monorepoDetector: MonorepoDetectorService,\n private readonly prGenerator: PrGeneratorService,\n private readonly codeReviewService: CodeReviewService,\n private readonly releaseNotesService: ReleaseNotesService,\n ) {}\n\n runGit(cmd: string): void {\n const { execSync } = require('child_process');\n try {\n const output = execSync(cmd, { encoding: 'utf-8', cwd: process.cwd() }).trim();\n process.stdout.write(output ? `\\r\\n${output}\\r\\n\\r\\n` : ` ${colorize('(no output)', 'muted')}\\r\\n`);\n } catch (e) {\n process.stdout.write(`${Colors.red} ${(e as Error).message}${Colors.reset}\\r\\n`);\n }\n }\n\n async cmdCommit(args: string[], smartInput: SmartInput): Promise<void> {\n const msg = args.join(' ');\n if (!msg) {\n await this.generateAndCommit(smartInput);\n } else {\n const { execSync } = require('child_process');\n try {\n execSync('git add -A', { cwd: process.cwd() });\n execSync('git commit -F -', { cwd: process.cwd(), input: `${msg}\\n`, encoding: 'utf-8' });\n } catch {}\n }\n }\n\n private async generateAndCommit(smartInput: SmartInput): Promise<void> {\n const w = (s: string) => process.stdout.write(s);\n\n if (!this.commitGenerator.hasChanges()) {\n w(`${Colors.yellow} No changes to commit${Colors.reset}\\r\\n\\r\\n`);\n return;\n }\n\n w(`\\r\\n${Colors.cyan}π€ Analyzing changes...${Colors.reset}\\r\\n`);\n\n const message = await this.commitGenerator.generateCommitMessage();\n if (!message) {\n w(`${Colors.red} Failed to generate commit message${Colors.reset}\\r\\n\\r\\n`);\n return;\n }\n\n w(`\\r\\n${Colors.green}β Generated:${Colors.reset} ${colorize(message, 'cyan')}\\r\\n\\r\\n`);\n\n const confirm = await smartInput.askChoice('Commit?', [\n { key: 'y', label: 'yes', description: 'Commit with this message' },\n { key: 'n', label: 'no', description: 'Cancel' },\n { key: 'e', label: 'edit', description: 'Edit message' },\n ]);\n\n if (confirm === 'n') {\n w(colorize(' Cancelled\\r\\n\\r\\n', 'muted'));\n return;\n }\n\n let finalMessage = message;\n\n if (confirm === 'e') {\n const newMsg = await smartInput.question(colorize(' Message: ', 'cyan'));\n if (!newMsg.trim()) {\n w(colorize(' Cancelled\\r\\n\\r\\n', 'muted'));\n return;\n }\n finalMessage = newMsg.trim();\n }\n\n const success = this.commitGenerator.executeCommit(finalMessage);\n if (success) {\n w(`${Colors.green}β Committed${Colors.reset}\\r\\n\\r\\n`);\n } else {\n w(`${Colors.red}β Commit failed${Colors.reset}\\r\\n\\r\\n`);\n }\n }\n\n async cmdUp(smartInput: SmartInput): Promise<void> {\n const w = (s: string) => process.stdout.write(s);\n\n if (!this.commitGenerator.hasChanges()) {\n w(`${Colors.yellow} No changes to commit${Colors.reset}\\r\\n\\r\\n`);\n return;\n }\n\n const monorepoInfo = this.monorepoDetector.detectMonorepo(process.cwd());\n if (monorepoInfo.isMonorepo) {\n w(`\\r\\n${colorize('Monorepo:', 'muted')} ${monorepoInfo.modules.join(', ')}\\r\\n`);\n }\n\n w(`\\r\\n${Colors.cyan}π€ Analyzing changes...${Colors.reset}\\r\\n`);\n\n const message = await this.commitGenerator.generateCommitMessage();\n if (!message) {\n w(`${Colors.red} Failed to generate commit message${Colors.reset}\\r\\n\\r\\n`);\n return;\n }\n\n w(`\\r\\n${Colors.green}β Generated:${Colors.reset}\\r\\n ${colorize(message, 'cyan')}\\r\\n\\r\\n`);\n\n const confirm = await smartInput.askChoice('Confirm and push?', [\n { key: 'y', label: 'yes', description: 'Commit and push' },\n { key: 'n', label: 'no', description: 'Cancel' },\n { key: 'e', label: 'edit', description: 'Edit message' },\n ]);\n\n if (confirm === 'n') {\n w(colorize(' Cancelled\\r\\n\\r\\n', 'muted'));\n return;\n }\n\n let finalMessage = message;\n\n if (confirm === 'e') {\n const instructions = await smartInput.question(colorize(' Instructions for AI: ', 'cyan'));\n if (!instructions.trim()) {\n w(colorize(' Cancelled\\r\\n\\r\\n', 'muted'));\n return;\n }\n\n w(`\\r\\n${Colors.cyan}π€ Regenerating...${Colors.reset}\\r\\n`);\n const diffInfo = this.commitGenerator.getDiffInfo();\n if (diffInfo) {\n const refined = await this.commitGenerator.refineCommitMessage(message, instructions.trim(), diffInfo);\n w(`\\r\\n${Colors.green}β Refined:${Colors.reset}\\r\\n ${colorize(refined, 'cyan')}\\r\\n\\r\\n`);\n\n const confirmRefined = await smartInput.askChoice('Use this?', [\n { key: 'y', label: 'yes', description: 'Commit and push' },\n { key: 'n', label: 'no', description: 'Cancel' },\n ]);\n\n if (confirmRefined === 'n') {\n w(colorize(' Cancelled\\r\\n\\r\\n', 'muted'));\n return;\n }\n finalMessage = refined;\n }\n }\n\n w(colorize(' Committing...\\r\\n', 'muted'));\n const commitSuccess = this.commitGenerator.executeCommit(finalMessage, true);\n if (!commitSuccess) {\n w(`${Colors.red} β Commit failed${Colors.reset}\\r\\n\\r\\n`);\n return;\n }\n\n w(`${Colors.green} β Committed${Colors.reset}\\r\\n`);\n w(colorize(' Pushing...\\r\\n', 'muted'));\n\n const pushResult = this.commitGenerator.executePush();\n if (pushResult.success) {\n w(`${Colors.green} β Pushed${Colors.reset}\\r\\n\\r\\n`);\n } else {\n w(`${Colors.red} β Push failed:${Colors.reset} ${pushResult.error}\\r\\n\\r\\n`);\n }\n }\n\n async cmdSplitUp(smartInput: SmartInput): Promise<void> {\n const w = (s: string) => process.stdout.write(s);\n\n if (!this.commitGenerator.hasChanges()) {\n w(`${Colors.yellow} No changes to commit${Colors.reset}\\r\\n\\r\\n`);\n return;\n }\n\n w(`\\r\\n${Colors.cyan}π€ Analyzing for split...${Colors.reset}\\r\\n`);\n\n const proposedCommits = await this.commitGenerator.splitCommits();\n const commits = (proposedCommits || []).filter(c => c.files && c.files.length > 0);\n\n if (commits.length === 0) {\n w(`${Colors.red} Failed to split commits${Colors.reset}\\r\\n\\r\\n`);\n return;\n }\n\n w(`\\r\\n${Colors.green}β Proposed ${commits.length} commits:${Colors.reset}\\r\\n\\r\\n`);\n \n for (let i = 0; i < commits.length; i++) {\n const commit = commits[i];\n w(` ${colorize((i + 1).toString() + '.', 'cyan')} ${commit.message}\\r\\n`);\n w(` ${colorize('Files: ' + commit.files.join(', '), 'muted')}\\r\\n`);\n }\n\n w('\\r\\n');\n\n const confirm = await smartInput.askChoice('Execute these commits?', [\n { key: 'y', label: 'yes', description: `Commit all ${commits.length}` },\n { key: 'n', label: 'no', description: 'Cancel' },\n ]);\n\n if (confirm !== 'y') {\n w(colorize(' Cancelled\\r\\n\\r\\n', 'muted'));\n return;\n }\n\n w(colorize(' Executing...\\r\\n', 'muted'));\n const result = this.commitGenerator.executeSplitCommits(commits);\n\n if (result.success) {\n w(`${Colors.green} β ${result.committed} commits executed${Colors.reset}\\r\\n\\r\\n`);\n\n const { execSync } = require('child_process');\n try {\n const log = execSync(`git log --oneline -${result.committed}`, { cwd: process.cwd(), encoding: 'utf-8' });\n w(colorize(' Commits criados:\\r\\n', 'bold'));\n log.split('\\n').filter(l => l.trim()).forEach((line: string) => {\n w(` ${colorize(line, 'muted')}\\r\\n`);\n });\n w('\\r\\n');\n } catch {}\n\n w(colorize(' Pushing...\\r\\n', 'muted'));\n const pushResult = this.commitGenerator.executePush();\n\n if (pushResult.success) {\n w(`${Colors.green} β Pushed${Colors.reset}\\r\\n\\r\\n`);\n } else {\n w(`${Colors.red} β Push failed:${Colors.reset} ${pushResult.error}\\r\\n\\r\\n`);\n }\n } else {\n w(`${Colors.red} β Failed after ${result.committed} commit(s):${Colors.reset} ${result.error}\\r\\n`);\n\n if (result.originalHead && result.committed > 0) {\n w(`${colorize(' Rollback disponΓvel:', 'warning')}\\r\\n`);\n w(` ${colorize(`git reset --soft ${result.originalHead}`, 'cyan')}\\r\\n\\r\\n`);\n } else {\n w('\\r\\n');\n }\n }\n }\n\n async cmdPr(smartInput: SmartInput): Promise<void> {\n const w = (s: string) => process.stdout.write(s);\n\n const branch = this.prGenerator.getCurrentBranch();\n if (branch === 'main' || branch === 'master' || branch === 'develop') {\n w(`${Colors.yellow} Cannot create PR from ${branch} branch${Colors.reset}\\r\\n\\r\\n`);\n return;\n }\n\n const detectedBase = this.prGenerator.detectDefaultBaseBranch();\n const baseInput = await smartInput.question(colorize(` Base branch (default: ${detectedBase}): `, 'cyan'));\n const baseBranch = baseInput.trim() || detectedBase;\n\n w(`\\r\\n${Colors.cyan}π Analyzing commits...${Colors.reset}\\r\\n`);\n\n const commits = this.prGenerator.getCommitsNotInBase(baseBranch);\n if (commits.length === 0) {\n w(`${Colors.yellow} No commits found between ${branch} and ${baseBranch}${Colors.reset}\\r\\n\\r\\n`);\n return;\n }\n\n w(`\\r\\n${Colors.green}β Found ${commits.length} commit(s):${Colors.reset}\\r\\n`);\n for (const commit of commits) {\n w(` ${colorize(commit.hash.slice(0, 7), 'muted')} ${commit.message.slice(0, 50)}${commit.message.length > 50 ? '...' : ''}\\r\\n`);\n }\n\n w(`\\r\\n${Colors.cyan}π€ Generating PR description...${Colors.reset}\\r\\n`);\n\n const prDescription = await this.prGenerator.generatePRDescription(branch, commits, baseBranch);\n\n w(`\\r\\n${colorize('β'.repeat(50), 'subtle')}\\r\\n`);\n w(colorize('Pull Request Preview:', 'bold') + '\\r\\n');\n w(colorize('β'.repeat(50), 'subtle') + '\\r\\n\\r\\n');\n w(`${colorize('Title:', 'bold')}\\r\\n ${colorize(prDescription.title, 'cyan')}\\r\\n\\r\\n`);\n \n const descLines = prDescription.description.split('\\n');\n for (const line of descLines.slice(0, 25)) {\n w(` ${line}\\r\\n`);\n }\n if (descLines.length > 25) {\n w(` ${colorize(`... (${descLines.length - 25} more lines)`, 'muted')}\\r\\n`);\n }\n \n w(`\\r\\n${colorize('β'.repeat(50), 'subtle')}\\r\\n\\r\\n`);\n\n const confirm = await smartInput.askChoice('Create this PR?', [\n { key: 'y', label: 'yes', description: 'Create PR on GitHub' },\n { key: 'n', label: 'no', description: 'Cancel' },\n { key: 'e', label: 'edit', description: 'Edit title/description' },\n ]);\n\n if (confirm === 'n') {\n w(colorize(' Cancelled\\r\\n\\r\\n', 'muted'));\n return;\n }\n\n let finalTitle = prDescription.title;\n let finalDescription = prDescription.description;\n\n if (confirm === 'e') {\n const newTitle = await smartInput.question(colorize(' Title (empty to keep): ', 'cyan'));\n if (newTitle.trim()) {\n finalTitle = newTitle.trim();\n }\n\n const editDesc = await smartInput.askChoice('Edit description?', [\n { key: 'y', label: 'yes', description: 'Open in editor' },\n { key: 'n', label: 'no', description: 'Keep as is' },\n ]);\n\n if (editDesc === 'y') {\n const fs = require('fs');\n const { execSync } = require('child_process');\n const tempFile = `/tmp/pr-desc-${Date.now()}.md`;\n fs.writeFileSync(tempFile, finalDescription);\n \n const editor = process.env.EDITOR || 'nano';\n try {\n execSync(`${editor} \"${tempFile}\"`, { stdio: 'inherit' });\n finalDescription = fs.readFileSync(tempFile, 'utf-8');\n } catch {\n w(colorize(' Could not open editor\\r\\n', 'yellow'));\n } finally {\n try { fs.unlinkSync(tempFile); } catch {}\n }\n }\n }\n\n const { platform } = this.prGenerator.detectPlatform();\n \n if (platform === 'github') {\n try {\n const { execSync } = require('child_process');\n execSync(`git push origin ${branch}`, { cwd: process.cwd() });\n } catch {}\n }\n\n const result = await this.prGenerator.createPR(finalTitle, finalDescription, baseBranch);\n\n if (result.success && result.url) {\n w(`\\r\\n${Colors.green}β Pull Request created!${Colors.reset}\\r\\n`);\n w(` ${colorize(result.url, 'cyan')}\\r\\n\\r\\n`);\n } else {\n if (result.description) {\n const copied = this.prGenerator.copyToClipboard(result.description);\n w(`\\r\\n${colorize('PR Description:', 'bold')}\\r\\n`);\n w(colorize('β'.repeat(50), 'subtle') + '\\r\\n');\n w(result.description.split('\\n').slice(0, 30).join('\\r\\n') + '\\r\\n');\n w(colorize('β'.repeat(50), 'subtle') + '\\r\\n\\r\\n');\n \n if (copied) {\n w(`${colorize('β', 'success')} Copied to clipboard\\r\\n`);\n }\n\n const createUrl = this.prGenerator.getPRCreateUrl(platform, baseBranch);\n if (createUrl) {\n w(`\\r\\n ${colorize('Open to create PR:', 'muted')}\\r\\n`);\n w(` ${colorize(createUrl, 'cyan')}\\r\\n`);\n }\n }\n w('\\r\\n');\n }\n }\n\n async cmdReview(args: string[]): Promise<void> {\n const w = (s: string) => process.stdout.write(s);\n\n let files: string[] = [];\n \n if (args.length > 0) {\n files = args.filter(a => !a.startsWith('/'));\n } else {\n w(`\\r\\n${Colors.cyan}π Analyzing staged files...${Colors.reset}\\r\\n`);\n files = this.codeReviewService['getChangedFiles'](true);\n }\n\n if (files.length === 0) {\n w(`${Colors.yellow} No files to review${Colors.reset}\\r\\n\\r\\n`);\n return;\n }\n\n w(`\\r\\n${Colors.cyan}π€ Reviewing ${files.length} file(s)...${Colors.reset}\\r\\n`);\n\n const results = await this.codeReviewService.reviewFiles(files);\n\n let totalIssues = 0;\n let totalScore = 0;\n\n for (const result of results) {\n totalScore += result.score;\n const errors = result.issues.filter(i => i.severity === 'error').length;\n const warnings = result.issues.filter(i => i.severity === 'warning').length;\n const suggestions = result.issues.filter(i => i.severity === 'suggestion').length;\n totalIssues += result.issues.length;\n\n const scoreColor = result.score >= 80 ? 'success' : result.score >= 60 ? 'warning' : 'error';\n \n w(`\\r\\n${colorize(result.file, 'bold')} ${colorize(result.score + '/100', scoreColor)}\\r\\n`);\n w(` ${colorize(result.summary, 'muted')}\\r\\n`);\n\n if (errors > 0) w(` ${colorize('β ' + errors + ' errors', 'error')} `);\n if (warnings > 0) w(`${colorize('β ' + warnings + ' warnings', 'warning')} `);\n if (suggestions > 0) w(`${colorize('π‘ ' + suggestions + ' suggestions', 'muted')}`);\n if (errors > 0 || warnings > 0 || suggestions > 0) w('\\r\\n');\n\n const topIssues = result.issues.filter(i => i.severity !== 'praise').slice(0, 3);\n for (const issue of topIssues) {\n const icon = issue.severity === 'error' ? 'β' : issue.severity === 'warning' ? 'β ' : 'π‘';\n const color = issue.severity === 'error' ? 'error' : issue.severity === 'warning' ? 'warning' : 'muted';\n const line = issue.line ? colorize(':' + issue.line, 'muted') : '';\n w(` ${colorize(icon, color)} ${issue.message}${line}\\r\\n`);\n }\n\n if (result.issues.length > 3) {\n w(` ${colorize('... and ' + (result.issues.length - 3) + ' more', 'muted')}\\r\\n`);\n }\n }\n\n const avgScore = Math.round(totalScore / results.length);\n const avgColor = avgScore >= 80 ? 'success' : avgScore >= 60 ? 'warning' : 'error';\n \n w(`\\r\\n${colorize('Summary:', 'bold')} ${colorize(avgScore + '/100', avgColor)} | ${totalIssues} issue(s)\\r\\n\\r\\n`);\n }\n\n async cmdFix(args: string[]): Promise<void> {\n const w = (s: string) => process.stdout.write(s);\n\n if (args.length === 0) {\n w(`${Colors.yellow} Usage: /fix <file>${Colors.reset}\\r\\n\\r\\n`);\n return;\n }\n\n const filePath = args[0];\n w(`\\r\\n${Colors.cyan}π§ Fixing ${filePath}...${Colors.reset}\\r\\n`);\n\n const result = await this.codeReviewService.fixFile(filePath);\n\n if (result.success) {\n w(`${Colors.green} β File fixed${Colors.reset}\\r\\n\\r\\n`);\n } else {\n w(`${Colors.red} β Failed: ${result.error}${Colors.reset}\\r\\n\\r\\n`);\n }\n }\n\n async cmdIdent(): Promise<void> {\n const w = (s: string) => process.stdout.write(s);\n w(`\\r\\n${Colors.cyan}π¨ Formatting code files...${Colors.reset}\\r\\n`);\n\n const result = await this.codeReviewService.indentAll();\n\n w(`${Colors.green} β ${result.success} file(s) formatted${Colors.reset}\\r\\n`);\n if (result.failed > 0) {\n w(`${Colors.yellow} β ${result.failed} file(s) failed${Colors.reset}\\r\\n`);\n }\n w('\\r\\n');\n }\n\n async cmdRelease(args: string[]): Promise<void> {\n const w = (s: string) => process.stdout.write(s);\n const sinceTag = args[0];\n\n w(`\\r\\n${Colors.cyan}π Generating release notes...${Colors.reset}\\r\\n`);\n\n const result = await this.releaseNotesService.generateReleaseNotes(sinceTag);\n\n if (result.success && result.filePath) {\n w(`${Colors.green} β Release notes generated!${Colors.reset}\\r\\n`);\n w(` ${colorize(result.filePath, 'accent')}\\r\\n\\r\\n`);\n\n if (result.content) {\n w(`${colorize('Preview:', 'bold')}\\r\\n`);\n const lines = result.content.split('\\n').slice(0, 15);\n for (const line of lines) {\n w(` ${line}\\r\\n`);\n }\n if (result.content.split('\\n').length > 15) {\n w(` ${colorize('...', 'muted')}\\r\\n`);\n }\n w('\\r\\n');\n }\n } else {\n w(`${Colors.red} β Failed: ${result.error}${Colors.reset}\\r\\n\\r\\n`);\n }\n }\n}\n"],"names":["GitCommandsService","runGit","cmd","execSync","require","output","encoding","cwd","process","trim","stdout","write","colorize","e","Colors","red","message","reset","cmdCommit","args","smartInput","msg","join","generateAndCommit","input","w","s","commitGenerator","hasChanges","yellow","cyan","generateCommitMessage","green","confirm","askChoice","key","label","description","finalMessage","newMsg","question","success","executeCommit","cmdUp","monorepoInfo","monorepoDetector","detectMonorepo","isMonorepo","modules","instructions","diffInfo","getDiffInfo","refined","refineCommitMessage","confirmRefined","commitSuccess","pushResult","executePush","error","cmdSplitUp","proposedCommits","splitCommits","commits","filter","c","files","length","i","commit","toString","result","executeSplitCommits","committed","log","split","l","forEach","line","originalHead","cmdPr","branch","prGenerator","getCurrentBranch","detectedBase","detectDefaultBaseBranch","baseInput","baseBranch","getCommitsNotInBase","hash","slice","prDescription","generatePRDescription","repeat","title","descLines","finalTitle","finalDescription","newTitle","editDesc","fs","tempFile","Date","now","writeFileSync","editor","env","EDITOR","stdio","readFileSync","unlinkSync","platform","detectPlatform","createPR","url","copied","copyToClipboard","createUrl","getPRCreateUrl","cmdReview","a","startsWith","codeReviewService","results","reviewFiles","totalIssues","totalScore","score","errors","issues","severity","warnings","suggestions","scoreColor","file","summary","topIssues","issue","icon","color","avgScore","Math","round","avgColor","cmdFix","filePath","fixFile","cmdIdent","indentAll","failed","cmdRelease","sinceTag","releaseNotesService","generateReleaseNotes","content","lines"],"mappings":";;;;+BAcaA;;;eAAAA;;;wBAdc;uBACkB;wCACN;yCACC;oCACL;mCACD;qCACE;;;;;;;;;;AAQ7B,IAAA,AAAMA,qBAAN,MAAMA;IASXC,OAAOC,GAAW,EAAQ;QACxB,MAAM,EAAEC,QAAQ,EAAE,GAAGC,QAAQ;QAC7B,IAAI;YACF,MAAMC,SAASF,SAASD,KAAK;gBAAEI,UAAU;gBAASC,KAAKC,Q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