@aryasaatvik/scratchpad 0.3.1 → 0.3.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## @aryasaatvik/scratchpad@0.3.2
2
+
3
+ ### Name feedback by id from any directory
4
+
5
+ `scratchpad feedback resolve` now finds an occurrence by the id after the last `-` in its file name (`c56d71da`) or by its file name, with or without `.md`, looked up in the feedback folder rather than the working directory. Paths still work. An id two files share is refused with both names.
6
+
7
+ `--review` takes a review record's file name too, looked up in this scope's `feedback/reviews/` and then the global one, so a project occurrence can cite a global review without its absolute path. `reviews/<name>` and a quoted `~/` path also work.
8
+
9
+ Both `--help` and the not-found errors now say which forms each argument accepts.
10
+
1
11
  ## @aryasaatvik/scratchpad@0.3.1
2
12
 
3
13
  ### Retire every file for a closed issue or milestone
package/README.md CHANGED
@@ -135,7 +135,7 @@ scratchpad backlog validate | graph # decode, check fields, links
135
135
  scratchpad feedback new "<text>" [--global] [--harness <h>] [--model <m>] [--session <id>]
136
136
  scratchpad feedback review [--global] [--classify] [--json]
137
137
  scratchpad feedback list [--global] [--status <s>] [--disposition <d>]... [--all]
138
- scratchpad feedback resolve <id-or-path> --disposition <d> --review <record> [--evidence <e>]...
138
+ scratchpad feedback resolve <id|file|path> --disposition <d> --review <name|path> [--evidence <e>]...
139
139
  scratchpad route "<correction>" [--write] [--json]
140
140
  scratchpad archive <paths...> --reason "<why>" # move into archive/<date>-<reason>/
141
141
  ```
@@ -48408,7 +48408,7 @@ var bundleHtml = async (options) => {
48408
48408
  // package.json
48409
48409
  var package_default = {
48410
48410
  name: "@aryasaatvik/scratchpad",
48411
- version: "0.3.1",
48411
+ version: "0.3.2",
48412
48412
  description: "Local-first GitHub issue and milestone tracking, hosted artifacts and uploads, and local architecture codemaps.",
48413
48413
  keywords: [
48414
48414
  "bun",
@@ -50572,6 +50572,9 @@ var writeFeedbackClassification = (file, classification) => rewriteFeedbackFront
50572
50572
  values.status = classification.confidence < REVIEW_THRESHOLD ? "review" : "classified";
50573
50573
  values.classification = classification;
50574
50574
  });
50575
+ var OCCURRENCE_FORMS = "Name it by the id after the last '-' in its file name (c56d71da), its file name with or without .md, or a path to the file.";
50576
+ var REVIEW_FORMS = "Name it by its file name in feedback/reviews/ (this scope's first, then the global one), or a path to it.";
50577
+ var hasPathSeparator = (value) => value.includes("/") || value.includes("\\");
50575
50578
  var resolveFeedback = (input) => gen2(function* () {
50576
50579
  const fs = yield* FileSystem;
50577
50580
  const path = yield* Path;
@@ -50580,21 +50583,36 @@ var resolveFeedback = (input) => gen2(function* () {
50580
50583
  const feedbackRoot = path.join(root, "feedback");
50581
50584
  const canonicalRoot = yield* fs.realPath(feedbackRoot).pipe(mapError2(() => new NotesCommandError({ reason: "not_found", message: "Feedback folder not found" })));
50582
50585
  let file;
50583
- if (input.occurrence.endsWith(".md")) {
50584
- file = path.resolve(input.occurrence);
50585
- } else if (!input.occurrence.includes("/") && !input.occurrence.includes("\\")) {
50586
- file = path.join(canonicalRoot, `${input.occurrence}.md`);
50587
- const exists = yield* fs.exists(file);
50588
- if (!exists)
50586
+ const occurrenceIsPath = hasPathSeparator(input.occurrence);
50587
+ if (occurrenceIsPath || input.occurrence.endsWith(".md") && (yield* fs.exists(path.resolve(input.occurrence)))) {
50588
+ if (!input.occurrence.endsWith(".md")) {
50589
50589
  return yield* new NotesCommandError({
50590
- reason: "not_found",
50591
- message: "Feedback occurrence not found"
50590
+ reason: "invalid",
50591
+ message: `Occurrence path must be a .md file. ${OCCURRENCE_FORMS}`
50592
50592
  });
50593
+ }
50594
+ file = path.resolve(input.occurrence);
50593
50595
  } else {
50594
- return yield* new NotesCommandError({
50595
- reason: "invalid",
50596
- message: "Occurrence must be a feedback file name stem or .md path"
50597
- });
50596
+ const name = input.occurrence.replace(/\.md$/u, "");
50597
+ const exact = path.join(canonicalRoot, `${name}.md`);
50598
+ if (name !== "" && (yield* fs.exists(exact))) {
50599
+ file = exact;
50600
+ } else {
50601
+ const matches = name === "" ? [] : (yield* fs.readDirectory(canonicalRoot)).filter((entry) => entry.endsWith(`-${name}.md`)).toSorted((a, b) => a.localeCompare(b));
50602
+ if (matches.length > 1) {
50603
+ return yield* new NotesCommandError({
50604
+ reason: "invalid",
50605
+ message: `"${input.occurrence}" matches ${matches.length} feedback files (${matches.join(", ")}); pass the full file name`
50606
+ });
50607
+ }
50608
+ if (matches.length === 0) {
50609
+ return yield* new NotesCommandError({
50610
+ reason: "not_found",
50611
+ message: `Feedback occurrence not found in ${canonicalRoot}. ${OCCURRENCE_FORMS}`
50612
+ });
50613
+ }
50614
+ file = path.join(canonicalRoot, matches[0]);
50615
+ }
50598
50616
  }
50599
50617
  file = yield* fs.realPath(file).pipe(mapError2(() => new NotesCommandError({
50600
50618
  reason: "not_found",
@@ -50607,9 +50625,29 @@ var resolveFeedback = (input) => gen2(function* () {
50607
50625
  message: "Occurrence path must be a .md file inside the feedback folder"
50608
50626
  });
50609
50627
  }
50610
- const review = path.resolve(input.review);
50611
- const reviewPath = yield* fs.realPath(review).pipe(mapError2(() => new NotesCommandError({ reason: "not_found", message: "Review record not found" })));
50612
50628
  const reviewRoots = [...input.global ? [] : [project.notesRoot], globalNotesRoot()];
50629
+ const reviewInput = input.review === "~" || input.review.startsWith("~/") ? path.join(homeDirectory(), input.review.slice(1)) : input.review;
50630
+ let review = path.resolve(reviewInput);
50631
+ if (!(yield* fs.exists(review))) {
50632
+ const name = reviewInput.replace(/^(?:feedback\/)?reviews\//u, "");
50633
+ if (!hasPathSeparator(name) && name !== "" && name !== ".md") {
50634
+ const fileName = name.endsWith(".md") ? name : `${name}.md`;
50635
+ const candidates = [
50636
+ path.join(canonicalRoot, "reviews", fileName),
50637
+ ...reviewRoots.map((notesRoot) => path.join(notesRoot, "feedback", "reviews", fileName))
50638
+ ];
50639
+ for (const candidate of candidates) {
50640
+ if (yield* fs.exists(candidate)) {
50641
+ review = candidate;
50642
+ break;
50643
+ }
50644
+ }
50645
+ }
50646
+ }
50647
+ const reviewPath = yield* fs.realPath(review).pipe(mapError2(() => new NotesCommandError({
50648
+ reason: "not_found",
50649
+ message: `Review record not found. ${REVIEW_FORMS}`
50650
+ })));
50613
50651
  const allowedReviewDirectories = [];
50614
50652
  for (const notesRoot of new Set(reviewRoots)) {
50615
50653
  const feedbackDirectory = yield* result2(fs.realPath(path.join(notesRoot, "feedback")));
@@ -50842,9 +50880,9 @@ var listCommand = make36("list", {
50842
50880
  yield* printListing(listing, json, "No feedback found");
50843
50881
  }).pipe(provide4(Project.layer), json ? provideService2(MinimumLogLevel2, "None") : identity)).pipe(withDescription4("List recorded instruction feedback"));
50844
50882
  var resolveCommand = make36("resolve", {
50845
- occurrence: String8("occurrence"),
50883
+ occurrence: String8("occurrence").pipe(withDescription2("Feedback file to update: the id after the last '-' in its name (c56d71da), its file name with or without .md, or a path")),
50846
50884
  disposition: Literals4("disposition", dispositions).pipe(withDescription3("Review outcome: open, deferred, dismissed, source-fixed, installed, verified")),
50847
- review: String9("review").pipe(withDescription3("Review record under feedback/reviews/ that decided this disposition")),
50885
+ review: String9("review").pipe(withDescription3("Review record that decided this disposition: its file name in feedback/reviews/ (this scope's, then the global one), or a path")),
50848
50886
  evidence: atLeast2(String9("evidence").pipe(withDescription3("Commit, PR URL, or path supporting the disposition; repeatable")), 0),
50849
50887
  global: Boolean6("global").pipe(withDefault4(false), withDescription3("Use the host-wide ~/.scratchpad instead of the project notes root")),
50850
50888
  json: jsonFlag
@@ -51431,20 +51469,23 @@ After writing the review record, write each occurrence's disposition back with t
51431
51469
  editing the file:
51432
51470
 
51433
51471
  \`\`\`bash
51434
- scratchpad feedback resolve <occurrence-id-or-path> --disposition <disposition> \\
51435
- --review <review-record-path> [--evidence <commit|PR URL|path>]... [--global]
51472
+ scratchpad feedback resolve <occurrence> --disposition <disposition> \\
51473
+ --review <review-record> [--evidence <commit|PR URL|path>]... [--global]
51436
51474
  \`\`\`
51437
51475
 
51438
- The review record must be a \`.md\` file directly inside a \`feedback/reviews/\` folder (project or
51439
- global). It adds \`disposition\`, \`disposition_review\`, \`disposition_evidence\`, and \`disposition_at\`
51440
- to the occurrence's front matter and leaves the body and every other key unchanged; resolving again
51441
- replaces them. \`disposition_review\` is relative to the occurrence's feedback folder when the record
51442
- sits under it (\`reviews/<name>.md\`), otherwise \`~/\`-relative when it is under the home directory,
51443
- else absolute. The review record stays the authority for the reasoning; the front matter only keeps
51444
- settled items out of the queue. \`feedback list\` and \`feedback review\` hide \`dismissed\` and
51445
- \`verified\` occurrences unless \`--all\` or a matching \`--disposition\` is passed. Occurrences whose
51446
- front matter does not decode cannot be resolved (the error names why); record their disposition in
51447
- the review record only.
51476
+ Name the occurrence by the id after the last \`-\` in its file name (\`c56d71da\`), by its file name
51477
+ with or without \`.md\`, or by a path; a name is looked up in the feedback folder from any working
51478
+ directory. Name the review record by its file name, which is looked up in this scope's
51479
+ \`feedback/reviews/\` and then the global one, or by a path. The review record must be a \`.md\` file
51480
+ directly inside a \`feedback/reviews/\` folder (project or global). It adds \`disposition\`,
51481
+ \`disposition_review\`, \`disposition_evidence\`, and \`disposition_at\` to the occurrence's front matter
51482
+ and leaves the body and every other key unchanged; resolving again replaces them.
51483
+ \`disposition_review\` is relative to the occurrence's feedback folder when the record sits under it
51484
+ (\`reviews/<name>.md\`), otherwise \`~/\`-relative when it is under the home directory, else absolute.
51485
+ The review record stays the authority for the reasoning; the front matter only keeps settled items
51486
+ out of the queue. \`feedback list\` and \`feedback review\` hide \`dismissed\` and \`verified\` occurrences
51487
+ unless \`--all\` or a matching \`--disposition\` is passed. Occurrences whose front matter does not
51488
+ decode cannot be resolved (the error names why); record their disposition in the review record only.
51448
51489
 
51449
51490
  Report recurrence by distinct incident/session, affected instruction, host, harness, and known
51450
51491
  model. Count unknown metadata separately. Multiple worker reports of the same incident count once.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aryasaatvik/scratchpad",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Local-first GitHub issue and milestone tracking, hosted artifacts and uploads, and local architecture codemaps.",
5
5
  "keywords": [
6
6
  "bun",