Repository navigation
feat(elos): pedagogical base, cited course questions, private answer keys #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // Moves a pedagogical base's answer key out of the folder shared with the agent. | ||
| // Usage: npm run mcp:split-base -- <base folder> <answers dir> | ||
| // Writes <answers dir>/<base name>.json (mode 600) and rewrites exercises.json without it. | ||
| import { chmodSync, mkdirSync, readFileSync, writeFileSync } from "node:fs"; | ||
| import path from "node:path"; | ||
| import { splitAnswerKey } from "../src/modules/learning-studio/pedagogical-base.ts"; | ||
|
|
||
| const [folder, answersDir] = process.argv.slice(2).map((value) => path.resolve(value)); | ||
| if (!folder || !answersDir) throw new Error("Usage: npm run mcp:split-base -- <base folder> <answers dir>"); | ||
| if (answersDir === folder || answersDir.startsWith(folder + path.sep) || folder.startsWith(answersDir + path.sep)) throw new Error("The answers dir must be outside the base folder."); | ||
|
|
||
| const exercisesFile = path.join(folder, "exercises.json"); | ||
| const { questions, answerKey } = splitAnswerKey(JSON.parse(readFileSync(exercisesFile, "utf8"))); | ||
| if (answerKey.length === 0) { console.log("No answer key in exercises.json: nothing to do."); process.exit(0); } | ||
| mkdirSync(answersDir, { recursive: true, mode: 0o700 }); | ||
| chmodSync(answersDir, 0o700); | ||
| const target = path.join(answersDir, `${path.basename(folder)}.json`); | ||
| writeFileSync(target, JSON.stringify(answerKey), { mode: 0o600 }); | ||
| writeFileSync(exercisesFile, JSON.stringify(questions, null, 1)); | ||
| console.log(`${answerKey.length} answers moved to ${target}; exercises.json now holds questions only.`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When two configured export folders reuse a chapter ID, the list response distinguishes them by base
name, but the follow-up request accepts onlychapter_idand returns the first matching base in sorted order. IDs are only required to be nonempty and are not globally unique, so the corresponding chapter in every later base becomes inaccessible; exercise IDs have the same ambiguity in the other tool. Include a base identifier in both lookup contracts or return composite IDs.Useful? React with 👍 / 👎.