slopcannon 0.1.7 → 0.1.9
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.
- package/README.md +17 -8
- package/dist/cli.js +38 -11
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,13 +4,15 @@
|
|
|
4
4
|
<img src="images/hero.png" width="512" />
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
|
-
Create a git worktree. Launch Claude Code. Ship slop.
|
|
7
|
+
Create a git worktree. Launch Claude Code or Codex. Ship slop.
|
|
8
8
|
|
|
9
9
|
## What it does
|
|
10
10
|
|
|
11
11
|
```
|
|
12
12
|
git worktree add -b <branch> ../repo-branch origin/main
|
|
13
|
-
|
|
13
|
+
pick a launcher:
|
|
14
|
+
- claude --dangerously-skip-permissions
|
|
15
|
+
- codex --yolo
|
|
14
16
|
```
|
|
15
17
|
|
|
16
18
|
That's it. Run it in any git repo.
|
|
@@ -27,12 +29,19 @@ Add to `~/.zshrc` so your shell cds into the worktree:
|
|
|
27
29
|
|
|
28
30
|
```bash
|
|
29
31
|
slopcannon() {
|
|
30
|
-
local
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
local pathfile=$(mktemp /tmp/slopcannon.path.XXXXXX)
|
|
33
|
+
local launcherfile=$(mktemp /tmp/slopcannon.launcher.XXXXXX)
|
|
34
|
+
bunx slopcannon --path-file "$pathfile" --launcher-file "$launcherfile" "$@"
|
|
35
|
+
local p=$(cat "$pathfile" 2>/dev/null)
|
|
36
|
+
local launcher=$(cat "$launcherfile" 2>/dev/null)
|
|
37
|
+
rm -f "$pathfile" "$launcherfile"
|
|
34
38
|
if [[ -n "$p" ]] && [[ -d "$p" ]]; then
|
|
35
|
-
cd "$p"
|
|
39
|
+
cd "$p" || return
|
|
40
|
+
if [[ "$launcher" == "codex" ]]; then
|
|
41
|
+
codex --yolo
|
|
42
|
+
else
|
|
43
|
+
claude --dangerously-skip-permissions
|
|
44
|
+
fi
|
|
36
45
|
fi
|
|
37
46
|
}
|
|
38
47
|
```
|
|
@@ -41,4 +50,4 @@ slopcannon() {
|
|
|
41
50
|
|
|
42
51
|
- [bun](https://bun.sh)
|
|
43
52
|
- [git](https://git-scm.com)
|
|
44
|
-
- [claude CLI](https://docs.anthropic.com/en/docs/claude-code)
|
|
53
|
+
- [claude CLI](https://docs.anthropic.com/en/docs/claude-code) or `codex`
|
package/dist/cli.js
CHANGED
|
@@ -1735,7 +1735,7 @@ async function typewriterActivation() {
|
|
|
1735
1735
|
process.stdout.write(`
|
|
1736
1736
|
`);
|
|
1737
1737
|
}
|
|
1738
|
-
async function runTui() {
|
|
1738
|
+
async function runTui(deps) {
|
|
1739
1739
|
We("slopcannon");
|
|
1740
1740
|
let info;
|
|
1741
1741
|
try {
|
|
@@ -1763,6 +1763,25 @@ async function runTui() {
|
|
|
1763
1763
|
return null;
|
|
1764
1764
|
}
|
|
1765
1765
|
const baseBranch = baseBranchEntry;
|
|
1766
|
+
const launcherOptions = [
|
|
1767
|
+
deps.claude ? {
|
|
1768
|
+
value: "claude",
|
|
1769
|
+
label: "claude --dangerously-skip-permissions"
|
|
1770
|
+
} : null,
|
|
1771
|
+
deps.codex ? {
|
|
1772
|
+
value: "codex",
|
|
1773
|
+
label: "codex --yolo"
|
|
1774
|
+
} : null
|
|
1775
|
+
].filter((option) => Boolean(option));
|
|
1776
|
+
const launcher = await Je({
|
|
1777
|
+
message: "Launcher",
|
|
1778
|
+
options: launcherOptions,
|
|
1779
|
+
initialValue: deps.claude ? "claude" : "codex"
|
|
1780
|
+
});
|
|
1781
|
+
if (Ct(launcher)) {
|
|
1782
|
+
Le("Cancelled.");
|
|
1783
|
+
return null;
|
|
1784
|
+
}
|
|
1766
1785
|
const defaultName = randomBranchName();
|
|
1767
1786
|
const newBranch = await Ze({
|
|
1768
1787
|
message: "New branch name",
|
|
@@ -1827,7 +1846,10 @@ async function runTui() {
|
|
|
1827
1846
|
else if (style === "typewriter")
|
|
1828
1847
|
await typewriterActivation();
|
|
1829
1848
|
Le(worktreePath);
|
|
1830
|
-
return
|
|
1849
|
+
return {
|
|
1850
|
+
worktreePath,
|
|
1851
|
+
launcher
|
|
1852
|
+
};
|
|
1831
1853
|
}
|
|
1832
1854
|
|
|
1833
1855
|
// src/cleanup.ts
|
|
@@ -1965,7 +1987,7 @@ Then run: bunx slopcannon`);
|
|
|
1965
1987
|
process.exit(1);
|
|
1966
1988
|
}
|
|
1967
1989
|
var HELP = `
|
|
1968
|
-
slopcannon - Create a git worktree. Launch Claude Code. Ship slop.
|
|
1990
|
+
slopcannon - Create a git worktree. Launch Claude Code or Codex. Ship slop.
|
|
1969
1991
|
|
|
1970
1992
|
Usage:
|
|
1971
1993
|
slopcannon Interactive TUI
|
|
@@ -1976,7 +1998,7 @@ Usage:
|
|
|
1976
1998
|
|
|
1977
1999
|
What it does:
|
|
1978
2000
|
git worktree add -b <branch> ../repo-branch origin/main
|
|
1979
|
-
|
|
2001
|
+
then launches your selected CLI
|
|
1980
2002
|
`.trim();
|
|
1981
2003
|
function parseArgs() {
|
|
1982
2004
|
const args = process.argv.slice(2);
|
|
@@ -2004,6 +2026,7 @@ function checkDeps() {
|
|
|
2004
2026
|
return {
|
|
2005
2027
|
git: Bun.which("git"),
|
|
2006
2028
|
claude: Bun.which("claude"),
|
|
2029
|
+
codex: Bun.which("codex"),
|
|
2007
2030
|
gh: Bun.which("gh"),
|
|
2008
2031
|
bun: Bun.which("bun")
|
|
2009
2032
|
};
|
|
@@ -2036,23 +2059,27 @@ async function main() {
|
|
|
2036
2059
|
process.exit(0);
|
|
2037
2060
|
}
|
|
2038
2061
|
requireGit(deps);
|
|
2039
|
-
if (!deps.claude) {
|
|
2040
|
-
console.error(`Error: claude CLI is
|
|
2041
|
-
Install
|
|
2062
|
+
if (!deps.claude && !deps.codex) {
|
|
2063
|
+
console.error(`Error: neither claude nor codex CLI is installed.
|
|
2064
|
+
Install one of them before running slopcannon.`);
|
|
2042
2065
|
process.exit(1);
|
|
2043
2066
|
}
|
|
2044
2067
|
if (!deps.gh) {
|
|
2045
2068
|
console.warn("Warning: gh CLI not found. Remote detection may be limited.");
|
|
2046
2069
|
}
|
|
2047
|
-
const
|
|
2048
|
-
|
|
2070
|
+
const tuiResult = await runTui({
|
|
2071
|
+
claude: deps.claude,
|
|
2072
|
+
codex: deps.codex
|
|
2073
|
+
});
|
|
2074
|
+
if (!tuiResult) {
|
|
2049
2075
|
process.exit(0);
|
|
2050
2076
|
}
|
|
2077
|
+
const { worktreePath, launcher } = tuiResult;
|
|
2051
2078
|
if (args.pathFile) {
|
|
2052
2079
|
await Bun.write(args.pathFile, worktreePath);
|
|
2053
|
-
process.exit(0);
|
|
2054
2080
|
}
|
|
2055
|
-
const
|
|
2081
|
+
const launchCommand = launcher === "codex" ? ["codex", "--yolo"] : ["claude", "--dangerously-skip-permissions"];
|
|
2082
|
+
const proc = Bun.spawn(launchCommand, {
|
|
2056
2083
|
cwd: worktreePath,
|
|
2057
2084
|
stdin: "inherit",
|
|
2058
2085
|
stdout: "inherit",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "slopcannon",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Create a git worktree. Launch Claude Code. Ship slop.",
|
|
3
|
+
"version": "0.1.9",
|
|
4
|
+
"description": "Create a git worktree. Launch Claude Code or Codex. Ship slop.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"slopcannon": "dist/cli.js"
|