@automagik/genie 0.260202.530 → 0.260202.1833
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/claudio.js +44 -45
- package/dist/genie.js +58 -135
- package/dist/term.js +134 -67
- package/install.sh +43 -7
- package/package.json +1 -1
- package/src/claudio.ts +31 -21
- package/src/commands/launch.ts +12 -68
- package/src/genie-commands/doctor.ts +327 -0
- package/src/genie-commands/setup.ts +317 -199
- package/src/genie-commands/uninstall.ts +176 -0
- package/src/genie.ts +24 -44
- package/src/lib/claude-settings.ts +22 -64
- package/src/lib/genie-config.ts +169 -57
- package/src/lib/orchestrator/completion.ts +392 -0
- package/src/lib/orchestrator/event-monitor.ts +442 -0
- package/src/lib/orchestrator/index.ts +12 -0
- package/src/lib/orchestrator/patterns.ts +277 -0
- package/src/lib/orchestrator/state-detector.ts +339 -0
- package/src/lib/version.ts +1 -1
- package/src/lib/worker-registry.ts +229 -0
- package/src/term-commands/close.ts +221 -0
- package/src/term-commands/exec.ts +28 -6
- package/src/term-commands/kill.ts +143 -0
- package/src/term-commands/orchestrate.ts +844 -0
- package/src/term-commands/read.ts +6 -1
- package/src/term-commands/shortcuts.ts +14 -14
- package/src/term-commands/work.ts +415 -0
- package/src/term-commands/workers.ts +264 -0
- package/src/term.ts +201 -3
- package/src/types/genie-config.ts +49 -81
- package/src/genie-commands/hooks.ts +0 -317
- package/src/lib/hook-script.ts +0 -263
- package/src/lib/hooks/compose.ts +0 -72
- package/src/lib/hooks/index.ts +0 -163
- package/src/lib/hooks/presets/audited.ts +0 -191
- package/src/lib/hooks/presets/collaborative.ts +0 -143
- package/src/lib/hooks/presets/sandboxed.ts +0 -153
- package/src/lib/hooks/presets/supervised.ts +0 -66
- package/src/lib/hooks/utils/escape.ts +0 -46
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Supervised Hook Preset
|
|
3
|
-
*
|
|
4
|
-
* Requires explicit approval for file modifications.
|
|
5
|
-
* Intercepts PermissionRequest events and forces 'ask' behavior for Write/Edit tools.
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* const hooks = supervisedHooks({ alwaysAsk: ['Write', 'Edit'] });
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type { SupervisedConfig } from '../../../types/genie-config.js';
|
|
12
|
-
import type { HookConfig, HookInput, HookOutput } from './collaborative.js';
|
|
13
|
-
|
|
14
|
-
export interface SupervisedHookConfig {
|
|
15
|
-
alwaysAsk: string[];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Default configuration for supervised hooks
|
|
20
|
-
*/
|
|
21
|
-
export const DEFAULT_SUPERVISED_CONFIG: SupervisedHookConfig = {
|
|
22
|
-
alwaysAsk: ['Write', 'Edit'],
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Create supervised hooks configuration
|
|
27
|
-
*
|
|
28
|
-
* This hook intercepts PermissionRequest events and ensures that
|
|
29
|
-
* specified tools (default: Write, Edit) always require user approval.
|
|
30
|
-
*/
|
|
31
|
-
export function supervisedHooks(config: Partial<SupervisedConfig> = {}): HookConfig {
|
|
32
|
-
const alwaysAsk = config.alwaysAsk || DEFAULT_SUPERVISED_CONFIG.alwaysAsk;
|
|
33
|
-
const alwaysAskSet = new Set(alwaysAsk);
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
PermissionRequest: [
|
|
37
|
-
{
|
|
38
|
-
timeout: 30,
|
|
39
|
-
hooks: [
|
|
40
|
-
async (input: HookInput, _toolUseID, _options): Promise<HookOutput> => {
|
|
41
|
-
// Type guard - only process PermissionRequest events
|
|
42
|
-
if (input.hook_event_name !== 'PermissionRequest') {
|
|
43
|
-
return { continue: true };
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const toolName = input.tool_name;
|
|
47
|
-
|
|
48
|
-
// Check if this tool requires approval
|
|
49
|
-
if (toolName && alwaysAskSet.has(toolName)) {
|
|
50
|
-
return {
|
|
51
|
-
continue: true,
|
|
52
|
-
hookSpecificOutput: {
|
|
53
|
-
hookEventName: 'PermissionRequest',
|
|
54
|
-
decision: { behavior: 'ask' },
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Allow other tools to proceed normally
|
|
60
|
-
return { continue: true };
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
};
|
|
66
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shell escaping utilities for safely embedding commands in shell strings.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Escape a string for safe embedding in single-quoted shell strings.
|
|
7
|
-
* e.g., "it's" becomes "it'\''s"
|
|
8
|
-
*
|
|
9
|
-
* This works by:
|
|
10
|
-
* 1. Ending the current single-quoted string: '
|
|
11
|
-
* 2. Adding an escaped single quote: \'
|
|
12
|
-
* 3. Starting a new single-quoted string: '
|
|
13
|
-
*
|
|
14
|
-
* So "it's cool" becomes 'it'\''s cool'
|
|
15
|
-
*/
|
|
16
|
-
export function escapeForSingleQuotes(str: string): string {
|
|
17
|
-
return str.replace(/'/g, "'\\''");
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Escape a string for safe embedding in double-quoted shell strings.
|
|
22
|
-
* Escapes: $ ` " \ and newlines
|
|
23
|
-
*/
|
|
24
|
-
export function escapeForDoubleQuotes(str: string): string {
|
|
25
|
-
return str
|
|
26
|
-
.replace(/\\/g, '\\\\')
|
|
27
|
-
.replace(/"/g, '\\"')
|
|
28
|
-
.replace(/\$/g, '\\$')
|
|
29
|
-
.replace(/`/g, '\\`')
|
|
30
|
-
.replace(/\n/g, '\\n');
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Wrap a command in single quotes with proper escaping.
|
|
35
|
-
* This is the safest way to pass arbitrary commands to shell.
|
|
36
|
-
*/
|
|
37
|
-
export function singleQuote(cmd: string): string {
|
|
38
|
-
return `'${escapeForSingleQuotes(cmd)}'`;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Wrap a command in double quotes with proper escaping.
|
|
43
|
-
*/
|
|
44
|
-
export function doubleQuote(cmd: string): string {
|
|
45
|
-
return `"${escapeForDoubleQuotes(cmd)}"`;
|
|
46
|
-
}
|