renma 0.17.0 → 0.18.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 +123 -1
- package/README.md +11 -1
- package/architecture.md +14 -4
- package/design.md +13 -2
- package/dist/agent-skills.d.ts +1 -1
- package/dist/agent-skills.d.ts.map +1 -1
- package/dist/agent-skills.js +28 -8
- package/dist/agent-skills.js.map +1 -1
- package/dist/catalog.d.ts +1 -1
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +120 -12
- package/dist/catalog.js.map +1 -1
- package/dist/cli-help.d.ts +9 -5
- package/dist/cli-help.d.ts.map +1 -1
- package/dist/cli-help.js +9 -0
- package/dist/cli-help.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +23 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/bom.d.ts +6 -3
- package/dist/commands/bom.d.ts.map +1 -1
- package/dist/commands/bom.js +27 -7
- package/dist/commands/bom.js.map +1 -1
- package/dist/commands/catalog.d.ts +1 -1
- package/dist/commands/catalog.d.ts.map +1 -1
- package/dist/commands/catalog.js +7 -1
- package/dist/commands/catalog.js.map +1 -1
- package/dist/commands/ci-report.d.ts.map +1 -1
- package/dist/commands/ci-report.js +18 -5
- package/dist/commands/ci-report.js.map +1 -1
- package/dist/commands/diff.js +8 -2
- package/dist/commands/diff.js.map +1 -1
- package/dist/commands/graph.d.ts +6 -2
- package/dist/commands/graph.d.ts.map +1 -1
- package/dist/commands/graph.js +23 -2
- package/dist/commands/graph.js.map +1 -1
- package/dist/commands/inspect.d.ts.map +1 -1
- package/dist/commands/inspect.js +2 -0
- package/dist/commands/inspect.js.map +1 -1
- package/dist/commands/ownership.d.ts +4 -3
- package/dist/commands/ownership.d.ts.map +1 -1
- package/dist/commands/ownership.js +27 -23
- package/dist/commands/ownership.js.map +1 -1
- package/dist/commands/readiness.d.ts +2 -1
- package/dist/commands/readiness.d.ts.map +1 -1
- package/dist/commands/readiness.js +98 -30
- package/dist/commands/readiness.js.map +1 -1
- package/dist/commands/scaffold.d.ts +3 -0
- package/dist/commands/scaffold.d.ts.map +1 -1
- package/dist/commands/scaffold.js +14 -0
- package/dist/commands/scaffold.js.map +1 -1
- package/dist/commands/suggest-metadata.d.ts.map +1 -1
- package/dist/commands/suggest-metadata.js +2 -0
- package/dist/commands/suggest-metadata.js.map +1 -1
- package/dist/commands/trust-graph.d.ts.map +1 -1
- package/dist/commands/trust-graph.js +12 -0
- package/dist/commands/trust-graph.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +10 -3
- package/dist/config.js.map +1 -1
- package/dist/diagnostic-ids.d.ts +8 -0
- package/dist/diagnostic-ids.d.ts.map +1 -1
- package/dist/diagnostic-ids.js +8 -0
- package/dist/diagnostic-ids.js.map +1 -1
- package/dist/discovery.d.ts +5 -0
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +108 -65
- package/dist/discovery.js.map +1 -1
- package/dist/markdown.d.ts.map +1 -1
- package/dist/markdown.js +15 -0
- package/dist/markdown.js.map +1 -1
- package/dist/model.d.ts +17 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +4 -1
- package/dist/model.js.map +1 -1
- package/dist/quality-profile.d.ts +91 -0
- package/dist/quality-profile.d.ts.map +1 -0
- package/dist/quality-profile.js +91 -0
- package/dist/quality-profile.js.map +1 -0
- package/dist/repeated-context.d.ts.map +1 -1
- package/dist/repeated-context.js +38 -83
- package/dist/repeated-context.js.map +1 -1
- package/dist/repository-boundary.d.ts +30 -0
- package/dist/repository-boundary.d.ts.map +1 -0
- package/dist/repository-boundary.js +116 -0
- package/dist/repository-boundary.js.map +1 -0
- package/dist/repository-evidence.d.ts +2 -0
- package/dist/repository-evidence.d.ts.map +1 -1
- package/dist/repository-evidence.js +6 -4
- package/dist/repository-evidence.js.map +1 -1
- package/dist/repository-paths.d.ts +6 -2
- package/dist/repository-paths.d.ts.map +1 -1
- package/dist/repository-paths.js +75 -24
- package/dist/repository-paths.js.map +1 -1
- package/dist/rules.d.ts +2 -0
- package/dist/rules.d.ts.map +1 -1
- package/dist/rules.js +263 -176
- package/dist/rules.js.map +1 -1
- package/dist/scanner.d.ts.map +1 -1
- package/dist/scanner.js +5 -1
- package/dist/scanner.js.map +1 -1
- package/dist/security-diagnostics.d.ts.map +1 -1
- package/dist/security-diagnostics.js +95 -30
- package/dist/security-diagnostics.js.map +1 -1
- package/dist/security-diff.d.ts +5 -2
- package/dist/security-diff.d.ts.map +1 -1
- package/dist/security-diff.js +20 -4
- package/dist/security-diff.js.map +1 -1
- package/dist/security-policy-inventory.d.ts +15 -3
- package/dist/security-policy-inventory.d.ts.map +1 -1
- package/dist/security-policy-inventory.js +123 -26
- package/dist/security-policy-inventory.js.map +1 -1
- package/dist/security-policy.d.ts +7 -0
- package/dist/security-policy.d.ts.map +1 -1
- package/dist/security-policy.js +70 -7
- package/dist/security-policy.js.map +1 -1
- package/dist/security-posture.d.ts.map +1 -1
- package/dist/security-posture.js +2 -1
- package/dist/security-posture.js.map +1 -1
- package/dist/skill-migration.js +2 -0
- package/dist/skill-migration.js.map +1 -1
- package/dist/static-support.d.ts +13 -0
- package/dist/static-support.d.ts.map +1 -0
- package/dist/static-support.js +284 -0
- package/dist/static-support.js.map +1 -0
- package/dist/token-estimator.d.ts +21 -0
- package/dist/token-estimator.d.ts.map +1 -0
- package/dist/token-estimator.js +84 -0
- package/dist/token-estimator.js.map +1 -0
- package/dist/trust-graph.d.ts +3 -3
- package/dist/trust-graph.d.ts.map +1 -1
- package/dist/trust-graph.js +69 -10
- package/dist/trust-graph.js.map +1 -1
- package/dist/types.d.ts +6 -1
- package/dist/types.d.ts.map +1 -1
- package/docs/README.md +13 -7
- package/docs/advanced-skill-authoring.md +16 -9
- package/docs/agent-skills-compatibility.md +10 -2
- package/docs/authoring-guide.md +62 -4
- package/docs/diagnostics.md +44 -11
- package/docs/quality-profile.md +123 -0
- package/docs/repository-context-bom.md +67 -8
- package/docs/schemas/repository-context-bom-v2.schema.json +648 -0
- package/docs/schemas/trust-graph-v2.schema.json +301 -0
- package/docs/security-policy.md +21 -5
- package/docs/trust-graph.md +47 -0
- package/docs/user-manual.md +34 -5
- package/examples/context-repo/README.md +6 -7
- package/examples/context-repo/contexts/domain/payment/idempotency.md +7 -0
- package/examples/context-repo/contexts/testing/boundary-value-analysis.md +7 -0
- package/examples/context-repo/contexts/testing/negative-testing.md +7 -0
- package/examples/context-repo/skills/testing/spec-review/SKILL.md +5 -0
- package/package.json +3 -1
- package/plan-discovery.md +24 -15
- package/plan.md +59 -119
- package/scripts/verify-package.mjs +8 -1
package/dist/rules.js
CHANGED
|
@@ -2,96 +2,52 @@ import path from "node:path";
|
|
|
2
2
|
import { resolvedAgentSkillDescription } from "./agent-skills.js";
|
|
3
3
|
import { addDaysIsoDate, isIsoDate, parseDayDuration, todayIsoDate, } from "./freshness.js";
|
|
4
4
|
import { DIAGNOSTIC_IDS } from "./diagnostic-ids.js";
|
|
5
|
-
import { classifyRepositorySkillEntrypointPath, classifyRepositorySkillPath, normalizeRepositoryRelativePath, } from "./discovery.js";
|
|
5
|
+
import { classifyRepositorySkillEntrypointPath, classifyRepositorySkillPath, logicalSkillDirectory, normalizeRepositoryRelativePath, } from "./discovery.js";
|
|
6
6
|
import { helperScriptPath, resolveHelperScriptPath, } from "./repository-paths.js";
|
|
7
7
|
import { parseAssetMetadata } from "./metadata.js";
|
|
8
8
|
import { runRuleRegistry } from "./rule-engine.js";
|
|
9
|
+
import { DEFAULT_QUALITY_PROFILE } from "./quality-profile.js";
|
|
10
|
+
import { estimateTokens, markdownBody } from "./token-estimator.js";
|
|
11
|
+
import { staticSupportReferences } from "./static-support.js";
|
|
9
12
|
const SECRET_PATTERN = /\b(?:password|passwd|token|api[_-]?key|secret|credential|private[_-]?key)\b\s*[:=]\s*["']?([A-Za-z0-9_./+=-]{8,})/i;
|
|
10
13
|
const PRIVATE_KEY_PATTERN = /-----BEGIN (?:RSA |OPENSSH |EC |DSA )?PRIVATE KEY-----/;
|
|
11
14
|
const REMOTE_PATTERN = /\b(?:curl|wget)\b.*(?:\|\s*(?:sh|bash)|\b(?:example\.com|prod|production|--insecure|-k)\b)|\b(?:ssh|scp)\b.*\b(?:example\.com|prod|production|root@|--insecure|-k|StrictHostKeyChecking=no|UserKnownHostsFile=\/dev\/null)\b/i;
|
|
12
15
|
const ENV_COPY_PATTERN = /\b(?:process\.env|env)\b.*\b(?:spawn|exec|execFile|system|subprocess|child_process)\b|\b(?:spawn|exec|execFile|system|subprocess|child_process)\b.*\b(?:process\.env|env)\b/i;
|
|
13
16
|
const USER_LOCAL_PATH_PATTERN = /(?:^|[^a-z0-9_])(?:\/Users\/[^\s/\\]+|\/home\/[^\s/\\]+|[A-Za-z]:\\Users\\[^\s\\]+)(?:\/|$)/iu;
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const REUSABLE_CONTEXT_MIN_LINES = 24;
|
|
17
|
-
const REUSABLE_CONTEXT_MIN_TOKENS = 180;
|
|
17
|
+
const QUALITY = DEFAULT_QUALITY_PROFILE;
|
|
18
|
+
const MAX_LOCAL_SUPPORT_REFERENCE_HOPS = QUALITY.agentSkills.recommendedReferenceDepth + 1;
|
|
18
19
|
const REQUIRED_INPUTS_PATTERN = /\b(?:required inputs?|inputs|input requirements?|required information|prerequisites?|required context|required files|required permissions?|permission requirements?|environment requirements?|before running,\s*provide|before you begin,\s*provide|the user must provide|needs the following|target files|permissions required|environment required)\b|\brequires:/;
|
|
19
20
|
const COMPLETION_CRITERIA_PATTERN = /\b(?:completion criteria|completion checklist|success criteria|success requirements|done criteria|done when|definition of done|acceptance criteria|deliverables?|final response|final answer|expected outcomes?|expected results?|expected output|required output|output requirements?|report should include|patch should include|when complete|workflow is complete|the workflow is complete after|task is complete|counts as complete|completion requirements?|stop when|do not finish until)\b/;
|
|
20
|
-
const REUSABLE_CONTEXT_MIN_SIGNALS = 3;
|
|
21
|
-
const SUPPORT_SHARED_CONTEXT_MIN_LINES = 18;
|
|
22
|
-
const SUPPORT_SHARED_CONTEXT_MIN_TOKENS = 140;
|
|
23
|
-
const SUPPORT_SHARED_CONTEXT_MIN_HEADINGS = 2;
|
|
24
|
-
const SUPPORT_SHARED_CONTEXT_MIN_PHRASES = 2;
|
|
25
21
|
const REUSABLE_CONTEXT_HEADING_PATTERNS = [
|
|
26
|
-
[/\
|
|
27
|
-
[/\
|
|
28
|
-
[/\bconfiguration\b/i, "Configuration"],
|
|
29
|
-
[/\benvironment\b/i, "Environment"],
|
|
30
|
-
[/\bprerequisites?\b/i, "Prerequisites"],
|
|
31
|
-
[/\bplatform\b/i, "Platform"],
|
|
32
|
-
[/\btroubleshooting\b/i, "Troubleshooting"],
|
|
22
|
+
[/\bplatform facts?\b/i, "Platform Facts"],
|
|
23
|
+
[/\breusable troubleshooting\b/i, "Reusable Troubleshooting"],
|
|
33
24
|
[/\bknown issues?\b/i, "Known Issues"],
|
|
34
|
-
[/\blimitations?\b/i, "Limitations"],
|
|
35
|
-
[/\bbest practices?\b/i, "Best Practices"],
|
|
36
|
-
[/\btesting heuristics?\b/i, "Testing Heuristics"],
|
|
37
|
-
[/\btest strategy\b/i, "Test Strategy"],
|
|
38
|
-
[/\bverification\b/i, "Verification"],
|
|
39
|
-
[/\bexamples?\b/i, "Examples"],
|
|
40
|
-
[/\bedge cases?\b/i, "Edge Cases"],
|
|
41
|
-
[/\brisks?\b/i, "Risks"],
|
|
42
25
|
[/\bdomain rules?\b/i, "Domain Rules"],
|
|
43
|
-
[/\
|
|
44
|
-
[/\
|
|
26
|
+
[/\bcompatibility (?:matrix|matrices)\b/i, "Compatibility Matrix"],
|
|
27
|
+
[/\bproduct polic(?:y|ies)\b/i, "Product Policy"],
|
|
28
|
+
[/\bshared testing heuristics?\b/i, "Shared Testing Heuristics"],
|
|
45
29
|
];
|
|
46
30
|
const REUSABLE_CONTEXT_PHRASE_PATTERNS = [
|
|
47
|
-
[/\buse this when\b/i, "use this when"],
|
|
48
31
|
[/\bknown issue\b/i, "known issue"],
|
|
49
|
-
[/\
|
|
50
|
-
[/\btroubleshooting\b/i, "troubleshooting"],
|
|
51
|
-
[/\bflaky\b/i, "flaky"],
|
|
52
|
-
[/\bretry\b/i, "retry"],
|
|
32
|
+
[/\breusable troubleshooting\b/i, "reusable troubleshooting"],
|
|
53
33
|
[/\bplatform-specific\b/i, "platform-specific"],
|
|
54
|
-
[/\
|
|
55
|
-
[/\
|
|
56
|
-
[/\
|
|
57
|
-
[/\bbest practice\b/i, "best practice"],
|
|
58
|
-
[/\bdo not\b/i, "do not"],
|
|
59
|
-
[/\bavoid\b/i, "avoid"],
|
|
60
|
-
[/\balways\b/i, "always"],
|
|
61
|
-
[/\bnever\b/i, "never"],
|
|
34
|
+
[/\bsource of truth\b/i, "source of truth"],
|
|
35
|
+
[/\bused by (?:multiple|several) skills\b/i, "cross-Skill use"],
|
|
36
|
+
[/\bshared (?:rule|policy|heuristic|knowledge)\b/i, "shared knowledge"],
|
|
62
37
|
];
|
|
63
38
|
const SUPPORT_SHARED_CONTEXT_HEADING_PATTERNS = [
|
|
64
39
|
...REUSABLE_CONTEXT_HEADING_PATTERNS,
|
|
65
|
-
[/\bdecision logic\b/i, "Decision Logic"],
|
|
66
|
-
[/\bsafety notes?\b/i, "Safety Notes"],
|
|
67
|
-
[/\bvalidation\b/i, "Validation"],
|
|
68
|
-
[/\boperating model\b/i, "Operating Model"],
|
|
69
40
|
[/\bpolicy\b/i, "Policy"],
|
|
70
|
-
[/\bguidelines?\b/i, "Guidelines"],
|
|
71
|
-
[/\bprocedures?\b/i, "Procedure"],
|
|
72
|
-
[/\bchecklist\b/i, "Checklist"],
|
|
73
41
|
[/\bcompatibility\b/i, "Compatibility"],
|
|
74
|
-
[/\
|
|
42
|
+
[/\bsource of truth\b/i, "Source of Truth"],
|
|
75
43
|
];
|
|
76
44
|
const SUPPORT_SHARED_CONTEXT_PHRASE_PATTERNS = [
|
|
77
|
-
[/\bmust\b/i, "must"],
|
|
78
|
-
[/\bshould\b/i, "should"],
|
|
79
|
-
[/\balways\b/i, "always"],
|
|
80
|
-
[/\bnever\b/i, "never"],
|
|
81
|
-
[/\bavoid\b/i, "avoid"],
|
|
82
|
-
[/\bprefer\b/i, "prefer"],
|
|
83
|
-
[/\bdo not\b/i, "do not"],
|
|
84
|
-
[/\brequired\b/i, "required"],
|
|
85
|
-
[/\brecommended\b/i, "recommended"],
|
|
86
45
|
[/\bknown issue\b/i, "known issue"],
|
|
87
|
-
[/\
|
|
88
|
-
[/\
|
|
89
|
-
[/\
|
|
90
|
-
[/\
|
|
91
|
-
[/\
|
|
92
|
-
[/\bbest practice\b/i, "best practice"],
|
|
93
|
-
[/\bvalidate\b/i, "validate"],
|
|
94
|
-
[/\bverify\b/i, "verify"],
|
|
46
|
+
[/\breusable troubleshooting\b/i, "reusable troubleshooting"],
|
|
47
|
+
[/\bsource of truth\b/i, "source of truth"],
|
|
48
|
+
[/\bused by (?:multiple|several) skills\b/i, "cross-Skill use"],
|
|
49
|
+
[/\bindependent (?:owner|ownership|lifecycle)\b/i, "independent ownership"],
|
|
50
|
+
[/\bshared (?:rule|policy|heuristic|knowledge)\b/i, "shared knowledge"],
|
|
95
51
|
];
|
|
96
52
|
const NON_SEMANTIC_CONTEXT_PATH_SEGMENTS = new Set([
|
|
97
53
|
"promoted",
|
|
@@ -114,15 +70,10 @@ const NON_SEMANTIC_CONTEXT_PATH_SEGMENTS = new Set([
|
|
|
114
70
|
"candidate",
|
|
115
71
|
"candidates",
|
|
116
72
|
]);
|
|
117
|
-
const CONTEXT_TOKEN_LIMITS =
|
|
118
|
-
context: 1200,
|
|
119
|
-
profile: 500,
|
|
120
|
-
reference: 800,
|
|
121
|
-
example: 800,
|
|
122
|
-
};
|
|
73
|
+
const CONTEXT_TOKEN_LIMITS = QUALITY.contentTokenWarn;
|
|
123
74
|
/** Run all deterministic rules and return findings in stable source order. */
|
|
124
75
|
export function runRules(documents, config, catalog, options = {}) {
|
|
125
|
-
const findings = runRuleRegistry(documents, rulesForEvaluationDate(evaluationDay(options.evaluationDate), options.repositoryPaths), catalog, config);
|
|
76
|
+
const findings = runRuleRegistry(documents, rulesForEvaluationDate(evaluationDay(options.evaluationDate), options.repositoryPaths, options.repositoryPathStates), catalog, config);
|
|
126
77
|
return findings.sort((a, b) => {
|
|
127
78
|
const byPath = a.evidence.path.localeCompare(b.evidence.path);
|
|
128
79
|
if (byPath !== 0)
|
|
@@ -130,7 +81,7 @@ export function runRules(documents, config, catalog, options = {}) {
|
|
|
130
81
|
return a.evidence.startLine - b.evidence.startLine;
|
|
131
82
|
});
|
|
132
83
|
}
|
|
133
|
-
function rulesForEvaluationDate(evaluationDate, repositoryPaths) {
|
|
84
|
+
function rulesForEvaluationDate(evaluationDate, repositoryPaths, repositoryPathStates) {
|
|
134
85
|
return [
|
|
135
86
|
{
|
|
136
87
|
id: "strict-layout-policy",
|
|
@@ -153,7 +104,7 @@ function rulesForEvaluationDate(evaluationDate, repositoryPaths) {
|
|
|
153
104
|
},
|
|
154
105
|
{
|
|
155
106
|
id: "skill-local-support-reachability",
|
|
156
|
-
run: ({ documents }) => skillLocalSupportReachabilityFindings(documents),
|
|
107
|
+
run: ({ documents }) => skillLocalSupportReachabilityFindings(documents, repositoryPaths, repositoryPathStates),
|
|
157
108
|
},
|
|
158
109
|
{
|
|
159
110
|
id: "support-asset-shared-context-candidate",
|
|
@@ -646,33 +597,51 @@ function shapeFindings(document) {
|
|
|
646
597
|
const description = document.artifact.kind === "skill"
|
|
647
598
|
? (resolvedAgentSkillDescription(document) ?? "")
|
|
648
599
|
: (document.metadata.description ?? "");
|
|
649
|
-
|
|
600
|
+
// Skill budgets measure only Markdown after frontmatter. Agent Skills loads
|
|
601
|
+
// metadata separately, and Renma applies independent metadata budgets.
|
|
602
|
+
const bodyTokenCount = estimateTokens(markdownBody(document.artifact.content));
|
|
650
603
|
if (!description) {
|
|
651
604
|
findings.push(documentFinding(document, DIAGNOSTIC_IDS.QUAL_MISSING_DESCRIPTION, "Skill is missing an explicit description", "quality", "medium", "Add frontmatter description so agents can route to the skill intentionally."));
|
|
652
605
|
}
|
|
653
606
|
else if (document.artifact.kind === "skill" &&
|
|
654
|
-
|
|
655
|
-
|
|
607
|
+
QUALITY.descriptionMinChars > 0 &&
|
|
608
|
+
description.length < QUALITY.descriptionMinChars) {
|
|
609
|
+
findings.push(documentFinding(document, DIAGNOSTIC_IDS.QUAL_SHORT_DESCRIPTION, "Skill description is too short for routing clarity", "quality", "low", `Expand frontmatter description to at least ${QUALITY.descriptionMinChars} characters with usage routing guidance.`));
|
|
656
610
|
}
|
|
657
|
-
const reusableContextFinding = reusableContextCandidateFinding(document,
|
|
611
|
+
const reusableContextFinding = reusableContextCandidateFinding(document, bodyTokenCount);
|
|
658
612
|
if (reusableContextFinding)
|
|
659
613
|
findings.push(reusableContextFinding);
|
|
660
|
-
if (document.artifact.kind === "skill" &&
|
|
661
|
-
|
|
662
|
-
|
|
614
|
+
if (document.artifact.kind === "skill" &&
|
|
615
|
+
bodyTokenCount > QUALITY.skillTokenWarn) {
|
|
616
|
+
const limit = bodyTokenCount > QUALITY.skillTokenStrongWarn
|
|
617
|
+
? QUALITY.skillTokenStrongWarn
|
|
618
|
+
: QUALITY.skillTokenWarn;
|
|
619
|
+
const severity = bodyTokenCount > QUALITY.skillTokenStrongWarn ? "medium" : "low";
|
|
620
|
+
findings.push(documentFinding(document, DIAGNOSTIC_IDS.QUAL_SKILL_TOKEN_BUDGET, "Skill body exceeds advisory token budget", "quality", severity, "Review progressive disclosure without deleting workflow steps. Keep selection boundaries, read conditions, ordered workflow, constraints, and completion criteria in SKILL.md. Move Skill-specific conditional detail to references/, deterministic repeated implementation to scripts/, output material to assets/, and independently owned cross-Skill knowledge to contexts/.", {
|
|
621
|
+
whyItMatters: "Long Skill bodies can make activated workflows harder to navigate. Size is advisory evidence only; Agent Skills recommends staying under 5,000 tokens and Renma adds an earlier low review point at 2,000 estimated tokens.",
|
|
663
622
|
constraints: [
|
|
664
623
|
"Do not introduce runtime context resolution.",
|
|
665
624
|
"Do not create prompt packages.",
|
|
666
625
|
"Do not make Renma responsible for selecting context.",
|
|
667
|
-
"Preserve
|
|
668
|
-
"
|
|
626
|
+
"Preserve ordered workflow steps, constraints, and completion criteria.",
|
|
627
|
+
"Choose a destination by semantic ownership, not by size alone.",
|
|
669
628
|
],
|
|
670
629
|
verificationSteps: [
|
|
671
630
|
"Run renma scan.",
|
|
672
631
|
"Run any project-specific validation checks that apply to this repository.",
|
|
673
|
-
"Confirm
|
|
632
|
+
"Confirm any moved material remains statically reachable and semantically owned by its destination.",
|
|
674
633
|
],
|
|
675
|
-
llmHint: "
|
|
634
|
+
llmHint: "Review the Skill for progressive disclosure. Keep core workflow in SKILL.md; use references/ for local detail, scripts/ for deterministic implementation, assets/ for output resources, and contexts/ only for independently owned shared knowledge.",
|
|
635
|
+
details: {
|
|
636
|
+
measured: bodyTokenCount,
|
|
637
|
+
limit,
|
|
638
|
+
unit: "estimated_tokens",
|
|
639
|
+
profile: QUALITY.profile,
|
|
640
|
+
measurement: "markdown_body_after_frontmatter",
|
|
641
|
+
source: limit === QUALITY.skillTokenStrongWarn
|
|
642
|
+
? "agent_skills_recommendation_and_renma_severity"
|
|
643
|
+
: "renma_quality_policy",
|
|
644
|
+
},
|
|
676
645
|
}));
|
|
677
646
|
}
|
|
678
647
|
if (document.artifact.kind === "skill" &&
|
|
@@ -732,17 +701,25 @@ function shapeFindings(document) {
|
|
|
732
701
|
if (!/verify|validation|test|confirm result|expected output/.test(text)) {
|
|
733
702
|
findings.push(documentFinding(document, DIAGNOSTIC_IDS.QUAL_MISSING_VERIFICATION, "Skill lacks verification guidance", "quality", "medium", "State how to verify success with a command, check, or observable result."));
|
|
734
703
|
}
|
|
735
|
-
if (document.headings.length <
|
|
736
|
-
|
|
737
|
-
findings.push(documentFinding(document, DIAGNOSTIC_IDS.QUAL_LOW_HEADING_DENSITY, "Long instruction file has few headings", "structure", "low", "
|
|
704
|
+
if (document.headings.length < QUALITY.lowHeadingDensityMinHeadings &&
|
|
705
|
+
bodyTokenCount >= QUALITY.lowHeadingDensityMinTokens) {
|
|
706
|
+
findings.push(documentFinding(document, DIAGNOSTIC_IDS.QUAL_LOW_HEADING_DENSITY, "Long instruction file has few headings", "structure", "low", "Add task-oriented headings so agents can navigate the body reliably.", {
|
|
707
|
+
details: {
|
|
708
|
+
measured: bodyTokenCount,
|
|
709
|
+
limit: QUALITY.lowHeadingDensityMinTokens,
|
|
710
|
+
unit: "estimated_tokens",
|
|
711
|
+
profile: QUALITY.profile,
|
|
712
|
+
measurement: "markdown_body_after_frontmatter",
|
|
713
|
+
},
|
|
714
|
+
}));
|
|
738
715
|
}
|
|
739
716
|
return findings;
|
|
740
717
|
}
|
|
741
|
-
function reusableContextCandidateFinding(document,
|
|
718
|
+
function reusableContextCandidateFinding(document, estimatedTokens) {
|
|
742
719
|
if (document.artifact.kind !== "skill")
|
|
743
720
|
return undefined;
|
|
744
|
-
if (document.lines.length <
|
|
745
|
-
|
|
721
|
+
if (document.lines.length < QUALITY.reusableContextCandidate.minLines &&
|
|
722
|
+
estimatedTokens < QUALITY.reusableContextCandidate.minTokens)
|
|
746
723
|
return undefined;
|
|
747
724
|
const headingMatches = document.headings.flatMap((heading) => REUSABLE_CONTEXT_HEADING_PATTERNS.filter(([pattern]) => pattern.test(heading.text)).map(([, label]) => ({
|
|
748
725
|
label,
|
|
@@ -766,7 +743,10 @@ function reusableContextCandidateFinding(document, tokenCount) {
|
|
|
766
743
|
];
|
|
767
744
|
const phraseLabels = [...new Set(phraseMatches.map((match) => match.label))];
|
|
768
745
|
const signalCount = new Set([...headingLabels, ...phraseLabels]).size;
|
|
769
|
-
|
|
746
|
+
// All patterns above are reusable-knowledge evidence. Ordinary workflow
|
|
747
|
+
// headings such as Verification, Examples, Steps, Risks, and Constraints are
|
|
748
|
+
// intentionally excluded and cannot qualify a Skill by themselves.
|
|
749
|
+
if (signalCount < QUALITY.reusableContextCandidate.minSignals)
|
|
770
750
|
return undefined;
|
|
771
751
|
const evidenceLine = headingMatches[0]?.line ??
|
|
772
752
|
phraseMatches[0]?.line ??
|
|
@@ -784,26 +764,37 @@ function reusableContextCandidateFinding(document, tokenCount) {
|
|
|
784
764
|
: undefined,
|
|
785
765
|
].filter((part) => Boolean(part));
|
|
786
766
|
return {
|
|
787
|
-
id: DIAGNOSTIC_IDS.
|
|
788
|
-
title: "Skill may
|
|
767
|
+
id: DIAGNOSTIC_IDS.QUAL_SKILL_MIXED_RESPONSIBILITY,
|
|
768
|
+
title: "Skill may mix its workflow with reusable knowledge",
|
|
789
769
|
category: "maintenance",
|
|
790
770
|
severity: "low",
|
|
791
771
|
confidence: "medium",
|
|
792
772
|
evidence: evidence(document, evidenceLine, evidenceParts.join("; ")),
|
|
793
773
|
whyItMatters: "Reusable setup notes, troubleshooting, platform guidance, testing heuristics, or domain rules are easier to own, review, and reuse when they live in shared context assets instead of only inside one skill.",
|
|
794
|
-
remediation: "Review the matched headings and phrases.
|
|
774
|
+
remediation: "Review the matched headings and phrases. Promote content to contexts/ only when it needs cross-Skill reuse, independent ownership, lifecycle, or source-of-truth status; otherwise keep Skill-specific detail in SKILL.md or references/.",
|
|
795
775
|
constraints: [
|
|
796
776
|
"Do not make Renma select runtime context.",
|
|
797
777
|
"Do not assemble prompt packages.",
|
|
798
778
|
"Do not automatically rewrite or split skills.",
|
|
799
|
-
"Preserve SKILL.md as
|
|
779
|
+
"Preserve SKILL.md as a focused workflow entrypoint.",
|
|
800
780
|
"Give extracted context assets stable metadata such as id, owner, and status.",
|
|
801
781
|
],
|
|
802
782
|
verificationSteps: [
|
|
803
783
|
"Run renma scan.",
|
|
804
784
|
"Confirm the advisory is resolved or intentionally accepted after reusable knowledge is represented as shared context assets.",
|
|
805
785
|
],
|
|
806
|
-
llmHint: "
|
|
786
|
+
llmHint: "Check whether the matched knowledge is used across Skills or needs independent ownership. Use contexts/ only for shared knowledge; keep Skill-local procedures and edge cases in SKILL.md or references/.",
|
|
787
|
+
details: {
|
|
788
|
+
measured: estimatedTokens,
|
|
789
|
+
limit: QUALITY.reusableContextCandidate.minTokens,
|
|
790
|
+
unit: "estimated_tokens",
|
|
791
|
+
lines: document.lines.length,
|
|
792
|
+
minLines: QUALITY.reusableContextCandidate.minLines,
|
|
793
|
+
distinctSignals: signalCount,
|
|
794
|
+
minSignals: QUALITY.reusableContextCandidate.minSignals,
|
|
795
|
+
profile: QUALITY.profile,
|
|
796
|
+
measurement: "markdown_body_after_frontmatter",
|
|
797
|
+
},
|
|
807
798
|
};
|
|
808
799
|
}
|
|
809
800
|
function supportSharedContextCandidateFindings(document) {
|
|
@@ -815,9 +806,9 @@ function supportSharedContextCandidateFindings(document) {
|
|
|
815
806
|
!document.artifact.path.endsWith(".md")) {
|
|
816
807
|
return [];
|
|
817
808
|
}
|
|
818
|
-
const
|
|
819
|
-
if (document.lines.length <
|
|
820
|
-
|
|
809
|
+
const estimatedTokens = estimateTokens(markdownBody(document.artifact.content));
|
|
810
|
+
if (document.lines.length < QUALITY.sharedSupportCandidate.minLines &&
|
|
811
|
+
estimatedTokens < QUALITY.sharedSupportCandidate.minTokens) {
|
|
821
812
|
return [];
|
|
822
813
|
}
|
|
823
814
|
const contentLineIndexes = markdownBodyLineIndexes(document);
|
|
@@ -852,8 +843,10 @@ function supportSharedContextCandidateFindings(document) {
|
|
|
852
843
|
];
|
|
853
844
|
});
|
|
854
845
|
const sourceSignals = [...headingMatches, ...phraseMatches];
|
|
855
|
-
if (headingMatches.
|
|
856
|
-
|
|
846
|
+
if (new Set(headingMatches.map((match) => match.label)).size <
|
|
847
|
+
QUALITY.sharedSupportCandidate.minHeadings ||
|
|
848
|
+
new Set(phraseMatches.map((match) => match.label)).size <
|
|
849
|
+
QUALITY.sharedSupportCandidate.minPhrases) {
|
|
857
850
|
return [];
|
|
858
851
|
}
|
|
859
852
|
const evidenceMatches = sourceSignals
|
|
@@ -897,6 +890,19 @@ function supportSharedContextCandidateFindings(document) {
|
|
|
897
890
|
"Confirm reusable source-of-truth knowledge lives in contexts/ and skill-local references only contain local support guidance.",
|
|
898
891
|
],
|
|
899
892
|
llmHint: "Search the repository for similar headings, filenames, repeated procedures, commands, constraints, or overlapping guidance. If this support file appears reusable, propose a first-class context asset under contexts/, move the reusable details without losing information, keep truly local notes in the skill directory, and update declared context references.",
|
|
893
|
+
details: {
|
|
894
|
+
measured: estimatedTokens,
|
|
895
|
+
limit: QUALITY.sharedSupportCandidate.minTokens,
|
|
896
|
+
unit: "estimated_tokens",
|
|
897
|
+
lines: document.lines.length,
|
|
898
|
+
minLines: QUALITY.sharedSupportCandidate.minLines,
|
|
899
|
+
headings: new Set(headingMatches.map((match) => match.label)).size,
|
|
900
|
+
minHeadings: QUALITY.sharedSupportCandidate.minHeadings,
|
|
901
|
+
phrases: new Set(phraseMatches.map((match) => match.label)).size,
|
|
902
|
+
minPhrases: QUALITY.sharedSupportCandidate.minPhrases,
|
|
903
|
+
profile: QUALITY.profile,
|
|
904
|
+
measurement: "full_file",
|
|
905
|
+
},
|
|
900
906
|
},
|
|
901
907
|
];
|
|
902
908
|
}
|
|
@@ -1085,7 +1091,9 @@ function parentSkillPath(referencePath) {
|
|
|
1085
1091
|
: undefined;
|
|
1086
1092
|
}
|
|
1087
1093
|
function skillReferenceLine(skill, referencePath) {
|
|
1088
|
-
const skillDir =
|
|
1094
|
+
const skillDir = logicalSkillDirectory(skill.artifact.path);
|
|
1095
|
+
if (!skillDir)
|
|
1096
|
+
return undefined;
|
|
1089
1097
|
const relativePath = path.posix.relative(skillDir, referencePath);
|
|
1090
1098
|
const referencedTokens = [referencePath, relativePath];
|
|
1091
1099
|
for (const index of markdownBodyLineIndexes(skill)) {
|
|
@@ -1208,16 +1216,17 @@ function contextBudgetFindings(document) {
|
|
|
1208
1216
|
return [];
|
|
1209
1217
|
}
|
|
1210
1218
|
const limit = CONTEXT_TOKEN_LIMITS[document.artifact.kind];
|
|
1211
|
-
const
|
|
1212
|
-
if (
|
|
1219
|
+
const estimatedTokens = estimateTokens(document.artifact.content);
|
|
1220
|
+
if (estimatedTokens <= limit)
|
|
1213
1221
|
return [];
|
|
1214
1222
|
return [
|
|
1215
|
-
documentFinding(document, DIAGNOSTIC_IDS.QUAL_SUPPORT_ASSET_TOKEN_BUDGET, "Support asset exceeds token guidance", "quality", "low", `
|
|
1216
|
-
whyItMatters: "
|
|
1223
|
+
documentFinding(document, DIAGNOSTIC_IDS.QUAL_SUPPORT_ASSET_TOKEN_BUDGET, "Support asset exceeds token guidance", "quality", "low", `Review whether this ${document.artifact.kind} asset still has one coherent scope. Size alone does not require a split. Consider headings, read conditions, reference depth, mixed responsibilities, and maintained duplication before using \`renma suggest-semantic-split ${document.artifact.path}\`.`, {
|
|
1224
|
+
whyItMatters: "Large content assets deserve a low-advisory coherence review, but an intentionally focused asset can remain intact above the threshold.",
|
|
1217
1225
|
constraints: [
|
|
1218
1226
|
"Do not introduce runtime context resolution.",
|
|
1219
1227
|
"Do not create prompt packages.",
|
|
1220
|
-
"
|
|
1228
|
+
"Do not split based on size alone.",
|
|
1229
|
+
"Preserve concrete procedural steps losslessly if a semantic split is chosen.",
|
|
1221
1230
|
"Keep static references from the parent file or SKILL.md to every split part.",
|
|
1222
1231
|
],
|
|
1223
1232
|
verificationSteps: [
|
|
@@ -1225,7 +1234,14 @@ function contextBudgetFindings(document) {
|
|
|
1225
1234
|
"Run the repository-specific validation or test command, if one exists.",
|
|
1226
1235
|
"Confirm the finding is resolved or reduced and every split part remains reachable.",
|
|
1227
1236
|
],
|
|
1228
|
-
llmHint: "
|
|
1237
|
+
llmHint: "Review scope, headings, read conditions, reference depth, responsibilities, and duplication. Propose a semantic split only when those signals justify it.",
|
|
1238
|
+
details: {
|
|
1239
|
+
measured: estimatedTokens,
|
|
1240
|
+
limit,
|
|
1241
|
+
unit: "estimated_tokens",
|
|
1242
|
+
profile: QUALITY.profile,
|
|
1243
|
+
measurement: "full_file",
|
|
1244
|
+
},
|
|
1229
1245
|
}),
|
|
1230
1246
|
];
|
|
1231
1247
|
}
|
|
@@ -1239,19 +1255,31 @@ function profileFindings(document) {
|
|
|
1239
1255
|
documentFinding(document, DIAGNOSTIC_IDS.PROF_MISSING_BASE, "Profile overlay does not declare its base skill", "structure", "medium", "Declare the base skill or compatibility target so routing conflicts are auditable."),
|
|
1240
1256
|
];
|
|
1241
1257
|
}
|
|
1242
|
-
function skillLocalSupportReachabilityFindings(documents) {
|
|
1258
|
+
function skillLocalSupportReachabilityFindings(documents, repositoryPaths, repositoryPathStates) {
|
|
1243
1259
|
const skills = documents.filter((document) => document.artifact.kind === "skill");
|
|
1244
1260
|
return skills.flatMap((skill) => {
|
|
1245
|
-
const skillDir =
|
|
1246
|
-
|
|
1247
|
-
document.artifact.path.startsWith(`${skillDir}/`));
|
|
1248
|
-
if (localSupportDocs.length === 0)
|
|
1261
|
+
const skillDir = logicalSkillDirectory(skill.artifact.path);
|
|
1262
|
+
if (!skillDir)
|
|
1249
1263
|
return [];
|
|
1264
|
+
const localSupportDocs = documents.filter((document) => {
|
|
1265
|
+
if (!["profile", "reference", "example", "script", "asset"].includes(document.artifact.kind)) {
|
|
1266
|
+
return false;
|
|
1267
|
+
}
|
|
1268
|
+
const classified = classifyRepositorySkillPath(document.artifact.path);
|
|
1269
|
+
return (classified?.kind === "support" && classified.skillDirectory === skillDir);
|
|
1270
|
+
});
|
|
1271
|
+
const localSupportPaths = repositoryPaths
|
|
1272
|
+
? [...repositoryPaths].filter((candidate) => {
|
|
1273
|
+
const classified = classifyRepositorySkillPath(candidate);
|
|
1274
|
+
return (classified?.kind === "support" &&
|
|
1275
|
+
classified.skillDirectory === skillDir);
|
|
1276
|
+
})
|
|
1277
|
+
: localSupportDocs.map((document) => document.artifact.path);
|
|
1250
1278
|
const findings = [];
|
|
1251
1279
|
const text = skill.artifact.content.toLowerCase();
|
|
1252
|
-
const hasLocalSupportGuidance = /support file|local support|context route|context map|mixin|profiles?\/|references?\/|examples?\/|load .*?(?:profile|reference|example)|reference .*?(?:profile|reference|example)/.test(text);
|
|
1253
|
-
if (!hasLocalSupportGuidance) {
|
|
1254
|
-
findings.push(documentFinding(skill, DIAGNOSTIC_IDS.SUPPORT_MISSING_REACHABILITY_GUIDANCE, "Skill has local support files but no reachability guidance", "structure", "medium", "Add local support file reachability guidance so the top-level skill declares when profiles, references, examples, or
|
|
1280
|
+
const hasLocalSupportGuidance = /support file|local support|context route|context map|mixin|profiles?\/|references?\/|examples?\/|scripts?\/|assets?\/|load .*?(?:profile|reference|example|script|asset)|(?:read|run|reference) .*?(?:profile|reference|example|script|asset)/.test(text);
|
|
1281
|
+
if (localSupportDocs.length > 0 && !hasLocalSupportGuidance) {
|
|
1282
|
+
findings.push(documentFinding(skill, DIAGNOSTIC_IDS.SUPPORT_MISSING_REACHABILITY_GUIDANCE, "Skill has local support files but no reachability guidance", "structure", "medium", "Add local support file reachability guidance so the top-level skill declares when profiles, references, examples, scripts, or assets are reachable. If support content was split into ordered parts, reference the index or all parts in order. Preserve original concrete steps. Do not delete, summarize, or merge away procedural steps.", {
|
|
1255
1283
|
whyItMatters: "Local support files should be statically discoverable from the skill so humans and LLM coding agents can tell which repository evidence belongs to the skill without relying on runtime context selection.",
|
|
1256
1284
|
constraints: [
|
|
1257
1285
|
"Do not introduce runtime context resolution.",
|
|
@@ -1262,14 +1290,15 @@ function skillLocalSupportReachabilityFindings(documents) {
|
|
|
1262
1290
|
verificationSteps: [
|
|
1263
1291
|
"Run renma scan.",
|
|
1264
1292
|
"Run any project-specific validation checks that apply to this repository.",
|
|
1265
|
-
"Confirm each local profile, reference, or
|
|
1293
|
+
"Confirm each local profile, reference, example, script, or asset is reachable from SKILL.md or from a referenced parent support file.",
|
|
1266
1294
|
],
|
|
1267
|
-
llmHint: "Add concise reachability guidance in SKILL.md that references local profiles, references, examples, or ordered support indexes without adding runtime routing behavior.",
|
|
1295
|
+
llmHint: "Add concise reachability guidance in SKILL.md that references local profiles, references, examples, scripts, assets, or ordered support indexes without adding runtime routing behavior.",
|
|
1268
1296
|
}));
|
|
1269
1297
|
}
|
|
1270
|
-
const
|
|
1298
|
+
const reachabilityDepth = localSupportReachabilityDepth(skill, skillDir, localSupportDocs, localSupportPaths);
|
|
1271
1299
|
for (const document of localSupportDocs) {
|
|
1272
|
-
|
|
1300
|
+
const depth = reachabilityDepth.get(document.artifact.path);
|
|
1301
|
+
if (depth === undefined) {
|
|
1273
1302
|
findings.push(documentFinding(document, localSupportUnreachableRuleId(document.artifact.kind), "Local support file is not reachable from the skill", "structure", "low", "Reference this local support file from SKILL.md or from a referenced parent support file with clear reachability guidance. If this file is a split part, ensure the parent skill references the index or all ordered parts so preserved details remain reachable. Do not delete, summarize, or merge away procedural steps just to satisfy the check.", {
|
|
1274
1303
|
whyItMatters: "Unreachable local support files can drift outside review and be missed by humans or LLM coding agents. Reachability should be static repository evidence, not runtime context assembly.",
|
|
1275
1304
|
constraints: [
|
|
@@ -1286,36 +1315,126 @@ function skillLocalSupportReachabilityFindings(documents) {
|
|
|
1286
1315
|
llmHint: "Update SKILL.md or a referenced support index to mention this file by path, basename, or clear title so the static reachability graph can find it.",
|
|
1287
1316
|
}));
|
|
1288
1317
|
}
|
|
1318
|
+
else if (depth > MAX_LOCAL_SUPPORT_REFERENCE_HOPS) {
|
|
1319
|
+
findings.push(documentFinding(document, DIAGNOSTIC_IDS.SUPPORT_DEEP_REFERENCE_CHAIN, "Skill-local resource is behind a deep reference chain", "structure", "low", "Reference this resource directly from SKILL.md or through one directly referenced index/reference. Agent Skills recommends shallow file-reference chains.", {
|
|
1320
|
+
details: {
|
|
1321
|
+
measured: depth,
|
|
1322
|
+
limit: MAX_LOCAL_SUPPORT_REFERENCE_HOPS,
|
|
1323
|
+
unit: "static_reference_hops",
|
|
1324
|
+
profile: QUALITY.profile,
|
|
1325
|
+
},
|
|
1326
|
+
}));
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
const missingPathSources = [
|
|
1330
|
+
skill,
|
|
1331
|
+
...localSupportDocs.filter((document) => (reachabilityDepth.get(document.artifact.path) ?? 99) <=
|
|
1332
|
+
MAX_LOCAL_SUPPORT_REFERENCE_HOPS),
|
|
1333
|
+
];
|
|
1334
|
+
const reportedMissingPaths = new Set();
|
|
1335
|
+
const reportedSymlinkBoundaries = new Set();
|
|
1336
|
+
for (const source of missingPathSources) {
|
|
1337
|
+
for (const reference of localSupportPathReferences(source, skillDir, localSupportPaths)) {
|
|
1338
|
+
if (reference.relative.startsWith("examples/") &&
|
|
1339
|
+
!path.posix.basename(reference.relative).includes(".")) {
|
|
1340
|
+
continue;
|
|
1341
|
+
}
|
|
1342
|
+
const symlinkBoundary = referencedSymlinkBoundary(reference.target, repositoryPathStates);
|
|
1343
|
+
if (symlinkBoundary) {
|
|
1344
|
+
const key = `${source.artifact.path}:${symlinkBoundary}`;
|
|
1345
|
+
if (reportedSymlinkBoundaries.has(key))
|
|
1346
|
+
continue;
|
|
1347
|
+
reportedSymlinkBoundaries.add(key);
|
|
1348
|
+
findings.push(findingAt(source, DIAGNOSTIC_IDS.SUPPORT_SYMLINK_PATH, "Skill-local resource path is an unusable symbolic link", "structure", "medium", reference.line, reference.raw, `Replace ${reference.relative} with a regular repository file or directory; Renma never follows symbolic links.`, {
|
|
1349
|
+
details: {
|
|
1350
|
+
sourcePath: source.artifact.path,
|
|
1351
|
+
target: reference.target,
|
|
1352
|
+
state: "symlink",
|
|
1353
|
+
symlinkBoundary,
|
|
1354
|
+
profile: QUALITY.profile,
|
|
1355
|
+
},
|
|
1356
|
+
}));
|
|
1357
|
+
continue;
|
|
1358
|
+
}
|
|
1359
|
+
if (repositoryPathExists(repositoryPaths, reference.target, repositoryPathStates) ||
|
|
1360
|
+
repositoryPathExists(repositoryPaths, reference.relative, repositoryPathStates) ||
|
|
1361
|
+
reportedMissingPaths.has(`${source.artifact.path}:${reference.target}`))
|
|
1362
|
+
continue;
|
|
1363
|
+
reportedMissingPaths.add(`${source.artifact.path}:${reference.target}`);
|
|
1364
|
+
findings.push(findingAt(source, DIAGNOSTIC_IDS.SUPPORT_MISSING_PATH, "Skill-local resource path does not exist", "structure", "medium", reference.line, reference.raw, `Create ${reference.relative} under the Skill root or correct the relative path.`, {
|
|
1365
|
+
details: {
|
|
1366
|
+
target: reference.target,
|
|
1367
|
+
profile: QUALITY.profile,
|
|
1368
|
+
},
|
|
1369
|
+
}));
|
|
1370
|
+
}
|
|
1289
1371
|
}
|
|
1290
1372
|
return findings;
|
|
1291
1373
|
});
|
|
1292
1374
|
}
|
|
1293
|
-
function
|
|
1294
|
-
const
|
|
1375
|
+
function repositoryPathExists(repositoryPaths, candidate, repositoryPathStates) {
|
|
1376
|
+
const state = repositoryPathStates?.get(candidate);
|
|
1377
|
+
if (state !== undefined)
|
|
1378
|
+
return state !== "absent";
|
|
1379
|
+
if (!repositoryPaths)
|
|
1380
|
+
return false;
|
|
1381
|
+
if (repositoryPaths.has(candidate))
|
|
1382
|
+
return true;
|
|
1383
|
+
const directoryPrefix = `${candidate.replace(/\/$/, "")}/`;
|
|
1384
|
+
for (const filePath of repositoryPaths) {
|
|
1385
|
+
if (filePath.startsWith(directoryPrefix))
|
|
1386
|
+
return true;
|
|
1387
|
+
}
|
|
1388
|
+
return false;
|
|
1389
|
+
}
|
|
1390
|
+
function referencedSymlinkBoundary(candidate, repositoryPathStates) {
|
|
1391
|
+
if (!repositoryPathStates)
|
|
1392
|
+
return undefined;
|
|
1393
|
+
const segments = candidate.split("/");
|
|
1394
|
+
for (let length = 1; length <= segments.length; length += 1) {
|
|
1395
|
+
const prefix = segments.slice(0, length).join("/");
|
|
1396
|
+
if (repositoryPathStates.get(prefix) === "symlink")
|
|
1397
|
+
return prefix;
|
|
1398
|
+
}
|
|
1399
|
+
return undefined;
|
|
1400
|
+
}
|
|
1401
|
+
function localSupportReachabilityDepth(skill, skillDirectory, localSupportDocs, candidatePaths) {
|
|
1402
|
+
const reachable = new Map();
|
|
1403
|
+
const references = new Map([skill, ...localSupportDocs].map((document) => [
|
|
1404
|
+
document.artifact.path,
|
|
1405
|
+
new Set(staticSupportReferences(document, skillDirectory, candidatePaths).map((reference) => reference.targetPath)),
|
|
1406
|
+
]));
|
|
1295
1407
|
let changed = true;
|
|
1296
1408
|
while (changed) {
|
|
1297
1409
|
changed = false;
|
|
1298
1410
|
for (const document of localSupportDocs) {
|
|
1299
1411
|
if (reachable.has(document.artifact.path))
|
|
1300
1412
|
continue;
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1413
|
+
if (references.get(skill.artifact.path)?.has(document.artifact.path)) {
|
|
1414
|
+
reachable.set(document.artifact.path, 1);
|
|
1415
|
+
changed = true;
|
|
1416
|
+
continue;
|
|
1417
|
+
}
|
|
1418
|
+
const parent = localSupportDocs
|
|
1419
|
+
.filter((candidate) => reachable.has(candidate.artifact.path))
|
|
1420
|
+
.sort((left, right) => (reachable.get(left.artifact.path) ?? 0) -
|
|
1421
|
+
(reachable.get(right.artifact.path) ?? 0))
|
|
1422
|
+
.find((candidate) => references.get(candidate.artifact.path)?.has(document.artifact.path));
|
|
1423
|
+
if (parent) {
|
|
1424
|
+
reachable.set(document.artifact.path, (reachable.get(parent.artifact.path) ?? 0) + 1);
|
|
1307
1425
|
changed = true;
|
|
1308
1426
|
}
|
|
1309
1427
|
}
|
|
1310
1428
|
}
|
|
1311
1429
|
return reachable;
|
|
1312
1430
|
}
|
|
1313
|
-
function
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1431
|
+
function localSupportPathReferences(document, skillDir, candidatePaths) {
|
|
1432
|
+
return staticSupportReferences(document, skillDir, candidatePaths).map((reference) => ({
|
|
1433
|
+
raw: reference.raw,
|
|
1434
|
+
relative: reference.relativePath,
|
|
1435
|
+
target: reference.targetPath,
|
|
1436
|
+
line: reference.line,
|
|
1437
|
+
}));
|
|
1319
1438
|
}
|
|
1320
1439
|
function markdownBodyLineIndexes(document) {
|
|
1321
1440
|
if (document.lines[0]?.trim() !== "---") {
|
|
@@ -1374,34 +1493,11 @@ function thinSkillLayoutFindings(document) {
|
|
|
1374
1493
|
if (classifyRepositorySkillEntrypointPath(document.artifact.path)?.kind !==
|
|
1375
1494
|
"canonical")
|
|
1376
1495
|
return [];
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
];
|
|
1383
|
-
if (wordCount > 450 ||
|
|
1384
|
-
procedureSignals.some((pattern) => pattern.test(document.artifact.content))) {
|
|
1385
|
-
findings.push(documentFinding(document, DIAGNOSTIC_IDS.LAYOUT_SKILL_NOT_THIN, "Skill entrypoint contains procedure content", "structure", wordCount > 700 ? "medium" : "low", "Move reusable procedure content into contexts/** and keep SKILL.md as a concise router that points to the required context assets.", {
|
|
1386
|
-
whyItMatters: "Canonical Skill entrypoints should route agents instead of owning reusable knowledge, helper implementations, or detailed procedures.",
|
|
1387
|
-
verificationSteps: [
|
|
1388
|
-
"Confirm SKILL.md contains routing guidance and required context references only.",
|
|
1389
|
-
"Run renma readiness and check layout.skills_thin.",
|
|
1390
|
-
],
|
|
1391
|
-
llmHint: "Extract long procedure sections into contexts/**, add metadata.renma.requires-context or metadata.renma.optional-context JSON-array strings, and keep SKILL.md focused on when to use or not use the Skill. Pre-0.16 top-level references are migration input only.",
|
|
1392
|
-
}));
|
|
1393
|
-
}
|
|
1394
|
-
const command = firstExecutableCommand(document);
|
|
1395
|
-
if (command) {
|
|
1396
|
-
findings.push(findingAt(document, DIAGNOSTIC_IDS.LAYOUT_SKILL_EXECUTABLE_COMMAND, "Skill entrypoint contains executable command", "structure", "low", command.line, command.command, "Move executable command detail into Skill-local references or governed contexts/** procedures, and keep SKILL.md as a router.", {
|
|
1397
|
-
whyItMatters: "Executable setup commands in SKILL.md make the entrypoint procedural instead of a concise routing layer.",
|
|
1398
|
-
verificationSteps: [
|
|
1399
|
-
"Move the command guidance to a context/reference/procedure.",
|
|
1400
|
-
"If the command invokes a helper script, ensure it resolves to local scripts/** in the owning Skill or a shared tools/** helper.",
|
|
1401
|
-
],
|
|
1402
|
-
}));
|
|
1403
|
-
}
|
|
1404
|
-
return findings;
|
|
1496
|
+
// Agent Skills explicitly permits step-by-step instructions and command
|
|
1497
|
+
// examples in SKILL.md. Focused-workflow quality is evaluated by dedicated
|
|
1498
|
+
// routing, input, completion, progressive-disclosure, and mixed-knowledge
|
|
1499
|
+
// rules instead of the removed 0.17 thin-router heuristic.
|
|
1500
|
+
return [];
|
|
1405
1501
|
}
|
|
1406
1502
|
function helperCommandFindings(document, paths) {
|
|
1407
1503
|
const findings = [];
|
|
@@ -1546,9 +1642,6 @@ function executableCommands(document) {
|
|
|
1546
1642
|
}))
|
|
1547
1643
|
.filter(({ command }) => /^(node|bash|sh|python|python3)\s+/.test(command)));
|
|
1548
1644
|
}
|
|
1549
|
-
function firstExecutableCommand(document) {
|
|
1550
|
-
return executableCommands(document)[0];
|
|
1551
|
-
}
|
|
1552
1645
|
function unresolvedHelperCommandFinding(document, command, scriptPath, details = {}) {
|
|
1553
1646
|
const unsafePath = details.details?.unsafePath === true;
|
|
1554
1647
|
return findingAt(document, DIAGNOSTIC_IDS.PATH_HELPER_COMMAND_UNRESOLVED, "Helper command target does not resolve", "structure", "medium", command.line, command.command, unsafePath
|
|
@@ -1578,9 +1671,6 @@ function lineText(document, line) {
|
|
|
1578
1671
|
function isRepoPathLike(value) {
|
|
1579
1672
|
return /^[A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)+$/.test(value);
|
|
1580
1673
|
}
|
|
1581
|
-
function words(text) {
|
|
1582
|
-
return text.match(/[A-Za-z0-9_./+=-]+|[^\sA-Za-z0-9_./+=-]/g) ?? [];
|
|
1583
|
-
}
|
|
1584
1674
|
function finding(id, title, category, severity, document, remediation, details = {}) {
|
|
1585
1675
|
return {
|
|
1586
1676
|
id,
|
|
@@ -1635,15 +1725,12 @@ function localSupportUnreachableRuleId(kind) {
|
|
|
1635
1725
|
return DIAGNOSTIC_IDS.SUPPORT_UNREACHABLE_PROFILE;
|
|
1636
1726
|
if (kind === "example")
|
|
1637
1727
|
return DIAGNOSTIC_IDS.SUPPORT_UNREACHABLE_EXAMPLE;
|
|
1728
|
+
if (kind === "script")
|
|
1729
|
+
return DIAGNOSTIC_IDS.SUPPORT_UNREACHABLE_SCRIPT;
|
|
1730
|
+
if (kind === "asset")
|
|
1731
|
+
return DIAGNOSTIC_IDS.SUPPORT_UNREACHABLE_ASSET;
|
|
1638
1732
|
return DIAGNOSTIC_IDS.SUPPORT_UNREACHABLE_REFERENCE;
|
|
1639
1733
|
}
|
|
1640
|
-
function escapeRegExp(value) {
|
|
1641
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1642
|
-
}
|
|
1643
|
-
function approximateTokenCount(text) {
|
|
1644
|
-
const matches = text.match(/[A-Za-z0-9_./+=-]+|[^\sA-Za-z0-9_./+=-]/g);
|
|
1645
|
-
return matches?.length ?? 0;
|
|
1646
|
-
}
|
|
1647
1734
|
function isPlaceholder(line) {
|
|
1648
1735
|
return /(?:example|placeholder|your_|<[^>]+>|\$\{[^}]+})/i.test(line);
|
|
1649
1736
|
}
|