ace-git 0.18.0
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.
- checksums.yaml +7 -0
- data/.ace-defaults/git/config.yml +83 -0
- data/.ace-defaults/nav/protocols/guide-sources/ace-git.yml +10 -0
- data/.ace-defaults/nav/protocols/tmpl-sources/ace-git.yml +19 -0
- data/.ace-defaults/nav/protocols/wfi-sources/ace-git.yml +19 -0
- data/CHANGELOG.md +762 -0
- data/LICENSE +21 -0
- data/README.md +48 -0
- data/Rakefile +14 -0
- data/docs/demo/ace-git-getting-started.gif +0 -0
- data/docs/demo/ace-git-getting-started.tape.yml +18 -0
- data/docs/demo/fixtures/README.md +3 -0
- data/docs/demo/fixtures/sample.txt +1 -0
- data/docs/getting-started.md +87 -0
- data/docs/handbook.md +50 -0
- data/docs/usage.md +259 -0
- data/exe/ace-git +37 -0
- data/handbook/guides/version-control/ruby.md +41 -0
- data/handbook/guides/version-control/rust.md +49 -0
- data/handbook/guides/version-control/typescript.md +47 -0
- data/handbook/guides/version-control-system-git.g.md +829 -0
- data/handbook/skills/as-git-rebase/SKILL.md +43 -0
- data/handbook/skills/as-git-reorganize-commits/SKILL.md +41 -0
- data/handbook/skills/as-github-pr-create/SKILL.md +60 -0
- data/handbook/skills/as-github-pr-update/SKILL.md +41 -0
- data/handbook/skills/as-github-release-publish/SKILL.md +58 -0
- data/handbook/templates/commit/squash.template.md +59 -0
- data/handbook/templates/pr/bugfix.template.md +103 -0
- data/handbook/templates/pr/default.template.md +40 -0
- data/handbook/templates/pr/feature.template.md +41 -0
- data/handbook/workflow-instructions/git/rebase.wf.md +402 -0
- data/handbook/workflow-instructions/git/reorganize-commits.wf.md +158 -0
- data/handbook/workflow-instructions/github/pr/create.wf.md +282 -0
- data/handbook/workflow-instructions/github/pr/update.wf.md +199 -0
- data/handbook/workflow-instructions/github/release-publish.wf.md +162 -0
- data/lib/ace/git/atoms/command_executor.rb +253 -0
- data/lib/ace/git/atoms/date_resolver.rb +129 -0
- data/lib/ace/git/atoms/diff_numstat_parser.rb +82 -0
- data/lib/ace/git/atoms/diff_parser.rb +110 -0
- data/lib/ace/git/atoms/file_grouper.rb +152 -0
- data/lib/ace/git/atoms/git_scope_filter.rb +86 -0
- data/lib/ace/git/atoms/git_status_fetcher.rb +29 -0
- data/lib/ace/git/atoms/grouped_stats_formatter.rb +233 -0
- data/lib/ace/git/atoms/lock_error_detector.rb +79 -0
- data/lib/ace/git/atoms/pattern_filter.rb +156 -0
- data/lib/ace/git/atoms/pr_identifier_parser.rb +88 -0
- data/lib/ace/git/atoms/repository_checker.rb +97 -0
- data/lib/ace/git/atoms/repository_state_detector.rb +92 -0
- data/lib/ace/git/atoms/stale_lock_cleaner.rb +247 -0
- data/lib/ace/git/atoms/status_formatter.rb +180 -0
- data/lib/ace/git/atoms/task_pattern_extractor.rb +57 -0
- data/lib/ace/git/atoms/time_formatter.rb +84 -0
- data/lib/ace/git/cli/commands/branch.rb +62 -0
- data/lib/ace/git/cli/commands/diff.rb +252 -0
- data/lib/ace/git/cli/commands/pr.rb +119 -0
- data/lib/ace/git/cli/commands/status.rb +84 -0
- data/lib/ace/git/cli.rb +87 -0
- data/lib/ace/git/models/diff_config.rb +185 -0
- data/lib/ace/git/models/diff_result.rb +94 -0
- data/lib/ace/git/models/repo_status.rb +202 -0
- data/lib/ace/git/molecules/branch_reader.rb +92 -0
- data/lib/ace/git/molecules/config_loader.rb +108 -0
- data/lib/ace/git/molecules/diff_filter.rb +102 -0
- data/lib/ace/git/molecules/diff_generator.rb +160 -0
- data/lib/ace/git/molecules/git_status_fetcher.rb +32 -0
- data/lib/ace/git/molecules/pr_metadata_fetcher.rb +286 -0
- data/lib/ace/git/molecules/recent_commits_fetcher.rb +53 -0
- data/lib/ace/git/organisms/diff_orchestrator.rb +178 -0
- data/lib/ace/git/organisms/repo_status_loader.rb +264 -0
- data/lib/ace/git/version.rb +7 -0
- data/lib/ace/git.rb +230 -0
- metadata +201 -0
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Michal Czyz
|
|
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.
|
data/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1> ACE - Git </h1>
|
|
3
|
+
|
|
4
|
+
Git workflows and context commands for developers and AI agents.
|
|
5
|
+
|
|
6
|
+
<img src="https://raw.githubusercontent.com/cs3b/ace/main/docs/brand/AgenticCodingEnvironment.Logo.XS.jpg" alt="ACE Logo" width="480">
|
|
7
|
+
<br><br>
|
|
8
|
+
|
|
9
|
+
<a href="https://rubygems.org/gems/ace-git"><img alt="Gem Version" src="https://img.shields.io/gem/v/ace-git.svg" /></a>
|
|
10
|
+
<a href="https://www.ruby-lang.org"><img alt="Ruby" src="https://img.shields.io/badge/Ruby-3.2+-CC342D?logo=ruby" /></a>
|
|
11
|
+
<a href="https://opensource.org/licenses/MIT"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-blue.svg" /></a>
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
> Works with: Claude Code, Codex CLI, OpenCode, Gemini CLI, pi-agent, and more.
|
|
16
|
+
|
|
17
|
+
[Getting Started](docs/getting-started.md) | [Usage Guide](docs/usage.md) | [Handbook - Skills, Agents, Templates](docs/handbook.md)
|
|
18
|
+
|
|
19
|
+

|
|
20
|
+
|
|
21
|
+
`ace-git` gives developers and coding agents focused git context commands and guided workflows that keep history operations traceable, review-friendly, and safe to execute from the terminal. It handles status, diff, branch, PR context, and structured rebase and reorganization flows.
|
|
22
|
+
|
|
23
|
+
## How It Works
|
|
24
|
+
|
|
25
|
+
1. Query repository state with context commands for status, diff, branch, and pull request metadata.
|
|
26
|
+
2. Run guided workflows for changelog-preserving rebases, commit reorganization, and PR creation or update.
|
|
27
|
+
3. Review results with smart diff output in summary and grouped-stats formats before publishing.
|
|
28
|
+
|
|
29
|
+
## Use Cases
|
|
30
|
+
|
|
31
|
+
**Check repo and PR context without leaving the CLI** - inspect branch, change, and pull request state quickly with [`ace-git`](docs/usage.md) before running higher-risk history operations.
|
|
32
|
+
|
|
33
|
+
**Rebase with changelog-safe workflow guardrails** - use the `as-git-rebase` agent workflow to run structured rebase flows that preserve package release metadata and reduce manual conflict-prone steps.
|
|
34
|
+
|
|
35
|
+
**Prepare clean review history before publishing** - run the `as-git-reorganize-commits` workflow to reorganize commit stacks, then use `as-github-pr-create` or `as-github-pr-update` to manage PR metadata in a predictable workflow sequence. See [Handbook](docs/handbook.md) for the full skill and workflow catalog.
|
|
36
|
+
|
|
37
|
+
**Coordinate with commit and worktree tools** - pair with [ace-git-commit](../ace-git-commit) for scoped commit authoring, [ace-git-worktree](../ace-git-worktree) for task-oriented worktree management, and [ace-bundle](../ace-bundle) for loading workflow instructions.
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
gem install ace-git
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
See [Getting Started](docs/getting-started.md) for setup and first steps.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
[Getting Started](docs/getting-started.md) | [Usage Guide](docs/usage.md) | [Handbook - Skills, Agents, Templates](docs/handbook.md) | Part of [ACE](https://github.com/cs3b/ace)
|
data/Rakefile
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bundler/gem_tasks"
|
|
4
|
+
require "rake/testtask"
|
|
5
|
+
|
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
|
7
|
+
t.libs << "test"
|
|
8
|
+
t.pattern = "test/**/*_test.rb"
|
|
9
|
+
t.warning = false
|
|
10
|
+
t.verbose = false
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Keep build as default for backward compatibility
|
|
14
|
+
task default: :build
|
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Show ace-git repository context and diff summary
|
|
3
|
+
tags:
|
|
4
|
+
- ace-git
|
|
5
|
+
- git
|
|
6
|
+
- getting-started
|
|
7
|
+
settings:
|
|
8
|
+
font_size: 16
|
|
9
|
+
width: 1200
|
|
10
|
+
height: 700
|
|
11
|
+
format: gif
|
|
12
|
+
scenes:
|
|
13
|
+
- name: Main flow
|
|
14
|
+
commands:
|
|
15
|
+
- type: ace-git status
|
|
16
|
+
sleep: 4s
|
|
17
|
+
- type: ace-git diff --format summary
|
|
18
|
+
sleep: 4s
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sample fixture content
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
doc-type: user
|
|
3
|
+
title: ace-git Getting Started
|
|
4
|
+
purpose: Tutorial for ace-git first-run workflows
|
|
5
|
+
ace-docs:
|
|
6
|
+
last-updated: 2026-03-22
|
|
7
|
+
last-checked: 2026-03-22
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Getting Started with ace-git
|
|
11
|
+
|
|
12
|
+
This walkthrough shows the core `ace-git` loop: inspect repository context, review a diff, and jump into a
|
|
13
|
+
guided workflow.
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
- Ruby 3.2+
|
|
18
|
+
- Git 2.23+
|
|
19
|
+
- `ace-git` installed
|
|
20
|
+
- Optional: GitHub CLI (`gh`) for PR-aware commands and workflows
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
gem install ace-git
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 1. Check Repository Context
|
|
29
|
+
|
|
30
|
+
Start with the repo snapshot command:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
ace-git status
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This shows your current branch, tracking state, recent commits, and PR context when available.
|
|
37
|
+
|
|
38
|
+
## 2. Inspect the Diff
|
|
39
|
+
|
|
40
|
+
Use the summary format when you want a quick read on what changed:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
ace-git diff --format summary
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Switch to raw diff output later with `ace-git diff` when you need the full patch.
|
|
47
|
+
|
|
48
|
+
## 3. Open a Guided Workflow
|
|
49
|
+
|
|
50
|
+
Use `ace-nav` when you want to discover or load the rebase workflow entry point:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
ace-nav wfi://git/rebase
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
When you are ready to run it directly, load the workflow with `ace-bundle wfi://git/rebase`.
|
|
57
|
+
|
|
58
|
+
## 4. Set Basic Preferences
|
|
59
|
+
|
|
60
|
+
Add project or user defaults in `.ace/git/config.yml`:
|
|
61
|
+
|
|
62
|
+
```yaml
|
|
63
|
+
git:
|
|
64
|
+
default_branch: main
|
|
65
|
+
remote: origin
|
|
66
|
+
status:
|
|
67
|
+
commits_limit: 5
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Use this for preferences, not for redefining the workflow logic.
|
|
71
|
+
|
|
72
|
+
## Common Commands
|
|
73
|
+
|
|
74
|
+
| Goal | Command |
|
|
75
|
+
|------|---------|
|
|
76
|
+
| Show repo context | `ace-git status` |
|
|
77
|
+
| Show a quick diff summary | `ace-git diff --format summary` |
|
|
78
|
+
| Show branch tracking info | `ace-git branch` |
|
|
79
|
+
| Show PR metadata | `ace-git pr` |
|
|
80
|
+
| Show package version | `ace-git version` |
|
|
81
|
+
|
|
82
|
+
## Next Steps
|
|
83
|
+
|
|
84
|
+
- Load `wfi://github/pr/create` to open a structured PR workflow
|
|
85
|
+
- Load `wfi://github/pr/update` to refresh an existing PR description
|
|
86
|
+
- Load `wfi://git/reorganize-commits` to clean up branch history before review
|
|
87
|
+
- Run `ace-git --help` to browse command-level examples
|
data/docs/handbook.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
doc-type: user
|
|
3
|
+
title: ace-git Handbook Catalog
|
|
4
|
+
purpose: Catalog of ace-git workflows, skills, guides, and templates
|
|
5
|
+
ace-docs:
|
|
6
|
+
last-updated: 2026-03-22
|
|
7
|
+
last-checked: 2026-03-22
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# ace-git Handbook Catalog
|
|
11
|
+
|
|
12
|
+
Reference for package-owned handbook resources in `ace-git/handbook/`.
|
|
13
|
+
|
|
14
|
+
## Skills
|
|
15
|
+
|
|
16
|
+
| Skill | What it does |
|
|
17
|
+
|-------|--------------|
|
|
18
|
+
| `as-git-rebase` | Guide changelog-preserving rebases |
|
|
19
|
+
| `as-git-reorganize-commits` | Rework commit history into reviewable logical groups |
|
|
20
|
+
| `as-github-pr-create` | Create pull requests with the package templates and workflow |
|
|
21
|
+
| `as-github-pr-update` | Refresh an existing PR body from current branch context |
|
|
22
|
+
| `as-github-release-publish` | Publish a GitHub release from the ACE workflow |
|
|
23
|
+
|
|
24
|
+
## Workflow Instructions
|
|
25
|
+
|
|
26
|
+
| Protocol Path | Purpose | Invoked by |
|
|
27
|
+
|--------------|---------|------------|
|
|
28
|
+
| `wfi://git/rebase` | Rebase a branch while preserving changelog/version files | `as-git-rebase` |
|
|
29
|
+
| `wfi://git/reorganize-commits` | Consolidate or regroup commit history before review | `as-git-reorganize-commits` |
|
|
30
|
+
| `wfi://github/pr/create` | Create a PR with the package templates | `as-github-pr-create` |
|
|
31
|
+
| `wfi://github/pr/update` | Update a PR description from current state | `as-github-pr-update` |
|
|
32
|
+
| `wfi://github/release-publish` | Publish a GitHub release | `as-github-release-publish` |
|
|
33
|
+
|
|
34
|
+
## Guides
|
|
35
|
+
|
|
36
|
+
- `handbook/guides/version-control-system-git.g.md`
|
|
37
|
+
- `handbook/guides/version-control/ruby.md`
|
|
38
|
+
- `handbook/guides/version-control/rust.md`
|
|
39
|
+
- `handbook/guides/version-control/typescript.md`
|
|
40
|
+
|
|
41
|
+
## Templates
|
|
42
|
+
|
|
43
|
+
- PR templates: `handbook/templates/pr/default.template.md`, `handbook/templates/pr/feature.template.md`, `handbook/templates/pr/bugfix.template.md`
|
|
44
|
+
- Commit templates: `handbook/templates/commit/squash.template.md`
|
|
45
|
+
|
|
46
|
+
## Related Docs
|
|
47
|
+
|
|
48
|
+
- [Getting Started](getting-started.md)
|
|
49
|
+
- [CLI Usage Reference](usage.md)
|
|
50
|
+
- Load workflows directly with `ace-bundle`, for example `ace-bundle wfi://git/rebase`
|
data/docs/usage.md
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
---
|
|
2
|
+
doc-type: user
|
|
3
|
+
title: ace-git CLI Usage Reference
|
|
4
|
+
purpose: Command reference for ace-git
|
|
5
|
+
ace-docs:
|
|
6
|
+
last-updated: 2026-03-22
|
|
7
|
+
last-checked: 2026-03-22
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# ace-git CLI Usage Reference
|
|
11
|
+
|
|
12
|
+
Reference for `ace-git` commands, options, and configuration.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# In Gemfile
|
|
18
|
+
gem 'ace-git'
|
|
19
|
+
|
|
20
|
+
# Or install directly
|
|
21
|
+
gem install ace-git
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Command Overview
|
|
25
|
+
|
|
26
|
+
`ace-git` ships five commands:
|
|
27
|
+
|
|
28
|
+
- `diff` for filtered or formatted git diffs
|
|
29
|
+
- `status` for repository context and PR activity
|
|
30
|
+
- `branch` for current branch and tracking state
|
|
31
|
+
- `pr` for PR metadata lookup
|
|
32
|
+
- `version` for the installed package version
|
|
33
|
+
|
|
34
|
+
`ace-git` with no arguments shows help. Git range shorthand such as `HEAD~5..HEAD` routes to `diff`.
|
|
35
|
+
|
|
36
|
+
## Commands
|
|
37
|
+
|
|
38
|
+
### `ace-git --help`
|
|
39
|
+
|
|
40
|
+
Show formatted command help and examples.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
ace-git --help
|
|
44
|
+
ace-git -h
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`ace-git` with no arguments also shows help.
|
|
48
|
+
|
|
49
|
+
### `ace-git diff [RANGE]`
|
|
50
|
+
|
|
51
|
+
Generate git diff with configurable filtering and formatting.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Smart defaults (unstaged changes OR branch diff)
|
|
55
|
+
ace-git diff
|
|
56
|
+
ace-git diff --since "7d"
|
|
57
|
+
|
|
58
|
+
# Specific range
|
|
59
|
+
ace-git diff HEAD~10..HEAD
|
|
60
|
+
ace-git diff origin/main...HEAD
|
|
61
|
+
|
|
62
|
+
# Range shorthand (routes to diff)
|
|
63
|
+
ace-git HEAD~5..HEAD
|
|
64
|
+
ace-git HEAD
|
|
65
|
+
|
|
66
|
+
# Time-based filtering
|
|
67
|
+
ace-git diff --since "1 week ago"
|
|
68
|
+
ace-git diff --since "2025-01-01"
|
|
69
|
+
|
|
70
|
+
# Path filtering (glob patterns)
|
|
71
|
+
ace-git diff --paths "lib/**/*.rb" "src/**/*.js"
|
|
72
|
+
ace-git diff --exclude "test/**/*" "vendor/**/*"
|
|
73
|
+
|
|
74
|
+
# Save to file
|
|
75
|
+
ace-git diff --output changes.diff
|
|
76
|
+
ace-git diff HEAD~5..HEAD --output /tmp/my-changes.diff
|
|
77
|
+
|
|
78
|
+
# Summary format (human-readable)
|
|
79
|
+
ace-git diff --format summary
|
|
80
|
+
|
|
81
|
+
# Grouped stats format (package/layer grouped)
|
|
82
|
+
ace-git diff --format grouped-stats
|
|
83
|
+
|
|
84
|
+
# Raw unfiltered diff
|
|
85
|
+
ace-git diff --raw
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Options:**
|
|
89
|
+
- `--format, -f` - Output format: `diff` (default), `summary`, `grouped-stats`
|
|
90
|
+
- `--since, -s` - Changes since date/duration (e.g., "7d", "1 week ago")
|
|
91
|
+
- `--paths, -p` - Include only these glob patterns
|
|
92
|
+
- `--exclude, -e` - Exclude these glob patterns
|
|
93
|
+
- `--output, -o` - Write diff to file instead of stdout
|
|
94
|
+
- `--config, -c` - Load config from specific file
|
|
95
|
+
- `--raw` - Raw unfiltered output (no exclusions)
|
|
96
|
+
|
|
97
|
+
### `ace-git status`
|
|
98
|
+
|
|
99
|
+
Display comprehensive repository context including current branch, associated PR information, recent commits, and PR activity (merged/open PRs).
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# Full status output (markdown)
|
|
103
|
+
ace-git status
|
|
104
|
+
|
|
105
|
+
# Skip PR lookups (faster, local-only)
|
|
106
|
+
ace-git status --no-pr
|
|
107
|
+
ace-git status -n
|
|
108
|
+
|
|
109
|
+
# Control recent commits shown
|
|
110
|
+
ace-git status --commits 5 # Show 5 recent commits
|
|
111
|
+
ace-git status --commits 0 # Disable recent commits
|
|
112
|
+
|
|
113
|
+
# JSON output
|
|
114
|
+
ace-git status --format json
|
|
115
|
+
|
|
116
|
+
# Include PR diff in output
|
|
117
|
+
ace-git status --with-diff
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Options:**
|
|
121
|
+
- `--format, -f` - Output format: `markdown` (default), `json`
|
|
122
|
+
- `--no-pr, -n` - Skip PR metadata and activity lookups (faster)
|
|
123
|
+
- `--commits N` - Number of recent commits to show (default: 3 from config)
|
|
124
|
+
- `--with-diff` - Include PR diff in output
|
|
125
|
+
|
|
126
|
+
**Output includes:**
|
|
127
|
+
- Current branch name with git status -sb output
|
|
128
|
+
- Remote tracking status (ahead/behind)
|
|
129
|
+
- Detected task pattern (from branch name)
|
|
130
|
+
- Recent commits (configurable count)
|
|
131
|
+
- Associated PR metadata (if found)
|
|
132
|
+
- PR activity: recently merged PRs and open PRs
|
|
133
|
+
|
|
134
|
+
### `ace-git branch`
|
|
135
|
+
|
|
136
|
+
Display current branch name and remote tracking status.
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
ace-git branch
|
|
140
|
+
# Output: 140-feature-name (tracking: origin/140-feature-name)
|
|
141
|
+
|
|
142
|
+
ace-git branch --format json
|
|
143
|
+
# Output:
|
|
144
|
+
# {
|
|
145
|
+
# "name": "140-feature-name",
|
|
146
|
+
# "detached": false,
|
|
147
|
+
# "tracking": "origin/140-feature-name",
|
|
148
|
+
# "ahead": 2,
|
|
149
|
+
# "behind": 0,
|
|
150
|
+
# "up_to_date": false,
|
|
151
|
+
# "status_description": "2 ahead"
|
|
152
|
+
# }
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Options:**
|
|
156
|
+
- `--format, -f` - Output format: `text` (default), `json`
|
|
157
|
+
|
|
158
|
+
### `ace-git pr [NUMBER]`
|
|
159
|
+
|
|
160
|
+
Fetch and display PR metadata using GitHub CLI.
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Auto-detect PR from current branch
|
|
164
|
+
ace-git pr
|
|
165
|
+
|
|
166
|
+
# Specific PR number
|
|
167
|
+
ace-git pr 123
|
|
168
|
+
|
|
169
|
+
# Cross-repository PR
|
|
170
|
+
ace-git pr owner/repo#456
|
|
171
|
+
|
|
172
|
+
# JSON output
|
|
173
|
+
ace-git pr --format json
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Options:**
|
|
177
|
+
- `--format, -f` - Output format: `markdown` (default), `json`
|
|
178
|
+
- `--with-diff` - Include PR diff in output
|
|
179
|
+
|
|
180
|
+
**PR Number Formats:**
|
|
181
|
+
- Simple number: `123`
|
|
182
|
+
- Qualified: `owner/repo#456`
|
|
183
|
+
- GitHub URL: `https://github.com/owner/repo/pull/789`
|
|
184
|
+
|
|
185
|
+
**Requirements:** GitHub CLI (`gh`) must be installed and authenticated.
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# Install gh
|
|
189
|
+
brew install gh
|
|
190
|
+
|
|
191
|
+
# Authenticate
|
|
192
|
+
gh auth login
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### `ace-git version`
|
|
196
|
+
|
|
197
|
+
Print the installed `ace-git` version.
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
ace-git version
|
|
201
|
+
ace-git --version
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Configuration
|
|
205
|
+
|
|
206
|
+
ace-git uses the ACE configuration cascade:
|
|
207
|
+
|
|
208
|
+
- **Global config:** `~/.ace/git/config.yml`
|
|
209
|
+
- **Project config:** `.ace/git/config.yml`
|
|
210
|
+
- **Example config:** `ace-git/.ace-defaults/git/config.yml`
|
|
211
|
+
|
|
212
|
+
### Example Configuration
|
|
213
|
+
|
|
214
|
+
```yaml
|
|
215
|
+
# .ace/git/config.yml
|
|
216
|
+
diff:
|
|
217
|
+
exclude_patterns:
|
|
218
|
+
- "vendor/**/*"
|
|
219
|
+
- "node_modules/**/*"
|
|
220
|
+
- "*.lock"
|
|
221
|
+
exclude_whitespace: true
|
|
222
|
+
exclude_renames: false
|
|
223
|
+
max_lines: 10000
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Configuration Options
|
|
227
|
+
|
|
228
|
+
| Option | Type | Default | Description |
|
|
229
|
+
|--------|------|---------|-------------|
|
|
230
|
+
| `exclude_patterns` | Array | See below | Glob patterns to exclude from diff |
|
|
231
|
+
| `exclude_whitespace` | Boolean | `true` | Ignore whitespace-only changes |
|
|
232
|
+
| `exclude_renames` | Boolean | `false` | Exclude renamed files from diff |
|
|
233
|
+
| `exclude_moves` | Boolean | `false` | Exclude moved files from diff |
|
|
234
|
+
| `max_lines` | Integer | `10000` | Maximum lines in diff output |
|
|
235
|
+
| `timeout` | Integer | `30` | Command timeout in seconds |
|
|
236
|
+
| `grouped_stats.layers` | Array | `["lib","test","handbook"]` | Preferred layer grouping order |
|
|
237
|
+
| `grouped_stats.collapse_above` | Integer | `5` | Collapse markdown groups above this file count |
|
|
238
|
+
| `grouped_stats.show_full_tree` | String | `collapsible` | Tree rendering strategy hint |
|
|
239
|
+
| `grouped_stats.dotfile_groups` | Array | `[".ace-taskflow",".ace"]` | Dot-directories to prioritize in grouping |
|
|
240
|
+
|
|
241
|
+
**Default exclude_patterns** (from `.ace-defaults/git/config.yml`):
|
|
242
|
+
- Lock files: `**/*.lock`, `package-lock.json`, `yarn.lock`, `Gemfile.lock`
|
|
243
|
+
- Vendored deps: `vendor/**/*`, `node_modules/**/*`
|
|
244
|
+
- Build artifacts: `coverage/**/*`, `dist/**/*`, `build/**/*`, `.cache/**/*`
|
|
245
|
+
- Test fixtures: `**/fixtures/**/*`, `**/testdata/**/*`
|
|
246
|
+
|
|
247
|
+
Note: `test/**/*` and `spec/**/*` are NOT excluded by default - test changes are typically important to review.
|
|
248
|
+
|
|
249
|
+
## Exit Codes
|
|
250
|
+
|
|
251
|
+
- `0` - Success
|
|
252
|
+
- `1` - Error (configuration error, git error, etc.)
|
|
253
|
+
|
|
254
|
+
## Related Tools
|
|
255
|
+
|
|
256
|
+
- **ace-git-commit** - Smart git commit generation
|
|
257
|
+
- **ace-git-worktree** - Git worktree management
|
|
258
|
+
- **ace-bundle** - Load ACE workflow instructions directly
|
|
259
|
+
- **ace-nav** - Discover workflow and template protocol paths
|
data/exe/ace-git
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "ace/support/cli"
|
|
5
|
+
require_relative "../lib/ace/git"
|
|
6
|
+
require_relative "../lib/ace/git/cli"
|
|
7
|
+
|
|
8
|
+
def git_range_pattern?(arg)
|
|
9
|
+
return false if arg.nil?
|
|
10
|
+
|
|
11
|
+
return true if arg.match?(/\.\.\.?/) # Range operators: .. or ...
|
|
12
|
+
return true if arg.match?(/[~^]\d*/) # Ref modifiers: ~, ~2, ^, ^2
|
|
13
|
+
return true if arg == "HEAD" # Exact HEAD match
|
|
14
|
+
return true if arg.match?(/@\{/) # Reflog: @{1}, @{yesterday}
|
|
15
|
+
|
|
16
|
+
false
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def normalized_args(argv)
|
|
20
|
+
return ["--help"] if argv.empty?
|
|
21
|
+
return ["diff"] + argv if git_range_pattern?(argv.first)
|
|
22
|
+
|
|
23
|
+
argv
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Start ace-support-cli with exception-based exit code handling (per ADR-023)
|
|
27
|
+
begin
|
|
28
|
+
Ace::Support::Cli::Runner.new(Ace::Git::CLI).call(args: normalized_args(ARGV))
|
|
29
|
+
rescue SystemExit => e
|
|
30
|
+
exit(e.status)
|
|
31
|
+
rescue Ace::Support::Cli::Error => e
|
|
32
|
+
warn e.message
|
|
33
|
+
exit(e.exit_code)
|
|
34
|
+
rescue Ace::Support::Cli::CommandNotFoundError => e
|
|
35
|
+
warn "unknown command: #{e.message}"
|
|
36
|
+
exit(1)
|
|
37
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Ruby Version Control Examples
|
|
2
|
+
|
|
3
|
+
This file provides Ruby-specific examples and considerations related to the main [Version Control Git Guide](../version-control-system-git.g.md).
|
|
4
|
+
|
|
5
|
+
* **.gitignore:** Ensure standard Ruby/Rails files are ignored (e.g., `log/*`, `tmp/*`, `.bundle/`, `coverage/`,
|
|
6
|
+
`.env`). Tools like [gitignore.io](https://www.toptal.com/developers/gitignore) can generate good starting points.
|
|
7
|
+
* **Pre-commit Hooks:** Use tools like `overcommit` or `lefthook` to run linters (`RuboCop`), formatters
|
|
8
|
+
(`RuboCop -a`), and tests (`RSpec`, `Minitest`) before committing.
|
|
9
|
+
* **Dependency Locking:** Always commit `Gemfile.lock` to ensure consistent dependencies across environments.
|
|
10
|
+
* **Branching Strategy:** Standard Git workflows (like Gitflow or GitHub Flow) apply. No Ruby-specific branching requirements.
|
|
11
|
+
|
|
12
|
+
```yaml
|
|
13
|
+
# Example .overcommit.yml snippet
|
|
14
|
+
PreCommit:
|
|
15
|
+
RuboCop:
|
|
16
|
+
enabled: true
|
|
17
|
+
command: ['bundle', 'exec', 'rubocop', '--parallel']
|
|
18
|
+
RSpec:
|
|
19
|
+
enabled: true
|
|
20
|
+
command: ['bundle', 'exec', 'rspec']
|
|
21
|
+
|
|
22
|
+
CommitMsg:
|
|
23
|
+
CapitalizedSubject:
|
|
24
|
+
enabled: true
|
|
25
|
+
EmptyMessage:
|
|
26
|
+
enabled: true
|
|
27
|
+
TextWidth:
|
|
28
|
+
enabled: true
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```gitignore
|
|
32
|
+
# Example additions to .gitignore for a Ruby project
|
|
33
|
+
/.bundle
|
|
34
|
+
/log/*
|
|
35
|
+
!/log/.keep
|
|
36
|
+
/tmp/*
|
|
37
|
+
!/tmp/.keep
|
|
38
|
+
/coverage/
|
|
39
|
+
*.gem
|
|
40
|
+
.env*
|
|
41
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Rust Version Control Examples
|
|
2
|
+
|
|
3
|
+
This file provides Rust-specific examples and considerations related to the main [Version Control Git Guide](../version-control-system-git.g.md).
|
|
4
|
+
|
|
5
|
+
* **.gitignore:** Ensure the standard Rust build directory (`target/`) is ignored. Tools like
|
|
6
|
+
[gitignore.io](https://www.toptal.com/developers/gitignore) are helpful.
|
|
7
|
+
* **Pre-commit Hooks:** Use tools like `husky` (if in a mixed project or preferred) or simple shell script hooks
|
|
8
|
+
(`.git/hooks/pre-commit`) to run the formatter (`cargo fmt --check`) and linter (`cargo clippy -- -D warnings`)
|
|
9
|
+
before committing.
|
|
10
|
+
* **Dependency Locking:** Always commit `Cargo.lock` to ensure reproducible builds and consistent dependencies.
|
|
11
|
+
* **Branching Strategy:** Standard Git workflows apply.
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
#!/bin/sh
|
|
15
|
+
# Example .git/hooks/pre-commit script for Rust
|
|
16
|
+
|
|
17
|
+
echo "Running pre-commit hook..."
|
|
18
|
+
|
|
19
|
+
# Check formatting
|
|
20
|
+
cargo fmt --check
|
|
21
|
+
if [ $? -ne 0 ]; then
|
|
22
|
+
echo "Code formatting issues found. Run 'cargo fmt' to fix."
|
|
23
|
+
exit 1
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
# Check linting (deny warnings)
|
|
27
|
+
cargo clippy -- -D warnings
|
|
28
|
+
if [ $? -ne 0 ]; then
|
|
29
|
+
echo "Clippy issues found. Address them before committing."
|
|
30
|
+
exit 1
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
# Optionally run tests
|
|
34
|
+
# cargo test
|
|
35
|
+
# if [ $? -ne 0 ]; then
|
|
36
|
+
# echo "Tests failed. Fix tests before committing."
|
|
37
|
+
# exit 1
|
|
38
|
+
# fi
|
|
39
|
+
|
|
40
|
+
echo "Pre-commit checks passed."
|
|
41
|
+
exit 0
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```gitignore
|
|
45
|
+
# Example additions to .gitignore for a Rust project
|
|
46
|
+
/target
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Note:** Make the pre-commit script executable: `chmod +x .git/hooks/pre-commit`.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# TypeScript Version Control Examples
|
|
2
|
+
|
|
3
|
+
This file provides TypeScript/Node.js specific examples and considerations related to the main [Version Control Git Guide](../version-control-system-git.g.md).
|
|
4
|
+
|
|
5
|
+
* **.gitignore:** Ensure standard Node.js/TypeScript files are ignored (e.g., `node_modules/`, `dist/`, `build/`,
|
|
6
|
+
`.env`, `*.tsbuildinfo`, `coverage/`). Tools like [gitignore.io](https://www.toptal.com/developers/gitignore) can
|
|
7
|
+
generate good starting points.
|
|
8
|
+
* **Pre-commit Hooks:** Use tools like `husky` with `lint-staged` to run linters (`ESLint`), formatters (`Prettier`),
|
|
9
|
+
type checkers (`tsc --noEmit`), and tests (`Jest`, `Mocha`) on staged files before committing.
|
|
10
|
+
* **Dependency Locking:** Always commit `package-lock.json` (for npm) or `yarn.lock` (for Yarn) to ensure consistent dependencies.
|
|
11
|
+
* **Branching Strategy:** Standard Git workflows apply.
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
// Example .lintstagedrc.json (used with husky)
|
|
15
|
+
{
|
|
16
|
+
"*.{js,jsx,ts,tsx}": [
|
|
17
|
+
"eslint --fix",
|
|
18
|
+
"prettier --write"
|
|
19
|
+
],
|
|
20
|
+
"*.{json,md,yml,yaml}": [
|
|
21
|
+
"prettier --write"
|
|
22
|
+
],
|
|
23
|
+
"*.ts?(x)": [
|
|
24
|
+
"bash -c 'tsc --noEmit'"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```gitignore
|
|
30
|
+
# Example additions to .gitignore for a TypeScript/Node project
|
|
31
|
+
/node_modules
|
|
32
|
+
/dist
|
|
33
|
+
/build
|
|
34
|
+
/.env*
|
|
35
|
+
*.tsbuildinfo
|
|
36
|
+
/coverage/
|
|
37
|
+
npm-debug.log*
|
|
38
|
+
yarn-debug.log*
|
|
39
|
+
yarn-error.log*
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Example husky setup command (run once)
|
|
44
|
+
npx husky init && npm install
|
|
45
|
+
# Add hooks like:
|
|
46
|
+
npx husky add .husky/pre-commit "npx lint-staged"
|
|
47
|
+
```
|