autohand-cli 0.7.6 → 0.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AutomodeManager-TJSW2SQY.cjs → AutomodeManager-HV6M7EAX.cjs} +61 -22
- package/dist/{AutomodeManager-WIMHLG4W.js → AutomodeManager-YVCJXOMQ.js} +61 -22
- package/dist/CommunitySkillsCache-2BITCEAA.cjs +7 -0
- package/dist/{CommunitySkillsCache-XPDVYU3K.js → CommunitySkillsCache-Q22FUAR5.js} +2 -2
- package/dist/HookManager-X47HCM5G.cjs +6 -0
- package/dist/{HookManager-VIX56KFU.js → HookManager-ZXKHCD7U.js} +1 -1
- package/dist/MemoryManager-2ATHG7BH.js +7 -0
- package/dist/MemoryManager-AENCGCEW.cjs +7 -0
- package/dist/PermissionManager-6HZGTK2N.cjs +10 -0
- package/dist/{PermissionManager-YFZI4ZZ6.js → PermissionManager-HATZKTRC.js} +3 -3
- package/dist/SessionManager-AG4WT3DP.cjs +9 -0
- package/dist/{SessionManager-XDBEQUPG.js → SessionManager-S5R6O3NU.js} +2 -2
- package/dist/{SkillsRegistry-7NICF6FY.js → SkillsRegistry-R5WDM6T3.js} +2 -2
- package/dist/SkillsRegistry-ZXU6YDRP.cjs +8 -0
- package/dist/SyncApiClient-FAOMIZAP.js +10 -0
- package/dist/SyncApiClient-UOA4VLLD.cjs +10 -0
- package/dist/add-dir-OMK3Y4DM.cjs +8 -0
- package/dist/add-dir-PNU7AGKO.js +8 -0
- package/dist/{agents-B33IAATH.js → agents-ICAC3KD3.js} +2 -2
- package/dist/agents-YONWPKFS.cjs +9 -0
- package/dist/agents-new-NV557UVG.cjs +10 -0
- package/dist/{agents-new-KTXJFC5E.js → agents-new-QHM3CO4B.js} +2 -2
- package/dist/{chunk-MFLRXVKU.js → chunk-23JQSCTO.js} +1 -1
- package/dist/chunk-2JPUEN44.cjs +299 -0
- package/dist/{chunk-5PD2L6WI.js → chunk-3YEDXG6S.js} +1 -1
- package/dist/{chunk-3ZUWWML7.cjs → chunk-4M2GX7RH.cjs} +2 -2
- package/dist/{chunk-R5KNHJ27.js → chunk-4RWTUT2Z.js} +1 -1
- package/dist/{chunk-CHQMK2ZG.js → chunk-52MLYK5P.js} +1 -1
- package/dist/{chunk-CVYEUA3D.cjs → chunk-53BR4MUW.cjs} +3 -3
- package/dist/{chunk-JYTXG6OV.cjs → chunk-54GVL2SE.cjs} +4 -2
- package/dist/{chunk-5WKR4HIB.js → chunk-5DN5KNXU.js} +1 -1
- package/dist/{chunk-K6NBYSME.cjs → chunk-5MDDOGTD.cjs} +6 -6
- package/dist/{chunk-5MCDN53U.js → chunk-6KMAJTU3.js} +4 -2
- package/dist/{chunk-3CO5R6M2.cjs → chunk-7TOHYAUF.cjs} +2 -2
- package/dist/{chunk-67NJKV5A.cjs → chunk-7VW3A7DO.cjs} +2 -2
- package/dist/{chunk-2W3QTBNG.cjs → chunk-A552JHUJ.cjs} +2 -2
- package/dist/{chunk-NGSLABLS.js → chunk-A6QBABQ7.js} +1 -1
- package/dist/chunk-ARVFUZOB.js +736 -0
- package/dist/{chunk-VO3JKFUH.js → chunk-AVL4DKQO.js} +1 -1
- package/dist/{chunk-CT2VTDPQ.cjs → chunk-B4ZPNXZE.cjs} +1 -1
- package/dist/{chunk-OKMYLMCR.cjs → chunk-B7EUETGY.cjs} +4 -4
- package/dist/chunk-C26EN22G.cjs +328 -0
- package/dist/chunk-DOTAX65F.js +328 -0
- package/dist/{chunk-4KZCGK7D.js → chunk-DPJ3IIBB.js} +1 -1
- package/dist/{chunk-SKT2CRNY.cjs → chunk-DSKVMFRM.cjs} +56 -8
- package/dist/{chunk-723DZKBU.js → chunk-EDGV5BNH.js} +2 -2
- package/dist/{chunk-FUEL6BK7.js → chunk-EKY5PKQI.js} +15 -0
- package/dist/{chunk-YMP7AGNT.js → chunk-G77ZY4QG.js} +1 -1
- package/dist/{chunk-KN5C4TR4.cjs → chunk-GDTZQSJ6.cjs} +2 -2
- package/dist/{chunk-536VWSZK.cjs → chunk-GFJ6AETU.cjs} +4 -4
- package/dist/{chunk-PVM5I5WI.js → chunk-GWIAMKKF.js} +1 -1
- package/dist/{chunk-XAM7SFVB.cjs → chunk-GWXXFQ3F.cjs} +2 -2
- package/dist/{chunk-REPKBECD.cjs → chunk-JHFH3N4U.cjs} +2 -2
- package/dist/{chunk-4L5WYXHN.js → chunk-KH7BCZJN.js} +1 -1
- package/dist/{chunk-JXOXZTMA.js → chunk-L5ZFPWHY.js} +54 -6
- package/dist/chunk-MDWULS57.js +288 -0
- package/dist/{chunk-6LP2GO5C.js → chunk-MJFBVQHB.js} +2 -2
- package/dist/{chunk-MWLAHCU7.js → chunk-NI3BQXKU.js} +1 -1
- package/dist/{chunk-SKU4M27Z.js → chunk-OBV3UUIL.js} +1 -1
- package/dist/{chunk-27ISZOFA.js → chunk-P2Z6GDEN.js} +1 -1
- package/dist/{chunk-XTHHDIBG.cjs → chunk-PMMSDR44.cjs} +16 -1
- package/dist/{chunk-URY4AS4L.cjs → chunk-PU534KPO.cjs} +4 -4
- package/dist/chunk-SFGJQPGC.cjs +288 -0
- package/dist/{chunk-53YDUYNS.cjs → chunk-SLISYSP4.cjs} +2 -2
- package/dist/{chunk-2E2COWKB.cjs → chunk-SYJLMBLP.cjs} +66 -10
- package/dist/chunk-U5WIP4HS.js +674 -0
- package/dist/{chunk-7HB7GSQF.js → chunk-UL7YPRCU.js} +1 -1
- package/dist/{chunk-LUKMRIKJ.cjs → chunk-VEDIYPWY.cjs} +2 -2
- package/dist/{chunk-C2NFLFHH.js → chunk-VPAN5H7Q.js} +1 -1
- package/dist/chunk-WH3D42BQ.js +299 -0
- package/dist/{chunk-2FSQPRPJ.js → chunk-WIUGUR5T.js} +59 -3
- package/dist/{chunk-QMVTT55Y.cjs → chunk-WQSWU2QA.cjs} +4 -4
- package/dist/chunk-XFPITUFJ.cjs +674 -0
- package/dist/chunk-XFQS2VGT.cjs +736 -0
- package/dist/{chunk-HYTYXN2G.cjs → chunk-YAGD43KA.cjs} +10 -10
- package/dist/{chunk-KJ67C72C.cjs → chunk-YDOR2OCA.cjs} +2 -2
- package/dist/constants-G2PLP5HH.cjs +20 -0
- package/dist/{constants-QYBEF3DB.js → constants-ZLG6M5SI.js} +3 -1
- package/dist/{defaultHooks-3G3DVF6I.js → defaultHooks-R56VYG7I.js} +315 -1
- package/dist/{defaultHooks-Z4KA6U5C.cjs → defaultHooks-WLMRQUXG.cjs} +315 -1
- package/dist/{feedback-PZ2PINDU.js → feedback-HZBCTSFG.js} +2 -2
- package/dist/feedback-JBQ3UPGZ.cjs +10 -0
- package/dist/index.cjs +897 -600
- package/dist/index.js +1438 -1141
- package/dist/language-KODBDE5R.js +12 -0
- package/dist/language-SJT475NW.cjs +12 -0
- package/dist/localProjectPermissions-AYQYGTOE.cjs +17 -0
- package/dist/{localProjectPermissions-DURCNDZG.js → localProjectPermissions-YFFAKLUZ.js} +2 -2
- package/dist/login-TC2KROQI.js +14 -0
- package/dist/login-TYMR2ZD3.cjs +14 -0
- package/dist/logout-2ECV365P.js +12 -0
- package/dist/logout-CO3CPYZJ.cjs +12 -0
- package/dist/resume-EPOEF3WV.cjs +9 -0
- package/dist/{resume-CWYAK6XR.js → resume-LOYD5MMP.js} +2 -2
- package/dist/share-APR5S2CS.cjs +10 -0
- package/dist/share-VLJFDZKR.js +10 -0
- package/dist/{skills-CRFOVWEQ.js → skills-3YEEODHK.js} +1 -1
- package/dist/skills-CRM55MKM.cjs +12 -0
- package/dist/{skills-install-Z27KPEGF.cjs → skills-install-FTGOHOZ4.cjs} +5 -5
- package/dist/{skills-install-RMPXN6RK.js → skills-install-KAXAQSN6.js} +2 -2
- package/dist/skills-new-JF4FKNUT.cjs +11 -0
- package/dist/{skills-new-S2YPO635.js → skills-new-JYX2GBKM.js} +2 -2
- package/dist/status-DAEFE7ZC.cjs +9 -0
- package/dist/{status-GPAZ67ZZ.js → status-PBFFUC4Q.js} +2 -2
- package/dist/sync-3B7SNBYC.js +14 -0
- package/dist/sync-4RARBQIH.cjs +39 -0
- package/dist/sync-H4UHHLKU.js +39 -0
- package/dist/sync-YZ6YZ42H.cjs +14 -0
- package/dist/theme-3XV5BWUB.js +12 -0
- package/dist/theme-Z2WS5XWZ.cjs +12 -0
- package/package.json +4 -2
- package/dist/CommunitySkillsCache-X3X237QQ.cjs +0 -7
- package/dist/HookManager-EOMUXKJ4.cjs +0 -6
- package/dist/MemoryManager-UVHILGV5.js +0 -7
- package/dist/MemoryManager-WO3KUZVA.cjs +0 -7
- package/dist/PermissionManager-PMTQN263.cjs +0 -10
- package/dist/SessionManager-M5ZLCLCW.cjs +0 -9
- package/dist/SkillsRegistry-OINIPILA.cjs +0 -8
- package/dist/agents-GRAFXZY3.cjs +0 -9
- package/dist/agents-new-67NJJSDA.cjs +0 -10
- package/dist/constants-PE5DLI7Q.cjs +0 -18
- package/dist/feedback-R66B3B3C.cjs +0 -10
- package/dist/localProjectPermissions-75X3ZGKH.cjs +0 -17
- package/dist/login-NYWZRZO5.js +0 -12
- package/dist/login-QNJ5C42G.cjs +0 -12
- package/dist/logout-MBS7L3ZW.js +0 -12
- package/dist/logout-MVUP7GPU.cjs +0 -12
- package/dist/resume-ANISKRWL.cjs +0 -9
- package/dist/share-3PSV53CQ.js +0 -10
- package/dist/share-4ACH6626.cjs +0 -10
- package/dist/skills-6PIGHOWS.cjs +0 -12
- package/dist/skills-new-3QJUST7P.cjs +0 -11
- package/dist/status-4U5CPUVT.cjs +0 -9
- package/dist/theme-CVY6MVEK.cjs +0 -12
- package/dist/theme-CY7WF4M6.js +0 -12
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkWQSWU2QAcjs = require('./chunk-WQSWU2QA.cjs');
|
|
9
9
|
|
|
10
10
|
// src/commands/theme.ts
|
|
11
11
|
var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
|
|
12
12
|
var _enquirer = require('enquirer'); var _enquirer2 = _interopRequireDefault(_enquirer);
|
|
13
13
|
async function theme(ctx) {
|
|
14
14
|
const { Select } = _enquirer2.default;
|
|
15
|
-
const themes =
|
|
16
|
-
const currentTheme =
|
|
15
|
+
const themes = _chunkWQSWU2QAcjs.listAvailableThemes.call(void 0, );
|
|
16
|
+
const currentTheme = _chunkWQSWU2QAcjs.isThemeInitialized.call(void 0, ) ? _chunkWQSWU2QAcjs.getTheme.call(void 0, ).name : _optionalChain([ctx, 'access', _ => _.config, 'access', _2 => _2.ui, 'optionalAccess', _3 => _3.theme]) || "dark";
|
|
17
17
|
console.log(_chalk2.default.cyan("\n\u{1F3A8} Theme Selection\n"));
|
|
18
18
|
console.log(_chalk2.default.gray(`Current theme: ${_chalk2.default.white(currentTheme)}`));
|
|
19
|
-
console.log(_chalk2.default.gray(`Custom themes location: ${
|
|
19
|
+
console.log(_chalk2.default.gray(`Custom themes location: ${_chunkWQSWU2QAcjs.CUSTOM_THEMES_DIR}
|
|
20
20
|
`));
|
|
21
21
|
const choices = themes.map((name) => ({
|
|
22
22
|
name,
|
|
@@ -35,12 +35,12 @@ async function theme(ctx) {
|
|
|
35
35
|
console.log(_chalk2.default.gray("\nNo change made."));
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
_chunkWQSWU2QAcjs.initTheme.call(void 0, selected);
|
|
39
39
|
ctx.config.ui = { ...ctx.config.ui, theme: selected };
|
|
40
|
-
await
|
|
40
|
+
await _chunkWQSWU2QAcjs.saveConfig.call(void 0, ctx.config);
|
|
41
41
|
console.log(_chalk2.default.green(`
|
|
42
42
|
\u2713 Theme changed to '${selected}'`));
|
|
43
|
-
const newTheme =
|
|
43
|
+
const newTheme = _chunkWQSWU2QAcjs.getTheme.call(void 0, );
|
|
44
44
|
console.log("\nTheme preview:");
|
|
45
45
|
console.log(` ${newTheme.fg("accent", "\u25CF accent")} ${newTheme.fg("success", "\u25CF success")} ${newTheme.fg("error", "\u25CF error")} ${newTheme.fg("warning", "\u25CF warning")}`);
|
|
46
46
|
console.log(` ${newTheme.fg("muted", "\u25CF muted")} ${newTheme.fg("dim", "\u25CF dim")} ${newTheme.fg("text", "\u25CF text")}`);
|
|
@@ -52,15 +52,15 @@ async function theme(ctx) {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
async function themeInfo() {
|
|
55
|
-
if (!
|
|
55
|
+
if (!_chunkWQSWU2QAcjs.isThemeInitialized.call(void 0, )) {
|
|
56
56
|
console.log(_chalk2.default.yellow("Theme not initialized."));
|
|
57
57
|
return null;
|
|
58
58
|
}
|
|
59
|
-
const currentTheme =
|
|
59
|
+
const currentTheme = _chunkWQSWU2QAcjs.getTheme.call(void 0, );
|
|
60
60
|
console.log(_chalk2.default.cyan("\n\u{1F3A8} Current Theme Info\n"));
|
|
61
61
|
console.log(_chalk2.default.gray(`Name: ${_chalk2.default.white(currentTheme.name)}`));
|
|
62
62
|
console.log(_chalk2.default.gray(`Color mode: ${_chalk2.default.white(currentTheme.getColorMode())}`));
|
|
63
|
-
console.log(_chalk2.default.gray(`Custom themes dir: ${
|
|
63
|
+
console.log(_chalk2.default.gray(`Custom themes dir: ${_chunkWQSWU2QAcjs.CUSTOM_THEMES_DIR}`));
|
|
64
64
|
console.log();
|
|
65
65
|
console.log("Color preview:");
|
|
66
66
|
console.log(` ${currentTheme.fg("accent", "\u25CF accent")} ${currentTheme.fg("success", "\u25CF success")} ${currentTheme.fg("error", "\u25CF error")} ${currentTheme.fg("warning", "\u25CF warning")}`);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk54GVL2SEcjs = require('./chunk-54GVL2SE.cjs');
|
|
4
4
|
|
|
5
5
|
// src/commands/status.ts
|
|
6
6
|
var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
|
|
@@ -25,7 +25,7 @@ async function gatherStatusData(ctx) {
|
|
|
25
25
|
apiConnected = false;
|
|
26
26
|
}
|
|
27
27
|
return {
|
|
28
|
-
version:
|
|
28
|
+
version: _chunk54GVL2SEcjs.package_default.version,
|
|
29
29
|
sessionId: _nullishCoalesce(_optionalChain([currentSession, 'optionalAccess', _ => _.metadata, 'access', _2 => _2.sessionId]), () => ( null)),
|
|
30
30
|
cwd: ctx.workspaceRoot,
|
|
31
31
|
provider: _nullishCoalesce(ctx.provider, () => ( "openrouter")),
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkPMMSDR44cjs = require('./chunk-PMMSDR44.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
exports.AUTH_CONFIG = _chunkPMMSDR44cjs.AUTH_CONFIG; exports.AUTOHAND_FILES = _chunkPMMSDR44cjs.AUTOHAND_FILES; exports.AUTOHAND_HOME = _chunkPMMSDR44cjs.AUTOHAND_HOME; exports.AUTOHAND_PATHS = _chunkPMMSDR44cjs.AUTOHAND_PATHS; exports.PROJECT_DIR_NAME = _chunkPMMSDR44cjs.PROJECT_DIR_NAME; exports.SKILL_LOCATIONS = _chunkPMMSDR44cjs.SKILL_LOCATIONS; exports.SYNC_CONFIG = _chunkPMMSDR44cjs.SYNC_CONFIG; exports.getProjectSkillLocations = _chunkPMMSDR44cjs.getProjectSkillLocations;
|
|
@@ -5,8 +5,9 @@ import {
|
|
|
5
5
|
AUTOHAND_PATHS,
|
|
6
6
|
PROJECT_DIR_NAME,
|
|
7
7
|
SKILL_LOCATIONS,
|
|
8
|
+
SYNC_CONFIG,
|
|
8
9
|
getProjectSkillLocations
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-EKY5PKQI.js";
|
|
10
11
|
export {
|
|
11
12
|
AUTH_CONFIG,
|
|
12
13
|
AUTOHAND_FILES,
|
|
@@ -14,5 +15,6 @@ export {
|
|
|
14
15
|
AUTOHAND_PATHS,
|
|
15
16
|
PROJECT_DIR_NAME,
|
|
16
17
|
SKILL_LOCATIONS,
|
|
18
|
+
SYNC_CONFIG,
|
|
17
19
|
getProjectSkillLocations
|
|
18
20
|
};
|
|
@@ -453,14 +453,328 @@ var HOOK_SCRIPTS = {
|
|
|
453
453
|
"git-auto-stage.sh": GIT_AUTO_STAGE_SCRIPT,
|
|
454
454
|
"security-guard.sh": SECURITY_GUARD_SCRIPT
|
|
455
455
|
};
|
|
456
|
+
var SOUND_ALERT_SCRIPT_PS1 = `# Sound Alert Hook for Autohand (PowerShell)
|
|
457
|
+
# Plays a sound when task completes
|
|
458
|
+
|
|
459
|
+
param()
|
|
460
|
+
|
|
461
|
+
try {
|
|
462
|
+
# Play system notification sound
|
|
463
|
+
[System.Media.SystemSounds]::Asterisk.Play()
|
|
464
|
+
} catch {
|
|
465
|
+
# Fallback to console beep
|
|
466
|
+
[Console]::Beep(1000, 200)
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
exit 0
|
|
470
|
+
`;
|
|
471
|
+
var AUTO_FORMAT_SCRIPT_PS1 = `# Auto-Format Hook for Autohand (PowerShell)
|
|
472
|
+
# Formats files on modification using prettier or eslint
|
|
473
|
+
|
|
474
|
+
param()
|
|
475
|
+
|
|
476
|
+
$FilePath = $env:HOOK_PATH
|
|
477
|
+
$ChangeType = $env:HOOK_CHANGE_TYPE
|
|
478
|
+
|
|
479
|
+
# Skip if file was deleted
|
|
480
|
+
if ($ChangeType -eq "delete") {
|
|
481
|
+
exit 0
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
# Skip if file doesn't exist
|
|
485
|
+
if (-not (Test-Path $FilePath)) {
|
|
486
|
+
exit 0
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
# Get file extension
|
|
490
|
+
$Ext = [System.IO.Path]::GetExtension($FilePath).TrimStart('.')
|
|
491
|
+
|
|
492
|
+
# Try to format the file
|
|
493
|
+
function Format-File {
|
|
494
|
+
param($File)
|
|
495
|
+
|
|
496
|
+
# Try prettier first
|
|
497
|
+
if (Test-Path "package.json") {
|
|
498
|
+
try {
|
|
499
|
+
npx prettier --write $File 2>$null
|
|
500
|
+
if ($LASTEXITCODE -eq 0) { return $true }
|
|
501
|
+
} catch {}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
# Try eslint for JS/TS files
|
|
505
|
+
if ($Ext -match "^(js|jsx|ts|tsx)$") {
|
|
506
|
+
if (Test-Path "package.json") {
|
|
507
|
+
try {
|
|
508
|
+
npx eslint --fix $File 2>$null
|
|
509
|
+
if ($LASTEXITCODE -eq 0) { return $true }
|
|
510
|
+
} catch {}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
return $false
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
# Format the file (silently)
|
|
518
|
+
Format-File $FilePath | Out-Null
|
|
519
|
+
|
|
520
|
+
# Always exit successfully
|
|
521
|
+
exit 0
|
|
522
|
+
`;
|
|
523
|
+
var SLACK_NOTIFY_SCRIPT_PS1 = `# Slack Notification Hook for Autohand (PowerShell)
|
|
524
|
+
# Sends notification to Slack when task completes
|
|
525
|
+
|
|
526
|
+
param()
|
|
527
|
+
|
|
528
|
+
$WebhookUrl = $env:SLACK_WEBHOOK_URL
|
|
529
|
+
|
|
530
|
+
# Skip if no webhook configured
|
|
531
|
+
if (-not $WebhookUrl) {
|
|
532
|
+
exit 0
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
$Tokens = if ($env:HOOK_TOKENS) { $env:HOOK_TOKENS } else { "0" }
|
|
536
|
+
$ToolCalls = if ($env:HOOK_TOOL_CALLS_COUNT) { $env:HOOK_TOOL_CALLS_COUNT } else { "0" }
|
|
537
|
+
$Duration = if ($env:HOOK_DURATION) { [int]$env:HOOK_DURATION } else { 0 }
|
|
538
|
+
$Workspace = if ($env:HOOK_WORKSPACE) { $env:HOOK_WORKSPACE } else { "unknown" }
|
|
539
|
+
|
|
540
|
+
# Convert duration to human readable
|
|
541
|
+
if ($Duration -gt 60000) {
|
|
542
|
+
$DurationStr = "{0}m {1}s" -f [math]::Floor($Duration / 60000), [math]::Floor(($Duration % 60000) / 1000)
|
|
543
|
+
} elseif ($Duration -gt 1000) {
|
|
544
|
+
$DurationStr = "{0}s" -f [math]::Floor($Duration / 1000)
|
|
545
|
+
} else {
|
|
546
|
+
$DurationStr = "{0}ms" -f $Duration
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
$ProjectName = Split-Path $Workspace -Leaf
|
|
550
|
+
|
|
551
|
+
$Payload = @{
|
|
552
|
+
blocks = @(
|
|
553
|
+
@{
|
|
554
|
+
type = "header"
|
|
555
|
+
text = @{
|
|
556
|
+
type = "plain_text"
|
|
557
|
+
text = "Autohand Task Completed"
|
|
558
|
+
emoji = $true
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
@{
|
|
562
|
+
type = "section"
|
|
563
|
+
fields = @(
|
|
564
|
+
@{ type = "mrkdwn"; text = "*Project:*\`n$ProjectName" }
|
|
565
|
+
@{ type = "mrkdwn"; text = "*Duration:*\`n$DurationStr" }
|
|
566
|
+
@{ type = "mrkdwn"; text = "*Tokens Used:*\`n$Tokens" }
|
|
567
|
+
@{ type = "mrkdwn"; text = "*Tool Calls:*\`n$ToolCalls" }
|
|
568
|
+
)
|
|
569
|
+
}
|
|
570
|
+
)
|
|
571
|
+
} | ConvertTo-Json -Depth 10
|
|
572
|
+
|
|
573
|
+
try {
|
|
574
|
+
Invoke-RestMethod -Uri $WebhookUrl -Method Post -Body $Payload -ContentType "application/json" | Out-Null
|
|
575
|
+
} catch {}
|
|
576
|
+
|
|
577
|
+
exit 0
|
|
578
|
+
`;
|
|
579
|
+
var GIT_AUTO_STAGE_SCRIPT_PS1 = `# Git Auto-Stage Hook for Autohand (PowerShell)
|
|
580
|
+
# Automatically stages modified files to git
|
|
581
|
+
|
|
582
|
+
param()
|
|
583
|
+
|
|
584
|
+
$FilePath = $env:HOOK_PATH
|
|
585
|
+
$ChangeType = $env:HOOK_CHANGE_TYPE
|
|
586
|
+
|
|
587
|
+
# Check if we're in a git repository
|
|
588
|
+
try {
|
|
589
|
+
git rev-parse --is-inside-work-tree 2>$null | Out-Null
|
|
590
|
+
if ($LASTEXITCODE -ne 0) { exit 0 }
|
|
591
|
+
} catch {
|
|
592
|
+
exit 0
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
# Files to skip
|
|
596
|
+
function Should-Skip {
|
|
597
|
+
param($File)
|
|
598
|
+
|
|
599
|
+
$BaseName = Split-Path $File -Leaf
|
|
600
|
+
|
|
601
|
+
# Skip log/temp files
|
|
602
|
+
if ($BaseName -match "\\.(log|tmp|swp|bak)$") { return $true }
|
|
603
|
+
|
|
604
|
+
# Skip .env files
|
|
605
|
+
if ($BaseName -like ".env*") { return $true }
|
|
606
|
+
|
|
607
|
+
# Skip certain directories
|
|
608
|
+
if ($File -match "(node_modules|.git|dist|build|coverage)[/\\\\]") { return $true }
|
|
609
|
+
|
|
610
|
+
return $false
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
if (Should-Skip $FilePath) {
|
|
614
|
+
exit 0
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
# Stage the file based on change type
|
|
618
|
+
switch ($ChangeType) {
|
|
619
|
+
{ $_ -in "create", "modify" } {
|
|
620
|
+
if (Test-Path $FilePath) {
|
|
621
|
+
git add $FilePath 2>$null
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
"delete" {
|
|
625
|
+
git rm --cached $FilePath 2>$null
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
exit 0
|
|
630
|
+
`;
|
|
631
|
+
var SECURITY_GUARD_SCRIPT_PS1 = `# Security Guard Hook for Autohand (PowerShell)
|
|
632
|
+
# Blocks dangerous commands and file operations
|
|
633
|
+
# Exit code 2 = block execution
|
|
634
|
+
|
|
635
|
+
param()
|
|
636
|
+
|
|
637
|
+
$ToolName = $env:HOOK_TOOL
|
|
638
|
+
$ToolArgs = $env:HOOK_ARGS
|
|
639
|
+
|
|
640
|
+
# Read JSON input from stdin
|
|
641
|
+
$Input = [Console]::In.ReadToEnd()
|
|
642
|
+
|
|
643
|
+
# Try to parse JSON input
|
|
644
|
+
$Command = ""
|
|
645
|
+
$FilePath = ""
|
|
646
|
+
try {
|
|
647
|
+
$JsonInput = $Input | ConvertFrom-Json
|
|
648
|
+
$Command = $JsonInput.tool_input.command
|
|
649
|
+
$FilePath = $JsonInput.tool_input.path
|
|
650
|
+
} catch {}
|
|
651
|
+
|
|
652
|
+
# Dangerous command patterns
|
|
653
|
+
$DangerousCommands = @(
|
|
654
|
+
"rm -rf /",
|
|
655
|
+
"rm -rf /*",
|
|
656
|
+
"rm -rf ~",
|
|
657
|
+
"rm -rf ~/*",
|
|
658
|
+
"rm -rf .",
|
|
659
|
+
"sudo rm",
|
|
660
|
+
"chmod 777",
|
|
661
|
+
"chmod -R 777",
|
|
662
|
+
"> /dev/sda",
|
|
663
|
+
"mkfs",
|
|
664
|
+
"dd if=",
|
|
665
|
+
"Remove-Item -Recurse -Force C:\\",
|
|
666
|
+
"Remove-Item -Recurse -Force /",
|
|
667
|
+
"Format-Volume"
|
|
668
|
+
)
|
|
669
|
+
|
|
670
|
+
# Sensitive file patterns
|
|
671
|
+
$SensitiveFiles = @(
|
|
672
|
+
".env",
|
|
673
|
+
".env.local",
|
|
674
|
+
".env.production",
|
|
675
|
+
"*.pem",
|
|
676
|
+
"*.key",
|
|
677
|
+
"*_rsa",
|
|
678
|
+
"id_rsa",
|
|
679
|
+
"id_ed25519",
|
|
680
|
+
"*.p12",
|
|
681
|
+
"credentials.json",
|
|
682
|
+
"secrets.json",
|
|
683
|
+
"service-account*.json",
|
|
684
|
+
".npmrc",
|
|
685
|
+
".pypirc"
|
|
686
|
+
)
|
|
687
|
+
|
|
688
|
+
function Test-DangerousCommand {
|
|
689
|
+
param($Cmd)
|
|
690
|
+
|
|
691
|
+
foreach ($Pattern in $DangerousCommands) {
|
|
692
|
+
if ($Cmd -like "*$Pattern*") {
|
|
693
|
+
Write-Error "BLOCKED: Dangerous command pattern detected: $Pattern"
|
|
694
|
+
exit 2
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
function Test-SensitiveFile {
|
|
700
|
+
param($File)
|
|
701
|
+
|
|
702
|
+
$BaseName = Split-Path $File -Leaf
|
|
703
|
+
|
|
704
|
+
foreach ($Pattern in $SensitiveFiles) {
|
|
705
|
+
if ($BaseName -like $Pattern -or $File -like "*$Pattern*") {
|
|
706
|
+
Write-Error "BLOCKED: Operation on sensitive file: $File"
|
|
707
|
+
exit 2
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
# Main security checks
|
|
713
|
+
switch ($ToolName) {
|
|
714
|
+
"run_command" {
|
|
715
|
+
Test-DangerousCommand $Command
|
|
716
|
+
Test-DangerousCommand $ToolArgs
|
|
717
|
+
}
|
|
718
|
+
{ $_ -in "write_file", "delete_path" } {
|
|
719
|
+
Test-SensitiveFile $FilePath
|
|
720
|
+
if ($ToolArgs) {
|
|
721
|
+
try {
|
|
722
|
+
$ArgsJson = $ToolArgs | ConvertFrom-Json
|
|
723
|
+
if ($ArgsJson.path) {
|
|
724
|
+
Test-SensitiveFile $ArgsJson.path
|
|
725
|
+
}
|
|
726
|
+
} catch {}
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
# All checks passed
|
|
732
|
+
exit 0
|
|
733
|
+
`;
|
|
734
|
+
var SMART_COMMIT_HOOK_SCRIPT_PS1 = `# Smart Commit Hook for Autohand (PowerShell)
|
|
735
|
+
# Runs lint, test, and creates commit with LLM-generated message
|
|
736
|
+
|
|
737
|
+
param()
|
|
738
|
+
|
|
739
|
+
# Prevent infinite recursion
|
|
740
|
+
if ($env:AUTOHAND_SMART_COMMIT_RUNNING) {
|
|
741
|
+
exit 0
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
# Check for uncommitted changes
|
|
745
|
+
$Status = git status --porcelain 2>$null
|
|
746
|
+
if (-not $Status) {
|
|
747
|
+
exit 0
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
$env:AUTOHAND_SMART_COMMIT_RUNNING = "1"
|
|
751
|
+
|
|
752
|
+
# Use autohand to handle the smart commit workflow
|
|
753
|
+
autohand --auto-commit -p "Complete the pending changes" -y
|
|
754
|
+
`;
|
|
755
|
+
var HOOK_SCRIPTS_WINDOWS = {
|
|
756
|
+
"smart-commit.ps1": SMART_COMMIT_HOOK_SCRIPT_PS1,
|
|
757
|
+
"sound-alert.ps1": SOUND_ALERT_SCRIPT_PS1,
|
|
758
|
+
"auto-format.ps1": AUTO_FORMAT_SCRIPT_PS1,
|
|
759
|
+
"slack-notify.ps1": SLACK_NOTIFY_SCRIPT_PS1,
|
|
760
|
+
"git-auto-stage.ps1": GIT_AUTO_STAGE_SCRIPT_PS1,
|
|
761
|
+
"security-guard.ps1": SECURITY_GUARD_SCRIPT_PS1
|
|
762
|
+
};
|
|
456
763
|
export {
|
|
457
764
|
AUTO_FORMAT_SCRIPT,
|
|
765
|
+
AUTO_FORMAT_SCRIPT_PS1,
|
|
458
766
|
DEFAULT_HOOKS,
|
|
459
767
|
GIT_AUTO_STAGE_SCRIPT,
|
|
768
|
+
GIT_AUTO_STAGE_SCRIPT_PS1,
|
|
460
769
|
HOOK_SCRIPTS,
|
|
770
|
+
HOOK_SCRIPTS_WINDOWS,
|
|
461
771
|
SECURITY_GUARD_SCRIPT,
|
|
772
|
+
SECURITY_GUARD_SCRIPT_PS1,
|
|
462
773
|
SLACK_NOTIFY_SCRIPT,
|
|
774
|
+
SLACK_NOTIFY_SCRIPT_PS1,
|
|
463
775
|
SMART_COMMIT_HOOK,
|
|
464
776
|
SMART_COMMIT_HOOK_SCRIPT,
|
|
465
|
-
|
|
777
|
+
SMART_COMMIT_HOOK_SCRIPT_PS1,
|
|
778
|
+
SOUND_ALERT_SCRIPT,
|
|
779
|
+
SOUND_ALERT_SCRIPT_PS1
|
|
466
780
|
};
|