mirror of
https://github.com/personamanagmentlayer/pcl.git
synced 2026-09-14 15:40:22 +08:00
dcf5e14efa
- Update extractProperties() to handle depth and verbosity properties - Update extractPersonaConfig() to extract depth and verbosity from AST - Add depth/verbosity to codegen property extraction interface - Test parsing and extraction of complete persona syntax Parsing now correctly handles: - intent/tone/depth/verbosity properties - skills/constraints/tags blocks Status: Parser + Codegen + Runtime integration COMPLETE
28 lines
792 B
JavaScript
28 lines
792 B
JavaScript
import { parse } from '../dist/index.js';
|
|
|
|
const source = `persona SEC {
|
|
intent: "Security analysis"
|
|
tone: cautious
|
|
depth: thorough
|
|
verbosity: detailed
|
|
skills { "OWASP Top 10" }
|
|
}`;
|
|
|
|
const result = parse(source);
|
|
console.log('Parse result:', result.ok ? 'SUCCESS' : 'FAILED');
|
|
if (result.ok) {
|
|
const persona = result.value.program.statements[0];
|
|
console.log('Persona ID:', persona.id?.name);
|
|
console.log('Body members:', persona.body?.members?.length || 0);
|
|
if (persona.body?.members) {
|
|
persona.body.members.forEach((member, idx) => {
|
|
console.log(
|
|
` [${idx}] ${member.kind}: ${member.name?.name || 'unnamed'}`
|
|
);
|
|
});
|
|
}
|
|
} else {
|
|
console.log('Errors:', result.error.length);
|
|
result.error.forEach((err) => console.log(' -', err.message));
|
|
}
|