safeword 0.3.1 → 0.4.0
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/dist/{chunk-TFNBQCKM.js → chunk-W3FGJHKQ.js} +27 -8
- package/dist/chunk-W3FGJHKQ.js.map +1 -0
- package/dist/cli.js +3 -3
- package/dist/{reset-MGB3ODNQ.js → reset-S2YDE326.js} +2 -2
- package/dist/{setup-D3CYQWGK.js → setup-PUKNUCJO.js} +2 -2
- package/dist/{upgrade-RGBXJUU4.js → upgrade-W5DLDTPU.js} +2 -2
- package/package.json +1 -1
- package/templates/hooks/git-pre-commit.sh +18 -0
- package/templates/hooks/post-tool-lint.sh +43 -0
- package/templates/hooks/prompt-questions.sh +27 -0
- package/templates/hooks/{inject-timestamp.sh → prompt-timestamp.sh} +2 -2
- package/templates/hooks/session-lint-check.sh +42 -0
- package/templates/hooks/{agents-md-check.sh → session-verify-agents.sh} +6 -3
- package/templates/hooks/session-version.sh +17 -0
- package/templates/hooks/stop-quality.sh +44 -0
- package/dist/chunk-TFNBQCKM.js.map +0 -1
- package/templates/hooks/post-tool.sh +0 -4
- package/templates/hooks/pre-commit.sh +0 -10
- /package/dist/{reset-MGB3ODNQ.js.map → reset-S2YDE326.js.map} +0 -0
- /package/dist/{setup-D3CYQWGK.js.map → setup-PUKNUCJO.js.map} +0 -0
- /package/dist/{upgrade-RGBXJUU4.js.map → upgrade-W5DLDTPU.js.map} +0 -0
|
@@ -17,10 +17,10 @@ function isGitRepo(cwd) {
|
|
|
17
17
|
function getHookContent() {
|
|
18
18
|
return `
|
|
19
19
|
${MARKER_START}
|
|
20
|
-
# Safeword
|
|
20
|
+
# Safeword pre-commit linting
|
|
21
21
|
# This section is managed by safeword - do not edit manually
|
|
22
|
-
if [ -f ".safeword/hooks/pre-commit.sh" ]; then
|
|
23
|
-
bash .safeword/hooks/pre-commit.sh
|
|
22
|
+
if [ -f ".safeword/hooks/git-pre-commit.sh" ]; then
|
|
23
|
+
bash .safeword/hooks/git-pre-commit.sh
|
|
24
24
|
fi
|
|
25
25
|
${MARKER_END}
|
|
26
26
|
`;
|
|
@@ -135,20 +135,39 @@ export default [
|
|
|
135
135
|
var SETTINGS_HOOKS = {
|
|
136
136
|
SessionStart: [
|
|
137
137
|
{
|
|
138
|
-
command: "bash .safeword/hooks/
|
|
138
|
+
command: "bash .safeword/hooks/session-verify-agents.sh",
|
|
139
139
|
description: "Safeword: Verify AGENTS.md link"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
command: "bash .safeword/hooks/session-version.sh",
|
|
143
|
+
description: "Safeword: Display version info"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
command: "bash .safeword/hooks/session-lint-check.sh",
|
|
147
|
+
description: "Safeword: Check lint config"
|
|
140
148
|
}
|
|
141
149
|
],
|
|
142
150
|
UserPromptSubmit: [
|
|
143
151
|
{
|
|
144
|
-
command: "bash .safeword/hooks/
|
|
152
|
+
command: "bash .safeword/hooks/prompt-timestamp.sh",
|
|
145
153
|
description: "Safeword: Inject current timestamp"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
command: "bash .safeword/hooks/prompt-questions.sh",
|
|
157
|
+
description: "Safeword: Question protocol guidance"
|
|
158
|
+
}
|
|
159
|
+
],
|
|
160
|
+
Stop: [
|
|
161
|
+
{
|
|
162
|
+
command: "bash .safeword/hooks/stop-quality.sh",
|
|
163
|
+
description: "Safeword: Quality review reminder"
|
|
146
164
|
}
|
|
147
165
|
],
|
|
148
166
|
PostToolUse: [
|
|
149
167
|
{
|
|
150
|
-
|
|
151
|
-
|
|
168
|
+
matcher: "Write|Edit|MultiEdit|NotebookEdit",
|
|
169
|
+
command: "bash .safeword/hooks/post-tool-lint.sh",
|
|
170
|
+
description: "Safeword: Auto-lint changed files"
|
|
152
171
|
}
|
|
153
172
|
]
|
|
154
173
|
};
|
|
@@ -200,4 +219,4 @@ export {
|
|
|
200
219
|
ensureAgentsMdLink,
|
|
201
220
|
removeAgentsMdLink
|
|
202
221
|
};
|
|
203
|
-
//# sourceMappingURL=chunk-
|
|
222
|
+
//# sourceMappingURL=chunk-W3FGJHKQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/git.ts","../src/utils/hooks.ts","../src/templates/content.ts","../src/templates/config.ts","../src/utils/agents-md.ts"],"sourcesContent":["/**\n * Git utilities for CLI operations\n */\n\nimport { execSync } from 'node:child_process';\nimport { join } from 'node:path';\nimport { exists, readFile, writeFile, ensureDir, makeExecutable } from './fs.js';\n\nconst MARKER_START = '# SAFEWORD_ARCH_CHECK_START';\nconst MARKER_END = '# SAFEWORD_ARCH_CHECK_END';\n\n/**\n * Check if directory is a git repository\n */\nexport function isGitRepo(cwd: string): boolean {\n return exists(join(cwd, '.git'));\n}\n\n/**\n * Initialize a git repository\n */\nexport function initGitRepo(cwd: string): void {\n execSync('git init', { cwd, stdio: 'pipe' });\n}\n\n/**\n * Get the pre-commit hook content to add\n */\nfunction getHookContent(): string {\n return `\n${MARKER_START}\n# Safeword pre-commit linting\n# This section is managed by safeword - do not edit manually\nif [ -f \".safeword/hooks/git-pre-commit.sh\" ]; then\n bash .safeword/hooks/git-pre-commit.sh\nfi\n${MARKER_END}\n`;\n}\n\n/**\n * Install safeword markers into pre-commit hook\n */\nexport function installGitHook(cwd: string): void {\n const hooksDir = join(cwd, '.git', 'hooks');\n const hookPath = join(hooksDir, 'pre-commit');\n\n ensureDir(hooksDir);\n\n let content = '';\n\n if (exists(hookPath)) {\n content = readFile(hookPath);\n\n // Check if already has safeword markers\n if (content.includes(MARKER_START)) {\n // Remove existing safeword section and re-add (update)\n content = removeMarkerSection(content);\n }\n } else {\n // Create new hook file with shebang\n content = '#!/bin/bash\\n';\n }\n\n // Add safeword section\n content = content.trimEnd() + '\\n' + getHookContent();\n\n writeFile(hookPath, content);\n makeExecutable(hookPath);\n}\n\n/**\n * Remove safeword markers from pre-commit hook\n */\nexport function removeGitHook(cwd: string): void {\n const hookPath = join(cwd, '.git', 'hooks', 'pre-commit');\n\n if (!exists(hookPath)) return;\n\n let content = readFile(hookPath);\n\n if (!content.includes(MARKER_START)) return;\n\n content = removeMarkerSection(content);\n\n // If only shebang remains, we could delete the file\n // but safer to leave it\n writeFile(hookPath, content);\n}\n\n/**\n * Remove the section between markers (inclusive)\n */\nfunction removeMarkerSection(content: string): string {\n const lines = content.split('\\n');\n const result: string[] = [];\n let inMarkerSection = false;\n\n for (const line of lines) {\n if (line.includes(MARKER_START)) {\n inMarkerSection = true;\n continue;\n }\n if (line.includes(MARKER_END)) {\n inMarkerSection = false;\n continue;\n }\n if (!inMarkerSection) {\n result.push(line);\n }\n }\n\n return result.join('\\n').trim() + '\\n';\n}\n\n/**\n * Check if git hooks have safeword markers\n */\nexport function hasGitHook(cwd: string): boolean {\n const hookPath = join(cwd, '.git', 'hooks', 'pre-commit');\n if (!exists(hookPath)) return false;\n const content = readFile(hookPath);\n return content.includes(MARKER_START);\n}\n","/**\n * Hook utilities for Claude Code settings\n */\n\n/**\n * Type guard to check if a value is a hook object with a command property\n */\nexport function isHookObject(h: unknown): h is { command: string } {\n return (\n typeof h === 'object' &&\n h !== null &&\n 'command' in h &&\n typeof (h as { command: string }).command === 'string'\n );\n}\n\n/**\n * Check if a hook is a safeword hook (command contains '.safeword')\n */\nexport function isSafewordHook(h: unknown): boolean {\n return isHookObject(h) && h.command.includes('.safeword');\n}\n\n/**\n * Filter out safeword hooks from an array of hooks\n */\nexport function filterOutSafewordHooks(hooks: unknown[]): unknown[] {\n return hooks.filter((h) => !isSafewordHook(h));\n}\n","/**\n * Content templates - static string content\n *\n * Note: Most templates (SAFEWORD.md, hooks, skills, guides, etc.) are now\n * file-based in the templates/ directory. This file contains only small\n * string constants that are used inline.\n */\n\nexport const AGENTS_MD_LINK = `**⚠️ ALWAYS READ FIRST: @./.safeword/SAFEWORD.md**\n\nThe SAFEWORD.md file contains core development patterns, workflows, and conventions.\nRead it BEFORE working on any task in this project.\n\n---`;\n\nexport const PRETTIERRC = `{\n \"semi\": true,\n \"singleQuote\": true,\n \"tabWidth\": 2,\n \"trailingComma\": \"es5\",\n \"printWidth\": 100\n}\n`;\n","/**\n * Configuration templates - ESLint config generation and hook settings\n */\n\nexport function getEslintConfig(options: {\n typescript?: boolean;\n react?: boolean;\n nextjs?: boolean;\n astro?: boolean;\n}): string {\n const imports: string[] = ['import js from \"@eslint/js\";'];\n const configs: string[] = ['js.configs.recommended'];\n\n if (options.typescript) {\n imports.push('import tseslint from \"typescript-eslint\";');\n configs.push('...tseslint.configs.recommended');\n }\n\n if (options.react || options.nextjs) {\n imports.push('import react from \"eslint-plugin-react\";');\n imports.push('import reactHooks from \"eslint-plugin-react-hooks\";');\n configs.push('react.configs.flat.recommended');\n configs.push('react.configs.flat[\"jsx-runtime\"]');\n configs.push(\n '{ plugins: { \"react-hooks\": reactHooks }, rules: reactHooks.configs.recommended.rules }',\n );\n }\n\n if (options.nextjs) {\n imports.push('import nextPlugin from \"@next/eslint-plugin-next\";');\n configs.push('{ plugins: { \"@next/next\": nextPlugin }, rules: nextPlugin.configs.recommended.rules }');\n }\n\n if (options.astro) {\n imports.push('import eslintPluginAstro from \"eslint-plugin-astro\";');\n configs.push('...eslintPluginAstro.configs.recommended');\n }\n\n return `${imports.join('\\n')}\n\nexport default [\n ${configs.join(',\\n ')},\n {\n ignores: [\"node_modules/\", \"dist/\", \".next/\", \".astro/\", \"build/\"],\n },\n];\n`;\n}\n\nexport const SETTINGS_HOOKS = {\n SessionStart: [\n {\n command: 'bash .safeword/hooks/session-verify-agents.sh',\n description: 'Safeword: Verify AGENTS.md link',\n },\n {\n command: 'bash .safeword/hooks/session-version.sh',\n description: 'Safeword: Display version info',\n },\n {\n command: 'bash .safeword/hooks/session-lint-check.sh',\n description: 'Safeword: Check lint config',\n },\n ],\n UserPromptSubmit: [\n {\n command: 'bash .safeword/hooks/prompt-timestamp.sh',\n description: 'Safeword: Inject current timestamp',\n },\n {\n command: 'bash .safeword/hooks/prompt-questions.sh',\n description: 'Safeword: Question protocol guidance',\n },\n ],\n Stop: [\n {\n command: 'bash .safeword/hooks/stop-quality.sh',\n description: 'Safeword: Quality review reminder',\n },\n ],\n PostToolUse: [\n {\n matcher: 'Write|Edit|MultiEdit|NotebookEdit',\n command: 'bash .safeword/hooks/post-tool-lint.sh',\n description: 'Safeword: Auto-lint changed files',\n },\n ],\n};\n","/**\n * AGENTS.md file utilities\n */\n\nimport { join } from 'node:path';\nimport { exists, readFile, writeFile } from './fs.js';\nimport { AGENTS_MD_LINK } from '../templates/index.js';\n\nconst SAFEWORD_LINK_MARKER = '@./.safeword/SAFEWORD.md';\n\n/**\n * Check if AGENTS.md has the safeword link\n */\nexport function hasAgentsMdLink(cwd: string): boolean {\n const agentsMdPath = join(cwd, 'AGENTS.md');\n if (!exists(agentsMdPath)) return false;\n const content = readFile(agentsMdPath);\n return content.includes(SAFEWORD_LINK_MARKER);\n}\n\n/**\n * Ensure AGENTS.md exists and has the safeword link.\n * Returns 'created' | 'modified' | 'unchanged'\n */\nexport function ensureAgentsMdLink(cwd: string): 'created' | 'modified' | 'unchanged' {\n const agentsMdPath = join(cwd, 'AGENTS.md');\n\n if (!exists(agentsMdPath)) {\n writeFile(agentsMdPath, `${AGENTS_MD_LINK}\\n`);\n return 'created';\n }\n\n const content = readFile(agentsMdPath);\n if (!content.includes(SAFEWORD_LINK_MARKER)) {\n writeFile(agentsMdPath, `${AGENTS_MD_LINK}\\n\\n${content}`);\n return 'modified';\n }\n\n return 'unchanged';\n}\n\n/**\n * Remove safeword link block from AGENTS.md.\n * Returns true if link was removed.\n */\nexport function removeAgentsMdLink(cwd: string): boolean {\n const agentsMdPath = join(cwd, 'AGENTS.md');\n if (!exists(agentsMdPath)) return false;\n\n const content = readFile(agentsMdPath);\n\n // Remove the entire AGENTS_MD_LINK block if present\n let newContent = content.replace(AGENTS_MD_LINK, '');\n\n // Also handle legacy single-line format (filter any remaining lines with marker)\n const lines = newContent.split('\\n').filter((line) => !line.includes(SAFEWORD_LINK_MARKER));\n\n // Remove extra blank lines and separators at the start\n while (lines.length > 0 && (lines[0].trim() === '' || lines[0].trim() === '---')) {\n lines.shift();\n }\n\n newContent = lines.join('\\n');\n\n if (newContent !== content) {\n writeFile(agentsMdPath, newContent);\n return true;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;;AAIA,SAAS,gBAAgB;AACzB,SAAS,YAAY;AAGrB,IAAM,eAAe;AACrB,IAAM,aAAa;AAKZ,SAAS,UAAU,KAAsB;AAC9C,SAAO,OAAO,KAAK,KAAK,MAAM,CAAC;AACjC;AAYA,SAAS,iBAAyB;AAChC,SAAO;AAAA,EACP,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMZ,UAAU;AAAA;AAEZ;AAKO,SAAS,eAAe,KAAmB;AAChD,QAAM,WAAW,KAAK,KAAK,QAAQ,OAAO;AAC1C,QAAM,WAAW,KAAK,UAAU,YAAY;AAE5C,YAAU,QAAQ;AAElB,MAAI,UAAU;AAEd,MAAI,OAAO,QAAQ,GAAG;AACpB,cAAU,SAAS,QAAQ;AAG3B,QAAI,QAAQ,SAAS,YAAY,GAAG;AAElC,gBAAU,oBAAoB,OAAO;AAAA,IACvC;AAAA,EACF,OAAO;AAEL,cAAU;AAAA,EACZ;AAGA,YAAU,QAAQ,QAAQ,IAAI,OAAO,eAAe;AAEpD,YAAU,UAAU,OAAO;AAC3B,iBAAe,QAAQ;AACzB;AAKO,SAAS,cAAc,KAAmB;AAC/C,QAAM,WAAW,KAAK,KAAK,QAAQ,SAAS,YAAY;AAExD,MAAI,CAAC,OAAO,QAAQ,EAAG;AAEvB,MAAI,UAAU,SAAS,QAAQ;AAE/B,MAAI,CAAC,QAAQ,SAAS,YAAY,EAAG;AAErC,YAAU,oBAAoB,OAAO;AAIrC,YAAU,UAAU,OAAO;AAC7B;AAKA,SAAS,oBAAoB,SAAyB;AACpD,QAAM,QAAQ,QAAQ,MAAM,IAAI;AAChC,QA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AC,OAAO,YAAY,EAAG,QAAO;AAElC,QAAM,UAAU,SAAS,YAAY;AAGrC,MAAI,aAAa,QAAQ,QAAQ,gBAAgB,EAAE;AAGnD,QAAM,QAAQ,WAAW,MAAM,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,KAAK,SAAS,oBAAoB,CAAC;AAG1F,SAAO,MAAM,SAAS,MAAM,MAAM,CAAC,EAAE,KAAK,MAAM,MAAM,MAAM,CAAC,EAAE,KAAK,MAAM,QAAQ;AAChF,UAAM,MAAM;AAAA,EACd;AAEA,eAAa,MAAM,KAAK,IAAI;AAE5B,MAAI,eAAe,SAAS;AAC1B,cAAU,cAAc,UAAU;AAClC,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":["join","join"]}
|
package/dist/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ import { Command } from "commander";
|
|
|
8
8
|
var program = new Command();
|
|
9
9
|
program.name("safeword").description("CLI for setting up and managing safeword development environments").version(VERSION);
|
|
10
10
|
program.command("setup").description("Set up safeword in the current project").option("-y, --yes", "Accept all defaults (non-interactive mode)").action(async (options) => {
|
|
11
|
-
const { setup } = await import("./setup-
|
|
11
|
+
const { setup } = await import("./setup-PUKNUCJO.js");
|
|
12
12
|
await setup(options);
|
|
13
13
|
});
|
|
14
14
|
program.command("check").description("Check project health and versions").option("--offline", "Skip remote version check").action(async (options) => {
|
|
@@ -16,7 +16,7 @@ program.command("check").description("Check project health and versions").option
|
|
|
16
16
|
await check(options);
|
|
17
17
|
});
|
|
18
18
|
program.command("upgrade").description("Upgrade safeword configuration to latest version").action(async () => {
|
|
19
|
-
const { upgrade } = await import("./upgrade-
|
|
19
|
+
const { upgrade } = await import("./upgrade-W5DLDTPU.js");
|
|
20
20
|
await upgrade();
|
|
21
21
|
});
|
|
22
22
|
program.command("diff").description("Preview changes that would be made by upgrade").option("-v, --verbose", "Show full diff output").action(async (options) => {
|
|
@@ -24,7 +24,7 @@ program.command("diff").description("Preview changes that would be made by upgra
|
|
|
24
24
|
await diff(options);
|
|
25
25
|
});
|
|
26
26
|
program.command("reset").description("Remove safeword configuration from project").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
|
|
27
|
-
const { reset } = await import("./reset-
|
|
27
|
+
const { reset } = await import("./reset-S2YDE326.js");
|
|
28
28
|
await reset(options);
|
|
29
29
|
});
|
|
30
30
|
if (process.argv.length === 2) {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
isGitRepo,
|
|
4
4
|
removeAgentsMdLink,
|
|
5
5
|
removeGitHook
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-W3FGJHKQ.js";
|
|
7
7
|
import {
|
|
8
8
|
error,
|
|
9
9
|
exists,
|
|
@@ -140,4 +140,4 @@ async function reset(options) {
|
|
|
140
140
|
export {
|
|
141
141
|
reset
|
|
142
142
|
};
|
|
143
|
-
//# sourceMappingURL=reset-
|
|
143
|
+
//# sourceMappingURL=reset-S2YDE326.js.map
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
getEslintConfig,
|
|
10
10
|
installGitHook,
|
|
11
11
|
isGitRepo
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-W3FGJHKQ.js";
|
|
13
13
|
import {
|
|
14
14
|
copyDir,
|
|
15
15
|
copyFile,
|
|
@@ -279,4 +279,4 @@ Safeword ${VERSION} installed successfully!`);
|
|
|
279
279
|
export {
|
|
280
280
|
setup
|
|
281
281
|
};
|
|
282
|
-
//# sourceMappingURL=setup-
|
|
282
|
+
//# sourceMappingURL=setup-PUKNUCJO.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
filterOutSafewordHooks,
|
|
11
11
|
installGitHook,
|
|
12
12
|
isGitRepo
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-W3FGJHKQ.js";
|
|
14
14
|
import {
|
|
15
15
|
copyDir,
|
|
16
16
|
copyFile,
|
|
@@ -131,4 +131,4 @@ Safeword upgraded to v${VERSION}`);
|
|
|
131
131
|
export {
|
|
132
132
|
upgrade
|
|
133
133
|
};
|
|
134
|
-
//# sourceMappingURL=upgrade-
|
|
134
|
+
//# sourceMappingURL=upgrade-W5DLDTPU.js.map
|
package/package.json
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Safeword: Git pre-commit hook
|
|
3
|
+
# Runs linting on staged files before commit
|
|
4
|
+
|
|
5
|
+
# Change to project directory if set
|
|
6
|
+
[ -n "$CLAUDE_PROJECT_DIR" ] && cd "$CLAUDE_PROJECT_DIR"
|
|
7
|
+
|
|
8
|
+
# Run linting if available
|
|
9
|
+
if [ -f "package.json" ] && grep -q '"lint"' package.json; then
|
|
10
|
+
npm run lint --silent || exit 1
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
# Run markdown linting if available
|
|
14
|
+
if [ -f "package.json" ] && grep -q '"lint:md"' package.json; then
|
|
15
|
+
npm run lint:md --silent || exit 1
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
exit 0
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Safeword: Auto-lint changed files (PostToolUse)
|
|
3
|
+
# Silently auto-fixes, only outputs unfixable errors
|
|
4
|
+
|
|
5
|
+
input=$(cat)
|
|
6
|
+
file=$(echo "$input" | jq -r '.tool_input.file_path // .tool_input.notebook_path // empty' 2>/dev/null)
|
|
7
|
+
|
|
8
|
+
# Exit silently if no file or file doesn't exist
|
|
9
|
+
[ -z "$file" ] || [ ! -f "$file" ] && exit 0
|
|
10
|
+
|
|
11
|
+
# Change to project directory
|
|
12
|
+
[ -n "$CLAUDE_PROJECT_DIR" ] && cd "$CLAUDE_PROJECT_DIR"
|
|
13
|
+
|
|
14
|
+
# Determine linters based on file extension
|
|
15
|
+
case "$file" in
|
|
16
|
+
*.js|*.jsx|*.ts|*.tsx|*.mjs|*.cjs|*.astro)
|
|
17
|
+
# Prettier (silent, ignore errors)
|
|
18
|
+
npx prettier --write "$file" 2>/dev/null
|
|
19
|
+
|
|
20
|
+
# ESLint --fix (capture unfixable errors)
|
|
21
|
+
errors=$(npx eslint --fix "$file" 2>&1)
|
|
22
|
+
exit_code=$?
|
|
23
|
+
if [ $exit_code -ne 0 ] && [ -n "$errors" ]; then
|
|
24
|
+
echo "$errors"
|
|
25
|
+
fi
|
|
26
|
+
;;
|
|
27
|
+
|
|
28
|
+
*.md)
|
|
29
|
+
# Markdownlint (capture unfixable errors)
|
|
30
|
+
errors=$(npx markdownlint-cli2 --fix "$file" 2>&1)
|
|
31
|
+
exit_code=$?
|
|
32
|
+
if [ $exit_code -ne 0 ] && [ -n "$errors" ]; then
|
|
33
|
+
echo "$errors"
|
|
34
|
+
fi
|
|
35
|
+
;;
|
|
36
|
+
|
|
37
|
+
*.json|*.css|*.scss|*.html|*.yaml|*.yml|*.graphql)
|
|
38
|
+
# Prettier only (silent, ignore errors)
|
|
39
|
+
npx prettier --write "$file" 2>/dev/null
|
|
40
|
+
;;
|
|
41
|
+
esac
|
|
42
|
+
|
|
43
|
+
exit 0
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Safeword: Question protocol guidance (UserPromptSubmit)
|
|
3
|
+
# Reminds Claude to ask 1-5 clarifying questions for ambiguous tasks
|
|
4
|
+
|
|
5
|
+
# Change to project directory if set
|
|
6
|
+
[ -n "$CLAUDE_PROJECT_DIR" ] && cd "$CLAUDE_PROJECT_DIR"
|
|
7
|
+
|
|
8
|
+
if [ ! -d ".safeword" ]; then
|
|
9
|
+
exit 0
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
# Read the user prompt from stdin
|
|
13
|
+
input=$(cat)
|
|
14
|
+
|
|
15
|
+
# Only trigger on substantial prompts (more than 20 chars)
|
|
16
|
+
prompt_length=${#input}
|
|
17
|
+
if [ "$prompt_length" -lt 20 ]; then
|
|
18
|
+
exit 0
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# Output guidance
|
|
22
|
+
cat << 'EOF'
|
|
23
|
+
SAFEWORD Question Protocol: For ambiguous or complex requests, ask 1-5 clarifying questions before proceeding. Focus on:
|
|
24
|
+
- Scope boundaries (what's included/excluded)
|
|
25
|
+
- Technical constraints (frameworks, patterns, compatibility)
|
|
26
|
+
- Success criteria (how will we know it's done)
|
|
27
|
+
EOF
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
# Inject
|
|
3
|
-
# Outputs current
|
|
2
|
+
# Safeword: Inject timestamp (UserPromptSubmit)
|
|
3
|
+
# Outputs current timestamp for Claude's context awareness
|
|
4
4
|
# Helps with accurate ticket timestamps and time-based reasoning
|
|
5
5
|
|
|
6
6
|
echo "Current time: $(date +%s) ($(date -u +%Y-%m-%dT%H:%M:%SZ))"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Safeword: Lint configuration sync check (SessionStart)
|
|
3
|
+
# Warns if ESLint or Prettier configs are missing or out of sync
|
|
4
|
+
|
|
5
|
+
# Change to project directory if set
|
|
6
|
+
[ -n "$CLAUDE_PROJECT_DIR" ] && cd "$CLAUDE_PROJECT_DIR"
|
|
7
|
+
|
|
8
|
+
if [ ! -d ".safeword" ]; then
|
|
9
|
+
exit 0
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
warnings=()
|
|
13
|
+
|
|
14
|
+
# Check for ESLint config
|
|
15
|
+
if [ ! -f "eslint.config.mjs" ] && [ ! -f "eslint.config.js" ] && [ ! -f ".eslintrc.json" ] && [ ! -f ".eslintrc.js" ]; then
|
|
16
|
+
warnings+=("ESLint config not found - run 'npm run lint' may fail")
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
# Check for Prettier config
|
|
20
|
+
if [ ! -f ".prettierrc" ] && [ ! -f ".prettierrc.json" ] && [ ! -f "prettier.config.js" ]; then
|
|
21
|
+
warnings+=("Prettier config not found - formatting may be inconsistent")
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
# Check for required dependencies
|
|
25
|
+
if [ -f "package.json" ]; then
|
|
26
|
+
if ! grep -q '"eslint"' package.json 2>/dev/null; then
|
|
27
|
+
warnings+=("ESLint not in package.json - run 'npm install -D eslint'")
|
|
28
|
+
fi
|
|
29
|
+
if ! grep -q '"prettier"' package.json 2>/dev/null; then
|
|
30
|
+
warnings+=("Prettier not in package.json - run 'npm install -D prettier'")
|
|
31
|
+
fi
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
# Output warnings if any
|
|
35
|
+
if [ ${#warnings[@]} -gt 0 ]; then
|
|
36
|
+
echo "SAFEWORD Lint Check:"
|
|
37
|
+
for warning in "${warnings[@]}"; do
|
|
38
|
+
echo " ⚠️ $warning"
|
|
39
|
+
done
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
exit 0
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
# Safeword AGENTS.md
|
|
3
|
-
#
|
|
2
|
+
# Safeword: Verify AGENTS.md link (SessionStart)
|
|
3
|
+
# Self-heals by restoring the link if removed
|
|
4
4
|
|
|
5
5
|
LINK='**⚠️ ALWAYS READ FIRST: @./.safeword/SAFEWORD.md**'
|
|
6
6
|
|
|
7
|
+
# Change to project directory if set
|
|
8
|
+
[ -n "$CLAUDE_PROJECT_DIR" ] && cd "$CLAUDE_PROJECT_DIR"
|
|
9
|
+
|
|
7
10
|
if [ ! -d ".safeword" ]; then
|
|
8
|
-
# Not a safeword project, skip
|
|
11
|
+
# Not a safeword project, skip silently
|
|
9
12
|
exit 0
|
|
10
13
|
fi
|
|
11
14
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Safeword: Display version on session start (SessionStart)
|
|
3
|
+
# Shows current safeword version and confirms hooks are active
|
|
4
|
+
|
|
5
|
+
# Change to project directory if set
|
|
6
|
+
[ -n "$CLAUDE_PROJECT_DIR" ] && cd "$CLAUDE_PROJECT_DIR"
|
|
7
|
+
|
|
8
|
+
if [ ! -d ".safeword" ]; then
|
|
9
|
+
exit 0
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
VERSION="unknown"
|
|
13
|
+
if [ -f ".safeword/version" ]; then
|
|
14
|
+
VERSION=$(cat .safeword/version)
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
echo "SAFE WORD Claude Config v${VERSION} installed - auto-linting and quality review active"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Safeword: Quality review on stop (Stop)
|
|
3
|
+
# Triggers a quality review reminder when Claude stops
|
|
4
|
+
|
|
5
|
+
# Change to project directory if set
|
|
6
|
+
[ -n "$CLAUDE_PROJECT_DIR" ] && cd "$CLAUDE_PROJECT_DIR"
|
|
7
|
+
|
|
8
|
+
if [ ! -d ".safeword" ]; then
|
|
9
|
+
exit 0
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
# Check if there are uncommitted changes
|
|
13
|
+
if ! command -v git &> /dev/null; then
|
|
14
|
+
exit 0
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
if [ ! -d ".git" ]; then
|
|
18
|
+
exit 0
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# Check for modified files
|
|
22
|
+
changed_files=$(git diff --name-only 2>/dev/null | head -20)
|
|
23
|
+
staged_files=$(git diff --staged --name-only 2>/dev/null | head -20)
|
|
24
|
+
|
|
25
|
+
if [ -n "$changed_files" ] || [ -n "$staged_files" ]; then
|
|
26
|
+
echo ""
|
|
27
|
+
echo "SAFEWORD Quality Check:"
|
|
28
|
+
echo " Consider running '/quality-review' before committing changes."
|
|
29
|
+
echo " Modified files:"
|
|
30
|
+
|
|
31
|
+
if [ -n "$staged_files" ]; then
|
|
32
|
+
echo "$staged_files" | while read -r file; do
|
|
33
|
+
echo " [staged] $file"
|
|
34
|
+
done
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
if [ -n "$changed_files" ]; then
|
|
38
|
+
echo "$changed_files" | while read -r file; do
|
|
39
|
+
echo " $file"
|
|
40
|
+
done
|
|
41
|
+
fi
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
exit 0
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/git.ts","../src/utils/hooks.ts","../src/templates/content.ts","../src/templates/config.ts","../src/utils/agents-md.ts"],"sourcesContent":["/**\n * Git utilities for CLI operations\n */\n\nimport { execSync } from 'node:child_process';\nimport { join } from 'node:path';\nimport { exists, readFile, writeFile, ensureDir, makeExecutable } from './fs.js';\n\nconst MARKER_START = '# SAFEWORD_ARCH_CHECK_START';\nconst MARKER_END = '# SAFEWORD_ARCH_CHECK_END';\n\n/**\n * Check if directory is a git repository\n */\nexport function isGitRepo(cwd: string): boolean {\n return exists(join(cwd, '.git'));\n}\n\n/**\n * Initialize a git repository\n */\nexport function initGitRepo(cwd: string): void {\n execSync('git init', { cwd, stdio: 'pipe' });\n}\n\n/**\n * Get the pre-commit hook content to add\n */\nfunction getHookContent(): string {\n return `\n${MARKER_START}\n# Safeword architecture check\n# This section is managed by safeword - do not edit manually\nif [ -f \".safeword/hooks/pre-commit.sh\" ]; then\n bash .safeword/hooks/pre-commit.sh\nfi\n${MARKER_END}\n`;\n}\n\n/**\n * Install safeword markers into pre-commit hook\n */\nexport function installGitHook(cwd: string): void {\n const hooksDir = join(cwd, '.git', 'hooks');\n const hookPath = join(hooksDir, 'pre-commit');\n\n ensureDir(hooksDir);\n\n let content = '';\n\n if (exists(hookPath)) {\n content = readFile(hookPath);\n\n // Check if already has safeword markers\n if (content.includes(MARKER_START)) {\n // Remove existing safeword section and re-add (update)\n content = removeMarkerSection(content);\n }\n } else {\n // Create new hook file with shebang\n content = '#!/bin/bash\\n';\n }\n\n // Add safeword section\n content = content.trimEnd() + '\\n' + getHookContent();\n\n writeFile(hookPath, content);\n makeExecutable(hookPath);\n}\n\n/**\n * Remove safeword markers from pre-commit hook\n */\nexport function removeGitHook(cwd: string): void {\n const hookPath = join(cwd, '.git', 'hooks', 'pre-commit');\n\n if (!exists(hookPath)) return;\n\n let content = readFile(hookPath);\n\n if (!content.includes(MARKER_START)) return;\n\n content = removeMarkerSection(content);\n\n // If only shebang remains, we could delete the file\n // but safer to leave it\n writeFile(hookPath, content);\n}\n\n/**\n * Remove the section between markers (inclusive)\n */\nfunction removeMarkerSection(content: string): string {\n const lines = content.split('\\n');\n const result: string[] = [];\n let inMarkerSection = false;\n\n for (const line of lines) {\n if (line.includes(MARKER_START)) {\n inMarkerSection = true;\n continue;\n }\n if (line.includes(MARKER_END)) {\n inMarkerSection = false;\n continue;\n }\n if (!inMarkerSection) {\n result.push(line);\n }\n }\n\n return result.join('\\n').trim() + '\\n';\n}\n\n/**\n * Check if git hooks have safeword markers\n */\nexport function hasGitHook(cwd: string): boolean {\n const hookPath = join(cwd, '.git', 'hooks', 'pre-commit');\n if (!exists(hookPath)) return false;\n const content = readFile(hookPath);\n return content.includes(MARKER_START);\n}\n","/**\n * Hook utilities for Claude Code settings\n */\n\n/**\n * Type guard to check if a value is a hook object with a command property\n */\nexport function isHookObject(h: unknown): h is { command: string } {\n return (\n typeof h === 'object' &&\n h !== null &&\n 'command' in h &&\n typeof (h as { command: string }).command === 'string'\n );\n}\n\n/**\n * Check if a hook is a safeword hook (command contains '.safeword')\n */\nexport function isSafewordHook(h: unknown): boolean {\n return isHookObject(h) && h.command.includes('.safeword');\n}\n\n/**\n * Filter out safeword hooks from an array of hooks\n */\nexport function filterOutSafewordHooks(hooks: unknown[]): unknown[] {\n return hooks.filter((h) => !isSafewordHook(h));\n}\n","/**\n * Content templates - static string content\n *\n * Note: Most templates (SAFEWORD.md, hooks, skills, guides, etc.) are now\n * file-based in the templates/ directory. This file contains only small\n * string constants that are used inline.\n */\n\nexport const AGENTS_MD_LINK = `**⚠️ ALWAYS READ FIRST: @./.safeword/SAFEWORD.md**\n\nThe SAFEWORD.md file contains core development patterns, workflows, and conventions.\nRead it BEFORE working on any task in this project.\n\n---`;\n\nexport const PRETTIERRC = `{\n \"semi\": true,\n \"singleQuote\": true,\n \"tabWidth\": 2,\n \"trailingComma\": \"es5\",\n \"printWidth\": 100\n}\n`;\n","/**\n * Configuration templates - ESLint config generation and hook settings\n */\n\nexport function getEslintConfig(options: {\n typescript?: boolean;\n react?: boolean;\n nextjs?: boolean;\n astro?: boolean;\n}): string {\n const imports: string[] = ['import js from \"@eslint/js\";'];\n const configs: string[] = ['js.configs.recommended'];\n\n if (options.typescript) {\n imports.push('import tseslint from \"typescript-eslint\";');\n configs.push('...tseslint.configs.recommended');\n }\n\n if (options.react || options.nextjs) {\n imports.push('import react from \"eslint-plugin-react\";');\n imports.push('import reactHooks from \"eslint-plugin-react-hooks\";');\n configs.push('react.configs.flat.recommended');\n configs.push('react.configs.flat[\"jsx-runtime\"]');\n configs.push(\n '{ plugins: { \"react-hooks\": reactHooks }, rules: reactHooks.configs.recommended.rules }',\n );\n }\n\n if (options.nextjs) {\n imports.push('import nextPlugin from \"@next/eslint-plugin-next\";');\n configs.push('{ plugins: { \"@next/next\": nextPlugin }, rules: nextPlugin.configs.recommended.rules }');\n }\n\n if (options.astro) {\n imports.push('import eslintPluginAstro from \"eslint-plugin-astro\";');\n configs.push('...eslintPluginAstro.configs.recommended');\n }\n\n return `${imports.join('\\n')}\n\nexport default [\n ${configs.join(',\\n ')},\n {\n ignores: [\"node_modules/\", \"dist/\", \".next/\", \".astro/\", \"build/\"],\n },\n];\n`;\n}\n\nexport const SETTINGS_HOOKS = {\n SessionStart: [\n {\n command: 'bash .safeword/hooks/agents-md-check.sh',\n description: 'Safeword: Verify AGENTS.md link',\n },\n ],\n UserPromptSubmit: [\n {\n command: 'bash .safeword/hooks/inject-timestamp.sh',\n description: 'Safeword: Inject current timestamp',\n },\n ],\n PostToolUse: [\n {\n command: 'bash .safeword/hooks/post-tool.sh 2>/dev/null || true',\n description: 'Safeword: Post-tool validation',\n },\n ],\n};\n","/**\n * AGENTS.md file utilities\n */\n\nimport { join } from 'node:path';\nimport { exists, readFile, writeFile } from './fs.js';\nimport { AGENTS_MD_LINK } from '../templates/index.js';\n\nconst SAFEWORD_LINK_MARKER = '@./.safeword/SAFEWORD.md';\n\n/**\n * Check if AGENTS.md has the safeword link\n */\nexport function hasAgentsMdLink(cwd: string): boolean {\n const agentsMdPath = join(cwd, 'AGENTS.md');\n if (!exists(agentsMdPath)) return false;\n const content = readFile(agentsMdPath);\n return content.includes(SAFEWORD_LINK_MARKER);\n}\n\n/**\n * Ensure AGENTS.md exists and has the safeword link.\n * Returns 'created' | 'modified' | 'unchanged'\n */\nexport function ensureAgentsMdLink(cwd: string): 'created' | 'modified' | 'unchanged' {\n const agentsMdPath = join(cwd, 'AGENTS.md');\n\n if (!exists(agentsMdPath)) {\n writeFile(agentsMdPath, `${AGENTS_MD_LINK}\\n`);\n return 'created';\n }\n\n const content = readFile(agentsMdPath);\n if (!content.includes(SAFEWORD_LINK_MARKER)) {\n writeFile(agentsMdPath, `${AGENTS_MD_LINK}\\n\\n${content}`);\n return 'modified';\n }\n\n return 'unchanged';\n}\n\n/**\n * Remove safeword link block from AGENTS.md.\n * Returns true if link was removed.\n */\nexport function removeAgentsMdLink(cwd: string): boolean {\n const agentsMdPath = join(cwd, 'AGENTS.md');\n if (!exists(agentsMdPath)) return false;\n\n const content = readFile(agentsMdPath);\n\n // Remove the entire AGENTS_MD_LINK block if present\n let newContent = content.replace(AGENTS_MD_LINK, '');\n\n // Also handle legacy single-line format (filter any remaining lines with marker)\n const lines = newContent.split('\\n').filter((line) => !line.includes(SAFEWORD_LINK_MARKER));\n\n // Remove extra blank lines and separators at the start\n while (lines.length > 0 && (lines[0].trim() === '' || lines[0].trim() === '---')) {\n lines.shift();\n }\n\n newContent = lines.join('\\n');\n\n if (newContent !== content) {\n writeFile(agentsMdPath, newContent);\n return true;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;;AAIA,S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