mct-cli 0.2.3__tar.gz

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.
@@ -0,0 +1,176 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+ workflow_dispatch:
8
+ inputs:
9
+ tag:
10
+ description: "Tag to release (e.g., v0.2.1)"
11
+ required: true
12
+
13
+ jobs:
14
+ release:
15
+ runs-on: ubuntu-latest
16
+ permissions:
17
+ contents: write
18
+
19
+ steps:
20
+ - name: Checkout
21
+ uses: actions/checkout@v6
22
+
23
+ - name: Set up Python
24
+ uses: actions/setup-python@v6
25
+ with:
26
+ python-version-file: ".python-version"
27
+
28
+ - name: Install uv
29
+ uses: astral-sh/setup-uv@v6
30
+
31
+ - name: Extract version from tag
32
+ id: version
33
+ run: |
34
+ # Use input tag for manual dispatch, otherwise use ref name
35
+ TAG="${{ inputs.tag || github.ref_name }}"
36
+ VERSION="${TAG#v}"
37
+ echo "tag=$TAG" >> $GITHUB_OUTPUT
38
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
39
+
40
+ - name: Validate version matches pyproject.toml
41
+ run: |
42
+ EXPECTED="${{ steps.version.outputs.version }}"
43
+ ACTUAL=$(grep -E "^version\s*=" pyproject.toml | sed -E 's/.*"([^"]+)".*/\1/')
44
+
45
+ if [ "$ACTUAL" != "$EXPECTED" ]; then
46
+ echo "Error: Tag version ($EXPECTED) doesn't match pyproject.toml ($ACTUAL)"
47
+ exit 1
48
+ fi
49
+ echo "Version validated: $EXPECTED"
50
+
51
+ - name: Build package
52
+ run: uv build
53
+
54
+ - name: Publish to PyPI
55
+ env:
56
+ UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
57
+ run: uv publish
58
+
59
+ - name: Generate release notes
60
+ run: |
61
+ cat > release_notes.md << 'EOF'
62
+ ## Installation
63
+
64
+ ### Homebrew (recommended)
65
+ ```bash
66
+ brew tap ocolunga/mct-cli
67
+ brew install mct-cli
68
+ ```
69
+
70
+ ### pip
71
+ ```bash
72
+ pip install mct-cli
73
+ ```
74
+
75
+ ### uv
76
+ ```bash
77
+ uv tool install mct-cli
78
+ ```
79
+ EOF
80
+
81
+ - name: Create GitHub Release
82
+ uses: softprops/action-gh-release@v2
83
+ with:
84
+ name: "v${{ steps.version.outputs.version }}"
85
+ body_path: release_notes.md
86
+ files: |
87
+ dist/*.whl
88
+ dist/*.tar.gz
89
+
90
+ update-homebrew:
91
+ needs: release
92
+ runs-on: macos-latest
93
+
94
+ steps:
95
+ - name: Extract version from tag
96
+ id: version
97
+ run: |
98
+ TAG="${{ inputs.tag || github.ref_name }}"
99
+ VERSION="${TAG#v}"
100
+ echo "tag=$TAG" >> $GITHUB_OUTPUT
101
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
102
+
103
+ - name: Wait for PyPI availability
104
+ run: |
105
+ VERSION="${{ steps.version.outputs.version }}"
106
+ echo "Waiting for mct-cli==$VERSION to be available on PyPI..."
107
+ for i in {1..30}; do
108
+ if curl -s "https://pypi.org/pypi/mct-cli/$VERSION/json" | grep -q '"version"'; then
109
+ echo "Package available on PyPI"
110
+ exit 0
111
+ fi
112
+ echo "Waiting for PyPI... ($i/30)"
113
+ sleep 10
114
+ done
115
+ echo "Warning: Timed out waiting for PyPI, continuing anyway..."
116
+
117
+ - name: Set up Homebrew
118
+ uses: Homebrew/actions/setup-homebrew@master
119
+
120
+ - name: Get PyPI package URL and SHA256
121
+ id: pypi
122
+ run: |
123
+ VERSION="${{ steps.version.outputs.version }}"
124
+ # Fetch package info from PyPI
125
+ PYPI_JSON=$(curl -s "https://pypi.org/pypi/mct-cli/$VERSION/json")
126
+
127
+ # Extract the sdist (source distribution) URL and SHA256
128
+ URL=$(echo "$PYPI_JSON" | python3 -c "import sys, json; urls = json.load(sys.stdin)['urls']; sdist = next(u for u in urls if u['packagetype'] == 'sdist'); print(sdist['url'])")
129
+ SHA256=$(echo "$PYPI_JSON" | python3 -c "import sys, json; urls = json.load(sys.stdin)['urls']; sdist = next(u for u in urls if u['packagetype'] == 'sdist'); print(sdist['digests']['sha256'])")
130
+
131
+ echo "url=$URL" >> $GITHUB_OUTPUT
132
+ echo "sha256=$SHA256" >> $GITHUB_OUTPUT
133
+ echo "Package URL: $URL"
134
+ echo "SHA256: $SHA256"
135
+
136
+ - name: Tap and update formula
137
+ run: |
138
+ VERSION="${{ steps.version.outputs.version }}"
139
+ SHA256="${{ steps.pypi.outputs.sha256 }}"
140
+ URL="${{ steps.pypi.outputs.url }}"
141
+
142
+ # Tap the repo (installs to proper Homebrew location)
143
+ brew tap ocolunga/mct-cli
144
+
145
+ # Get the tap directory
146
+ TAP_DIR="$(brew --prefix)/Library/Taps/ocolunga/homebrew-mct-cli"
147
+ FORMULA="$TAP_DIR/Formula/mct-cli.rb"
148
+
149
+ # Update URL and SHA256
150
+ sed -i '' "s|url \".*\"|url \"${URL}\"|" "$FORMULA"
151
+ sed -i '' "s|sha256 \".*\"|sha256 \"${SHA256}\"|" "$FORMULA"
152
+
153
+ echo "Updated formula:"
154
+ cat "$FORMULA"
155
+
156
+ - name: Update Python resource dependencies
157
+ run: |
158
+ echo "Updating Python resources..."
159
+ brew update-python-resources ocolunga/mct-cli/mct-cli
160
+ echo "Resources updated successfully"
161
+
162
+ - name: Commit and push
163
+ env:
164
+ HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
165
+ run: |
166
+ TAP_DIR="$(brew --prefix)/Library/Taps/ocolunga/homebrew-mct-cli"
167
+ cd "$TAP_DIR"
168
+
169
+ # Configure git with token for push
170
+ git remote set-url origin "https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/ocolunga/homebrew-mct-cli.git"
171
+ git config user.name "github-actions[bot]"
172
+ git config user.email "github-actions[bot]@users.noreply.github.com"
173
+
174
+ git add Formula/mct-cli.rb
175
+ git diff --staged --quiet || git commit -m "Update mct-cli to ${{ steps.version.outputs.version }}"
176
+ git push
@@ -0,0 +1,48 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ *.egg-info/
8
+ *.egg
9
+ .installed.cfg
10
+ MANIFEST
11
+
12
+ # Build / Distribution
13
+ build/
14
+ dist/
15
+ sdist/
16
+ wheels/
17
+ share/python-wheels/
18
+ develop-eggs/
19
+ downloads/
20
+ eggs/
21
+ .eggs/
22
+ lib/
23
+ lib64/
24
+ parts/
25
+ var/
26
+
27
+ # Virtual Environment
28
+ venv/
29
+ .venv/
30
+ env/
31
+ .env
32
+
33
+ # IDE
34
+ .idea/
35
+ .vscode/
36
+ *.swp
37
+ *.swo
38
+ .DS_Store
39
+
40
+ # Testing
41
+ .coverage
42
+ htmlcov/
43
+ .pytest_cache/
44
+ .tox/
45
+
46
+ # Type checking / Linting
47
+ .mypy_cache/
48
+ .ruff_cache/
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,68 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ mct (macOS Configuration Tools) is a declarative CLI tool for managing macOS settings, inspired by nix-darwin. It uses Typer for the CLI framework and subprocess calls to `defaults` for modifying macOS preferences.
8
+
9
+ ## Development Commands
10
+
11
+ ```bash
12
+ # Install dependencies (uses uv)
13
+ uv sync --group dev
14
+
15
+ # Run the CLI
16
+ uv run mct --help
17
+
18
+ # Type checking (ty)
19
+ uv run ty check src/
20
+
21
+ # Linting and formatting (ruff)
22
+ uv run ruff check src/
23
+ uv run ruff format src/
24
+ ```
25
+
26
+ ## Architecture
27
+
28
+ ### Core Modules
29
+
30
+ - `src/mct/cli.py` - Main entry point, registers command groups and declarative commands (apply, export, diff, init, settings)
31
+ - `src/mct/config.py` - Configuration management: YAML loading/saving, settings registry, diff computation
32
+ - `src/mct/defaults.py` - Low-level helper for macOS `defaults` read/write/delete operations
33
+
34
+ ### Command Groups
35
+
36
+ Each file in `src/mct/commands/` exports a `typer.Typer()` instance registered in `cli.py`:
37
+ - `dock.py` - Dock settings (size, auto-hide, lock)
38
+ - `finder.py` - Finder settings (extensions, hidden files, path bar, view style)
39
+ - `keyboard.py` - Keyboard settings (key hold/repeat)
40
+ - `screenshot.py` - Screenshot settings (location, format, shadow)
41
+ - `system.py` - System settings (Touch ID for sudo)
42
+
43
+ ### Settings Registry
44
+
45
+ All declarative settings are defined in `config.py` in the `SETTINGS` dict. Each setting specifies:
46
+ - `domain`: The macOS defaults domain (e.g., `com.apple.dock`)
47
+ - `key`: The defaults key
48
+ - `value_type`: Type hint (`bool`, `int`, `float`, `string`)
49
+ - `restart_app`: App to restart after changing (e.g., `Dock`, `Finder`)
50
+
51
+ ### Adding New Settings
52
+
53
+ 1. Add the setting to `SETTINGS` dict in `config.py`
54
+ 2. Optionally add an imperative command in the appropriate `commands/*.py` file
55
+
56
+ ### Config File
57
+
58
+ Users can define desired state in `~/.config/mct/config.yaml`:
59
+ ```yaml
60
+ dock:
61
+ size: 48
62
+ autohide: true
63
+ finder:
64
+ show_extensions: true
65
+ show_path_bar: true
66
+ ```
67
+
68
+ Then apply with `mct apply` or preview changes with `mct diff`.
mct_cli-0.2.3/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Your Name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
mct_cli-0.2.3/PKG-INFO ADDED
@@ -0,0 +1,139 @@
1
+ Metadata-Version: 2.4
2
+ Name: mct-cli
3
+ Version: 0.2.3
4
+ Summary: macOS Configuration Tools
5
+ Author-email: Oscar Colunga <oscar@ancile.dev>
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.12
8
+ Requires-Dist: pyyaml>=6.0
9
+ Requires-Dist: typer>=0.9.0
10
+ Description-Content-Type: text/markdown
11
+
12
+ # macOS Configuration Tools (mct)
13
+
14
+ A personal collection of CLI tools for managing macOS settings through a simple, intuitive interface.
15
+
16
+ ## Features
17
+
18
+ Currently implemented:
19
+
20
+ ### General
21
+ - Check version: `mct --version` or `mct -v` - Display the installed version
22
+
23
+ ### Dock Management
24
+ - Set dock size: `mct dock size <value>` (32-128)
25
+ - Show current dock size: `mct dock size`
26
+ - Auto-hide controls:
27
+ - `mct dock hide` - Enable auto-hide
28
+ - `mct dock show` - Disable auto-hide
29
+ - Size lock controls:
30
+ - `mct dock lock` - Lock dock size
31
+ - `mct dock unlock` - Unlock dock size
32
+ - Reset options:
33
+ - `mct dock reset -s` - Reset size to default (64)
34
+ - `mct dock reset -h` - Reset auto-hide to default (disabled)
35
+ - `mct dock reset -l` - Reset size lock to default (unlocked)
36
+ - `mct dock reset -a` - Reset all dock settings
37
+
38
+ ### Keyboard Management
39
+ - Key repeat controls:
40
+ - `mct keyboard hold` - Enable press-and-hold for accented characters
41
+ - `mct keyboard repeat` - Enable key repeat (disables accents)
42
+ - Reset options:
43
+ - `mct keyboard reset -h` - Reset key hold to default (enabled)
44
+ - `mct keyboard reset -a` - Reset all keyboard settings
45
+
46
+ ### System Management
47
+ - Touch ID for sudo:
48
+ - `mct system touchid` - Enable Touch ID authentication for sudo with interactive backup management
49
+ - `mct system reset -t` - Reset Touch ID sudo configuration from backup
50
+ - `mct system reset -a` - Reset all system settings to defaults
51
+
52
+ Planned features:
53
+ - Configuration file support (`~/.config/mct/config.toml`) for:
54
+ - Setting default values for commands
55
+ - Storing preferred configurations
56
+ - Batch applying multiple settings at once
57
+ - Example configuration:
58
+ ```toml
59
+ [dock]
60
+ default_size = 48
61
+ auto_hide = true
62
+ size_locked = false
63
+
64
+ [keyboard]
65
+ key_hold = true
66
+
67
+ [system]
68
+ touch_id_sudo = true
69
+ ```
70
+ - More dock management options
71
+ - System preferences management
72
+ - And more...
73
+
74
+ ## Installation
75
+
76
+ ### Using Homebrew (recommended)
77
+ ```bash
78
+ # Add the tap repository
79
+ brew tap ocolunga/mct-cli
80
+
81
+ # Install mct-cli
82
+ brew install mct-cli
83
+ ```
84
+
85
+ ### Using pip
86
+ ```bash
87
+ pip install mct-cli
88
+ ```
89
+
90
+ ### Using uv
91
+ ```bash
92
+ uv tool install mct-cli
93
+ ```
94
+
95
+ ### From source
96
+ ```bash
97
+ git clone https://github.com/ocolunga/mct.git
98
+ cd mct
99
+ uv sync
100
+ uv run mct --help
101
+ ```
102
+
103
+ ## Usage Examples
104
+
105
+ ```bash
106
+ # Show help
107
+ mct --help
108
+ mct dock --help
109
+ mct keyboard --help
110
+ mct system --help
111
+
112
+ # Check version
113
+ mct --version
114
+
115
+ # Dock Examples
116
+ mct dock size 48 # Set dock size to 48
117
+ mct dock size # Show current dock size
118
+ mct dock hide # Enable auto-hide
119
+ mct dock show # Disable auto-hide
120
+ mct dock lock # Lock dock size
121
+ mct dock unlock # Unlock dock size
122
+ mct dock reset -s -h # Reset both size and auto-hide
123
+
124
+ # Keyboard Examples
125
+ mct keyboard hold # Enable press-and-hold for accents
126
+ mct keyboard repeat # Enable key repeat (disable accents)
127
+ mct keyboard reset -a # Reset all keyboard settings
128
+
129
+ # System Examples
130
+ mct system touchid # Enable Touch ID for sudo with interactive backup
131
+ mct system reset -t # Reset Touch ID sudo configuration from backup
132
+ mct system reset -a # Reset all system settings to defaults
133
+ ```
134
+
135
+ Note: Some commands may require restarting applications to take effect.
136
+
137
+ ## License
138
+
139
+ This project is licensed under the MIT License - see the LICENSE file for details.
@@ -0,0 +1,128 @@
1
+ # macOS Configuration Tools (mct)
2
+
3
+ A personal collection of CLI tools for managing macOS settings through a simple, intuitive interface.
4
+
5
+ ## Features
6
+
7
+ Currently implemented:
8
+
9
+ ### General
10
+ - Check version: `mct --version` or `mct -v` - Display the installed version
11
+
12
+ ### Dock Management
13
+ - Set dock size: `mct dock size <value>` (32-128)
14
+ - Show current dock size: `mct dock size`
15
+ - Auto-hide controls:
16
+ - `mct dock hide` - Enable auto-hide
17
+ - `mct dock show` - Disable auto-hide
18
+ - Size lock controls:
19
+ - `mct dock lock` - Lock dock size
20
+ - `mct dock unlock` - Unlock dock size
21
+ - Reset options:
22
+ - `mct dock reset -s` - Reset size to default (64)
23
+ - `mct dock reset -h` - Reset auto-hide to default (disabled)
24
+ - `mct dock reset -l` - Reset size lock to default (unlocked)
25
+ - `mct dock reset -a` - Reset all dock settings
26
+
27
+ ### Keyboard Management
28
+ - Key repeat controls:
29
+ - `mct keyboard hold` - Enable press-and-hold for accented characters
30
+ - `mct keyboard repeat` - Enable key repeat (disables accents)
31
+ - Reset options:
32
+ - `mct keyboard reset -h` - Reset key hold to default (enabled)
33
+ - `mct keyboard reset -a` - Reset all keyboard settings
34
+
35
+ ### System Management
36
+ - Touch ID for sudo:
37
+ - `mct system touchid` - Enable Touch ID authentication for sudo with interactive backup management
38
+ - `mct system reset -t` - Reset Touch ID sudo configuration from backup
39
+ - `mct system reset -a` - Reset all system settings to defaults
40
+
41
+ Planned features:
42
+ - Configuration file support (`~/.config/mct/config.toml`) for:
43
+ - Setting default values for commands
44
+ - Storing preferred configurations
45
+ - Batch applying multiple settings at once
46
+ - Example configuration:
47
+ ```toml
48
+ [dock]
49
+ default_size = 48
50
+ auto_hide = true
51
+ size_locked = false
52
+
53
+ [keyboard]
54
+ key_hold = true
55
+
56
+ [system]
57
+ touch_id_sudo = true
58
+ ```
59
+ - More dock management options
60
+ - System preferences management
61
+ - And more...
62
+
63
+ ## Installation
64
+
65
+ ### Using Homebrew (recommended)
66
+ ```bash
67
+ # Add the tap repository
68
+ brew tap ocolunga/mct-cli
69
+
70
+ # Install mct-cli
71
+ brew install mct-cli
72
+ ```
73
+
74
+ ### Using pip
75
+ ```bash
76
+ pip install mct-cli
77
+ ```
78
+
79
+ ### Using uv
80
+ ```bash
81
+ uv tool install mct-cli
82
+ ```
83
+
84
+ ### From source
85
+ ```bash
86
+ git clone https://github.com/ocolunga/mct.git
87
+ cd mct
88
+ uv sync
89
+ uv run mct --help
90
+ ```
91
+
92
+ ## Usage Examples
93
+
94
+ ```bash
95
+ # Show help
96
+ mct --help
97
+ mct dock --help
98
+ mct keyboard --help
99
+ mct system --help
100
+
101
+ # Check version
102
+ mct --version
103
+
104
+ # Dock Examples
105
+ mct dock size 48 # Set dock size to 48
106
+ mct dock size # Show current dock size
107
+ mct dock hide # Enable auto-hide
108
+ mct dock show # Disable auto-hide
109
+ mct dock lock # Lock dock size
110
+ mct dock unlock # Unlock dock size
111
+ mct dock reset -s -h # Reset both size and auto-hide
112
+
113
+ # Keyboard Examples
114
+ mct keyboard hold # Enable press-and-hold for accents
115
+ mct keyboard repeat # Enable key repeat (disable accents)
116
+ mct keyboard reset -a # Reset all keyboard settings
117
+
118
+ # System Examples
119
+ mct system touchid # Enable Touch ID for sudo with interactive backup
120
+ mct system reset -t # Reset Touch ID sudo configuration from backup
121
+ mct system reset -a # Reset all system settings to defaults
122
+ ```
123
+
124
+ Note: Some commands may require restarting applications to take effect.
125
+
126
+ ## License
127
+
128
+ This project is licensed under the MIT License - see the LICENSE file for details.
@@ -0,0 +1,24 @@
1
+ [project]
2
+ name = "mct-cli"
3
+ version = "0.2.3"
4
+ authors = [{ name = "Oscar Colunga", email = "oscar@ancile.dev" }]
5
+ description = "macOS Configuration Tools"
6
+ readme = "README.md"
7
+ requires-python = ">=3.12"
8
+ dependencies = ["typer>=0.9.0", "pyyaml>=6.0"]
9
+
10
+ [dependency-groups]
11
+ dev = [
12
+ "ruff>=0.11.4",
13
+ "ty>=0.0.12",
14
+ ]
15
+
16
+ [project.scripts]
17
+ mct = "mct.cli:main"
18
+
19
+ [build-system]
20
+ requires = ["hatchling"]
21
+ build-backend = "hatchling.build"
22
+
23
+ [tool.hatch.build.targets.wheel]
24
+ packages = ["src/mct"]
@@ -0,0 +1,5 @@
1
+ """macOS Configuration Tools - A CLI for managing macOS settings declaratively."""
2
+
3
+ from importlib.metadata import version
4
+
5
+ __version__ = version("macos-config-tools")