@cod3vil/trunk 0.1.1

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.
Files changed (81) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cli.d.ts +2 -0
  3. package/dist/cli.js +69 -0
  4. package/dist/commands/clone.d.ts +6 -0
  5. package/dist/commands/clone.js +114 -0
  6. package/dist/commands/init.d.ts +6 -0
  7. package/dist/commands/init.js +235 -0
  8. package/dist/commands/new.d.ts +6 -0
  9. package/dist/commands/new.js +357 -0
  10. package/dist/core/adopt.d.ts +14 -0
  11. package/dist/core/adopt.js +157 -0
  12. package/dist/core/agents.d.ts +30 -0
  13. package/dist/core/agents.js +31 -0
  14. package/dist/core/arguments.d.ts +92 -0
  15. package/dist/core/arguments.js +93 -0
  16. package/dist/core/detect.d.ts +28 -0
  17. package/dist/core/detect.js +169 -0
  18. package/dist/core/diff.d.ts +37 -0
  19. package/dist/core/diff.js +140 -0
  20. package/dist/core/env.d.ts +63 -0
  21. package/dist/core/env.js +140 -0
  22. package/dist/core/generate/aliases.d.ts +7 -0
  23. package/dist/core/generate/aliases.js +45 -0
  24. package/dist/core/generate/header.d.ts +2 -0
  25. package/dist/core/generate/header.js +81 -0
  26. package/dist/core/generate/index.d.ts +8 -0
  27. package/dist/core/generate/index.js +74 -0
  28. package/dist/core/generate/proxy.d.ts +8 -0
  29. package/dist/core/generate/proxy.js +56 -0
  30. package/dist/core/generate/steps.d.ts +7 -0
  31. package/dist/core/generate/steps.js +88 -0
  32. package/dist/core/generate/tmux.d.ts +4 -0
  33. package/dist/core/generate/tmux.js +98 -0
  34. package/dist/core/generate/toml.d.ts +16 -0
  35. package/dist/core/generate/toml.js +68 -0
  36. package/dist/core/gh.d.ts +60 -0
  37. package/dist/core/gh.js +101 -0
  38. package/dist/core/git.d.ts +79 -0
  39. package/dist/core/git.js +211 -0
  40. package/dist/core/journal.d.ts +54 -0
  41. package/dist/core/journal.js +147 -0
  42. package/dist/core/log.d.ts +8 -0
  43. package/dist/core/log.js +38 -0
  44. package/dist/core/pipeline.d.ts +119 -0
  45. package/dist/core/pipeline.js +473 -0
  46. package/dist/core/platform.d.ts +10 -0
  47. package/dist/core/platform.js +26 -0
  48. package/dist/core/prefix.d.ts +25 -0
  49. package/dist/core/prefix.js +59 -0
  50. package/dist/core/process.d.ts +27 -0
  51. package/dist/core/process.js +43 -0
  52. package/dist/core/repo.d.ts +79 -0
  53. package/dist/core/repo.js +294 -0
  54. package/dist/core/resolve.d.ts +127 -0
  55. package/dist/core/resolve.js +488 -0
  56. package/dist/core/result.d.ts +27 -0
  57. package/dist/core/result.js +32 -0
  58. package/dist/core/settings.d.ts +51 -0
  59. package/dist/core/settings.js +83 -0
  60. package/dist/core/tmuxRename.d.ts +36 -0
  61. package/dist/core/tmuxRename.js +79 -0
  62. package/dist/core/validate.d.ts +22 -0
  63. package/dist/core/validate.js +111 -0
  64. package/dist/core/version.d.ts +2 -0
  65. package/dist/core/version.js +35 -0
  66. package/dist/core/words.d.ts +16 -0
  67. package/dist/core/words.js +198 -0
  68. package/dist/core/wt.d.ts +41 -0
  69. package/dist/core/wt.js +59 -0
  70. package/dist/ui/SetupForm.d.ts +55 -0
  71. package/dist/ui/SetupForm.js +354 -0
  72. package/dist/ui/Summary.d.ts +15 -0
  73. package/dist/ui/Summary.js +74 -0
  74. package/dist/ui/fields/MultiSelect.d.ts +17 -0
  75. package/dist/ui/fields/MultiSelect.js +66 -0
  76. package/dist/ui/fields/Select.d.ts +17 -0
  77. package/dist/ui/fields/Select.js +37 -0
  78. package/dist/ui/fields/TextInput.d.ts +13 -0
  79. package/dist/ui/fields/TextInput.js +50 -0
  80. package/package.json +76 -0
  81. package/readme.md +147 -0
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "@cod3vil/trunk",
3
+ "version": "0.1.1",
4
+ "description": "Generate shared Worktrunk automation for a Git repository.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/theCodeD3vil/trunk.git"
8
+ },
9
+ "homepage": "https://github.com/theCodeD3vil/trunk#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/theCodeD3vil/trunk/issues"
12
+ },
13
+ "keywords": [
14
+ "worktrunk",
15
+ "git-worktree",
16
+ "tmux",
17
+ "caddy",
18
+ "cli"
19
+ ],
20
+ "license": "MIT",
21
+ "packageManager": "bun@1.4.0",
22
+ "bin": {
23
+ "trunk": "dist/cli.js"
24
+ },
25
+ "type": "module",
26
+ "engines": {
27
+ "node": ">=20"
28
+ },
29
+ "scripts": {
30
+ "build": "rm -rf dist && tsc",
31
+ "dev": "tsc --watch",
32
+ "test": "prettier --check . && xo && bun test",
33
+ "prepack": "bun run build",
34
+ "release": "np"
35
+ },
36
+ "files": [
37
+ "dist"
38
+ ],
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "dependencies": {
43
+ "@iarna/toml": "^2.2.5",
44
+ "ink": "^4.1.0",
45
+ "meow": "^11.0.0",
46
+ "react": "^18.2.0"
47
+ },
48
+ "devDependencies": {
49
+ "@sindresorhus/tsconfig": "^3.0.1",
50
+ "@types/bun": "^1.4.2",
51
+ "@types/iarna__toml": "^2.0.5",
52
+ "@types/node": "^20.0.0",
53
+ "@types/react": "^18.0.32",
54
+ "@vdemedes/prettier-config": "^2.0.1",
55
+ "eslint-config-xo-react": "^0.27.0",
56
+ "eslint-plugin-react": "^7.32.2",
57
+ "eslint-plugin-react-hooks": "^4.6.0",
58
+ "ink-testing-library": "^4.0.0",
59
+ "np": "^12.1.1",
60
+ "prettier": "^2.8.7",
61
+ "typescript": "^5.0.3",
62
+ "xo": "^0.60.0"
63
+ },
64
+ "xo": {
65
+ "extends": "xo-react",
66
+ "prettier": true,
67
+ "rules": {
68
+ "react/prop-types": "off"
69
+ }
70
+ },
71
+ "prettier": "@vdemedes/prettier-config",
72
+ "np": {
73
+ "branch": "main",
74
+ "releaseDraft": true
75
+ }
76
+ }
package/readme.md ADDED
@@ -0,0 +1,147 @@
1
+ # trunk
2
+
3
+ `trunk` creates a shared [Worktrunk](https://worktrunk.dev) configuration for a Git repository. It detects the package manager and development script, generates worktree hooks for dependencies and a development server, and can add optional tmux workspaces and Caddy routes. The generated `.config/wt.toml` is committed with the project so every contributor gets the same workflow.
4
+
5
+ `trunk` is a setup tool, not a worktree manager. It does not write global Worktrunk configuration and does not manage the project after setup; use `wt` and edit the generated file directly from then on.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm install --global @cod3vil/trunk
11
+ ```
12
+
13
+ or:
14
+
15
+ ```sh
16
+ bun add --global @cod3vil/trunk
17
+ ```
18
+
19
+ The installed command is `trunk`. That name is also used by the Rust/Wasm `trunk` tool and by Trunk.io, so check `command -v trunk` if one of those is already installed.
20
+
21
+ ## Prerequisites
22
+
23
+ | Tool | Requirement |
24
+ | ------------------------------------------------- | ----------------------------------------------------- |
25
+ | Node.js | 20 or newer |
26
+ | Git | Required |
27
+ | Worktrunk (`wt`) | Required; generated templates are tested with v0.77.0 |
28
+ | tmux | Optional; creates one workspace per worktree |
29
+ | Caddy and curl | Optional; creates a stable local URL per worktree |
30
+ | GitHub CLI (`gh`) | Optional; creates repositories and pull requests |
31
+ | claude, codex, opencode, copilot, antigravity, pi | Optional; started in tmux when selected |
32
+
33
+ macOS and Linux are supported, including Linux under WSL. Native Windows is not supported.
34
+
35
+ ## Repository Layout
36
+
37
+ Worktrunk uses a bare repository with sibling worktrees. Before using `trunk`, understand that the project directory itself is not a checked-out branch:
38
+
39
+ ```text
40
+ storefront/
41
+ .git/ bare repository and shared Git data
42
+ main/ default-branch worktree
43
+ chore-trunk-setup/ temporary setup worktree, when needed
44
+ feature-checkout/ another worktree created by wt
45
+ ```
46
+
47
+ Run project commands inside a worktree such as `storefront/main`, not in `storefront`. `trunk clone` and `trunk new` create this layout. `trunk init` adopts an existing bare-layout project and deliberately refuses to rewrite an ordinary clone in place.
48
+
49
+ ## Commands
50
+
51
+ ### Clone
52
+
53
+ Clone an existing remote into the bare layout and commit the generated configuration on `chore/trunk-setup`:
54
+
55
+ ```sh
56
+ trunk clone git@github.com:acme/storefront.git ~/Projects/storefront
57
+ ```
58
+
59
+ ### Init
60
+
61
+ Set up an existing bare-layout project, whether it was cloned by hand or already uses Worktrunk:
62
+
63
+ ```sh
64
+ trunk init ~/Projects/storefront
65
+ ```
66
+
67
+ ### New
68
+
69
+ Create a new bare-layout project and, optionally, its GitHub repository:
70
+
71
+ ```sh
72
+ trunk new api-service ~/Projects/api-service --remote --owner acme
73
+ ```
74
+
75
+ For a fully local project:
76
+
77
+ ```sh
78
+ trunk new scratch-app --no-remote --yes
79
+ ```
80
+
81
+ ## Options
82
+
83
+ | Option | Effect |
84
+ | -------------------------- | ----------------------------------------------------------------------------------------------- |
85
+ | `--yes` | Accept detected defaults without opening the form; required without a TTY |
86
+ | `--prefix <name>` | Set the tmux session prefix |
87
+ | `--pm <npm\|pnpm\|bun>` | Set the package manager |
88
+ | `--agents <a,b>` | Select up to four agents from `claude`, `codex`, `opencode`, `copilot`, `antigravity`, and `pi` |
89
+ | `--server` / `--no-server` | Enable or disable the development-server step |
90
+ | `--caddy` / `--no-caddy` | Enable or disable the Caddy route |
91
+ | `--tmux` / `--no-tmux` | Enable or disable tmux session hooks |
92
+ | `--copy` / `--no-copy` | Enable or disable `wt step copy-ignored` |
93
+ | `--mc` / `--no-mc` | Enable or disable the `wt mc` merge alias |
94
+ | `--direct` | Commit on the current branch instead of `chore/trunk-setup` |
95
+ | `--remote` / `--no-remote` | With `trunk new`, create or skip the GitHub repository |
96
+ | `--owner <name>` | With `trunk new`, choose the GitHub user or organization |
97
+ | `--public` | With `trunk new`, create a public repository instead of a private one |
98
+
99
+ Run `trunk --help` for the same command surface in the terminal.
100
+
101
+ ## What It Generates
102
+
103
+ The generated `.config/wt.toml` can contain:
104
+
105
+ - `wt up`, `wt url`, and `wt mc` aliases;
106
+ - pre-start hooks for tmux and the local URL;
107
+ - post-start hooks for copied ignored files, dependency installation, the development server, and Caddy;
108
+ - pre-remove cleanup for tmux processes and Caddy routes;
109
+ - a stable URL shown by `wt list`.
110
+
111
+ The file is normal project configuration, not generated code that must remain untouched. Review and edit it for the repository's real commands. See the [annotated generated configuration](https://github.com/theCodeD3vil/trunk/blob/main/docs/generated-config.md) for the complete lifecycle and the reasons behind the less obvious template expressions.
112
+
113
+ Worktrunk treats project hooks as trusted code. Run `wt config approvals add` after reviewing a new file, and run it again whenever `.config/wt.toml` changes.
114
+
115
+ ## Development
116
+
117
+ ```sh
118
+ bun install --frozen-lockfile
119
+ bun run build
120
+ bun run test
121
+ ```
122
+
123
+ `bun run build` creates a clean `dist/` and stamps the package version into the compiled CLI. The published package runs on Node.js; the test suite and CI exercise that runtime explicitly.
124
+
125
+ ## Releasing
126
+
127
+ Releases are published by hand, never by CI, so the npm credentials stay on one machine:
128
+
129
+ ```sh
130
+ git checkout main && git pull
131
+ bun run release # or: bun run release minor
132
+ ```
133
+
134
+ That runs [`np`](https://github.com/sindresorhus/np), which verifies the branch and working
135
+ tree, reinstalls from `bun.lock`, runs the tests, bumps the version, commits, tags, pushes,
136
+ publishes, and opens a GitHub release draft. `bun run release -- --dry-run` shows every step
137
+ without performing any of them.
138
+
139
+ Releases happen on `main` because that is the published history. `np` tags the commit it
140
+ creates, and a tag only means something if that commit is reachable from `main` — squashing
141
+ or rebasing a release made on a side branch leaves the tag pointing at history that never
142
+ shipped. After releasing, merge `main` back into the working branch to pick up the version
143
+ bump.
144
+
145
+ ## License
146
+
147
+ MIT