Support Snapshot artifacts in Ranker bridge
This commit is contained in:
@@ -601,6 +601,7 @@ function cleanDecisionContext(input = {}) {
|
||||
const featureSet = objectFrom(input.featureSet);
|
||||
const artifact = objectFrom(input.artifact || featureSet.artifact);
|
||||
const conceptMap = objectFrom(input.conceptMap || featureSet.conceptMap || artifact.conceptMap);
|
||||
const snapshot = objectFrom(input.snapshot || featureSet.snapshot || artifact.snapshot || conceptMap.snapshot);
|
||||
const conceptMapLenses = objectFrom(conceptMap.lenses || input.lenses || featureSet.lenses);
|
||||
const riskLens = conceptMapLenses.risk || conceptMapLenses.risks || conceptMapLenses.boundaries || conceptMapLenses.notYet;
|
||||
const audienceLens = conceptMapLenses.audience || conceptMapLenses.who || conceptMapLenses.customer || conceptMapLenses.users;
|
||||
@@ -612,8 +613,10 @@ function cleanDecisionContext(input = {}) {
|
||||
featureSet.decisionContext,
|
||||
artifact.decisionContext,
|
||||
conceptMap.decisionContext,
|
||||
snapshot.decisionContext,
|
||||
structuredContext,
|
||||
conceptMap.context,
|
||||
snapshot.context,
|
||||
featureSet.context,
|
||||
artifact.context,
|
||||
];
|
||||
@@ -622,22 +625,23 @@ function cleanDecisionContext(input = {}) {
|
||||
lensContent(riskLens),
|
||||
lensContent(constraintsLens),
|
||||
conceptMap.risk || conceptMap.whatNotToBuildYet || conceptMap.notYet || '',
|
||||
snapshot.risk || snapshot.whatNotToBuildYet || snapshot.notYet || '',
|
||||
].filter(Boolean).join('\n'));
|
||||
return {
|
||||
targetAudience: cleanText(input.targetAudience || featureSet.targetAudience || firstContextText(contextSources, ['targetAudience', 'audience', 'who', 'whoItHelps', 'customer', 'users']) || conceptMap.targetAudience || lensContent(audienceLens), 180),
|
||||
targetAudience: cleanText(input.targetAudience || featureSet.targetAudience || snapshot.targetAudience || firstContextText(contextSources, ['targetAudience', 'audience', 'who', 'whoItHelps', 'customer', 'users']) || conceptMap.targetAudience || lensContent(audienceLens), 180),
|
||||
constraints: uniqueList([
|
||||
...cleanFlexibleTextList(input.constraints || featureSet.constraints || conceptMap.constraints, 8, 180),
|
||||
...cleanFlexibleTextList(input.constraints || featureSet.constraints || snapshot.constraints || conceptMap.constraints, 8, 180),
|
||||
...collectContextList(contextSources, ['constraints', 'constraint', 'boundaries', 'scope'], 8),
|
||||
...cleanSentenceList(lensContent(constraintsLens), 8, 180),
|
||||
...textContextGuardrails.constraints,
|
||||
], 8),
|
||||
nonGoals: uniqueList([
|
||||
...cleanFlexibleTextList(input.nonGoals || input.avoid || featureSet.nonGoals || featureSet.avoid || conceptMap.nonGoals || conceptMap.avoid, 8, 180),
|
||||
...cleanFlexibleTextList(input.nonGoals || input.avoid || featureSet.nonGoals || featureSet.avoid || snapshot.nonGoals || snapshot.avoid || conceptMap.nonGoals || conceptMap.avoid, 8, 180),
|
||||
...collectContextList(contextSources, ['nonGoals', 'nonGoal', 'avoid', 'notYet', 'doNotBuild'], 8),
|
||||
...textContextGuardrails.nonGoals,
|
||||
], 8),
|
||||
assumptions: uniqueList([
|
||||
...cleanFlexibleTextList(input.assumptions || featureSet.assumptions || conceptMap.assumptions, 6, 180),
|
||||
...cleanFlexibleTextList(input.assumptions || featureSet.assumptions || snapshot.assumptions || conceptMap.assumptions, 6, 180),
|
||||
...collectContextList(contextSources, ['assumptions', 'assumption', 'unknowns', 'openQuestions'], 6),
|
||||
...cleanSentenceList(lensContent(assumptionsLens), 6, 180),
|
||||
], 6),
|
||||
@@ -807,7 +811,9 @@ function optionsFromBuildOrderText(text = '', sourceSection = 'concept-map.lense
|
||||
|
||||
function optionsFromBody(body = {}) {
|
||||
const featureSet = objectFrom(body.featureSet);
|
||||
const conceptMap = objectFrom(body.conceptMap || featureSet.conceptMap);
|
||||
const artifact = objectFrom(body.artifact || featureSet.artifact);
|
||||
const conceptMap = objectFrom(body.conceptMap || featureSet.conceptMap || artifact.conceptMap);
|
||||
const snapshot = objectFrom(body.snapshot || featureSet.snapshot || artifact.snapshot || conceptMap.snapshot);
|
||||
const conceptMapLenses = objectFrom(conceptMap.lenses || body.lenses || featureSet.lenses);
|
||||
const buildOrderLens = objectFrom(conceptMapLenses.channel || conceptMapLenses.buildOrder || conceptMap.buildOrder);
|
||||
const directCandidateGroup = compactCandidateGroup([
|
||||
@@ -838,11 +844,26 @@ function optionsFromBody(body = {}) {
|
||||
{ items: conceptMap.deferred || conceptMap.defer || conceptMap.later, sourceSection: 'concept-map.deferred', defaultLane: 'defer' },
|
||||
{ items: conceptMap.parkingLot || conceptMap.park || conceptMap.parked, sourceSection: 'concept-map.parkingLot', defaultLane: 'park' },
|
||||
]);
|
||||
const snapshotCandidateGroup = compactCandidateGroup([
|
||||
{ items: snapshot.nextActions, sourceSection: 'snapshot.nextActions' },
|
||||
{ items: snapshot.nextMoves, sourceSection: 'snapshot.nextMoves' },
|
||||
{ items: snapshot.actions, sourceSection: 'snapshot.actions' },
|
||||
{ items: snapshot.features, sourceSection: 'snapshot.features' },
|
||||
{ items: snapshot.candidates, sourceSection: 'snapshot.candidates' },
|
||||
{ items: snapshot.validateNext || snapshot.validate || snapshot.validation, sourceSection: 'snapshot.validateNext', defaultLane: 'validate-next' },
|
||||
{ items: snapshot.experiments, sourceSection: 'snapshot.experiments', defaultLane: 'validate-next' },
|
||||
{ items: snapshot.validationTests, sourceSection: 'snapshot.experiments', defaultLane: 'validate-next' },
|
||||
{ items: snapshot.proofTests, sourceSection: 'snapshot.experiments', defaultLane: 'validate-next' },
|
||||
{ items: snapshot.deferred || snapshot.defer || snapshot.later, sourceSection: 'snapshot.deferred', defaultLane: 'defer' },
|
||||
{ items: snapshot.parkingLot || snapshot.park || snapshot.parked, sourceSection: 'snapshot.parkingLot', defaultLane: 'park' },
|
||||
]);
|
||||
const groupedCandidates = [
|
||||
...directCandidateGroup,
|
||||
...snapshotCandidateGroup,
|
||||
...conceptMapCandidateGroup,
|
||||
...buildOrderSectionGroup(body.buildOrder, 'buildOrder'),
|
||||
...buildOrderSectionGroup(featureSet.buildOrder, 'feature-set.buildOrder'),
|
||||
...buildOrderSectionGroup(snapshot.buildOrder, 'snapshot.buildOrder'),
|
||||
...buildOrderSectionGroup(conceptMap.buildOrder, 'concept-map.buildOrder'),
|
||||
];
|
||||
if (groupedCandidates.length) return normalizeCandidateGroup(groupedCandidates);
|
||||
|
||||
Reference in New Issue
Block a user