safeword 0.6.3 → 0.6.4
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-ICZISZ3R.js} +41 -23
- package/dist/check-ICZISZ3R.js.map +1 -0
- package/dist/chunk-E5ZC6R5H.js +720 -0
- package/dist/chunk-E5ZC6R5H.js.map +1 -0
- package/dist/chunk-JGXYBPNM.js +454 -0
- package/dist/chunk-JGXYBPNM.js.map +1 -0
- package/dist/cli.js +7 -7
- package/dist/cli.js.map +1 -1
- package/dist/diff-FOJDBKKF.js +168 -0
- package/dist/diff-FOJDBKKF.js.map +1 -0
- package/dist/reset-JU2E65XN.js +74 -0
- package/dist/reset-JU2E65XN.js.map +1 -0
- package/dist/setup-UKMYK5TE.js +103 -0
- package/dist/setup-UKMYK5TE.js.map +1 -0
- package/dist/{sync-4XBMKLXS.js → sync-5MOXVTH4.js} +33 -32
- package/dist/sync-5MOXVTH4.js.map +1 -0
- package/dist/upgrade-NSLDFWNR.js +73 -0
- package/dist/upgrade-NSLDFWNR.js.map +1 -0
- package/package.json +1 -1
- package/templates/SAFEWORD.md +8 -28
- 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/prompts/{review.md → quality-review.md} +0 -0
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,WAAW,MAAM,IAAI;AAEtC,QAAM,QAAkB,CAAC;AACzB,QAAM,KAAK,SAAS,QAAQ,EAAE;AAC9B,QAAM,KAAK,SAAS,QAAQ,EAAE;AAI9B,MAAI,aAAa;AAEjB,QAAM,W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,IAAI,iBAAiB;AAAA,MAC/B;AAAA,IACF;AAAA,EACF;AAEA,MAAI,MAAM,WAAW,KAAK,SAAS,WAAW,GAAG;AAC/C,YAAQ,mDAAmD;AAAA,EAC7D,OAAO;AACL,SAAK,iDAAiD;AAAA,EACxD;AACF;","names":[]}
|
package/dist/reset-5SRM3P6J.js
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
filterOutSafewordHooks,
|
|
3
|
-
removeAgentsMdLink
|
|
4
|
-
} from "./chunk-IWWBZVHT.js";
|
|
5
|
-
import {
|
|
6
|
-
error,
|
|
7
|
-
header,
|
|
8
|
-
info,
|
|
9
|
-
listItem,
|
|
10
|
-
success
|
|
11
|
-
} from "./chunk-FRPJITGG.js";
|
|
12
|
-
import {
|
|
13
|
-
exists,
|
|
14
|
-
listDir,
|
|
15
|
-
readJson,
|
|
16
|
-
remove,
|
|
17
|
-
writeJson
|
|
18
|
-
} from "./chunk-ARIAOK2F.js";
|
|
19
|
-
|
|
20
|
-
// src/commands/reset.ts
|
|
21
|
-
import { join } from "path";
|
|
22
|
-
async function reset(options) {
|
|
23
|
-
const cwd = process.cwd();
|
|
24
|
-
const safewordDir = join(cwd, ".safeword");
|
|
25
|
-
if (!exists(safewordDir)) {
|
|
26
|
-
info("Nothing to remove. Project is not configured with safeword.");
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const isNonInteractive = options.yes || !process.stdin.isTTY;
|
|
30
|
-
if (!isNonInteractive) {
|
|
31
|
-
}
|
|
32
|
-
header("Safeword Reset");
|
|
33
|
-
info("Removing safeword configuration...");
|
|
34
|
-
const removed = [];
|
|
35
|
-
try {
|
|
36
|
-
if (exists(safewordDir)) {
|
|
37
|
-
remove(safewordDir);
|
|
38
|
-
removed.push(".safeword/");
|
|
39
|
-
success("Removed .safeword directory");
|
|
40
|
-
}
|
|
41
|
-
const settingsPath = join(cwd, ".claude", "settings.json");
|
|
42
|
-
if (exists(settingsPath)) {
|
|
43
|
-
info("\nRemoving hooks from .claude/settings.json...");
|
|
44
|
-
const settings = readJson(settingsPath);
|
|
45
|
-
if (settings?.hooks) {
|
|
46
|
-
let modified = false;
|
|
47
|
-
for (const [event, hooks] of Object.entries(settings.hooks)) {
|
|
48
|
-
if (Array.isArray(hooks)) {
|
|
49
|
-
const filtered = filterOutSafewordHooks(hooks);
|
|
50
|
-
if (filtered.length !== hooks.length) {
|
|
51
|
-
settings.hooks[event] = filtered;
|
|
52
|
-
modified = true;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
if (modified) {
|
|
57
|
-
writeJson(settingsPath, settings);
|
|
58
|
-
removed.push(".claude/settings.json (hooks)");
|
|
59
|
-
success("Removed safeword hooks");
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
const skillsDir = join(cwd, ".claude", "skills");
|
|
64
|
-
if (exists(skillsDir)) {
|
|
65
|
-
info("\nRemoving safeword skills...");
|
|
66
|
-
const skills = listDir(skillsDir);
|
|
67
|
-
for (const skill of skills) {
|
|
68
|
-
if (skill.startsWith("safeword-")) {
|
|
69
|
-
remove(join(skillsDir, skill));
|
|
70
|
-
removed.push(`.claude/skills/${skill}/`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (removed.some((r) => r.includes("skills"))) {
|
|
74
|
-
success("Removed safeword skills");
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
const commandsDir = join(cwd, ".claude", "commands");
|
|
78
|
-
const safewordCommands = ["review.md", "architecture.md", "lint.md"];
|
|
79
|
-
if (exists(commandsDir)) {
|
|
80
|
-
info("\nRemoving safeword commands...");
|
|
81
|
-
let commandsRemoved = false;
|
|
82
|
-
for (const cmd of safewordCommands) {
|
|
83
|
-
const cmdPath = join(commandsDir, cmd);
|
|
84
|
-
if (exists(cmdPath)) {
|
|
85
|
-
remove(cmdPath);
|
|
86
|
-
removed.push(`.claude/commands/${cmd}`);
|
|
87
|
-
commandsRemoved = true;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (commandsRemoved) {
|
|
91
|
-
success("Removed safeword commands");
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
const mcpConfigPath = join(cwd, ".mcp.json");
|
|
95
|
-
if (exists(mcpConfigPath)) {
|
|
96
|
-
info("\nRemoving MCP servers...");
|
|
97
|
-
const mcpConfig = readJson(mcpConfigPath);
|
|
98
|
-
if (mcpConfig?.mcpServers) {
|
|
99
|
-
delete mcpConfig.mcpServers.context7;
|
|
100
|
-
delete mcpConfig.mcpServers.playwright;
|
|
101
|
-
if (Object.keys(mcpConfig.mcpServers).length === 0) {
|
|
102
|
-
remove(mcpConfigPath);
|
|
103
|
-
removed.push(".mcp.json");
|
|
104
|
-
} else {
|
|
105
|
-
writeJson(mcpConfigPath, mcpConfig);
|
|
106
|
-
removed.push(".mcp.json (context7, playwright)");
|
|
107
|
-
}
|
|
108
|
-
success("Removed MCP servers");
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
const huskyDir = join(cwd, ".husky");
|
|
112
|
-
if (exists(huskyDir)) {
|
|
113
|
-
info("\nRemoving Husky hooks...");
|
|
114
|
-
remove(huskyDir);
|
|
115
|
-
removed.push(".husky/");
|
|
116
|
-
success("Removed Husky hooks");
|
|
117
|
-
}
|
|
118
|
-
info("\nCleaning AGENTS.md...");
|
|
119
|
-
if (removeAgentsMdLink(cwd)) {
|
|
120
|
-
removed.push("AGENTS.md (link)");
|
|
121
|
-
success("Removed safeword link from AGENTS.md");
|
|
122
|
-
}
|
|
123
|
-
header("Reset Complete");
|
|
124
|
-
if (removed.length > 0) {
|
|
125
|
-
info("\nRemoved:");
|
|
126
|
-
for (const item of removed) {
|
|
127
|
-
listItem(item);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
info("\nPreserved (remove manually if desired):");
|
|
131
|
-
listItem("eslint.config.mjs");
|
|
132
|
-
listItem(".prettierrc");
|
|
133
|
-
listItem(".markdownlint-cli2.jsonc");
|
|
134
|
-
listItem("package.json (scripts, lint-staged config)");
|
|
135
|
-
listItem("devDependencies (eslint, prettier, husky, lint-staged, etc.)");
|
|
136
|
-
success("\nSafeword configuration removed");
|
|
137
|
-
} catch (err) {
|
|
138
|
-
error(`Reset failed: ${err instanceof Error ? err.message : "Unknown error"}`);
|
|
139
|
-
process.exit(1);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
export {
|
|
143
|
-
reset
|
|
144
|
-
};
|
|
145
|
-
//# sourceMappingURL=reset-5SRM3P6J.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/reset.ts"],"sourcesContent":["/**\n * Reset command - Remove safeword configuration from project\n */\n\nimport { join } from 'node:path';\nimport { exists, remove, readJson, writeJson, listDir } from '../utils/fs.js';\nimport { info, success, error, header, listItem } from '../utils/output.js';\nimport { filterOutSafewordHooks } from '../utils/hooks.js';\nimport { removeAgentsMdLink } from '../utils/agents-md.js';\n\nexport interface ResetOptions {\n yes?: boolean;\n}\n\nexport async function reset(options: ResetOptions): Promise<void> {\n const cwd = process.cwd();\n const safewordDir = join(cwd, '.safeword');\n\n // Check if configured\n if (!exists(safewordDir)) {\n info('Nothing to remove. Project is not configured with safeword.');\n return;\n }\n\n const isNonInteractive = options.yes || !process.stdin.isTTY;\n\n // Confirmation (in interactive mode without --yes)\n if (!isNonInteractive) {\n // In a real implementation, we'd prompt here\n // For now, non-TTY mode auto-confirms\n }\n\n header('Safeword Reset');\n info('Removing safeword configuration...');\n\n const removed: string[] = [];\n\n try {\n // 1. Remove .safeword directory\n if (exists(safewordDir)) {\n remove(safewordDir);\n removed.push('.safeword/');\n success('Removed .safeword directory');\n }\n\n // 2. Remove safeword hooks from .claude/settings.json\n const settingsPath = join(cwd, '.claude', 'settings.json');\n\n if (exists(settingsPath)) {\n info('\\nRemoving hooks from .claude/settings.json...');\n\n interface SettingsJson {\n hooks?: Record<string, unknown[]>;\n [key: string]: unknown;\n }\n\n const settings = readJson<SettingsJson>(settingsPath);\n\n if (settings?.hooks) {\n let modified = false;\n\n for (const [event, hooks] of Object.entries(settings.hooks)) {\n if (Array.isArray(hooks)) {\n const filtered = filterOutSafewordHooks(hooks);\n if (filtered.length !== hooks.length) {\n settings.hooks[event] = filtered;\n modified = true;\n }\n }\n }\n\n if (modified) {\n writeJson(settingsPath, settings);\n removed.push('.claude/settings.json (hooks)');\n success('Removed safeword hooks');\n }\n }\n }\n\n // 3. Remove safeword skills\n const skillsDir = join(cwd, '.claude', 'skills');\n\n if (exists(skillsDir)) {\n info('\\nRemoving safeword skills...');\n\n const skills = listDir(skillsDir);\n for (const skill of skills) {\n if (skill.startsWith('safeword-')) {\n remove(join(skillsDir, skill));\n removed.push(`.claude/skills/${skill}/`);\n }\n }\n\n if (removed.some(r => r.includes('skills'))) {\n success('Removed safeword skills');\n }\n }\n\n // 3.5. Remove safeword slash commands\n const commandsDir = join(cwd, '.claude', 'commands');\n const safewordCommands = ['review.md', 'architecture.md', 'lint.md'];\n\n if (exists(commandsDir)) {\n info('\\nRemoving safeword commands...');\n\n let commandsRemoved = false;\n for (const cmd of safewordCommands) {\n const cmdPath = join(commandsDir, cmd);\n if (exists(cmdPath)) {\n remove(cmdPath);\n removed.push(`.claude/commands/${cmd}`);\n commandsRemoved = true;\n }\n }\n\n if (commandsRemoved) {\n success('Removed safeword commands');\n }\n }\n\n // 3.6. Remove MCP servers from .mcp.json\n const mcpConfigPath = join(cwd, '.mcp.json');\n\n if (exists(mcpConfigPath)) {\n info('\\nRemoving MCP servers...');\n\n interface McpConfig {\n mcpServers?: Record<string, unknown>;\n [key: string]: unknown;\n }\n\n const mcpConfig = readJson<McpConfig>(mcpConfigPath);\n\n if (mcpConfig?.mcpServers) {\n // Remove safeword MCP servers\n delete mcpConfig.mcpServers.context7;\n delete mcpConfig.mcpServers.playwright;\n\n // If no servers left, remove the file\n if (Object.keys(mcpConfig.mcpServers).length === 0) {\n remove(mcpConfigPath);\n removed.push('.mcp.json');\n } else {\n writeJson(mcpConfigPath, mcpConfig);\n removed.push('.mcp.json (context7, playwright)');\n }\n\n success('Removed MCP servers');\n }\n }\n\n // 4. Remove Husky directory\n const huskyDir = join(cwd, '.husky');\n if (exists(huskyDir)) {\n info('\\nRemoving Husky hooks...');\n remove(huskyDir);\n removed.push('.husky/');\n success('Removed Husky hooks');\n }\n\n // 5. Remove link from AGENTS.md\n info('\\nCleaning AGENTS.md...');\n if (removeAgentsMdLink(cwd)) {\n removed.push('AGENTS.md (link)');\n success('Removed safeword link from AGENTS.md');\n }\n\n // Print summary\n header('Reset Complete');\n\n if (removed.length > 0) {\n info('\\nRemoved:');\n for (const item of removed) {\n listItem(item);\n }\n }\n\n // Note about preserved linting\n info('\\nPreserved (remove manually if desired):');\n listItem('eslint.config.mjs');\n listItem('.prettierrc');\n listItem('.markdownlint-cli2.jsonc');\n listItem('package.json (scripts, lint-staged config)');\n listItem('devDependencies (eslint, prettier, husky, lint-staged, etc.)');\n\n success('\\nSafeword configuration removed');\n } catch (err) {\n error(`Reset failed: ${err instanceof Error ? err.message : 'Unknown error'}`);\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAIA,SAAS,YAAY;AAUrB,eAAsB,MAAM,SAAsC;AAChE,QAAM,MAAM,QAAQ,IAAI;AACxB,QAAM,cAAc,KAAK,KAAK,WAAW;AAGzC,MAAI,CAAC,OAAO,WAAW,GAAG;AACxB,SAAK,6DAA6D;AAClE;AAAA,EACF;AAEA,QAAM,mBAAmB,QAAQ,OAAO,CAAC,QAAQ,MAAM;AAGvD,MAAI,CAAC,kBAAkB;AAAA,EAGvB;AAEA,SAAO,gBAAgB;AACvB,OAAK,oCAAoC;AAEzC,QAAM,UAAoB,CAAC;AAE3B,MAAI;AAEF,QAAI,OAAO,WAAW,GAAG;AACvB,aAAO,WAAW;AAClB,cAAQ,KAAK,YAAY;AACzB,cAAQ,6BAA6B;AAAA,IACvC;AAGA,U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