repomind 0.14.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1002 -502
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -55614,14 +55614,14 @@ var require_react_reconciler_production = __commonJS({
55614
55614
  }
55615
55615
  var exports2 = {};
55616
55616
  "use strict";
55617
- var React40 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
55617
+ var React41 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
55618
55618
  Symbol.for("react.scope");
55619
55619
  var REACT_ACTIVITY_TYPE = Symbol.for("react.activity");
55620
55620
  Symbol.for("react.legacy_hidden");
55621
55621
  Symbol.for("react.tracing_marker");
55622
55622
  var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
55623
55623
  Symbol.for("react.view_transition");
55624
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React40.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance = $$$config.createInstance;
55624
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React41.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance = $$$config.createInstance;
55625
55625
  $$$config.cloneMutableInstance;
55626
55626
  var appendInitialChild = $$$config.appendInitialChild, finalizeInitialChildren = $$$config.finalizeInitialChildren, shouldSetTextContent = $$$config.shouldSetTextContent, createTextInstance = $$$config.createTextInstance;
55627
55627
  $$$config.cloneMutableTextInstance;
@@ -68214,14 +68214,14 @@ var require_react_reconciler_development = __commonJS({
68214
68214
  }
68215
68215
  var exports2 = {};
68216
68216
  "use strict";
68217
- var React40 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
68217
+ var React41 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
68218
68218
  Symbol.for("react.scope");
68219
68219
  var REACT_ACTIVITY_TYPE = Symbol.for("react.activity");
68220
68220
  Symbol.for("react.legacy_hidden");
68221
68221
  Symbol.for("react.tracing_marker");
68222
68222
  var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
68223
68223
  Symbol.for("react.view_transition");
68224
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React40.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance = $$$config.createInstance;
68224
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React41.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance = $$$config.createInstance;
68225
68225
  $$$config.cloneMutableInstance;
68226
68226
  var appendInitialChild = $$$config.appendInitialChild, finalizeInitialChildren = $$$config.finalizeInitialChildren, shouldSetTextContent = $$$config.shouldSetTextContent, createTextInstance = $$$config.createTextInstance;
68227
68227
  $$$config.cloneMutableTextInstance;
@@ -74628,18 +74628,18 @@ var require_react_jsx_runtime_development = __commonJS({
74628
74628
  function isValidElement2(object) {
74629
74629
  return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
74630
74630
  }
74631
- var React40 = require_react(), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React40.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
74631
+ var React41 = require_react(), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React41.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
74632
74632
  return null;
74633
74633
  };
74634
- React40 = {
74634
+ React41 = {
74635
74635
  react_stack_bottom_frame: function(callStackForError) {
74636
74636
  return callStackForError();
74637
74637
  }
74638
74638
  };
74639
74639
  var specialPropKeyWarningShown;
74640
74640
  var didWarnAboutElementRef = {};
74641
- var unknownOwnerDebugStack = React40.react_stack_bottom_frame.bind(
74642
- React40,
74641
+ var unknownOwnerDebugStack = React41.react_stack_bottom_frame.bind(
74642
+ React41,
74643
74643
  UnknownOwner
74644
74644
  )();
74645
74645
  var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
@@ -77453,7 +77453,7 @@ var OutdatedCliError = class extends Error {
77453
77453
  };
77454
77454
  var CLI_VERSION_HEADER = "X-RepoMind-CLI-Version";
77455
77455
  var CLI_LATEST_HEADER = "X-RepoMind-CLI-Latest";
77456
- function createApiClient(baseUrl = DEFAULT_BASE_URL2, fetchFn = fetch, cliVersion = "0.14.0") {
77456
+ function createApiClient(baseUrl = DEFAULT_BASE_URL2, fetchFn = fetch, cliVersion = "1.0.0") {
77457
77457
  let latestCliVersion = null;
77458
77458
  function baseHeaders(token) {
77459
77459
  return {
@@ -85747,7 +85747,7 @@ var import_react27 = __toESM(require_react(), 1);
85747
85747
  var import_react28 = __toESM(require_react(), 1);
85748
85748
 
85749
85749
  // src/commands/commit.ts
85750
- var import_react66 = __toESM(require_react(), 1);
85750
+ var import_react67 = __toESM(require_react(), 1);
85751
85751
 
85752
85752
  // src/lib/auth.ts
85753
85753
  import { mkdirSync, readFileSync as readFileSync3, rmSync, writeFileSync } from "node:fs";
@@ -86206,7 +86206,7 @@ async function readRepoConfig(cwd2 = process.cwd()) {
86206
86206
  function getUpdateInfo() {
86207
86207
  const latest = apiClient.getLatestCliVersion();
86208
86208
  if (!latest) return void 0;
86209
- const current = "0.14.0";
86209
+ const current = "1.0.0";
86210
86210
  return { current, latest };
86211
86211
  }
86212
86212
 
@@ -88749,8 +88749,8 @@ var import_react59 = __toESM(require_react(), 1);
88749
88749
  var import_react60 = __toESM(require_react(), 1);
88750
88750
  var cursor3 = source_default.inverse(" ");
88751
88751
 
88752
- // src/ui/commit-app.tsx
88753
- var import_react64 = __toESM(require_react(), 1);
88752
+ // src/ui/commit/commit-app.tsx
88753
+ var import_react65 = __toESM(require_react(), 1);
88754
88754
 
88755
88755
  // ../../node_modules/.bun/supports-hyperlinks@4.4.0/node_modules/supports-hyperlinks/index.js
88756
88756
  init_supports_color();
@@ -89162,7 +89162,7 @@ function deriveRepoName(remoteUrl) {
89162
89162
  return repo;
89163
89163
  }
89164
89164
 
89165
- // src/ui/commit-app.tsx
89165
+ // src/ui/commit/commit-app.tsx
89166
89166
  init_sentry();
89167
89167
 
89168
89168
  // src/ui/commit-utils.ts
@@ -89399,25 +89399,71 @@ function TypeBadge({ type }) {
89399
89399
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { backgroundColor: bg, color: fg, bold: true, children: ` ${type} ` });
89400
89400
  }
89401
89401
 
89402
- // src/ui/commit-app.tsx
89403
- var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
89404
- var STEP_LABELS = {
89405
- "parse-instructions": "Interpretando instru\xE7\xF5es",
89406
- understand: "Entendendo diff",
89407
- classify: "Classificando mudan\xE7as",
89408
- group: "Agrupando commits",
89409
- generate: "Gerando mensagem",
89410
- "fast-split": "Analisando e agrupando"
89411
- };
89412
- function CommitApp({
89402
+ // src/ui/commit/hooks/use-commit-actions.ts
89403
+ function makeCommitActions({
89413
89404
  deps,
89414
- onExit
89405
+ message,
89406
+ rawDiff,
89407
+ commitId,
89408
+ editedRef,
89409
+ streamPayload,
89410
+ setPhase,
89411
+ setErrorMsg,
89412
+ sendFeedback,
89413
+ committedMessageRef
89415
89414
  }) {
89416
- const { exit } = use_app_default();
89417
- const activeFileConfig = mergeInstructionsWithRepoConfig(
89418
- deps.fileConfig ?? {},
89419
- deps.instructionsOverride ?? null
89420
- );
89415
+ async function confirmCommit() {
89416
+ setPhase("committing");
89417
+ const code = await deps.runGitCommit(message);
89418
+ if (code !== 0) {
89419
+ setErrorMsg("git commit falhou. Verifique os hooks do repositorio.");
89420
+ setPhase("error-commit");
89421
+ return;
89422
+ }
89423
+ if (!deps.skipVerification && deps.captureCommittedDiff && deps.verifyCommitIntegrity && deps.getRepoRoot && deps.runGitReset) {
89424
+ setPhase("verifying");
89425
+ try {
89426
+ const repoRoot = await deps.getRepoRoot();
89427
+ const committedDiff = await deps.captureCommittedDiff(
89428
+ repoRoot,
89429
+ 1,
89430
+ repoRoot
89431
+ );
89432
+ const verification = deps.verifyCommitIntegrity(rawDiff, committedDiff);
89433
+ if (!verification.match) {
89434
+ await deps.runGitReset(["--soft", "HEAD~1"]);
89435
+ setErrorMsg(
89436
+ `Verificacao falhou: ${verification.details ?? "diff mismatch"}. Commit desfeito.`
89437
+ );
89438
+ setPhase("error-commit");
89439
+ return;
89440
+ }
89441
+ } catch (verifyErr) {
89442
+ const verbose2 = process.argv.includes("--verbose") || !!process.env.REPOMIND_DEBUG;
89443
+ if (verbose2) {
89444
+ console.error("[verify] Verificacao pos-commit falhou:", verifyErr);
89445
+ }
89446
+ }
89447
+ }
89448
+ if (commitId && streamPayload?.token) {
89449
+ getLastCommitHash().then(
89450
+ (hash) => deps.apiPost(`/commits/${commitId}`, { hash }, streamPayload.token)
89451
+ ).catch(() => {
89452
+ });
89453
+ }
89454
+ sendFeedback(
89455
+ editedRef.current ? "edited" : "accepted",
89456
+ editedRef.current ? message : void 0
89457
+ );
89458
+ committedMessageRef.current = message;
89459
+ setPhase("done");
89460
+ }
89461
+ return { confirmCommit };
89462
+ }
89463
+
89464
+ // src/ui/commit/hooks/use-commit-phase.ts
89465
+ var import_react64 = __toESM(require_react(), 1);
89466
+ function useCommitPhase() {
89421
89467
  const committedMessageRef = (0, import_react64.useRef)("");
89422
89468
  const lastRejectedRef = (0, import_react64.useRef)("");
89423
89469
  const flowIdRef = (0, import_react64.useRef)("");
@@ -89436,6 +89482,89 @@ function CommitApp({
89436
89482
  const [streamPayload, setStreamPayload] = (0, import_react64.useState)(
89437
89483
  null
89438
89484
  );
89485
+ return {
89486
+ // refs
89487
+ committedMessageRef,
89488
+ lastRejectedRef,
89489
+ flowIdRef,
89490
+ editedRef,
89491
+ // state
89492
+ phase,
89493
+ setPhase,
89494
+ message,
89495
+ setMessage,
89496
+ issueRef,
89497
+ setIssueRef,
89498
+ errorMsg,
89499
+ setErrorMsg,
89500
+ fileCount,
89501
+ setFileCount,
89502
+ additions,
89503
+ setAdditions,
89504
+ deletions,
89505
+ setDeletions,
89506
+ rawDiff,
89507
+ setRawDiff,
89508
+ commitId,
89509
+ setCommitId,
89510
+ confirmingAbort,
89511
+ setConfirmingAbort,
89512
+ retryCount,
89513
+ setRetryCount,
89514
+ streamPayload,
89515
+ setStreamPayload
89516
+ };
89517
+ }
89518
+
89519
+ // src/ui/commit/commit-app.tsx
89520
+ var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
89521
+ var STEP_LABELS = {
89522
+ "parse-instructions": "Interpretando instru\xE7\xF5es",
89523
+ understand: "Entendendo diff",
89524
+ classify: "Classificando mudan\xE7as",
89525
+ group: "Agrupando commits",
89526
+ generate: "Gerando mensagem",
89527
+ "fast-split": "Analisando e agrupando"
89528
+ };
89529
+ function CommitApp({
89530
+ deps,
89531
+ onExit
89532
+ }) {
89533
+ const { exit } = use_app_default();
89534
+ const activeFileConfig = mergeInstructionsWithRepoConfig(
89535
+ deps.fileConfig ?? {},
89536
+ deps.instructionsOverride ?? null
89537
+ );
89538
+ const {
89539
+ committedMessageRef,
89540
+ lastRejectedRef,
89541
+ flowIdRef,
89542
+ editedRef,
89543
+ phase,
89544
+ setPhase,
89545
+ message,
89546
+ setMessage,
89547
+ issueRef,
89548
+ setIssueRef,
89549
+ errorMsg,
89550
+ setErrorMsg,
89551
+ fileCount,
89552
+ setFileCount,
89553
+ additions,
89554
+ setAdditions,
89555
+ deletions,
89556
+ setDeletions,
89557
+ rawDiff,
89558
+ setRawDiff,
89559
+ commitId,
89560
+ setCommitId,
89561
+ confirmingAbort,
89562
+ setConfirmingAbort,
89563
+ retryCount,
89564
+ setRetryCount,
89565
+ streamPayload,
89566
+ setStreamPayload
89567
+ } = useCommitPhase();
89439
89568
  const streamOptions = streamPayload && phase === "streaming" ? {
89440
89569
  path: streamPayload.path,
89441
89570
  body: retryCount > 0 ? {
@@ -89464,7 +89593,19 @@ function CommitApp({
89464
89593
  ).catch(() => {
89465
89594
  });
89466
89595
  };
89467
- (0, import_react64.useEffect)(() => {
89596
+ const { confirmCommit } = makeCommitActions({
89597
+ deps,
89598
+ message,
89599
+ rawDiff,
89600
+ commitId,
89601
+ editedRef,
89602
+ streamPayload,
89603
+ setPhase,
89604
+ setErrorMsg,
89605
+ sendFeedback,
89606
+ committedMessageRef
89607
+ });
89608
+ (0, import_react65.useEffect)(() => {
89468
89609
  if (!TERMINAL_PHASES.includes(phase)) return;
89469
89610
  const code = phase === "done" || phase === "aborted" ? 0 : 1;
89470
89611
  exit();
@@ -89474,7 +89615,7 @@ function CommitApp({
89474
89615
  code !== 0 ? errorMsg : void 0
89475
89616
  );
89476
89617
  }, [phase]);
89477
- (0, import_react64.useEffect)(() => {
89618
+ (0, import_react65.useEffect)(() => {
89478
89619
  if (phase !== "streaming") return;
89479
89620
  if (stream.result) {
89480
89621
  setMessage(stream.result.message);
@@ -89522,7 +89663,7 @@ function CommitApp({
89522
89663
  }
89523
89664
  }
89524
89665
  }, [stream.result, stream.error, stream.errorRaw, phase]);
89525
- (0, import_react64.useEffect)(() => {
89666
+ (0, import_react65.useEffect)(() => {
89526
89667
  async function run2() {
89527
89668
  const token = deps.readToken();
89528
89669
  if (!token) {
@@ -89657,7 +89798,6 @@ ${prefixed}`);
89657
89798
  }
89658
89799
  return;
89659
89800
  }
89660
- const parsed2 = parseCommitType(message);
89661
89801
  if (input === "r") {
89662
89802
  sendFeedback("regenerated");
89663
89803
  lastRejectedRef.current = message;
@@ -89685,60 +89825,7 @@ ${prefixed}`);
89685
89825
  const confirmed = key.return || input.toLowerCase() === "y";
89686
89826
  const denied = input.toLowerCase() === "q" || input.toLowerCase() === "n";
89687
89827
  if (confirmed) {
89688
- setPhase("committing");
89689
- const code = await deps.runGitCommit(message);
89690
- if (code !== 0) {
89691
- setErrorMsg("git commit falhou. Verifique os hooks do repositorio.");
89692
- setPhase("error-commit");
89693
- return;
89694
- }
89695
- if (!deps.skipVerification && deps.captureCommittedDiff && deps.verifyCommitIntegrity && deps.getRepoRoot && deps.runGitReset) {
89696
- setPhase("verifying");
89697
- try {
89698
- const repoRoot = await deps.getRepoRoot();
89699
- const committedDiff = await deps.captureCommittedDiff(
89700
- repoRoot,
89701
- 1,
89702
- repoRoot
89703
- );
89704
- const verification = deps.verifyCommitIntegrity(
89705
- rawDiff,
89706
- committedDiff
89707
- );
89708
- if (!verification.match) {
89709
- await deps.runGitReset(["--soft", "HEAD~1"]);
89710
- setErrorMsg(
89711
- `Verificacao falhou: ${verification.details ?? "diff mismatch"}. Commit desfeito.`
89712
- );
89713
- setPhase("error-commit");
89714
- return;
89715
- }
89716
- } catch (verifyErr) {
89717
- const verbose2 = process.argv.includes("--verbose") || !!process.env.REPOMIND_DEBUG;
89718
- if (verbose2) {
89719
- console.error(
89720
- "[verify] Verificacao pos-commit falhou:",
89721
- verifyErr
89722
- );
89723
- }
89724
- }
89725
- }
89726
- if (commitId && streamPayload?.token) {
89727
- getLastCommitHash().then(
89728
- (hash) => deps.apiPost(
89729
- `/commits/${commitId}`,
89730
- { hash },
89731
- streamPayload.token
89732
- )
89733
- ).catch(() => {
89734
- });
89735
- }
89736
- sendFeedback(
89737
- editedRef.current ? "edited" : "accepted",
89738
- editedRef.current ? message : void 0
89739
- );
89740
- committedMessageRef.current = message;
89741
- setPhase("done");
89828
+ await confirmCommit();
89742
89829
  } else if (denied) {
89743
89830
  setConfirmingAbort(true);
89744
89831
  }
@@ -89916,7 +90003,7 @@ ${prefixed}`);
89916
90003
  }
89917
90004
 
89918
90005
  // src/ui/done-summary.tsx
89919
- var import_react65 = __toESM(require_react(), 1);
90006
+ var import_react66 = __toESM(require_react(), 1);
89920
90007
  var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
89921
90008
  function parseType(msg) {
89922
90009
  if (!msg) return { type: "chore", description: msg ?? "" };
@@ -89942,7 +90029,7 @@ function SplitDoneSummary({
89942
90029
  updateAvailable
89943
90030
  }) {
89944
90031
  const { exit } = use_app_default();
89945
- (0, import_react65.useEffect)(() => {
90032
+ (0, import_react66.useEffect)(() => {
89946
90033
  exit();
89947
90034
  }, []);
89948
90035
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 1, children: [
@@ -89978,7 +90065,7 @@ function CommitDoneSummary({
89978
90065
  updateAvailable
89979
90066
  }) {
89980
90067
  const { exit } = use_app_default();
89981
- (0, import_react65.useEffect)(() => {
90068
+ (0, import_react66.useEffect)(() => {
89982
90069
  exit();
89983
90070
  }, []);
89984
90071
  const { type, description } = parseType(message);
@@ -90054,7 +90141,7 @@ async function commitCommand() {
90054
90141
  let errorMessage = "";
90055
90142
  enterImmersive();
90056
90143
  const { waitUntilExit } = render_default(
90057
- import_react66.default.createElement(CommitApp, {
90144
+ import_react67.default.createElement(CommitApp, {
90058
90145
  deps: {
90059
90146
  readToken,
90060
90147
  getStagedChanges,
@@ -90085,7 +90172,7 @@ async function commitCommand() {
90085
90172
  }
90086
90173
  if (completedMessage) {
90087
90174
  const { waitUntilExit: waitUntilExit2 } = render_default(
90088
- import_react66.default.createElement(CommitDoneSummary, {
90175
+ import_react67.default.createElement(CommitDoneSummary, {
90089
90176
  message: completedMessage,
90090
90177
  updateAvailable: getUpdateInfo()
90091
90178
  })
@@ -90095,96 +90182,151 @@ async function commitCommand() {
90095
90182
  process.exit(exitCode);
90096
90183
  }
90097
90184
 
90185
+ // src/lib/open-browser.ts
90186
+ async function openBrowser(url) {
90187
+ const platform3 = process.platform;
90188
+ let args2;
90189
+ if (platform3 === "darwin") {
90190
+ args2 = ["open", url];
90191
+ } else if (platform3 === "linux") {
90192
+ args2 = ["xdg-open", url];
90193
+ } else if (platform3 === "win32") {
90194
+ args2 = ["cmd", "/c", "start", url];
90195
+ } else {
90196
+ return;
90197
+ }
90198
+ try {
90199
+ Bun.spawn(args2, { stdio: ["ignore", "ignore", "ignore"] });
90200
+ } catch {
90201
+ }
90202
+ }
90203
+
90204
+ // src/commands/dashboard.ts
90205
+ async function dashboardCommand() {
90206
+ const url = `${WEB_BASE_URL}/dashboard`;
90207
+ console.log(`Abrindo ${url}`);
90208
+ await openBrowser(url);
90209
+ }
90210
+
90098
90211
  // src/commands/help.tsx
90099
- var import_react67 = __toESM(require_react(), 1);
90212
+ var import_react68 = __toESM(require_react(), 1);
90100
90213
  var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
90101
- var COMMANDS = [
90102
- {
90103
- name: "commit",
90104
- description: "Gerar mensagem de commit com IA",
90105
- icon: "\u2726",
90106
- color: C.cyan
90107
- },
90214
+ var GROUPS = [
90108
90215
  {
90109
- name: "split",
90110
- description: "Dividir altera\xE7\xF5es em commits at\xF4micos",
90111
- icon: "\u25C8",
90112
- color: "#c084fc"
90113
- },
90114
- {
90115
- name: "login",
90116
- description: "Autenticar com sua conta RepoMind",
90117
- icon: "\u2192",
90118
- color: C.green
90216
+ label: "GERA\xC7\xC3O",
90217
+ commands: [
90218
+ {
90219
+ name: "commit",
90220
+ icon: "\u2726",
90221
+ color: C.cyan,
90222
+ description: "Mensagem de commit gerada por IA"
90223
+ },
90224
+ {
90225
+ name: "split",
90226
+ icon: "\u25C8",
90227
+ color: "#c084fc",
90228
+ description: "Divide staged em commits at\xF4micos"
90229
+ }
90230
+ ]
90119
90231
  },
90120
90232
  {
90121
- name: "logout",
90122
- description: "Encerrar sess\xE3o atual",
90123
- icon: "\u2190",
90124
- color: C.yellow
90233
+ label: "CONTA",
90234
+ commands: [
90235
+ {
90236
+ name: "login",
90237
+ icon: "\u2192",
90238
+ color: C.green,
90239
+ description: "Autenticar com sua conta RepoMind"
90240
+ },
90241
+ {
90242
+ name: "logout",
90243
+ icon: "\u2190",
90244
+ color: C.yellow,
90245
+ description: "Encerrar sess\xE3o atual"
90246
+ },
90247
+ {
90248
+ name: "whoami",
90249
+ icon: "\u25CF",
90250
+ color: C.dim,
90251
+ description: "Exibir usu\xE1rio autenticado"
90252
+ },
90253
+ {
90254
+ name: "status",
90255
+ icon: "\u25C6",
90256
+ color: C.cyan,
90257
+ description: "Plano e uso de commits"
90258
+ },
90259
+ {
90260
+ name: "dashboard",
90261
+ icon: "\u229E",
90262
+ color: C.dim,
90263
+ description: "Abrir dashboard no navegador"
90264
+ }
90265
+ ]
90125
90266
  },
90126
90267
  {
90127
- name: "whoami",
90128
- description: "Exibir usu\xE1rio autenticado",
90129
- icon: "\u25CF",
90130
- color: C.dim
90268
+ label: "PROJETO",
90269
+ commands: [
90270
+ {
90271
+ name: "init",
90272
+ icon: "\u2699",
90273
+ color: C.dim,
90274
+ description: "Criar .repomind.json no diret\xF3rio"
90275
+ }
90276
+ ]
90131
90277
  }
90132
90278
  ];
90279
+ function Rule() {
90280
+ const cols = Math.max(20, (process.stdout.columns ?? 80) - 3);
90281
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: "\u2500".repeat(cols) });
90282
+ }
90283
+ function SectionLabel({ label }) {
90284
+ const cols = Math.max(20, (process.stdout.columns ?? 80) - 3);
90285
+ const dashes = Math.max(0, cols - label.length - 3);
90286
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { gap: 1, children: [
90287
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, bold: true, children: label }),
90288
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: "\u2500".repeat(dashes) })
90289
+ ] });
90290
+ }
90133
90291
  function HelpApp() {
90134
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", children: [
90292
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
90135
90293
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Header, { title: "RepoMind" }),
90136
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { flexDirection: "column", gap: 0, marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { paddingLeft: 1, gap: 1, children: [
90137
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: "Uso:" }),
90138
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { bold: true, children: "repomind" }),
90139
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.cyan, children: "<comando>" }),
90294
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { paddingLeft: 2, paddingTop: 1, paddingBottom: 1, gap: 1, children: [
90295
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: "repomind" }),
90296
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.cyan, bold: true, children: "<comando>" }),
90140
90297
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: "[op\xE7\xF5es]" })
90141
- ] }) }),
90142
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
90143
- Box_default,
90144
- {
90145
- flexDirection: "column",
90146
- paddingLeft: 1,
90147
- marginBottom: 1,
90148
- borderStyle: "round",
90149
- borderColor: C.dim,
90150
- paddingX: 2,
90151
- paddingY: 0,
90152
- children: COMMANDS.map((cmd) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { gap: 1, children: [
90153
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: cmd.color, children: cmd.icon }),
90154
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { width: 10, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { bold: true, color: cmd.color, children: cmd.name }) }),
90155
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: cmd.description })
90156
- ] }, cmd.name))
90157
- }
90158
- ),
90159
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { paddingLeft: 1, flexDirection: "column", gap: 0, children: [
90160
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { gap: 1, children: [
90161
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { backgroundColor: C.grayBg, color: C.white, bold: true, children: [
90162
- " ",
90163
- "--version",
90164
- " "
90165
- ] }),
90166
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: "Exibir vers\xE3o instalada" })
90167
- ] }),
90168
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { gap: 1, children: [
90169
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { backgroundColor: C.grayBg, color: C.white, bold: true, children: [
90170
- " ",
90171
- "--verbose",
90172
- " "
90173
- ] }),
90174
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: "Exibir detalhes de erro" })
90175
- ] })
90176
90298
  ] }),
90177
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { marginTop: 1, paddingLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { color: C.dim, children: [
90178
- "Docs: ",
90179
- WEB_BASE_URL,
90180
- " \xB7 Dashboard: ",
90181
- WEB_BASE_URL,
90182
- "/dashboard"
90183
- ] }) })
90299
+ GROUPS.map((group) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
90300
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SectionLabel, { label: group.label }) }),
90301
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { flexDirection: "column", paddingLeft: 2, paddingTop: 1, children: group.commands.map((cmd) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { gap: 2, children: [
90302
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: cmd.color, children: cmd.icon }),
90303
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { width: 12, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { bold: true, color: cmd.color, children: cmd.name }) }),
90304
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: cmd.description })
90305
+ ] }, cmd.name)) })
90306
+ ] }, group.label)),
90307
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { paddingLeft: 2, paddingTop: 0, paddingBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Rule, {}) }),
90308
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { paddingLeft: 2, gap: 2, children: [
90309
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: "git add ." }),
90310
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: "\u2192" }),
90311
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.cyan, bold: true, children: "repomind commit" }),
90312
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: "\u2192" }),
90313
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: "git push" })
90314
+ ] }),
90315
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box_default, { paddingLeft: 2, paddingTop: 1, paddingBottom: 0, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Rule, {}) }),
90316
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box_default, { paddingLeft: 2, paddingTop: 1, gap: 2, children: [
90317
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: "--version" }),
90318
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: "\xB7" }),
90319
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Text, { color: C.dim, children: [
90320
+ "<cmd>",
90321
+ " --help"
90322
+ ] }),
90323
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: "\xB7" }),
90324
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { color: C.dim, children: WEB_BASE_URL })
90325
+ ] })
90184
90326
  ] });
90185
90327
  }
90186
90328
  async function helpCommand() {
90187
- const { waitUntilExit } = render_default(import_react67.default.createElement(HelpApp));
90329
+ const { waitUntilExit } = render_default(import_react68.default.createElement(HelpApp));
90188
90330
  setTimeout(() => process.exit(0), 50);
90189
90331
  await waitUntilExit();
90190
90332
  }
@@ -90192,7 +90334,7 @@ async function helpCommand() {
90192
90334
  // src/commands/init.ts
90193
90335
  import { access, writeFile as writeFile2 } from "node:fs/promises";
90194
90336
  import { join as join8 } from "node:path";
90195
- var import_react69 = __toESM(require_react(), 1);
90337
+ var import_react70 = __toESM(require_react(), 1);
90196
90338
 
90197
90339
  // src/lib/init-config.ts
90198
90340
  import { readFile as readFile3, writeFile } from "node:fs/promises";
@@ -90279,7 +90421,7 @@ var LANGUAGE_OPTIONS = SUPPORTED_LANGUAGES.map((code) => ({
90279
90421
  }));
90280
90422
 
90281
90423
  // src/ui/init-app.tsx
90282
- var import_react68 = __toESM(require_react(), 1);
90424
+ var import_react69 = __toESM(require_react(), 1);
90283
90425
  var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
90284
90426
  function SelectList({
90285
90427
  items,
@@ -90310,19 +90452,19 @@ function InitApp({
90310
90452
  onExit
90311
90453
  }) {
90312
90454
  const { exit } = use_app_default();
90313
- const [overwriteConfirmed, setOverwriteConfirmed] = (0, import_react68.useState)(!alreadyExists);
90455
+ const [overwriteConfirmed, setOverwriteConfirmed] = (0, import_react69.useState)(!alreadyExists);
90314
90456
  const langCodes = LANGUAGE_OPTIONS.map((l) => l.code);
90315
- const [langIndex, setLangIndex] = (0, import_react68.useState)(0);
90316
- const [body, setBody] = (0, import_react68.useState)(null);
90317
- const [footer, setFooter] = (0, import_react68.useState)(null);
90318
- const [breaking, setBreaking] = (0, import_react68.useState)(null);
90319
- const [addToGitignore, setAddToGitignore] = (0, import_react68.useState)(null);
90320
- const [boolCursor, setBoolCursor] = (0, import_react68.useState)(true);
90321
- const [step, setStep] = (0, import_react68.useState)("language");
90322
- const [writing, setWriting] = (0, import_react68.useState)(false);
90323
- const [written, setWritten] = (0, import_react68.useState)(false);
90324
- const [error4, setError] = (0, import_react68.useState)(null);
90325
- const [askOverwrite, setAskOverwrite] = (0, import_react68.useState)(alreadyExists);
90457
+ const [langIndex, setLangIndex] = (0, import_react69.useState)(0);
90458
+ const [body, setBody] = (0, import_react69.useState)(null);
90459
+ const [footer, setFooter] = (0, import_react69.useState)(null);
90460
+ const [breaking, setBreaking] = (0, import_react69.useState)(null);
90461
+ const [addToGitignore, setAddToGitignore] = (0, import_react69.useState)(null);
90462
+ const [boolCursor, setBoolCursor] = (0, import_react69.useState)(true);
90463
+ const [step, setStep] = (0, import_react69.useState)("language");
90464
+ const [writing, setWriting] = (0, import_react69.useState)(false);
90465
+ const [written, setWritten] = (0, import_react69.useState)(false);
90466
+ const [error4, setError] = (0, import_react69.useState)(null);
90467
+ const [askOverwrite, setAskOverwrite] = (0, import_react69.useState)(alreadyExists);
90326
90468
  function advanceBool(setter, next) {
90327
90469
  setter(boolCursor);
90328
90470
  setBoolCursor(true);
@@ -90537,7 +90679,7 @@ async function initCommand() {
90537
90679
  const alreadyExists = await fileExists(configPath);
90538
90680
  let exitCode = 0;
90539
90681
  const { waitUntilExit } = render_default(
90540
- import_react69.default.createElement(InitApp, {
90682
+ import_react70.default.createElement(InitApp, {
90541
90683
  alreadyExists,
90542
90684
  onWrite: async (config3, options) => {
90543
90685
  await writeFile2(
@@ -90562,35 +90704,16 @@ async function initCommand() {
90562
90704
  process.exit(exitCode);
90563
90705
  }
90564
90706
 
90565
- // src/lib/open-browser.ts
90566
- async function openBrowser(url) {
90567
- const platform3 = process.platform;
90568
- let args2;
90569
- if (platform3 === "darwin") {
90570
- args2 = ["open", url];
90571
- } else if (platform3 === "linux") {
90572
- args2 = ["xdg-open", url];
90573
- } else if (platform3 === "win32") {
90574
- args2 = ["cmd", "/c", "start", url];
90575
- } else {
90576
- return;
90577
- }
90578
- try {
90579
- Bun.spawn(args2, { stdio: ["ignore", "ignore", "ignore"] });
90580
- } catch {
90581
- }
90582
- }
90583
-
90584
90707
  // src/commands/login.ts
90585
- var import_react72 = __toESM(require_react(), 1);
90708
+ var import_react73 = __toESM(require_react(), 1);
90586
90709
 
90587
90710
  // ../../node_modules/.bun/ink-spinner@5.0.0+4d0808a67a30d5ab/node_modules/ink-spinner/build/index.js
90588
- var import_react70 = __toESM(require_react(), 1);
90711
+ var import_react71 = __toESM(require_react(), 1);
90589
90712
  var import_cli_spinners2 = __toESM(require_cli_spinners(), 1);
90590
90713
  function Spinner2({ type = "dots" }) {
90591
- const [frame, setFrame] = (0, import_react70.useState)(0);
90714
+ const [frame, setFrame] = (0, import_react71.useState)(0);
90592
90715
  const spinner = import_cli_spinners2.default[type];
90593
- (0, import_react70.useEffect)(() => {
90716
+ (0, import_react71.useEffect)(() => {
90594
90717
  const timer = setInterval(() => {
90595
90718
  setFrame((previousFrame) => {
90596
90719
  const isLastFrame = previousFrame === spinner.frames.length - 1;
@@ -90601,12 +90724,12 @@ function Spinner2({ type = "dots" }) {
90601
90724
  clearInterval(timer);
90602
90725
  };
90603
90726
  }, [spinner]);
90604
- return import_react70.default.createElement(Text, null, spinner.frames[frame]);
90727
+ return import_react71.default.createElement(Text, null, spinner.frames[frame]);
90605
90728
  }
90606
90729
  var build_default = Spinner2;
90607
90730
 
90608
90731
  // src/ui/login-app.tsx
90609
- var import_react71 = __toESM(require_react(), 1);
90732
+ var import_react72 = __toESM(require_react(), 1);
90610
90733
  var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
90611
90734
  var TERMINAL_PHASES2 = ["done", "error"];
90612
90735
  function LoginApp({
@@ -90617,19 +90740,19 @@ function LoginApp({
90617
90740
  onExit
90618
90741
  }) {
90619
90742
  const { exit } = use_app_default();
90620
- const [phase, setPhase] = (0, import_react71.useState)("init");
90621
- const [userCode, setUserCode] = (0, import_react71.useState)("");
90622
- const [verificationUrl, setVerificationUrl] = (0, import_react71.useState)("");
90623
- const [email, setEmail] = (0, import_react71.useState)("");
90624
- const [tokenName, setTokenName] = (0, import_react71.useState)(null);
90625
- const [errorMsg, setErrorMsg] = (0, import_react71.useState)("");
90626
- (0, import_react71.useEffect)(() => {
90743
+ const [phase, setPhase] = (0, import_react72.useState)("init");
90744
+ const [userCode, setUserCode] = (0, import_react72.useState)("");
90745
+ const [verificationUrl, setVerificationUrl] = (0, import_react72.useState)("");
90746
+ const [email, setEmail] = (0, import_react72.useState)("");
90747
+ const [tokenName, setTokenName] = (0, import_react72.useState)(null);
90748
+ const [errorMsg, setErrorMsg] = (0, import_react72.useState)("");
90749
+ (0, import_react72.useEffect)(() => {
90627
90750
  if (!TERMINAL_PHASES2.includes(phase)) return;
90628
90751
  const code = phase === "done" ? 0 : 1;
90629
90752
  exit();
90630
90753
  onExit(code);
90631
90754
  }, [phase]);
90632
- (0, import_react71.useEffect)(() => {
90755
+ (0, import_react72.useEffect)(() => {
90633
90756
  if (tokenArg) {
90634
90757
  runTokenLogin();
90635
90758
  } else {
@@ -90752,7 +90875,7 @@ async function loginCommand() {
90752
90875
  const noBrowser = process.argv.includes("--no-browser");
90753
90876
  let exitCode = 0;
90754
90877
  const { waitUntilExit } = render_default(
90755
- import_react72.default.createElement(LoginApp, {
90878
+ import_react73.default.createElement(LoginApp, {
90756
90879
  deps: {
90757
90880
  apiPost: (path2, body) => apiClient2.post(path2, body),
90758
90881
  apiGet: (path2, token) => apiClient2.get(path2, token),
@@ -90773,12 +90896,12 @@ async function loginCommand() {
90773
90896
  }
90774
90897
 
90775
90898
  // src/commands/logout.tsx
90776
- var import_react73 = __toESM(require_react(), 1);
90899
+ var import_react74 = __toESM(require_react(), 1);
90777
90900
  var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
90778
90901
  function LogoutApp({ onExit }) {
90779
90902
  const wasLoggedIn = readToken() !== null;
90780
90903
  const deleted = deleteToken();
90781
- (0, import_react73.useEffect)(() => {
90904
+ (0, import_react74.useEffect)(() => {
90782
90905
  onExit(0);
90783
90906
  }, [onExit]);
90784
90907
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Box_default, { flexDirection: "column", paddingTop: 1, marginBottom: 1, children: [
@@ -90795,7 +90918,7 @@ function LogoutApp({ onExit }) {
90795
90918
  async function logoutCommand() {
90796
90919
  let exitCode = 0;
90797
90920
  const { waitUntilExit } = render_default(
90798
- import_react73.default.createElement(LogoutApp, {
90921
+ import_react74.default.createElement(LogoutApp, {
90799
90922
  onExit: (code) => {
90800
90923
  exitCode = code;
90801
90924
  }
@@ -90806,10 +90929,10 @@ async function logoutCommand() {
90806
90929
  }
90807
90930
 
90808
90931
  // src/commands/pr.ts
90809
- var import_react75 = __toESM(require_react(), 1);
90932
+ var import_react76 = __toESM(require_react(), 1);
90810
90933
 
90811
90934
  // src/ui/pr-app.tsx
90812
- var import_react74 = __toESM(require_react(), 1);
90935
+ var import_react75 = __toESM(require_react(), 1);
90813
90936
  init_sentry();
90814
90937
  var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
90815
90938
  var TERMINAL_PHASES3 = [
@@ -90838,18 +90961,18 @@ function PrApp({
90838
90961
  onExit
90839
90962
  }) {
90840
90963
  const { exit } = use_app_default();
90841
- const [phase, setPhase] = (0, import_react74.useState)("collecting");
90842
- const [prTitle, setPrTitle] = (0, import_react74.useState)("");
90843
- const [prBody, setPrBody] = (0, import_react74.useState)("");
90844
- const [errorMsg, setErrorMsg] = (0, import_react74.useState)("");
90845
- (0, import_react74.useEffect)(() => {
90964
+ const [phase, setPhase] = (0, import_react75.useState)("collecting");
90965
+ const [prTitle, setPrTitle] = (0, import_react75.useState)("");
90966
+ const [prBody, setPrBody] = (0, import_react75.useState)("");
90967
+ const [errorMsg, setErrorMsg] = (0, import_react75.useState)("");
90968
+ (0, import_react75.useEffect)(() => {
90846
90969
  if (!TERMINAL_PHASES3.includes(phase) && phase !== "copied" && phase !== "aborted")
90847
90970
  return;
90848
90971
  const code = phase === "copied" || phase === "aborted" ? 0 : 1;
90849
90972
  exit();
90850
90973
  onExit(code);
90851
90974
  }, [phase]);
90852
- (0, import_react74.useEffect)(() => {
90975
+ (0, import_react75.useEffect)(() => {
90853
90976
  async function run2() {
90854
90977
  const token = deps.readToken();
90855
90978
  if (!token) {
@@ -91039,7 +91162,7 @@ async function prCommand() {
91039
91162
  let exitCode = 0;
91040
91163
  enterImmersive();
91041
91164
  const { waitUntilExit } = render_default(
91042
- import_react75.default.createElement(PrApp, {
91165
+ import_react76.default.createElement(PrApp, {
91043
91166
  deps: {
91044
91167
  readToken,
91045
91168
  getDiffBetweenBranches,
@@ -91057,10 +91180,10 @@ async function prCommand() {
91057
91180
  }
91058
91181
 
91059
91182
  // src/commands/split.ts
91060
- var import_react77 = __toESM(require_react(), 1);
91183
+ var import_react80 = __toESM(require_react(), 1);
91061
91184
 
91062
- // src/ui/split-app.tsx
91063
- var import_react76 = __toESM(require_react(), 1);
91185
+ // src/ui/split/split-app.tsx
91186
+ var import_react79 = __toESM(require_react(), 1);
91064
91187
  init_sentry();
91065
91188
 
91066
91189
  // src/lib/worktree-groups.ts
@@ -91242,13 +91365,154 @@ function CommitRow(props) {
91242
91365
  ] });
91243
91366
  }
91244
91367
 
91245
- // src/ui/split-app.tsx
91246
- var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
91247
- function getCliInvocation() {
91248
- const script = process.argv[1] ?? "";
91249
- if (script.endsWith(".ts")) return "bun run repomind";
91250
- return "repomind";
91368
+ // src/ui/split/hooks/use-split-keyboard.ts
91369
+ function useSplitKeyboard({
91370
+ phase,
91371
+ groups,
91372
+ selectedIndex,
91373
+ setSelectedIndex,
91374
+ skippedGroups,
91375
+ setSkippedGroups,
91376
+ issueRef,
91377
+ setIssueRef,
91378
+ confirmingAbort,
91379
+ setConfirmingAbort,
91380
+ setPhase,
91381
+ setGroups,
91382
+ patchMap,
91383
+ authToken,
91384
+ regenRetryCount,
91385
+ setRegenGroupIndex,
91386
+ setRegenBody,
91387
+ setRegenRetryCount,
91388
+ editedAnyRef,
91389
+ activeFileConfig,
91390
+ sendFeedback,
91391
+ startCommitting
91392
+ }) {
91393
+ use_input_default(
91394
+ (input, key) => {
91395
+ if (phase !== "review") return;
91396
+ if (confirmingAbort) {
91397
+ if (input.toLowerCase() === "y") {
91398
+ sendFeedback("discarded");
91399
+ setConfirmingAbort(false);
91400
+ setPhase("aborted");
91401
+ return;
91402
+ }
91403
+ if (input.toLowerCase() === "n" || key.escape) {
91404
+ setConfirmingAbort(false);
91405
+ return;
91406
+ }
91407
+ return;
91408
+ }
91409
+ if (key.upArrow || input === "k") {
91410
+ setSelectedIndex((prev) => Math.max(0, prev - 1));
91411
+ return;
91412
+ }
91413
+ if (key.downArrow || input === "j") {
91414
+ setSelectedIndex((prev) => Math.min(groups.length - 1, prev + 1));
91415
+ return;
91416
+ }
91417
+ if (input === "d") {
91418
+ setPhase("viewing-diff");
91419
+ return;
91420
+ }
91421
+ if (input === "e") {
91422
+ editedAnyRef.current = true;
91423
+ setPhase("editing");
91424
+ return;
91425
+ }
91426
+ if (input === "r") {
91427
+ const group = groups[selectedIndex];
91428
+ if (!group || !authToken) return;
91429
+ sendFeedback("regenerated");
91430
+ const combinedPatch = group.files.map((f) => patchMap.get(f.path) ?? "").filter(Boolean).join("\n");
91431
+ const body = { diff: combinedPatch };
91432
+ if (Object.keys(activeFileConfig).length > 0) {
91433
+ body.config = activeFileConfig;
91434
+ }
91435
+ body.regeneration = {
91436
+ attempt: regenRetryCount + 1,
91437
+ previousMessage: group.message
91438
+ };
91439
+ setRegenGroupIndex(selectedIndex);
91440
+ setRegenBody(body);
91441
+ setRegenRetryCount((c) => c + 1);
91442
+ setPhase("regenerating");
91443
+ return;
91444
+ }
91445
+ if (input === "l") {
91446
+ setIssueRef(() => "");
91447
+ setPhase("link-issue");
91448
+ return;
91449
+ }
91450
+ if (input === "s") {
91451
+ const groupId = groups[selectedIndex]?.groupId;
91452
+ if (groupId) {
91453
+ setSkippedGroups((prev) => {
91454
+ const next = new Set(prev);
91455
+ if (next.has(groupId)) {
91456
+ next.delete(groupId);
91457
+ } else {
91458
+ next.add(groupId);
91459
+ }
91460
+ return next;
91461
+ });
91462
+ }
91463
+ return;
91464
+ }
91465
+ if (key.return || input === "a") {
91466
+ startCommitting();
91467
+ return;
91468
+ }
91469
+ if (input === "q") {
91470
+ setConfirmingAbort(true);
91471
+ }
91472
+ },
91473
+ { isActive: phase === "review" }
91474
+ );
91475
+ use_input_default(
91476
+ (input, key) => {
91477
+ if (key.return) {
91478
+ const ref = issueRef.trim();
91479
+ if (ref) {
91480
+ const prefixed = /^refs:/i.test(ref) ? ref : `Refs: ${ref}`;
91481
+ setGroups((prev) => {
91482
+ const next = [...prev];
91483
+ const g = next[selectedIndex];
91484
+ if (!g) return prev;
91485
+ const body = g.body ? `${g.body}
91486
+
91487
+ ${prefixed}` : prefixed;
91488
+ const newMessage = `${g.message.split("\n\n")[0]}
91489
+
91490
+ ${body}`;
91491
+ next[selectedIndex] = { ...g, body, message: newMessage };
91492
+ return next;
91493
+ });
91494
+ }
91495
+ setPhase("review");
91496
+ return;
91497
+ }
91498
+ if (key.escape) {
91499
+ setPhase("review");
91500
+ return;
91501
+ }
91502
+ if (key.backspace || key.delete) {
91503
+ setIssueRef((prev) => prev.slice(0, -1));
91504
+ return;
91505
+ }
91506
+ if (input && !key.ctrl && !key.meta) {
91507
+ setIssueRef((prev) => prev + input);
91508
+ }
91509
+ },
91510
+ { isActive: phase === "link-issue" }
91511
+ );
91251
91512
  }
91513
+
91514
+ // src/ui/split/hooks/use-split-pipeline.ts
91515
+ var import_react77 = __toESM(require_react(), 1);
91252
91516
  var STEP_LABELS2 = {
91253
91517
  "parse-instructions": "Interpretando instru\xE7\xF5es",
91254
91518
  understand: "Entendendo altera\xE7\xF5es",
@@ -91265,6 +91529,45 @@ var COMMIT_STEP_LABELS = {
91265
91529
  generate: "Gerando mensagem",
91266
91530
  "fast-split": "Analisando e agrupando"
91267
91531
  };
91532
+ function useSplitPipeline({
91533
+ phase,
91534
+ streamPayload,
91535
+ regenBody,
91536
+ regenRetryCount,
91537
+ authToken,
91538
+ postStream
91539
+ }) {
91540
+ const streamOptions = (0, import_react77.useMemo)(
91541
+ () => streamPayload && phase === "analyzing" ? {
91542
+ path: streamPayload.path,
91543
+ body: streamPayload.body,
91544
+ token: streamPayload.token,
91545
+ postStream,
91546
+ stepLabels: STEP_LABELS2,
91547
+ timeoutMs: 3e5
91548
+ } : null,
91549
+ [streamPayload, phase, postStream]
91550
+ );
91551
+ const stream = usePipelineStream(streamOptions);
91552
+ const regenStreamOptions = (0, import_react77.useMemo)(
91553
+ () => regenBody && phase === "regenerating" ? {
91554
+ path: "/commit/generate",
91555
+ body: regenBody,
91556
+ token: authToken,
91557
+ postStream,
91558
+ stepLabels: COMMIT_STEP_LABELS,
91559
+ retryKey: regenRetryCount
91560
+ } : null,
91561
+ [regenBody, phase, authToken, postStream, regenRetryCount]
91562
+ );
91563
+ const regenStream = usePipelineStream(
91564
+ regenStreamOptions
91565
+ );
91566
+ return { stream, regenStream };
91567
+ }
91568
+
91569
+ // src/ui/split/hooks/use-split-state.ts
91570
+ var import_react78 = __toESM(require_react(), 1);
91268
91571
  var TERMINAL_PHASES4 = [
91269
91572
  "done",
91270
91573
  "aborted",
@@ -91276,6 +91579,82 @@ var TERMINAL_PHASES4 = [
91276
91579
  "error-hook",
91277
91580
  "error-commit"
91278
91581
  ];
91582
+ function useSplitState() {
91583
+ const committedMessagesRef = (0, import_react78.useRef)([]);
91584
+ const flowIdRef = (0, import_react78.useRef)("");
91585
+ const editedAnyRef = (0, import_react78.useRef)(false);
91586
+ const [phase, setPhase] = (0, import_react78.useState)("collecting");
91587
+ const [groups, setGroups] = (0, import_react78.useState)([]);
91588
+ const [selectedIndex, setSelectedIndex] = (0, import_react78.useState)(0);
91589
+ const [skippedGroups, setSkippedGroups] = (0, import_react78.useState)(/* @__PURE__ */ new Set());
91590
+ const [commitProgress, setCommitProgress] = (0, import_react78.useState)(0);
91591
+ const [errorMsg, setErrorMsg] = (0, import_react78.useState)("");
91592
+ const [orphanCount, setOrphanCount] = (0, import_react78.useState)(0);
91593
+ const [originalFiles, setOriginalFiles] = (0, import_react78.useState)([]);
91594
+ const [hunksMap, setHunksMap] = (0, import_react78.useState)(/* @__PURE__ */ new Map());
91595
+ const [patchMap, setPatchMap] = (0, import_react78.useState)(/* @__PURE__ */ new Map());
91596
+ const [authToken, setAuthToken] = (0, import_react78.useState)("");
91597
+ const [originalRawDiff, setOriginalRawDiff] = (0, import_react78.useState)("");
91598
+ const [issueRef, setIssueRef] = (0, import_react78.useState)("");
91599
+ const [confirmingAbort, setConfirmingAbort] = (0, import_react78.useState)(false);
91600
+ const [regenGroupIndex, setRegenGroupIndex] = (0, import_react78.useState)(null);
91601
+ const [regenBody, setRegenBody] = (0, import_react78.useState)(null);
91602
+ const [regenRetryCount, setRegenRetryCount] = (0, import_react78.useState)(0);
91603
+ const [streamPayload, setStreamPayload] = (0, import_react78.useState)(
91604
+ null
91605
+ );
91606
+ return {
91607
+ // refs
91608
+ committedMessagesRef,
91609
+ flowIdRef,
91610
+ editedAnyRef,
91611
+ // state
91612
+ phase,
91613
+ setPhase,
91614
+ groups,
91615
+ setGroups,
91616
+ selectedIndex,
91617
+ setSelectedIndex,
91618
+ skippedGroups,
91619
+ setSkippedGroups,
91620
+ commitProgress,
91621
+ setCommitProgress,
91622
+ errorMsg,
91623
+ setErrorMsg,
91624
+ orphanCount,
91625
+ setOrphanCount,
91626
+ originalFiles,
91627
+ setOriginalFiles,
91628
+ hunksMap,
91629
+ setHunksMap,
91630
+ patchMap,
91631
+ setPatchMap,
91632
+ authToken,
91633
+ setAuthToken,
91634
+ originalRawDiff,
91635
+ setOriginalRawDiff,
91636
+ issueRef,
91637
+ setIssueRef,
91638
+ confirmingAbort,
91639
+ setConfirmingAbort,
91640
+ regenGroupIndex,
91641
+ setRegenGroupIndex,
91642
+ regenBody,
91643
+ setRegenBody,
91644
+ regenRetryCount,
91645
+ setRegenRetryCount,
91646
+ streamPayload,
91647
+ setStreamPayload
91648
+ };
91649
+ }
91650
+
91651
+ // src/ui/split/split-app.tsx
91652
+ var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
91653
+ function getCliInvocation() {
91654
+ const script = process.argv[1] ?? "";
91655
+ if (script.endsWith(".ts")) return "bun run repomind";
91656
+ return "repomind";
91657
+ }
91279
91658
  function computeGroupStats(files, originalFiles) {
91280
91659
  let additions = 0;
91281
91660
  let deletions = 0;
@@ -91301,55 +91680,56 @@ function SplitApp({
91301
91680
  deps.fileConfig ?? {},
91302
91681
  deps.instructionsOverride ?? null
91303
91682
  );
91304
- const committedMessagesRef = (0, import_react76.useRef)([]);
91305
- const [phase, setPhase] = (0, import_react76.useState)("collecting");
91306
- const [groups, setGroups] = (0, import_react76.useState)([]);
91307
- const [selectedIndex, setSelectedIndex] = (0, import_react76.useState)(0);
91308
- const [skippedGroups, setSkippedGroups] = (0, import_react76.useState)(/* @__PURE__ */ new Set());
91309
- const [commitProgress, setCommitProgress] = (0, import_react76.useState)(0);
91310
- const [errorMsg, setErrorMsg] = (0, import_react76.useState)("");
91311
- const [orphanCount, setOrphanCount] = (0, import_react76.useState)(0);
91312
- const [originalFiles, setOriginalFiles] = (0, import_react76.useState)([]);
91313
- const [hunksMap, setHunksMap] = (0, import_react76.useState)(/* @__PURE__ */ new Map());
91314
- const [patchMap, setPatchMap] = (0, import_react76.useState)(/* @__PURE__ */ new Map());
91315
- const [authToken, setAuthToken] = (0, import_react76.useState)("");
91316
- const [originalRawDiff, setOriginalRawDiff] = (0, import_react76.useState)("");
91317
- const [issueRef, setIssueRef] = (0, import_react76.useState)("");
91318
- const [confirmingAbort, setConfirmingAbort] = (0, import_react76.useState)(false);
91319
- const [regenGroupIndex, setRegenGroupIndex] = (0, import_react76.useState)(null);
91320
- const [regenBody, setRegenBody] = (0, import_react76.useState)(null);
91321
- const [regenRetryCount, setRegenRetryCount] = (0, import_react76.useState)(0);
91322
- const flowIdRef = (0, import_react76.useRef)("");
91323
- const editedAnyRef = (0, import_react76.useRef)(false);
91324
- const [streamPayload, setStreamPayload] = (0, import_react76.useState)(
91325
- null
91326
- );
91327
- const streamOptions = (0, import_react76.useMemo)(
91328
- () => streamPayload && phase === "analyzing" ? {
91329
- path: streamPayload.path,
91330
- body: streamPayload.body,
91331
- token: streamPayload.token,
91332
- postStream: deps.postStream,
91333
- stepLabels: STEP_LABELS2,
91334
- timeoutMs: 3e5
91335
- } : null,
91336
- [streamPayload, phase, deps.postStream]
91337
- );
91338
- const stream = usePipelineStream(streamOptions);
91339
- const regenStreamOptions = (0, import_react76.useMemo)(
91340
- () => regenBody && phase === "regenerating" ? {
91341
- path: "/commit/generate",
91342
- body: regenBody,
91343
- token: authToken,
91344
- postStream: deps.postStream,
91345
- stepLabels: COMMIT_STEP_LABELS,
91346
- retryKey: regenRetryCount
91347
- } : null,
91348
- [regenBody, phase, authToken, deps.postStream, regenRetryCount]
91349
- );
91350
- const regenStream = usePipelineStream(
91351
- regenStreamOptions
91352
- );
91683
+ const state = useSplitState();
91684
+ const {
91685
+ committedMessagesRef,
91686
+ flowIdRef,
91687
+ editedAnyRef,
91688
+ phase,
91689
+ setPhase,
91690
+ groups,
91691
+ setGroups,
91692
+ selectedIndex,
91693
+ setSelectedIndex,
91694
+ skippedGroups,
91695
+ setSkippedGroups,
91696
+ commitProgress,
91697
+ setCommitProgress,
91698
+ errorMsg,
91699
+ setErrorMsg,
91700
+ orphanCount,
91701
+ setOrphanCount,
91702
+ originalFiles,
91703
+ setOriginalFiles,
91704
+ hunksMap,
91705
+ setHunksMap,
91706
+ patchMap,
91707
+ setPatchMap,
91708
+ authToken,
91709
+ setAuthToken,
91710
+ originalRawDiff,
91711
+ setOriginalRawDiff,
91712
+ issueRef,
91713
+ setIssueRef,
91714
+ confirmingAbort,
91715
+ setConfirmingAbort,
91716
+ regenGroupIndex,
91717
+ setRegenGroupIndex,
91718
+ regenBody,
91719
+ setRegenBody,
91720
+ regenRetryCount,
91721
+ setRegenRetryCount,
91722
+ streamPayload,
91723
+ setStreamPayload
91724
+ } = state;
91725
+ const { stream, regenStream } = useSplitPipeline({
91726
+ phase,
91727
+ streamPayload,
91728
+ regenBody,
91729
+ regenRetryCount,
91730
+ authToken,
91731
+ postStream: deps.postStream
91732
+ });
91353
91733
  const sendFeedback = (outcome) => {
91354
91734
  if (!flowIdRef.current || !authToken) return;
91355
91735
  deps.apiPost(
@@ -91359,7 +91739,7 @@ function SplitApp({
91359
91739
  ).catch(() => {
91360
91740
  });
91361
91741
  };
91362
- (0, import_react76.useEffect)(() => {
91742
+ (0, import_react79.useEffect)(() => {
91363
91743
  if (!TERMINAL_PHASES4.includes(phase)) return;
91364
91744
  const code = phase === "done" || phase === "aborted" ? 0 : 1;
91365
91745
  exit();
@@ -91369,7 +91749,7 @@ function SplitApp({
91369
91749
  code !== 0 ? errorMsg : void 0
91370
91750
  );
91371
91751
  }, [phase]);
91372
- (0, import_react76.useEffect)(() => {
91752
+ (0, import_react79.useEffect)(() => {
91373
91753
  if (phase !== "analyzing") return;
91374
91754
  if (stream.result) {
91375
91755
  const sortedGroups = stream.result.groups.sort(
@@ -91377,9 +91757,14 @@ function SplitApp({
91377
91757
  );
91378
91758
  setGroups(sortedGroups);
91379
91759
  if (stream.result.orphans?.length) {
91380
- setOrphanCount(stream.result.orphans.length);
91760
+ setOrphanCount(
91761
+ stream.result.orphans?.length ?? 0
91762
+ );
91763
+ }
91764
+ const flowId = stream.result.flowId;
91765
+ if (flowId) {
91766
+ flowIdRef.current = flowId;
91381
91767
  }
91382
- if (stream.result.flowId) flowIdRef.current = stream.result.flowId;
91383
91768
  setPhase("review");
91384
91769
  return;
91385
91770
  }
@@ -91418,7 +91803,7 @@ function SplitApp({
91418
91803
  }
91419
91804
  }
91420
91805
  }, [stream.result, stream.error, stream.errorRaw, phase]);
91421
- (0, import_react76.useEffect)(() => {
91806
+ (0, import_react79.useEffect)(() => {
91422
91807
  if (phase !== "regenerating") return;
91423
91808
  if (regenStream.result) {
91424
91809
  if (regenStream.result.flowId) {
@@ -91450,7 +91835,7 @@ function SplitApp({
91450
91835
  setPhase("review");
91451
91836
  }
91452
91837
  }, [regenStream.result, regenStream.error, phase, regenGroupIndex]);
91453
- (0, import_react76.useEffect)(() => {
91838
+ (0, import_react79.useEffect)(() => {
91454
91839
  async function run2() {
91455
91840
  const token = deps.readToken();
91456
91841
  if (!token) {
@@ -91548,144 +91933,6 @@ ${hookResult.output}` : "";
91548
91933
  }
91549
91934
  run2();
91550
91935
  }, []);
91551
- use_input_default(
91552
- (input, key) => {
91553
- if (phase !== "review") return;
91554
- if (confirmingAbort) {
91555
- if (input.toLowerCase() === "y") {
91556
- sendFeedback("discarded");
91557
- setConfirmingAbort(false);
91558
- setPhase("aborted");
91559
- return;
91560
- }
91561
- if (input.toLowerCase() === "n" || key.escape) {
91562
- setConfirmingAbort(false);
91563
- return;
91564
- }
91565
- return;
91566
- }
91567
- if (key.upArrow || input === "k") {
91568
- setSelectedIndex((prev) => Math.max(0, prev - 1));
91569
- return;
91570
- }
91571
- if (key.downArrow || input === "j") {
91572
- setSelectedIndex((prev) => Math.min(groups.length - 1, prev + 1));
91573
- return;
91574
- }
91575
- if (input === "d") {
91576
- setPhase("viewing-diff");
91577
- return;
91578
- }
91579
- if (input === "e") {
91580
- editedAnyRef.current = true;
91581
- setPhase("editing");
91582
- return;
91583
- }
91584
- if (input === "r") {
91585
- const group = groups[selectedIndex];
91586
- if (!group || !authToken) return;
91587
- sendFeedback("regenerated");
91588
- const combinedPatch = group.files.map((f) => patchMap.get(f.path) ?? "").filter(Boolean).join("\n");
91589
- const body = { diff: combinedPatch };
91590
- if (Object.keys(activeFileConfig).length > 0) {
91591
- body.config = activeFileConfig;
91592
- }
91593
- body.regeneration = {
91594
- attempt: regenRetryCount + 1,
91595
- previousMessage: group.message
91596
- };
91597
- setRegenGroupIndex(selectedIndex);
91598
- setRegenBody(body);
91599
- setRegenRetryCount((c) => c + 1);
91600
- setPhase("regenerating");
91601
- return;
91602
- }
91603
- if (input === "l") {
91604
- setIssueRef("");
91605
- setPhase("link-issue");
91606
- return;
91607
- }
91608
- if (input === "s") {
91609
- const groupId = groups[selectedIndex]?.groupId;
91610
- if (groupId) {
91611
- setSkippedGroups((prev) => {
91612
- const next = new Set(prev);
91613
- if (next.has(groupId)) {
91614
- next.delete(groupId);
91615
- } else {
91616
- next.add(groupId);
91617
- }
91618
- return next;
91619
- });
91620
- }
91621
- return;
91622
- }
91623
- if (key.return || input === "a") {
91624
- startCommitting();
91625
- return;
91626
- }
91627
- if (input === "q") {
91628
- setConfirmingAbort(true);
91629
- }
91630
- },
91631
- { isActive: phase === "review" }
91632
- );
91633
- use_input_default(
91634
- (input, key) => {
91635
- if (key.return) {
91636
- const ref = issueRef.trim();
91637
- if (ref) {
91638
- const prefixed = /^refs:/i.test(ref) ? ref : `Refs: ${ref}`;
91639
- setGroups((prev) => {
91640
- const next = [...prev];
91641
- const g = next[selectedIndex];
91642
- if (!g) return prev;
91643
- const body = g.body ? `${g.body}
91644
-
91645
- ${prefixed}` : prefixed;
91646
- const newMessage = `${g.message.split("\n\n")[0]}
91647
-
91648
- ${body}`;
91649
- next[selectedIndex] = { ...g, body, message: newMessage };
91650
- return next;
91651
- });
91652
- }
91653
- setPhase("review");
91654
- return;
91655
- }
91656
- if (key.escape) {
91657
- setPhase("review");
91658
- return;
91659
- }
91660
- if (key.backspace || key.delete) {
91661
- setIssueRef((prev) => prev.slice(0, -1));
91662
- return;
91663
- }
91664
- if (input && !key.ctrl && !key.meta) {
91665
- setIssueRef((prev) => prev + input);
91666
- }
91667
- },
91668
- { isActive: phase === "link-issue" }
91669
- );
91670
- function applyEditedMessage(newMessage) {
91671
- setGroups((prev) => {
91672
- const next = [...prev];
91673
- const g = next[selectedIndex];
91674
- if (!g) return prev;
91675
- const [header, ...bodyParts] = newMessage.split("\n\n");
91676
- const parsed = parseCommitType(header);
91677
- next[selectedIndex] = {
91678
- ...g,
91679
- type: parsed.type,
91680
- scope: parsed.scope,
91681
- description: parsed.description,
91682
- body: bodyParts.length > 0 ? bodyParts.join("\n\n") : null,
91683
- message: newMessage
91684
- };
91685
- return next;
91686
- });
91687
- setPhase("review");
91688
- }
91689
91936
  async function startCommitting() {
91690
91937
  const debug4 = process.argv.includes("--verbose") || process.argv.includes("-v") || !!process.env.REPOMIND_DEBUG;
91691
91938
  const log4 = debug4 ? (msg) => console.error(`[split-commit] ${msg}`) : () => {
@@ -91757,6 +92004,49 @@ ${body}`;
91757
92004
  setPhase("error-commit");
91758
92005
  }
91759
92006
  }
92007
+ function applyEditedMessage(newMessage) {
92008
+ setGroups((prev) => {
92009
+ const next = [...prev];
92010
+ const g = next[selectedIndex];
92011
+ if (!g) return prev;
92012
+ const [header, ...bodyParts] = newMessage.split("\n\n");
92013
+ const parsed = parseCommitType(header);
92014
+ next[selectedIndex] = {
92015
+ ...g,
92016
+ type: parsed.type,
92017
+ scope: parsed.scope,
92018
+ description: parsed.description,
92019
+ body: bodyParts.length > 0 ? bodyParts.join("\n\n") : null,
92020
+ message: newMessage
92021
+ };
92022
+ return next;
92023
+ });
92024
+ setPhase("review");
92025
+ }
92026
+ useSplitKeyboard({
92027
+ phase,
92028
+ groups,
92029
+ selectedIndex,
92030
+ setSelectedIndex,
92031
+ skippedGroups,
92032
+ setSkippedGroups,
92033
+ issueRef,
92034
+ setIssueRef,
92035
+ confirmingAbort,
92036
+ setConfirmingAbort,
92037
+ setPhase,
92038
+ setGroups,
92039
+ patchMap,
92040
+ authToken,
92041
+ regenRetryCount,
92042
+ setRegenGroupIndex,
92043
+ setRegenBody,
92044
+ setRegenRetryCount,
92045
+ editedAnyRef,
92046
+ activeFileConfig,
92047
+ sendFeedback,
92048
+ startCommitting
92049
+ });
91760
92050
  const activeGroups = groups.filter((g) => !skippedGroups.has(g.groupId));
91761
92051
  const activeGroupCount = activeGroups.length;
91762
92052
  if (phase === "viewing-diff") {
@@ -92058,7 +92348,7 @@ async function splitCommand() {
92058
92348
  let errorMessage = "";
92059
92349
  enterImmersive();
92060
92350
  const { waitUntilExit } = render_default(
92061
- import_react77.default.createElement(SplitApp, {
92351
+ import_react80.default.createElement(SplitApp, {
92062
92352
  deps: {
92063
92353
  readToken,
92064
92354
  getAllChanges,
@@ -92096,7 +92386,7 @@ async function splitCommand() {
92096
92386
  exitImmersive();
92097
92387
  if (completedCommits.length > 0) {
92098
92388
  const { waitUntilExit: waitUntilExit2 } = render_default(
92099
- import_react77.default.createElement(SplitDoneSummary, {
92389
+ import_react80.default.createElement(SplitDoneSummary, {
92100
92390
  commits: completedCommits,
92101
92391
  updateAvailable: getUpdateInfo()
92102
92392
  })
@@ -92110,63 +92400,226 @@ async function splitCommand() {
92110
92400
  process.exit(exitCode);
92111
92401
  }
92112
92402
 
92113
- // src/commands/whoami.tsx
92114
- var import_react78 = __toESM(require_react(), 1);
92403
+ // src/commands/status.tsx
92404
+ var import_react81 = __toESM(require_react(), 1);
92115
92405
  var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
92116
92406
  var apiClient3 = createApiClient();
92117
- function WhoamiApp({ onExit }) {
92407
+ function formatDate(iso) {
92408
+ if (!iso) return "\u2014";
92409
+ return new Date(iso).toLocaleDateString("pt-BR", {
92410
+ day: "2-digit",
92411
+ month: "short",
92412
+ year: "numeric"
92413
+ });
92414
+ }
92415
+ function CommitBar({ used, limit }) {
92416
+ const BAR_WIDTH = 20;
92417
+ const pct = limit > 0 ? Math.min(used / limit, 1) : 0;
92418
+ const filled = Math.round(pct * BAR_WIDTH);
92419
+ const empty = BAR_WIDTH - filled;
92420
+ const bar = "\u2588".repeat(filled) + "\u2591".repeat(empty);
92421
+ const color = pct >= 1 ? C.red : pct >= 0.8 ? C.yellow : C.green;
92422
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { gap: 1, children: [
92423
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color, children: bar }),
92424
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Text, { color: C.dim, children: [
92425
+ used,
92426
+ " / ",
92427
+ limit === -1 ? "\u221E" : limit,
92428
+ " commits"
92429
+ ] })
92430
+ ] });
92431
+ }
92432
+ function statusLabel(status) {
92433
+ switch (status) {
92434
+ case "active":
92435
+ return { label: "Ativo", color: C.green };
92436
+ case "trialing":
92437
+ return { label: "Trial", color: C.cyan };
92438
+ case "past_due":
92439
+ return { label: "Pagamento pendente", color: C.yellow };
92440
+ case "canceled":
92441
+ return { label: "Cancelado", color: C.red };
92442
+ case "unpaid":
92443
+ return { label: "Inadimplente", color: C.red };
92444
+ default:
92445
+ return { label: "Sem assinatura", color: C.dim };
92446
+ }
92447
+ }
92448
+ function Row({
92449
+ label,
92450
+ children
92451
+ }) {
92452
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { gap: 1, children: [
92453
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Box_default, { width: 14, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: C.dim, children: label }) }),
92454
+ children
92455
+ ] });
92456
+ }
92457
+ function StatusApp({ onExit }) {
92118
92458
  const token = readToken();
92119
- const [me, setMe] = (0, import_react78.useState)(null);
92120
- const [loading, setLoading] = (0, import_react78.useState)(!!token);
92121
- const [failed, setFailed] = (0, import_react78.useState)(false);
92122
- const [expired, setExpired] = (0, import_react78.useState)(false);
92123
- (0, import_react78.useEffect)(() => {
92459
+ const [me, setMe] = (0, import_react81.useState)(null);
92460
+ const [billing, setBilling] = (0, import_react81.useState)(null);
92461
+ const [loading, setLoading] = (0, import_react81.useState)(!!token);
92462
+ const [expired, setExpired] = (0, import_react81.useState)(false);
92463
+ const [failed, setFailed] = (0, import_react81.useState)(false);
92464
+ (0, import_react81.useEffect)(() => {
92124
92465
  if (!token) return;
92125
- apiClient3.get("/auth/me", token).then(setMe).catch((err) => {
92466
+ Promise.all([
92467
+ apiClient3.get("/auth/me", token),
92468
+ apiClient3.get("/billing/status", token)
92469
+ ]).then(([meData, billingData]) => {
92470
+ setMe(meData);
92471
+ setBilling(billingData);
92472
+ }).catch((err) => {
92126
92473
  if (err instanceof TokenExpiredError) setExpired(true);
92127
92474
  setFailed(true);
92128
92475
  }).finally(() => setLoading(false));
92129
92476
  }, []);
92130
92477
  const done = !loading;
92131
- const authenticated = !!me && !failed;
92132
- (0, import_react78.useEffect)(() => {
92478
+ (0, import_react81.useEffect)(() => {
92133
92479
  if (!done) return;
92134
- onExit(authenticated ? 0 : 1);
92135
- }, [done, authenticated, onExit]);
92480
+ const success = !!me && !failed;
92481
+ onExit(success ? 0 : 1);
92482
+ }, [done, me, failed, onExit]);
92483
+ const { label: statusText, color: statusColor } = billing ? statusLabel(billing.subscriptionStatus) : { label: "", color: C.dim };
92136
92484
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { flexDirection: "column", paddingTop: 1, marginBottom: 1, children: [
92137
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { bold: true, color: C.cyan, children: "RepoMind" }) }),
92485
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { bold: true, color: C.cyan, children: "RepoMind Status" }) }),
92138
92486
  loading && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { gap: 1, children: [
92139
92487
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: C.cyan, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(build_default, { type: "dots" }) }),
92140
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: C.dim, children: "Verificando..." })
92488
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: C.dim, children: "Carregando..." })
92489
+ ] }),
92490
+ done && !token && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { gap: 1, children: [
92491
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: C.yellow, children: "\u25C6" }),
92492
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Text, { color: C.dim, children: [
92493
+ "N\xE3o autenticado. Execute ",
92494
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: C.white, children: "repomind login" }),
92495
+ "."
92496
+ ] })
92497
+ ] }),
92498
+ done && token && expired && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { gap: 1, children: [
92499
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: C.yellow, children: "\u25C6" }),
92500
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Text, { color: C.dim, children: [
92501
+ "Token expirado. Execute ",
92502
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: C.white, children: "repomind login" }),
92503
+ " ",
92504
+ "para renovar."
92505
+ ] })
92506
+ ] }),
92507
+ done && token && failed && !expired && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { gap: 1, children: [
92508
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: C.red, children: "\u2717" }),
92509
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: C.dim, children: "Falha ao carregar status. Tente novamente." })
92141
92510
  ] }),
92142
- done && me && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { flexDirection: "column", gap: 0, children: [
92143
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { gap: 1, children: [
92511
+ done && me && billing && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { flexDirection: "column", gap: 0, children: [
92512
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { gap: 1, marginBottom: 1, children: [
92144
92513
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: C.green, children: "\u2713" }),
92145
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Text, { children: [
92514
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Text, { color: C.dim, children: [
92515
+ "Autenticado como ",
92516
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: C.white, children: me.email })
92517
+ ] })
92518
+ ] }),
92519
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { flexDirection: "column", gap: 0, paddingLeft: 2, children: [
92520
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Row, { label: "Plano", children: [
92521
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: C.white, children: billing.planName || billing.planSlug }),
92522
+ billing.interval && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Text, { color: C.dim, children: [
92523
+ "(",
92524
+ billing.interval === "month" ? "mensal" : "anual",
92525
+ ")"
92526
+ ] })
92527
+ ] }),
92528
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Row, { label: "Status", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: statusColor, children: statusText }) }),
92529
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Row, { label: "Uso", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
92530
+ CommitBar,
92531
+ {
92532
+ used: billing.commitsUsed,
92533
+ limit: billing.commitsLimit
92534
+ }
92535
+ ) }),
92536
+ billing.subscriptionStatus === "trialing" && billing.trialEnd && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Row, { label: "Trial at\xE9", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: C.cyan, children: formatDate(billing.trialEnd) }) }),
92537
+ billing.subscriptionStatus !== "trialing" && billing.currentPeriodEnd && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Row, { label: "Renova\xE7\xE3o", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: C.dim, children: formatDate(billing.currentPeriodEnd) }) }),
92538
+ billing.cancelAtPeriodEnd && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Row, { label: "", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Text, { color: C.yellow, children: [
92539
+ "\u25C6 Cancela em ",
92540
+ formatDate(billing.currentPeriodEnd)
92541
+ ] }) }),
92542
+ billing.pendingPlanChange && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Row, { label: "", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Text, { color: C.yellow, children: [
92543
+ "\u25C6 Mudan\xE7a para",
92544
+ " ",
92545
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: C.white, children: billing.pendingPlanChange.planName ?? "novo plano" }),
92546
+ " ",
92547
+ "no pr\xF3ximo ciclo"
92548
+ ] }) })
92549
+ ] })
92550
+ ] })
92551
+ ] });
92552
+ }
92553
+ async function statusCommand() {
92554
+ let exitCode = 0;
92555
+ const { waitUntilExit } = render_default(
92556
+ import_react81.default.createElement(StatusApp, {
92557
+ onExit: (code) => {
92558
+ exitCode = code;
92559
+ }
92560
+ })
92561
+ );
92562
+ await waitUntilExit();
92563
+ process.exit(exitCode);
92564
+ }
92565
+
92566
+ // src/commands/whoami.tsx
92567
+ var import_react82 = __toESM(require_react(), 1);
92568
+ var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
92569
+ var apiClient4 = createApiClient();
92570
+ function WhoamiApp({ onExit }) {
92571
+ const token = readToken();
92572
+ const [me, setMe] = (0, import_react82.useState)(null);
92573
+ const [loading, setLoading] = (0, import_react82.useState)(!!token);
92574
+ const [failed, setFailed] = (0, import_react82.useState)(false);
92575
+ const [expired, setExpired] = (0, import_react82.useState)(false);
92576
+ (0, import_react82.useEffect)(() => {
92577
+ if (!token) return;
92578
+ apiClient4.get("/auth/me", token).then(setMe).catch((err) => {
92579
+ if (err instanceof TokenExpiredError) setExpired(true);
92580
+ setFailed(true);
92581
+ }).finally(() => setLoading(false));
92582
+ }, []);
92583
+ const done = !loading;
92584
+ const authenticated = !!me && !failed;
92585
+ (0, import_react82.useEffect)(() => {
92586
+ if (!done) return;
92587
+ onExit(authenticated ? 0 : 1);
92588
+ }, [done, authenticated, onExit]);
92589
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box_default, { flexDirection: "column", paddingTop: 1, marginBottom: 1, children: [
92590
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { bold: true, color: C.cyan, children: "RepoMind" }) }),
92591
+ loading && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box_default, { gap: 1, children: [
92592
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { color: C.cyan, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(build_default, { type: "dots" }) }),
92593
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { color: C.dim, children: "Verificando..." })
92594
+ ] }),
92595
+ done && me && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box_default, { flexDirection: "column", gap: 0, children: [
92596
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box_default, { gap: 1, children: [
92597
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { color: C.green, children: "\u2713" }),
92598
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text, { children: [
92146
92599
  "Autenticado como",
92147
92600
  " ",
92148
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { bold: true, color: C.white, children: me.email })
92601
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { bold: true, color: C.white, children: me.email })
92149
92602
  ] })
92150
92603
  ] }),
92151
- me.tokenName && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Box_default, { gap: 1, paddingLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Text, { color: C.dim, children: [
92604
+ me.tokenName && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Box_default, { gap: 1, paddingLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text, { color: C.dim, children: [
92152
92605
  "Token: ",
92153
92606
  me.tokenName
92154
92607
  ] }) })
92155
92608
  ] }),
92156
- done && !me && expired && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { gap: 1, children: [
92157
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: C.yellow, children: "\u25C6" }),
92158
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Text, { color: C.dim, children: [
92609
+ done && !me && expired && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box_default, { gap: 1, children: [
92610
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { color: C.yellow, children: "\u25C6" }),
92611
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text, { color: C.dim, children: [
92159
92612
  "Token expirado. Execute ",
92160
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: C.white, children: "repomind login" }),
92613
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { color: C.white, children: "repomind login" }),
92161
92614
  " ",
92162
92615
  "para renovar."
92163
92616
  ] })
92164
92617
  ] }),
92165
- done && !me && !expired && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { gap: 1, children: [
92166
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: C.yellow, children: "\u25C6" }),
92167
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Text, { color: C.dim, children: [
92618
+ done && !me && !expired && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box_default, { gap: 1, children: [
92619
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { color: C.yellow, children: "\u25C6" }),
92620
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text, { color: C.dim, children: [
92168
92621
  "Nao autenticado. Execute ",
92169
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: C.white, children: "repomind login" }),
92622
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { color: C.white, children: "repomind login" }),
92170
92623
  "."
92171
92624
  ] })
92172
92625
  ] })
@@ -92175,7 +92628,7 @@ function WhoamiApp({ onExit }) {
92175
92628
  async function whoamiCommand() {
92176
92629
  let exitCode = 0;
92177
92630
  const { waitUntilExit } = render_default(
92178
- import_react78.default.createElement(WhoamiApp, {
92631
+ import_react82.default.createElement(WhoamiApp, {
92179
92632
  onExit: (code) => {
92180
92633
  exitCode = code;
92181
92634
  }
@@ -92187,58 +92640,69 @@ async function whoamiCommand() {
92187
92640
 
92188
92641
  // src/index.ts
92189
92642
  import { createRequire } from "node:module";
92190
- var import_react79 = __toESM(require_react(), 1);
92643
+ var import_react83 = __toESM(require_react(), 1);
92191
92644
 
92192
92645
  // src/ui/components/command-help.tsx
92193
- var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
92646
+ var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
92647
+ function SectionLabel2({ label }) {
92648
+ const cols = Math.max(20, (process.stdout.columns ?? 80) - 3);
92649
+ const dashes = Math.max(0, cols - label.length - 3);
92650
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Box_default, { gap: 1, children: [
92651
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { color: C.dim, bold: true, children: label }),
92652
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { color: C.dim, children: "\u2500".repeat(dashes) })
92653
+ ] });
92654
+ }
92194
92655
  function CommandHelp({
92195
92656
  command: command2,
92196
92657
  usage,
92197
92658
  description,
92198
92659
  details,
92199
- flags
92660
+ flags,
92661
+ examples
92200
92662
  }) {
92201
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box_default, { flexDirection: "column", children: [
92202
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Header, { title: `RepoMind ${command2}` }),
92203
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box_default, { paddingLeft: 1, marginBottom: 1, gap: 1, children: [
92204
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { color: C.dim, children: "Uso:" }),
92205
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { bold: true, children: usage })
92206
- ] }),
92207
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
92663
+ const visibleFlags = flags?.filter(
92664
+ (f) => f.name !== "--help" && f.name !== "--verbose"
92665
+ );
92666
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
92667
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Header, { title: `RepoMind ${command2}` }),
92668
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
92208
92669
  Box_default,
92209
92670
  {
92210
- paddingLeft: 1,
92211
- marginBottom: 1,
92212
- borderStyle: "round",
92213
- borderColor: C.dim,
92214
- paddingX: 2,
92215
- paddingY: 0,
92671
+ paddingLeft: 2,
92672
+ paddingTop: 1,
92673
+ paddingBottom: 1,
92216
92674
  flexDirection: "column",
92217
92675
  children: [
92218
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { children: description }),
92219
- details?.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { color: C.dim, children: detail }, detail))
92676
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { color: C.white, children: description }),
92677
+ details?.map((d) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { color: C.dim, children: d }, d))
92220
92678
  ]
92221
92679
  }
92222
92680
  ),
92223
- flags && flags.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 1, children: [
92224
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { color: C.dim, children: "Flags:" }),
92225
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Box_default, { flexDirection: "column", marginTop: 0, paddingLeft: 1, children: flags.map((flag) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box_default, { gap: 1, children: [
92226
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Box_default, { width: 20, children: [
92227
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { color: C.cyan, bold: true, children: flag.name }),
92228
- flag.alias && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text, { color: C.dim, children: [
92681
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box_default, { paddingLeft: 2, paddingBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SectionLabel2, { label: "USO" }) }),
92682
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box_default, { paddingLeft: 2, paddingBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { color: C.cyan, bold: true, children: usage }) }),
92683
+ visibleFlags && visibleFlags.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
92684
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box_default, { paddingLeft: 2, paddingBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SectionLabel2, { label: "OP\xC7\xD5ES" }) }),
92685
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box_default, { flexDirection: "column", paddingLeft: 2, paddingBottom: 1, children: visibleFlags.map((flag) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Box_default, { gap: 1, children: [
92686
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Box_default, { width: 26, children: [
92687
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { color: C.cyan, children: flag.name }),
92688
+ flag.alias && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Text, { color: C.dim, children: [
92229
92689
  ", ",
92230
92690
  flag.alias
92231
92691
  ] })
92232
92692
  ] }),
92233
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { color: C.dim, children: flag.description })
92693
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { color: C.dim, children: flag.description })
92234
92694
  ] }, flag.name)) })
92695
+ ] }),
92696
+ examples && examples.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
92697
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box_default, { paddingLeft: 2, paddingBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SectionLabel2, { label: "EXEMPLO" }) }),
92698
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box_default, { flexDirection: "column", paddingLeft: 2, children: examples.map((ex) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { color: C.white, children: ex }, ex)) })
92235
92699
  ] })
92236
92700
  ] });
92237
92701
  }
92238
92702
 
92239
92703
  // src/index.ts
92240
92704
  function getVersion() {
92241
- if ("0.14.0") return "0.14.0";
92705
+ if ("1.0.0") return "1.0.0";
92242
92706
  try {
92243
92707
  const require2 = createRequire(import.meta.url);
92244
92708
  const pkg = require2("../package.json");
@@ -92273,16 +92737,15 @@ var COMMAND_HELP = {
92273
92737
  "Se o arquivo j\xE1 existir, pergunta se deseja sobrescrever.",
92274
92738
  "Configura idioma, corpo, rodap\xE9 e rastreamento de breaking changes."
92275
92739
  ],
92276
- flags: [{ name: "--help", alias: "-h", description: "Exibir esta ajuda" }]
92740
+ examples: ["cd meu-projeto", "repomind init"]
92277
92741
  },
92278
92742
  commit: {
92279
- usage: "repomind commit",
92743
+ usage: "repomind commit [op\xE7\xF5es]",
92280
92744
  description: "Gera uma mensagem de commit inteligente a partir do git diff --staged.",
92281
- details: ["Requer arquivos staged (git add)."],
92282
92745
  flags: [
92283
92746
  {
92284
92747
  name: "--instructions [texto]",
92285
- description: 'Instru\xE7\xF5es pontuais para esta gera\xE7\xE3o (ex: "foca na parte de auth"). Sem texto abre um editor interativo.'
92748
+ description: "Instru\xE7\xE3o pontual para esta gera\xE7\xE3o. Sem texto abre editor interativo."
92286
92749
  },
92287
92750
  {
92288
92751
  name: "--no-verify",
@@ -92294,17 +92757,21 @@ var COMMAND_HELP = {
92294
92757
  description: "Exibir detalhes de erro"
92295
92758
  },
92296
92759
  { name: "--help", alias: "-h", description: "Exibir esta ajuda" }
92760
+ ],
92761
+ examples: [
92762
+ "git add src/auth.ts",
92763
+ "repomind commit",
92764
+ 'repomind commit --instructions "foca na parte de auth"'
92297
92765
  ]
92298
92766
  },
92299
92767
  split: {
92300
- usage: "repomind split [--all]",
92768
+ usage: "repomind split [op\xE7\xF5es]",
92301
92769
  description: "Analisa altera\xE7\xF5es staged e divide em commits at\xF4micos.",
92302
- details: ["Por padr\xE3o analisa apenas altera\xE7\xF5es staged (git add)."],
92303
92770
  flags: [
92304
92771
  { name: "--all", description: "Incluir altera\xE7\xF5es unstaged + untracked" },
92305
92772
  {
92306
92773
  name: "--instructions [texto]",
92307
- description: 'Instru\xE7\xF5es pontuais para esta gera\xE7\xE3o (ex: "separa migration do model"). Sem texto abre um editor interativo.'
92774
+ description: "Instru\xE7\xE3o pontual para esta gera\xE7\xE3o. Sem texto abre editor interativo."
92308
92775
  },
92309
92776
  {
92310
92777
  name: "--no-verify",
@@ -92316,6 +92783,11 @@ var COMMAND_HELP = {
92316
92783
  description: "Exibir detalhes de erro"
92317
92784
  },
92318
92785
  { name: "--help", alias: "-h", description: "Exibir esta ajuda" }
92786
+ ],
92787
+ examples: [
92788
+ "git add .",
92789
+ "repomind split",
92790
+ "repomind split --all # inclui unstaged"
92319
92791
  ]
92320
92792
  },
92321
92793
  pr: {
@@ -92329,37 +92801,59 @@ var COMMAND_HELP = {
92329
92801
  description: "Exibir detalhes de erro"
92330
92802
  },
92331
92803
  { name: "--help", alias: "-h", description: "Exibir esta ajuda" }
92804
+ ],
92805
+ examples: [
92806
+ "git checkout -b feat/nova-feature",
92807
+ "# faz commits...",
92808
+ "repomind pr"
92332
92809
  ]
92333
92810
  },
92334
92811
  login: {
92335
92812
  usage: "repomind login [--token <token>]",
92336
92813
  description: "Autenticar com sua conta RepoMind.",
92337
92814
  details: [
92338
- "Sem flags: usa Device Flow (codigo + browser).",
92815
+ "Sem flags: usa Device Flow (c\xF3digo + browser).",
92339
92816
  "Com --token: autentica com um Personal Access Token."
92340
92817
  ],
92341
92818
  flags: [
92342
- { name: "--token", description: "Autenticar com Personal Access Token" }
92343
- ]
92819
+ {
92820
+ name: "--token <token>",
92821
+ description: "Autenticar com Personal Access Token"
92822
+ }
92823
+ ],
92824
+ examples: ["repomind login", "repomind login --token rm_pat_xxxx"]
92344
92825
  },
92345
92826
  logout: {
92346
92827
  usage: "repomind logout",
92347
- description: "Encerrar sess\xE3o atual e remover token local."
92828
+ description: "Encerrar sess\xE3o atual e remover token local.",
92829
+ examples: ["repomind logout"]
92348
92830
  },
92349
92831
  whoami: {
92350
92832
  usage: "repomind whoami",
92351
- description: "Exibir o usu\xE1rio autenticado atualmente."
92833
+ description: "Exibir o usu\xE1rio autenticado atualmente.",
92834
+ examples: ["repomind whoami"]
92835
+ },
92836
+ status: {
92837
+ usage: "repomind status",
92838
+ description: "Exibir status da conta: plano, uso de commits e per\xEDodo atual.",
92839
+ examples: ["repomind status"]
92840
+ },
92841
+ dashboard: {
92842
+ usage: "repomind dashboard",
92843
+ description: "Abrir o dashboard RepoMind no navegador.",
92844
+ examples: ["repomind dashboard"]
92352
92845
  }
92353
92846
  };
92354
92847
  if (wantsHelp && command && COMMAND_HELP[command]) {
92355
92848
  const def = COMMAND_HELP[command];
92356
92849
  const { waitUntilExit } = render_default(
92357
- import_react79.default.createElement(CommandHelp, {
92850
+ import_react83.default.createElement(CommandHelp, {
92358
92851
  command,
92359
92852
  usage: def.usage,
92360
92853
  description: def.description,
92361
92854
  details: def.details,
92362
- flags: def.flags
92855
+ flags: def.flags,
92856
+ examples: def.examples
92363
92857
  })
92364
92858
  );
92365
92859
  setTimeout(() => process.exit(0), 50);
@@ -92387,6 +92881,12 @@ switch (command) {
92387
92881
  case "pr":
92388
92882
  run(prCommand);
92389
92883
  break;
92884
+ case "dashboard":
92885
+ run(dashboardCommand);
92886
+ break;
92887
+ case "status":
92888
+ run(statusCommand);
92889
+ break;
92390
92890
  default:
92391
92891
  run(helpCommand);
92392
92892
  break;