@scotthamilton77/sidekick 0.0.8-alpha.1 → 0.0.8-alpha.2
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/bin.js +54 -47
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -67078,6 +67078,31 @@ var require_hook_command = __commonJS({
|
|
|
67078
67078
|
userMessage: messages.userMessage
|
|
67079
67079
|
};
|
|
67080
67080
|
}
|
|
67081
|
+
async function ensureDaemonForHook(projectRoot, logger) {
|
|
67082
|
+
try {
|
|
67083
|
+
const setupService = new core_1.SetupStatusService(projectRoot);
|
|
67084
|
+
const setupState = await setupService.getSetupState();
|
|
67085
|
+
if (setupState !== "healthy") {
|
|
67086
|
+
logger.debug("Skipping daemon start - setup not healthy", { setupState });
|
|
67087
|
+
return false;
|
|
67088
|
+
}
|
|
67089
|
+
} catch (err) {
|
|
67090
|
+
logger.warn("Failed to check setup status for daemon start, proceeding anyway", {
|
|
67091
|
+
error: err instanceof Error ? err.message : String(err)
|
|
67092
|
+
});
|
|
67093
|
+
}
|
|
67094
|
+
try {
|
|
67095
|
+
const daemonClient = new core_1.DaemonClient(projectRoot, logger);
|
|
67096
|
+
await daemonClient.start();
|
|
67097
|
+
logger.debug("Daemon started for hook execution");
|
|
67098
|
+
return true;
|
|
67099
|
+
} catch (err) {
|
|
67100
|
+
logger.warn("Failed to start daemon for hook, proceeding without daemon features", {
|
|
67101
|
+
error: err instanceof Error ? err.message : String(err)
|
|
67102
|
+
});
|
|
67103
|
+
return false;
|
|
67104
|
+
}
|
|
67105
|
+
}
|
|
67081
67106
|
function parseInternalResponse(output, hookName, logger) {
|
|
67082
67107
|
if (!output)
|
|
67083
67108
|
return {};
|
|
@@ -67117,6 +67142,7 @@ var require_hook_command = __commonJS({
|
|
|
67117
67142
|
if (hookName === "SessionStart") {
|
|
67118
67143
|
await maybeAutoConfigureProject(projectRoot, logger);
|
|
67119
67144
|
}
|
|
67145
|
+
await ensureDaemonForHook(projectRoot, logger);
|
|
67120
67146
|
const degradedResponse = await checkSetupState(projectRoot, hookName, logger);
|
|
67121
67147
|
if (degradedResponse !== null) {
|
|
67122
67148
|
const claudeResponse2 = translateToClaudeCodeFormat(hookName, degradedResponse);
|
|
@@ -71600,6 +71626,11 @@ Examples:
|
|
|
71600
71626
|
throw err;
|
|
71601
71627
|
}
|
|
71602
71628
|
}
|
|
71629
|
+
const existing = settings.statusLine;
|
|
71630
|
+
if (existing?.command?.includes("dev-sidekick")) {
|
|
71631
|
+
logger?.warn("Statusline managed by dev-mode, skipping overwrite", { path: settingsPath });
|
|
71632
|
+
return false;
|
|
71633
|
+
}
|
|
71603
71634
|
settings.statusLine = {
|
|
71604
71635
|
type: "command",
|
|
71605
71636
|
command: STATUSLINE_COMMAND
|
|
@@ -71608,6 +71639,7 @@ Examples:
|
|
|
71608
71639
|
await fs.mkdir(dir, { recursive: true });
|
|
71609
71640
|
await fs.writeFile(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
71610
71641
|
logger?.info("Statusline configured", { path: settingsPath });
|
|
71642
|
+
return true;
|
|
71611
71643
|
}
|
|
71612
71644
|
async function writeApiKeyToEnv(envPath, key, value) {
|
|
71613
71645
|
const dir = path.dirname(envPath);
|
|
@@ -71667,8 +71699,12 @@ Examples:
|
|
|
71667
71699
|
{ value: "project", label: "Project-level (.claude/settings.local.json)", description: "This project only" }
|
|
71668
71700
|
]);
|
|
71669
71701
|
const statuslinePath = statuslineScope === "user" ? path.join(homeDir, ".claude", "settings.json") : path.join(projectDir, ".claude", "settings.local.json");
|
|
71670
|
-
await configureStatusline(statuslinePath, logger);
|
|
71671
|
-
(
|
|
71702
|
+
const wrote = await configureStatusline(statuslinePath, logger);
|
|
71703
|
+
if (wrote) {
|
|
71704
|
+
(0, prompts_js_1.printStatus)(ctx, "success", `Statusline configured in ${statuslinePath}`);
|
|
71705
|
+
} else {
|
|
71706
|
+
(0, prompts_js_1.printStatus)(ctx, "warning", "Statusline managed by dev-mode (skipped)");
|
|
71707
|
+
}
|
|
71672
71708
|
return statuslineScope;
|
|
71673
71709
|
}
|
|
71674
71710
|
async function runStep2Gitignore(wctx, force) {
|
|
@@ -71807,6 +71843,7 @@ Examples:
|
|
|
71807
71843
|
}
|
|
71808
71844
|
};
|
|
71809
71845
|
await setupService.writeUserStatus(userStatus);
|
|
71846
|
+
const existingProject = await setupService.getProjectStatus();
|
|
71810
71847
|
const projectStatus = {
|
|
71811
71848
|
version: 1,
|
|
71812
71849
|
lastUpdatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -71816,7 +71853,8 @@ Examples:
|
|
|
71816
71853
|
OPENROUTER_API_KEY: apiKeyDetection ? setupService.buildProjectApiKeyStatus(apiKeyDetection) : apiKeyHealth === "healthy" ? "user" : apiKeyHealth,
|
|
71817
71854
|
OPENAI_API_KEY: "not-required"
|
|
71818
71855
|
},
|
|
71819
|
-
gitignore: gitignoreStatus
|
|
71856
|
+
gitignore: gitignoreStatus,
|
|
71857
|
+
devMode: existingProject?.devMode
|
|
71820
71858
|
};
|
|
71821
71859
|
await setupService.writeProjectStatus(projectStatus);
|
|
71822
71860
|
}
|
|
@@ -71867,7 +71905,10 @@ Examples:
|
|
|
71867
71905
|
const autoConfig = force ? "auto" : await runStep4AutoConfig(wctx);
|
|
71868
71906
|
if (force) {
|
|
71869
71907
|
const statuslinePath = path.join(homeDir, ".claude", "settings.json");
|
|
71870
|
-
await configureStatusline(statuslinePath, logger);
|
|
71908
|
+
const wrote = await configureStatusline(statuslinePath, logger);
|
|
71909
|
+
if (!wrote) {
|
|
71910
|
+
stdout.write("\u26A0 Statusline managed by dev-mode (skipped)\n");
|
|
71911
|
+
}
|
|
71871
71912
|
}
|
|
71872
71913
|
const state = {
|
|
71873
71914
|
statuslineScope,
|
|
@@ -71902,10 +71943,15 @@ Examples:
|
|
|
71902
71943
|
let configuredCount = 0;
|
|
71903
71944
|
if (options.statuslineScope) {
|
|
71904
71945
|
const statuslinePath = options.statuslineScope === "user" ? path.join(homeDir, ".claude", "settings.json") : path.join(projectDir, ".claude", "settings.local.json");
|
|
71905
|
-
await configureStatusline(statuslinePath, logger);
|
|
71906
|
-
|
|
71946
|
+
const wrote = await configureStatusline(statuslinePath, logger);
|
|
71947
|
+
if (wrote) {
|
|
71948
|
+
stdout.write(`\u2713 Statusline configured (${options.statuslineScope}-level)
|
|
71907
71949
|
`);
|
|
71908
|
-
|
|
71950
|
+
configuredCount++;
|
|
71951
|
+
} else {
|
|
71952
|
+
stdout.write(`\u26A0 Statusline managed by dev-mode (skipped)
|
|
71953
|
+
`);
|
|
71954
|
+
}
|
|
71909
71955
|
}
|
|
71910
71956
|
if (options.gitignore === true) {
|
|
71911
71957
|
const result = await (0, core_1.installGitignoreSection)(projectDir);
|
|
@@ -72111,13 +72157,12 @@ var require_cli = __commonJS({
|
|
|
72111
72157
|
exports2.parseHookInput = parseHookInput;
|
|
72112
72158
|
exports2.initializeRuntime = initializeRuntime;
|
|
72113
72159
|
exports2.initializeSession = initializeSession;
|
|
72114
|
-
exports2.ensureDaemon = ensureDaemon;
|
|
72115
72160
|
exports2.routeCommand = routeCommand;
|
|
72116
72161
|
exports2.runCli = runCli;
|
|
72117
72162
|
var promises_12 = require("node:fs/promises");
|
|
72118
72163
|
var node_stream_1 = require("node:stream");
|
|
72119
72164
|
var yargs_parser_1 = __importDefault2(require_build());
|
|
72120
|
-
var VERSION = true ? "0.0.8-alpha.
|
|
72165
|
+
var VERSION = true ? "0.0.8-alpha.2" : "dev";
|
|
72121
72166
|
function isInSandbox() {
|
|
72122
72167
|
return process.env.SANDBOX_RUNTIME === "1";
|
|
72123
72168
|
}
|
|
@@ -72248,38 +72293,6 @@ Example: { "command": "pnpm sidekick daemon status", "dangerouslyDisableSandbox"
|
|
|
72248
72293
|
logger.warn("Failed to create session directory", { sessionId, error: error.message });
|
|
72249
72294
|
}
|
|
72250
72295
|
}
|
|
72251
|
-
async function ensureDaemon(options) {
|
|
72252
|
-
const { hookMode, projectRoot, logger } = options;
|
|
72253
|
-
if (!hookMode || !projectRoot) {
|
|
72254
|
-
return { started: false };
|
|
72255
|
-
}
|
|
72256
|
-
try {
|
|
72257
|
-
const { SetupStatusService } = await Promise.resolve().then(() => __importStar(require_dist4()));
|
|
72258
|
-
const setupService = new SetupStatusService(projectRoot);
|
|
72259
|
-
const setupState = await setupService.getSetupState();
|
|
72260
|
-
if (setupState !== "healthy") {
|
|
72261
|
-
logger.debug("Skipping daemon start - setup not healthy", { setupState });
|
|
72262
|
-
return { started: false };
|
|
72263
|
-
}
|
|
72264
|
-
} catch (err) {
|
|
72265
|
-
logger.warn("Failed to check setup status, proceeding with daemon start", {
|
|
72266
|
-
error: err instanceof Error ? err.message : String(err)
|
|
72267
|
-
});
|
|
72268
|
-
}
|
|
72269
|
-
try {
|
|
72270
|
-
const { DaemonClient } = await Promise.resolve().then(() => __importStar(require_dist4()));
|
|
72271
|
-
const daemonClient = new DaemonClient(projectRoot, logger);
|
|
72272
|
-
await daemonClient.start();
|
|
72273
|
-
logger.debug("Daemon auto-started for hook execution");
|
|
72274
|
-
return { started: true };
|
|
72275
|
-
} catch (err) {
|
|
72276
|
-
const error = err instanceof Error ? err : new Error(String(err));
|
|
72277
|
-
logger.warn("Failed to auto-start daemon, proceeding with sync paths", {
|
|
72278
|
-
error: error.message
|
|
72279
|
-
});
|
|
72280
|
-
return { started: false };
|
|
72281
|
-
}
|
|
72282
|
-
}
|
|
72283
72296
|
var GLOBAL_HELP_TEXT = `Usage: sidekick <command> [options]
|
|
72284
72297
|
|
|
72285
72298
|
Commands:
|
|
@@ -72511,12 +72524,6 @@ Run 'sidekick help' for available commands.
|
|
|
72511
72524
|
stateService: runtime.stateService,
|
|
72512
72525
|
logger: runtime.logger
|
|
72513
72526
|
});
|
|
72514
|
-
const isHookExecution = parsed.command === "hook" && Boolean(parsed.projectDir);
|
|
72515
|
-
await ensureDaemon({
|
|
72516
|
-
hookMode: isHookExecution,
|
|
72517
|
-
projectRoot: runtime.projectRoot,
|
|
72518
|
-
logger: runtime.logger
|
|
72519
|
-
});
|
|
72520
72527
|
const result = await routeCommand({
|
|
72521
72528
|
parsed,
|
|
72522
72529
|
runtime,
|
package/package.json
CHANGED