@staff0rd/assist 0.292.0 → 0.294.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/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.292.0",
9
+ version: "0.294.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -4639,49 +4639,6 @@ function createFallbackHandler(routes2, htmlHandler2, extra) {
4639
4639
  };
4640
4640
  }
4641
4641
 
4642
- // src/commands/backlog/web/applyCwdFromReq.ts
4643
- function applyCwdFromReq(req) {
4644
- const url = new URL(req.url ?? "/", "http://localhost");
4645
- setBacklogDir(url.searchParams.get("cwd") ?? void 0);
4646
- }
4647
-
4648
- // src/commands/backlog/web/parseItemBody.ts
4649
- function readBody(req) {
4650
- return new Promise((resolve16, reject) => {
4651
- let body = "";
4652
- req.on("data", (chunk) => {
4653
- body += chunk.toString();
4654
- });
4655
- req.on("end", () => resolve16(body));
4656
- req.on("error", reject);
4657
- });
4658
- }
4659
- async function parseItemBody(req) {
4660
- return JSON.parse(await readBody(req));
4661
- }
4662
- async function parseStatusBody(req) {
4663
- return JSON.parse(await readBody(req));
4664
- }
4665
- async function parseRewindBody(req) {
4666
- return JSON.parse(await readBody(req));
4667
- }
4668
-
4669
- // src/commands/backlog/web/createItem.ts
4670
- async function createItem(req, res) {
4671
- const body = await parseItemBody(req);
4672
- applyCwdFromReq(req);
4673
- const orm = await getBacklogOrm();
4674
- const newItem = {
4675
- type: body.type ?? "story",
4676
- name: body.name,
4677
- description: body.description,
4678
- acceptanceCriteria: body.acceptanceCriteria ?? [],
4679
- status: "todo"
4680
- };
4681
- const id = await insertItem(orm, newItem, getOrigin());
4682
- respondJson(res, 201, { id, ...newItem });
4683
- }
4684
-
4685
4642
  // src/commands/backlog/loadBacklogSummaries.ts
4686
4643
  import { eq as eq11 } from "drizzle-orm";
4687
4644
 
@@ -4722,6 +4679,12 @@ async function backlogHasItems() {
4722
4679
  return row !== void 0;
4723
4680
  }
4724
4681
 
4682
+ // src/commands/backlog/web/applyCwdFromReq.ts
4683
+ function applyCwdFromReq(req) {
4684
+ const url = new URL(req.url ?? "/", "http://localhost");
4685
+ setBacklogDir(url.searchParams.get("cwd") ?? void 0);
4686
+ }
4687
+
4725
4688
  // src/commands/backlog/web/getBacklogExists.ts
4726
4689
  async function getBacklogExists(req, res) {
4727
4690
  applyCwdFromReq(req);
@@ -4731,6 +4694,27 @@ async function getBacklogExists(req, res) {
4731
4694
  // src/commands/backlog/web/rewindItemPhase.ts
4732
4695
  import { eq as eq13 } from "drizzle-orm";
4733
4696
 
4697
+ // src/commands/backlog/web/parseItemBody.ts
4698
+ function readBody(req) {
4699
+ return new Promise((resolve16, reject) => {
4700
+ let body = "";
4701
+ req.on("data", (chunk) => {
4702
+ body += chunk.toString();
4703
+ });
4704
+ req.on("end", () => resolve16(body));
4705
+ req.on("error", reject);
4706
+ });
4707
+ }
4708
+ async function parseItemBody(req) {
4709
+ return JSON.parse(await readBody(req));
4710
+ }
4711
+ async function parseStatusBody(req) {
4712
+ return JSON.parse(await readBody(req));
4713
+ }
4714
+ async function parseRewindBody(req) {
4715
+ return JSON.parse(await readBody(req));
4716
+ }
4717
+
4734
4718
  // src/commands/backlog/deleteComment.ts
4735
4719
  import { and as and2, eq as eq12 } from "drizzle-orm";
4736
4720
  async function deleteComment(orm, itemId, commentId) {
@@ -5332,7 +5316,6 @@ var routes = {
5332
5316
  ),
5333
5317
  "GET /xterm.css": createCssHandler("@xterm/xterm/css/xterm.css"),
5334
5318
  "GET /api/items": listItems,
5335
- "POST /api/items": createItem,
5336
5319
  "GET /api/backlog/exists": getBacklogExists,
5337
5320
  "POST /api/backlog/init": initBacklog,
5338
5321
  "POST /api/open-in-code": openInCode,
@@ -11344,6 +11327,45 @@ ${resolves}` : baseWhy);
11344
11327
  }
11345
11328
 
11346
11329
  // src/commands/prs/validatePrContent.ts
11330
+ var MAX_PARAGRAPH_CHARS = 600;
11331
+ var MAX_PARAGRAPH_SENTENCES = 4;
11332
+ function isListLine(line) {
11333
+ return /^\s*([-*+]|\d+[.)])\s/.test(line);
11334
+ }
11335
+ function countSentences(paragraph) {
11336
+ return paragraph.match(/[.!?]+(\s|$)/g)?.length ?? 0;
11337
+ }
11338
+ function splitParagraphs(body) {
11339
+ const paragraphs = [];
11340
+ let section2 = "(intro)";
11341
+ let lines = [];
11342
+ const flush = () => {
11343
+ if (lines.length > 0) {
11344
+ paragraphs.push({ section: section2, lines });
11345
+ lines = [];
11346
+ }
11347
+ };
11348
+ for (const line of body.split("\n")) {
11349
+ const heading = line.match(/^#{1,6}\s+(.*)$/);
11350
+ if (heading) {
11351
+ flush();
11352
+ section2 = heading[1].trim();
11353
+ } else if (line.trim() === "") {
11354
+ flush();
11355
+ } else {
11356
+ lines.push(line);
11357
+ }
11358
+ }
11359
+ flush();
11360
+ return paragraphs;
11361
+ }
11362
+ function isWallOfText(lines) {
11363
+ if (lines.some(isListLine)) {
11364
+ return false;
11365
+ }
11366
+ const text3 = lines.join(" ").trim();
11367
+ return text3.length > MAX_PARAGRAPH_CHARS || countSentences(text3) > MAX_PARAGRAPH_SENTENCES;
11368
+ }
11347
11369
  function validatePrContent(title, body) {
11348
11370
  if (title.toLowerCase().includes("claude")) {
11349
11371
  console.error("Error: PR title must not reference Claude");
@@ -11353,6 +11375,14 @@ function validatePrContent(title, body) {
11353
11375
  console.error("Error: PR body must not reference Claude");
11354
11376
  process.exit(1);
11355
11377
  }
11378
+ const wall = splitParagraphs(body).find((p) => isWallOfText(p.lines));
11379
+ if (wall) {
11380
+ const chars = wall.lines.join(" ").trim().length;
11381
+ console.error(
11382
+ `Error: the "${wall.section}" section contains a wall-of-text paragraph (${chars} chars). Be concise \u2014 split it into bullet points or trim it.`
11383
+ );
11384
+ process.exit(1);
11385
+ }
11356
11386
  }
11357
11387
 
11358
11388
  // src/commands/prs/edit.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.292.0",
3
+ "version": "0.294.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {