NotePicker - V1
Node.js build / build (20.x) (push) Waiting to run
Node.js build / build (22.x) (push) Waiting to run

This commit is contained in:
Lars committed 2026-01-17 06:28:36 +01:00
1 parent b5f2c8fc67
commit 78e8216ab9
13 files changed
+1651 -4

No files matched your search

+27
View File
@@ -377,6 +377,33 @@ function parseStep(raw: Record<string, unknown>): InterviewStep | null {
return step;
}
if (type === "entity_picker") {
const key = getKey();
if (!key) {
return null;
}
const step: InterviewStep = {
type: "entity_picker",
key: key,
};
if (typeof raw.label === "string" && raw.label.trim()) {
step.label = raw.label.trim();
}
if (typeof raw.prompt === "string" && raw.prompt.trim()) {
step.prompt = raw.prompt.trim();
}
if (typeof raw.required === "boolean") {
step.required = raw.required;
}
if (typeof raw.labelField === "string" && raw.labelField.trim()) {
step.labelField = raw.labelField.trim();
}
return step;
}
if (type === "review") {
const key = getKey();
if (!key) {
+29 -1
View File
@@ -3,7 +3,7 @@
* Converts collected answers into markdown output based on profile configuration.
*/
import type { InterviewProfile, InterviewStep, CaptureTextStep, CaptureTextLineStep, CaptureFrontmatterStep, LoopStep } from "./types";
import type { InterviewProfile, InterviewStep, CaptureTextStep, CaptureTextLineStep, CaptureFrontmatterStep, LoopStep, EntityPickerStep } from "./types";
export interface RenderAnswers {
collectedData: Map<string, unknown>;
@@ -44,6 +44,8 @@ function renderStep(step: InterviewStep, answers: RenderAnswers): string | null
return null;
case "loop":
return renderLoop(step, answers);
case "entity_picker":
return renderEntityPicker(step, answers);
case "instruction":
case "llm_dialog":
case "review":
@@ -122,6 +124,32 @@ function renderCaptureTextLine(step: CaptureTextLineStep, answers: RenderAnswers
return headingPrefix + text;
}
/**
* Render entity_picker step.
*/
function renderEntityPicker(step: EntityPickerStep, answers: RenderAnswers): string | null {
const basename = answers.collectedData.get(step.key);
if (!basename || typeof basename !== "string" || !basename.trim()) {
return null;
}
// Check if there's a label field
let label: string | undefined;
if (step.labelField) {
const labelValue = answers.collectedData.get(step.labelField);
if (labelValue && typeof labelValue === "string" && labelValue.trim()) {
label = labelValue.trim();
}
}
// Render wikilink
if (label) {
return `[[${basename}|${label}]]`;
} else {
return `[[${basename}]]`;
}
}
/**
* Render capture_frontmatter step.
* Note: This is typically handled separately, but included for completeness.
+11 -1
View File
@@ -24,7 +24,8 @@ export type InterviewStep =
| CaptureTextStep
| CaptureTextLineStep
| InstructionStep
| ReviewStep;
| ReviewStep
| EntityPickerStep;
export interface LoopStep {
type: "loop";
@@ -96,6 +97,15 @@ export interface InstructionStep {
content: string;
}
export interface EntityPickerStep {
type: "entity_picker";
key: string;
label?: string;
prompt?: string;
required?: boolean;
labelField?: string; // Optional field key to use as wikilink label
}
export interface ReviewStep {
type: "review";
key: string;