@staff0rd/assist 0.613.1 → 0.615.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.613.1",
9
+ version: "0.615.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -11537,6 +11537,14 @@ function appendRulesSection(lines2, entry) {
11537
11537
  }
11538
11538
 
11539
11539
  // src/commands/rules/parseRulesSection.ts
11540
+ var RULE_TITLE = /^\*\*\s*([^*]+?)\s*\*\*\s*(?:[—–:-]\s*)?(.*)$/;
11541
+ function splitTitle(rest) {
11542
+ const match = RULE_TITLE.exec(rest);
11543
+ if (!match) return { text: rest };
11544
+ const title = match[1].trim();
11545
+ const text18 = match[2].trim();
11546
+ return title === "" || text18 === "" ? { text: rest } : { title, text: text18 };
11547
+ }
11540
11548
  function parseRulesSection(content) {
11541
11549
  const lines2 = content.split(/\r?\n/);
11542
11550
  const range = rulesSectionRange(lines2);
@@ -11546,9 +11554,9 @@ function parseRulesSection(content) {
11546
11554
  const match = RULE_BULLET.exec(line);
11547
11555
  if (!match) continue;
11548
11556
  const code = match[1].trim();
11549
- const text18 = match[2].trim();
11550
- if (code === "" || text18 === "") continue;
11551
- rules3.push({ code, text: text18 });
11557
+ const rest = match[2].trim();
11558
+ if (code === "" || rest === "") continue;
11559
+ rules3.push({ code, ...splitTitle(rest) });
11552
11560
  }
11553
11561
  return rules3;
11554
11562
  }
@@ -21754,6 +21762,16 @@ function collectLabels(value, previous) {
21754
21762
  return [...previous, ...added];
21755
21763
  }
21756
21764
 
21765
+ // src/commands/prs/appendScreenshots.ts
21766
+ function appendScreenshots(body, screenshots) {
21767
+ if (screenshots.length === 0) return body;
21768
+ return `${body}
21769
+
21770
+ ## Screenshots
21771
+
21772
+ ${screenshots.join("\n\n")}`;
21773
+ }
21774
+
21757
21775
  // src/commands/github/issue/addIssueToProject.ts
21758
21776
  var MUTATION3 = `mutation($projectId: ID!, $contentId: ID!) {
21759
21777
  addProjectV2ItemById(input: { projectId: $projectId, contentId: $contentId }) {
@@ -22171,8 +22189,8 @@ function resolveCreateIssueMetadata(options2) {
22171
22189
  import { randomUUID as randomUUID8 } from "crypto";
22172
22190
  async function reviewProposedIssue(title, body, metadata2 = []) {
22173
22191
  const sessionId = process.env.ASSIST_SESSION_ID;
22174
- if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
22175
- await awaitPreviewApproval("GitHub issue preview", {
22192
+ if (process.env.ASSIST_SESSION !== "1" || !sessionId) return void 0;
22193
+ return await awaitPreviewApproval("GitHub issue preview", {
22176
22194
  sessionId,
22177
22195
  requestId: randomUUID8(),
22178
22196
  title,
@@ -22221,8 +22239,17 @@ async function createIssue(options2) {
22221
22239
  body
22222
22240
  );
22223
22241
  const resolved = preflight(options2);
22224
- await reviewProposedIssue(title, body, issuePreviewMetadata(resolved));
22225
- const output = runGhIssueCreate(title, body, options2.repo, resolved?.labels);
22242
+ const decision = await reviewProposedIssue(
22243
+ title,
22244
+ body,
22245
+ issuePreviewMetadata(resolved)
22246
+ );
22247
+ const output = runGhIssueCreate(
22248
+ title,
22249
+ appendScreenshots(body, decision?.screenshots ?? []),
22250
+ options2.repo,
22251
+ resolved?.labels
22252
+ );
22226
22253
  console.log(output.trim());
22227
22254
  if (resolved) applyCreatedIssueMetadata(output, resolved);
22228
22255
  }
@@ -25170,16 +25197,6 @@ async function comment2(path90, line, body, startLine) {
25170
25197
  // src/commands/prs/edit.ts
25171
25198
  import { randomUUID as randomUUID14 } from "crypto";
25172
25199
 
25173
- // src/commands/prs/appendScreenshots.ts
25174
- function appendScreenshots(body, screenshots) {
25175
- if (screenshots.length === 0) return body;
25176
- return `${body}
25177
-
25178
- ## Screenshots
25179
-
25180
- ${screenshots.join("\n\n")}`;
25181
- }
25182
-
25183
25200
  // src/commands/prs/applyEdit.ts
25184
25201
  import { execFileSync as execFileSync13 } from "child_process";
25185
25202
  function applyEdit(number, title, body) {
@@ -30606,8 +30623,11 @@ import path71 from "path";
30606
30623
  import chalk209 from "chalk";
30607
30624
 
30608
30625
  // src/commands/rules/insertRuleBullet.ts
30609
- function insertRuleBullet(content, code, text18) {
30610
- const bullet = `- **${code}** \u2014 ${text18}`;
30626
+ function ruleBullet({ code, title, text: text18 }) {
30627
+ return title ? `- **${code}** \u2014 **${title}** \u2014 ${text18}` : `- **${code}** \u2014 ${text18}`;
30628
+ }
30629
+ function insertRuleBullet(content, rule) {
30630
+ const bullet = ruleBullet(rule);
30611
30631
  const lines2 = contentLines(content);
30612
30632
  const range = rulesSectionRange(lines2);
30613
30633
  if (!range) return appendRulesSection(lines2, bullet);
@@ -30744,7 +30764,14 @@ function addRule(text18, options2) {
30744
30764
  const targetDir = path71.dirname(target);
30745
30765
  const root = findRepoRoot(targetDir) ?? targetDir;
30746
30766
  const code = nextRuleCode(root);
30747
- writeFileSync41(target, insertRuleBullet(read2(target), code, rule));
30767
+ writeFileSync41(
30768
+ target,
30769
+ insertRuleBullet(read2(target), {
30770
+ code,
30771
+ title: options2.title?.trim() || void 0,
30772
+ text: rule
30773
+ })
30774
+ );
30748
30775
  updateScopedRulesIndex(root);
30749
30776
  console.log(
30750
30777
  `Added ${chalk209.cyan(code)} to ${path71.relative(process.cwd(), target) || target}`
@@ -30773,7 +30800,7 @@ function indexRules() {
30773
30800
  // src/commands/rules/listRules.ts
30774
30801
  import path73 from "path";
30775
30802
  import chalk211 from "chalk";
30776
- function listRules(target) {
30803
+ function listRules(target, options2 = {}) {
30777
30804
  const resolved = path73.resolve(target ?? process.cwd());
30778
30805
  const rules3 = readScopedRules(resolved);
30779
30806
  if (rules3.length === 0) {
@@ -30791,7 +30818,11 @@ function listRules(target) {
30791
30818
  chalk211.dim(base ? path73.relative(base, rule.source) : rule.source)
30792
30819
  );
30793
30820
  }
30794
- console.log(` ${chalk211.cyan(rule.code.padEnd(width))} ${rule.text}`);
30821
+ console.log(
30822
+ ` ${chalk211.cyan(rule.code.padEnd(width))} ${rule.title ?? rule.text}`
30823
+ );
30824
+ if (options2.full && rule.title)
30825
+ console.log(` ${" ".repeat(width)} ${chalk211.dim(rule.text)}`);
30795
30826
  }
30796
30827
  }
30797
30828
 
@@ -30800,9 +30831,14 @@ function registerRules(program2) {
30800
30831
  const rulesCommand = program2.command("rules").description("Read and write the CLAUDE.md rules in scope for a path");
30801
30832
  rulesCommand.command("list [path]").description(
30802
30833
  "List the rules from the `## Rules` section of every CLAUDE.md from a path's directory up to the repo root (default: cwd)"
30803
- ).action((target) => listRules(target));
30834
+ ).option("--full", "Show each rule's full description as well as its title").action(
30835
+ (target, options2) => listRules(target, options2)
30836
+ );
30804
30837
  rulesCommand.command("add <text>").description(
30805
30838
  "Add a rule to the `## Rules` section of the scope's CLAUDE.md, allocating the next repo-wide code and creating the section when absent"
30839
+ ).option(
30840
+ "--title <title>",
30841
+ "As few words as possible summarising the rule, shown in the rule picker in place of the description"
30806
30842
  ).option(
30807
30843
  "--scope <path>",
30808
30844
  "File or directory whose nearest CLAUDE.md receives the rule, or a CLAUDE.md path to write to directly (default: cwd)"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.613.1",
3
+ "version": "0.615.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {