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.
@@ -26,8 +26,4 @@ jobs:
26
26
 
27
27
  - run: pnpm install --frozen-lockfile
28
28
  - run: pnpm run build
29
-
30
- - uses: JS-DevTools/npm-publish@v3
31
- with:
32
- token: ${{ secrets.NPM_TOKEN }}
33
- provenance: true
29
+ - run: npm publish
@@ -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.
@@ -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: "node18",
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.2";
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.2";
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.2",
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.mjs",
11
- "dev": "node build.mjs --watch",
12
- "prepare": "node build.mjs",
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
- "picocolors": "^1.0.0",
17
- "cli-table3": "^0.6.5"
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}`);