@agent-plan/core 0.2.19-next.14 → 0.2.19-next.16

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.
@@ -1 +1 @@
1
- {"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../src/refs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAKlD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,KAAK,EAAE,EACf,QAAQ,EAAE,OAAO,EAAE,EACnB,GAAG,EAAE,MAAM,GACV,KAAK,GAAG,SAAS,CAgCnB;AACD;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAexC,wBAAgB,aAAa,CAC3B,MAAM,EAAE,KAAK,EAAE,EACf,QAAQ,EAAE,OAAO,EAAE,EACnB,GAAG,EAAE,MAAM,GACV;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,GAAG,SAAS,CAiD1C"}
1
+ {"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../src/refs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAKlD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,KAAK,EAAE,EACf,QAAQ,EAAE,OAAO,EAAE,EACnB,GAAG,EAAE,MAAM,GACV,KAAK,GAAG,SAAS,CAgCnB;AACD;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAiBxC,wBAAgB,aAAa,CAC3B,MAAM,EAAE,KAAK,EAAE,EACf,QAAQ,EAAE,OAAO,EAAE,EACnB,GAAG,EAAE,MAAM,GACV;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,GAAG,SAAS,CA2D1C"}
package/dist/refs.js CHANGED
@@ -43,14 +43,19 @@ export function findPhaseByRef(phases, features, ref) {
43
43
  // Extract optional feature/phase/task numbers from a composite ref.
44
44
  // Accepts 1+ digits so "t3" == "t003". Numbers are GLOBAL (post-migration).
45
45
  function parseTaskComposite(ref) {
46
- const t = ref.match(/t0*(\d+)/);
47
- const p = ref.match(/p0*(\d+)/);
48
- const f = ref.match(/f0*(\d+)/);
49
- return {
50
- taskNum: t ? parseInt(t[1], 10) : undefined,
51
- phaseNum: p ? parseInt(p[1], 10) : undefined,
52
- featureNum: f ? parseInt(f[1], 10) : undefined,
53
- };
46
+ // Anchored patterns only: composite refs (F00x/P00x/T00x, P00x(F00x)/T00x,
47
+ // P00x/T00x) and bare T00x. A 5-char shortId (e.g. "HT23X") or a title never
48
+ // matches these because they are anchored to the WHOLE string.
49
+ const composite = ref.match(/^f0*(\d+)\/p0*(\d+)\/t0*(\d+)$/);
50
+ if (composite)
51
+ return { featureNum: parseInt(composite[1], 10), phaseNum: parseInt(composite[2], 10), taskNum: parseInt(composite[3], 10) };
52
+ const phaseTask = ref.match(/^p0*(\d+)(?:\(f0*(\d+)\))?\/t0*(\d+)$/);
53
+ if (phaseTask)
54
+ return { phaseNum: parseInt(phaseTask[1], 10), featureNum: phaseTask[2] ? parseInt(phaseTask[2], 10) : undefined, taskNum: parseInt(phaseTask[3], 10) };
55
+ const bare = ref.match(/^t0*(\d+)$/);
56
+ if (bare)
57
+ return { taskNum: parseInt(bare[1], 10) };
58
+ return {};
54
59
  }
55
60
  export function findTaskByRef(phases, features, ref) {
56
61
  const normalized = ref.trim().toLowerCase();
@@ -62,6 +67,16 @@ export function findTaskByRef(phases, features, ref) {
62
67
  if (task)
63
68
  return { phase, task };
64
69
  }
70
+ // 1b. ShortId (5-char) — check BEFORE composite so a shortId like "HT23X"
71
+ // or "T1234" is never misread as a numeric task ref (regexes are anchored now,
72
+ // but a 5-char ref can still look numeric). SHORT_ID_LENGTH is always 5.
73
+ if (normalized.length === 5) {
74
+ for (const phase of phases) {
75
+ const task = phase.tasks.find((t) => t.shortId && t.shortId.toLowerCase() === normalized);
76
+ if (task)
77
+ return { phase, task };
78
+ }
79
+ }
65
80
  // 2. Composite / short ref with a T segment
66
81
  const { featureNum, phaseNum, taskNum } = parseTaskComposite(normalized);
67
82
  if (taskNum !== undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-plan/core",
3
- "version": "0.2.19-next.14",
3
+ "version": "0.2.19-next.16",
4
4
  "private": false,
5
5
  "description": "Harness-agnostic core for Agent Plan: schemas, persistence, ordering, status rollups, and markdown rendering.",
6
6
  "license": "MIT",