@medicine-wheel/community-review
Version:
Community-based ceremonial review protocol for Medicine Wheel — implements Wilson's validation through Elder review circles, consensus, and relational accountability
86 lines • 2.56 kB
JavaScript
;
/**
* @medicine-wheel/community-review — Circle Management
*
* Creates and manages review circles — the community body
* that evaluates artifacts through ceremonial review.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.createReviewCircle = createReviewCircle;
exports.addReviewer = addReviewer;
exports.submitForReview = submitForReview;
exports.closeCircle = closeCircle;
exports.circleStatus = circleStatus;
/**
* Create a new review circle for an artifact.
* Initializes in 'gathering' status, awaiting reviewers.
*/
function createReviewCircle(artifactId, artifactType) {
return {
id: `circle-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
artifactId,
artifactType,
reviewers: [],
status: 'gathering',
talkingCircleLog: [],
wilsonAlignment: 0,
ocapCompliant: false,
createdAt: new Date().toISOString(),
};
}
/**
* Add a reviewer to the circle.
* Only allowed while status is 'gathering'.
*/
function addReviewer(circle, reviewer) {
if (circle.status !== 'gathering') {
throw new Error(`Cannot add reviewer — circle is '${circle.status}', must be 'gathering'`);
}
return {
...circle,
reviewers: [...circle.reviewers, reviewer],
};
}
/**
* Transition the circle to 'reviewing' status.
* Requires at least one reviewer.
*/
function submitForReview(circle) {
if (circle.status !== 'gathering') {
throw new Error(`Cannot submit — circle is '${circle.status}', must be 'gathering'`);
}
if (circle.reviewers.length === 0) {
throw new Error('Cannot submit — circle has no reviewers');
}
return {
...circle,
status: 'reviewing',
};
}
/**
* Close the circle with a final outcome.
* Transitions status to 'decided'.
*/
function closeCircle(circle, outcome) {
if (circle.status !== 'deliberating' && circle.status !== 'reviewing') {
throw new Error(`Cannot close — circle is '${circle.status}', must be 'reviewing' or 'deliberating'`);
}
return {
...circle,
status: 'decided',
outcome,
};
}
/**
* Get a summary of the circle's current state.
*/
function circleStatus(circle) {
return {
status: circle.status,
reviewerCount: circle.reviewers.length,
hasElder: circle.elderValidator !== undefined,
voicesHeard: circle.talkingCircleLog.length,
outcomeType: circle.outcome?.type,
};
}
//# sourceMappingURL=circle.js.map