-
Notifications
You must be signed in to change notification settings - Fork 0
Strengthen portfolio evidence links and publication controls #11
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
cbratkovics
merged 1 commit into
main
from
codex/remove-career-coaching-materials-from-repository
Sep 15, 2026
Merged
Changes from all commits
Commits
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
This file was deleted.
Oops, something went wrong.
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,81 @@ | ||
| import { execFile } from "node:child_process"; | ||
| import { readdir, readFile, stat } from "node:fs/promises"; | ||
| import path from "node:path"; | ||
| import { fileURLToPath } from "node:url"; | ||
| import { promisify } from "node:util"; | ||
|
|
||
| const execFileAsync = promisify(execFile); | ||
| const scriptDirectory = path.dirname(fileURLToPath(import.meta.url)); | ||
| const repositoryRoot = path.resolve(scriptDirectory, "../.."); | ||
| const textExtensions = new Set([".css", ".html", ".js", ".json", ".jsx", ".md", ".mdx", ".mjs", ".svg", ".ts", ".tsx", ".txt", ".yaml", ".yml", ".xml"]); | ||
|
|
||
| // Expressions are assembled so the publication checker can inspect its own source. | ||
| export const preparationRules = [ | ||
| { id: "interview-preparation", expression: new RegExp(`\\binterview(?:er|ing)?\\s+(?:${["prep", "preparation", "answers?", "narratives?", "talking points?"].join("|")})`, "i") }, | ||
| { id: "structured-response-coaching", expression: new RegExp(`\\b${["ST", "AR"].join("")}[- ](?:answers?|responses?|stories?)\\b`, "i") }, | ||
| { id: "profile-tailoring", expression: new RegExp(`\\b(?:tailor|rewrite|optimi[sz]e|align)\\s+(?:your\\s+|the\\s+)?(?:r[ée]sum[ée]|CV|LinkedIn)(?:\\s+(?:profile|bullets?|copy))?\\b`, "i") }, | ||
| { id: "interviewer-talking-points", expression: new RegExp(`\\b(?:say|tell|explain)\\s+(?:this\\s+)?to\\s+(?:an?\\s+|the\\s+)?interviewer\\b`, "i") }, | ||
| { id: "target-role-guidance", expression: new RegExp(`\\b(?:target(?:ing)?\\s+(?:a\\s+|the\\s+)?role|role[- ]targeting|${["career", "signal roadmap"].join("[- ]")})\\b`, "i") }, | ||
| { id: "recruiting-talking-points", expression: new RegExp(`\\b(?:recruiter|recruiting)\\s+(?:script|talking points?|pitch)\\b`, "i") }, | ||
| ]; | ||
|
|
||
| export const suspiciousDocumentName = new RegExp(`(?:^|/)(?:alignment[-_ ]notes|interview[-_ ](?:prep|notes)|career[-_ ]coaching|(?:r[ée]sum[ée]|linkedin)[-_ ](?:alignment|notes|guidance))(?:\\.[^/]*)?$`, "i"); | ||
|
|
||
| export function scanText(contents) { | ||
| const findings = []; | ||
| for (const [index, line] of contents.split(/\r?\n/u).entries()) { | ||
| for (const rule of preparationRules) { | ||
| if (rule.expression.test(line)) findings.push({ line: index + 1, rule: rule.id }); | ||
| } | ||
| } | ||
| return findings; | ||
| } | ||
|
|
||
| async function trackedFiles() { | ||
| const { stdout } = await execFileAsync("git", ["ls-files", "-z"], { cwd: repositoryRoot, encoding: "buffer" }); | ||
| return stdout.toString().split("\0").filter(Boolean); | ||
| } | ||
|
|
||
| async function filesBelow(directory) { | ||
| try { | ||
| const entries = await readdir(directory, { withFileTypes: true }); | ||
| return (await Promise.all(entries.map(async (entry) => { | ||
| const item = path.join(directory, entry.name); | ||
| return entry.isDirectory() ? filesBelow(item) : [item]; | ||
| }))).flat(); | ||
| } catch (error) { | ||
| if (error.code === "ENOENT") return []; | ||
| throw error; | ||
| } | ||
| } | ||
|
|
||
| async function scanFile(file, displayPath) { | ||
| if (!textExtensions.has(path.extname(file).toLowerCase())) return []; | ||
| if ((await stat(file)).size > 10_000_000) return []; | ||
| const contents = await readFile(file, "utf8"); | ||
| return scanText(contents).map(({ line, rule }) => ({ path: displayPath, line, rule })); | ||
| } | ||
|
|
||
| export async function scanRepository({ generated = false } = {}) { | ||
| const findings = []; | ||
| for (const relative of await trackedFiles()) { | ||
| if (suspiciousDocumentName.test(relative)) findings.push({ path: relative, line: 1, rule: "suspicious-document-name" }); | ||
| findings.push(...await scanFile(path.join(repositoryRoot, relative), relative)); | ||
| } | ||
| if (generated) { | ||
| const outputRoot = path.join(repositoryRoot, "portfolio/.next"); | ||
| for (const file of await filesBelow(outputRoot)) findings.push(...await scanFile(file, path.relative(repositoryRoot, file))); | ||
| } | ||
| return findings; | ||
| } | ||
|
|
||
| async function main() { | ||
| const findings = await scanRepository({ generated: process.argv.includes("--generated") }); | ||
| for (const finding of findings) console.error(`${finding.path}:${finding.line} [${finding.rule}]`); | ||
| if (findings.length) { | ||
| console.error(`Publication content check failed with ${findings.length} finding(s).`); | ||
| process.exitCode = 1; | ||
| } else console.log("Publication content check passed."); | ||
| } | ||
|
|
||
| if (path.resolve(process.argv[1] ?? "") === fileURLToPath(import.meta.url)) await main(); | ||
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.
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 a prohibited phrase is soft-wrapped across lines, as commonly happens in Markdown (for example,
interview\npreparation), splitting the contents before applying rules means neither invocation sees the complete phrase;scanTexttherefore returns no findings and the repository publication check passes despite the rendered text containing the prohibited guidance. Scan the complete contents, or include adjacent-line overlap while retaining line-number calculation.Useful? React with 👍 / 👎.