start-vibing 2.0.16 → 2.0.18
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/cli.js +42 -8
- package/package.json +1 -1
- package/template/.claude/hooks/run-hook.ts +23 -1
package/dist/cli.js
CHANGED
|
@@ -129,8 +129,8 @@ async function copyClaudeSetup(targetDir, options = {}) {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
// src/cli.ts
|
|
132
|
-
import { existsSync as
|
|
133
|
-
import { join as
|
|
132
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
|
|
133
|
+
import { join as join4, dirname as dirname2 } from "path";
|
|
134
134
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
135
135
|
|
|
136
136
|
// src/update.ts
|
|
@@ -317,6 +317,9 @@ function getUpdateCommand() {
|
|
|
317
317
|
|
|
318
318
|
// src/claude.ts
|
|
319
319
|
import { spawn, execSync as execSync2, spawnSync } from "child_process";
|
|
320
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
321
|
+
import { join as join3 } from "path";
|
|
322
|
+
import { homedir } from "os";
|
|
320
323
|
function isClaudeInstalled() {
|
|
321
324
|
return commandExists("claude");
|
|
322
325
|
}
|
|
@@ -432,6 +435,33 @@ function launchClaude(cwd) {
|
|
|
432
435
|
process.exit(code || 0);
|
|
433
436
|
});
|
|
434
437
|
}
|
|
438
|
+
function ensureHooksEnabled() {
|
|
439
|
+
try {
|
|
440
|
+
const home = homedir();
|
|
441
|
+
const globalSettingsPath = join3(home, ".claude", "settings.json");
|
|
442
|
+
if (!existsSync3(globalSettingsPath)) {
|
|
443
|
+
return { modified: false };
|
|
444
|
+
}
|
|
445
|
+
const content = readFileSync3(globalSettingsPath, "utf-8");
|
|
446
|
+
let settings;
|
|
447
|
+
try {
|
|
448
|
+
settings = JSON.parse(content);
|
|
449
|
+
} catch {
|
|
450
|
+
return { modified: false };
|
|
451
|
+
}
|
|
452
|
+
if ("disableAllHooks" in settings) {
|
|
453
|
+
delete settings["disableAllHooks"];
|
|
454
|
+
writeFileSync3(globalSettingsPath, JSON.stringify(settings, null, "\t"), "utf-8");
|
|
455
|
+
return { modified: true };
|
|
456
|
+
}
|
|
457
|
+
return { modified: false };
|
|
458
|
+
} catch (error) {
|
|
459
|
+
return {
|
|
460
|
+
modified: false,
|
|
461
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
}
|
|
435
465
|
|
|
436
466
|
// src/mcp.ts
|
|
437
467
|
import { spawnSync as spawnSync2, spawn as spawn2 } from "child_process";
|
|
@@ -693,12 +723,12 @@ var __dirname3 = dirname2(__filename3);
|
|
|
693
723
|
function getVersion() {
|
|
694
724
|
try {
|
|
695
725
|
const paths = [
|
|
696
|
-
|
|
697
|
-
|
|
726
|
+
join4(__dirname3, "..", "package.json"),
|
|
727
|
+
join4(__dirname3, "..", "..", "package.json")
|
|
698
728
|
];
|
|
699
729
|
for (const pkgPath of paths) {
|
|
700
|
-
if (
|
|
701
|
-
const pkg = JSON.parse(
|
|
730
|
+
if (existsSync4(pkgPath)) {
|
|
731
|
+
const pkg = JSON.parse(readFileSync4(pkgPath, "utf-8"));
|
|
702
732
|
return pkg.version || "1.0.0";
|
|
703
733
|
}
|
|
704
734
|
}
|
|
@@ -800,8 +830,8 @@ async function main() {
|
|
|
800
830
|
console.log(" Then just run: start-vibing");
|
|
801
831
|
console.log("");
|
|
802
832
|
}
|
|
803
|
-
const claudeDir =
|
|
804
|
-
if (
|
|
833
|
+
const claudeDir = join4(targetDir, ".claude");
|
|
834
|
+
if (existsSync4(claudeDir) && !force) {
|
|
805
835
|
console.log(" Found existing .claude/ folder.");
|
|
806
836
|
console.log(" Will preserve your custom domains and merge with new files.\n");
|
|
807
837
|
}
|
|
@@ -816,6 +846,10 @@ async function main() {
|
|
|
816
846
|
if (result.preserved > 0) {
|
|
817
847
|
console.log(`\n Preserved ${result.preserved} custom file(s) (domains, etc.)`);
|
|
818
848
|
}
|
|
849
|
+
const hooksResult = ensureHooksEnabled();
|
|
850
|
+
if (hooksResult.modified) {
|
|
851
|
+
console.log("\n Fixed global settings: removed disableAllHooks (hooks now enabled)");
|
|
852
|
+
}
|
|
819
853
|
if (!skipClaude) {
|
|
820
854
|
console.log("");
|
|
821
855
|
console.log(" ========================================");
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import { spawnSync } from 'child_process';
|
|
15
|
-
import { existsSync } from 'fs';
|
|
15
|
+
import { existsSync, unlinkSync } from 'fs';
|
|
16
16
|
import { join, dirname } from 'path';
|
|
17
17
|
import { fileURLToPath } from 'url';
|
|
18
18
|
|
|
@@ -30,6 +30,25 @@ const getHooksDir = (): string => {
|
|
|
30
30
|
|
|
31
31
|
const HOOKS_DIR = getHooksDir();
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Remove deprecated settings.local.json if it exists.
|
|
35
|
+
* This file was previously tracked but should not be used anymore.
|
|
36
|
+
* All hooks should use the universal runner via settings.json.
|
|
37
|
+
*/
|
|
38
|
+
function cleanupDeprecatedFiles(): void {
|
|
39
|
+
const claudeDir = join(HOOKS_DIR, '..');
|
|
40
|
+
const settingsLocalPath = join(claudeDir, 'settings.local.json');
|
|
41
|
+
|
|
42
|
+
if (existsSync(settingsLocalPath)) {
|
|
43
|
+
try {
|
|
44
|
+
unlinkSync(settingsLocalPath);
|
|
45
|
+
console.error('[run-hook] Removed deprecated settings.local.json');
|
|
46
|
+
} catch {
|
|
47
|
+
// Ignore errors - file may be locked or read-only
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
33
52
|
function checkRuntime(cmd: string): boolean {
|
|
34
53
|
try {
|
|
35
54
|
const result = spawnSync(cmd, ['--version'], {
|
|
@@ -152,6 +171,9 @@ async function readStdinWithTimeout(timeoutMs: number): Promise<string> {
|
|
|
152
171
|
|
|
153
172
|
// Main
|
|
154
173
|
async function main(): Promise<void> {
|
|
174
|
+
// Clean up deprecated files on every hook run
|
|
175
|
+
cleanupDeprecatedFiles();
|
|
176
|
+
|
|
155
177
|
const hookName = process.argv[2];
|
|
156
178
|
if (!hookName) {
|
|
157
179
|
console.error('Usage: bun run-hook.ts <hook-name>');
|