@metasession.co/devaudit-sdlc 1.6.1 → 1.7.1
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/package.json +1 -1
- package/src/bin/devaudit-sdlc.js +61 -2
package/package.json
CHANGED
package/src/bin/devaudit-sdlc.js
CHANGED
|
@@ -57,10 +57,14 @@ function hasFlag(name) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
function printUsageAndExit() {
|
|
60
|
-
console.error("❌ ERROR: Missing required configuration property. Execution syntax: devaudit-sdlc --phase=<1-5|issue> | --watch-pr=<number>");
|
|
60
|
+
console.error("❌ ERROR: Missing required configuration property. Execution syntax: devaudit-sdlc --phase=<1-5|issue> | --watch-pr=<number> | --freshness-checked[=<version>]");
|
|
61
61
|
process.exit(1);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
function hasFreshnessFlag() {
|
|
65
|
+
return args.some(arg => arg === '--freshness-checked' || arg.startsWith('--freshness-checked='));
|
|
66
|
+
}
|
|
67
|
+
|
|
64
68
|
function sleep(ms) {
|
|
65
69
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
66
70
|
}
|
|
@@ -201,6 +205,50 @@ function appendPhaseRecord(phase) {
|
|
|
201
205
|
}
|
|
202
206
|
}
|
|
203
207
|
|
|
208
|
+
function appendFreshnessRecord(version) {
|
|
209
|
+
const context = detectInvocationContext();
|
|
210
|
+
const reqId = resolveReqId();
|
|
211
|
+
|
|
212
|
+
const newRecord = {
|
|
213
|
+
freshnessCheckedAt: new Date().toISOString(),
|
|
214
|
+
freshnessCheckedVersion: version || null,
|
|
215
|
+
initializedBy: context.initializedBy,
|
|
216
|
+
reqId: reqId,
|
|
217
|
+
agentType: context.agentType,
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
let phaseHistory = [];
|
|
221
|
+
if (fs.existsSync(sentinelPath)) {
|
|
222
|
+
try {
|
|
223
|
+
const existingContent = fs.readFileSync(sentinelPath, 'utf8');
|
|
224
|
+
const parsed = JSON.parse(existingContent);
|
|
225
|
+
if (Array.isArray(parsed)) {
|
|
226
|
+
phaseHistory = parsed;
|
|
227
|
+
} else {
|
|
228
|
+
console.warn('⚠️ WARNING: Sentinel file contained a legacy single-object format. Migrating to array format.');
|
|
229
|
+
phaseHistory = [parsed];
|
|
230
|
+
}
|
|
231
|
+
} catch (_parseError) {
|
|
232
|
+
console.warn('⚠️ WARNING: Sentinel file was corrupt or in legacy plain-text format. Overwriting with fresh phase history.');
|
|
233
|
+
phaseHistory = [];
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
phaseHistory.push(newRecord);
|
|
238
|
+
saveJsonFile(sentinelPath, phaseHistory);
|
|
239
|
+
|
|
240
|
+
console.log(`\n✅ Freshness check recorded: appended entry to sentinel at ${sentinelPath}`);
|
|
241
|
+
console.log(`📦 Synced version confirmed: ${version || 'unknown (registry unreachable)'}`);
|
|
242
|
+
console.log(`👤 Initialized by: ${context.initializedBy}${reqId ? ` (REQ-${reqId})` : ''}`);
|
|
243
|
+
|
|
244
|
+
// Same CI-provenance rationale as appendPhaseRecord (devaudit#775): the
|
|
245
|
+
// sentinel file is gitignored and local-only, so print the trailer for
|
|
246
|
+
// the skill to copy into commits this session in case a CI-run upload
|
|
247
|
+
// needs to prove the freshness check happened too.
|
|
248
|
+
console.log(`\n--- GIT COMMIT TRAILER (copy verbatim into every commit this session) ---`);
|
|
249
|
+
console.log(`Sdlc-Implementer-Sentinel: ${JSON.stringify(phaseHistory)}`);
|
|
250
|
+
}
|
|
251
|
+
|
|
204
252
|
function runBlueprintView(phase) {
|
|
205
253
|
const blueprintPath = path.join(__dirname, '..', 'blueprints', phaseMap[phase]);
|
|
206
254
|
if (!fs.existsSync(blueprintPath)) {
|
|
@@ -575,11 +623,22 @@ async function main() {
|
|
|
575
623
|
const phase = getOption('phase');
|
|
576
624
|
const viewOnly = hasFlag('view');
|
|
577
625
|
const watchPr = getOption('watch-pr');
|
|
626
|
+
const freshnessChecked = hasFreshnessFlag();
|
|
578
627
|
|
|
579
|
-
if (!phase && !watchPr) {
|
|
628
|
+
if (!phase && !watchPr && !freshnessChecked) {
|
|
580
629
|
printUsageAndExit();
|
|
581
630
|
}
|
|
582
631
|
|
|
632
|
+
if (freshnessChecked) {
|
|
633
|
+
try {
|
|
634
|
+
appendFreshnessRecord(getOption('freshness-checked'));
|
|
635
|
+
} catch (error) {
|
|
636
|
+
console.error("❌ SYSTEM ERROR: Failed to instantiate workspace sentinel tracking state:", error.message);
|
|
637
|
+
process.exit(1);
|
|
638
|
+
}
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
|
|
583
642
|
if (watchPr) {
|
|
584
643
|
await watchPullRequest();
|
|
585
644
|
return;
|