or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

cli.mdconfiguration.mdgit-operations.mdhook-management.mdindex.mdpath-utilities.mdplugin-api.md

cli.mddocs/

0

# Command Line Interface

1

2

Complete command-line interface for managing autohooks installation, validation, and plugin management. The CLI provides all necessary commands for setting up and maintaining git hooks in Python projects.

3

4

## Capabilities

5

6

### Main CLI Entry Point

7

8

Main command-line interface with subcommand routing and argument parsing, providing access to all autohooks functionality.

9

10

```python { .api }

11

def main():

12

"""

13

Main CLI entry point with argument parsing and subcommand dispatch.

14

Handles version display, command completion, and routes to appropriate handlers.

15

"""

16

```

17

18

### Hook Installation

19

20

Install and activate pre-commit hooks with different dependency management modes, with support for forced reinstallation and mode selection.

21

22

```python { .api }

23

def install_hooks(term: Terminal, args: Namespace) -> None:

24

"""

25

Install autohooks pre-commit hook with specified mode.

26

27

Args:

28

term: Terminal interface for output

29

args: Parsed arguments containing force flag and mode setting

30

"""

31

```

32

33

**Usage Examples:**

34

35

```bash

36

# Activate hooks with default mode

37

autohooks activate

38

39

# Force reinstall with specific mode

40

autohooks activate --force --mode poetry

41

42

# Activate with pipenv mode

43

autohooks activate --mode pipenv

44

```

45

46

### Hook Validation

47

48

Check the status of installed hooks, configuration validity, and plugin availability with comprehensive validation reporting.

49

50

```python { .api }

51

def check_hooks(term: Terminal, args: Namespace) -> None:

52

"""

53

Validate installed hooks and configuration.

54

55

Args:

56

term: Terminal interface for output

57

args: Parsed arguments (currently unused)

58

"""

59

60

def check_pre_commit_hook(term: Terminal, pre_commit_hook: PreCommitHook) -> None:

61

"""

62

Check pre-commit hook installation status and version.

63

64

Args:

65

term: Terminal interface for output

66

pre_commit_hook: Hook instance to validate

67

"""

68

69

def check_config(term: Terminal, pyproject_toml: Path, pre_commit_hook: PreCommitHook) -> None:

70

"""

71

Validate pyproject.toml configuration and plugin availability.

72

73

Args:

74

term: Terminal interface for output

75

pyproject_toml: Path to configuration file

76

pre_commit_hook: Hook instance for mode comparison

77

"""

78

```

79

80

**Usage Examples:**

81

82

```bash

83

# Check hook installation status

84

autohooks check

85

```

86

87

### Plugin Management

88

89

Comprehensive plugin management system for adding, removing, and listing autohooks plugins with validation and status reporting.

90

91

```python { .api }

92

def plugins(term: Terminal, args: Namespace) -> None:

93

"""

94

Plugin management dispatcher.

95

96

Args:

97

term: Terminal interface for output

98

args: Parsed arguments with plugins_func attribute

99

"""

100

101

def add_plugins(term: Terminal, args: Namespace) -> None:

102

"""

103

Add plugins to autohooks configuration.

104

105

Args:

106

term: Terminal interface for output

107

args: Parsed arguments with plugin names to add

108

"""

109

110

def remove_plugins(term: Terminal, args: Namespace) -> None:

111

"""

112

Remove plugins from autohooks configuration.

113

114

Args:

115

term: Terminal interface for output

116

args: Parsed arguments with plugin names to remove

117

"""

118

119

def list_plugins(term: Terminal, args: Namespace) -> None:

120

"""

121

List currently configured plugins with status validation.

122

123

Args:

124

term: Terminal interface for output

125

args: Parsed arguments (currently unused)

126

"""

127

128

def print_current_plugins(term: Terminal, current_plugins: Iterable[str]) -> None:

129

"""

130

Display current plugins with validation status.

131

132

Args:

133

term: Terminal interface for output

134

current_plugins: Iterator of plugin names to display

135

"""

136

```

137

138

**Usage Examples:**

139

140

```bash

141

# Add single plugin

142

autohooks plugins add autohooks.plugins.black

143

144

# Add multiple plugins

145

autohooks plugins add autohooks.plugins.black autohooks.plugins.ruff

146

147

# Remove plugins

148

autohooks plugins remove autohooks.plugins.mypy

149

150

# List current plugins

151

autohooks plugins list

152

```

153

154

## CLI Commands Summary

155

156

### `autohooks activate`

157

158

Install and activate pre-commit hooks.

159

160

**Options:**

161

- `-f, --force`: Force activation even if hook exists

162

- `-m, --mode {pythonpath,pipenv,poetry}`: Dependency management mode

163

164

### `autohooks check`

165

166

Validate hook installation and configuration.

167

168

### `autohooks plugins add <plugin_names>`

169

170

Add plugins to configuration.

171

172

**Arguments:**

173

- `plugin_names`: One or more plugin names to add

174

175

### `autohooks plugins remove <plugin_names>`

176

177

Remove plugins from configuration.

178

179

**Arguments:**

180

- `plugin_names`: One or more plugin names to remove

181

182

### `autohooks plugins list`

183

184

List currently configured plugins with status.

185

186

## Types

187

188

```python { .api }

189

from argparse import Namespace

190

from autohooks.terminal import Terminal

191

```