feat: add spark table completion and rolling support

Implement "spark tables" functionality, which allows users to roll
dice against markdown tables to retrieve specific values.

- Add `sparkTablesSource` to scan markdown files for tables starting
  with a dice notation (e.g., d6, d20).
- Implement `/spark` command in the journal to resolve and roll
  spark tables.
- Add a new message type `spark` with a dedicated UI component to
  render the results.
- Update completions API to include spark table metadata.
This commit is contained in:
2026-07-07 19:02:17 +08:00
parent 3690d13407
commit 2f29f8774d
10 changed files with 587 additions and 10 deletions
+7 -1
View File
@@ -4,16 +4,22 @@
import { diceSource } from "./sources/dice.js";
import { linksSource } from "./sources/links.js";
import { sparkTablesSource } from "./sources/spark-tables.js";
import type { CompletionSource, CompletionsPayload } from "./types.js";
export type {
CompletionsPayload,
DiceCompletion,
LinkCompletion,
SparkTableCompletion,
} from "./types.js";
/** Registered sources — open for extension */
const sources: CompletionSource[] = [diceSource, linksSource];
const sources: CompletionSource[] = [
diceSource,
linksSource,
sparkTablesSource,
];
/**
* Scan the full content index and return structured completion data.