@enruana/claude-orka 0.2.2 → 0.3.1

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 (70) hide show
  1. package/dist/cli.js +41 -2
  2. package/dist/electron/main/main.d.ts +1 -4
  3. package/dist/electron/main/main.d.ts.map +1 -1
  4. package/dist/electron/main/main.js +148 -43
  5. package/dist/electron/main/main.js.map +1 -1
  6. package/dist/electron/preload/preload.d.ts +0 -23
  7. package/dist/electron/preload/preload.d.ts.map +1 -1
  8. package/dist/electron/preload/preload.js +13 -29
  9. package/dist/electron/preload/preload.js.map +1 -1
  10. package/dist/src/cli/index.js +0 -0
  11. package/dist/src/core/SessionManager.d.ts +4 -0
  12. package/dist/src/core/SessionManager.d.ts.map +1 -1
  13. package/dist/src/core/SessionManager.js +44 -0
  14. package/dist/src/core/SessionManager.js.map +1 -1
  15. package/package.json +16 -5
  16. package/dist/core/ClaudeOrka.d.ts +0 -111
  17. package/dist/core/ClaudeOrka.d.ts.map +0 -1
  18. package/dist/core/ClaudeOrka.js +0 -160
  19. package/dist/core/ClaudeOrka.js.map +0 -1
  20. package/dist/core/SessionManager.d.ts +0 -82
  21. package/dist/core/SessionManager.d.ts.map +0 -1
  22. package/dist/core/SessionManager.js +0 -519
  23. package/dist/core/SessionManager.js.map +0 -1
  24. package/dist/core/StateManager.d.ts +0 -92
  25. package/dist/core/StateManager.d.ts.map +0 -1
  26. package/dist/core/StateManager.js +0 -307
  27. package/dist/core/StateManager.js.map +0 -1
  28. package/dist/core/index.d.ts +0 -4
  29. package/dist/core/index.d.ts.map +0 -1
  30. package/dist/core/index.js +0 -20
  31. package/dist/core/index.js.map +0 -1
  32. package/dist/electron/main/ipc-handlers.d.ts +0 -5
  33. package/dist/electron/main/ipc-handlers.d.ts.map +0 -1
  34. package/dist/electron/main/ipc-handlers.js +0 -169
  35. package/dist/electron/main/ipc-handlers.js.map +0 -1
  36. package/dist/electron/renderer/app.js +0 -808
  37. package/dist/electron/renderer/index.html +0 -189
  38. package/dist/electron/renderer/styles.css +0 -736
  39. package/dist/index.d.ts +0 -9
  40. package/dist/index.d.ts.map +0 -1
  41. package/dist/index.js +0 -18
  42. package/dist/index.js.map +0 -1
  43. package/dist/models/Fork.d.ts +0 -26
  44. package/dist/models/Fork.d.ts.map +0 -1
  45. package/dist/models/Fork.js +0 -3
  46. package/dist/models/Fork.js.map +0 -1
  47. package/dist/models/Session.d.ts +0 -38
  48. package/dist/models/Session.d.ts.map +0 -1
  49. package/dist/models/Session.js +0 -3
  50. package/dist/models/Session.js.map +0 -1
  51. package/dist/models/State.d.ts +0 -24
  52. package/dist/models/State.d.ts.map +0 -1
  53. package/dist/models/State.js +0 -3
  54. package/dist/models/State.js.map +0 -1
  55. package/dist/models/index.d.ts +0 -4
  56. package/dist/models/index.d.ts.map +0 -1
  57. package/dist/models/index.js +0 -20
  58. package/dist/models/index.js.map +0 -1
  59. package/dist/utils/index.d.ts +0 -3
  60. package/dist/utils/index.d.ts.map +0 -1
  61. package/dist/utils/index.js +0 -19
  62. package/dist/utils/index.js.map +0 -1
  63. package/dist/utils/logger.d.ts +0 -20
  64. package/dist/utils/logger.d.ts.map +0 -1
  65. package/dist/utils/logger.js +0 -41
  66. package/dist/utils/logger.js.map +0 -1
  67. package/dist/utils/tmux.d.ts +0 -77
  68. package/dist/utils/tmux.d.ts.map +0 -1
  69. package/dist/utils/tmux.js +0 -270
  70. package/dist/utils/tmux.js.map +0 -1
package/dist/index.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- /**
3
- * Claude-Orka SDK
4
- * Orquestador de sesiones de Claude Code con tmux
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.TmuxError = exports.TmuxCommands = exports.LogLevel = exports.logger = exports.ClaudeOrka = void 0;
8
- // API Principal
9
- var ClaudeOrka_1 = require("./core/ClaudeOrka");
10
- Object.defineProperty(exports, "ClaudeOrka", { enumerable: true, get: function () { return ClaudeOrka_1.ClaudeOrka; } });
11
- // Utilidades exportadas (opcional)
12
- var logger_1 = require("./utils/logger");
13
- Object.defineProperty(exports, "logger", { enumerable: true, get: function () { return logger_1.logger; } });
14
- Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return logger_1.LogLevel; } });
15
- var tmux_1 = require("./utils/tmux");
16
- Object.defineProperty(exports, "TmuxCommands", { enumerable: true, get: function () { return tmux_1.TmuxCommands; } });
17
- Object.defineProperty(exports, "TmuxError", { enumerable: true, get: function () { return tmux_1.TmuxError; } });
18
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,gBAAgB;AAChB,gDAA8C;AAArC,wGAAA,UAAU,OAAA;AAWnB,mCAAmC;AACnC,yCAAiD;AAAxC,gGAAA,MAAM,OAAA;AAAE,kGAAA,QAAQ,OAAA;AACzB,qCAAsD;AAA7C,oGAAA,YAAY,OAAA;AAAE,iGAAA,SAAS,OAAA"}
@@ -1,26 +0,0 @@
1
- /**
2
- * Representa un fork (rama de conversación) de una sesión
3
- */
4
- export interface Fork {
5
- /** ID único del fork (fork-{name?}-{nanoid}) */
6
- id: string;
7
- /** Nombre descriptivo del fork */
8
- name: string;
9
- /** ID del pane tmux (solo si status = 'active') */
10
- tmuxPaneId?: string;
11
- /** ID del padre: 'main' o ID de otro fork */
12
- parentId: string;
13
- /** Fecha de creación (ISO timestamp) */
14
- createdAt: string;
15
- /** Path al contexto guardado (relativo a projectPath) */
16
- contextPath?: string;
17
- /** Estado del fork */
18
- status: 'active' | 'saved' | 'merged';
19
- /** Última actividad en este fork (ISO timestamp) */
20
- lastActivity: string;
21
- /** Si el fork ya fue mergeado a main */
22
- mergedToMain?: boolean;
23
- /** Fecha en que se hizo merge (ISO timestamp) */
24
- mergedAt?: string;
25
- }
26
- //# sourceMappingURL=Fork.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Fork.d.ts","sourceRoot":"","sources":["../../src/models/Fork.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,gDAAgD;IAChD,EAAE,EAAE,MAAM,CAAA;IAEV,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAA;IAEZ,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAA;IAEhB,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAA;IAEjB,yDAAyD;IACzD,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB,sBAAsB;IACtB,MAAM,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAA;IAErC,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAA;IAEpB,wCAAwC;IACxC,YAAY,CAAC,EAAE,OAAO,CAAA;IAEtB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=Fork.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Fork.js","sourceRoot":"","sources":["../../src/models/Fork.ts"],"names":[],"mappings":""}
@@ -1,38 +0,0 @@
1
- import { Fork } from './Fork';
2
- /**
3
- * Representa una sesión de Claude Code
4
- */
5
- export interface Session {
6
- /** ID único de la sesión (session-{nanoid}) */
7
- id: string;
8
- /** Nombre descriptivo de la sesión */
9
- name: string;
10
- /** Nombre de la sesión tmux (orchestrator-{id}) */
11
- tmuxSessionName: string;
12
- /** Path absoluto del proyecto */
13
- projectPath: string;
14
- /** Fecha de creación (ISO timestamp) */
15
- createdAt: string;
16
- /** Estado: active = tmux corriendo, saved = guardado en disco */
17
- status: 'active' | 'saved';
18
- /** Rama principal de la sesión */
19
- main: MainBranch;
20
- /** Forks (ramas) de esta sesión */
21
- forks: Fork[];
22
- /** Última actividad en cualquier parte de la sesión (ISO timestamp) */
23
- lastActivity: string;
24
- }
25
- /**
26
- * Representa la rama principal de una sesión
27
- */
28
- export interface MainBranch {
29
- /** ID del pane tmux (solo si status = 'active') */
30
- tmuxPaneId?: string;
31
- /** ID de la ventana tmux (solo si status = 'active') */
32
- tmuxWindowId?: string;
33
- /** Path al contexto guardado (relativo a projectPath) */
34
- contextPath?: string;
35
- /** Última actividad en main (ISO timestamp) */
36
- lastActivity: string;
37
- }
38
- //# sourceMappingURL=Session.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Session.d.ts","sourceRoot":"","sources":["../../src/models/Session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,+CAA+C;IAC/C,EAAE,EAAE,MAAM,CAAA;IAEV,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAA;IAEZ,mDAAmD;IACnD,eAAe,EAAE,MAAM,CAAA;IAEvB,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAA;IAEnB,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAA;IAEjB,iEAAiE;IACjE,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAA;IAE1B,kCAAkC;IAClC,IAAI,EAAE,UAAU,CAAA;IAEhB,mCAAmC;IACnC,KAAK,EAAE,IAAI,EAAE,CAAA;IAEb,uEAAuE;IACvE,YAAY,EAAE,MAAM,CAAA;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB,wDAAwD;IACxD,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB,yDAAyD;IACzD,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB,+CAA+C;IAC/C,YAAY,EAAE,MAAM,CAAA;CACrB"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=Session.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Session.js","sourceRoot":"","sources":["../../src/models/Session.ts"],"names":[],"mappings":""}
@@ -1,24 +0,0 @@
1
- import { Session } from './Session';
2
- /**
3
- * Estado global del proyecto almacenado en .claude-orka/state.json
4
- */
5
- export interface ProjectState {
6
- /** Versión del formato del estado */
7
- version: string;
8
- /** Path absoluto del proyecto */
9
- projectPath: string;
10
- /** Todas las sesiones del proyecto (activas y guardadas) */
11
- sessions: Session[];
12
- /** Última actualización del estado (ISO timestamp) */
13
- lastUpdated: string;
14
- }
15
- /**
16
- * Filtros para buscar sesiones
17
- */
18
- export interface SessionFilters {
19
- /** Filtrar por estado: active = tmux corriendo, saved = guardado */
20
- status?: 'active' | 'saved';
21
- /** Filtrar por nombre de sesión */
22
- name?: string;
23
- }
24
- //# sourceMappingURL=State.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"State.d.ts","sourceRoot":"","sources":["../../src/models/State.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAA;IAEf,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAA;IAEnB,4DAA4D;IAC5D,QAAQ,EAAE,OAAO,EAAE,CAAA;IAEnB,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAA;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,oEAAoE;IACpE,MAAM,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAA;IAE3B,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAA;CACd"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=State.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"State.js","sourceRoot":"","sources":["../../src/models/State.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- export * from './State';
2
- export * from './Session';
3
- export * from './Fork';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,QAAQ,CAAA"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./State"), exports);
18
- __exportStar(require("./Session"), exports);
19
- __exportStar(require("./Fork"), exports);
20
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB;AACvB,4CAAyB;AACzB,yCAAsB"}
@@ -1,3 +0,0 @@
1
- export * from './tmux';
2
- export * from './logger';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./tmux"), exports);
18
- __exportStar(require("./logger"), exports);
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB;AACtB,2CAAwB"}
@@ -1,20 +0,0 @@
1
- /**
2
- * Logger simple para Claude-Orka
3
- */
4
- export declare enum LogLevel {
5
- DEBUG = 0,
6
- INFO = 1,
7
- WARN = 2,
8
- ERROR = 3
9
- }
10
- declare class Logger {
11
- private level;
12
- setLevel(level: LogLevel): void;
13
- debug(...args: any[]): void;
14
- info(...args: any[]): void;
15
- warn(...args: any[]): void;
16
- error(...args: any[]): void;
17
- }
18
- export declare const logger: Logger;
19
- export {};
20
- //# sourceMappingURL=logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,oBAAY,QAAQ;IAClB,KAAK,IAAI;IACT,IAAI,IAAI;IACR,IAAI,IAAI;IACR,KAAK,IAAI;CACV;AAED,cAAM,MAAM;IACV,OAAO,CAAC,KAAK,CAA0B;IAEvC,QAAQ,CAAC,KAAK,EAAE,QAAQ;IAIxB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAMpB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAMnB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAMnB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;CAKrB;AAED,eAAO,MAAM,MAAM,QAAe,CAAA"}
@@ -1,41 +0,0 @@
1
- "use strict";
2
- /**
3
- * Logger simple para Claude-Orka
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.logger = exports.LogLevel = void 0;
7
- var LogLevel;
8
- (function (LogLevel) {
9
- LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
10
- LogLevel[LogLevel["INFO"] = 1] = "INFO";
11
- LogLevel[LogLevel["WARN"] = 2] = "WARN";
12
- LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
13
- })(LogLevel || (exports.LogLevel = LogLevel = {}));
14
- class Logger {
15
- level = LogLevel.INFO;
16
- setLevel(level) {
17
- this.level = level;
18
- }
19
- debug(...args) {
20
- if (this.level <= LogLevel.DEBUG) {
21
- console.log('[DEBUG]', ...args);
22
- }
23
- }
24
- info(...args) {
25
- if (this.level <= LogLevel.INFO) {
26
- console.log('[INFO]', ...args);
27
- }
28
- }
29
- warn(...args) {
30
- if (this.level <= LogLevel.WARN) {
31
- console.warn('[WARN]', ...args);
32
- }
33
- }
34
- error(...args) {
35
- if (this.level <= LogLevel.ERROR) {
36
- console.error('[ERROR]', ...args);
37
- }
38
- }
39
- }
40
- exports.logger = new Logger();
41
- //# sourceMappingURL=logger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,yCAAS,CAAA;IACT,uCAAQ,CAAA;IACR,uCAAQ,CAAA;IACR,yCAAS,CAAA;AACX,CAAC,EALW,QAAQ,wBAAR,QAAQ,QAKnB;AAED,MAAM,MAAM;IACF,KAAK,GAAa,QAAQ,CAAC,IAAI,CAAA;IAEvC,QAAQ,CAAC,KAAe;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,GAAG,IAAW;QAClB,IAAI,IAAI,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;YACjC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAA;QACjC,CAAC;IACH,CAAC;IAED,IAAI,CAAC,GAAG,IAAW;QACjB,IAAI,IAAI,CAAC,KAAK,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;YAChC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,CAAA;QAChC,CAAC;IACH,CAAC;IAED,IAAI,CAAC,GAAG,IAAW;QACjB,IAAI,IAAI,CAAC,KAAK,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;YAChC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,CAAA;QACjC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,GAAG,IAAW;QAClB,IAAI,IAAI,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;YACjC,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAA;QACnC,CAAC;IACH,CAAC;CACF;AAEY,QAAA,MAAM,GAAG,IAAI,MAAM,EAAE,CAAA"}
@@ -1,77 +0,0 @@
1
- /**
2
- * Error personalizado para comandos tmux
3
- */
4
- export declare class TmuxError extends Error {
5
- command: string;
6
- originalError?: any | undefined;
7
- constructor(message: string, command: string, originalError?: any | undefined);
8
- }
9
- /**
10
- * Wrapper de comandos tmux
11
- */
12
- export declare class TmuxCommands {
13
- /**
14
- * Verificar si tmux está disponible
15
- */
16
- static isAvailable(): Promise<boolean>;
17
- /**
18
- * Crear una nueva sesión tmux en modo detached
19
- */
20
- static createSession(name: string, projectPath: string): Promise<void>;
21
- /**
22
- * Abrir una terminal que se adjunte a una sesión tmux existente
23
- * (Solo macOS por ahora)
24
- */
25
- static openTerminalWindow(sessionName: string): Promise<void>;
26
- /**
27
- * Cerrar una sesión tmux
28
- */
29
- static killSession(sessionName: string): Promise<void>;
30
- /**
31
- * Verificar si una sesión existe
32
- */
33
- static sessionExists(sessionName: string): Promise<boolean>;
34
- /**
35
- * Obtener el ID del pane principal de una sesión
36
- */
37
- static getMainPaneId(sessionName: string): Promise<string>;
38
- /**
39
- * Obtener el ID de la ventana principal de una sesión
40
- */
41
- static getMainWindowId(sessionName: string): Promise<string>;
42
- /**
43
- * Dividir un pane (crear fork)
44
- * @param sessionName Nombre de la sesión
45
- * @param vertical Si es true, divide verticalmente (-h), si es false horizontalmente (-v)
46
- * @returns ID del nuevo pane creado
47
- */
48
- static splitPane(sessionName: string, vertical?: boolean): Promise<string>;
49
- /**
50
- * Cerrar un pane específico
51
- */
52
- static killPane(paneId: string): Promise<void>;
53
- /**
54
- * Enviar texto a un pane (SIN Enter)
55
- * IMPORTANTE: No envía Enter, debe llamarse a sendEnter() por separado
56
- */
57
- static sendKeys(paneId: string, text: string): Promise<void>;
58
- /**
59
- * Enviar SOLO Enter a un pane
60
- */
61
- static sendEnter(paneId: string): Promise<void>;
62
- /**
63
- * Capturar el contenido de un pane
64
- * @param paneId ID del pane
65
- * @param startLine Línea desde donde empezar a capturar (negativo = desde el final)
66
- * @returns Contenido del pane
67
- */
68
- static capturePane(paneId: string, startLine?: number): Promise<string>;
69
- /**
70
- * Listar todas las sesiones tmux
71
- */
72
- static listSessions(): Promise<Array<{
73
- id: string;
74
- name: string;
75
- }>>;
76
- }
77
- //# sourceMappingURL=tmux.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tmux.d.ts","sourceRoot":"","sources":["../../src/utils/tmux.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,qBAAa,SAAU,SAAQ,KAAK;IACE,OAAO,EAAE,MAAM;IAAS,aAAa,CAAC,EAAE,GAAG;gBAAnE,OAAO,EAAE,MAAM,EAAS,OAAO,EAAE,MAAM,EAAS,aAAa,CAAC,EAAE,GAAG,YAAA;CAIhF;AAED;;GAEG;AACH,qBAAa,YAAY;IACvB;;OAEG;WACU,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAS5C;;OAEG;WACU,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAc5E;;;OAGG;WACU,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA2CnE;;OAEG;WACU,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAc5D;;OAEG;WACU,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IASjE;;OAEG;WACU,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAsBhE;;OAEG;WACU,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAsBlE;;;;;OAKG;WACU,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,GAAE,OAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IA6BvF;;OAEG;WACU,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAcpD;;;OAGG;WACU,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAalE;;OAEG;WACU,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAarD;;;;;OAKG;WACU,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,GAAE,MAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IAqBnF;;OAEG;WACU,YAAY,IAAI,OAAO,CAAC,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAmB1E"}
@@ -1,270 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TmuxCommands = exports.TmuxError = void 0;
4
- const execa_1 = require("execa");
5
- const logger_1 = require("./logger");
6
- /**
7
- * Error personalizado para comandos tmux
8
- */
9
- class TmuxError extends Error {
10
- command;
11
- originalError;
12
- constructor(message, command, originalError) {
13
- super(message);
14
- this.command = command;
15
- this.originalError = originalError;
16
- this.name = 'TmuxError';
17
- }
18
- }
19
- exports.TmuxError = TmuxError;
20
- /**
21
- * Wrapper de comandos tmux
22
- */
23
- class TmuxCommands {
24
- /**
25
- * Verificar si tmux está disponible
26
- */
27
- static async isAvailable() {
28
- try {
29
- await (0, execa_1.execa)('which', ['tmux']);
30
- return true;
31
- }
32
- catch {
33
- return false;
34
- }
35
- }
36
- /**
37
- * Crear una nueva sesión tmux en modo detached
38
- */
39
- static async createSession(name, projectPath) {
40
- try {
41
- logger_1.logger.debug(`Creating tmux session: ${name} at ${projectPath}`);
42
- await (0, execa_1.execa)('tmux', ['new-session', '-d', '-s', name, '-c', projectPath]);
43
- logger_1.logger.info(`Tmux session created: ${name}`);
44
- }
45
- catch (error) {
46
- throw new TmuxError(`Failed to create tmux session: ${name}`, `tmux new-session -d -s ${name} -c ${projectPath}`, error);
47
- }
48
- }
49
- /**
50
- * Abrir una terminal que se adjunte a una sesión tmux existente
51
- * (Solo macOS por ahora)
52
- */
53
- static async openTerminalWindow(sessionName) {
54
- try {
55
- logger_1.logger.debug(`Opening terminal window for session: ${sessionName}`);
56
- // Detectar sistema operativo
57
- const platform = process.platform;
58
- if (platform === 'darwin') {
59
- // macOS - Usar Terminal.app
60
- const script = `tell application "Terminal"
61
- do script "tmux attach -t ${sessionName}"
62
- activate
63
- end tell`;
64
- await (0, execa_1.execa)('osascript', ['-e', script]);
65
- logger_1.logger.info('Terminal window opened (Terminal.app)');
66
- }
67
- else if (platform === 'linux') {
68
- // Linux - Intentar con gnome-terminal, xterm, etc.
69
- try {
70
- await (0, execa_1.execa)('gnome-terminal', ['--', 'tmux', 'attach', '-t', sessionName]);
71
- logger_1.logger.info('Terminal window opened (gnome-terminal)');
72
- }
73
- catch {
74
- try {
75
- await (0, execa_1.execa)('xterm', ['-e', `tmux attach -t ${sessionName}`]);
76
- logger_1.logger.info('Terminal window opened (xterm)');
77
- }
78
- catch {
79
- logger_1.logger.warn('Could not open terminal window on Linux');
80
- throw new Error('No suitable terminal emulator found');
81
- }
82
- }
83
- }
84
- else {
85
- logger_1.logger.warn(`Platform ${platform} not supported for opening terminal windows`);
86
- throw new Error(`Platform ${platform} not supported`);
87
- }
88
- }
89
- catch (error) {
90
- throw new TmuxError(`Failed to open terminal window for session: ${sessionName}`, `osascript/terminal`, error);
91
- }
92
- }
93
- /**
94
- * Cerrar una sesión tmux
95
- */
96
- static async killSession(sessionName) {
97
- try {
98
- logger_1.logger.debug(`Killing tmux session: ${sessionName}`);
99
- await (0, execa_1.execa)('tmux', ['kill-session', '-t', sessionName]);
100
- logger_1.logger.info(`Tmux session killed: ${sessionName}`);
101
- }
102
- catch (error) {
103
- throw new TmuxError(`Failed to kill tmux session: ${sessionName}`, `tmux kill-session -t ${sessionName}`, error);
104
- }
105
- }
106
- /**
107
- * Verificar si una sesión existe
108
- */
109
- static async sessionExists(sessionName) {
110
- try {
111
- await (0, execa_1.execa)('tmux', ['has-session', '-t', sessionName]);
112
- return true;
113
- }
114
- catch {
115
- return false;
116
- }
117
- }
118
- /**
119
- * Obtener el ID del pane principal de una sesión
120
- */
121
- static async getMainPaneId(sessionName) {
122
- try {
123
- logger_1.logger.debug(`Getting main pane ID for session: ${sessionName}`);
124
- const { stdout } = await (0, execa_1.execa)('tmux', [
125
- 'list-panes',
126
- '-t',
127
- sessionName,
128
- '-F',
129
- '#{pane_id}',
130
- ]);
131
- const paneId = stdout.split('\n')[0];
132
- logger_1.logger.debug(`Main pane ID: ${paneId}`);
133
- return paneId;
134
- }
135
- catch (error) {
136
- throw new TmuxError(`Failed to get main pane ID for session: ${sessionName}`, `tmux list-panes -t ${sessionName} -F '#{pane_id}'`, error);
137
- }
138
- }
139
- /**
140
- * Obtener el ID de la ventana principal de una sesión
141
- */
142
- static async getMainWindowId(sessionName) {
143
- try {
144
- logger_1.logger.debug(`Getting main window ID for session: ${sessionName}`);
145
- const { stdout } = await (0, execa_1.execa)('tmux', [
146
- 'list-windows',
147
- '-t',
148
- sessionName,
149
- '-F',
150
- '#{window_id}',
151
- ]);
152
- const windowId = stdout.split('\n')[0];
153
- logger_1.logger.debug(`Main window ID: ${windowId}`);
154
- return windowId;
155
- }
156
- catch (error) {
157
- throw new TmuxError(`Failed to get main window ID for session: ${sessionName}`, `tmux list-windows -t ${sessionName} -F '#{window_id}'`, error);
158
- }
159
- }
160
- /**
161
- * Dividir un pane (crear fork)
162
- * @param sessionName Nombre de la sesión
163
- * @param vertical Si es true, divide verticalmente (-h), si es false horizontalmente (-v)
164
- * @returns ID del nuevo pane creado
165
- */
166
- static async splitPane(sessionName, vertical = false) {
167
- try {
168
- const direction = vertical ? '-h' : '-v';
169
- logger_1.logger.debug(`Splitting pane in session ${sessionName} (${vertical ? 'vertical' : 'horizontal'})`);
170
- await (0, execa_1.execa)('tmux', ['split-window', '-t', sessionName, direction]);
171
- // Obtener el ID del último pane creado
172
- const { stdout } = await (0, execa_1.execa)('tmux', [
173
- 'list-panes',
174
- '-t',
175
- sessionName,
176
- '-F',
177
- '#{pane_id}',
178
- ]);
179
- const panes = stdout.split('\n');
180
- const newPaneId = panes[panes.length - 1];
181
- logger_1.logger.info(`New pane created: ${newPaneId}`);
182
- return newPaneId;
183
- }
184
- catch (error) {
185
- throw new TmuxError(`Failed to split pane in session: ${sessionName}`, `tmux split-window -t ${sessionName} ${vertical ? '-h' : '-v'}`, error);
186
- }
187
- }
188
- /**
189
- * Cerrar un pane específico
190
- */
191
- static async killPane(paneId) {
192
- try {
193
- logger_1.logger.debug(`Killing pane: ${paneId}`);
194
- await (0, execa_1.execa)('tmux', ['kill-pane', '-t', paneId]);
195
- logger_1.logger.info(`Pane killed: ${paneId}`);
196
- }
197
- catch (error) {
198
- throw new TmuxError(`Failed to kill pane: ${paneId}`, `tmux kill-pane -t ${paneId}`, error);
199
- }
200
- }
201
- /**
202
- * Enviar texto a un pane (SIN Enter)
203
- * IMPORTANTE: No envía Enter, debe llamarse a sendEnter() por separado
204
- */
205
- static async sendKeys(paneId, text) {
206
- try {
207
- logger_1.logger.debug(`Sending keys to pane ${paneId}: ${text.substring(0, 50)}...`);
208
- await (0, execa_1.execa)('tmux', ['send-keys', '-t', paneId, text]);
209
- }
210
- catch (error) {
211
- throw new TmuxError(`Failed to send keys to pane: ${paneId}`, `tmux send-keys -t ${paneId} "${text}"`, error);
212
- }
213
- }
214
- /**
215
- * Enviar SOLO Enter a un pane
216
- */
217
- static async sendEnter(paneId) {
218
- try {
219
- logger_1.logger.debug(`Sending Enter to pane: ${paneId}`);
220
- await (0, execa_1.execa)('tmux', ['send-keys', '-t', paneId, 'Enter']);
221
- }
222
- catch (error) {
223
- throw new TmuxError(`Failed to send Enter to pane: ${paneId}`, `tmux send-keys -t ${paneId} Enter`, error);
224
- }
225
- }
226
- /**
227
- * Capturar el contenido de un pane
228
- * @param paneId ID del pane
229
- * @param startLine Línea desde donde empezar a capturar (negativo = desde el final)
230
- * @returns Contenido del pane
231
- */
232
- static async capturePane(paneId, startLine = -100) {
233
- try {
234
- logger_1.logger.debug(`Capturing pane ${paneId} from line ${startLine}`);
235
- const { stdout } = await (0, execa_1.execa)('tmux', [
236
- 'capture-pane',
237
- '-t',
238
- paneId,
239
- '-p',
240
- '-S',
241
- startLine.toString(),
242
- ]);
243
- return stdout;
244
- }
245
- catch (error) {
246
- throw new TmuxError(`Failed to capture pane: ${paneId}`, `tmux capture-pane -t ${paneId} -p -S ${startLine}`, error);
247
- }
248
- }
249
- /**
250
- * Listar todas las sesiones tmux
251
- */
252
- static async listSessions() {
253
- try {
254
- const { stdout } = await (0, execa_1.execa)('tmux', ['list-sessions', '-F', '#{session_id}:#{session_name}']);
255
- return stdout.split('\n').map(line => {
256
- const [id, name] = line.split(':');
257
- return { id, name };
258
- });
259
- }
260
- catch (error) {
261
- // Si no hay sesiones, tmux devuelve error
262
- if (error.stderr?.includes('no server running')) {
263
- return [];
264
- }
265
- throw new TmuxError('Failed to list tmux sessions', 'tmux list-sessions', error);
266
- }
267
- }
268
- }
269
- exports.TmuxCommands = TmuxCommands;
270
- //# sourceMappingURL=tmux.js.map