Skip to content

Commit d790675

Browse files
authored
Merge pull request #4 from epcim/fixeswithoutAi
Fixeswithout ai
2 parents 0335414 + 50f8877 commit d790675

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1504
-2504
lines changed

.env

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,5 @@
11
# Source this file manually if you don't use direnv:
22
# source .env
3-
# Or add to your shell rc: source /path/to/git-cross/.env
4-
5-
# Add cross wrapper to PATH
6-
export PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd):$PATH"
7-
8-
# Detect and add Homebrew to PATH
9-
if [ -d "/opt/homebrew/bin" ]; then
10-
export PATH="/opt/homebrew/bin:$PATH"
11-
elif [ -d "/usr/local/bin" ]; then
12-
export PATH="/usr/local/bin:$PATH"
13-
elif [ -d "/home/linuxbrew/.linuxbrew/bin" ]; then
14-
export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"
15-
elif [ -n "$HOMEBREW_PREFIX" ]; then
16-
export PATH="$HOMEBREW_PREFIX/bin:$PATH"
17-
fi
183

194
export PATH="$HOME/bin:$PATH"
205

.envrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
# .envrc – load environment variables for this repo
1+
# direnv - load environment variables for this repo
2+
source_up
3+
24
# If .env exists, source it (direnv will evaluate this file automatically)
35
test -f "$(pwd)/.env" && source "$(pwd)/.env" || true

.github/workflows/ci.yml

Lines changed: 21 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -2,123 +2,49 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [ master, main ]
66
pull_request:
7-
branches: [ main ]
7+
branches: [ master, main ]
88

99
jobs:
1010
test:
11-
name: Test on ${{ matrix.os }}
12-
runs-on: ${{ matrix.os }}
13-
strategy:
14-
matrix:
15-
os: [ubuntu-latest, macos-latest]
16-
fail-fast: false
11+
name: Test
12+
runs-on: ubuntu-latest
1713

1814
steps:
1915
- uses: actions/checkout@v4
2016

2117
- name: Install dependencies
2218
run: |
23-
if [ "$RUNNER_OS" == "Linux" ]; then
24-
sudo apt-get update
25-
sudo apt-get install -y fish rsync
26-
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to ~/bin
27-
echo "$HOME/bin" >> $GITHUB_PATH
28-
elif [ "$RUNNER_OS" == "macOS" ]; then
29-
brew install fish rsync just
30-
fi
19+
sudo apt-get update
20+
sudo apt-get install -y fish rsync jq
21+
# Install yq
22+
sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq
23+
sudo chmod +x /usr/bin/yq
24+
# Install just
25+
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to ~/bin
26+
echo "$HOME/bin" >> $GITHUB_PATH
3127
3228
- name: Verify installation
3329
run: |
3430
just --version
3531
fish --version
3632
git --version
3733
rsync --version
34+
jq --version
35+
yq --version
3836
3937
- name: Run dependency check
40-
run: just check-deps
38+
run: just cross check-deps
4139

4240
- name: Run all tests
43-
run: ./test/test_all_commands.sh
44-
45-
- name: Run individual tests
46-
run: |
47-
for test in test/test_*.sh; do
48-
if [ -x "$test" ] && [ "$test" != "test/test_all_commands.sh" ]; then
49-
echo "Running $test..."
50-
$test
51-
fi
52-
done
41+
run: just cross-test
5342

54-
- name: Test coverage report
43+
- name: Upload test logs
5544
if: always()
56-
run: |
57-
echo "## Test Results" >> $GITHUB_STEP_SUMMARY
58-
echo "" >> $GITHUB_STEP_SUMMARY
59-
echo "| Test | Status |" >> $GITHUB_STEP_SUMMARY
60-
echo "|------|--------|" >> $GITHUB_STEP_SUMMARY
61-
62-
TOTAL=0
63-
PASSED=0
64-
65-
for test in test/test_*.sh; do
66-
if [ -x "$test" ]; then
67-
TOTAL=$((TOTAL + 1))
68-
TEST_NAME=$(basename "$test" .sh)
69-
if $test > /dev/null 2>&1; then
70-
echo "| $TEST_NAME | ✅ PASS |" >> $GITHUB_STEP_SUMMARY
71-
PASSED=$((PASSED + 1))
72-
else
73-
echo "| $TEST_NAME | ❌ FAIL |" >> $GITHUB_STEP_SUMMARY
74-
fi
75-
fi
76-
done
77-
78-
COVERAGE=$((PASSED * 100 / TOTAL))
79-
echo "" >> $GITHUB_STEP_SUMMARY
80-
echo "**Coverage:** $PASSED/$TOTAL tests passed ($COVERAGE%)" >> $GITHUB_STEP_SUMMARY
81-
82-
# Create coverage badge data
83-
mkdir -p .coverage
84-
echo "$COVERAGE" > .coverage/percentage.txt
85-
86-
- name: Upload coverage data
87-
if: always() && matrix.os == 'ubuntu-latest'
8845
uses: actions/upload-artifact@v4
8946
with:
90-
name: coverage-data
91-
path: .coverage/
92-
retention-days: 30
93-
94-
shellcheck:
95-
name: Shellcheck
96-
runs-on: ubuntu-latest
97-
98-
steps:
99-
- uses: actions/checkout@v4
100-
101-
- name: Run ShellCheck
102-
uses: ludeeus/action-shellcheck@master
103-
with:
104-
scandir: './test'
105-
severity: warning
106-
107-
status:
108-
name: Status Check
109-
runs-on: ubuntu-latest
110-
needs: [test, shellcheck]
111-
if: always()
112-
113-
steps:
114-
- name: Check test results
115-
run: |
116-
if [ "${{ needs.test.result }}" == "success" ] && [ "${{ needs.shellcheck.result }}" == "success" ]; then
117-
echo "✅ All checks passed"
118-
exit 0
119-
else
120-
echo "❌ Some checks failed"
121-
echo "Test: ${{ needs.test.result }}"
122-
echo "Shellcheck: ${{ needs.shellcheck.result }}"
123-
exit 1
124-
fi
47+
name: test-logs
48+
path: test/*.log
49+
retention-days: 7
50+
if-no-files-found: ignore

.gitignore

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
# internal, unless forced
2+
.*
13
# cross test harness artifacts
4+
testdir
25
.test*
3-
/test/results/
4-
/test/fixtures/workspaces/
5-
/test/fixtures/remotes/
6-
/test/rust/target/
7-
/tmp/
6+
*.log
7+
**/*.log
8+
9+
# allow
10+
!.github
11+
!.specify
12+
!.gitignore

AGENTS.md

Lines changed: 55 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,61 @@
2525

2626
## Commands
2727

28-
| Command | Purpose | Arguments |
29-
|---------|---------|-----------|
30-
| `use` | Add remote repository | `<name> <url>` |
31-
| `patch` | Vendor subdirectory | `<remote>:<path> <local> [branch]` |
32-
| `sync` | Update from upstream | None |
33-
| `list` | Show all patches | None |
34-
| `status` | Check patch status | None |
35-
| `diff-patch` | Compare local vs upstream | `[remote:path] [local]` (inferred) |
36-
| `push-upstream` | Push changes upstream | `[remote:path] [local]` (inferred) |
37-
| `replay` | Restore from Crossfile | None |
28+
All commands are accessible via `just cross <command>` or `./cross <command>` wrapper:
29+
30+
### Core Workflow
31+
- **`use <name> <url>`** - Add a remote repository with branch auto-detection
32+
- Auto-detects default branch (main/master) via `git ls-remote --symref`
33+
- Fetches detected branch automatically
34+
- Records in Crossfile
35+
36+
- **`patch <remote:path[:branch]> <local_path> [branch]`** - Vendor a directory from remote
37+
- Supports `remote:path:branch` syntax (branch in spec)
38+
- Alternative: `remote:path local_path branch` (branch as 3rd arg)
39+
- Creates worktree with sparse checkout
40+
- Syncs to local path with rsync
41+
- Creates intermediate directories automatically (`mkdir -p`)
42+
- Updates Crossfile only on success (idempotency)
43+
44+
- **`sync`** - Update all patches from upstream
45+
- Updates all worktrees via git pull --rebase
46+
- Checks for uncommitted changes in local paths
47+
- Prompts before overwriting local modifications
48+
- Executes `cross exec` commands from Crossfile
49+
50+
- **`replay`** - Re-execute all Crossfile commands
51+
- Processes each line sequentially
52+
- Supports `cross` prefix and legacy format
53+
- Skips comments and empty lines
54+
55+
### Inspection
56+
- **`list`** - Show all configured patches in table format
57+
- **`status`** - Show patch status (diffs, upstream sync, conflicts)
58+
- **`diff [remote:path] [local_path]`** - Compare local vs upstream
59+
- Auto-infers from current directory if in tracked path
60+
61+
### Contribution
62+
- **`push [remote:path] [local_path]`** - Push changes back to upstream
63+
- Syncs local to worktree
64+
- Shows git status
65+
- Interactive: Run (commit+push), Manual (subshell), Cancel
66+
- Auto-infers from current directory if in tracked path
67+
68+
### Automation
69+
- **`exec <command>`** - Execute arbitrary shell commands
70+
- Used for post-hooks in Crossfile
71+
- Can call user's Justfile recipes
72+
- Example: `cross exec just posthook`
73+
74+
### Utilities
75+
- **`help`** - Show usage and available commands
76+
- **`check-deps`** - Verify required dependencies (fish, rsync, git, python3, jq, yq)
77+
- **`setup`** - Auto-setup environment (direnv)
78+
79+
### Internal Helpers
80+
- **`_resolve_context`** - Infer remote:path and local_path from CWD
81+
- **`_sync_from_crossfile`** - Process Crossfile for sync operations
82+
- **`update_crossfile`** - Append command to Crossfile (deduplicated)
3883

3984
## Testing
4085

0 commit comments

Comments
 (0)