@rheged-studio/changelog-core 1.1.2 → 1.2.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/config.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "issueKeys": ["A"],
2
+ "issueKeys": ["R", "A"],
3
3
  "linearWorkspaceSlug": "rheged-studio",
4
4
  "baseBranch": "main",
5
5
  "changelogDir": "changelog",
package/dist/index.d.ts CHANGED
@@ -19,5 +19,5 @@ export { derivePackagesFromPaths, type DerivePackagesOptions, } from "./lib/deri
19
19
  export { enrichFrontmatter, type EnrichInput } from "./lib/enrich.js";
20
20
  export { type FrontmatterData, type FrontmatterValue, type ParsedFrontmatter, parseFrontmatter, stringifyFrontmatter, } from "./lib/frontmatter.js";
21
21
  export { readPackageVersion, stampVersion } from "./lib/stamp.js";
22
- export { buildIssueRe, escapeRegex } from "./lib/vendor/issue-keys.js";
22
+ export { buildBranchIssueRe, buildIssueRe, escapeRegex, extractBranchIssueId, } from "./lib/vendor/issue-keys.js";
23
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,KAAK,kBAAkB,EACvB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EACL,aAAa,EACb,YAAY,EACZ,KAAK,UAAU,EACf,KAAK,UAAU,GAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gCAAgC,EAAE,MAAM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ACZ,KAAK,UAAU,EACf,KAAK,UAAU,GAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAIvD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,KAAK,MAAM,GACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,eAAe,EACpB,UAAU,EACV,WAAW,EACX,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,uBAAuB,EACvB,KAAK,qBAAqB,GAC3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,oBAAoB,GACrB,MAAM,4BAA4B,CAAC"}
package/dist/index.js CHANGED
@@ -21,4 +21,4 @@ export { derivePackagesFromPaths, } from "./lib/derive-packages.js";
21
21
  export { enrichFrontmatter } from "./lib/enrich.js";
22
22
  export { parseFrontmatter, stringifyFrontmatter, } from "./lib/frontmatter.js";
23
23
  export { readPackageVersion, stampVersion } from "./lib/stamp.js";
24
- export { buildIssueRe, escapeRegex } from "./lib/vendor/issue-keys.js";
24
+ export { buildBranchIssueRe, buildIssueRe, escapeRegex, extractBranchIssueId, } from "./lib/vendor/issue-keys.js";
@@ -13,4 +13,19 @@ export declare function escapeRegex(source: string): string;
13
13
  * bare `A` and missing `A-7`).
14
14
  */
15
15
  export declare function buildIssueRe(keys: string[]): null | RegExp;
16
+ /**
17
+ * Build the anchored `^(?:KEY|…)-\d+\b` matcher (no global flag) for reading a
18
+ * branch name's **leading** issue ID. Branches are named `<id>-<slug>`, so only
19
+ * the leading token is the branch's issue: a slug token such as `-c-2-` or
20
+ * `-r-3-` must never resolve to an issue (A-2682). Same escaping, grouping and
21
+ * empty-key rules as `buildIssueRe`; prose (changelog bodies, commit messages,
22
+ * PR titles) keeps the unanchored `buildIssueRe`.
23
+ */
24
+ export declare function buildBranchIssueRe(keys: string[]): null | RegExp;
25
+ /**
26
+ * The branch's issue ID — its leading `<KEY>-<digits>` token, upper-cased — or
27
+ * `null` when the branch doesn't start with a configured key. At most one ID
28
+ * per branch.
29
+ */
30
+ export declare function extractBranchIssueId(branch: string, keys: string[]): null | string;
16
31
  //# sourceMappingURL=issue-keys.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"issue-keys.d.ts","sourceRoot":"","sources":["../../../src/lib/vendor/issue-keys.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,MAAM,CAQ1D"}
1
+ {"version":3,"file":"issue-keys.d.ts","sourceRoot":"","sources":["../../../src/lib/vendor/issue-keys.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,MAAM,CAQ1D;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,MAAM,CAOhE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAAE,GACb,IAAI,GAAG,MAAM,CAIf"}
@@ -1,6 +1,10 @@
1
1
  // Canonical issue-key helpers — the single source of truth for deriving a
2
2
  // Linear issue-key regex from a branch name or prose.
3
3
  //
4
+ // TypeScript port of agent-skills' `lib/issue-keys.mjs` (vendored per ADR-0004,
5
+ // A-534). Re-sync by hand when upstream changes; last synced at agent-skills
6
+ // `76a032d` (A-2652).
7
+ //
4
8
  // Pure and zero-dependency by design: the host loads its own config and
5
9
  // passes the configured keys in.
6
10
  /**
@@ -27,3 +31,28 @@ export function buildIssueRe(keys) {
27
31
  const group = keys.length > 1 ? `(?:${alternation})` : alternation;
28
32
  return new RegExp(`\\b${group}-\\d+\\b`, "g");
29
33
  }
34
+ /**
35
+ * Build the anchored `^(?:KEY|…)-\d+\b` matcher (no global flag) for reading a
36
+ * branch name's **leading** issue ID. Branches are named `<id>-<slug>`, so only
37
+ * the leading token is the branch's issue: a slug token such as `-c-2-` or
38
+ * `-r-3-` must never resolve to an issue (A-2682). Same escaping, grouping and
39
+ * empty-key rules as `buildIssueRe`; prose (changelog bodies, commit messages,
40
+ * PR titles) keeps the unanchored `buildIssueRe`.
41
+ */
42
+ export function buildBranchIssueRe(keys) {
43
+ const prose = buildIssueRe(keys);
44
+ if (!prose) {
45
+ return null;
46
+ }
47
+ return new RegExp(prose.source.replace(/^\\b/, "^"));
48
+ }
49
+ /**
50
+ * The branch's issue ID — its leading `<KEY>-<digits>` token, upper-cased — or
51
+ * `null` when the branch doesn't start with a configured key. At most one ID
52
+ * per branch.
53
+ */
54
+ export function extractBranchIssueId(branch, keys) {
55
+ const re = buildBranchIssueRe(keys);
56
+ const match = re?.exec(branch.toUpperCase());
57
+ return match ? match[0] : null;
58
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rheged-studio/changelog-core",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "Shared changelog contract and dual-runtime CLI for Rheged Studio — validate, enrich, and finalise dated changelog entries.",
5
5
  "keywords": [
6
6
  "changelog",