36 lines
803 B
JavaScript
Executable File
36 lines
803 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
// SessionStart hook for ArcheFlow plugin.
|
|
// Injects the using-archeflow skill as additional context.
|
|
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
try {
|
|
const pluginRoot = path.resolve(__dirname, "..");
|
|
const skillFile = path.join(pluginRoot, "skills", "using-archeflow", "SKILL.md");
|
|
|
|
if (!fs.existsSync(skillFile)) {
|
|
console.log("{}");
|
|
process.exit(0);
|
|
}
|
|
|
|
const raw = fs.readFileSync(skillFile, "utf8");
|
|
|
|
// Strip YAML frontmatter
|
|
const stripped = raw.replace(/^---\n[\s\S]*?\n---\n?/, "");
|
|
|
|
if (!stripped.trim()) {
|
|
console.log("{}");
|
|
process.exit(0);
|
|
}
|
|
|
|
console.log(JSON.stringify({
|
|
hookSpecificOutput: {
|
|
hookEventName: "SessionStart",
|
|
additionalContext: stripped
|
|
}
|
|
}));
|
|
} catch (e) {
|
|
console.log("{}");
|
|
}
|