@taprootio/trellis 0.1.0

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.
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env node
2
+ // Packaged Trellis CLI dispatcher.
3
+ //
4
+ // The subcommand wrappers keep their existing thin shape, while this file is the
5
+ // npm bin exposed by the `@taprootio/trellis` package. Run from an installed package, paths
6
+ // below are package-relative; target repos are still resolved by each subcommand
7
+ // from cwd / --target / --repo.
8
+
9
+ import { dirname, join } from "node:path";
10
+ import { fileURLToPath, pathToFileURL } from "node:url";
11
+
12
+ const here = dirname(fileURLToPath(import.meta.url));
13
+ const HELP = `trellis — file-based backlog toolkit
14
+
15
+ Usage:
16
+ trellis <command> [args]
17
+
18
+ Commands:
19
+ init scaffold Trellis into a repo
20
+ import import an existing backlog into a Trellis repo
21
+ generate validate and rewrite generated backlog artifacts
22
+ check validate and fail if generated artifacts are stale
23
+ history derive per-task history from git
24
+ mcp serve Trellis operations over MCP stdio
25
+ pr-title lint a PR title from PR_TITLE
26
+
27
+ Run "trellis <command> --help" for command-specific options.
28
+ `;
29
+
30
+ const COMMANDS = {
31
+ init: ["trellis-init.mjs"],
32
+ import: ["trellis-import.mjs"],
33
+ generate: ["backlog-readme.mjs"],
34
+ check: ["backlog-readme.mjs", "--check"],
35
+ history: ["trellis-history.mjs"],
36
+ mcp: ["trellis-mcp.mjs"],
37
+ "pr-title": ["pr-title-lint.mjs"],
38
+ };
39
+
40
+ const [cmd, ...args] = process.argv.slice(2);
41
+ if (!cmd || cmd === "-h" || cmd === "--help" || cmd === "help") {
42
+ process.stdout.write(HELP);
43
+ process.exit(0);
44
+ }
45
+
46
+ const spec = COMMANDS[cmd];
47
+ if (!spec) {
48
+ console.error(`Unknown command: ${cmd}\n`);
49
+ process.stdout.write(HELP);
50
+ process.exit(2);
51
+ }
52
+
53
+ const [script, ...prefixArgs] = spec;
54
+ const scriptPath = join(here, script);
55
+ process.argv = [process.argv[0], scriptPath, ...prefixArgs, ...args];
56
+
57
+ try {
58
+ await import(pathToFileURL(scriptPath).href);
59
+ } catch (e) {
60
+ console.error(`error: failed to run ${cmd}: ${e && e.message ? e.message : String(e)}`);
61
+ process.exit(1);
62
+ }