trissue 0.1.0 → 0.2.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.
- package/README.md +18 -4
- package/dist/cli-g9sxmkeh.js +168 -0
- package/dist/cli.js +7 -2676
- package/dist/run-0f63mpr8.js +2474 -0
- package/package.json +8 -16
package/README.md
CHANGED
|
@@ -4,9 +4,22 @@ Have the coding agent already on your computer find the source of an issue and
|
|
|
4
4
|
write it up, then file it, copy it, or send it wherever the project wants.
|
|
5
5
|
|
|
6
6
|
```sh
|
|
7
|
-
|
|
7
|
+
npx trissue MileniumHQ/Paperboard
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
+
It runs on Node 20 or newer, or Bun, so use whichever runner you already have:
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npx trissue MileniumHQ/Paperboard # npm
|
|
14
|
+
pnpm dlx trissue MileniumHQ/Paperboard # pnpm
|
|
15
|
+
yarn dlx trissue MileniumHQ/Paperboard # Yarn 2 or newer
|
|
16
|
+
bunx trissue MileniumHQ/Paperboard # Bun
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Yarn 4.18 and newer hold back packages for a day after they're published. If
|
|
20
|
+
`yarn dlx` says a version is quarantined, use another runner or try again the
|
|
21
|
+
next day.
|
|
22
|
+
|
|
10
23
|
1. trissue downloads the repo and warns you before anything else: an agent is
|
|
11
24
|
about to read it, so you should trust it.
|
|
12
25
|
2. You explain the issue.
|
|
@@ -125,7 +138,7 @@ into rows. trissue-embedded runs on Node 20+, Bun and Electron.
|
|
|
125
138
|
|
|
126
139
|
| Package | What it is |
|
|
127
140
|
|---|---|
|
|
128
|
-
| [`trissue`](packages/cli) | The command and its terminal interface.
|
|
141
|
+
| [`trissue`](packages/cli) | The command and its terminal interface. Runs on Node 20+ or Bun. |
|
|
129
142
|
| [`trissue-embedded`](packages/embedded) | The engine: agents, config, prompts, sending. No interface. |
|
|
130
143
|
|
|
131
144
|
## Development
|
|
@@ -138,8 +151,9 @@ bun run screenshots # renders every screen to screenshots/
|
|
|
138
151
|
bun run typecheck
|
|
139
152
|
```
|
|
140
153
|
|
|
141
|
-
The interface is built with [
|
|
142
|
-
|
|
154
|
+
The interface is built with [Ink](https://github.com/vadimdemedes/ink) and
|
|
155
|
+
React, in plain JavaScript, so it runs anywhere Node 20+ or Bun does. Building
|
|
156
|
+
and the screenshots use Bun.
|
|
143
157
|
|
|
144
158
|
## License
|
|
145
159
|
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/cli.ts
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
5
|
+
import { parseArgs } from "node:util";
|
|
6
|
+
import { buildLink, copyIssue, detectHarnesses, fileGitHubIssue, formatIssue, openUrl, resolveSource, runTriage } from "trissue-embedded";
|
|
7
|
+
|
|
8
|
+
// src/version.ts
|
|
9
|
+
var VERSION = "0.2.0";
|
|
10
|
+
|
|
11
|
+
// src/cli.ts
|
|
12
|
+
var HELP = `trissue: have a coding agent find the source of an issue and write it up.
|
|
13
|
+
|
|
14
|
+
Usage
|
|
15
|
+
trissue [repo] [options]
|
|
16
|
+
|
|
17
|
+
repo owner/repo (GitHub), a clone URL, or a folder. Defaults to this folder.
|
|
18
|
+
|
|
19
|
+
Options
|
|
20
|
+
--ref <ref> Branch, tag or commit to download
|
|
21
|
+
--background <hex> Background color of the interface
|
|
22
|
+
--list-agents List the coding agents installed on this computer
|
|
23
|
+
-h, --help Show this help
|
|
24
|
+
-v, --version Show the version
|
|
25
|
+
|
|
26
|
+
Without the interface (all set from arguments)
|
|
27
|
+
--issue <text> What's wrong. "-" reads it from stdin
|
|
28
|
+
--agent <id> Agent to use, like claude or codex. Defaults to the first installed
|
|
29
|
+
--model <id> Model to use. Defaults to the agent's default
|
|
30
|
+
--send <how> print (default), json, copy, github, or link:<label>
|
|
31
|
+
--yes Required with --send github: confirms filing a public issue
|
|
32
|
+
`;
|
|
33
|
+
function fail(message) {
|
|
34
|
+
process.stderr.write(`trissue: ${message}
|
|
35
|
+
`);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
var { values, positionals } = parseArgs({
|
|
39
|
+
allowPositionals: true,
|
|
40
|
+
options: {
|
|
41
|
+
ref: { type: "string" },
|
|
42
|
+
background: { type: "string" },
|
|
43
|
+
"list-agents": { type: "boolean" },
|
|
44
|
+
issue: { type: "string" },
|
|
45
|
+
agent: { type: "string" },
|
|
46
|
+
model: { type: "string" },
|
|
47
|
+
send: { type: "string" },
|
|
48
|
+
yes: { type: "boolean" },
|
|
49
|
+
help: { type: "boolean", short: "h" },
|
|
50
|
+
version: { type: "boolean", short: "v" }
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
if (values.help) {
|
|
54
|
+
process.stdout.write(HELP);
|
|
55
|
+
process.exit(0);
|
|
56
|
+
}
|
|
57
|
+
if (values.version) {
|
|
58
|
+
process.stdout.write(`${VERSION}
|
|
59
|
+
`);
|
|
60
|
+
process.exit(0);
|
|
61
|
+
}
|
|
62
|
+
if (values.background && !/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(values.background))
|
|
63
|
+
fail("--background must be a hex color like #101010.");
|
|
64
|
+
if (positionals.length > 1)
|
|
65
|
+
fail("Give one repo at most.");
|
|
66
|
+
if (values["list-agents"]) {
|
|
67
|
+
const harnesses = detectHarnesses();
|
|
68
|
+
if (!harnesses.length)
|
|
69
|
+
fail("No coding agents are installed.");
|
|
70
|
+
for (const harness of harnesses)
|
|
71
|
+
process.stdout.write(`${harness.id.padEnd(16)} ${harness.name.padEnd(20)} ${harness.executable}
|
|
72
|
+
`);
|
|
73
|
+
process.exit(0);
|
|
74
|
+
}
|
|
75
|
+
var repo = positionals[0];
|
|
76
|
+
if (values.issue !== undefined) {
|
|
77
|
+
await headless();
|
|
78
|
+
} else {
|
|
79
|
+
if (values.agent || values.model || values.send || values.yes)
|
|
80
|
+
fail("--agent, --model, --send and --yes need --issue.");
|
|
81
|
+
await interactive();
|
|
82
|
+
}
|
|
83
|
+
async function headless() {
|
|
84
|
+
const issueText = values.issue === "-" ? readFileSync(0, "utf8") : values.issue;
|
|
85
|
+
const send = values.send ?? "print";
|
|
86
|
+
if (!/^(print|json|copy|github|link:.+)$/.test(send))
|
|
87
|
+
fail(`--send must be print, json, copy, github, or link:<label>, not "${send}".`);
|
|
88
|
+
if (send === "github" && !values.yes)
|
|
89
|
+
fail("--send github posts a public issue. Add --yes to confirm.");
|
|
90
|
+
const controller = new AbortController;
|
|
91
|
+
process.once("SIGINT", () => controller.abort());
|
|
92
|
+
let result;
|
|
93
|
+
try {
|
|
94
|
+
result = await runTriage({
|
|
95
|
+
issue: issueText,
|
|
96
|
+
repo,
|
|
97
|
+
ref: values.ref,
|
|
98
|
+
harness: values.agent,
|
|
99
|
+
model: values.model,
|
|
100
|
+
signal: controller.signal,
|
|
101
|
+
onEvent: (event) => {
|
|
102
|
+
if (event.type === "tool") {
|
|
103
|
+
if (event.title && event.status !== "completed")
|
|
104
|
+
process.stderr.write(`› ${event.title}
|
|
105
|
+
`);
|
|
106
|
+
} else if (event.type === "blocked")
|
|
107
|
+
process.stderr.write(`⊘ Blocked ${event.title}
|
|
108
|
+
`);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
} catch (error) {
|
|
112
|
+
fail(error.message);
|
|
113
|
+
}
|
|
114
|
+
try {
|
|
115
|
+
const { issue, config, source } = result;
|
|
116
|
+
if (send === "print")
|
|
117
|
+
process.stdout.write(`${formatIssue(issue)}
|
|
118
|
+
`);
|
|
119
|
+
else if (send === "json")
|
|
120
|
+
process.stdout.write(`${JSON.stringify(issue, null, 2)}
|
|
121
|
+
`);
|
|
122
|
+
else if (send === "copy") {
|
|
123
|
+
await copyIssue(issue);
|
|
124
|
+
process.stderr.write(`Copied the issue.
|
|
125
|
+
`);
|
|
126
|
+
} else if (send === "github") {
|
|
127
|
+
const target = config?.github === false ? null : config?.github ?? source.github;
|
|
128
|
+
if (!target)
|
|
129
|
+
fail("This repo has no GitHub repository to file on.");
|
|
130
|
+
process.stdout.write(`${await fileGitHubIssue(target, issue, config?.labels ?? [])}
|
|
131
|
+
`);
|
|
132
|
+
} else {
|
|
133
|
+
const label = send.slice("link:".length);
|
|
134
|
+
const link = config?.links?.find((candidate) => candidate.label.toLowerCase() === label.toLowerCase());
|
|
135
|
+
if (!link)
|
|
136
|
+
fail(`This repo has no link called "${label}".`);
|
|
137
|
+
const url = buildLink(link, issue);
|
|
138
|
+
await openUrl(url);
|
|
139
|
+
process.stdout.write(`${url}
|
|
140
|
+
`);
|
|
141
|
+
}
|
|
142
|
+
} finally {
|
|
143
|
+
await result.source.dispose();
|
|
144
|
+
}
|
|
145
|
+
process.exit(0);
|
|
146
|
+
}
|
|
147
|
+
async function interactive() {
|
|
148
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY)
|
|
149
|
+
fail("The interface needs a terminal. Use --issue to run without it.");
|
|
150
|
+
let source;
|
|
151
|
+
try {
|
|
152
|
+
source = await resolveSource(repo, values.ref);
|
|
153
|
+
} catch (error) {
|
|
154
|
+
fail(error.message);
|
|
155
|
+
}
|
|
156
|
+
const saved = ["CI", "CONTINUOUS_INTEGRATION"].map((name) => [name, process.env[name]]);
|
|
157
|
+
for (const [name] of saved)
|
|
158
|
+
delete process.env[name];
|
|
159
|
+
let runInterface;
|
|
160
|
+
try {
|
|
161
|
+
({ runInterface } = await import("./run-0f63mpr8.js"));
|
|
162
|
+
} finally {
|
|
163
|
+
for (const [name, value] of saved)
|
|
164
|
+
if (value !== undefined)
|
|
165
|
+
process.env[name] = value;
|
|
166
|
+
}
|
|
167
|
+
await runInterface({ source, harnesses: detectHarnesses(), background: values.background });
|
|
168
|
+
}
|