portable-agent-layer 0.61.2 → 0.61.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "portable-agent-layer",
3
- "version": "0.61.2",
3
+ "version": "0.61.3",
4
4
  "description": "PAL — Portable Agent Layer: persistent personal context for AI coding assistants",
5
5
  "type": "module",
6
6
  "bin": {
@@ -378,6 +378,23 @@ function removeIscLine(
378
378
  };
379
379
  }
380
380
 
381
+ // Drops any "### Archived <date>" heading whose block has no content left —
382
+ // e.g. after every ISC filed under that date has been reopened.
383
+ function dropEmptyArchiveHeadings(changelog: string): string {
384
+ const lines = changelog.split("\n");
385
+ const blockHasContent = (headingIdx: number): boolean => {
386
+ for (let j = headingIdx + 1; j < lines.length && !lines[j].startsWith("### "); j++) {
387
+ if (lines[j].trim() !== "") return true;
388
+ }
389
+ return false;
390
+ };
391
+ return lines
392
+ .filter((l, i) => !(/^### Archived /.test(l) && !blockHasContent(i)))
393
+ .join("\n")
394
+ .replace(/\n{3,}/g, "\n\n")
395
+ .trim();
396
+ }
397
+
381
398
  function archiveLine(changelog: string | undefined, doneLine: string): string {
382
399
  const heading = `### Archived ${new Date().toISOString().slice(0, 10)}`;
383
400
  const base = (changelog ?? "").trim();
@@ -439,7 +456,7 @@ function cmdReopenIsc(args: string[]): void {
439
456
  }
440
457
  let removed = removeIscLine(p.changelog ?? "", id);
441
458
  if (removed.line) {
442
- p.changelog = removed.rest;
459
+ p.changelog = dropEmptyArchiveHeadings(removed.rest);
443
460
  } else {
444
461
  removed = removeIscLine(p.criteria ?? "", id);
445
462
  if (removed.line) p.criteria = removed.rest;