@scotthamilton77/sidekick 0.0.4-alpha → 0.0.5-alpha
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 +71 -2
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -49286,6 +49286,7 @@ var require_hook_command = __commonJS({
|
|
|
49286
49286
|
exports2.translateToClaudeCodeFormat = translateToClaudeCodeFormat;
|
|
49287
49287
|
exports2.parseHookArg = parseHookArg;
|
|
49288
49288
|
exports2.handleUnifiedHookCommand = handleUnifiedHookCommand;
|
|
49289
|
+
var core_1 = require_dist3();
|
|
49289
49290
|
var hook_js_1 = require_hook();
|
|
49290
49291
|
function combineReasonAndContext(reason, additionalContext, separator = "\n\n") {
|
|
49291
49292
|
if (reason && additionalContext) {
|
|
@@ -49303,7 +49304,7 @@ var require_hook_command = __commonJS({
|
|
|
49303
49304
|
response.systemMessage = internal.userMessage;
|
|
49304
49305
|
}
|
|
49305
49306
|
if (internal.additionalContext) {
|
|
49306
|
-
response.hookSpecificOutput = { additionalContext: internal.additionalContext };
|
|
49307
|
+
response.hookSpecificOutput = { hookEventName: "SessionStart", additionalContext: internal.additionalContext };
|
|
49307
49308
|
}
|
|
49308
49309
|
return response;
|
|
49309
49310
|
}
|
|
@@ -49408,6 +49409,52 @@ var require_hook_command = __commonJS({
|
|
|
49408
49409
|
return void 0;
|
|
49409
49410
|
return HOOK_ARG_TO_NAME[arg];
|
|
49410
49411
|
}
|
|
49412
|
+
var DEGRADED_MODE_MESSAGES = {
|
|
49413
|
+
"not-run": {
|
|
49414
|
+
additionalContext: `Sidekick plugin detected but not configured. Features like reminders, personas, and statusline are unavailable until setup is complete. If you haven't already, ask the user if you should execute the sidekick-config skill.`,
|
|
49415
|
+
userMessage: `Sidekick is installed but not configured. Run 'sidekick setup' to configure.`
|
|
49416
|
+
},
|
|
49417
|
+
partial: {
|
|
49418
|
+
additionalContext: `Sidekick user setup is complete but this project is not configured. Features like reminders, personas, and statusline are unavailable until project setup is complete. If you haven't already, ask the user if you should execute the sidekick-config skill.`,
|
|
49419
|
+
userMessage: `Sidekick project setup incomplete. Run 'sidekick setup' in this project to configure.`
|
|
49420
|
+
},
|
|
49421
|
+
unhealthy: {
|
|
49422
|
+
additionalContext: `Sidekick is configured but unhealthy (possibly invalid API keys or missing configuration). Features are unavailable until issues are resolved. If you haven't already, ask the user if you should execute sidekick doctor.`,
|
|
49423
|
+
userMessage: `Sidekick configuration is unhealthy. Run 'sidekick doctor' to diagnose issues.`
|
|
49424
|
+
}
|
|
49425
|
+
};
|
|
49426
|
+
var VERBOSE_DEGRADED_HOOKS = /* @__PURE__ */ new Set(["SessionStart", "UserPromptSubmit"]);
|
|
49427
|
+
async function checkSetupState(projectRoot, hookName, logger) {
|
|
49428
|
+
let state;
|
|
49429
|
+
try {
|
|
49430
|
+
const setupService = new core_1.SetupStatusService(projectRoot);
|
|
49431
|
+
state = await setupService.getSetupState();
|
|
49432
|
+
} catch (err) {
|
|
49433
|
+
logger.warn("Failed to check setup state, assuming healthy", {
|
|
49434
|
+
error: err instanceof Error ? err.message : String(err),
|
|
49435
|
+
hookName,
|
|
49436
|
+
projectRoot
|
|
49437
|
+
});
|
|
49438
|
+
return null;
|
|
49439
|
+
}
|
|
49440
|
+
if (state === "healthy") {
|
|
49441
|
+
return null;
|
|
49442
|
+
}
|
|
49443
|
+
const logData = { setupState: state, hookName, projectRoot };
|
|
49444
|
+
if (state === "not-run") {
|
|
49445
|
+
logger.info("Hook operating in degraded mode - setup not run", logData);
|
|
49446
|
+
} else {
|
|
49447
|
+
logger.warn("Hook operating in degraded mode", logData);
|
|
49448
|
+
}
|
|
49449
|
+
if (!VERBOSE_DEGRADED_HOOKS.has(hookName)) {
|
|
49450
|
+
return {};
|
|
49451
|
+
}
|
|
49452
|
+
const messages = DEGRADED_MODE_MESSAGES[state];
|
|
49453
|
+
return {
|
|
49454
|
+
additionalContext: messages.additionalContext,
|
|
49455
|
+
userMessage: messages.userMessage
|
|
49456
|
+
};
|
|
49457
|
+
}
|
|
49411
49458
|
function parseInternalResponse(output, hookName, logger) {
|
|
49412
49459
|
if (!output)
|
|
49413
49460
|
return {};
|
|
@@ -49425,6 +49472,15 @@ var require_hook_command = __commonJS({
|
|
|
49425
49472
|
async function handleUnifiedHookCommand(hookName, options, logger, stdout) {
|
|
49426
49473
|
const { projectRoot, hookInput, correlationId, runtime } = options;
|
|
49427
49474
|
logger.debug("Unified hook command invoked", { hookName, sessionId: hookInput.sessionId });
|
|
49475
|
+
const degradedResponse = await checkSetupState(projectRoot, hookName, logger);
|
|
49476
|
+
if (degradedResponse !== null) {
|
|
49477
|
+
const claudeResponse2 = translateToClaudeCodeFormat(hookName, degradedResponse);
|
|
49478
|
+
const outputStr2 = JSON.stringify(claudeResponse2);
|
|
49479
|
+
stdout.write(`${outputStr2}
|
|
49480
|
+
`);
|
|
49481
|
+
logger.debug("Hook completed in degraded mode", { hookName });
|
|
49482
|
+
return { exitCode: 0, output: outputStr2 };
|
|
49483
|
+
}
|
|
49428
49484
|
let internalOutput = "";
|
|
49429
49485
|
const captureStream = {
|
|
49430
49486
|
write(chunk) {
|
|
@@ -54175,7 +54231,7 @@ var require_cli = __commonJS({
|
|
|
54175
54231
|
var promises_12 = require("node:fs/promises");
|
|
54176
54232
|
var node_stream_1 = require("node:stream");
|
|
54177
54233
|
var yargs_parser_1 = __importDefault2(require_build());
|
|
54178
|
-
var VERSION = true ? "0.0.
|
|
54234
|
+
var VERSION = true ? "0.0.5-alpha" : "dev";
|
|
54179
54235
|
function isInSandbox() {
|
|
54180
54236
|
return process.env.SANDBOX_RUNTIME === "1";
|
|
54181
54237
|
}
|
|
@@ -54293,6 +54349,19 @@ Example: { "command": "pnpm sidekick daemon status", "dangerouslyDisableSandbox"
|
|
|
54293
54349
|
if (!hookMode || !projectRoot) {
|
|
54294
54350
|
return { started: false };
|
|
54295
54351
|
}
|
|
54352
|
+
try {
|
|
54353
|
+
const { SetupStatusService } = await Promise.resolve().then(() => __importStar(require_dist3()));
|
|
54354
|
+
const setupService = new SetupStatusService(projectRoot);
|
|
54355
|
+
const setupState = await setupService.getSetupState();
|
|
54356
|
+
if (setupState !== "healthy") {
|
|
54357
|
+
logger.debug("Skipping daemon start - setup not healthy", { setupState });
|
|
54358
|
+
return { started: false };
|
|
54359
|
+
}
|
|
54360
|
+
} catch (err) {
|
|
54361
|
+
logger.warn("Failed to check setup status, proceeding with daemon start", {
|
|
54362
|
+
error: err instanceof Error ? err.message : String(err)
|
|
54363
|
+
});
|
|
54364
|
+
}
|
|
54296
54365
|
try {
|
|
54297
54366
|
const { DaemonClient } = await Promise.resolve().then(() => __importStar(require_dist3()));
|
|
54298
54367
|
const daemonClient = new DaemonClient(projectRoot, logger);
|
package/package.json
CHANGED