@akjamie/agentic-sdlc 1.4.0 → 1.5.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/README.md +25 -21
- package/assets/commands/asdlc-approve.md +2 -2
- package/assets/schema/risk-assessment.schema.json +2 -1
- package/assets/skills/asdlc-apply/SKILL.md +1 -1
- package/assets/skills/asdlc-approve/SKILL.md +1 -1
- package/assets/skills/asdlc-impl-review/SKILL.md +13 -11
- package/assets/skills/asdlc-new/SKILL.md +5 -2
- package/assets/skills/asdlc-spec-review/SKILL.md +8 -6
- package/package.json +1 -1
- package/src/assess/ai_judge.js +70 -33
- package/src/assess/decide.js +8 -6
- package/src/assess/index.js +13 -3
- package/src/assess/rules/builtin.js +6 -1
- package/src/assess/schema.js +6 -1
- package/src/assess/vectors/v1_intent.js +53 -8
- package/src/assess/vectors/v3_topology.js +97 -3
- package/src/commands/apply.js +32 -3
- package/src/commands/lint.js +32 -2
- package/src/commands/new.js +23 -22
- package/src/commands/status.js +1 -1
- package/src/commands/test.js +31 -4
- package/src/commands/verify.js +47 -20
- package/src/lib/graphify.js +67 -3
- package/src/lib/speclint.js +5 -3
- package/src/lib/tdd.js +6 -2
package/src/lib/graphify.js
CHANGED
|
@@ -3,9 +3,9 @@ import path from 'node:path';
|
|
|
3
3
|
import { exists, readText, writeText } from './fs.js';
|
|
4
4
|
import { headSha } from './git.js';
|
|
5
5
|
|
|
6
|
-
// graphify
|
|
7
|
-
//
|
|
8
|
-
//
|
|
6
|
+
// graphify builds a deterministic code-derived AST knowledge graph (no LLM key)
|
|
7
|
+
// used both to ground explore.md before spec authoring and to compute cross-file
|
|
8
|
+
// fan-in / blast-radius centrality in v3_topology risk assessment.
|
|
9
9
|
//
|
|
10
10
|
// The graph is a DERIVED CACHE bound to the current HEAD (graphify-out/), never
|
|
11
11
|
// committed; refreshed when HEAD moves.
|
|
@@ -56,6 +56,70 @@ export function readRef(repoRoot) {
|
|
|
56
56
|
return exists(p) ? readText(p).trim() : null;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Loads the Graphify knowledge graph JSON.
|
|
61
|
+
* Returns null if missing or invalid.
|
|
62
|
+
*/
|
|
63
|
+
export function loadGraphData(repoRoot) {
|
|
64
|
+
if (!repoRoot) return null;
|
|
65
|
+
const p = path.join(repoRoot, GRAPH_REL);
|
|
66
|
+
if (!exists(p)) return null;
|
|
67
|
+
try {
|
|
68
|
+
return JSON.parse(readText(p));
|
|
69
|
+
} catch {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function isNonProdCaller(filePath = '') {
|
|
75
|
+
const norm = String(filePath).replace(/\\/g, '/');
|
|
76
|
+
return (
|
|
77
|
+
/(^|\/)(tests?|__tests__|testing|docs?)\//i.test(norm) ||
|
|
78
|
+
/\.(test|spec)\.[a-z0-9]+$/i.test(norm) ||
|
|
79
|
+
/_test\.go$/i.test(norm) ||
|
|
80
|
+
/(^|\/)test_[^/]+\.py$/i.test(norm) ||
|
|
81
|
+
/_test\.py$/i.test(norm) ||
|
|
82
|
+
/\.(md|txt)$/i.test(norm)
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Calculates cross-file fan-in (inbound dependency count) from Graphify AST.
|
|
88
|
+
* Excludes test/doc callers so test suites do not artificially inflate hub centrality.
|
|
89
|
+
*/
|
|
90
|
+
export function getGraphTopologyMetrics(repoRoot) {
|
|
91
|
+
const graph = loadGraphData(repoRoot);
|
|
92
|
+
if (!graph || !Array.isArray(graph.nodes) || !Array.isArray(graph.links)) {
|
|
93
|
+
return { available: false, fileInDegree: {}, topHubs: [] };
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const nodeToFile = {};
|
|
97
|
+
const fileInDegree = {};
|
|
98
|
+
|
|
99
|
+
for (const n of graph.nodes) {
|
|
100
|
+
if (n.source_file) {
|
|
101
|
+
nodeToFile[n.id] = String(n.source_file).replace(/\\/g, '/');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
for (const link of graph.links) {
|
|
106
|
+
const targetFile = nodeToFile[link.target];
|
|
107
|
+
const sourceFile = nodeToFile[link.source];
|
|
108
|
+
if (targetFile && sourceFile && targetFile !== sourceFile && !isNonProdCaller(sourceFile)) {
|
|
109
|
+
fileInDegree[targetFile] = (fileInDegree[targetFile] || 0) + 1;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const sortedFiles = Object.entries(fileInDegree)
|
|
114
|
+
.sort((a, b) => b[1] - a[1]);
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
available: true,
|
|
118
|
+
fileInDegree,
|
|
119
|
+
topHubs: sortedFiles.slice(0, 15)
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
59
123
|
export function writeRef(repoRoot) {
|
|
60
124
|
const sha = headSha(repoRoot);
|
|
61
125
|
if (sha) writeText(path.join(repoRoot, REF_REL), sha);
|
package/src/lib/speclint.js
CHANGED
|
@@ -76,9 +76,10 @@ function scenarios(body) {
|
|
|
76
76
|
function acceptanceCriteria(body) {
|
|
77
77
|
const out = [];
|
|
78
78
|
for (const line of body.split('\n')) {
|
|
79
|
-
const
|
|
79
|
+
const trimmed = line.trimEnd();
|
|
80
|
+
const m = trimmed.match(/^\s*-\s*\[[ xX]\]\s*(AC\d+)\s*:\s*(.+)$/);
|
|
80
81
|
if (!m) continue;
|
|
81
|
-
const t =
|
|
82
|
+
const t = trimmed.match(/\(test:\s*([^)]+?)\s*\)/i);
|
|
82
83
|
out.push({ id: m[1], text: m[2].replace(/\(test:.*$/i, '').trim(), test: t ? t[1].trim() : null });
|
|
83
84
|
}
|
|
84
85
|
return out;
|
|
@@ -109,7 +110,8 @@ const DEFAULT_SEVERITY = {
|
|
|
109
110
|
'R8-removed-reason': 'major',
|
|
110
111
|
};
|
|
111
112
|
|
|
112
|
-
export function lintSpecText(
|
|
113
|
+
export function lintSpecText(rawText, { requireGiven = true, repoRoot = null, rules = {} } = {}) {
|
|
114
|
+
const text = String(rawText || '').replace(/\r\n/g, '\n').replace(/\r/g, '\n');
|
|
113
115
|
const findings = [];
|
|
114
116
|
const add = (code, rawSeverity, message, location = '') => {
|
|
115
117
|
const configured = rules[code] ?? DEFAULT_SEVERITY[code] ?? rawSeverity;
|
package/src/lib/tdd.js
CHANGED
|
@@ -3,8 +3,12 @@
|
|
|
3
3
|
export function isTestFile(file) {
|
|
4
4
|
const normalized = String(file).replace(/\\/g, '/');
|
|
5
5
|
return (
|
|
6
|
-
/(?:^|\/)(?:tests?|__tests__|spec)\//i.test(normalized) ||
|
|
7
|
-
/\.(?:test|spec)\.[a-zA-Z0-9]+$/i.test(normalized)
|
|
6
|
+
/(?:^|\/)(?:tests?|__tests__|testing|spec|fixtures?|mocks?)\//i.test(normalized) ||
|
|
7
|
+
/\.(?:test|spec)\.[a-zA-Z0-9]+$/i.test(normalized) ||
|
|
8
|
+
/_test\.go$/i.test(normalized) ||
|
|
9
|
+
/test_[^/]+\.py$/i.test(normalized) ||
|
|
10
|
+
/[^/]+_test\.py$/i.test(normalized) ||
|
|
11
|
+
/(?:^|\/).*(?:Test|Tests|TestCase|IT)\.(?:java|kt|scala)$/i.test(normalized)
|
|
8
12
|
);
|
|
9
13
|
}
|
|
10
14
|
|