1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-22 21:20:09 +00:00
Commit Graph

1826 Commits

Author SHA1 Message Date
github-actions[bot]
c8ed94698d chore: update contributors [skip ci] 2026-03-03 08:30:16 +00:00
tw93
8f86659032 docs: remove dev branch workflow from contributing guide 2026-03-03 16:29:51 +08:00
tw93
25cba0cf38 refactor(clean): simplify Xcode DeviceSupport cleanup logic
- Use array slicing instead of manual loop for splitting dirs
- Remove redundant early returns with duplicated safe_clean calls
- Consolidate cache/logs cleanup to single location at function end
2026-03-03 16:16:52 +08:00
tw93
b663974f76 Merge branch 'dev' 2026-03-03 16:06:42 +08:00
github-actions[bot]
7e19b2673b chore: update contributors [skip ci] 2026-03-03 08:06:16 +00:00
Noah Qin
2a4eaf007b feat(status): add --json flag for programmatic access (#529)
Add --json command-line flag to mo status that outputs system metrics
in JSON format without requiring a TTY environment.

This enables:
- Integration with GUI applications (e.g., native macOS apps)
- Use in automation scripts and monitoring systems
- Piping output to tools like jq for data extraction
- Recording metrics for analysis

Implementation:
- Add JSON struct tags to all metric types
- Add --json flag using Go's flag package
- Implement runJSONMode() for one-time metric collection
- Refactor main() to support both TUI and JSON modes
- Maintain 100% backward compatibility (default TUI unchanged)

Testing:
- All 454 existing tests pass
- JSON output validated with jq and python json.tool
- Pipeline and redirection work correctly
- No breaking changes to existing functionality
2026-03-03 16:05:55 +08:00
github-actions[bot]
b6fd68009f chore: update contributors [skip ci] 2026-03-03 08:05:54 +00:00
Nour
607073c333 feat(clean): clean old Xcode DeviceSupport versions instead of just their caches (#519) 2026-03-03 16:05:29 +08:00
tw93
677077818e refactor(clean): simplify Go cache whitelist logic
- Fix undefined ICON_SKIP, use ICON_SUCCESS instead
- Reduce code from 46 to 27 lines with early return pattern
- Consistent styling with other whitelist skip messages
2026-03-03 16:02:39 +08:00
github-actions[bot]
ab35f2e8f1 chore: update contributors [skip ci] 2026-03-03 07:58:03 +00:00
Noah Qin
5d4c304797 fix(clean): respect whitelist when cleaning Go caches (#530)
- Add whitelist checking to clean_dev_go() function
- Check both GOCACHE and GOMODCACHE before cleaning
- Show appropriate messages for protected caches
- Fix whitelist pattern from ~/go/pkg/mod/cache/* to ~/go/pkg/mod/*
- Split Go cache into separate build and module entries

Fixes #521
2026-03-03 15:57:45 +08:00
tw93
66ba1889c6 fix: correct missing $ in color variable reference
Fix typo from PR #523: {NC} → ${NC}
2026-03-03 15:57:18 +08:00
Tw93
c41dcbcdee chore: auto format code 2026-03-03 07:52:51 +00:00
Angelk90
00f29cff20 Clean dynamic size formatting (#523) 2026-03-03 15:52:04 +08:00
github-actions[bot]
87bf90f712 chore: update contributors [skip ci] 2026-03-03 07:42:46 +00:00
tw93
d0e5e3618e Merge branch 'main' into dev 2026-03-03 15:42:13 +08:00
tw93
abb0b2b688 fix(clean): use defined ICON_WARNING instead of undefined ICON_SKIP
Ref #531
2026-03-03 15:39:45 +08:00
github-actions[bot]
509bbbfbcc chore: update contributors [skip ci] 2026-03-03 07:38:19 +00:00
Noah Qin
0da3d4ab23 fix(clean): enhance Xcode simulator cleanup with fallback mechanism (#531)
- Add simctl availability check before attempting cleanup
- Capture and analyze error output for better diagnostics
- Implement fallback: manual deletion when simctl fails
- Provide specific error hints (permission, in-use, service issues)
- Skip early when no unavailable simulators exist
- Show partial success status when some deletions fail

Error scenarios now handled:
- simctl not available → skip with friendly message
- Permission denied → show hint and try manual deletion
- Device in use → show hint and try manual deletion
- CoreSimulator service issues → show hint
- Partial failures → show "partially cleaned X/Y"

Fixes #520
2026-03-03 15:38:01 +08:00
github-actions[bot]
38601ec0d1 chore: update contributors [skip ci] 2026-03-03 02:04:59 +00:00
dependabot[bot]
0736892a57 chore(deps): bump actions/setup-go from 6.2.0 to 6.3.0 (#524)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 6.2.0 to 6.3.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](7a3fe6cf4c...4b73464bb3)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-version: 6.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-03 10:04:22 +08:00
dependabot[bot]
fd6d444e00 chore(deps): bump actions/upload-artifact from 6.0.0 to 7.0.0 (#525)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 6.0.0 to 7.0.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](b7c566a772...bbbca2ddaa)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-03 10:04:08 +08:00
dependabot[bot]
e992cd351b chore(deps): bump actions/download-artifact from 7.0.0 to 8.0.0 (#526)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 7.0.0 to 8.0.0.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](37930b1c2a...70fc10c6e5)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: 8.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-03 10:03:59 +08:00
dependabot[bot]
046af7682c chore(deps): bump github.com/shirou/gopsutil/v4 from 4.26.1 to 4.26.2 (#527)
Bumps [github.com/shirou/gopsutil/v4](https://github.com/shirou/gopsutil) from 4.26.1 to 4.26.2.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/compare/v4.26.1...v4.26.2)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v4
  dependency-version: 4.26.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-03 10:03:50 +08:00
tw93
27a2cc5927 feat: show nightly channel in version output
Refs #517
2026-03-02 10:55:36 +08:00
github-actions[bot]
0a8f92cf83 chore: update contributors [skip ci] 2026-03-01 13:06:02 +00:00
tw93
d4116fbd49 docs(readme): reduce duplicate quick-start guidance 2026-03-01 21:04:48 +08:00
tw93
de57a20828 refactor(dry-run): unify flag handling in completion and remove 2026-03-01 21:04:41 +08:00
tw93
241e6a7a34 fix(purge): avoid counting failed dry-run removals 2026-03-01 20:35:49 +08:00
陳德生
05446e0847 Add dry-run support across destructive commands (#516)
* chore: update contributors [skip ci]

* Add dry-run support across destructive commands

Implement dry-run for uninstall, purge, installer, touchid, completion, and remove flows.\nGuard side effects in uninstall path (launchctl, defaults writes, kill/brew actions), update help/README, and add coverage in CLI/Bats tests.\n\nValidation: ./scripts/check.sh and ./scripts/test.sh (452 tests, 0 failures, 8 skipped).

* test(purge): keep dev-compatible purge coverage

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tw93 <hitw93@gmail.com>
2026-03-01 20:03:22 +08:00
tw93
adcd98096a fix(update): keep sudo session alive during installer run
Start sudo keepalive after authorization and clean it up on all failure/success paths to avoid repeated password prompts and overlapping update UI output. Closes #514.
2026-03-01 19:56:42 +08:00
tw93
172742b0d5 fix(version): avoid SIGPIPE in Homebrew install detection
Cache Homebrew formula output and use shell string matching to prevent pipefail SIGPIPE races that could misreport script installs as manual. Closes #513.
2026-03-01 19:56:33 +08:00
tw93
3b5707b078 fix(clean): skip pip cache cleanup when pip3 is macOS stub
On macOS 15+, /usr/bin/pip3 exists as a stub that triggers Command Line
Tools installation dialog. The previous check only verified command
existence, causing false "pip cache · would clean" output for users
without actual pip3 installed.

Now verifies pip3 is functional by checking `pip3 --version` before
attempting cleanup.

Fixes #512
2026-02-28 20:19:30 +08:00
Tw93
d40783cca9 chore: auto format code 2026-02-28 07:27:33 +00:00
tw93
c8190772ac refactor(core): remove unused utility functions
Remove unused functions from base.sh and ui.sh:
- base.sh: is_interactive, spinner stack management, get_terminal_info, validate_terminal_environment
- ui.sh: with_spinner

Net reduction: ~166 lines of dead code
2026-02-28 15:25:53 +08:00
tw93
2f1985ad6f fix(clean): clear spinner remnants after stopping
Add extra terminal clear to prevent spinner character remnants
when cleaning project caches.
2026-02-28 14:57:45 +08:00
tw93
60624f951b fix(clean): respect whitelist in Homebrew dry-run mode
Show "skipped whitelist" instead of "would cleanup" when Homebrew cache
is whitelisted, making dry-run behavior consistent with actual execution.
2026-02-28 14:57:44 +08:00
tw93
167bc7ac8d docs: Add local file path guideline to AGENTS.md and CLAUDE.md, and update .gitignore to ignore these and mole_guidelines.md. 2026-02-28 11:51:16 +08:00
tw93
022b42687e test: mock defaults in tmutil tests to bypass early check added in #510 2026-02-28 11:45:26 +08:00
tw93
7568bfc579 test: update bytes_to_human performance test inputs to use Base-10 values 2026-02-28 11:38:49 +08:00
tw93
9fed092283 test: update bytes_to_human test inputs to use Base-10 values V1.28.1 2026-02-28 11:30:17 +08:00
tw93
9d89bab922 fix(uninstall): run LaunchServices refresh async so Press Enter prompt appears immediately 2026-02-28 11:28:03 +08:00
tw93
c1f25eb854 chore: Bump version to 1.28.1 2026-02-28 11:23:38 +08:00
tw93
297111aa1b chore: Delete test_rounding.sh script. 2026-02-28 11:23:17 +08:00
tw93
d2820eeb2e fix(uninstall): sync LaunchServices refresh for Spotlight update, remove background hint message, close #490 2026-02-28 11:22:41 +08:00
tw93
75dc9f01dc refactor(clean): use assignment form for arithmetic increments in safe_clean 2026-02-28 11:22:35 +08:00
Tw93
194e8ad29a chore: auto format code 2026-02-28 03:11:16 +00:00
tw93
c19a0276b8 refactor: Update shell arithmetic increment syntax from ((var++)) || true to var=$((var + 1)) across various scripts. 2026-02-28 11:10:18 +08:00
tw93
7d70889ad4 chore: auto format code 2026-02-28 11:03:16 +08:00
tw93
1be71edc9d fix: use Base-10 sizes and mdls logical size to match macOS Finder
- Switch bytes_to_human (shell) and humanizeBytes (Go) from Base-2
  (1024) to Base-10 (1000) to match Apple's storage calculation
  standard since Snow Leopard
- Add proper decimal rounding instead of truncation
- Use mdls kMDItemLogicalSize for .app bundles to avoid APFS clone
  file undercounting by du

Fixes #511
2026-02-28 10:02:34 +08:00