xdrs-core 0.54.0 → 0.55.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.
|
@@ -184,7 +184,6 @@ Rules:
|
|
|
184
184
|
**Script standards**
|
|
185
185
|
|
|
186
186
|
When a skill includes `scripts/`:
|
|
187
|
-
- Each script MUST declare its runtime/interpreter at the top (shebang or equivalent header comment).
|
|
188
187
|
- SHOULD use the language already used by the consuming project when known, rather than mandating one language repo-wide.
|
|
189
188
|
- MUST avoid non-essential external dependencies, or document install steps in `SKILL.md` when unavoidable.
|
|
190
189
|
- SHOULD support both human-readable and machine-readable (JSON) output when producing analysis or report output.
|
package/lib/lint.js
CHANGED
|
@@ -50,7 +50,6 @@ const SKILL_OPTIONAL_RUNTIME_SECTION = '### Runtime Requirements';
|
|
|
50
50
|
const SKILL_OPTIONAL_USER_INTERACTION_SECTION = '### User Interaction';
|
|
51
51
|
const SKILL_ANTI_PATTERNS_MIN_ENTRIES = 3;
|
|
52
52
|
const SKILL_BUNDLING_MAKEFILE_TARGETS = ['build', 'test', 'clean'];
|
|
53
|
-
const SCRIPT_HEADER_RE = /^(#!|#|\/\/|\/\*|<!--|--|;)/;
|
|
54
53
|
|
|
55
54
|
// Subject number block ranges per _core-adr-policy-017
|
|
56
55
|
const SUBJECT_NUMBER_RANGES = {
|
|
@@ -1264,10 +1263,6 @@ function lintSkillsDirectory(xdrsRoot, scopeName, skillsPath, errors, externalSc
|
|
|
1264
1263
|
}
|
|
1265
1264
|
}
|
|
1266
1265
|
|
|
1267
|
-
if (packageEntry.name === 'scripts') {
|
|
1268
|
-
lintSkillScriptHeaders(packageEntryPath, errors);
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
1266
|
if (SKILL_PACKAGE_OPTIONAL_DIRS.has(packageEntry.name)) {
|
|
1272
1267
|
continue;
|
|
1273
1268
|
}
|
|
@@ -1637,24 +1632,6 @@ function lintSkillAntiPatternsCount(content, filePath, errors) {
|
|
|
1637
1632
|
}
|
|
1638
1633
|
}
|
|
1639
1634
|
|
|
1640
|
-
/**
|
|
1641
|
-
* Validates that each file inside a skill's scripts/ directory declares its runtime or
|
|
1642
|
-
* interpreter at the top (shebang or header comment) per _core-adr-policy-003.
|
|
1643
|
-
*/
|
|
1644
|
-
function lintSkillScriptHeaders(scriptsPath, errors) {
|
|
1645
|
-
const entries = safeReadDir(scriptsPath, errors, `read scripts directory ${toDisplayPath(scriptsPath)}`);
|
|
1646
|
-
for (const entry of entries) {
|
|
1647
|
-
if (!entry.isFile()) {
|
|
1648
|
-
continue;
|
|
1649
|
-
}
|
|
1650
|
-
const scriptPath = path.join(scriptsPath, entry.name);
|
|
1651
|
-
const content = fs.readFileSync(scriptPath, 'utf8');
|
|
1652
|
-
if (!SCRIPT_HEADER_RE.test(firstNonEmptyLine(content))) {
|
|
1653
|
-
errors.push(`Script must declare its runtime/interpreter at the top (shebang or header comment): ${toDisplayPath(scriptPath)} [_core-adr-policy-003]`);
|
|
1654
|
-
}
|
|
1655
|
-
}
|
|
1656
|
-
}
|
|
1657
|
-
|
|
1658
1635
|
/**
|
|
1659
1636
|
* Validates an optional skill bundling Makefile per _core-adr-policy-021: it must expose
|
|
1660
1637
|
* build/test/clean targets, and its dist/ output must be covered by a .gitignore.
|
package/lib/lint.test.js
CHANGED
|
@@ -866,7 +866,7 @@ test('passes when skill bundling Makefile dist output is covered by a local .git
|
|
|
866
866
|
expect(result.errors.join('\n')).not.toContain('is not covered by any .gitignore');
|
|
867
867
|
});
|
|
868
868
|
|
|
869
|
-
test('
|
|
869
|
+
test('does not require a shebang or header comment in scripts/ files', () => {
|
|
870
870
|
const workspaceRoot = createWorkspace('skill-script-missing-header', {
|
|
871
871
|
'.xdrs/index.md': rootIndex(),
|
|
872
872
|
'.xdrs/_local/adrs/index.md': localAdrIndex([
|
|
@@ -881,26 +881,7 @@ test('reports scripts/ file missing a shebang or header comment', () => {
|
|
|
881
881
|
|
|
882
882
|
const result = lintWorkspace(workspaceRoot);
|
|
883
883
|
|
|
884
|
-
expect(result.errors.join('\n')).toContain('
|
|
885
|
-
});
|
|
886
|
-
|
|
887
|
-
test('passes when scripts/ file declares a shebang', () => {
|
|
888
|
-
const workspaceRoot = createWorkspace('skill-script-with-shebang', {
|
|
889
|
-
'.xdrs/index.md': rootIndex(),
|
|
890
|
-
'.xdrs/_local/adrs/index.md': localAdrIndex([
|
|
891
|
-
'- [check-links](principles/skills/check-links/SKILL.md) - Check links'
|
|
892
|
-
]),
|
|
893
|
-
'.xdrs/_local/adrs/principles/skills/check-links/SKILL.md': skillDocument('Test instructions.'),
|
|
894
|
-
'.xdrs/_local/adrs/principles/skills/check-links/scripts/run.sh': [
|
|
895
|
-
'#!/bin/bash',
|
|
896
|
-
'echo "has a shebang"',
|
|
897
|
-
''
|
|
898
|
-
].join('\n'),
|
|
899
|
-
});
|
|
900
|
-
|
|
901
|
-
const result = lintWorkspace(workspaceRoot);
|
|
902
|
-
|
|
903
|
-
expect(result.errors.join('\n')).not.toContain('Script must declare its runtime/interpreter at the top');
|
|
884
|
+
expect(result.errors.join('\n')).not.toContain('scripts/run.sh');
|
|
904
885
|
});
|
|
905
886
|
|
|
906
887
|
test('accepts skill package names containing digits, including as a prefix', () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xdrs-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.55.0",
|
|
4
4
|
"description": "XDRS (eXtensible Decision Record System): a framework to structure, compile and distribute Architectural (ADR), Business (BDR), and Engineering (EDR) decision records contents so that AI agents and humans can reliably find and use them with hierarchical scopes and controlled rollout in the format of distributable versioned packages.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|