@sybelblue/prairielearn-navigator 1.0.1 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -127,3 +127,29 @@ the pull request. Run it from the repository root so annotation paths resolve:
127
127
  ```
128
128
 
129
129
  Requires Node.js 22 or newer.
130
+
131
+ ## Library API
132
+
133
+ The package also exposes a typed, headless resolver for tools that need the
134
+ files used by each question without starting VS Code or invoking the CLI:
135
+
136
+ ```ts
137
+ import { createQuestionFileResolver } from "@sybelblue/prairielearn-navigator";
138
+
139
+ const resolver = createQuestionFileResolver({
140
+ courseRoot: "/path/to/course",
141
+ questions: [
142
+ { qid: "vectors/addition", directory: "questions/vectors/addition" },
143
+ ],
144
+ });
145
+
146
+ const initial = await resolver.resolveAll();
147
+ const changed = await resolver.update(["clientFilesCourse/plots.js"]);
148
+ ```
149
+
150
+ `resolveAll()` returns a `Map` from QID to a `QuestionFileResolution` with
151
+ course-relative file paths, `question-local`, `template-local`, or
152
+ `course-level` provenance, and diagnostics for dependencies that cannot be
153
+ resolved statically. `update()` maintains the dependency graph and returns
154
+ only questions affected by the supplied course-relative paths. The resolver
155
+ does not watch the filesystem; callers decide how and when to batch changes.