git-smart-flow 0.3.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/CHANGELOG.md +33 -0
- package/LICENSE +21 -0
- package/README.md +130 -0
- package/bin/git-smart-flow.js +2 -0
- package/bin/gsf.js +2 -0
- package/bin/gsfc.js +3 -0
- package/bin/gsfm.js +3 -0
- package/bin/gsfp.js +3 -0
- package/bin/gsfpr.js +3 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +214 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/aliases.d.ts +2 -0
- package/dist/commands/aliases.js +37 -0
- package/dist/commands/aliases.js.map +1 -0
- package/dist/commands/branch.d.ts +2 -0
- package/dist/commands/branch.js +414 -0
- package/dist/commands/branch.js.map +1 -0
- package/dist/commands/commit-message.d.ts +7 -0
- package/dist/commands/commit-message.js +95 -0
- package/dist/commands/commit-message.js.map +1 -0
- package/dist/commands/commit.d.ts +3 -0
- package/dist/commands/commit.js +597 -0
- package/dist/commands/commit.js.map +1 -0
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/config.js +88 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.js +246 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/info.d.ts +2 -0
- package/dist/commands/info.js +155 -0
- package/dist/commands/info.js.map +1 -0
- package/dist/commands/install-hooks.d.ts +2 -0
- package/dist/commands/install-hooks.js +66 -0
- package/dist/commands/install-hooks.js.map +1 -0
- package/dist/commands/log.d.ts +2 -0
- package/dist/commands/log.js +101 -0
- package/dist/commands/log.js.map +1 -0
- package/dist/commands/menu.d.ts +2 -0
- package/dist/commands/menu.js +297 -0
- package/dist/commands/menu.js.map +1 -0
- package/dist/commands/merge.d.ts +6 -0
- package/dist/commands/merge.js +128 -0
- package/dist/commands/merge.js.map +1 -0
- package/dist/commands/pr.d.ts +2 -0
- package/dist/commands/pr.js +731 -0
- package/dist/commands/pr.js.map +1 -0
- package/dist/commands/push.d.ts +7 -0
- package/dist/commands/push.js +225 -0
- package/dist/commands/push.js.map +1 -0
- package/dist/commands/reflog.d.ts +2 -0
- package/dist/commands/reflog.js +162 -0
- package/dist/commands/reflog.js.map +1 -0
- package/dist/commands/repo-init.d.ts +2 -0
- package/dist/commands/repo-init.js +466 -0
- package/dist/commands/repo-init.js.map +1 -0
- package/dist/commands/revert.d.ts +7 -0
- package/dist/commands/revert.js +694 -0
- package/dist/commands/revert.js.map +1 -0
- package/dist/commands/setup.d.ts +2 -0
- package/dist/commands/setup.js +86 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/stash.d.ts +2 -0
- package/dist/commands/stash.js +130 -0
- package/dist/commands/stash.js.map +1 -0
- package/dist/commands/sync.d.ts +2 -0
- package/dist/commands/sync.js +335 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/tag.d.ts +2 -0
- package/dist/commands/tag.js +163 -0
- package/dist/commands/tag.js.map +1 -0
- package/dist/commands/validate.d.ts +2 -0
- package/dist/commands/validate.js +203 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/config/config.d.ts +10 -0
- package/dist/config/config.js +126 -0
- package/dist/config/config.js.map +1 -0
- package/dist/git/ai-context-builder.d.ts +11 -0
- package/dist/git/ai-context-builder.js +112 -0
- package/dist/git/ai-context-builder.js.map +1 -0
- package/dist/git/convention-detector.d.ts +3 -0
- package/dist/git/convention-detector.js +211 -0
- package/dist/git/convention-detector.js.map +1 -0
- package/dist/git/ensure-repo.d.ts +7 -0
- package/dist/git/ensure-repo.js +141 -0
- package/dist/git/ensure-repo.js.map +1 -0
- package/dist/git/gitignore.d.ts +8 -0
- package/dist/git/gitignore.js +261 -0
- package/dist/git/gitignore.js.map +1 -0
- package/dist/git/remote-setup.d.ts +2 -0
- package/dist/git/remote-setup.js +129 -0
- package/dist/git/remote-setup.js.map +1 -0
- package/dist/git/repo.d.ts +73 -0
- package/dist/git/repo.js +308 -0
- package/dist/git/repo.js.map +1 -0
- package/dist/git/validate.d.ts +36 -0
- package/dist/git/validate.js +113 -0
- package/dist/git/validate.js.map +1 -0
- package/dist/providers/base.provider.d.ts +10 -0
- package/dist/providers/base.provider.js +40 -0
- package/dist/providers/base.provider.js.map +1 -0
- package/dist/providers/claude.provider.d.ts +14 -0
- package/dist/providers/claude.provider.js +85 -0
- package/dist/providers/claude.provider.js.map +1 -0
- package/dist/providers/copilot.provider.d.ts +12 -0
- package/dist/providers/copilot.provider.js +88 -0
- package/dist/providers/copilot.provider.js.map +1 -0
- package/dist/providers/heuristic.provider.d.ts +9 -0
- package/dist/providers/heuristic.provider.js +163 -0
- package/dist/providers/heuristic.provider.js.map +1 -0
- package/dist/providers/ollama.provider.d.ts +14 -0
- package/dist/providers/ollama.provider.js +83 -0
- package/dist/providers/ollama.provider.js.map +1 -0
- package/dist/providers/openai.provider.d.ts +14 -0
- package/dist/providers/openai.provider.js +84 -0
- package/dist/providers/openai.provider.js.map +1 -0
- package/dist/providers/provider.factory.d.ts +5 -0
- package/dist/providers/provider.factory.js +51 -0
- package/dist/providers/provider.factory.js.map +1 -0
- package/dist/security/scanner.d.ts +13 -0
- package/dist/security/scanner.js +138 -0
- package/dist/security/scanner.js.map +1 -0
- package/dist/types/index.d.ts +146 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/ux/components/BranchTree.d.ts +8 -0
- package/dist/ux/components/BranchTree.js +57 -0
- package/dist/ux/components/BranchTree.js.map +1 -0
- package/dist/ux/components/CommitProposal.d.ts +13 -0
- package/dist/ux/components/CommitProposal.js +127 -0
- package/dist/ux/components/CommitProposal.js.map +1 -0
- package/dist/ux/components/DiagnosticReport.d.ts +18 -0
- package/dist/ux/components/DiagnosticReport.js +19 -0
- package/dist/ux/components/DiagnosticReport.js.map +1 -0
- package/dist/ux/components/ErrorBox.d.ts +7 -0
- package/dist/ux/components/ErrorBox.js +9 -0
- package/dist/ux/components/ErrorBox.js.map +1 -0
- package/dist/ux/components/FileSelector.d.ts +14 -0
- package/dist/ux/components/FileSelector.js +87 -0
- package/dist/ux/components/FileSelector.js.map +1 -0
- package/dist/ux/components/Logo.d.ts +6 -0
- package/dist/ux/components/Logo.js +21 -0
- package/dist/ux/components/Logo.js.map +1 -0
- package/dist/ux/components/RepoContext.d.ts +8 -0
- package/dist/ux/components/RepoContext.js +17 -0
- package/dist/ux/components/RepoContext.js.map +1 -0
- package/dist/ux/components/SecurityAlert.d.ts +9 -0
- package/dist/ux/components/SecurityAlert.js +16 -0
- package/dist/ux/components/SecurityAlert.js.map +1 -0
- package/dist/ux/components/StatusDashboard.d.ts +14 -0
- package/dist/ux/components/StatusDashboard.js +36 -0
- package/dist/ux/components/StatusDashboard.js.map +1 -0
- package/dist/ux/components/SuccessBox.d.ts +7 -0
- package/dist/ux/components/SuccessBox.js +9 -0
- package/dist/ux/components/SuccessBox.js.map +1 -0
- package/dist/ux/components/ValidationReport.d.ts +16 -0
- package/dist/ux/components/ValidationReport.js +19 -0
- package/dist/ux/components/ValidationReport.js.map +1 -0
- package/dist/ux/components/WarningBox.d.ts +7 -0
- package/dist/ux/components/WarningBox.js +9 -0
- package/dist/ux/components/WarningBox.js.map +1 -0
- package/dist/ux/display.d.ts +21 -0
- package/dist/ux/display.js +96 -0
- package/dist/ux/display.js.map +1 -0
- package/dist/ux/hooks/useActivation.d.ts +8 -0
- package/dist/ux/hooks/useActivation.js +16 -0
- package/dist/ux/hooks/useActivation.js.map +1 -0
- package/dist/ux/hooks/useSpinner.d.ts +2 -0
- package/dist/ux/hooks/useSpinner.js +13 -0
- package/dist/ux/hooks/useSpinner.js.map +1 -0
- package/dist/ux/menu.d.ts +7 -0
- package/dist/ux/menu.js +56 -0
- package/dist/ux/menu.js.map +1 -0
- package/dist/ux/prompt.d.ts +7 -0
- package/dist/ux/prompt.js +361 -0
- package/dist/ux/prompt.js.map +1 -0
- package/dist/ux/renderer.d.ts +9 -0
- package/dist/ux/renderer.js +45 -0
- package/dist/ux/renderer.js.map +1 -0
- package/dist/ux/spinner.d.ts +6 -0
- package/dist/ux/spinner.js +42 -0
- package/dist/ux/spinner.js.map +1 -0
- package/dist/ux/statusbar.d.ts +2 -0
- package/dist/ux/statusbar.js +44 -0
- package/dist/ux/statusbar.js.map +1 -0
- package/dist/ux/theme.d.ts +37 -0
- package/dist/ux/theme.js +55 -0
- package/dist/ux/theme.js.map +1 -0
- package/package.json +125 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import { MultiSelect } from '@inkjs/ui';
|
|
4
|
+
import { theme } from '../theme.js';
|
|
5
|
+
import { useActivation } from '../hooks/useActivation.js';
|
|
6
|
+
function statusIcon(status) {
|
|
7
|
+
const map = {
|
|
8
|
+
added: 'A',
|
|
9
|
+
modified: 'M',
|
|
10
|
+
deleted: 'D',
|
|
11
|
+
renamed: 'R',
|
|
12
|
+
copied: 'C',
|
|
13
|
+
unknown: '?',
|
|
14
|
+
untracked: '?',
|
|
15
|
+
unstaged: 'M',
|
|
16
|
+
};
|
|
17
|
+
return map[status] ?? '?';
|
|
18
|
+
}
|
|
19
|
+
function dirOf(filePath) {
|
|
20
|
+
const idx = filePath.lastIndexOf('/');
|
|
21
|
+
return idx >= 0 ? filePath.slice(0, idx) : '';
|
|
22
|
+
}
|
|
23
|
+
function buildOptions(files) {
|
|
24
|
+
const options = [];
|
|
25
|
+
if (files.length >= 2) {
|
|
26
|
+
options.push({ label: `📦 Todos los archivos (${files.length})`, value: '__ALL__' });
|
|
27
|
+
}
|
|
28
|
+
// Group by directory
|
|
29
|
+
const dirs = new Map();
|
|
30
|
+
for (const f of files) {
|
|
31
|
+
const d = dirOf(f.path);
|
|
32
|
+
if (!dirs.has(d))
|
|
33
|
+
dirs.set(d, []);
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
35
|
+
dirs.get(d).push(f);
|
|
36
|
+
}
|
|
37
|
+
const sortedDirs = [...dirs.entries()].sort(([a], [b]) => a.localeCompare(b));
|
|
38
|
+
for (const [dir, dirFiles] of sortedDirs) {
|
|
39
|
+
// Directory shortcut only when the dir has 2+ files
|
|
40
|
+
if (dirFiles.length >= 2) {
|
|
41
|
+
const dirLabel = dir ? `📁 ${dir}/ (${dirFiles.length})` : `📁 (raíz) (${dirFiles.length})`;
|
|
42
|
+
options.push({ label: dirLabel, value: `__DIR:${dir}` });
|
|
43
|
+
}
|
|
44
|
+
for (const f of dirFiles) {
|
|
45
|
+
const indent = dirFiles.length >= 2 ? ' ' : '';
|
|
46
|
+
options.push({
|
|
47
|
+
label: `${indent}${statusIcon(f.status)} ${f.path}`,
|
|
48
|
+
value: f.path,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return options;
|
|
53
|
+
}
|
|
54
|
+
function expandSelection(selected, allFiles) {
|
|
55
|
+
const paths = new Set();
|
|
56
|
+
for (const val of selected) {
|
|
57
|
+
if (val === '__ALL__') {
|
|
58
|
+
for (const f of allFiles)
|
|
59
|
+
paths.add(f.path);
|
|
60
|
+
}
|
|
61
|
+
else if (val.startsWith('__DIR:')) {
|
|
62
|
+
const dir = val.slice(6);
|
|
63
|
+
for (const f of allFiles) {
|
|
64
|
+
if (dirOf(f.path) === dir)
|
|
65
|
+
paths.add(f.path);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
paths.add(val);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return [...paths];
|
|
73
|
+
}
|
|
74
|
+
export function FileSelector({ files, blockedFiles = [], onSelect }) {
|
|
75
|
+
const isActive = useActivation();
|
|
76
|
+
const selectableFiles = files.filter((f) => !blockedFiles.includes(f.path));
|
|
77
|
+
const blocked = files.filter((f) => blockedFiles.includes(f.path));
|
|
78
|
+
const options = buildOptions(selectableFiles);
|
|
79
|
+
function handleSubmit(selected) {
|
|
80
|
+
const paths = expandSelection(selected, selectableFiles);
|
|
81
|
+
if (paths.length === 0)
|
|
82
|
+
return;
|
|
83
|
+
onSelect(paths);
|
|
84
|
+
}
|
|
85
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { bold: true, color: "white", children: "\uD83D\uDCC2 Archivos con cambios" }), _jsx(Text, { color: theme.muted, children: '─'.repeat(40) }), blocked.length > 0 && (_jsx(Box, { flexDirection: "column", marginBottom: 1, children: blocked.map((f, i) => (_jsxs(Text, { color: theme.muted, children: [' ', "\uD83D\uDD12 ", f.path, " ", _jsx(Text, { color: theme.error, children: "(bloqueado - secretos)" })] }, i))) })), _jsx(MultiSelect, { isDisabled: !isActive, options: options, onSubmit: handleSubmit }), _jsx(Text, { color: theme.muted, children: " Espacio para seleccionar \u00B7 Enter para confirmar" })] }));
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=FileSelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSelector.js","sourceRoot":"","sources":["../../../src/ux/components/FileSelector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAc1D,SAAS,UAAU,CAAC,MAA2B;IAC7C,MAAM,GAAG,GAA2B;QAClC,KAAK,EAAE,GAAG;QACV,QAAQ,EAAE,GAAG;QACb,OAAO,EAAE,GAAG;QACZ,OAAO,EAAE,GAAG;QACZ,MAAM,EAAE,GAAG;QACX,OAAO,EAAE,GAAG;QACZ,SAAS,EAAE,GAAG;QACd,QAAQ,EAAE,GAAG;KACd,CAAC;IACF,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC;AAC5B,CAAC;AAED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,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACrB,MAAC,IAAI,IAAS,KAAK,EAAE,KAAK,CAAC,KAAK,aAC7B,GAAG,mBACA,CAAC,CAAC,IAAI,OAAE,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,uCAA+B,KAF1D,CAAC,CAGL,CACR,CAAC,GACE,CACP,EAED,KAAC,WAAW,IAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,GAAI,EAEhF,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,sEAAyD,IAC7E,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import figlet from 'figlet';
|
|
4
|
+
import { theme } from '../theme.js';
|
|
5
|
+
function renderLogo(narrow) {
|
|
6
|
+
try {
|
|
7
|
+
return figlet.textSync('GSF', { font: narrow ? 'Small' : 'ANSI Shadow' });
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return narrow
|
|
11
|
+
? ' ___ ___ ___ \n/ __|| _|| __|\n|(_ |___ || __|\n \\___||___||___|'
|
|
12
|
+
: ' ██████╗ ███████╗███████╗\n ██╔════╝ ██╔════╝██╔════╝\n ██║ ███╗███████╗█████╗ \n ██║ ██║╚════██║██╔══╝ \n ╚██████╔╝███████║██║ \n ╚═════╝ ╚══════╝╚═╝ ';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function Logo({ version }) {
|
|
16
|
+
const cols = process.stdout.columns ?? 80;
|
|
17
|
+
const narrow = cols < 80;
|
|
18
|
+
const art = renderLogo(narrow);
|
|
19
|
+
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Text, { color: theme.accent, children: art }), _jsxs(Box, { marginTop: -1, paddingLeft: 2, gap: 1, children: [_jsx(Text, { bold: true, color: "white", children: "Git Smart Flow" }), _jsxs(Text, { color: theme.muted, children: ["v", version] })] }), _jsx(Box, { paddingLeft: 2, children: _jsx(Text, { color: theme.muted, children: "The smart way to use Git" }) })] }));
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=Logo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logo.js","sourceRoot":"","sources":["../../../src/ux/components/Logo.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAMpC,SAAS,UAAU,CAAC,MAAe;IACjC,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC;IAC5E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM;YACX,CAAC,CAAC,qEAAqE;YACvE,CAAC,CAAC,wKAAwK,CAAC;IAC/K,CAAC;AACH,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,EAAE,OAAO,EAAS;IACrC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;IAC1C,MAAM,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;IACzB,MAAM,GAAG,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IAE/B,OAAO,CACL,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,YAAY,EAAE,CAAC,aACzC,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,YAAG,GAAG,GAAQ,EACvC,MAAC,GAAG,IAAC,SAAS,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,aACxC,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,OAAO,+BAEjB,EACP,MAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,kBAAI,OAAO,IAAQ,IACvC,EACN,KAAC,GAAG,IAAC,WAAW,EAAE,CAAC,YACjB,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,yCAAiC,GACrD,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import { branchColor, theme } from '../theme.js';
|
|
4
|
+
export function RepoContextBox({ ctx, provider }) {
|
|
5
|
+
const width = Math.min(process.stdout.columns ?? 80, 60);
|
|
6
|
+
const color = branchColor(ctx.branch);
|
|
7
|
+
const isProtected = ctx.branch === 'main' || ctx.branch === 'master' || ctx.branch === 'develop';
|
|
8
|
+
const aheadStr = ctx.aheadCount > 0 ? _jsxs(Text, { color: theme.success, children: [" \u2191", ctx.aheadCount] }) : null;
|
|
9
|
+
const behindStr = ctx.behindCount > 0 ? _jsxs(Text, { color: theme.error, children: [" \u2193", ctx.behindCount] }) : null;
|
|
10
|
+
const conventionName = ctx.convention.type === 'conventional'
|
|
11
|
+
? 'Conventional'
|
|
12
|
+
: ctx.convention.type === 'angular'
|
|
13
|
+
? 'Angular'
|
|
14
|
+
: ctx.convention.type;
|
|
15
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.border, paddingX: 1, width: width, marginBottom: 1, children: [_jsxs(Text, { children: [_jsx(Text, { color: theme.muted, children: "\uD83D\uDCC1 " }), _jsx(Text, { bold: true, color: "white", children: ctx.name })] }), _jsxs(Box, { children: [_jsx(Text, { color: theme.muted, children: "\uD83C\uDF3F " }), _jsx(Text, { color: color, children: ctx.branch }), aheadStr, behindStr, isProtected && _jsx(Text, { color: theme.warning, children: " \u26A0 PROTECTED" })] }), _jsxs(Text, { children: [_jsx(Text, { color: theme.muted, children: "\u26A1 " }), _jsx(Text, { color: theme.info, children: conventionName })] }), _jsxs(Text, { children: [_jsx(Text, { color: theme.muted, children: "\uD83E\uDD16 " }), _jsx(Text, { color: theme.muted, children: provider ?? 'Heurístico' })] })] }));
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=RepoContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RepoContext.js","sourceRoot":"","sources":["../../../src/ux/components/RepoContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAOjD,MAAM,UAAU,cAAc,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAS;IACrD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IACzD,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,KAAK,MAAM,IAAI,GAAG,CAAC,MAAM,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC;IAEjG,MAAM,QAAQ,GACZ,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,MAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,OAAO,wBAAK,GAAG,CAAC,UAAU,IAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;IACpF,MAAM,SAAS,GACb,GAAG,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,MAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,wBAAK,GAAG,CAAC,WAAW,IAAQ,CAAC,CAAC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9 @@
|
|
|
1
|
+
import type { SecurityScanResult } from '../../types/index.js';
|
|
2
|
+
type SecurityChoice = 'review' | 'continue' | 'cancel';
|
|
3
|
+
interface Props {
|
|
4
|
+
scan: SecurityScanResult;
|
|
5
|
+
onChoice: (choice: SecurityChoice) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function SecurityAlert({ scan, onChoice }: Props): JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=SecurityAlert.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import { Select } from '@inkjs/ui';
|
|
4
|
+
import { theme } from '../theme.js';
|
|
5
|
+
import { useActivation } from '../hooks/useActivation.js';
|
|
6
|
+
export function SecurityAlert({ scan, onChoice }) {
|
|
7
|
+
const isActive = useActivation();
|
|
8
|
+
const width = Math.min(process.stdout.columns ?? 80, 76);
|
|
9
|
+
const options = [
|
|
10
|
+
{ label: 'No, revisar los archivos primero', value: 'review' },
|
|
11
|
+
{ label: 'Sí, continuar sin IA para estos archivos', value: 'continue' },
|
|
12
|
+
{ label: 'Cancelar', value: 'cancel' },
|
|
13
|
+
];
|
|
14
|
+
return (_jsxs(Box, { flexDirection: "column", width: width, children: [_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.warning, paddingX: 1, marginBottom: 1, children: [_jsx(Text, { bold: true, color: theme.warning, children: "\u26A0\uFE0F Alerta de seguridad" }), _jsx(Text, { children: " " }), _jsx(Text, { color: "white", children: " Se detectaron posibles secretos en archivos staged:" }), _jsx(Text, { children: " " }), scan.detectedSecrets.map((s, i) => (_jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [_jsxs(Text, { color: theme.info, children: ["\uD83D\uDCC4 ", s.file] }), _jsxs(Text, { color: theme.muted, children: [' ', "L\u00EDnea ", s.line, ": ", s.pattern.replace(/./g, '•').slice(0, 20)] })] }, i))), scan.blockedFiles.length > 0 && (_jsxs(_Fragment, { children: [_jsx(Text, { children: " " }), scan.blockedFiles.map((f, i) => (_jsx(Box, { marginLeft: 2, children: _jsxs(Text, { color: theme.error, children: ["\uD83D\uDD12 ", f, " (bloqueado)"] }) }, i)))] })), _jsx(Text, { children: " " }), _jsx(Text, { color: theme.muted, children: " Estos archivos NO ser\u00E1n enviados a la IA." })] }), _jsx(Select, { isDisabled: !isActive, options: options, onChange: (val) => onChoice(val) })] }));
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=SecurityAlert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SecurityAlert.js","sourceRoot":"","sources":["../../../src/ux/components/SecurityAlert.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAS1D,MAAM,UAAU,aAAa,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAS;IACrD,MAAM,QAAQ,GAAG,aAAa,EAAE,CAAC;IACjC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IAEzD,MAAM,OAAO,GAAG;QACd,EAAE,KAAK,EAAE,kCAAkC,EAAE,KAAK,EAAE,QAA0B,EAAE;QAChF,EAAE,KAAK,EAAE,0CAA0C,EAAE,KAAK,EAAE,UAA4B,EAAE;QAC1F,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,QAA0B,EAAE;KACzD,CAAC;IAEF,OAAO,CACL,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,KAAK,EAAE,KAAK,aACt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,UAAU,EAAE,CAAC,QAAQ,EACrB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAqB,CAAC,GAClD,IACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { RepoContext } from '../../types/index.js';
|
|
2
|
+
import type { LastCommit } from '../../git/repo.js';
|
|
3
|
+
interface Props {
|
|
4
|
+
ctx: RepoContext;
|
|
5
|
+
lastCommit: LastCommit | null;
|
|
6
|
+
lastFetch: Date | null;
|
|
7
|
+
version: string;
|
|
8
|
+
provider?: string;
|
|
9
|
+
cwd: string;
|
|
10
|
+
graphLimit?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function StatusDashboard({ ctx, lastCommit, lastFetch, version, provider, cwd, graphLimit, }: Props): JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=StatusDashboard.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import { branchColor, theme } from '../theme.js';
|
|
4
|
+
import { BranchTree } from './BranchTree.js';
|
|
5
|
+
function relativeTime(d) {
|
|
6
|
+
const s = Math.floor((Date.now() - d.getTime()) / 1000);
|
|
7
|
+
if (s < 60)
|
|
8
|
+
return `${s}s ago`;
|
|
9
|
+
if (s < 3600)
|
|
10
|
+
return `${Math.floor(s / 60)}m ago`;
|
|
11
|
+
if (s < 86400)
|
|
12
|
+
return `${Math.floor(s / 3600)}h ago`;
|
|
13
|
+
return `${Math.floor(s / 86400)}d ago`;
|
|
14
|
+
}
|
|
15
|
+
export function StatusDashboard({ ctx, lastCommit, lastFetch, version, provider, cwd, graphLimit = 3, }) {
|
|
16
|
+
const width = Math.min(process.stdout.columns ?? 80, 78);
|
|
17
|
+
const innerWidth = width - 6;
|
|
18
|
+
const brColor = branchColor(ctx.branch);
|
|
19
|
+
const isProtected = ctx.branch === 'main' || ctx.branch === 'master' || ctx.branch === 'develop';
|
|
20
|
+
const conventionName = ctx.convention.type === 'conventional'
|
|
21
|
+
? 'Conventional'
|
|
22
|
+
: ctx.convention.type === 'angular'
|
|
23
|
+
? 'Angular'
|
|
24
|
+
: ctx.convention.type;
|
|
25
|
+
const msgTrunc = lastCommit
|
|
26
|
+
? lastCommit.message.length > 45
|
|
27
|
+
? lastCommit.message.slice(0, 44) + '…'
|
|
28
|
+
: lastCommit.message
|
|
29
|
+
: null;
|
|
30
|
+
const hasDirty = ctx.conflictsActive ||
|
|
31
|
+
ctx.stagedFiles.length > 0 ||
|
|
32
|
+
ctx.unstagedFiles.length > 0 ||
|
|
33
|
+
ctx.untrackedFiles.length > 0;
|
|
34
|
+
return (_jsxs(Box, { flexDirection: "column", width: width, children: [_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.border, paddingX: 1, width: width, marginBottom: 0, children: [_jsxs(Box, { children: [_jsx(Text, { color: theme.muted, children: "\uD83D\uDCC1 " }), _jsx(Text, { bold: true, color: "white", children: ctx.name }), _jsx(Text, { color: theme.muted, children: ' · git-smart-flow v' + version })] }), _jsxs(Box, { children: [_jsx(Text, { color: theme.muted, children: "\uD83C\uDF3F " }), _jsx(Text, { bold: true, color: brColor, children: ctx.branch }), ctx.aheadCount > 0 && _jsxs(Text, { color: theme.success, children: [" \u2191", ctx.aheadCount] }), ctx.behindCount > 0 && _jsxs(Text, { color: theme.error, children: [" \u2193", ctx.behindCount] }), isProtected && _jsx(Text, { color: theme.warning, children: " \u26A0 PROTECTED" }), _jsx(Text, { color: theme.muted, children: ' · ⚡ ' + conventionName }), provider && provider !== 'heuristic' && (_jsx(Text, { color: theme.muted, children: ' · 🤖 ' + provider }))] }), lastCommit ? (_jsxs(Box, { children: [_jsx(Text, { color: theme.muted, children: "\uD83D\uDD50 " }), _jsxs(Text, { color: theme.muted, children: [lastCommit.shortSha, " "] }), _jsxs(Text, { color: "#d1d5db", children: ["\"", msgTrunc, "\""] }), _jsx(Text, { color: theme.muted, children: ' ' + lastCommit.ago })] })) : (_jsxs(Box, { children: [_jsx(Text, { color: theme.muted, children: "\uD83D\uDD50 " }), _jsx(Text, { color: theme.muted, children: "(no commits yet)" })] })), _jsx(Text, { color: theme.border, children: '─'.repeat(innerWidth) }), _jsxs(Box, { children: [ctx.conflictsActive && _jsx(Text, { color: theme.error, children: "\u2716 CONFLICTS " }), ctx.stagedFiles.length > 0 && (_jsx(Text, { color: theme.warning, children: '● ' + ctx.stagedFiles.length + ' staged ' })), ctx.unstagedFiles.length > 0 && (_jsx(Text, { color: theme.warning, children: '△ ' + ctx.unstagedFiles.length + ' modified ' })), ctx.untrackedFiles.length > 0 && (_jsx(Text, { color: theme.muted, children: '○ ' + ctx.untrackedFiles.length + ' untracked ' })), !hasDirty && _jsx(Text, { color: theme.success, children: "\u2714 clean " }), _jsx(Text, { color: theme.muted, children: lastFetch ? '· fetched ' + relativeTime(lastFetch) : '· never fetched' })] })] }), _jsx(BranchTree, { cwd: cwd, limit: graphLimit, showMeta: true })] }));
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=StatusDashboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusDashboard.js","sourceRoot":"","sources":["../../../src/ux/components/StatusDashboard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAY7C,SAAS,YAAY,CAAC,CAAO;IAC3B,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;IACxD,IAAI,CAA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AAM,GAAG,CAAC,IAAI,CAC/B,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,OAAO,YAAG,IAAI,GAAG,GAAG,CAAC,aAAa,CAAC,MAAM,GAAG,aAAa,GAAQ,CACrF,EACA,GAAG,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,IAAI,CAChC,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,YAAG,IAAI,GAAG,GAAG,CAAC,cAAc,CAAC,MAAM,GAAG,cAAc,GAAQ,CACrF,EACA,CAAC,QAAQ,IAAI,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,OAAO,8BAAiB,EACzD,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,YACrB,SAAS,CAAC,CAAC,CAAC,YAAY,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,iBAAiB,GAClE,IACH,IACF,EAGN,KAAC,UAAU,IAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,SAAG,IAChD,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import { theme } from '../theme.js';
|
|
4
|
+
export function SuccessBox({ title = '✅ Éxito', messages }) {
|
|
5
|
+
const lines = Array.isArray(messages) ? messages : [messages];
|
|
6
|
+
const width = Math.min(process.stdout.columns ?? 80, 78);
|
|
7
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "double", borderColor: theme.success, paddingX: 1, width: width, children: [_jsx(Text, { bold: true, color: theme.success, children: title }), _jsx(Text, { children: " " }), lines.map((line, i) => (_jsxs(Text, { color: "white", children: [' ', line] }, i)))] }));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=SuccessBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SuccessBox.js","sourceRoot":"","sources":["../../../src/ux/components/SuccessBox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAOpC,MAAM,UAAU,UAAU,CAAC,EAAE,KAAK,GAAG,SAAS,EAAE,QAAQ,EAAS;IAC/D,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC9D,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IAEzD,OAAO,CACL,MAAC,GAAG,IACF,aAAa,EAAC,QAAQ,EACtB,WAAW,EAAC,QAAQ,EACpB,WAAW,EAAE,KAAK,CAAC,OAAO,EAC1B,QAAQ,EAAE,CAAC,EACX,KAAK,EAAE,KAAK,aAEZ,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAE,KAAK,CAAC,OAAO,YAC5B,KAAK,GACD,EACP,KAAC,IAAI,oBAAS,EACb,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CACtB,MAAC,IAAI,IAAS,KAAK,EAAC,OAAO,aACxB,GAAG,EACH,IAAI,KAFI,CAAC,CAGL,CACR,CAAC,IACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ValidationItem {
|
|
2
|
+
status: 'ok' | 'warn' | 'error' | 'info';
|
|
3
|
+
label: string;
|
|
4
|
+
detail?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ValidationSection {
|
|
7
|
+
title: string;
|
|
8
|
+
items: ValidationItem[];
|
|
9
|
+
}
|
|
10
|
+
interface Props {
|
|
11
|
+
repoName: string;
|
|
12
|
+
sections: ValidationSection[];
|
|
13
|
+
}
|
|
14
|
+
export declare function ValidationReport({ repoName, sections }: Props): JSX.Element;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=ValidationReport.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import { theme } from '../theme.js';
|
|
4
|
+
function StatusIcon({ status }) {
|
|
5
|
+
const map = {
|
|
6
|
+
ok: _jsx(Text, { color: theme.success, children: "\u2705" }),
|
|
7
|
+
warn: _jsx(Text, { color: theme.warning, children: "\u26A0\uFE0F " }),
|
|
8
|
+
error: _jsx(Text, { color: theme.error, children: "\u274C" }),
|
|
9
|
+
info: _jsx(Text, { color: theme.info, children: "\u2139 " }),
|
|
10
|
+
};
|
|
11
|
+
return map[status];
|
|
12
|
+
}
|
|
13
|
+
export function ValidationReport({ repoName, sections }) {
|
|
14
|
+
const width = Math.min(process.stdout.columns ?? 80, 78);
|
|
15
|
+
const divider = '─'.repeat(Math.min(width - 2, 46));
|
|
16
|
+
const allOk = sections.every((s) => s.items.every((i) => i.status === 'ok' || i.status === 'info'));
|
|
17
|
+
return (_jsxs(Box, { flexDirection: "column", width: width, children: [_jsxs(Text, { bold: true, color: "white", children: ["Validaci\u00F3n del repositorio \u2014 ", repoName] }), _jsx(Text, { color: theme.muted, children: '━'.repeat(Math.min(repoName.length + 30, width - 2)) }), _jsx(Text, { children: " " }), sections.map((sec) => (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Text, { bold: true, color: "#d1d5db", children: sec.title }), _jsx(Text, { color: theme.muted, children: divider }), sec.items.map((item, i) => (_jsxs(Box, { gap: 1, children: [_jsx(StatusIcon, { status: item.status }), _jsx(Text, { color: "white", children: item.label }), item.detail && _jsx(Text, { color: theme.muted, children: item.detail })] }, i)))] }, sec.title))), _jsx(Box, { marginTop: 1, children: allOk ? (_jsx(Text, { bold: true, color: theme.success, children: "\u2714 Sin problemas detectados" })) : (_jsx(Text, { bold: true, color: theme.warning, children: "\u26A0 Revisa los elementos marcados antes de continuar" })) })] }));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=ValidationReport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidationReport.js","sourceRoot":"","sources":["../../../src/ux/components/ValidationReport.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAkBpC,SAAS,UAAU,CAAC,EAAE,MAAM,EAAwC;IAClE,MAAM,GAAG,GAAG;QACV,EAAE,EAAE,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,OAAO,uBAAU;QACxC,IAAI,EAAE,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,OAAO,8BAAY;QAC5C,KAAK,EAAE,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,uBAAU;QACzC,IAAI,EAAE,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,IAAI,wBAAW;KACzC,CAAC;IACF,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAS;IAC5D,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IACzD,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACpD,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CACjC,CAAC,CAAC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,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACd,KAAK,CAAC,CAAC,CAAC,CACP,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAE,KAAK,CAAC,OAAO,gDAExB,CACR,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAE,KAAK,CAAC,OAAO,wEAExB,CACR,GACG,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import { theme } from '../theme.js';
|
|
4
|
+
export function WarningBox({ title = '⚠️ Atención', messages }) {
|
|
5
|
+
const lines = Array.isArray(messages) ? messages : [messages];
|
|
6
|
+
const width = Math.min(process.stdout.columns ?? 80, 78);
|
|
7
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "double", borderColor: theme.warning, paddingX: 1, width: width, children: [_jsx(Text, { bold: true, color: theme.warning, children: title }), _jsx(Text, { children: " " }), lines.map((line, i) => (_jsxs(Text, { color: "white", children: [' ', line] }, i)))] }));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=WarningBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WarningBox.js","sourceRoot":"","sources":["../../../src/ux/components/WarningBox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAOpC,MAAM,UAAU,UAAU,CAAC,EAAE,KAAK,GAAG,cAAc,EAAE,QAAQ,EAAS;IACpE,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC9D,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IAEzD,OAAO,CACL,MAAC,GAAG,IACF,aAAa,EAAC,QAAQ,EACtB,WAAW,EAAC,QAAQ,EACpB,WAAW,EAAE,KAAK,CAAC,OAAO,EAC1B,QAAQ,EAAE,CAAC,EACX,KAAK,EAAE,KAAK,aAEZ,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAE,KAAK,CAAC,OAAO,YAC5B,KAAK,GACD,EACP,KAAC,IAAI,oBAAS,EACb,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CACtB,MAAC,IAAI,IAAS,KAAK,EAAC,OAAO,aACxB,GAAG,EACH,IAAI,KAFI,CAAC,CAGL,CACR,CAAC,IACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare function success(msg: string): void;
|
|
2
|
+
export declare function error(msg: string): void;
|
|
3
|
+
export declare function warning(msg: string): void;
|
|
4
|
+
export declare function info(msg: string): void;
|
|
5
|
+
export declare function secondary(msg: string): void;
|
|
6
|
+
export declare function section(title: string): void;
|
|
7
|
+
export declare function keyValue(key: string, value: string, indent?: number): void;
|
|
8
|
+
export declare function table(rows: Array<[string, string]>): void;
|
|
9
|
+
export declare function blank(): void;
|
|
10
|
+
export declare function header(title: string, version: string): void;
|
|
11
|
+
export declare function divider(): void;
|
|
12
|
+
export declare function printSuccess(msg: string): void;
|
|
13
|
+
export declare function printError(msg: string): void;
|
|
14
|
+
export declare function printWarning(msg: string): void;
|
|
15
|
+
export declare function printInfo(msg: string): void;
|
|
16
|
+
export declare function printSection(title: string): void;
|
|
17
|
+
export declare function printItem(status: 'ok' | 'warn' | 'error' | 'info', label: string, value?: string): void;
|
|
18
|
+
export declare function printErrorBox(title: string, ...lines: string[]): void;
|
|
19
|
+
export declare function printSuccessBox(title: string, ...lines: string[]): void;
|
|
20
|
+
export declare function printWarningBox(title: string, ...lines: string[]): void;
|
|
21
|
+
//# sourceMappingURL=display.d.ts.map
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import boxen from 'boxen';
|
|
3
|
+
// ── Legacy helpers (backward-compatible with existing commands) ────────────
|
|
4
|
+
export function success(msg) {
|
|
5
|
+
console.log(chalk.green('✔ ' + msg));
|
|
6
|
+
}
|
|
7
|
+
export function error(msg) {
|
|
8
|
+
console.error(chalk.red('✖ ' + msg));
|
|
9
|
+
}
|
|
10
|
+
export function warning(msg) {
|
|
11
|
+
console.warn(chalk.yellow('⚠ ' + msg));
|
|
12
|
+
}
|
|
13
|
+
export function info(msg) {
|
|
14
|
+
console.log(chalk.blue('ℹ ' + msg));
|
|
15
|
+
}
|
|
16
|
+
export function secondary(msg) {
|
|
17
|
+
console.log(chalk.gray(msg));
|
|
18
|
+
}
|
|
19
|
+
export function section(title) {
|
|
20
|
+
console.log('\n' + chalk.bold.cyan('── ' + title + ' ──'));
|
|
21
|
+
}
|
|
22
|
+
export function keyValue(key, value, indent = 0) {
|
|
23
|
+
const pad = ' '.repeat(indent);
|
|
24
|
+
console.log(`${pad}${chalk.gray(key + ':')} ${chalk.white(value)}`);
|
|
25
|
+
}
|
|
26
|
+
export function table(rows) {
|
|
27
|
+
const maxKey = Math.max(...rows.map(([k]) => k.length));
|
|
28
|
+
for (const [k, v] of rows) {
|
|
29
|
+
console.log(` ${chalk.gray(k.padEnd(maxKey))} ${chalk.white(v)}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export function blank() {
|
|
33
|
+
console.log();
|
|
34
|
+
}
|
|
35
|
+
export function header(title, version) {
|
|
36
|
+
console.log(chalk.bold.cyan(`\n Git Smart Flow ${chalk.white(`v${version}`)}\n`));
|
|
37
|
+
if (title)
|
|
38
|
+
console.log(chalk.gray(` ${title}\n`));
|
|
39
|
+
}
|
|
40
|
+
export function divider() {
|
|
41
|
+
console.log(chalk.gray('─'.repeat(50)));
|
|
42
|
+
}
|
|
43
|
+
// ── New semantic helpers (for CI/pipe-safe output) ─────────────────────────
|
|
44
|
+
export function printSuccess(msg) {
|
|
45
|
+
console.log(chalk.green('✔') + ' ' + msg);
|
|
46
|
+
}
|
|
47
|
+
export function printError(msg) {
|
|
48
|
+
console.error(chalk.red('✖') + ' ' + msg);
|
|
49
|
+
}
|
|
50
|
+
export function printWarning(msg) {
|
|
51
|
+
console.warn(chalk.yellow('⚠') + ' ' + msg);
|
|
52
|
+
}
|
|
53
|
+
export function printInfo(msg) {
|
|
54
|
+
console.log(chalk.blue('ℹ') + ' ' + msg);
|
|
55
|
+
}
|
|
56
|
+
export function printSection(title) {
|
|
57
|
+
const width = Math.min(process.stdout.columns ?? 80, 80);
|
|
58
|
+
const line = '─'.repeat(Math.max(0, width - title.length - 4));
|
|
59
|
+
console.log('\n' + chalk.bold(title) + ' ' + chalk.gray(line));
|
|
60
|
+
}
|
|
61
|
+
export function printItem(status, label, value) {
|
|
62
|
+
const icons = {
|
|
63
|
+
ok: chalk.green('✅'),
|
|
64
|
+
warn: chalk.yellow('⚠️ '),
|
|
65
|
+
error: chalk.red('❌'),
|
|
66
|
+
info: chalk.blue('──'),
|
|
67
|
+
};
|
|
68
|
+
const icon = icons[status];
|
|
69
|
+
const val = value ? ' ' + chalk.gray(value) : '';
|
|
70
|
+
console.log(` ${icon} ${label}${val}`);
|
|
71
|
+
}
|
|
72
|
+
export function printErrorBox(title, ...lines) {
|
|
73
|
+
const content = lines.join('\n');
|
|
74
|
+
console.error(boxen(`${chalk.bold.red(title)}\n\n${content}`, {
|
|
75
|
+
padding: 1,
|
|
76
|
+
borderStyle: 'double',
|
|
77
|
+
borderColor: 'red',
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
export function printSuccessBox(title, ...lines) {
|
|
81
|
+
const content = lines.join('\n');
|
|
82
|
+
console.log(boxen(`${chalk.bold.green(title)}\n\n${content}`, {
|
|
83
|
+
padding: 1,
|
|
84
|
+
borderStyle: 'double',
|
|
85
|
+
borderColor: 'green',
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
export function printWarningBox(title, ...lines) {
|
|
89
|
+
const content = lines.join('\n');
|
|
90
|
+
console.warn(boxen(`${chalk.bold.yellow(title)}\n\n${content}`, {
|
|
91
|
+
padding: 1,
|
|
92
|
+
borderStyle: 'double',
|
|
93
|
+
borderColor: 'yellow',
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=display.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display.js","sourceRoot":"","sources":["../../src/ux/display.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,8EAA8E;AAE9E,MAAM,UAAU,OAAO,CAAC,GAAW;IACjC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC;AACvC,CAAC;AACD,MAAM,UAAU,KAAK,CAAC,GAAW;IAC/B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC;AACvC,CAAC;AACD,MAAM,UAAU,OAAO,CAAC,GAAW;IACjC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC;AACzC,CAAC;AACD,MAAM,UAAU,IAAI,CAAC,GAAW;IAC9B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC;AACtC,CAAC;AACD,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,OAAO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AO,EAAE,CAAC;QACV,WAAW,EAAE,QAAQ;QACrB,WAAW,EAAE,OAAO;KACrB,CAAC,CACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAa,EAAE,GAAG,KAAe;IAC/D,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,CAAC,IAAI,CACV,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,OAAO,EAAE,EAAE;QACjD,OAAO,EAAE,CAAC;QACV,WAAW,EAAE,QAAQ;QACrB,WAAW,EAAE,QAAQ;KACtB,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true after delayMs, false until then.
|
|
3
|
+
* Apply as `isDisabled={!isActive}` on any @inkjs/ui interactive component
|
|
4
|
+
* to prevent ghost key events from a previous Ink render from triggering
|
|
5
|
+
* actions immediately after mounting.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useActivation(delayMs?: number): boolean;
|
|
8
|
+
//# sourceMappingURL=useActivation.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Returns true after delayMs, false until then.
|
|
4
|
+
* Apply as `isDisabled={!isActive}` on any @inkjs/ui interactive component
|
|
5
|
+
* to prevent ghost key events from a previous Ink render from triggering
|
|
6
|
+
* actions immediately after mounting.
|
|
7
|
+
*/
|
|
8
|
+
export function useActivation(delayMs = 120) {
|
|
9
|
+
const [active, setActive] = useState(false);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const t = setTimeout(() => setActive(true), delayMs);
|
|
12
|
+
return () => clearTimeout(t);
|
|
13
|
+
}, []);
|
|
14
|
+
return active;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=useActivation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActivation.js","sourceRoot":"","sources":["../../../src/ux/hooks/useActivation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,OAAO,GAAG,GAAG;IACzC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5C,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,CAAC,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;QACrD,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
const FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
3
|
+
export function useSpinner(message, active = true) {
|
|
4
|
+
const [frame, setFrame] = useState(0);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
if (!active)
|
|
7
|
+
return;
|
|
8
|
+
const id = setInterval(() => setFrame((f) => (f + 1) % FRAMES.length), 80);
|
|
9
|
+
return () => clearInterval(id);
|
|
10
|
+
}, [active]);
|
|
11
|
+
return `${FRAMES[frame]} ${message}`;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=useSpinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSpinner.js","sourceRoot":"","sources":["../../../src/ux/hooks/useSpinner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAElE,MAAM,UAAU,UAAU,CAAC,OAAe,EAAE,MAAM,GAAG,IAAI;IACvD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEtC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;QAC3E,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,OAAO,EAAE,CAAC;AACvC,CAAC"}
|
package/dist/ux/menu.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { isCI } from './renderer.js';
|
|
2
|
+
export async function showMenu(title, items) {
|
|
3
|
+
if (isCI()) {
|
|
4
|
+
return plainShowMenu(title, items);
|
|
5
|
+
}
|
|
6
|
+
return inkShowMenu(title, items);
|
|
7
|
+
}
|
|
8
|
+
async function inkShowMenu(title, items) {
|
|
9
|
+
const React = (await import('react')).default;
|
|
10
|
+
const { useState, useEffect } = await import('react');
|
|
11
|
+
const { Box, Text } = await import('ink');
|
|
12
|
+
const { Select } = await import('@inkjs/ui');
|
|
13
|
+
const { renderInteractive } = await import('./renderer.js');
|
|
14
|
+
const { theme } = await import('./theme.js');
|
|
15
|
+
const options = items.map((i) => ({ label: i.label, value: i.key }));
|
|
16
|
+
const selectedKey = await renderInteractive((resolve) => {
|
|
17
|
+
function MenuUI() {
|
|
18
|
+
const [active, setActive] = useState(false);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const t = setTimeout(() => setActive(true), 120);
|
|
21
|
+
return () => clearTimeout(t);
|
|
22
|
+
}, []);
|
|
23
|
+
return React.createElement(Box, { flexDirection: 'column', paddingX: 1 }, React.createElement(Text, { bold: true, color: 'white' }, title), React.createElement(Text), React.createElement(Select, { isDisabled: !active, options, onChange: resolve }), React.createElement(Text, { color: theme.muted }, ' ↑↓ navegar Enter seleccionar'));
|
|
24
|
+
}
|
|
25
|
+
return React.createElement(MenuUI, null);
|
|
26
|
+
});
|
|
27
|
+
const selected = items.find((i) => i.key === selectedKey);
|
|
28
|
+
if (selected)
|
|
29
|
+
await selected.action();
|
|
30
|
+
}
|
|
31
|
+
async function plainShowMenu(title, items) {
|
|
32
|
+
const chalk = (await import('chalk')).default;
|
|
33
|
+
const { createInterface } = await import('readline');
|
|
34
|
+
console.log(`\n${chalk.bold(title)}\n`);
|
|
35
|
+
for (const item of items) {
|
|
36
|
+
console.log(` ${chalk.cyan(item.key)}. ${item.label}`);
|
|
37
|
+
}
|
|
38
|
+
return new Promise((resolve) => {
|
|
39
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
40
|
+
rl.question('\n' + chalk.gray('Select option: '), (answer) => {
|
|
41
|
+
rl.close();
|
|
42
|
+
const selected = items.find((i) => i.key === answer.trim());
|
|
43
|
+
if (selected) {
|
|
44
|
+
void selected
|
|
45
|
+
.action()
|
|
46
|
+
.then(resolve)
|
|
47
|
+
.catch(() => resolve());
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
console.log(chalk.yellow('Invalid option.'));
|
|
51
|
+
resolve();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=menu.js.map
|