feat(voyage)!: marketplace handoff — rename plugins/ultraplan-local to plugins/voyage [skip-docs]
Session 5 of voyage-rebrand (V6). Operator-authorized cross-plugin scope. - git mv plugins/ultraplan-local plugins/voyage (rename detected, history preserved) - .claude-plugin/marketplace.json: voyage entry replaces ultraplan-local - CLAUDE.md: voyage row in plugin list, voyage in design-system consumer list - README.md: bulk rename ultra*-local commands -> trek* commands; ultraplan-local refs -> voyage; type discriminators (type: trekbrief/trekreview); session-title pattern (voyage:<command>:<slug>); v4.0.0 release-note paragraph - plugins/voyage/.claude-plugin/plugin.json: homepage/repository URLs point to monorepo voyage path - plugins/voyage/verify.sh: drop URL whitelist exception (no longer needed) Closes voyage-rebrand. bash plugins/voyage/verify.sh PASS 7/7. npm test 361/361.
This commit is contained in:
parent
8f1bf9b7b4
commit
7a90d348ad
149 changed files with 26 additions and 33 deletions
94
plugins/voyage/lib/validators/architecture-discovery.mjs
Normal file
94
plugins/voyage/lib/validators/architecture-discovery.mjs
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
// lib/validators/architecture-discovery.mjs
|
||||
// EXTERNAL CONTRACT — drift-WARN, never drift-FAIL.
|
||||
//
|
||||
// The architecture/ directory is owned by the separate `ultra-cc-architect`
|
||||
// plugin. ultraplan-local validates only DISCOVERY (file present at canonical
|
||||
// path) and tolerates internal-format drift via warnings.
|
||||
//
|
||||
// Never read body content beyond first heading. Never assert frontmatter shape.
|
||||
|
||||
import { existsSync, readdirSync, statSync, readFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { issue } from '../util/result.mjs';
|
||||
|
||||
const CANONICAL_OVERVIEW = 'overview.md';
|
||||
const CANONICAL_GAPS = 'gaps.md';
|
||||
const KNOWN_ALTERNATIVES = ['architecture-overview.md', 'overview.markdown', 'README.md'];
|
||||
|
||||
export function discoverArchitecture(projectDir) {
|
||||
const archDir = projectDir ? join(projectDir, 'architecture') : null;
|
||||
const result = {
|
||||
found: false,
|
||||
overview: null,
|
||||
gaps: null,
|
||||
looseFiles: [],
|
||||
warnings: [],
|
||||
};
|
||||
|
||||
if (!archDir || !existsSync(archDir) || !statSync(archDir).isDirectory()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
const overviewPath = join(archDir, CANONICAL_OVERVIEW);
|
||||
if (existsSync(overviewPath) && statSync(overviewPath).isFile()) {
|
||||
result.found = true;
|
||||
result.overview = overviewPath;
|
||||
} else {
|
||||
for (const alt of KNOWN_ALTERNATIVES) {
|
||||
const altPath = join(archDir, alt);
|
||||
if (existsSync(altPath) && statSync(altPath).isFile()) {
|
||||
result.found = true;
|
||||
result.overview = altPath;
|
||||
result.warnings.push(issue(
|
||||
'ARCH_NON_CANONICAL_OVERVIEW',
|
||||
`Architecture file at non-canonical path: ${alt}`,
|
||||
`Canonical contract is architecture/overview.md. The ultra-cc-architect plugin may have drifted; this is a warning, not a blocker.`,
|
||||
));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const gapsPath = join(archDir, CANONICAL_GAPS);
|
||||
if (existsSync(gapsPath) && statSync(gapsPath).isFile()) result.gaps = gapsPath;
|
||||
|
||||
const all = readdirSync(archDir).filter(f => /\.md$/i.test(f));
|
||||
result.looseFiles = all
|
||||
.filter(f => f !== CANONICAL_OVERVIEW && f !== CANONICAL_GAPS && !KNOWN_ALTERNATIVES.includes(f))
|
||||
.map(f => join(archDir, f));
|
||||
|
||||
if (result.looseFiles.length > 0) {
|
||||
result.warnings.push(issue(
|
||||
'ARCH_LOOSE_FILES',
|
||||
`Found ${result.looseFiles.length} unrecognized architecture file(s)`,
|
||||
`Architecture contract expects overview.md (+ optional gaps.md). Loose files may indicate format drift in ultra-cc-architect.`,
|
||||
));
|
||||
}
|
||||
|
||||
if (result.found && result.overview) {
|
||||
try {
|
||||
const text = readFileSync(result.overview, 'utf-8');
|
||||
const firstHeading = text.match(/^#\s+(.+?)\s*$/m);
|
||||
result.firstHeading = firstHeading ? firstHeading[1] : null;
|
||||
} catch { /* ignore — only sniff */ }
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
if (import.meta.url === `file://${process.argv[1]}`) {
|
||||
const projectDir = process.argv[2];
|
||||
const wantJson = process.argv.includes('--json');
|
||||
if (!projectDir) {
|
||||
process.stderr.write('Usage: architecture-discovery.mjs <project-dir> [--json]\n');
|
||||
process.exit(2);
|
||||
}
|
||||
const r = discoverArchitecture(projectDir);
|
||||
if (wantJson) {
|
||||
process.stdout.write(JSON.stringify(r, null, 2) + '\n');
|
||||
} else {
|
||||
process.stdout.write(`architecture-discovery: ${r.found ? 'FOUND' : 'NONE'} ${r.overview || projectDir}\n`);
|
||||
for (const w of r.warnings) process.stderr.write(` WARN [${w.code}] ${w.message}\n`);
|
||||
}
|
||||
process.exit(0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue