autohand-cli 0.7.5 → 0.7.7

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 (136) hide show
  1. package/README.md +2 -0
  2. package/dist/{AutomodeManager-TJSW2SQY.cjs → AutomodeManager-HV6M7EAX.cjs} +61 -22
  3. package/dist/{AutomodeManager-WIMHLG4W.js → AutomodeManager-YVCJXOMQ.js} +61 -22
  4. package/dist/CommunitySkillsCache-2BITCEAA.cjs +7 -0
  5. package/dist/{CommunitySkillsCache-XPDVYU3K.js → CommunitySkillsCache-Q22FUAR5.js} +2 -2
  6. package/dist/HookManager-X47HCM5G.cjs +6 -0
  7. package/dist/{HookManager-VIX56KFU.js → HookManager-ZXKHCD7U.js} +1 -1
  8. package/dist/MemoryManager-2ATHG7BH.js +7 -0
  9. package/dist/MemoryManager-AENCGCEW.cjs +7 -0
  10. package/dist/PermissionManager-6HZGTK2N.cjs +10 -0
  11. package/dist/{PermissionManager-YFZI4ZZ6.js → PermissionManager-HATZKTRC.js} +3 -3
  12. package/dist/SessionManager-AG4WT3DP.cjs +9 -0
  13. package/dist/{SessionManager-IMW2HGR3.js → SessionManager-S5R6O3NU.js} +2 -2
  14. package/dist/{SkillsRegistry-7NICF6FY.js → SkillsRegistry-R5WDM6T3.js} +2 -2
  15. package/dist/SkillsRegistry-ZXU6YDRP.cjs +8 -0
  16. package/dist/SyncApiClient-FAOMIZAP.js +10 -0
  17. package/dist/SyncApiClient-UOA4VLLD.cjs +10 -0
  18. package/dist/add-dir-OMK3Y4DM.cjs +8 -0
  19. package/dist/add-dir-PNU7AGKO.js +8 -0
  20. package/dist/{agents-B33IAATH.js → agents-ICAC3KD3.js} +2 -2
  21. package/dist/agents-YONWPKFS.cjs +9 -0
  22. package/dist/agents-new-NV557UVG.cjs +10 -0
  23. package/dist/{agents-new-KTXJFC5E.js → agents-new-QHM3CO4B.js} +2 -2
  24. package/dist/{chunk-MFLRXVKU.js → chunk-23JQSCTO.js} +1 -1
  25. package/dist/chunk-2JPUEN44.cjs +299 -0
  26. package/dist/{chunk-5PD2L6WI.js → chunk-3YEDXG6S.js} +1 -1
  27. package/dist/{chunk-3ZUWWML7.cjs → chunk-4M2GX7RH.cjs} +2 -2
  28. package/dist/chunk-4RWTUT2Z.js +151 -0
  29. package/dist/{chunk-CHQMK2ZG.js → chunk-52MLYK5P.js} +1 -1
  30. package/dist/{chunk-CVYEUA3D.cjs → chunk-53BR4MUW.cjs} +3 -3
  31. package/dist/{chunk-5WKR4HIB.js → chunk-5DN5KNXU.js} +1 -1
  32. package/dist/{chunk-3CO5R6M2.cjs → chunk-7TOHYAUF.cjs} +2 -2
  33. package/dist/{chunk-UPR5PKX4.cjs → chunk-7VW3A7DO.cjs} +7 -3
  34. package/dist/chunk-A552JHUJ.cjs +151 -0
  35. package/dist/{chunk-NGSLABLS.js → chunk-A6QBABQ7.js} +1 -1
  36. package/dist/chunk-ARVFUZOB.js +736 -0
  37. package/dist/{chunk-2FLBGPE3.js → chunk-AVL4DKQO.js} +6 -2
  38. package/dist/{chunk-CT2VTDPQ.cjs → chunk-B4ZPNXZE.cjs} +1 -1
  39. package/dist/{chunk-OKMYLMCR.cjs → chunk-B7EUETGY.cjs} +4 -4
  40. package/dist/chunk-C26EN22G.cjs +328 -0
  41. package/dist/chunk-DOTAX65F.js +328 -0
  42. package/dist/{chunk-SKT2CRNY.cjs → chunk-DSKVMFRM.cjs} +56 -8
  43. package/dist/{chunk-FUEL6BK7.js → chunk-EKY5PKQI.js} +15 -0
  44. package/dist/{chunk-YMP7AGNT.js → chunk-G77ZY4QG.js} +1 -1
  45. package/dist/{chunk-KN5C4TR4.cjs → chunk-GDTZQSJ6.cjs} +2 -2
  46. package/dist/{chunk-536VWSZK.cjs → chunk-GFJ6AETU.cjs} +4 -4
  47. package/dist/chunk-GR7VWN63.js +613 -0
  48. package/dist/{chunk-PVM5I5WI.js → chunk-GWIAMKKF.js} +1 -1
  49. package/dist/{chunk-XAM7SFVB.cjs → chunk-GWXXFQ3F.cjs} +2 -2
  50. package/dist/{chunk-REPKBECD.cjs → chunk-JHFH3N4U.cjs} +2 -2
  51. package/dist/{chunk-4L5WYXHN.js → chunk-KH7BCZJN.js} +1 -1
  52. package/dist/{chunk-JXOXZTMA.js → chunk-L5ZFPWHY.js} +54 -6
  53. package/dist/chunk-MDWULS57.js +288 -0
  54. package/dist/{chunk-6LP2GO5C.js → chunk-MJFBVQHB.js} +2 -2
  55. package/dist/{chunk-MWLAHCU7.js → chunk-NI3BQXKU.js} +1 -1
  56. package/dist/{chunk-63XGCFCC.cjs → chunk-NYQVQYIF.cjs} +6 -103
  57. package/dist/{chunk-SKU4M27Z.js → chunk-OBV3UUIL.js} +1 -1
  58. package/dist/{chunk-27ISZOFA.js → chunk-P2Z6GDEN.js} +1 -1
  59. package/dist/{chunk-XTHHDIBG.cjs → chunk-PMMSDR44.cjs} +16 -1
  60. package/dist/chunk-PR53E47T.cjs +613 -0
  61. package/dist/{chunk-URY4AS4L.cjs → chunk-PU534KPO.cjs} +4 -4
  62. package/dist/chunk-Q3WCMY3Z.js +104 -0
  63. package/dist/{chunk-EYBIKL2I.js → chunk-QXAPHGEW.js} +4 -101
  64. package/dist/chunk-SFGJQPGC.cjs +288 -0
  65. package/dist/{chunk-53YDUYNS.cjs → chunk-SLISYSP4.cjs} +2 -2
  66. package/dist/{chunk-2E2COWKB.cjs → chunk-SYJLMBLP.cjs} +66 -10
  67. package/dist/chunk-U5WIP4HS.js +674 -0
  68. package/dist/{chunk-7HB7GSQF.js → chunk-UL7YPRCU.js} +1 -1
  69. package/dist/chunk-VDZJ3W4M.cjs +104 -0
  70. package/dist/{chunk-LUKMRIKJ.cjs → chunk-VEDIYPWY.cjs} +2 -2
  71. package/dist/{chunk-C2NFLFHH.js → chunk-VPAN5H7Q.js} +1 -1
  72. package/dist/chunk-WH3D42BQ.js +299 -0
  73. package/dist/{chunk-2FSQPRPJ.js → chunk-WIUGUR5T.js} +59 -3
  74. package/dist/{chunk-QMVTT55Y.cjs → chunk-WQSWU2QA.cjs} +4 -4
  75. package/dist/chunk-XFPITUFJ.cjs +674 -0
  76. package/dist/chunk-XFQS2VGT.cjs +736 -0
  77. package/dist/{chunk-HYTYXN2G.cjs → chunk-YAGD43KA.cjs} +10 -10
  78. package/dist/constants-G2PLP5HH.cjs +20 -0
  79. package/dist/{constants-QYBEF3DB.js → constants-ZLG6M5SI.js} +3 -1
  80. package/dist/{defaultHooks-3G3DVF6I.js → defaultHooks-R56VYG7I.js} +315 -1
  81. package/dist/{defaultHooks-Z4KA6U5C.cjs → defaultHooks-WLMRQUXG.cjs} +315 -1
  82. package/dist/{feedback-PZ2PINDU.js → feedback-HZBCTSFG.js} +2 -2
  83. package/dist/feedback-JBQ3UPGZ.cjs +10 -0
  84. package/dist/index.cjs +2669 -978
  85. package/dist/index.js +2657 -966
  86. package/dist/language-KODBDE5R.js +12 -0
  87. package/dist/language-SJT475NW.cjs +12 -0
  88. package/dist/localProjectPermissions-AYQYGTOE.cjs +17 -0
  89. package/dist/{localProjectPermissions-DURCNDZG.js → localProjectPermissions-YFFAKLUZ.js} +2 -2
  90. package/dist/login-TC2KROQI.js +14 -0
  91. package/dist/login-TYMR2ZD3.cjs +14 -0
  92. package/dist/logout-2ECV365P.js +12 -0
  93. package/dist/logout-CO3CPYZJ.cjs +12 -0
  94. package/dist/resume-EPOEF3WV.cjs +9 -0
  95. package/dist/{resume-2NERFSTD.js → resume-LOYD5MMP.js} +2 -1
  96. package/dist/share-544SIZOY.js +10 -0
  97. package/dist/share-OETK2GUF.cjs +10 -0
  98. package/dist/{skills-CRFOVWEQ.js → skills-3YEEODHK.js} +1 -1
  99. package/dist/skills-CRM55MKM.cjs +12 -0
  100. package/dist/{skills-install-Z27KPEGF.cjs → skills-install-FTGOHOZ4.cjs} +5 -5
  101. package/dist/{skills-install-RMPXN6RK.js → skills-install-KAXAQSN6.js} +2 -2
  102. package/dist/skills-new-JF4FKNUT.cjs +11 -0
  103. package/dist/{skills-new-S2YPO635.js → skills-new-JYX2GBKM.js} +2 -2
  104. package/dist/{status-VRYDAEBT.js → status-7LCXYYY4.js} +2 -1
  105. package/dist/status-E7MZEQ26.cjs +9 -0
  106. package/dist/sync-3B7SNBYC.js +14 -0
  107. package/dist/sync-4RARBQIH.cjs +39 -0
  108. package/dist/sync-H4UHHLKU.js +39 -0
  109. package/dist/sync-YZ6YZ42H.cjs +14 -0
  110. package/dist/theme-3XV5BWUB.js +12 -0
  111. package/dist/theme-Z2WS5XWZ.cjs +12 -0
  112. package/package.json +5 -2
  113. package/dist/CommunitySkillsCache-X3X237QQ.cjs +0 -7
  114. package/dist/HookManager-EOMUXKJ4.cjs +0 -6
  115. package/dist/MemoryManager-UVHILGV5.js +0 -7
  116. package/dist/MemoryManager-WO3KUZVA.cjs +0 -7
  117. package/dist/PermissionManager-PMTQN263.cjs +0 -10
  118. package/dist/SessionManager-VZNWGX4O.cjs +0 -9
  119. package/dist/SkillsRegistry-OINIPILA.cjs +0 -8
  120. package/dist/agents-GRAFXZY3.cjs +0 -9
  121. package/dist/agents-new-67NJJSDA.cjs +0 -10
  122. package/dist/chunk-55DQY6B5.js +0 -49
  123. package/dist/chunk-RYY5I7QN.cjs +0 -49
  124. package/dist/constants-PE5DLI7Q.cjs +0 -18
  125. package/dist/feedback-R66B3B3C.cjs +0 -10
  126. package/dist/localProjectPermissions-75X3ZGKH.cjs +0 -17
  127. package/dist/login-NYWZRZO5.js +0 -12
  128. package/dist/login-QNJ5C42G.cjs +0 -12
  129. package/dist/logout-MBS7L3ZW.js +0 -12
  130. package/dist/logout-MVUP7GPU.cjs +0 -12
  131. package/dist/resume-OYZMJRNO.cjs +0 -8
  132. package/dist/skills-6PIGHOWS.cjs +0 -12
  133. package/dist/skills-new-3QJUST7P.cjs +0 -11
  134. package/dist/status-CYVPCW7G.cjs +0 -8
  135. package/dist/theme-CVY6MVEK.cjs +0 -12
  136. package/dist/theme-CY7WF4M6.js +0 -12
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AUTOHAND_PATHS
3
- } from "./chunk-FUEL6BK7.js";
3
+ } from "./chunk-EKY5PKQI.js";
4
4
 
5
5
  // src/session/SessionManager.ts
6
6
  import fs from "fs-extra";
@@ -20,6 +20,8 @@ var SessionManager = class {
20
20
  const sessionId = this.generateSessionId();
21
21
  const sessionDir = path.join(this.sessionsDir, sessionId);
22
22
  await fs.ensureDir(sessionDir);
23
+ const client = process.env.AUTOHAND_CLIENT_NAME || "terminal";
24
+ const clientVersion = process.env.AUTOHAND_CLIENT_VERSION;
23
25
  const metadata = {
24
26
  sessionId,
25
27
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -28,7 +30,9 @@ var SessionManager = class {
28
30
  projectName: path.basename(projectPath),
29
31
  model,
30
32
  messageCount: 0,
31
- status: "active"
33
+ status: "active",
34
+ client,
35
+ clientVersion
32
36
  };
33
37
  const session = new Session(sessionDir, metadata);
34
38
  await session.save();
@@ -226,7 +226,7 @@ async function handleSkillsInstall(ctx, skillName) {
226
226
  if (!workspaceRoot) {
227
227
  return "Workspace root not available.";
228
228
  }
229
- const { skillsInstall } = await Promise.resolve().then(() => _interopRequireWildcard(require("./skills-install-Z27KPEGF.cjs")));
229
+ const { skillsInstall } = await Promise.resolve().then(() => _interopRequireWildcard(require("./skills-install-FTGOHOZ4.cjs")));
230
230
  const result = await skillsInstall(
231
231
  {
232
232
  skillsRegistry,
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunk3CO5R6M2cjs = require('./chunk-3CO5R6M2.cjs');
5
+ var _chunk7TOHYAUFcjs = require('./chunk-7TOHYAUF.cjs');
6
6
 
7
7
  // src/permissions/PermissionManager.ts
8
8
  var DEFAULT_SECURITY_BLACKLIST = [
@@ -121,7 +121,7 @@ var PermissionManager = class {
121
121
  async initLocalSettings() {
122
122
  if (!this.workspaceRoot || this.localSettingsLoaded) return;
123
123
  try {
124
- const localSettings = await _chunk3CO5R6M2cjs.loadLocalProjectSettings.call(void 0, this.workspaceRoot);
124
+ const localSettings = await _chunk7TOHYAUFcjs.loadLocalProjectSettings.call(void 0, this.workspaceRoot);
125
125
  if (_optionalChain([localSettings, 'optionalAccess', _ => _.permissions])) {
126
126
  this.localSettings = localSettings.permissions;
127
127
  }
@@ -133,7 +133,7 @@ var PermissionManager = class {
133
133
  * Get merged settings (global + local)
134
134
  */
135
135
  getMergedSettings() {
136
- return _chunk3CO5R6M2cjs.mergePermissions.call(void 0, this.settings, this.localSettings);
136
+ return _chunk7TOHYAUFcjs.mergePermissions.call(void 0, this.settings, this.localSettings);
137
137
  }
138
138
  /**
139
139
  * Set permission mode (can be overridden by CLI flags)
@@ -193,7 +193,7 @@ var PermissionManager = class {
193
193
  const pattern = this.contextToPattern(context);
194
194
  if (allowed && this.workspaceRoot) {
195
195
  try {
196
- await _chunk3CO5R6M2cjs.addToLocalWhitelist.call(void 0, this.workspaceRoot, pattern);
196
+ await _chunk7TOHYAUFcjs.addToLocalWhitelist.call(void 0, this.workspaceRoot, pattern);
197
197
  if (!this.localSettings) {
198
198
  this.localSettings = { whitelist: [] };
199
199
  }
@@ -0,0 +1,328 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/commands/add-dir.ts
2
+ var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
3
+ var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
4
+ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
5
+
6
+ // src/startup/workspaceSafety.ts
7
+ var _os = require('os'); var _os2 = _interopRequireDefault(_os);
8
+
9
+
10
+
11
+ var DANGEROUS_PATHS = {
12
+ // Filesystem roots (Unix and Windows)
13
+ roots: ["/", "C:\\", "D:\\", "E:\\", "F:\\", "G:\\"],
14
+ // System directories (Unix/Linux)
15
+ unix: [
16
+ "/etc",
17
+ "/var",
18
+ "/usr",
19
+ "/opt",
20
+ "/bin",
21
+ "/sbin",
22
+ "/lib",
23
+ "/lib64",
24
+ "/root",
25
+ "/sys",
26
+ "/proc",
27
+ "/dev",
28
+ "/boot",
29
+ "/run",
30
+ "/snap"
31
+ ],
32
+ // System directories (macOS)
33
+ macos: [
34
+ "/System",
35
+ "/Library",
36
+ "/Applications",
37
+ "/private",
38
+ "/cores",
39
+ "/Volumes"
40
+ ],
41
+ // System directories (Windows)
42
+ windows: [
43
+ "C:\\Windows",
44
+ "C:\\Program Files",
45
+ "C:\\Program Files (x86)",
46
+ "C:\\ProgramData",
47
+ "C:\\Recovery",
48
+ "C:\\$Recycle.Bin"
49
+ ],
50
+ // WSL mount points (Windows drives mounted in WSL)
51
+ wsl: ["/mnt/c", "/mnt/d", "/mnt/e", "/mnt/f"]
52
+ };
53
+ function normalizePath(inputPath) {
54
+ let normalized = _path2.default.resolve(inputPath);
55
+ try {
56
+ normalized = _fsextra2.default.realpathSync(normalized);
57
+ } catch (e) {
58
+ }
59
+ if (normalized.length > 1 && normalized.endsWith(_path2.default.sep)) {
60
+ normalized = normalized.slice(0, -1);
61
+ }
62
+ return normalized;
63
+ }
64
+ function pathsEqual(path1, path22) {
65
+ const normalized1 = normalizePath(path1);
66
+ const normalized2 = normalizePath(path22);
67
+ if (process.platform === "darwin" || process.platform === "win32") {
68
+ return normalized1.toLowerCase() === normalized2.toLowerCase();
69
+ }
70
+ return normalized1 === normalized2;
71
+ }
72
+ function isFilesystemRoot(workspacePath) {
73
+ const normalized = normalizePath(workspacePath);
74
+ if (normalized === "/") {
75
+ return true;
76
+ }
77
+ if (process.platform === "win32") {
78
+ if (/^[A-Za-z]:[\\/]?$/.test(normalized)) {
79
+ return true;
80
+ }
81
+ }
82
+ return false;
83
+ }
84
+ function isHomeDirectory(workspacePath) {
85
+ const homeDir = _os2.default.homedir();
86
+ return pathsEqual(workspacePath, homeDir);
87
+ }
88
+ function isParentOfHome(workspacePath) {
89
+ const homeDir = _os2.default.homedir();
90
+ const normalized = normalizePath(workspacePath);
91
+ const normalizedHome = normalizePath(homeDir);
92
+ if (process.platform === "darwin" || process.platform === "win32") {
93
+ return normalizedHome.toLowerCase().startsWith(normalized.toLowerCase() + _path2.default.sep);
94
+ }
95
+ return normalizedHome.startsWith(normalized + _path2.default.sep);
96
+ }
97
+ function isSystemDirectory(workspacePath) {
98
+ const normalized = normalizePath(workspacePath);
99
+ const dangerousPaths = [
100
+ ...DANGEROUS_PATHS.roots,
101
+ ...DANGEROUS_PATHS.unix,
102
+ ...DANGEROUS_PATHS.macos,
103
+ ...DANGEROUS_PATHS.windows,
104
+ ...DANGEROUS_PATHS.wsl
105
+ ];
106
+ for (const dangerous of dangerousPaths) {
107
+ if (pathsEqual(normalized, dangerous)) {
108
+ return true;
109
+ }
110
+ }
111
+ return false;
112
+ }
113
+ function isWindowsUserHome(workspacePath) {
114
+ const windowsUsersPattern = /^[A-Za-z]:[/\\]Users([/\\][^/\\]+)?$/i;
115
+ if (windowsUsersPattern.test(workspacePath)) {
116
+ return true;
117
+ }
118
+ return false;
119
+ }
120
+ function isWslWindowsHome(workspacePath) {
121
+ const normalized = normalizePath(workspacePath);
122
+ for (const wslMount of DANGEROUS_PATHS.wsl) {
123
+ if (pathsEqual(normalized, wslMount)) {
124
+ return true;
125
+ }
126
+ }
127
+ const wslUsersPattern = /^\/mnt\/[a-z]\/users(\/[^/]+)?$/i;
128
+ if (wslUsersPattern.test(normalized)) {
129
+ return true;
130
+ }
131
+ const wslWindowsPattern = /^\/mnt\/[a-z]\/windows$/i;
132
+ if (wslWindowsPattern.test(normalized)) {
133
+ return true;
134
+ }
135
+ return false;
136
+ }
137
+ function getDangerReason(workspacePath) {
138
+ const normalized = normalizePath(workspacePath);
139
+ if (isFilesystemRoot(workspacePath)) {
140
+ return "This is the filesystem root directory.";
141
+ }
142
+ if (isHomeDirectory(workspacePath)) {
143
+ return "This is your home directory.";
144
+ }
145
+ if (isParentOfHome(workspacePath)) {
146
+ return "This directory contains user home directories.";
147
+ }
148
+ if (isWslWindowsHome(workspacePath)) {
149
+ return "This is a Windows system directory accessed via WSL.";
150
+ }
151
+ if (normalized.startsWith("/etc") || normalized.match(/^[A-Za-z]:\\Windows/i)) {
152
+ return "This is a system configuration directory.";
153
+ }
154
+ if (normalized.startsWith("/var") || normalized.match(/^[A-Za-z]:\\ProgramData/i)) {
155
+ return "This is a system data directory.";
156
+ }
157
+ if (normalized.startsWith("/usr") || normalized.match(/^[A-Za-z]:\\Program Files/i)) {
158
+ return "This is a system programs directory.";
159
+ }
160
+ if (normalized.startsWith("/System") || normalized.startsWith("/Library")) {
161
+ return "This is a macOS system directory.";
162
+ }
163
+ return "This directory is too broad for safe AI agent operation.";
164
+ }
165
+ function checkWorkspaceSafety(workspacePath) {
166
+ try {
167
+ const normalized = normalizePath(workspacePath);
168
+ if (isFilesystemRoot(normalized)) {
169
+ return {
170
+ safe: false,
171
+ reason: "This is the filesystem root directory. Running an AI agent here could modify critical system files.",
172
+ suggestion: "Navigate to a specific project folder and try again."
173
+ };
174
+ }
175
+ if (isHomeDirectory(normalized)) {
176
+ return {
177
+ safe: false,
178
+ reason: "This is your home directory. Running an AI agent here could modify files across your entire user account.",
179
+ suggestion: "Navigate to a specific project folder (e.g., ~/projects/my-app) and try again."
180
+ };
181
+ }
182
+ if (isParentOfHome(normalized)) {
183
+ return {
184
+ safe: false,
185
+ reason: "This directory contains user home directories. Running an AI agent here is too broad.",
186
+ suggestion: "Navigate to a specific project folder and try again."
187
+ };
188
+ }
189
+ if (isSystemDirectory(normalized)) {
190
+ return {
191
+ safe: false,
192
+ reason: getDangerReason(normalized),
193
+ suggestion: "Navigate to a specific project folder and try again."
194
+ };
195
+ }
196
+ if (isWslWindowsHome(normalized)) {
197
+ return {
198
+ safe: false,
199
+ reason: getDangerReason(normalized),
200
+ suggestion: "Navigate to a specific project folder and try again."
201
+ };
202
+ }
203
+ if (isWindowsUserHome(workspacePath)) {
204
+ return {
205
+ safe: false,
206
+ reason: "This is a Windows user home directory. Running an AI agent here could modify files across the user account.",
207
+ suggestion: "Navigate to a specific project folder and try again."
208
+ };
209
+ }
210
+ return { safe: true };
211
+ } catch (error) {
212
+ console.warn(`Warning: Could not verify workspace safety for "${workspacePath}": ${error}`);
213
+ return { safe: true };
214
+ }
215
+ }
216
+ function printDangerousWorkspaceWarning(workspacePath, result) {
217
+ const boxWidth = 65;
218
+ const horizontalLine = "\u2500".repeat(boxWidth - 2);
219
+ console.log();
220
+ console.log(_chalk2.default.red(`\u250C${horizontalLine}\u2510`));
221
+ console.log(_chalk2.default.red(`\u2502`) + _chalk2.default.yellow.bold(" \u26A0\uFE0F Unsafe Workspace Directory") + " ".repeat(boxWidth - 35) + _chalk2.default.red("\u2502"));
222
+ console.log(_chalk2.default.red(`\u251C${horizontalLine}\u2524`));
223
+ console.log(_chalk2.default.red(`\u2502`) + " ".repeat(boxWidth - 2) + _chalk2.default.red("\u2502"));
224
+ console.log(_chalk2.default.red(`\u2502`) + _chalk2.default.white(" You're trying to run autohand in:") + " ".repeat(boxWidth - 38) + _chalk2.default.red("\u2502"));
225
+ const pathLine = ` ${workspacePath}`;
226
+ const truncatedPath = pathLine.length > boxWidth - 4 ? pathLine.slice(0, boxWidth - 7) + "..." : pathLine;
227
+ console.log(_chalk2.default.red(`\u2502`) + _chalk2.default.cyan(truncatedPath) + " ".repeat(Math.max(0, boxWidth - 2 - truncatedPath.length)) + _chalk2.default.red("\u2502"));
228
+ console.log(_chalk2.default.red(`\u2502`) + " ".repeat(boxWidth - 2) + _chalk2.default.red("\u2502"));
229
+ if (result.reason) {
230
+ const reasonWords = result.reason.split(" ");
231
+ let currentLine = " ";
232
+ for (const word of reasonWords) {
233
+ if (currentLine.length + word.length + 1 > boxWidth - 4) {
234
+ const paddedLine = currentLine + " ".repeat(Math.max(0, boxWidth - 2 - currentLine.length));
235
+ console.log(_chalk2.default.red(`\u2502`) + _chalk2.default.white(paddedLine) + _chalk2.default.red("\u2502"));
236
+ currentLine = " ";
237
+ }
238
+ currentLine += (currentLine === " " ? "" : " ") + word;
239
+ }
240
+ if (currentLine.length > 2) {
241
+ const paddedLine = currentLine + " ".repeat(Math.max(0, boxWidth - 2 - currentLine.length));
242
+ console.log(_chalk2.default.red(`\u2502`) + _chalk2.default.white(paddedLine) + _chalk2.default.red("\u2502"));
243
+ }
244
+ }
245
+ console.log(_chalk2.default.red(`\u2502`) + " ".repeat(boxWidth - 2) + _chalk2.default.red("\u2502"));
246
+ console.log(_chalk2.default.red(`\u2502`) + _chalk2.default.white(" Please navigate to a specific project folder:") + " ".repeat(boxWidth - 50) + _chalk2.default.red("\u2502"));
247
+ console.log(_chalk2.default.red(`\u2502`) + " ".repeat(boxWidth - 2) + _chalk2.default.red("\u2502"));
248
+ console.log(_chalk2.default.red(`\u2502`) + _chalk2.default.cyan(" cd ~/projects/my-app") + " ".repeat(boxWidth - 27) + _chalk2.default.red("\u2502"));
249
+ console.log(_chalk2.default.red(`\u2502`) + _chalk2.default.cyan(" autohand") + " ".repeat(boxWidth - 15) + _chalk2.default.red("\u2502"));
250
+ console.log(_chalk2.default.red(`\u2502`) + " ".repeat(boxWidth - 2) + _chalk2.default.red("\u2502"));
251
+ console.log(_chalk2.default.red(`\u2502`) + _chalk2.default.white(" Or specify a path directly:") + " ".repeat(boxWidth - 32) + _chalk2.default.red("\u2502"));
252
+ console.log(_chalk2.default.red(`\u2502`) + " ".repeat(boxWidth - 2) + _chalk2.default.red("\u2502"));
253
+ console.log(_chalk2.default.red(`\u2502`) + _chalk2.default.cyan(" autohand --path ~/projects/my-app") + " ".repeat(boxWidth - 40) + _chalk2.default.red("\u2502"));
254
+ console.log(_chalk2.default.red(`\u2502`) + " ".repeat(boxWidth - 2) + _chalk2.default.red("\u2502"));
255
+ console.log(_chalk2.default.red(`\u2514${horizontalLine}\u2518`));
256
+ console.log();
257
+ }
258
+
259
+ // src/commands/add-dir.ts
260
+ async function addDir(ctx, args) {
261
+ const dirPath = args.join(" ").trim();
262
+ if (!dirPath) {
263
+ console.log();
264
+ console.log(_chalk2.default.bold.cyan("Workspace Directories"));
265
+ console.log(_chalk2.default.gray("\u2500".repeat(50)));
266
+ console.log();
267
+ console.log(_chalk2.default.bold("Primary Workspace:"));
268
+ console.log(_chalk2.default.cyan(` ${ctx.workspaceRoot}`));
269
+ console.log();
270
+ if (ctx.additionalDirs.length > 0) {
271
+ console.log(_chalk2.default.bold("Additional Directories:"));
272
+ ctx.additionalDirs.forEach((dir, index) => {
273
+ console.log(_chalk2.default.green(` ${index + 1}. ${dir}`));
274
+ });
275
+ } else {
276
+ console.log(_chalk2.default.gray("No additional directories configured."));
277
+ }
278
+ console.log();
279
+ console.log(_chalk2.default.gray("Usage: /add-dir <path> to add a new directory"));
280
+ console.log();
281
+ return null;
282
+ }
283
+ const resolvedPath = _path2.default.resolve(dirPath);
284
+ if (!await _fsextra2.default.pathExists(resolvedPath)) {
285
+ console.log(_chalk2.default.red(`Error: Directory does not exist: ${dirPath}`));
286
+ return null;
287
+ }
288
+ const stats = await _fsextra2.default.stat(resolvedPath);
289
+ if (!stats.isDirectory()) {
290
+ console.log(_chalk2.default.red(`Error: Path is not a directory: ${dirPath}`));
291
+ return null;
292
+ }
293
+ const safetyResult = checkWorkspaceSafety(resolvedPath);
294
+ if (!safetyResult.safe) {
295
+ console.log(_chalk2.default.red(`Error: Unsafe directory: ${dirPath}`));
296
+ console.log(_chalk2.default.yellow(` ${safetyResult.reason}`));
297
+ return null;
298
+ }
299
+ if (resolvedPath === ctx.workspaceRoot) {
300
+ console.log(_chalk2.default.yellow(`Directory is already the primary workspace: ${resolvedPath}`));
301
+ return null;
302
+ }
303
+ if (ctx.additionalDirs.includes(resolvedPath)) {
304
+ console.log(_chalk2.default.yellow(`Directory already added: ${resolvedPath}`));
305
+ return null;
306
+ }
307
+ ctx.addAdditionalDir(resolvedPath);
308
+ console.log(_chalk2.default.green(`Added directory: ${resolvedPath}`));
309
+ console.log(_chalk2.default.gray("You can now read, write, and modify files in this directory."));
310
+ return null;
311
+ }
312
+ var metadata = {
313
+ command: "/add-dir",
314
+ description: "add additional directories to workspace scope",
315
+ implemented: true
316
+ };
317
+
318
+
319
+
320
+
321
+
322
+
323
+ exports.checkWorkspaceSafety = checkWorkspaceSafety; exports.printDangerousWorkspaceWarning = printDangerousWorkspaceWarning; exports.addDir = addDir; exports.metadata = metadata;
324
+ /**
325
+ * @license
326
+ * Copyright 2025 Autohand AI LLC
327
+ * SPDX-License-Identifier: Apache-2.0
328
+ */