safeword 0.6.3 → 0.6.5
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/{check-PECCGHEA.js → check-OYYSYHFP.js} +41 -23
- package/dist/check-OYYSYHFP.js.map +1 -0
- package/dist/chunk-LNSEDZIW.js +454 -0
- package/dist/chunk-LNSEDZIW.js.map +1 -0
- package/dist/chunk-ZS3Z3Q37.js +729 -0
- package/dist/chunk-ZS3Z3Q37.js.map +1 -0
- package/dist/cli.js +7 -7
- package/dist/cli.js.map +1 -1
- package/dist/diff-325TIZ63.js +168 -0
- package/dist/diff-325TIZ63.js.map +1 -0
- package/dist/reset-ZGJIKMUW.js +74 -0
- package/dist/reset-ZGJIKMUW.js.map +1 -0
- package/dist/setup-GAMXTFM2.js +103 -0
- package/dist/setup-GAMXTFM2.js.map +1 -0
- package/dist/{sync-4XBMKLXS.js → sync-BFMXZEHM.js} +33 -32
- package/dist/sync-BFMXZEHM.js.map +1 -0
- package/dist/upgrade-X4GREJXN.js +73 -0
- package/dist/upgrade-X4GREJXN.js.map +1 -0
- package/package.json +15 -14
- package/templates/SAFEWORD.md +101 -689
- package/templates/guides/architecture-guide.md +1 -1
- package/templates/guides/cli-reference.md +35 -0
- package/templates/guides/code-philosophy.md +22 -19
- package/templates/guides/context-files-guide.md +2 -2
- package/templates/guides/data-architecture-guide.md +1 -1
- package/templates/guides/design-doc-guide.md +1 -1
- package/templates/guides/{testing-methodology.md → development-workflow.md} +1 -1
- package/templates/guides/learning-extraction.md +1 -1
- package/templates/guides/{llm-instruction-design.md → llm-guide.md} +93 -29
- package/templates/guides/tdd-best-practices.md +2 -2
- package/templates/guides/test-definitions-guide.md +1 -1
- package/templates/guides/user-story-guide.md +1 -1
- package/templates/guides/zombie-process-cleanup.md +1 -1
- package/dist/check-PECCGHEA.js.map +0 -1
- package/dist/chunk-6CVTH67L.js +0 -43
- package/dist/chunk-6CVTH67L.js.map +0 -1
- package/dist/chunk-75FKNZUM.js +0 -15
- package/dist/chunk-75FKNZUM.js.map +0 -1
- package/dist/chunk-ARIAOK2F.js +0 -110
- package/dist/chunk-ARIAOK2F.js.map +0 -1
- package/dist/chunk-FRPJITGG.js +0 -35
- package/dist/chunk-FRPJITGG.js.map +0 -1
- package/dist/chunk-IWWBZVHT.js +0 -274
- package/dist/chunk-IWWBZVHT.js.map +0 -1
- package/dist/diff-ZACVJKOU.js +0 -171
- package/dist/diff-ZACVJKOU.js.map +0 -1
- package/dist/reset-5SRM3P6J.js +0 -145
- package/dist/reset-5SRM3P6J.js.map +0 -1
- package/dist/setup-65EVU5OT.js +0 -437
- package/dist/setup-65EVU5OT.js.map +0 -1
- package/dist/sync-4XBMKLXS.js.map +0 -1
- package/dist/upgrade-P3WX3ODU.js +0 -153
- package/dist/upgrade-P3WX3ODU.js.map +0 -1
- package/templates/guides/llm-prompting.md +0 -102
- /package/templates/prompts/{review.md → quality-review.md} +0 -0
package/dist/chunk-ARIAOK2F.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
// src/utils/fs.ts
|
|
2
|
-
import {
|
|
3
|
-
existsSync,
|
|
4
|
-
mkdirSync,
|
|
5
|
-
readFileSync,
|
|
6
|
-
writeFileSync,
|
|
7
|
-
rmSync,
|
|
8
|
-
readdirSync,
|
|
9
|
-
statSync,
|
|
10
|
-
chmodSync,
|
|
11
|
-
copyFileSync
|
|
12
|
-
} from "fs";
|
|
13
|
-
import { join, dirname } from "path";
|
|
14
|
-
import { fileURLToPath } from "url";
|
|
15
|
-
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
16
|
-
function getTemplatesDir() {
|
|
17
|
-
const fromDist = join(__dirname, "..", "templates");
|
|
18
|
-
const fallback = join(__dirname, "..", "..", "templates");
|
|
19
|
-
if (existsSync(fromDist)) return fromDist;
|
|
20
|
-
if (existsSync(fallback)) return fallback;
|
|
21
|
-
throw new Error("Templates directory not found");
|
|
22
|
-
}
|
|
23
|
-
function exists(path) {
|
|
24
|
-
return existsSync(path);
|
|
25
|
-
}
|
|
26
|
-
function ensureDir(path) {
|
|
27
|
-
if (!existsSync(path)) {
|
|
28
|
-
mkdirSync(path, { recursive: true });
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
function readFile(path) {
|
|
32
|
-
return readFileSync(path, "utf-8");
|
|
33
|
-
}
|
|
34
|
-
function readFileSafe(path) {
|
|
35
|
-
if (!existsSync(path)) return null;
|
|
36
|
-
return readFileSync(path, "utf-8");
|
|
37
|
-
}
|
|
38
|
-
function writeFile(path, content) {
|
|
39
|
-
ensureDir(dirname(path));
|
|
40
|
-
writeFileSync(path, content);
|
|
41
|
-
}
|
|
42
|
-
function remove(path) {
|
|
43
|
-
if (existsSync(path)) {
|
|
44
|
-
rmSync(path, { recursive: true, force: true });
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function listDir(path) {
|
|
48
|
-
if (!existsSync(path)) return [];
|
|
49
|
-
return readdirSync(path);
|
|
50
|
-
}
|
|
51
|
-
function copyFile(src, dest) {
|
|
52
|
-
ensureDir(dirname(dest));
|
|
53
|
-
copyFileSync(src, dest);
|
|
54
|
-
}
|
|
55
|
-
function copyDir(src, dest) {
|
|
56
|
-
ensureDir(dest);
|
|
57
|
-
const entries = readdirSync(src, { withFileTypes: true });
|
|
58
|
-
for (const entry of entries) {
|
|
59
|
-
const srcPath = join(src, entry.name);
|
|
60
|
-
const destPath = join(dest, entry.name);
|
|
61
|
-
if (entry.isDirectory()) {
|
|
62
|
-
copyDir(srcPath, destPath);
|
|
63
|
-
} else {
|
|
64
|
-
copyFileSync(srcPath, destPath);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function makeScriptsExecutable(dirPath) {
|
|
69
|
-
if (!existsSync(dirPath)) return;
|
|
70
|
-
for (const file of readdirSync(dirPath)) {
|
|
71
|
-
if (file.endsWith(".sh")) {
|
|
72
|
-
chmodSync(join(dirPath, file), 493);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
function readJson(path) {
|
|
77
|
-
const content = readFileSafe(path);
|
|
78
|
-
if (!content) return null;
|
|
79
|
-
try {
|
|
80
|
-
return JSON.parse(content);
|
|
81
|
-
} catch {
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
function writeJson(path, data) {
|
|
86
|
-
writeFile(path, JSON.stringify(data, null, 2) + "\n");
|
|
87
|
-
}
|
|
88
|
-
function updateJson(path, updater) {
|
|
89
|
-
const existing = readJson(path);
|
|
90
|
-
const updated = updater(existing);
|
|
91
|
-
writeJson(path, updated);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export {
|
|
95
|
-
getTemplatesDir,
|
|
96
|
-
exists,
|
|
97
|
-
ensureDir,
|
|
98
|
-
readFile,
|
|
99
|
-
readFileSafe,
|
|
100
|
-
writeFile,
|
|
101
|
-
remove,
|
|
102
|
-
listDir,
|
|
103
|
-
copyFile,
|
|
104
|
-
copyDir,
|
|
105
|
-
makeScriptsExecutable,
|
|
106
|
-
readJson,
|
|
107
|
-
writeJson,
|
|
108
|
-
updateJson
|
|
109
|
-
};
|
|
110
|
-
//# sourceMappingURL=chunk-ARIAOK2F.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/fs.ts"],"sourcesContent":["/**\n * File system utilities for CLI operations\n */\n\nimport {\n existsSync,\n mkdirSync,\n readFileSync,\n writeFileSync,\n rmSync,\n readdirSync,\n statSync,\n chmodSync,\n copyFileSync,\n} from 'node:fs';\nimport { join, dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\n// Get the directory of this module (for locating templates)\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\n/**\n * Get path to bundled templates directory.\n * Works in both development (src/) and production (dist/) contexts.\n */\nexport function getTemplatesDir(): string {\n // When running from dist/, __dirname is packages/cli/dist/\n // Templates are at packages/cli/templates/ (one level up)\n const fromDist = join(__dirname, '..', 'templates');\n\n // Fallback path for edge cases\n const fallback = join(__dirname, '..', '..', 'templates');\n\n if (existsSync(fromDist)) return fromDist;\n if (existsSync(fallback)) return fallback;\n\n throw new Error('Templates directory not found');\n}\n\n/**\n * Check if a path exists\n */\nexport function exists(path: string): boolean {\n return existsSync(path);\n}\n\n/**\n * Check if path is a directory\n */\nexport function isDirectory(path: string): boolean {\n return existsSync(path) && statSync(path).isDirectory();\n}\n\n/**\n * Create directory recursively\n */\nexport function ensureDir(path: string): void {\n if (!existsSync(path)) {\n mkdirSync(path, { recursive: true });\n }\n}\n\n/**\n * Read file as string\n */\nexport function readFile(path: string): string {\n return readFileSync(path, 'utf-8');\n}\n\n/**\n * Read file as string, return null if not exists\n */\nexport function readFileSafe(path: string): string | null {\n if (!existsSync(path)) return null;\n return readFileSync(path, 'utf-8');\n}\n\n/**\n * Write file, creating parent directories if needed\n */\nexport function writeFile(path: string, content: string): void {\n ensureDir(dirname(path));\n writeFileSync(path, content);\n}\n\n/**\n * Remove file or directory recursively\n */\nexport function remove(path: string): void {\n if (existsSync(path)) {\n rmSync(path, { recursive: true, force: true });\n }\n}\n\n/**\n * List files in directory\n */\nexport function listDir(path: string): string[] {\n if (!existsSync(path)) return [];\n return readdirSync(path);\n}\n\n/**\n * Copy a single file\n */\nexport function copyFile(src: string, dest: string): void {\n ensureDir(dirname(dest));\n copyFileSync(src, dest);\n}\n\n/**\n * Copy directory recursively\n */\nexport function copyDir(src: string, dest: string): void {\n ensureDir(dest);\n const entries = readdirSync(src, { withFileTypes: true });\n\n for (const entry of entries) {\n const srcPath = join(src, entry.name);\n const destPath = join(dest, entry.name);\n\n if (entry.isDirectory()) {\n copyDir(srcPath, destPath);\n } else {\n copyFileSync(srcPath, destPath);\n }\n }\n}\n\n/**\n * Make file executable\n */\nexport function makeExecutable(path: string): void {\n chmodSync(path, 0o755);\n}\n\n/**\n * Make all shell scripts in a directory executable\n */\nexport function makeScriptsExecutable(dirPath: string): void {\n if (!existsSync(dirPath)) return;\n for (const file of readdirSync(dirPath)) {\n if (file.endsWith('.sh')) {\n chmodSync(join(dirPath, file), 0o755);\n }\n }\n}\n\n/**\n * Read JSON file\n */\nexport function readJson<T = unknown>(path: string): T | null {\n const content = readFileSafe(path);\n if (!content) return null;\n try {\n return JSON.parse(content) as T;\n } catch {\n return null;\n }\n}\n\n/**\n * Write JSON file with formatting\n */\nexport function writeJson(path: string, data: unknown): void {\n writeFile(path, JSON.stringify(data, null, 2) + '\\n');\n}\n\n/**\n * Update JSON file, merging with existing content\n */\nexport function updateJson<T extends Record<string, unknown>>(\n path: string,\n updater: (existing: T | null) => T,\n): void {\n const existing = readJson<T>(path);\n const updated = updater(existing);\n writeJson(path, updated);\n}\n"],"mappings":";AAIA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,MAAM,eAAe;AAC9B,SAAS,qBAAqB;AAG9B,IAAM,YAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AAMjD,SAAS,kBAA0B;AAGxC,QAAM,WAAW,KAAK,WAAW,MAAM,WAAW;AAGlD,QAAM,WAAW,KAAK,WAAW,MAAM,MAAM,WAAW;AAExD,MAAI,WAAW,QAAQ,EAAG,QAAO;AACjC,MAAI,WAAW,QAAQ,EAAG,QAAO;AAEjC,QAAM,IAAI,MAAM,+BAA+B;AACjD;AAKO,SAAS,OAAO,MAAuB;AAC5C,SAAO,WAAW,IAAI;AACxB;AAYO,SAAS,UAAU,MAAoB;AAC5C,MAAI,CAAC,WAAW,IAAI,GAAG;AACrB,cAAU,MAAM,EAAE,WAAW,KAAK,CAAC;AAAA,EACrC;AACF;AAKO,SAAS,SAAS,MAAsB;AAC7C,SAAO,aAAa,MAAM,OAAO;AACnC;AAKO,SAAS,aAAa,MAA6B;AACxD,MAAI,CAAC,WAAW,IAAI,EAAG,QAAO;AAC9B,SAAO,aAAa,MAAM,OA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AAM,CAAC,IAAI,IAAI;AACtD;AAKO,SAAS,WACd,MACA,SACM;AACN,QAAM,WAAW,SAAY,IAAI;AACjC,QAAM,UAAU,QAAQ,QAAQ;AAChC,YAAU,MAAM,OAAO;AACzB;","names":[]}
|
package/dist/chunk-FRPJITGG.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// src/utils/output.ts
|
|
2
|
-
function info(message) {
|
|
3
|
-
console.log(message);
|
|
4
|
-
}
|
|
5
|
-
function success(message) {
|
|
6
|
-
console.log(`\u2713 ${message}`);
|
|
7
|
-
}
|
|
8
|
-
function warn(message) {
|
|
9
|
-
console.warn(`\u26A0 ${message}`);
|
|
10
|
-
}
|
|
11
|
-
function error(message) {
|
|
12
|
-
console.error(`\u2717 ${message}`);
|
|
13
|
-
}
|
|
14
|
-
function header(title) {
|
|
15
|
-
console.log(`
|
|
16
|
-
${title}`);
|
|
17
|
-
console.log("\u2500".repeat(title.length));
|
|
18
|
-
}
|
|
19
|
-
function listItem(item, indent = 2) {
|
|
20
|
-
console.log(`${" ".repeat(indent)}\u2022 ${item}`);
|
|
21
|
-
}
|
|
22
|
-
function keyValue(key, value) {
|
|
23
|
-
console.log(` ${key}: ${value}`);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export {
|
|
27
|
-
info,
|
|
28
|
-
success,
|
|
29
|
-
warn,
|
|
30
|
-
error,
|
|
31
|
-
header,
|
|
32
|
-
listItem,
|
|
33
|
-
keyValue
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=chunk-FRPJITGG.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/output.ts"],"sourcesContent":["/**\n * Console output utilities for consistent CLI messaging\n */\n\n/**\n * Print info message\n */\nexport function info(message: string): void {\n console.log(message);\n}\n\n/**\n * Print success message\n */\nexport function success(message: string): void {\n console.log(`✓ ${message}`);\n}\n\n/**\n * Print warning message\n */\nexport function warn(message: string): void {\n console.warn(`⚠ ${message}`);\n}\n\n/**\n * Print error message to stderr\n */\nexport function error(message: string): void {\n console.error(`✗ ${message}`);\n}\n\n/**\n * Print a blank line\n */\nexport function blank(): void {\n console.log('');\n}\n\n/**\n * Print a section header\n */\nexport function header(title: string): void {\n console.log(`\\n${title}`);\n console.log('─'.repeat(title.length));\n}\n\n/**\n * Print a list item\n */\nexport function listItem(item: string, indent = 2): void {\n console.log(`${' '.repeat(indent)}• ${item}`);\n}\n\n/**\n * Print key-value pair\n */\nexport function keyValue(key: string, value: string): void {\n console.log(` ${key}: ${value}`);\n}\n"],"mappings":";AAOO,SAAS,KAAK,SAAuB;AAC1C,UAAQ,IAAI,OAAO;AACrB;AAKO,SAAS,QAAQ,SAAuB;AAC7C,UAAQ,IAAI,UAAK,OAAO,EAAE;AAC5B;AAKO,SAAS,KAAK,SAAuB;AAC1C,UAAQ,KAAK,UAAK,OAAO,EAAE;AAC7B;AAKO,SAAS,MAAM,SAAuB;AAC3C,UAAQ,MAAM,UAAK,OAAO,EAAE;AAC9B;AAYO,SAAS,OAAO,OAAqB;AAC1C,UAAQ,IAAI;AAAA,EAAK,KAAK,EAAE;AACxB,UAAQ,IAAI,SAAI,OAAO,MAAM,MAAM,CAAC;AACtC;AAKO,SAAS,SAAS,MAAc,SAAS,GAAS;AACvD,UAAQ,IAAI,GAAG,IAAI,OAAO,MAAM,CAAC,UAAK,IAAI,EAAE;AAC9C;AAKO,SAAS,SAAS,KAAa,OAAqB;AACzD,UAAQ,IAAI,KAAK,GAAG,KAAK,KAAK,EAAE;AAClC;","names":[]}
|
package/dist/chunk-IWWBZVHT.js
DELETED
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
exists,
|
|
3
|
-
readFile,
|
|
4
|
-
writeFile
|
|
5
|
-
} from "./chunk-ARIAOK2F.js";
|
|
6
|
-
|
|
7
|
-
// src/utils/hooks.ts
|
|
8
|
-
function isHookEntry(h) {
|
|
9
|
-
return typeof h === "object" && h !== null && "hooks" in h && Array.isArray(h.hooks);
|
|
10
|
-
}
|
|
11
|
-
function isSafewordHook(h) {
|
|
12
|
-
if (!isHookEntry(h)) return false;
|
|
13
|
-
return h.hooks.some(
|
|
14
|
-
(cmd) => typeof cmd.command === "string" && cmd.command.includes(".safeword")
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
function filterOutSafewordHooks(hooks) {
|
|
18
|
-
return hooks.filter((h) => !isSafewordHook(h));
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// src/templates/content.ts
|
|
22
|
-
var AGENTS_MD_LINK = `**\u26A0\uFE0F ALWAYS READ FIRST: @./.safeword/SAFEWORD.md**
|
|
23
|
-
|
|
24
|
-
The SAFEWORD.md file contains core development patterns, workflows, and conventions.
|
|
25
|
-
Read it BEFORE working on any task in this project.
|
|
26
|
-
|
|
27
|
-
---`;
|
|
28
|
-
var PRETTIERRC = `{
|
|
29
|
-
"semi": true,
|
|
30
|
-
"singleQuote": true,
|
|
31
|
-
"tabWidth": 2,
|
|
32
|
-
"trailingComma": "es5",
|
|
33
|
-
"printWidth": 100,
|
|
34
|
-
"endOfLine": "lf"
|
|
35
|
-
}
|
|
36
|
-
`;
|
|
37
|
-
var LINT_STAGED_CONFIG = {
|
|
38
|
-
"*.{js,jsx,ts,tsx,mjs,mts,cjs,cts}": ["eslint --fix", "prettier --write"],
|
|
39
|
-
"*.{vue,svelte,astro}": ["eslint --fix", "prettier --write"],
|
|
40
|
-
"*.{json,css,scss,html,yaml,yml,graphql}": ["prettier --write"],
|
|
41
|
-
"*.md": ["markdownlint-cli2 --fix", "prettier --write"]
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// src/templates/config.ts
|
|
45
|
-
function getEslintConfig(options) {
|
|
46
|
-
return `import { readFileSync } from "fs";
|
|
47
|
-
import { defineConfig } from "eslint/config";
|
|
48
|
-
import js from "@eslint/js";
|
|
49
|
-
import { importX } from "eslint-plugin-import-x";
|
|
50
|
-
import sonarjs from "eslint-plugin-sonarjs";
|
|
51
|
-
import sdl from "@microsoft/eslint-plugin-sdl";
|
|
52
|
-
import playwright from "eslint-plugin-playwright";
|
|
53
|
-
import eslintConfigPrettier from "eslint-config-prettier";
|
|
54
|
-
${options.boundaries ? 'import boundariesConfig from "./.safeword/eslint-boundaries.config.mjs";' : ""}
|
|
55
|
-
|
|
56
|
-
// Read package.json to detect frameworks at runtime
|
|
57
|
-
const pkg = JSON.parse(readFileSync("./package.json", "utf8"));
|
|
58
|
-
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
59
|
-
|
|
60
|
-
// Build dynamic ignores based on detected frameworks
|
|
61
|
-
const ignores = ["node_modules/", "dist/", "build/", "coverage/"];
|
|
62
|
-
if (deps["next"]) ignores.push(".next/");
|
|
63
|
-
if (deps["astro"]) ignores.push(".astro/");
|
|
64
|
-
if (deps["vue"] || deps["nuxt"]) ignores.push(".nuxt/");
|
|
65
|
-
if (deps["svelte"] || deps["@sveltejs/kit"]) ignores.push(".svelte-kit/");
|
|
66
|
-
|
|
67
|
-
// Start with base configs (always loaded)
|
|
68
|
-
const configs = [
|
|
69
|
-
{ ignores },
|
|
70
|
-
js.configs.recommended,
|
|
71
|
-
importX.flatConfigs.recommended,
|
|
72
|
-
sonarjs.configs.recommended,
|
|
73
|
-
...sdl.configs.recommended,
|
|
74
|
-
];
|
|
75
|
-
|
|
76
|
-
// TypeScript support (detected from package.json)
|
|
77
|
-
if (deps["typescript"]) {
|
|
78
|
-
const tseslint = await import("typescript-eslint");
|
|
79
|
-
configs.push(importX.flatConfigs.typescript);
|
|
80
|
-
configs.push(...tseslint.default.configs.recommended);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// React/Next.js support
|
|
84
|
-
if (deps["react"] || deps["next"]) {
|
|
85
|
-
const react = await import("eslint-plugin-react");
|
|
86
|
-
const reactHooks = await import("eslint-plugin-react-hooks");
|
|
87
|
-
const jsxA11y = await import("eslint-plugin-jsx-a11y");
|
|
88
|
-
configs.push(react.default.configs.flat.recommended);
|
|
89
|
-
configs.push(react.default.configs.flat["jsx-runtime"]);
|
|
90
|
-
configs.push({
|
|
91
|
-
name: "react-hooks",
|
|
92
|
-
plugins: { "react-hooks": reactHooks.default },
|
|
93
|
-
rules: reactHooks.default.configs.recommended.rules,
|
|
94
|
-
});
|
|
95
|
-
configs.push(jsxA11y.default.flatConfigs.recommended);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Next.js plugin
|
|
99
|
-
if (deps["next"]) {
|
|
100
|
-
const nextPlugin = await import("@next/eslint-plugin-next");
|
|
101
|
-
configs.push({
|
|
102
|
-
name: "nextjs",
|
|
103
|
-
plugins: { "@next/next": nextPlugin.default },
|
|
104
|
-
rules: nextPlugin.default.configs.recommended.rules,
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Astro support
|
|
109
|
-
if (deps["astro"]) {
|
|
110
|
-
const astro = await import("eslint-plugin-astro");
|
|
111
|
-
configs.push(...astro.default.configs.recommended);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// Vue support
|
|
115
|
-
if (deps["vue"] || deps["nuxt"]) {
|
|
116
|
-
const vue = await import("eslint-plugin-vue");
|
|
117
|
-
configs.push(...vue.default.configs["flat/recommended"]);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// Svelte support
|
|
121
|
-
if (deps["svelte"] || deps["@sveltejs/kit"]) {
|
|
122
|
-
const svelte = await import("eslint-plugin-svelte");
|
|
123
|
-
configs.push(...svelte.default.configs.recommended);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Electron support
|
|
127
|
-
if (deps["electron"]) {
|
|
128
|
-
const electron = await import("@electron-toolkit/eslint-config");
|
|
129
|
-
configs.push(electron.default);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// Vitest support (scoped to test files)
|
|
133
|
-
if (deps["vitest"]) {
|
|
134
|
-
const vitest = await import("@vitest/eslint-plugin");
|
|
135
|
-
configs.push({
|
|
136
|
-
name: "vitest",
|
|
137
|
-
files: ["**/*.test.{js,ts,jsx,tsx}", "**/*.spec.{js,ts,jsx,tsx}", "**/tests/**"],
|
|
138
|
-
plugins: { vitest: vitest.default },
|
|
139
|
-
languageOptions: {
|
|
140
|
-
globals: { ...vitest.default.environments.env.globals },
|
|
141
|
-
},
|
|
142
|
-
rules: { ...vitest.default.configs.recommended.rules },
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Playwright for e2e tests (always included - safeword sets up Playwright)
|
|
147
|
-
configs.push({
|
|
148
|
-
name: "playwright",
|
|
149
|
-
files: ["**/e2e/**", "**/*.e2e.{js,ts,jsx,tsx}", "**/playwright/**"],
|
|
150
|
-
...playwright.configs["flat/recommended"],
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
// Architecture boundaries${options.boundaries ? "\nconfigs.push(boundariesConfig);" : ""}
|
|
154
|
-
|
|
155
|
-
// eslint-config-prettier must be last to disable conflicting rules
|
|
156
|
-
configs.push(eslintConfigPrettier);
|
|
157
|
-
|
|
158
|
-
export default defineConfig(configs);
|
|
159
|
-
`;
|
|
160
|
-
}
|
|
161
|
-
var SETTINGS_HOOKS = {
|
|
162
|
-
SessionStart: [
|
|
163
|
-
{
|
|
164
|
-
hooks: [
|
|
165
|
-
{
|
|
166
|
-
type: "command",
|
|
167
|
-
command: "bash .safeword/hooks/session-verify-agents.sh"
|
|
168
|
-
}
|
|
169
|
-
]
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
hooks: [
|
|
173
|
-
{
|
|
174
|
-
type: "command",
|
|
175
|
-
command: "bash .safeword/hooks/session-version.sh"
|
|
176
|
-
}
|
|
177
|
-
]
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
hooks: [
|
|
181
|
-
{
|
|
182
|
-
type: "command",
|
|
183
|
-
command: "bash .safeword/hooks/session-lint-check.sh"
|
|
184
|
-
}
|
|
185
|
-
]
|
|
186
|
-
}
|
|
187
|
-
],
|
|
188
|
-
UserPromptSubmit: [
|
|
189
|
-
{
|
|
190
|
-
hooks: [
|
|
191
|
-
{
|
|
192
|
-
type: "command",
|
|
193
|
-
command: "bash .safeword/hooks/prompt-timestamp.sh"
|
|
194
|
-
}
|
|
195
|
-
]
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
hooks: [
|
|
199
|
-
{
|
|
200
|
-
type: "command",
|
|
201
|
-
command: "bash .safeword/hooks/prompt-questions.sh"
|
|
202
|
-
}
|
|
203
|
-
]
|
|
204
|
-
}
|
|
205
|
-
],
|
|
206
|
-
Stop: [
|
|
207
|
-
{
|
|
208
|
-
hooks: [
|
|
209
|
-
{
|
|
210
|
-
type: "command",
|
|
211
|
-
command: "bash .safeword/hooks/stop-quality.sh"
|
|
212
|
-
}
|
|
213
|
-
]
|
|
214
|
-
}
|
|
215
|
-
],
|
|
216
|
-
PostToolUse: [
|
|
217
|
-
{
|
|
218
|
-
matcher: "Write|Edit|MultiEdit|NotebookEdit",
|
|
219
|
-
hooks: [
|
|
220
|
-
{
|
|
221
|
-
type: "command",
|
|
222
|
-
command: "bash .safeword/hooks/post-tool-lint.sh"
|
|
223
|
-
}
|
|
224
|
-
]
|
|
225
|
-
}
|
|
226
|
-
]
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
// src/utils/agents-md.ts
|
|
230
|
-
import { join } from "path";
|
|
231
|
-
var SAFEWORD_LINK_MARKER = "@./.safeword/SAFEWORD.md";
|
|
232
|
-
function ensureAgentsMdLink(cwd) {
|
|
233
|
-
const agentsMdPath = join(cwd, "AGENTS.md");
|
|
234
|
-
if (!exists(agentsMdPath)) {
|
|
235
|
-
writeFile(agentsMdPath, `${AGENTS_MD_LINK}
|
|
236
|
-
`);
|
|
237
|
-
return "created";
|
|
238
|
-
}
|
|
239
|
-
const content = readFile(agentsMdPath);
|
|
240
|
-
if (!content.includes(SAFEWORD_LINK_MARKER)) {
|
|
241
|
-
writeFile(agentsMdPath, `${AGENTS_MD_LINK}
|
|
242
|
-
|
|
243
|
-
${content}`);
|
|
244
|
-
return "modified";
|
|
245
|
-
}
|
|
246
|
-
return "unchanged";
|
|
247
|
-
}
|
|
248
|
-
function removeAgentsMdLink(cwd) {
|
|
249
|
-
const agentsMdPath = join(cwd, "AGENTS.md");
|
|
250
|
-
if (!exists(agentsMdPath)) return false;
|
|
251
|
-
const content = readFile(agentsMdPath);
|
|
252
|
-
let newContent = content.replace(AGENTS_MD_LINK, "");
|
|
253
|
-
const lines = newContent.split("\n").filter((line) => !line.includes(SAFEWORD_LINK_MARKER));
|
|
254
|
-
while (lines.length > 0 && (lines[0].trim() === "" || lines[0].trim() === "---")) {
|
|
255
|
-
lines.shift();
|
|
256
|
-
}
|
|
257
|
-
newContent = lines.join("\n");
|
|
258
|
-
if (newContent !== content) {
|
|
259
|
-
writeFile(agentsMdPath, newContent);
|
|
260
|
-
return true;
|
|
261
|
-
}
|
|
262
|
-
return false;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
export {
|
|
266
|
-
filterOutSafewordHooks,
|
|
267
|
-
PRETTIERRC,
|
|
268
|
-
LINT_STAGED_CONFIG,
|
|
269
|
-
getEslintConfig,
|
|
270
|
-
SETTINGS_HOOKS,
|
|
271
|
-
ensureAgentsMdLink,
|
|
272
|
-
removeAgentsMdLink
|
|
273
|
-
};
|
|
274
|
-
//# sourceMappingURL=chunk-IWWBZVHT.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/hooks.ts","../src/templates/content.ts","../src/templates/config.ts","../src/utils/agents-md.ts"],"sourcesContent":["/**\n * Hook utilities for Claude Code settings\n */\n\ninterface HookCommand {\n type: string;\n command: string;\n}\n\ninterface HookEntry {\n matcher?: string;\n hooks: HookCommand[];\n}\n\n/**\n * Type guard to check if a value is a hook entry with hooks array\n */\nexport function isHookEntry(h: unknown): h is HookEntry {\n return (\n typeof h === 'object' &&\n h !== null &&\n 'hooks' in h &&\n Array.isArray((h as HookEntry).hooks)\n );\n}\n\n/**\n * Check if a hook entry contains a safeword hook (command contains '.safeword')\n */\nexport function isSafewordHook(h: unknown): boolean {\n if (!isHookEntry(h)) return false;\n return h.hooks.some(\n (cmd) => typeof cmd.command === 'string' && cmd.command.includes('.safeword'),\n );\n}\n\n/**\n * Filter out safeword hooks from an array of hook entries\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 \"endOfLine\": \"lf\"\n}\n`;\n\n/**\n * lint-staged configuration for pre-commit hooks\n * Runs linters only on staged files for fast commits\n *\n * SYNC: Keep file patterns in sync with post-tool-lint.sh in:\n * packages/cli/templates/hooks/post-tool-lint.sh\n */\nexport const LINT_STAGED_CONFIG = {\n '*.{js,jsx,ts,tsx,mjs,mts,cjs,cts}': ['eslint --fix', 'prettier --write'],\n '*.{vue,svelte,astro}': ['eslint --fix', 'prettier --write'],\n '*.{json,css,scss,html,yaml,yml,graphql}': ['prettier --write'],\n '*.md': ['markdownlint-cli2 --fix', 'prettier --write'],\n};\n","/**\n * Configuration templates - ESLint config generation and hook settings\n *\n * ESLint flat config (v9+) with:\n * - Dynamic framework detection from package.json at runtime\n * - Static imports for base plugins (always installed by safeword)\n * - Dynamic imports for framework plugins (loaded only if framework detected)\n * - defineConfig helper for validation and type checking\n * - eslint-config-prettier last to avoid conflicts\n *\n * See: https://eslint.org/docs/latest/use/configure/configuration-files\n */\n\n/**\n * Generates a dynamic ESLint config that adapts to project frameworks at runtime.\n *\n * The generated config reads package.json to detect frameworks and dynamically\n * imports the corresponding ESLint plugins. This allows the config to be generated\n * once at setup and automatically adapt when frameworks are added or removed.\n *\n * @param options.boundaries - Whether to include architecture boundaries config\n * @returns ESLint config file content as a string\n */\nexport function getEslintConfig(options: { boundaries?: boolean }): string {\n return `import { readFileSync } from \"fs\";\nimport { defineConfig } from \"eslint/config\";\nimport js from \"@eslint/js\";\nimport { importX } from \"eslint-plugin-import-x\";\nimport sonarjs from \"eslint-plugin-sonarjs\";\nimport sdl from \"@microsoft/eslint-plugin-sdl\";\nimport playwright from \"eslint-plugin-playwright\";\nimport eslintConfigPrettier from \"eslint-config-prettier\";\n${options.boundaries ? 'import boundariesConfig from \"./.safeword/eslint-boundaries.config.mjs\";' : ''}\n\n// Read package.json to detect frameworks at runtime\nconst pkg = JSON.parse(readFileSync(\"./package.json\", \"utf8\"));\nconst deps = { ...pkg.dependencies, ...pkg.devDependencies };\n\n// Build dynamic ignores based on detected frameworks\nconst ignores = [\"node_modules/\", \"dist/\", \"build/\", \"coverage/\"];\nif (deps[\"next\"]) ignores.push(\".next/\");\nif (deps[\"astro\"]) ignores.push(\".astro/\");\nif (deps[\"vue\"] || deps[\"nuxt\"]) ignores.push(\".nuxt/\");\nif (deps[\"svelte\"] || deps[\"@sveltejs/kit\"]) ignores.push(\".svelte-kit/\");\n\n// Start with base configs (always loaded)\nconst configs = [\n { ignores },\n js.configs.recommended,\n importX.flatConfigs.recommended,\n sonarjs.configs.recommended,\n ...sdl.configs.recommended,\n];\n\n// TypeScript support (detected from package.json)\nif (deps[\"typescript\"]) {\n const tseslint = await import(\"typescript-eslint\");\n configs.push(importX.flatConfigs.typescript);\n configs.push(...tseslint.default.configs.recommended);\n}\n\n// React/Next.js support\nif (deps[\"react\"] || deps[\"next\"]) {\n const react = await import(\"eslint-plugin-react\");\n const reactHooks = await import(\"eslint-plugin-react-hooks\");\n const jsxA11y = await import(\"eslint-plugin-jsx-a11y\");\n configs.push(react.default.configs.flat.recommended);\n configs.push(react.default.configs.flat[\"jsx-runtime\"]);\n configs.push({\n name: \"react-hooks\",\n plugins: { \"react-hooks\": reactHooks.default },\n rules: reactHooks.default.configs.recommended.rules,\n });\n configs.push(jsxA11y.default.flatConfigs.recommended);\n}\n\n// Next.js plugin\nif (deps[\"next\"]) {\n const nextPlugin = await import(\"@next/eslint-plugin-next\");\n configs.push({\n name: \"nextjs\",\n plugins: { \"@next/next\": nextPlugin.default },\n rules: nextPlugin.default.configs.recommended.rules,\n });\n}\n\n// Astro support\nif (deps[\"astro\"]) {\n const astro = await import(\"eslint-plugin-astro\");\n configs.push(...astro.default.configs.recommended);\n}\n\n// Vue support\nif (deps[\"vue\"] || deps[\"nuxt\"]) {\n const vue = await import(\"eslint-plugin-vue\");\n configs.push(...vue.default.configs[\"flat/recommended\"]);\n}\n\n// Svelte support\nif (deps[\"svelte\"] || deps[\"@sveltejs/kit\"]) {\n const svelte = await import(\"eslint-plugin-svelte\");\n configs.push(...svelte.default.configs.recommended);\n}\n\n// Electron support\nif (deps[\"electron\"]) {\n const electron = await import(\"@electron-toolkit/eslint-config\");\n configs.push(electron.default);\n}\n\n// Vitest support (scoped to test files)\nif (deps[\"vitest\"]) {\n const vitest = await import(\"@vitest/eslint-plugin\");\n configs.push({\n name: \"vitest\",\n files: [\"**/*.test.{js,ts,jsx,tsx}\", \"**/*.spec.{js,ts,jsx,tsx}\", \"**/tests/**\"],\n plugins: { vitest: vitest.default },\n languageOptions: {\n globals: { ...vitest.default.environments.env.globals },\n },\n rules: { ...vitest.default.configs.recommended.rules },\n });\n}\n\n// Playwright for e2e tests (always included - safeword sets up Playwright)\nconfigs.push({\n name: \"playwright\",\n files: [\"**/e2e/**\", \"**/*.e2e.{js,ts,jsx,tsx}\", \"**/playwright/**\"],\n ...playwright.configs[\"flat/recommended\"],\n});\n\n// Architecture boundaries${options.boundaries ? '\\nconfigs.push(boundariesConfig);' : ''}\n\n// eslint-config-prettier must be last to disable conflicting rules\nconfigs.push(eslintConfigPrettier);\n\nexport default defineConfig(configs);\n`;\n}\n\nexport const SETTINGS_HOOKS = {\n SessionStart: [\n {\n hooks: [\n {\n type: 'command',\n command: 'bash .safeword/hooks/session-verify-agents.sh',\n },\n ],\n },\n {\n hooks: [\n {\n type: 'command',\n command: 'bash .safeword/hooks/session-version.sh',\n },\n ],\n },\n {\n hooks: [\n {\n type: 'command',\n command: 'bash .safeword/hooks/session-lint-check.sh',\n },\n ],\n },\n ],\n UserPromptSubmit: [\n {\n hooks: [\n {\n type: 'command',\n command: 'bash .safeword/hooks/prompt-timestamp.sh',\n },\n ],\n },\n {\n hooks: [\n {\n type: 'command',\n command: 'bash .safeword/hooks/prompt-questions.sh',\n },\n ],\n },\n ],\n Stop: [\n {\n hooks: [\n {\n type: 'command',\n command: 'bash .safeword/hooks/stop-quality.sh',\n },\n ],\n },\n ],\n PostToolUse: [\n {\n matcher: 'Write|Edit|MultiEdit|NotebookEdit',\n hooks: [\n {\n type: 'command',\n command: 'bash .safeword/hooks/post-tool-lint.sh',\n },\n ],\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":";;;;;;;AAiBO,SAAS,YAAY,GAA4B;AACtD,SACE,OAAO,MAAM,YACb,MAAM,QACN,WAAW,KACX,MAAM,QAAS,EAAgB,KAAK;AAExC;AAKO,SAAS,eAAe,GAAqB;AAClD,MAAI,CAAC,YAAY,CAAC,EAAG,QAAO;AAC5B,SAAO,EAAE,MAAM;AAAA,IACb,CAAC,QAAQ,OAAO,IAAI,YAAY,YAAY,IAAI,QAAQ,SAAS,WAAW;AAAA,EAC9E;AACF;AAKO,SAAS,uBAAuB,OAA6B;AAClE,SAAO,MAAM,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;AAC/C;;;ACjCO,IAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAOvB,IAAM,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBnB,IAAM,qBAAqB;AAAA,EAChC,qCAAqC,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,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":[]}
|
package/dist/diff-ZACVJKOU.js
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
VERSION
|
|
3
|
-
} from "./chunk-ORQHKDT2.js";
|
|
4
|
-
import {
|
|
5
|
-
error,
|
|
6
|
-
header,
|
|
7
|
-
info,
|
|
8
|
-
listItem,
|
|
9
|
-
success
|
|
10
|
-
} from "./chunk-FRPJITGG.js";
|
|
11
|
-
import {
|
|
12
|
-
exists,
|
|
13
|
-
getTemplatesDir,
|
|
14
|
-
readFileSafe
|
|
15
|
-
} from "./chunk-ARIAOK2F.js";
|
|
16
|
-
|
|
17
|
-
// src/commands/diff.ts
|
|
18
|
-
import { join } from "path";
|
|
19
|
-
function createUnifiedDiff(oldContent, newContent, filename) {
|
|
20
|
-
const oldLines = oldContent.split("\n");
|
|
21
|
-
const newLines = newContent.split("\n");
|
|
22
|
-
const lines = [];
|
|
23
|
-
lines.push(`--- a/${filename}`);
|
|
24
|
-
lines.push(`+++ b/${filename}`);
|
|
25
|
-
let hasChanges = false;
|
|
26
|
-
const maxLines = Math.max(oldLines.length, newLines.length);
|
|
27
|
-
for (let i = 0; i < maxLines; i++) {
|
|
28
|
-
const oldLine = oldLines[i];
|
|
29
|
-
const newLine = newLines[i];
|
|
30
|
-
if (oldLine === newLine) {
|
|
31
|
-
lines.push(` ${oldLine ?? ""}`);
|
|
32
|
-
} else {
|
|
33
|
-
hasChanges = true;
|
|
34
|
-
if (oldLine !== void 0) {
|
|
35
|
-
lines.push(`-${oldLine}`);
|
|
36
|
-
}
|
|
37
|
-
if (newLine !== void 0) {
|
|
38
|
-
lines.push(`+${newLine}`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (!hasChanges) {
|
|
43
|
-
return "";
|
|
44
|
-
}
|
|
45
|
-
lines.splice(2, 0, `@@ -1,${oldLines.length} +1,${newLines.length} @@`);
|
|
46
|
-
return lines.join("\n");
|
|
47
|
-
}
|
|
48
|
-
function getFileDiffs(cwd) {
|
|
49
|
-
const templatesDir = getTemplatesDir();
|
|
50
|
-
const diffs = [];
|
|
51
|
-
const files = [
|
|
52
|
-
{ templatePath: "SAFEWORD.md", installPath: ".safeword/SAFEWORD.md" },
|
|
53
|
-
{ templatePath: "hooks/session-verify-agents.sh", installPath: ".safeword/hooks/session-verify-agents.sh" },
|
|
54
|
-
{ templatePath: "hooks/session-version.sh", installPath: ".safeword/hooks/session-version.sh" },
|
|
55
|
-
{ templatePath: "hooks/session-lint-check.sh", installPath: ".safeword/hooks/session-lint-check.sh" },
|
|
56
|
-
{ templatePath: "hooks/prompt-timestamp.sh", installPath: ".safeword/hooks/prompt-timestamp.sh" },
|
|
57
|
-
{ templatePath: "hooks/prompt-questions.sh", installPath: ".safeword/hooks/prompt-questions.sh" },
|
|
58
|
-
{ templatePath: "hooks/post-tool-lint.sh", installPath: ".safeword/hooks/post-tool-lint.sh" },
|
|
59
|
-
{ templatePath: "hooks/stop-quality.sh", installPath: ".safeword/hooks/stop-quality.sh" },
|
|
60
|
-
{ templatePath: "skills/safeword-quality-reviewer/SKILL.md", installPath: ".claude/skills/safeword-quality-reviewer/SKILL.md" }
|
|
61
|
-
];
|
|
62
|
-
const versionPath = join(cwd, ".safeword/version");
|
|
63
|
-
const currentVersion = readFileSafe(versionPath);
|
|
64
|
-
if (currentVersion === null) {
|
|
65
|
-
diffs.push({ path: ".safeword/version", status: "added", newContent: VERSION });
|
|
66
|
-
} else if (currentVersion.trim() !== VERSION) {
|
|
67
|
-
diffs.push({ path: ".safeword/version", status: "modified", currentContent: currentVersion, newContent: VERSION });
|
|
68
|
-
} else {
|
|
69
|
-
diffs.push({ path: ".safeword/version", status: "unchanged", currentContent: currentVersion, newContent: VERSION });
|
|
70
|
-
}
|
|
71
|
-
for (const file of files) {
|
|
72
|
-
const templateFullPath = join(templatesDir, file.templatePath);
|
|
73
|
-
const installFullPath = join(cwd, file.installPath);
|
|
74
|
-
const newContent = readFileSafe(templateFullPath);
|
|
75
|
-
if (newContent === null) continue;
|
|
76
|
-
const currentContent = readFileSafe(installFullPath);
|
|
77
|
-
if (currentContent === null) {
|
|
78
|
-
diffs.push({
|
|
79
|
-
path: file.installPath,
|
|
80
|
-
status: "added",
|
|
81
|
-
newContent
|
|
82
|
-
});
|
|
83
|
-
} else if (currentContent.trim() !== newContent.trim()) {
|
|
84
|
-
diffs.push({
|
|
85
|
-
path: file.installPath,
|
|
86
|
-
status: "modified",
|
|
87
|
-
currentContent,
|
|
88
|
-
newContent
|
|
89
|
-
});
|
|
90
|
-
} else {
|
|
91
|
-
diffs.push({
|
|
92
|
-
path: file.installPath,
|
|
93
|
-
status: "unchanged",
|
|
94
|
-
currentContent,
|
|
95
|
-
newContent
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return diffs;
|
|
100
|
-
}
|
|
101
|
-
async function diff(options) {
|
|
102
|
-
const cwd = process.cwd();
|
|
103
|
-
const safewordDir = join(cwd, ".safeword");
|
|
104
|
-
if (!exists(safewordDir)) {
|
|
105
|
-
error("Not configured. Run `safeword setup` first.");
|
|
106
|
-
process.exit(1);
|
|
107
|
-
}
|
|
108
|
-
const versionPath = join(safewordDir, "version");
|
|
109
|
-
const projectVersion = readFileSafe(versionPath)?.trim() ?? "unknown";
|
|
110
|
-
header("Safeword Diff");
|
|
111
|
-
info(`Changes from v${projectVersion} \u2192 v${VERSION}`);
|
|
112
|
-
const diffs = getFileDiffs(cwd);
|
|
113
|
-
const added = diffs.filter((d) => d.status === "added");
|
|
114
|
-
const modified = diffs.filter((d) => d.status === "modified");
|
|
115
|
-
const unchanged = diffs.filter((d) => d.status === "unchanged");
|
|
116
|
-
info(
|
|
117
|
-
`
|
|
118
|
-
Summary: ${added.length} added, ${modified.length} modified, ${unchanged.length} unchanged`
|
|
119
|
-
);
|
|
120
|
-
if (added.length > 0) {
|
|
121
|
-
info("\nAdded:");
|
|
122
|
-
for (const file of added) {
|
|
123
|
-
listItem(file.path);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
if (modified.length > 0) {
|
|
127
|
-
info("\nModified:");
|
|
128
|
-
for (const file of modified) {
|
|
129
|
-
listItem(file.path);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if (unchanged.length > 0) {
|
|
133
|
-
info("\nUnchanged:");
|
|
134
|
-
for (const file of unchanged) {
|
|
135
|
-
listItem(file.path);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
if (options.verbose) {
|
|
139
|
-
header("Detailed Changes");
|
|
140
|
-
for (const file of modified) {
|
|
141
|
-
if (file.currentContent) {
|
|
142
|
-
info(`
|
|
143
|
-
${file.path}:`);
|
|
144
|
-
const diffOutput = createUnifiedDiff(file.currentContent, file.newContent, file.path);
|
|
145
|
-
if (diffOutput) {
|
|
146
|
-
console.log(diffOutput);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
for (const file of added) {
|
|
151
|
-
info(`
|
|
152
|
-
${file.path}: (new file)`);
|
|
153
|
-
const lines = file.newContent.split("\n").slice(0, 10);
|
|
154
|
-
for (const line of lines) {
|
|
155
|
-
console.log(`+${line}`);
|
|
156
|
-
}
|
|
157
|
-
if (file.newContent.split("\n").length > 10) {
|
|
158
|
-
console.log("... (truncated)");
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
if (added.length === 0 && modified.length === 0) {
|
|
163
|
-
success("\nNo changes needed - configuration is up to date");
|
|
164
|
-
} else {
|
|
165
|
-
info("\nRun `safeword upgrade` to apply these changes");
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
export {
|
|
169
|
-
diff
|
|
170
|
-
};
|
|
171
|
-
//# sourceMappingURL=diff-ZACVJKOU.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/diff.ts"],"sourcesContent":["/**\n * Diff command - Preview changes that would be made by upgrade\n */\n\nimport { join } from 'node:path';\nimport { VERSION } from '../version.js';\nimport { exists, readFileSafe, getTemplatesDir } from '../utils/fs.js';\nimport { info, success, error, header, listItem } from '../utils/output.js';\n\nexport interface DiffOptions {\n verbose?: boolean;\n}\n\ninterface FileDiff {\n path: string;\n status: 'added' | 'modified' | 'unchanged';\n currentContent?: string;\n newContent: string;\n}\n\n/**\n * Create a unified diff between two strings\n */\nfunction createUnifiedDiff(oldContent: string, newContent: string, filename: string): string {\n const oldLines = oldContent.split('\\n');\n const newLines = newContent.split('\\n');\n\n const lines: string[] = [];\n lines.push(`--- a/${filename}`);\n lines.push(`+++ b/${filename}`);\n\n // Simple diff - show all changes\n // A real implementation would use a proper diff algorithm\n let hasChanges = false;\n\n const maxLines = Math.max(oldLines.length, newLines.length);\n\n for (let i = 0; i < maxLines; i++) {\n const oldLine = oldLines[i];\n const newLine = newLines[i];\n\n if (oldLine === newLine) {\n lines.push(` ${oldLine ?? ''}`);\n } else {\n hasChanges = true;\n if (oldLine !== undefined) {\n lines.push(`-${oldLine}`);\n }\n if (newLine !== undefined) {\n lines.push(`+${newLine}`);\n }\n }\n }\n\n if (!hasChanges) {\n return '';\n }\n\n // Add context marker\n lines.splice(2, 0, `@@ -1,${oldLines.length} +1,${newLines.length} @@`);\n\n return lines.join('\\n');\n}\n\n/**\n * Get all files that would be changed by upgrade\n */\nfunction getFileDiffs(cwd: string): FileDiff[] {\n const templatesDir = getTemplatesDir();\n const diffs: FileDiff[] = [];\n\n // Define files to check (template source -> install destination)\n const files: Array<{ templatePath: string; installPath: string }> = [\n { templatePath: 'SAFEWORD.md', installPath: '.safeword/SAFEWORD.md' },\n { templatePath: 'hooks/session-verify-agents.sh', installPath: '.safeword/hooks/session-verify-agents.sh' },\n { templatePath: 'hooks/session-version.sh', installPath: '.safeword/hooks/session-version.sh' },\n { templatePath: 'hooks/session-lint-check.sh', installPath: '.safeword/hooks/session-lint-check.sh' },\n { templatePath: 'hooks/prompt-timestamp.sh', installPath: '.safeword/hooks/prompt-timestamp.sh' },\n { templatePath: 'hooks/prompt-questions.sh', installPath: '.safeword/hooks/prompt-questions.sh' },\n { templatePath: 'hooks/post-tool-lint.sh', installPath: '.safeword/hooks/post-tool-lint.sh' },\n { templatePath: 'hooks/stop-quality.sh', installPath: '.safeword/hooks/stop-quality.sh' },\n { templatePath: 'skills/safeword-quality-reviewer/SKILL.md', installPath: '.claude/skills/safeword-quality-reviewer/SKILL.md' },\n ];\n\n // Add version file (not from templates)\n const versionPath = join(cwd, '.safeword/version');\n const currentVersion = readFileSafe(versionPath);\n if (currentVersion === null) {\n diffs.push({ path: '.safeword/version', status: 'added', newContent: VERSION });\n } else if (currentVersion.trim() !== VERSION) {\n diffs.push({ path: '.safeword/version', status: 'modified', currentContent: currentVersion, newContent: VERSION });\n } else {\n diffs.push({ path: '.safeword/version', status: 'unchanged', currentContent: currentVersion, newContent: VERSION });\n }\n\n for (const file of files) {\n const templateFullPath = join(templatesDir, file.templatePath);\n const installFullPath = join(cwd, file.installPath);\n\n const newContent = readFileSafe(templateFullPath);\n if (newContent === null) continue; // Skip if template doesn't exist\n\n const currentContent = readFileSafe(installFullPath);\n\n if (currentContent === null) {\n diffs.push({\n path: file.installPath,\n status: 'added',\n newContent,\n });\n } else if (currentContent.trim() !== newContent.trim()) {\n diffs.push({\n path: file.installPath,\n status: 'modified',\n currentContent,\n newContent,\n });\n } else {\n diffs.push({\n path: file.installPath,\n status: 'unchanged',\n currentContent,\n newContent,\n });\n }\n }\n\n return diffs;\n}\n\nexport async function diff(options: DiffOptions): Promise<void> {\n const cwd = process.cwd();\n const safewordDir = join(cwd, '.safeword');\n\n // Check if configured\n if (!exists(safewordDir)) {\n error('Not configured. Run `safeword setup` first.');\n process.exit(1);\n }\n\n // Read project version\n const versionPath = join(safewordDir, 'version');\n const projectVersion = readFileSafe(versionPath)?.trim() ?? 'unknown';\n\n header('Safeword Diff');\n info(`Changes from v${projectVersion} → v${VERSION}`);\n\n const diffs = getFileDiffs(cwd);\n\n const added = diffs.filter(d => d.status === 'added');\n const modified = diffs.filter(d => d.status === 'modified');\n const unchanged = diffs.filter(d => d.status === 'unchanged');\n\n // Summary\n info(\n `\\nSummary: ${added.length} added, ${modified.length} modified, ${unchanged.length} unchanged`,\n );\n\n // List by category\n if (added.length > 0) {\n info('\\nAdded:');\n for (const file of added) {\n listItem(file.path);\n }\n }\n\n if (modified.length > 0) {\n info('\\nModified:');\n for (const file of modified) {\n listItem(file.path);\n }\n }\n\n if (unchanged.length > 0) {\n info('\\nUnchanged:');\n for (const file of unchanged) {\n listItem(file.path);\n }\n }\n\n // Verbose output - show actual diffs\n if (options.verbose) {\n header('Detailed Changes');\n\n for (const file of modified) {\n if (file.currentContent) {\n info(`\\n${file.path}:`);\n const diffOutput = createUnifiedDiff(file.currentContent, file.newContent, file.path);\n if (diffOutput) {\n console.log(diffOutput);\n }\n }\n }\n\n for (const file of added) {\n info(`\\n${file.path}: (new file)`);\n const lines = file.newContent.split('\\n').slice(0, 10);\n for (const line of lines) {\n console.log(`+${line}`);\n }\n if (file.newContent.split('\\n').length > 10) {\n console.log('... (truncated)');\n }\n }\n }\n\n if (added.length === 0 && modified.length === 0) {\n success('\\nNo changes needed - configuration is up to date');\n } else {\n info('\\nRun `safeword upgrade` to apply these changes');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAIA,SAAS,YAAY;AAmBrB,SAAS,kBAAkB,YAAoB,YAAoB,UAA0B;AAC3F,QAAM,WAAW,WAAW,MAAM,IAAI;AACtC,QAAM,WAAW,WA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