mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-11-01 02:11:54 +00:00
docs(prompts): fix canonical artifact paths and lint invalid refs
This commit is contained in:
1 parent
7feac76410
commit
711f2bc62f
2 files changed
+47
-6
No files matched your search
@@ -1,4 +1,5 @@
|
|||||||
import { readdir, readFile } from 'node:fs/promises';
|
import { readdir, readFile } from 'node:fs/promises';
|
||||||
|
import { join } from 'node:path';
|
||||||
|
|
||||||
const CONFIG = {
|
const CONFIG = {
|
||||||
daily: {
|
daily: {
|
||||||
@@ -97,6 +98,44 @@ function validateScheduler(cadence, roster, rows, promptFiles) {
|
|||||||
return errors;
|
return errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function listMarkdownFiles(dir) {
|
||||||
|
const entries = await readdir(dir, { withFileTypes: true });
|
||||||
|
const files = [];
|
||||||
|
|
||||||
|
for (const entry of entries) {
|
||||||
|
const fullPath = join(dir, entry.name);
|
||||||
|
if (entry.isDirectory()) {
|
||||||
|
files.push(...(await listMarkdownFiles(fullPath)));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entry.isFile() && entry.name.endsWith('.md')) {
|
||||||
|
files.push(fullPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function validateCanonicalPromptPaths() {
|
||||||
|
const errors = [];
|
||||||
|
const markdownFiles = await listMarkdownFiles('src/prompts');
|
||||||
|
const invalidPathPattern = /src\/src\/(context|todo|decisions|test_logs)\b/;
|
||||||
|
|
||||||
|
for (const file of markdownFiles) {
|
||||||
|
const content = await readFile(file, 'utf8');
|
||||||
|
if (!invalidPathPattern.test(content)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
errors.push(
|
||||||
|
`[prompt-paths] ${file} contains invalid canonical path references using "src/src/..."; expected "src/..."`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return errors;
|
||||||
|
}
|
||||||
|
|
||||||
const roster = JSON.parse(await readFile('src/prompts/roster.json', 'utf8'));
|
const roster = JSON.parse(await readFile('src/prompts/roster.json', 'utf8'));
|
||||||
|
|
||||||
const allErrors = [];
|
const allErrors = [];
|
||||||
@@ -111,6 +150,8 @@ for (const [cadence, cfg] of Object.entries(CONFIG)) {
|
|||||||
allErrors.push(...validateScheduler(cadence, roster[cadence] ?? [], rows, promptFiles));
|
allErrors.push(...validateScheduler(cadence, roster[cadence] ?? [], rows, promptFiles));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
allErrors.push(...(await validateCanonicalPromptPaths()));
|
||||||
|
|
||||||
if (allErrors.length > 0) {
|
if (allErrors.length > 0) {
|
||||||
console.error('Scheduler/roster drift detected:');
|
console.error('Scheduler/roster drift detected:');
|
||||||
for (const error of allErrors) {
|
for (const error of allErrors) {
|
||||||
|
|||||||
@@ -77,10 +77,10 @@ WORKFLOW
|
|||||||
1. Preflight
|
1. Preflight
|
||||||
- Read `AGENTS.md` and `CLAUDE.md`.
|
- Read `AGENTS.md` and `CLAUDE.md`.
|
||||||
- Update persistent state files using repository conventions:
|
- Update persistent state files using repository conventions:
|
||||||
- `src/src/context/CONTEXT_<timestamp>.md`
|
- `src/context/CONTEXT_<timestamp>.md`
|
||||||
- `src/src/todo/TODO_<timestamp>.md`
|
- `src/todo/TODO_<timestamp>.md`
|
||||||
- `src/src/decisions/DECISIONS_<timestamp>.md`
|
- `src/decisions/DECISIONS_<timestamp>.md`
|
||||||
- `src/src/test_logs/TEST_LOG_<timestamp>.md`
|
- `src/test_logs/TEST_LOG_<timestamp>.md`
|
||||||
- Store execution logs under `task-logs/daily/`.
|
- Store execution logs under `task-logs/daily/`.
|
||||||
|
|
||||||
2. Inventory — Daily prompts
|
2. Inventory — Daily prompts
|
||||||
@@ -128,7 +128,7 @@ WORKFLOW
|
|||||||
|
|
||||||
9. Document
|
9. Document
|
||||||
- Log additions/removals/renames in commit message.
|
- Log additions/removals/renames in commit message.
|
||||||
- Update `src/src/test_logs/TEST_LOG_<timestamp>.md` with verification results.
|
- Update `src/test_logs/TEST_LOG_<timestamp>.md` with verification results.
|
||||||
|
|
||||||
───────────────────────────────────────────────────────────────────────────────
|
───────────────────────────────────────────────────────────────────────────────
|
||||||
VERIFICATION
|
VERIFICATION
|
||||||
@@ -161,7 +161,7 @@ FAILURE MODES
|
|||||||
- If a scheduler file or `src/prompts/roster.json` is missing/corrupt, open an
|
- If a scheduler file or `src/prompts/roster.json` is missing/corrupt, open an
|
||||||
issue and stop. Do not recreate from scratch.
|
issue and stop. Do not recreate from scratch.
|
||||||
- If you cannot determine whether a rename occurred, treat as delete + add and
|
- If you cannot determine whether a rename occurred, treat as delete + add and
|
||||||
log ambiguity in `src/src/decisions/DECISIONS_<timestamp>.md`.
|
log ambiguity in `src/decisions/DECISIONS_<timestamp>.md`.
|
||||||
- If scheduler roster table format no longer matches expected pattern, stop and
|
- If scheduler roster table format no longer matches expected pattern, stop and
|
||||||
open an issue rather than risking malformed edits.
|
open an issue rather than risking malformed edits.
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user