AnthropicallyHuggingFaces's picture
Sync full ProjectOS monorepo from GitHub 7f633f5
a8f4b72 verified
Raw History Blame Contribute Delete
2.01 kB
import { SymbolResolver, type LanguageProfileRegistry, type SymbolAliasRegistry } from '@projectos/schema-engine';
export interface PlanCheck { valid: boolean; issues: string[] }
export interface PromotionCheck { valid: boolean; issues: string[] }
export function validateFrontierPromotion(
item: { id?: string; projectId?: string | null; title?: string; description?: string; rationale?: string; status?: string },
projectId: string
): PromotionCheck {
const issues: string[] = [];
if (!item.id?.trim()) issues.push('A frontier record identifier is required.');
if (!projectId.trim() || item.projectId !== projectId) issues.push('The frontier record must belong to the target project.');
if (!item.title?.trim()) issues.push('A titled frontier record is required.');
if (!(item.description?.trim() || item.rationale?.trim())) issues.push('Promotion needs a description or rationale.');
if (item.status !== 'candidate' && item.status !== 'tracking') issues.push('Only candidate or tracking frontier records can be promoted.');
return { valid: issues.length === 0, issues };
}
export function validatePlanDraft(plan: { question?: string; council?: string; agents?: string[] }): PlanCheck {
const issues: string[] = [];
if (!plan.question?.trim()) issues.push('A question is required.');
if (!plan.council?.trim()) issues.push('A council template must be selected.');
if (!plan.agents?.length) issues.push('At least one specialist agent must be assigned.');
return { valid: issues.length === 0, issues };
}
export function resolveSymbols(names: string[], registry: SymbolAliasRegistry): string[] {
const resolver = new SymbolResolver(registry);
return names.map((name) => resolver.resolve(name));
}
export function emitSymbols(
names: string[],
registry: SymbolAliasRegistry,
profiles: LanguageProfileRegistry,
profileName: string
): string[] {
const resolver = new SymbolResolver(registry, profiles);
return names.map((name) => resolver.emit(name, profileName));
}