Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"dts-bundle-generator": "9.5.1",
"esbuild": "0.28.2",
"lefthook": "^2.2.2",
"structured-context-map-views": "^0.5.0"
"structured-context-map-views": "^0.6.0"
},
"peerDependencies": {
"typescript": "^5"
Expand Down
2 changes: 1 addition & 1 deletion plugin/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "structured-context",
"version": "0.23.0",
"version": "0.23.1",
"description": "Structured content authoring for Obsidian — automatic validation hooks, slash commands, and agent skills to keep markdown files compliant with your schema.",
"homepage": "https://github.com/mindsocket/structured-context",
"repository": "https://github.com/mindsocket/structured-context",
Expand Down
39 changes: 2 additions & 37 deletions plugin/hooks/map-pane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,33 +126,10 @@ function findOccurrence(occurrences: Occurrence[], key: string): Occurrence | un
return undefined;
}

type Issue = PaneData['validation']['issues'][number];

// PROTOTYPE: structured-context-map-views 0.5 takes issues by node plus the global rule violations.
// Drop this once a map-views release takes the issue list itself.
function byNode(list: Issue[]): Parameters<typeof annotationsFrom>[0] {
const issues: Record<
string,
Record<string, Pick<Issue, 'kind' | 'message' | 'severity'> & { line?: number; column?: number }>
> = {};
const ruleViolations: { ruleId: string; severity: Issue['severity']; description: string }[] = [];
for (const issue of list) {
if (issue.kind === 'parse') continue;
if (issue.nodeId === undefined) {
if (issue.kind === 'rule') ruleViolations.push(issue);
continue;
}
const { kind, message, severity, source } = issue;
issues[issue.nodeId] ??= {};
issues[issue.nodeId]![issue.key] = { kind, message, severity, line: source?.line, column: source?.column };
}
return { issues, ruleViolations } as Parameters<typeof annotationsFrom>[0];
}

function project(data: PaneData, hierarchy?: string): { graph: Graph; tree: Tree; annotations: Annotations } {
const graph = spaceGraphFrom(data.graph as Parameters<typeof spaceGraphFrom>[0], { hierarchy });
const tree = buildTree(graph, 'pane');
const annotations = annotationsFrom(byNode(data.validation.issues), graph);
const annotations = annotationsFrom(data.validation, graph);
return { graph, tree, annotations };
}

Expand Down Expand Up @@ -266,8 +243,6 @@ export function registerMapPane(on: On): void {
const counts = { error: 0, warning: 0, info: 0 };
for (const results of annotations.annotations.values()) for (const a of results) counts[a.severity]++;
for (const a of annotations.unattached) counts[a.severity]++;
const parseIssues = data.validation.issues.filter((issue) => issue.kind === 'parse');
for (const issue of parseIssues) counts[issue.severity]++;

const toggle = (key: string) =>
update($, collapsed, (keys) => (keys.includes(key) ? keys.filter((k) => k !== key) : [...keys, key]));
Expand Down Expand Up @@ -367,22 +342,12 @@ export function registerMapPane(on: On): void {
{unattached.slice(0, UNATTACHED_LIMIT).map((a) => (
<Text color={SEVERITY_COLOR[a.severity]}>
{' '}
{a.nodeId ?? 'space'}: {describe(a)}
{a.nodeId ?? a.location?.file ?? 'space'}: {describe(a)}
</Text>
))}
{unattached.length > UNATTACHED_LIMIT && (
<Text dimColor>{` and ${unattached.length - UNATTACHED_LIMIT} more`}</Text>
)}
{parseIssues.length > 0 && <Text>Could not parse ({parseIssues.length}):</Text>}
{parseIssues.slice(0, UNATTACHED_LIMIT).map((issue) => (
<Text color={SEVERITY_COLOR[issue.severity]}>
{' '}
{issue.source?.file}: {issue.severity}: {issue.message}
</Text>
))}
{parseIssues.length > UNATTACHED_LIMIT && (
<Text dimColor>{` and ${parseIssues.length - UNATTACHED_LIMIT} more`}</Text>
)}
</Box>
);
});
Expand Down
38 changes: 14 additions & 24 deletions plugin/hooks/projection.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading