@adamchanadam/agent-handoff-kit 0.1.4 → 0.1.6

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Agent Handoff Kit
2
2
 
3
- 狀態:`v0.1.4` 已正式發佈到 GitHub 與 npm。這是早期可用版本,尚未宣稱所有需求已完成。
3
+ 狀態:`v0.1.6` 已正式發佈到 GitHub 與 npm。這是早期可用版本,尚未宣稱所有需求已完成。
4
4
 
5
5
  ![Agent Handoff Kit 主視覺](https://raw.githubusercontent.com/Adamchanadam/agent-handoff-kit/main/images/agent-handoff-kit-main-visual2.png)
6
6
 
@@ -8,7 +8,7 @@ Agent Handoff Kit 是 **AI Session 之間的接力棒**。
8
8
 
9
9
  它只處理一件狹窄但重要的事:AI 跨對話失憶。每次開新對話,AI 往往不記得你上次做到哪裡,也認不出中途新建的文件、你引入的參考資料、哪些檔案是真源。這套工具把進度、下一步、風險、檔案登記與下次開工提示寫進固定文件,讓下一個 AI 工具能接得上上一棒。
10
10
 
11
- 想先看非技術版介紹,可打開 GitHub repo 內的 [`agent-handoff-kit-intro.html`](agent-handoff-kit-intro.html)。那一頁是新手 60 秒入門,README 則保留安裝、日常使用與限制。
11
+ 想先看非技術版介紹,可打開 GitHub Pages 上的 [`agent-handoff-kit-intro.html`](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-intro.html)。那一頁是新手 60 秒入門,README 則保留安裝、日常使用與限制。
12
12
 
13
13
  ## 它解決甚麼問題
14
14
 
@@ -197,11 +197,11 @@ npm package 只包含安裝所需內容:
197
197
  - `LICENSE`
198
198
  - `package.json`
199
199
 
200
- GitHub repo 內的新手介紹頁 `agent-handoff-kit-intro.html` 與 `images/` 是原始碼倉庫資產,不會安裝到你的專案。
200
+ GitHub Pages 上的新手介紹頁 `agent-handoff-kit-intro.html` 由原始碼倉庫根目錄發佈;`agent-handoff-kit-intro.html` 與 `images/` 是原始碼倉庫資產,不會安裝到你的專案。
201
201
 
202
202
  ## 目前限制
203
203
 
204
- - `v0.1.4` 是 GitHub 與 npm 同步發佈版本。
204
+ - `v0.1.6` 是 GitHub 與 npm 同步發佈版本。
205
205
  - 這是早期可用版本,尚未宣稱完整穩定。
206
206
  - 升級合併仍是窄範圍策略,不是完整的複雜合併工具。
207
207
  - `doctor` 能檢查結構,不能代替 AI 對專案內容的理解。
@@ -162,6 +162,24 @@ const requiredAnchors = [
162
162
  ];
163
163
 
164
164
  const schemaChecks = [
165
+ {
166
+ target: "AGENTS.md",
167
+ label: "core runtime uniqueness",
168
+ checks: [
169
+ {
170
+ label: "exactly one Agent Handoff Kit Core Runtime heading",
171
+ test: (text) => countOccurrences(text, "# Agent Handoff Kit Core Runtime") === 1
172
+ },
173
+ {
174
+ label: "managed core markers are paired and not duplicated",
175
+ test: (text) => {
176
+ const starts = countOccurrences(text, managedCoreStart);
177
+ const ends = countOccurrences(text, managedCoreEnd);
178
+ return starts === ends && starts <= 1;
179
+ }
180
+ }
181
+ ]
182
+ },
165
183
  {
166
184
  target: "dev/SESSION_HANDOFF.md",
167
185
  label: "handoff required sections",
@@ -594,7 +612,7 @@ function classifyExistingFile(command, sourceRel, targetRel, sourceAbs, targetAb
594
612
  return {
595
613
  ...base,
596
614
  action: "merge",
597
- reason: "append managed core while preserving existing AGENTS.md content",
615
+ reason: "replace stale Agent Handoff Kit core or add managed core while preserving existing AGENTS.md content",
598
616
  mergedText: mergeManagedBlock(targetText, sourceText)
599
617
  };
600
618
  }
@@ -608,9 +626,29 @@ function mergeManagedBlock(targetText, sourceText) {
608
626
  const block = `${managedCoreStart}\n${sourceText.trim()}\n${managedCoreEnd}`;
609
627
  const existingBlock = new RegExp(`${escapeRegExp(managedCoreStart)}[\\s\\S]*?${escapeRegExp(managedCoreEnd)}`);
610
628
  if (existingBlock.test(targetText)) return `${targetText.replace(existingBlock, block).trimEnd()}\n`;
629
+ const unmarkedCore = findUnmarkedCoreRange(targetText);
630
+ if (unmarkedCore) {
631
+ return `${targetText.slice(0, unmarkedCore.start).trimEnd()}${targetText.slice(0, unmarkedCore.start).trimEnd() ? "\n\n" : ""}${block}${targetText.slice(unmarkedCore.end).trimStart() ? `\n\n${targetText.slice(unmarkedCore.end).trimStart()}` : ""}\n`;
632
+ }
611
633
  return `${targetText.trimEnd()}\n\n${block}\n`;
612
634
  }
613
635
 
636
+ function findUnmarkedCoreRange(text) {
637
+ const start = text.indexOf("# Agent Handoff Kit Core Runtime");
638
+ if (start < 0) return null;
639
+ const terminal = "keep the core within budget.";
640
+ const terminalIndex = text.indexOf(terminal, start);
641
+ if (terminalIndex >= 0) return { start, end: terminalIndex + terminal.length };
642
+ const afterTitle = start + "# Agent Handoff Kit Core Runtime".length;
643
+ const nextTopLevel = text.slice(afterTitle).search(/\n# (?!Agent Handoff Kit Core Runtime\b)/);
644
+ if (nextTopLevel < 0) return { start, end: text.length };
645
+ return { start, end: afterTitle + nextTopLevel + 1 };
646
+ }
647
+
648
+ function countOccurrences(text, needle) {
649
+ return text.split(needle).length - 1;
650
+ }
651
+
614
652
  function escapeRegExp(text) {
615
653
  return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
616
654
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamchanadam/agent-handoff-kit",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Lightweight agent harness for project memory, handoff, and multi-session continuity.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -6,7 +6,7 @@ Purpose: give a stateless AI a compact map of the project before it reads or edi
6
6
 
7
7
  | Field | Value | Last verified |
8
8
  |---|---|---|
9
- | Agent Handoff Kit template version | 0.1.4 | package prototype |
9
+ | Agent Handoff Kit template version | 0.1.6 | package prototype |
10
10
  | Runtime | TBD | TBD |
11
11
  | Framework | TBD | TBD |
12
12
  | Package manager | TBD | TBD |