v0.4.2 Enhance interview functionality and settings; add YAML dependency
Node.js build / build (20.x) (push) Waiting to run
Node.js build / build (22.x) (push) Waiting to run

- Introduced profile selection modal for creating notes from interview profiles.
- Added settings for interview configuration path, auto-starting interviews, and intercepting unresolved link clicks.
- Updated package files to include YAML dependency for configuration handling.
- Enhanced CSS for profile selection and interview wizard UI elements.
This commit is contained in:
Lars committed 2026-01-18 21:46:20 +01:00
1 parent 90ccec5f7d
commit 0b763511d8
12 files changed
+978 -26

No files matched your search

+61 -15
View File
@@ -98,6 +98,15 @@ export interface ChainInspectorReport {
loadedAt: number | null;
templateCount: number;
};
templateMatchingProfileUsed?: {
name: string;
resolvedFrom: "settings" | "default";
profileConfig?: {
required_links?: boolean;
min_slots_filled_for_gap_findings?: number;
min_score_for_gap_findings?: number;
};
};
}
const MIN_TEXT_LENGTH_FOR_EDGE_CHECK = 200;
@@ -654,7 +663,8 @@ export async function inspectChains(
chainRoles: ChainRolesConfig | null,
edgeVocabularyPath?: string,
chainTemplates?: ChainTemplatesConfig | null,
templatesLoadResult?: { path: string; status: string; loadedAt: number | null; templateCount: number }
templatesLoadResult?: { path: string; status: string; loadedAt: number | null; templateCount: number },
templateMatchingProfileName?: string
): Promise<ChainInspectorReport> {
// Build index for current note
const currentFile = app.vault.getAbstractFileByPath(context.file);
@@ -950,6 +960,7 @@ export async function inspectChains(
// Template matching
let templateMatches: TemplateMatch[] = [];
let templatesSource: ChainInspectorReport["templatesSource"] = undefined;
let templateMatchingProfileUsed: ChainInspectorReport["templateMatchingProfileUsed"] = undefined;
if (chainTemplates && templatesLoadResult) {
templatesSource = {
@@ -959,6 +970,32 @@ export async function inspectChains(
templateCount: templatesLoadResult.templateCount,
};
// Resolve profile from settings or defaults
const profileName = templateMatchingProfileName || "discovery";
let profile: import("../dictionary/types").TemplateMatchingProfile | undefined;
let resolvedFrom: "settings" | "default" = "default";
if (chainTemplates.defaults?.profiles) {
if (profileName === "discovery" && chainTemplates.defaults.profiles.discovery) {
profile = chainTemplates.defaults.profiles.discovery;
resolvedFrom = templateMatchingProfileName ? "settings" : "default";
} else if (profileName === "decisioning" && chainTemplates.defaults.profiles.decisioning) {
profile = chainTemplates.defaults.profiles.decisioning;
resolvedFrom = templateMatchingProfileName ? "settings" : "default";
}
}
// Set profile used info
templateMatchingProfileUsed = {
name: profileName,
resolvedFrom,
profileConfig: profile ? {
required_links: profile.required_links,
min_slots_filled_for_gap_findings: profile.min_slots_filled_for_gap_findings,
min_score_for_gap_findings: profile.min_score_for_gap_findings,
} : undefined,
};
try {
const { matchTemplates } = await import("./templateMatching");
templateMatches = await matchTemplates(
@@ -968,23 +1005,31 @@ export async function inspectChains(
chainTemplates,
chainRoles,
edgeVocabulary,
options
options,
profile
);
// Add template-based findings
// Add template-based findings with profile thresholds
for (const match of templateMatches) {
// missing_slot_<slotId> findings
if (match.missingSlots.length > 0 && (match.score >= 0 || match.slotAssignments && Object.keys(match.slotAssignments).length >= 2)) {
for (const slotId of match.missingSlots) {
findings.push({
code: `missing_slot_${slotId}`,
severity: "warn",
message: `Template ${match.templateName}: missing slot ${slotId} near current section`,
evidence: {
file: context.file,
sectionHeading: context.heading,
},
});
// missing_slot_<slotId> findings (with profile thresholds)
if (match.missingSlots.length > 0) {
const slotsFilled = Object.keys(match.slotAssignments).length;
const minSlotsFilled = profile?.min_slots_filled_for_gap_findings ?? 2;
const minScore = profile?.min_score_for_gap_findings ?? 0;
// Only emit if thresholds are met
if (slotsFilled >= minSlotsFilled && match.score >= minScore) {
for (const slotId of match.missingSlots) {
findings.push({
code: `missing_slot_${slotId}`,
severity: "warn",
message: `Template ${match.templateName}: missing slot ${slotId} near current section`,
evidence: {
file: context.file,
sectionHeading: context.heading,
},
});
}
}
}
@@ -1024,5 +1069,6 @@ export async function inspectChains(
analysisMeta,
templateMatches: templateMatches.length > 0 ? templateMatches : undefined,
templatesSource,
templateMatchingProfileUsed,
};
}
+11 -9
View File
@@ -3,7 +3,7 @@
*/
import type { App, TFile } from "obsidian";
import type { ChainTemplatesConfig, ChainTemplate, ChainTemplateSlot, ChainTemplateLink } from "../dictionary/types";
import type { ChainTemplatesConfig, ChainTemplate, ChainTemplateSlot, ChainTemplateLink, TemplateMatchingProfile } from "../dictionary/types";
import type { ChainRolesConfig } from "../dictionary/types";
import type { IndexedEdge } from "./graphIndex";
import type { EdgeVocabulary } from "../vocab/types";
@@ -306,7 +306,7 @@ function scoreAssignment(
canonicalEdgeType: (rawType: string) => string | undefined,
chainRoles: ChainRolesConfig | null,
edgeVocabulary: EdgeVocabulary | null,
defaultsRequiredLinks?: boolean,
profile?: TemplateMatchingProfile,
edgeTargetResolutionMap?: Map<string, string>
): {
score: number;
@@ -319,7 +319,10 @@ function scoreAssignment(
let requiredLinks = normalized.links.length;
const roleEvidence: Array<{ from: string; to: string; edgeRole: string; rawEdgeType: string }> = [];
const requiredLinksEnabled = template.matching?.required_links ?? defaultsRequiredLinks ?? false;
// Determine required_links: profile > template.matching > defaults.matching
const requiredLinksEnabled = profile?.required_links ??
template.matching?.required_links ??
false;
// Score slots filled
score += assignment.size * 2;
@@ -392,7 +395,7 @@ function findBestAssignment(
canonicalEdgeType: (rawType: string) => string | undefined,
chainRoles: ChainRolesConfig | null,
edgeVocabulary: EdgeVocabulary | null,
defaultsRequiredLinks?: boolean,
profile?: TemplateMatchingProfile,
edgeTargetResolutionMap?: Map<string, string>
): TemplateMatch | null {
const slots = normalized.slots;
@@ -420,7 +423,7 @@ function findBestAssignment(
canonicalEdgeType,
chainRoles,
edgeVocabulary,
defaultsRequiredLinks,
profile,
edgeTargetResolutionMap
);
@@ -527,7 +530,8 @@ export async function matchTemplates(
templatesConfig: ChainTemplatesConfig | null,
chainRoles: ChainRolesConfig | null,
edgeVocabulary: EdgeVocabulary | null,
options: { includeNoteLinks: boolean; includeCandidates: boolean }
options: { includeNoteLinks: boolean; includeCandidates: boolean },
profile?: TemplateMatchingProfile
): Promise<TemplateMatch[]> {
if (!templatesConfig || !templatesConfig.templates || templatesConfig.templates.length === 0) {
return [];
@@ -556,8 +560,6 @@ export async function matchTemplates(
return result.canonical;
};
const defaultsRequiredLinks = templatesConfig.defaults?.matching?.required_links;
// Match each template
const matches: TemplateMatch[] = [];
@@ -572,7 +574,7 @@ export async function matchTemplates(
canonicalEdgeType,
chainRoles,
edgeVocabulary,
defaultsRequiredLinks,
profile,
edgeTargetResolutionMap
);