@lesscap/baton-cli 0.2.8 → 0.2.9
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/LICENSE +21 -0
- package/dist/baton.mjs +10 -77
- package/package.json +11 -12
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 bencode
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/baton.mjs
CHANGED
|
@@ -799,12 +799,6 @@ var parseWorkerHandle = (handle) => {
|
|
|
799
799
|
const m = handle.trim().match(/^(?:[wW]-)?(\d+)$/);
|
|
800
800
|
return m ? Number(m[1]) : null;
|
|
801
801
|
};
|
|
802
|
-
var parseIssueUrl = (url) => {
|
|
803
|
-
const m = url.match(/^https:\/\/github\.com\/[^/]+\/[^/]+\/issues\/(\d+)/);
|
|
804
|
-
if (!m)
|
|
805
|
-
throw new Error(`expected a GitHub issue url (https://github.com/o/r/issues/N), got "${url}"`);
|
|
806
|
-
return { source: "github", number: Number(m[1]), url: url.split(/[?#]/)[0] };
|
|
807
|
-
};
|
|
808
802
|
var splitCsv = (s) => s ? s.split(",").map((x) => x.trim()).filter(Boolean) : void 0;
|
|
809
803
|
|
|
810
804
|
// src/commands/init.ts
|
|
@@ -980,7 +974,6 @@ var requirement = defineCommand({
|
|
|
980
974
|
project: { type: "string", description: "project id (overrides .baton.json)" },
|
|
981
975
|
desc: { type: "string", description: "description" },
|
|
982
976
|
body: { type: "string", description: "requirement body (markdown)" },
|
|
983
|
-
github: { type: "string", description: "link a GitHub issue url (light association)" },
|
|
984
977
|
...common
|
|
985
978
|
},
|
|
986
979
|
run: async ({ args }) => {
|
|
@@ -991,8 +984,7 @@ var requirement = defineCommand({
|
|
|
991
984
|
projectId: resolveProjectId(args),
|
|
992
985
|
title: args.title,
|
|
993
986
|
description: args.desc,
|
|
994
|
-
body: args.body
|
|
995
|
-
external: args.github ? parseIssueUrl(args.github) : void 0
|
|
987
|
+
body: args.body
|
|
996
988
|
},
|
|
997
989
|
Boolean(args.json)
|
|
998
990
|
)
|
|
@@ -1019,41 +1011,6 @@ var requirement = defineCommand({
|
|
|
1019
1011
|
console.log(await updateRequirement(c, id, patch2, Boolean(args.json)));
|
|
1020
1012
|
}
|
|
1021
1013
|
}),
|
|
1022
|
-
link: defineCommand({
|
|
1023
|
-
meta: { name: "link", description: "link a requirement to a GitHub issue url" },
|
|
1024
|
-
args: {
|
|
1025
|
-
code: { type: "positional", required: true, description: "requirement code (R-N)" },
|
|
1026
|
-
// Named `issue` (not `url`) — `url` would collide with the common --url flag.
|
|
1027
|
-
issue: { type: "positional", required: true, description: "GitHub issue url" },
|
|
1028
|
-
project: { type: "string", description: "project id (overrides .baton.json)" },
|
|
1029
|
-
...common
|
|
1030
|
-
},
|
|
1031
|
-
run: async ({ args }) => {
|
|
1032
|
-
const c = clientFor(args);
|
|
1033
|
-
const id = await resolveByCode(c, resolveProjectId(args), args.code);
|
|
1034
|
-
console.log(
|
|
1035
|
-
await updateRequirement(
|
|
1036
|
-
c,
|
|
1037
|
-
id,
|
|
1038
|
-
{ external: parseIssueUrl(args.issue) },
|
|
1039
|
-
Boolean(args.json)
|
|
1040
|
-
)
|
|
1041
|
-
);
|
|
1042
|
-
}
|
|
1043
|
-
}),
|
|
1044
|
-
unlink: defineCommand({
|
|
1045
|
-
meta: { name: "unlink", description: "clear a requirement\u2019s GitHub issue association" },
|
|
1046
|
-
args: {
|
|
1047
|
-
code: { type: "positional", required: true, description: "requirement code (R-N)" },
|
|
1048
|
-
project: { type: "string", description: "project id (overrides .baton.json)" },
|
|
1049
|
-
...common
|
|
1050
|
-
},
|
|
1051
|
-
run: async ({ args }) => {
|
|
1052
|
-
const c = clientFor(args);
|
|
1053
|
-
const id = await resolveByCode(c, resolveProjectId(args), args.code);
|
|
1054
|
-
console.log(await updateRequirement(c, id, { external: null }, Boolean(args.json)));
|
|
1055
|
-
}
|
|
1056
|
-
}),
|
|
1057
1014
|
ls: defineCommand({
|
|
1058
1015
|
meta: { name: "ls", description: "list requirements in a project" },
|
|
1059
1016
|
args: {
|
|
@@ -2338,7 +2295,6 @@ var task = defineCommand({
|
|
|
2338
2295
|
project: { type: "string", description: "project id (overrides .baton.json)" },
|
|
2339
2296
|
body: { type: "string", description: "task body (markdown)" },
|
|
2340
2297
|
deps: { type: "string", description: "comma-separated dependency task codes (T-N,T-N)" },
|
|
2341
|
-
github: { type: "string", description: "link a GitHub issue url (light association)" },
|
|
2342
2298
|
...common
|
|
2343
2299
|
},
|
|
2344
2300
|
run: async ({ args }) => {
|
|
@@ -2356,8 +2312,7 @@ var task = defineCommand({
|
|
|
2356
2312
|
requirementId,
|
|
2357
2313
|
title: args.title,
|
|
2358
2314
|
body: args.body,
|
|
2359
|
-
dependsOn: dependsOn.length ? dependsOn : void 0
|
|
2360
|
-
external: args.github ? parseIssueUrl(args.github) : void 0
|
|
2315
|
+
dependsOn: dependsOn.length ? dependsOn : void 0
|
|
2361
2316
|
},
|
|
2362
2317
|
Boolean(args.json)
|
|
2363
2318
|
)
|
|
@@ -2384,36 +2339,6 @@ var task = defineCommand({
|
|
|
2384
2339
|
console.log(await updateTask(c, id, patch2, Boolean(args.json)));
|
|
2385
2340
|
}
|
|
2386
2341
|
}),
|
|
2387
|
-
link: defineCommand({
|
|
2388
|
-
meta: { name: "link", description: "link a task to a GitHub issue url" },
|
|
2389
|
-
args: {
|
|
2390
|
-
code: { type: "positional", required: true, description: "task code (T-N)" },
|
|
2391
|
-
// Named `issue` (not `url`) — `url` would collide with the common --url flag.
|
|
2392
|
-
issue: { type: "positional", required: true, description: "GitHub issue url" },
|
|
2393
|
-
project: { type: "string", description: "project id (overrides .baton.json)" },
|
|
2394
|
-
...common
|
|
2395
|
-
},
|
|
2396
|
-
run: async ({ args }) => {
|
|
2397
|
-
const c = clientFor(args);
|
|
2398
|
-
const id = await resolveTaskByCode(c, resolveProjectId(args), args.code);
|
|
2399
|
-
console.log(
|
|
2400
|
-
await updateTask(c, id, { external: parseIssueUrl(args.issue) }, Boolean(args.json))
|
|
2401
|
-
);
|
|
2402
|
-
}
|
|
2403
|
-
}),
|
|
2404
|
-
unlink: defineCommand({
|
|
2405
|
-
meta: { name: "unlink", description: "clear a task\u2019s GitHub issue association" },
|
|
2406
|
-
args: {
|
|
2407
|
-
code: { type: "positional", required: true, description: "task code (T-N)" },
|
|
2408
|
-
project: { type: "string", description: "project id (overrides .baton.json)" },
|
|
2409
|
-
...common
|
|
2410
|
-
},
|
|
2411
|
-
run: async ({ args }) => {
|
|
2412
|
-
const c = clientFor(args);
|
|
2413
|
-
const id = await resolveTaskByCode(c, resolveProjectId(args), args.code);
|
|
2414
|
-
console.log(await updateTask(c, id, { external: null }, Boolean(args.json)));
|
|
2415
|
-
}
|
|
2416
|
-
}),
|
|
2417
2342
|
ls: defineCommand({
|
|
2418
2343
|
meta: { name: "ls", description: "list tasks in a requirement" },
|
|
2419
2344
|
args: {
|
|
@@ -2595,6 +2520,14 @@ import { dirname, isAbsolute as isAbsolute2, resolve } from "node:path";
|
|
|
2595
2520
|
var createWorktree = (input) => {
|
|
2596
2521
|
if (existsSync4(input.worktreePath))
|
|
2597
2522
|
throw new Error(`worktree path already exists: ${input.worktreePath}`);
|
|
2523
|
+
const head = spawnSync2("git", ["-C", input.repo, "rev-parse", "--verify", "-q", "HEAD"], {
|
|
2524
|
+
stdio: "pipe",
|
|
2525
|
+
encoding: "utf8"
|
|
2526
|
+
});
|
|
2527
|
+
if (head.status !== 0)
|
|
2528
|
+
throw new Error(
|
|
2529
|
+
`repo has no commits (unborn HEAD) \u2014 create an initial commit before starting sessions`
|
|
2530
|
+
);
|
|
2598
2531
|
mkdirSync(dirname(input.worktreePath), { recursive: true });
|
|
2599
2532
|
const branch = `baton/${input.sessionCode}`;
|
|
2600
2533
|
const r = spawnSync2(
|
package/package.json
CHANGED
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lesscap/baton-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "baton CLI — register/run a worker, manage projects/requirements/tasks/sessions",
|
|
7
7
|
"bin": {
|
|
8
|
-
"baton": "
|
|
8
|
+
"baton": "dist/baton.mjs"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist"
|
|
12
12
|
],
|
|
13
|
-
"scripts": {
|
|
14
|
-
"baton": "tsx src/index.ts",
|
|
15
|
-
"build": "esbuild src/index.ts --bundle --platform=node --format=esm --packages=bundle --external:@anthropic-ai/claude-agent-sdk --banner:js=\"#!/usr/bin/env node\" --outfile=dist/baton.mjs && chmod +x dist/baton.mjs",
|
|
16
|
-
"prepublishOnly": "pnpm build",
|
|
17
|
-
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
18
|
-
"test": "tsx --test 'src/**/*.test.ts'"
|
|
19
|
-
},
|
|
20
13
|
"devDependencies": {
|
|
21
|
-
"@baton/shared": "workspace:*",
|
|
22
14
|
"@types/node": "^25.9.1",
|
|
23
15
|
"citty": "^0.2.2",
|
|
24
16
|
"esbuild": "^0.28.0",
|
|
25
17
|
"eventsource": "^4.1.0",
|
|
26
18
|
"tsx": "^4.22.4",
|
|
27
|
-
"typescript": "^6.0.3"
|
|
19
|
+
"typescript": "^6.0.3",
|
|
20
|
+
"@baton/shared": "0.0.0"
|
|
28
21
|
},
|
|
29
22
|
"dependencies": {
|
|
30
23
|
"@anthropic-ai/claude-agent-sdk": "^0.3.161"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"baton": "tsx src/index.ts",
|
|
27
|
+
"build": "esbuild src/index.ts --bundle --platform=node --format=esm --packages=bundle --external:@anthropic-ai/claude-agent-sdk --banner:js=\"#!/usr/bin/env node\" --outfile=dist/baton.mjs && chmod +x dist/baton.mjs",
|
|
28
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
29
|
+
"test": "tsx --test 'src/**/*.test.ts'"
|
|
31
30
|
}
|
|
32
|
-
}
|
|
31
|
+
}
|