pf 0.0.2 → 0.0.4
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/.github/workflows/publish.yml +1 -5
- package/.husky/pre-push +1 -0
- package/README.md +57 -0
- package/{build.mjs → build.ts} +2 -2
- package/dist/index.js +1 -1
- package/index.ts +1 -1
- package/package.json +8 -6
- package/scripts/check-version.ts +20 -0
package/.husky/pre-push
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
node scripts/check-version.ts
|
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# pf
|
|
2
|
+
|
|
3
|
+
A humane utility for git worktrees.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npm i -g pf
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
pf <command> [options]
|
|
15
|
+
|
|
16
|
+
Commands:
|
|
17
|
+
new [name] Create a branch and worktree with the specified name (default: "pf-[hash]")
|
|
18
|
+
open <name> Open a worktree in a subshell
|
|
19
|
+
ls List all tracked worktrees
|
|
20
|
+
rm <name> Remove a worktree
|
|
21
|
+
|
|
22
|
+
Options:
|
|
23
|
+
--help, -h Show help
|
|
24
|
+
--version, -v Show version
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Why `pf`?
|
|
28
|
+
|
|
29
|
+
In agentic development, you often want to spin up isolated workspaces for specific tasks—without stashing or committing your current changes. pf makes this effortless.
|
|
30
|
+
|
|
31
|
+
Create a new worktree for a task:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
$ pf new add-login-button
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
This creates a branch and worktree, then drops you into a subshell. Open it in your editor or point an AI coding agent at it. Your changes are completely independent of any other work on your machine.
|
|
38
|
+
|
|
39
|
+
When you're done, push to GitHub and create a PR:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
$ git push -u origin add-login-button
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Or merge directly back into main:
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
$ git checkout main && git merge add-login-button
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Then just `exit` to pop out of the worktree and back to your main repo. Clean up when you're done:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
$ pf rm add-login-button
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Use `pf ls` to see your active worktrees, and `pf open <name>` to return to one later.
|
package/{build.mjs → build.ts}
RENAMED
|
@@ -2,11 +2,11 @@ import * as esbuild from "esbuild";
|
|
|
2
2
|
|
|
3
3
|
const watch = process.argv.includes("--watch");
|
|
4
4
|
|
|
5
|
-
const options = {
|
|
5
|
+
const options: esbuild.BuildOptions = {
|
|
6
6
|
entryPoints: ["index.ts"],
|
|
7
7
|
bundle: true,
|
|
8
8
|
platform: "node",
|
|
9
|
-
target: "
|
|
9
|
+
target: "node24",
|
|
10
10
|
format: "esm",
|
|
11
11
|
outfile: "dist/index.js",
|
|
12
12
|
banner: {
|
package/dist/index.js
CHANGED
|
@@ -2221,7 +2221,7 @@ function rmCommand(name, deleteBranchFlag = false) {
|
|
|
2221
2221
|
}
|
|
2222
2222
|
|
|
2223
2223
|
// index.ts
|
|
2224
|
-
var VERSION = "0.0.
|
|
2224
|
+
var VERSION = "0.0.4";
|
|
2225
2225
|
function printHelp() {
|
|
2226
2226
|
const dim2 = import_picocolors3.default.dim;
|
|
2227
2227
|
const cyan = import_picocolors3.default.cyan;
|
package/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { lsCommand } from "./commands/ls.js";
|
|
|
5
5
|
import { rmCommand } from "./commands/rm.js";
|
|
6
6
|
// import { completionCommand } from "./commands/completion.js";
|
|
7
7
|
|
|
8
|
-
const VERSION = "0.0.
|
|
8
|
+
const VERSION = "0.0.4";
|
|
9
9
|
|
|
10
10
|
function printHelp() {
|
|
11
11
|
const dim = pc.dim;
|
package/package.json
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pf",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "A humane utility for git worktrees",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"pf": "dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"build": "tsc && node build.
|
|
11
|
-
"
|
|
12
|
-
"
|
|
10
|
+
"build": "tsc && node build.ts",
|
|
11
|
+
"postbuild": "ln -sf $(pwd)/dist/index.js /usr/local/bin/pf-dev",
|
|
12
|
+
"dev": "node build.ts --watch",
|
|
13
|
+
"prepare": "husky && node build.ts",
|
|
13
14
|
"typecheck": "tsc"
|
|
14
15
|
},
|
|
15
16
|
"dependencies": {
|
|
16
|
-
"
|
|
17
|
-
"
|
|
17
|
+
"cli-table3": "^0.6.5",
|
|
18
|
+
"picocolors": "^1.0.0"
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|
|
20
21
|
"@types/node": "^22.0.0",
|
|
21
22
|
"esbuild": "^0.24.0",
|
|
23
|
+
"husky": "^9.1.7",
|
|
22
24
|
"typescript": "^5.7.0"
|
|
23
25
|
},
|
|
24
26
|
"engines": {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { readFileSync } from "fs";
|
|
2
|
+
|
|
3
|
+
const pkg = JSON.parse(readFileSync("package.json", "utf-8"));
|
|
4
|
+
const indexContent = readFileSync("index.ts", "utf-8");
|
|
5
|
+
|
|
6
|
+
const versionMatch = indexContent.match(/const VERSION = "([^"]+)"/);
|
|
7
|
+
if (!versionMatch) {
|
|
8
|
+
console.error("Could not find VERSION in index.ts");
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const indexVersion = versionMatch[1];
|
|
13
|
+
const pkgVersion = pkg.version;
|
|
14
|
+
|
|
15
|
+
if (indexVersion !== pkgVersion) {
|
|
16
|
+
console.error(`Version mismatch: index.ts has "${indexVersion}", package.json has "${pkgVersion}"`);
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
console.log(`Version check passed: ${pkgVersion}`);
|