renma 0.9.0 → 0.11.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/CHANGELOG.md +31 -1
- package/README.md +13 -4
- package/dist/catalog-conflicts.d.ts +4 -0
- package/dist/catalog-conflicts.d.ts.map +1 -0
- package/dist/catalog-conflicts.js +86 -0
- package/dist/catalog-conflicts.js.map +1 -0
- package/dist/catalog-lifecycle.d.ts +4 -0
- package/dist/catalog-lifecycle.d.ts.map +1 -0
- package/dist/catalog-lifecycle.js +150 -0
- package/dist/catalog-lifecycle.js.map +1 -0
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +246 -24
- package/dist/catalog.js.map +1 -1
- package/dist/cli.js +5 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/inspect.d.ts +31 -0
- package/dist/commands/inspect.d.ts.map +1 -1
- package/dist/commands/inspect.js +183 -0
- package/dist/commands/inspect.js.map +1 -1
- package/dist/commands/scaffold.d.ts +1 -1
- package/dist/commands/scaffold.d.ts.map +1 -1
- package/dist/commands/scaffold.js +49 -3
- package/dist/commands/scaffold.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/context-language-diagnostics.d.ts +2 -0
- package/dist/context-language-diagnostics.d.ts.map +1 -0
- package/dist/context-language-diagnostics.js +2 -0
- package/dist/context-language-diagnostics.js.map +1 -0
- package/dist/context-language.d.ts +20 -0
- package/dist/context-language.d.ts.map +1 -0
- package/dist/context-language.js +105 -0
- package/dist/context-language.js.map +1 -0
- package/dist/diagnostic-ids.d.ts +7 -0
- package/dist/diagnostic-ids.d.ts.map +1 -1
- package/dist/diagnostic-ids.js +7 -0
- package/dist/diagnostic-ids.js.map +1 -1
- package/dist/discovery.js +2 -0
- package/dist/discovery.js.map +1 -1
- package/dist/markdown.js +5 -0
- package/dist/markdown.js.map +1 -1
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +12 -0
- package/dist/metadata.js.map +1 -1
- package/dist/model.d.ts +10 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/rules.d.ts.map +1 -1
- package/dist/rules.js +95 -0
- package/dist/rules.js.map +1 -1
- package/dist/scanner.js +82 -4
- package/dist/scanner.js.map +1 -1
- package/dist/security-policy.d.ts.map +1 -1
- package/dist/security-policy.js +5 -37
- package/dist/security-policy.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,34 @@ This project follows the spirit of [Keep a Changelog](https://keepachangelog.com
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.11.0] - 2026-07-05
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Added experimental `context_lens` assets, including default `lenses/**/*.md` discovery, cataloging, graph edges, and authoring docs.
|
|
14
|
+
- Added `requires_lens`, `optional_lens`, and `applies_to` metadata relationships for static skill-to-lens-to-context graphs.
|
|
15
|
+
- Added `inspect` and `scaffold context_lens` support for lens metadata, relationships, and deterministic starter files.
|
|
16
|
+
- Added context lens diagnostics for missing purpose or `applies_to` metadata, orphaned active lenses, and active lenses that apply to inactive contexts.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- Updated docs and examples for the context lens model, including clearer boundaries around runtime selection, prompt assembly, and context injection.
|
|
21
|
+
|
|
22
|
+
## [0.10.0] - 2026-07-05
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- Added metadata budget diagnostics for oversized frontmatter and long metadata list items.
|
|
27
|
+
- Added shared context usage-boundary diagnostics for missing or placeholder `when_to_use` and `when_not_to_use` metadata.
|
|
28
|
+
- Added shared context language diagnostics for vague wording, relative currentness wording, and prompt/runtime-selection wording.
|
|
29
|
+
- Added shared context lifecycle diagnostics for deprecated assets, invalid `superseded_by` targets, and supersession cycles.
|
|
30
|
+
- Added context conflict graph diagnostics for invalid `conflicts` metadata and skills that require conflicting contexts.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- Simplified security policy frontmatter handling around canonical snake_case metadata keys.
|
|
35
|
+
- Expanded diagnostics documentation for metadata budgets and shared context governance checks.
|
|
36
|
+
|
|
9
37
|
## [0.9.0] - 2026-07-03
|
|
10
38
|
|
|
11
39
|
### Added
|
|
@@ -159,7 +187,9 @@ Tag-only release. No GitHub Release entry was published for this version.
|
|
|
159
187
|
- Added metadata governance, advisory diagnostics, local path checks, and semantic split suggestions.
|
|
160
188
|
- Added the initial project documentation, architecture notes, package metadata, tests, and license.
|
|
161
189
|
|
|
162
|
-
[Unreleased]: https://github.com/KazuCocoa/renma/compare/v0.
|
|
190
|
+
[Unreleased]: https://github.com/KazuCocoa/renma/compare/v0.11.0...HEAD
|
|
191
|
+
[0.11.0]: https://github.com/KazuCocoa/renma/compare/v0.10.0...v0.11.0
|
|
192
|
+
[0.10.0]: https://github.com/KazuCocoa/renma/compare/v0.9.0...v0.10.0
|
|
163
193
|
[0.9.0]: https://github.com/KazuCocoa/renma/compare/v0.8.1...v0.9.0
|
|
164
194
|
[0.8.1]: https://github.com/KazuCocoa/renma/compare/v0.8.0...v0.8.1
|
|
165
195
|
[0.8.0]: https://github.com/KazuCocoa/renma/compare/v0.7.0...v0.8.0
|
package/README.md
CHANGED
|
@@ -47,6 +47,9 @@ Tools
|
|
|
47
47
|
Skills
|
|
48
48
|
agent-facing entrypoints that route an agent toward a task
|
|
49
49
|
|
|
50
|
+
Context Lenses
|
|
51
|
+
purpose-oriented interpretation layers over context assets
|
|
52
|
+
|
|
50
53
|
Context Assets
|
|
51
54
|
Shared domain, product, testing, platform, and tool knowledge
|
|
52
55
|
|
|
@@ -57,7 +60,7 @@ Repository
|
|
|
57
60
|
Git-reviewed source of truth for agent-consumable knowledge
|
|
58
61
|
```
|
|
59
62
|
|
|
60
|
-
Tools decide what to do at runtime. Skills tell an agent when and how to use a capability. Context assets hold reusable knowledge. Renma catalogs and validates the layer underneath so tools and agents are not guessing from stale, orphaned, duplicated, or unowned files.
|
|
63
|
+
Tools decide what to do at runtime. Skills tell an agent when and how to use a capability. Context lenses describe purpose-oriented interpretation over reusable knowledge. Context assets hold that reusable knowledge. Renma catalogs and validates the layer underneath so tools and agents are not guessing from stale, orphaned, duplicated, or unowned files.
|
|
61
64
|
|
|
62
65
|
## How Renma Relates to RAG and Agent Memory
|
|
63
66
|
|
|
@@ -119,9 +122,13 @@ contexts/
|
|
|
119
122
|
checkout/
|
|
120
123
|
payment-api-contracts.md
|
|
121
124
|
known-risk-patterns.md
|
|
125
|
+
|
|
126
|
+
lenses/
|
|
127
|
+
testing/
|
|
128
|
+
spec-review-boundary-values.md
|
|
122
129
|
```
|
|
123
130
|
|
|
124
|
-
`contexts/` is preferred. `context/` is also scanned for compatibility. Files under either root are cataloged as first-class `context` assets, while
|
|
131
|
+
`contexts/` is preferred. `context/` is also scanned for compatibility. Files under either root are cataloged as first-class `context` assets, while experimental `context_lens` assets live under `lenses/` or opt in from context files with `type: context_lens`. Skill-local `references/` remain supported as `reference` assets.
|
|
125
132
|
|
|
126
133
|
## What Renma Does Today
|
|
127
134
|
|
|
@@ -213,11 +220,12 @@ node dist/index.js readiness .
|
|
|
213
220
|
node dist/index.js diff . --from main --to HEAD --format markdown
|
|
214
221
|
```
|
|
215
222
|
|
|
216
|
-
Author a skill or context
|
|
223
|
+
Author a skill, context asset, or context lens with `scaffold`:
|
|
217
224
|
|
|
218
225
|
```bash
|
|
219
226
|
npx renma scaffold skill skills/testing/spec-review/SKILL.md --id skill.testing.spec-review --title "Spec Review" --owner qa-platform --tags testing,spec-review
|
|
220
227
|
npx renma scaffold context contexts/testing/boundary-value-analysis.md --id context.testing.boundary-value-analysis --title "Boundary Value Analysis" --owner qa-platform --tags testing
|
|
228
|
+
npx renma scaffold context_lens lenses/testing/spec-review-boundary-values.md --id lens.testing.spec-review.boundary-values --title "Spec Review Boundary Values Lens" --owner qa-platform --tags testing,spec-review
|
|
221
229
|
```
|
|
222
230
|
|
|
223
231
|
Inspect a focused graph for the new skill:
|
|
@@ -300,10 +308,11 @@ AGENTS.md
|
|
|
300
308
|
README.md
|
|
301
309
|
context/**/*.md
|
|
302
310
|
contexts/**/*.md
|
|
311
|
+
lenses/**/*.md
|
|
303
312
|
tools/**/*
|
|
304
313
|
```
|
|
305
314
|
|
|
306
|
-
Renma can still discover legacy skill-local support files for compatibility, but canonical reusable knowledge belongs in `contexts
|
|
315
|
+
Renma can still discover legacy skill-local support files for compatibility, but canonical reusable knowledge belongs in `contexts/`, experimental interpretation layers belong in `lenses/`, and helper implementations belong in `tools/`. Shared knowledge that is reused across skills should usually move into `contexts/` so it can have its own owner, lifecycle, dependencies, and review history.
|
|
307
316
|
|
|
308
317
|
## Configuration
|
|
309
318
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog-conflicts.d.ts","sourceRoot":"","sources":["../src/catalog-conflicts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAY,MAAM,YAAY,CAAC;AAEvD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,UAAU,EAAE,CAiCzE"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export function conflictDiagnostics(entries) {
|
|
2
|
+
const diagnostics = [];
|
|
3
|
+
const entriesById = new Map(entries.map((entry) => [entry.id, entry]));
|
|
4
|
+
const conflictPairs = new Set();
|
|
5
|
+
for (const entry of entries) {
|
|
6
|
+
for (const [index, targetId] of entry.metadata.conflicts.entries()) {
|
|
7
|
+
if (targetId === entry.id) {
|
|
8
|
+
diagnostics.push({
|
|
9
|
+
severity: "warning",
|
|
10
|
+
path: entry.sourcePath,
|
|
11
|
+
message: `Asset conflicts metadata references itself: "${targetId}".`,
|
|
12
|
+
evidence: metadataListEvidence(entry, "conflicts", index),
|
|
13
|
+
});
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
if (!entriesById.has(targetId)) {
|
|
17
|
+
diagnostics.push({
|
|
18
|
+
severity: "warning",
|
|
19
|
+
path: entry.sourcePath,
|
|
20
|
+
message: `Asset conflicts target "${targetId}" does not match a catalog entry.`,
|
|
21
|
+
evidence: metadataListEvidence(entry, "conflicts", index),
|
|
22
|
+
});
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
conflictPairs.add(pairKey(entry.id, targetId));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
diagnostics.push(...requiredConflictDiagnostics(entries, conflictPairs));
|
|
29
|
+
return diagnostics;
|
|
30
|
+
}
|
|
31
|
+
function requiredConflictDiagnostics(entries, conflictPairs) {
|
|
32
|
+
const diagnostics = [];
|
|
33
|
+
for (const entry of entries) {
|
|
34
|
+
if (entry.kind !== "skill")
|
|
35
|
+
continue;
|
|
36
|
+
for (let leftIndex = 0; leftIndex < entry.requiredContext.length; leftIndex += 1) {
|
|
37
|
+
const left = entry.requiredContext[leftIndex];
|
|
38
|
+
if (left === undefined)
|
|
39
|
+
continue;
|
|
40
|
+
for (let rightIndex = leftIndex + 1; rightIndex < entry.requiredContext.length; rightIndex += 1) {
|
|
41
|
+
const right = entry.requiredContext[rightIndex];
|
|
42
|
+
if (right === undefined)
|
|
43
|
+
continue;
|
|
44
|
+
if (!conflictPairs.has(pairKey(left, right)))
|
|
45
|
+
continue;
|
|
46
|
+
diagnostics.push({
|
|
47
|
+
severity: "warning",
|
|
48
|
+
path: entry.sourcePath,
|
|
49
|
+
message: `Skill requires conflicting context assets "${left}" and "${right}".`,
|
|
50
|
+
evidence: metadataListEvidence(entry, "requires_context", rightIndex),
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return diagnostics;
|
|
56
|
+
}
|
|
57
|
+
function pairKey(left, right) {
|
|
58
|
+
return [left, right].sort().join("\u0000");
|
|
59
|
+
}
|
|
60
|
+
function metadataListEvidence(entry, fieldKey, index) {
|
|
61
|
+
const item = entry.metadataListItems[fieldKey]?.[index];
|
|
62
|
+
if (item) {
|
|
63
|
+
return {
|
|
64
|
+
path: item.path,
|
|
65
|
+
startLine: item.startLine,
|
|
66
|
+
endLine: item.endLine,
|
|
67
|
+
snippet: item.raw,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const field = entry.metadataFields[fieldKey];
|
|
71
|
+
if (field) {
|
|
72
|
+
return {
|
|
73
|
+
path: field.path,
|
|
74
|
+
startLine: field.startLine,
|
|
75
|
+
endLine: field.endLine,
|
|
76
|
+
snippet: field.raw,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
path: entry.sourcePath,
|
|
81
|
+
startLine: 1,
|
|
82
|
+
endLine: 1,
|
|
83
|
+
snippet: `${fieldKey} metadata`,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=catalog-conflicts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog-conflicts.js","sourceRoot":"","sources":["../src/catalog-conflicts.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,mBAAmB,CAAC,OAAuB;IACzD,MAAM,WAAW,GAAiB,EAAE,CAAC;IACrC,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACvE,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;IAExC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,KAAK,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,EAAE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AK,GAAG,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC7C,IAAI,KAAK,EAAE,CAAC;QACV,OAAO;YACL,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,OAAO,EAAE,KAAK,CAAC,GAAG;SACnB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,UAAU;QACtB,SAAS,EAAE,CAAC;QACZ,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,GAAG,QAAQ,WAAW;KAChC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog-lifecycle.d.ts","sourceRoot":"","sources":["../src/catalog-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,YAAY,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAY,MAAM,YAAY,CAAC;AAOvD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,UAAU,EAAE,CAyD1E"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
const ACTIVE_STATUSES = new Set(["experimental", "stable"]);
|
|
2
|
+
const INACTIVE_STATUSES = new Set(["deprecated", "archived"]);
|
|
3
|
+
const MISSING_SUPERSEDED_BY_MESSAGE = "Deprecated shared context asset is missing superseded_by metadata.";
|
|
4
|
+
export function lifecycleDiagnostics(entries) {
|
|
5
|
+
const diagnostics = [];
|
|
6
|
+
const entriesById = new Map(entries.map((entry) => [entry.id, entry]));
|
|
7
|
+
for (const entry of entries) {
|
|
8
|
+
if (!isGovernedContext(entry))
|
|
9
|
+
continue;
|
|
10
|
+
if (entry.metadata.status === "deprecated" &&
|
|
11
|
+
entry.metadata.supersededBy.length === 0) {
|
|
12
|
+
diagnostics.push({
|
|
13
|
+
severity: "warning",
|
|
14
|
+
path: entry.sourcePath,
|
|
15
|
+
message: MISSING_SUPERSEDED_BY_MESSAGE,
|
|
16
|
+
evidence: defaultMetadataEvidence(entry, "missing superseded_by metadata"),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
for (const [index, targetId] of entry.metadata.supersededBy.entries()) {
|
|
20
|
+
if (targetId === entry.id) {
|
|
21
|
+
diagnostics.push({
|
|
22
|
+
severity: "warning",
|
|
23
|
+
path: entry.sourcePath,
|
|
24
|
+
message: selfReferenceMessage(targetId),
|
|
25
|
+
evidence: metadataListEvidence(entry, "superseded_by", index),
|
|
26
|
+
});
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const target = entriesById.get(targetId);
|
|
30
|
+
if (!target) {
|
|
31
|
+
diagnostics.push({
|
|
32
|
+
severity: "warning",
|
|
33
|
+
path: entry.sourcePath,
|
|
34
|
+
message: missingTargetMessage(targetId),
|
|
35
|
+
evidence: metadataListEvidence(entry, "superseded_by", index),
|
|
36
|
+
});
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (isInactiveStatus(target.metadata.status)) {
|
|
40
|
+
diagnostics.push({
|
|
41
|
+
severity: "warning",
|
|
42
|
+
path: entry.sourcePath,
|
|
43
|
+
message: inactiveTargetMessage(targetId, target.metadata.status),
|
|
44
|
+
evidence: metadataListEvidence(entry, "superseded_by", index),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
diagnostics.push(...supersessionCycleDiagnostics(entries, entriesById));
|
|
50
|
+
return diagnostics;
|
|
51
|
+
}
|
|
52
|
+
function supersessionCycleDiagnostics(entries, entriesById) {
|
|
53
|
+
const diagnostics = [];
|
|
54
|
+
const reported = new Set();
|
|
55
|
+
for (const entry of entries) {
|
|
56
|
+
if (!isGovernedContext(entry))
|
|
57
|
+
continue;
|
|
58
|
+
if (entry.metadata.supersededBy.length === 0)
|
|
59
|
+
continue;
|
|
60
|
+
const path = [];
|
|
61
|
+
const cycleEntry = firstCycleEntry(entry, entriesById, path);
|
|
62
|
+
if (!cycleEntry)
|
|
63
|
+
continue;
|
|
64
|
+
const cycleKey = [...new Set(path.slice(path.indexOf(cycleEntry.id)))]
|
|
65
|
+
.sort()
|
|
66
|
+
.join(" -> ");
|
|
67
|
+
if (reported.has(cycleKey))
|
|
68
|
+
continue;
|
|
69
|
+
reported.add(cycleKey);
|
|
70
|
+
diagnostics.push({
|
|
71
|
+
severity: "warning",
|
|
72
|
+
path: entry.sourcePath,
|
|
73
|
+
message: cycleMessage(cycleEntry.id),
|
|
74
|
+
evidence: metadataListEvidence(entry, "superseded_by", 0),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
return diagnostics;
|
|
78
|
+
}
|
|
79
|
+
function firstCycleEntry(entry, entriesById, path) {
|
|
80
|
+
if (path.includes(entry.id))
|
|
81
|
+
return entry;
|
|
82
|
+
path.push(entry.id);
|
|
83
|
+
for (const targetId of entry.metadata.supersededBy) {
|
|
84
|
+
const target = entriesById.get(targetId);
|
|
85
|
+
if (!target || !isGovernedContext(target))
|
|
86
|
+
continue;
|
|
87
|
+
if (isActiveStatus(target.metadata.status))
|
|
88
|
+
continue;
|
|
89
|
+
const cycleEntry = firstCycleEntry(target, entriesById, path);
|
|
90
|
+
if (cycleEntry)
|
|
91
|
+
return cycleEntry;
|
|
92
|
+
}
|
|
93
|
+
path.pop();
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
function isGovernedContext(entry) {
|
|
97
|
+
return (entry.kind === "context" &&
|
|
98
|
+
entry.id.startsWith("context.") &&
|
|
99
|
+
Boolean(entry.metadata.owner) &&
|
|
100
|
+
entry.metadata.whenToUse.length > 0 &&
|
|
101
|
+
entry.metadata.whenNotToUse.length > 0);
|
|
102
|
+
}
|
|
103
|
+
function isActiveStatus(status) {
|
|
104
|
+
return status !== undefined && ACTIVE_STATUSES.has(status);
|
|
105
|
+
}
|
|
106
|
+
function isInactiveStatus(status) {
|
|
107
|
+
return status !== undefined && INACTIVE_STATUSES.has(status);
|
|
108
|
+
}
|
|
109
|
+
function selfReferenceMessage(targetId) {
|
|
110
|
+
return `Shared context asset superseded_by references itself: "${targetId}".`;
|
|
111
|
+
}
|
|
112
|
+
function missingTargetMessage(targetId) {
|
|
113
|
+
return `Shared context asset superseded_by target "${targetId}" does not match a catalog entry.`;
|
|
114
|
+
}
|
|
115
|
+
function inactiveTargetMessage(targetId, status) {
|
|
116
|
+
return `Shared context asset superseded_by target "${targetId}" resolves to an inactive asset with status "${status}".`;
|
|
117
|
+
}
|
|
118
|
+
function cycleMessage(entryId) {
|
|
119
|
+
return `Shared context asset superseded_by chain forms a cycle involving "${entryId}".`;
|
|
120
|
+
}
|
|
121
|
+
function metadataListEvidence(entry, fieldKey, index) {
|
|
122
|
+
const item = entry.metadataListItems[fieldKey]?.[index];
|
|
123
|
+
if (item) {
|
|
124
|
+
return {
|
|
125
|
+
path: item.path,
|
|
126
|
+
startLine: item.startLine,
|
|
127
|
+
endLine: item.endLine,
|
|
128
|
+
snippet: item.raw,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
const field = entry.metadataFields[fieldKey];
|
|
132
|
+
if (field) {
|
|
133
|
+
return {
|
|
134
|
+
path: field.path,
|
|
135
|
+
startLine: field.startLine,
|
|
136
|
+
endLine: field.endLine,
|
|
137
|
+
snippet: field.raw,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
return defaultMetadataEvidence(entry, `missing ${fieldKey} metadata`);
|
|
141
|
+
}
|
|
142
|
+
function defaultMetadataEvidence(entry, snippet) {
|
|
143
|
+
return {
|
|
144
|
+
path: entry.sourcePath,
|
|
145
|
+
startLine: 1,
|
|
146
|
+
endLine: 1,
|
|
147
|
+
snippet,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=catalog-lifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog-lifecycle.js","sourceR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AAC1F,CAAC;AAED,SAAS,oBAAoB,CAC3B,KAAmB,EACnB,QAAgB,EAChB,KAAa;IAEb,MAAM,IAAI,GAAG,KAAK,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IACxD,IAAI,IAAI,EAAE,CAAC;QACT,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI,CAAC,GAAG;SAClB,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC7C,IAAI,KAAK,EAAE,CAAC;QACV,OAAO;YACL,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,OAAO,EAAE,KAAK,CAAC,GAAG;SACnB,CAAC;IACJ,CAAC;IAED,OAAO,uBAAuB,CAAC,KAAK,EAAE,WAAW,QAAQ,WAAW,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,uBAAuB,CAC9B,KAAmB,EACnB,OAAe;IAEf,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,UAAU;QACtB,SAAS,EAAE,CAAC;QACZ,OAAO,EAAE,CAAC;QACV,OAAO;KACR,CAAC;AACJ,CAAC"}
|
package/dist/catalog.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,OAAO,EAIR,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,UAAU,EAAY,cAAc,EAAE,MAAM,YAAY,CAAC;AAUvE,wFAAwF;AACxF,wBAAgB,YAAY,CAAC,SAAS,EAAE,cAAc,EAAE,GAAG;IACzD,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B,CAsEA"}
|