Repository navigation
chore: clean up build pipeline, remove MCP server, unify logger - #82
Conversation
- remove OpenKit MCP server and @modelcontextprotocol/sdk dependency (replaced by skills API for agent integration) - unify logger TS bindings into shared ts_utils.ts base class (eliminates duplicate Logger implementations across node/browser) - move commit-message, git-policy, notes-types, task-context to @openkit/shared (these are consumed by multiple apps, not server-specific) - simplify Nx project.json files to metadata + overrides only (targets inferred from package.json scripts via nx:run-script) - move runtime file copying and dev server spawn into tsup.config.ts onSuccess (server and desktop-app build scripts are now just "tsup") - standardize script naming: check:types, check:lint, check:format, fix:lint, fix:format (consistent namespace convention across all projects) - remove unnecessary targetDefaults cascading for typecheck and lint (these are independent per project, cascading just wasted time) - add --parallel flag to root test/check/build scripts - fix server build path from libs/port-resolution to libs/native-port-resolution - simplify CLI dev watch to --watch ../../libs instead of listing each lib - use pnpm exec nx for start scripts instead of brittle path traversal
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
📝 WalkthroughWalkthroughOpenKit's MCP server functionality and direct MCP routes are removed in favor of third-party server management and unified skill deployment. Simultaneously, logging infrastructure is unified across runtimes through a Go-based logger with new Changes
Sequence Diagram(s)sequenceDiagram
actor Caller
participant BaseLogger as BaseLogger<br/>(ts_utils)
participant Resolver as BindingsResolver<br/>(Environment-specific)
participant GoLogger as Go Logger<br/>(Native/WASM)
Caller->>BaseLogger: Constructor(resolve, system, subsystem)
activate BaseLogger
BaseLogger->>Resolver: resolve() on demand
Resolver->>GoLogger: Load bindings (Node/Browser/Zig)
GoLogger-->>Resolver: Return LoggerBindings or null
Resolver-->>BaseLogger: BindingsResolver result
Caller->>BaseLogger: info(msg, context)
activate BaseLogger
BaseLogger->>BaseLogger: ensureHandle() - lazy LoggerNew
BaseLogger->>BaseLogger: normalizeContext(ctx) - serialize Error objs
BaseLogger->>GoLogger: LoggerInfo(handle, msg, contextJSON)
GoLogger->>GoLogger: Log with level=info
deactivate BaseLogger
Caller->>BaseLogger: started(msg, context)
activate BaseLogger
BaseLogger->>BaseLogger: Add status: "started" to context
BaseLogger->>GoLogger: LoggerStarted(handle, msg, contextJSON)
GoLogger->>GoLogger: Log with lifecycle marker
deactivate BaseLogger
deactivate BaseLogger
sequenceDiagram
actor CLI as CLI/Agent
participant Server as OpenKit Server
participant Logger as Unified Logger<br/>(domain-specific)
participant OpsLog as OpsLog<br/>(legacy fallback)
CLI->>Server: POST /api/tasks/... or other action
activate Server
Server->>Logger: taskLog.info(msg, context)
activate Logger
Logger->>Logger: route to started/success/error based on status
Logger->>OpsLog: (fallback if no sink configured)
deactivate Logger
Server->>Server: Perform operation
alt Operation succeeds
Server->>Logger: taskLog.success(msg, {..., status: "success"})
else Operation fails
Server->>Logger: taskLog.error(msg, error, {..., status: "failed"})
end
Server-->>CLI: Response
deactivate Server
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
|
There was a problem hiding this comment.
Actionable comments posted: 11
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
apps/server/src/routes/claude-plugins.ts (1)
466-577:⚠️ Potential issue | 🟠 MajorAdd co-located Vitest coverage for the new CLI logging behavior
runClaude()behavior changed (new start log payload + success/warn/error terminal branching), but no matching*.test.tschanges are included. Please add tests for:
- non-zero exit →
cliLog.error- zero exit with empty stdout →
cliLog.warn- zero exit with stdout →
cliLog.success- spawn error path →
cliLog.errorAs per coding guidelines: “Every code change — feature, bugfix, or refactor — must include corresponding tests. Tests are co-located with source files using the pattern foo.ts -> foo.test.ts. Always use Vitest for testing.”
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/server/src/routes/claude-plugins.ts` around lines 466 - 577, The change to runClaude introduced new CLI logging branches (start log plus success/warn/error on close and an error handler) but no tests were added; create a co-located Vitest test file next to claude-plugins.ts that covers four scenarios: (1) non-zero exit → verify cliLog.error is called with status "failed" and exitCode present, (2) zero exit with empty stdout → verify cliLog.warn called with status "success" but empty stdout, (3) zero exit with non-empty stdout → verify cliLog.success called and stdout is included, and (4) spawn error → simulate spawn emitting "error" and verify cliLog.error is called; in tests, stub/spy/mock spawn/child process behavior used by runClaude (and spy cliLog methods) so you can emit stdout/stderr data, "close" with codes, and "error" events and assert the logged payloads (check command.exitCode/durationMs/stdout/stderr and status fields) using Vitest APIs and restore mocks after each test.apps/server/src/task-context.ts (2)
82-84:⚠️ Potential issue | 🟡 MinorSilent catch swallows local task loading errors.
If local task file parsing fails, returning
nullwithout any logging makes it impossible to diagnose why a task failed to load. Add logging with file path context. As per coding guidelines: "Silent catch {} blocks are never acceptable."🐛 Proposed fix
Note: This requires importing the logger. Add at top of file:
import { log } from "./logger";Then update the catch block:
} catch { + log.warn(`Failed to parse local task file`, { + domain: "task-context", + taskFile, + issueId, + }); return null; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/server/src/task-context.ts` around lines 82 - 84, The silent catch in the local task loading code (inside the function that reads/parses tasks in task-context.ts) should log the error and file path before returning null: add an import for log from "./logger" at top and update the catch block in the loader (the try/catch that currently does `} catch { return null; }`) to call log.error or similar with a clear message including the task file path/identifier (e.g., the variable holding the path used to load the task) and the caught error, then return null as before.
130-132:⚠️ Potential issue | 🟡 MinorSilent catch swallows issue file parsing errors.
The comment "Corrupt file" indicates awareness that parsing can fail, but the error is silently swallowed. Log at warn level with the file path and source for diagnosability. As per coding guidelines: "Never swallow errors silently. If you genuinely cannot handle an error, re-throw it or log it at warn/error level with context."
🐛 Proposed fix
} catch { - // Corrupt file + log.warn(`Failed to parse issue file`, { + domain: "task-context", + issueFile, + source, + issueId, + }); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/server/src/task-context.ts` around lines 130 - 132, The empty catch in task-context.ts that currently swallows parse errors should be replaced with a warn-level log that includes the file path and source content plus the caught error for diagnosability: inside the catch block, call the module's logger (e.g., logger or processLogger used elsewhere in this file) to log a message like "Failed to parse file" including the filePath and source variables and the caught error object; if parsing truly cannot be tolerated in this context, re-throw the error instead of swallowing it.libs/logger/browser/src/index.ts (1)
30-33:⚠️ Potential issue | 🟡 MinorEmpty catch block swallows WASM loading failures silently.
While there's a bootstrapping issue (the logger itself can't use the logger), development-time diagnostics would help troubleshoot missing WASM artifacts. Consider at least a
console.warnsince this is critical infrastructure code.🛡️ Proposed fix to add minimal error reporting
} catch { // WASM loading failed (e.g., missing build artifacts). // Logger methods become no-ops. + // eslint-disable-next-line no-console + console.warn("[openkit-logger] WASM initialization failed; logging disabled"); }As per coding guidelines: "Silent
catch {}blocks are never acceptable... If you genuinely cannot handle an error, re-throw it or log it at warn/error level with context."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@libs/logger/browser/src/index.ts` around lines 30 - 33, The empty catch in the WASM bootstrap swallows load failures; change the catch to capture the error (e.g., catch (err)) and emit a minimal developer-facing message using console.warn or console.error with context (for example: "WASM logger failed to load, falling back to no-op logger") and include the captured error object; update the catch block in libs/logger/browser/src/index.ts where WASM loading occurs so the fallback to no-op logger remains but the failure is logged for diagnostics.
🧹 Nitpick comments (8)
libs/agents/README.md (1)
10-10: Consider renaming or annotatingsrc/mcp/to avoid MCP-server ambiguity.Given this PR removes built-in MCP server functionality, keeping instruction templates under
src/mcp/can be confusing for future contributors. A short note (or eventual directory rename) would reduce ambiguity.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@libs/agents/README.md` at line 10, Update the README entry for the instruction templates to remove ambiguity around the removed MCP server by either renaming the directory label or adding a clarifying note: change the mention of `src/mcp/` to something like `src/instructions/ (formerly src/mcp/)` or append a short sentence stating that these are only instruction/skill templates and not an MCP server implementation; ensure the README text references the directory name `src/mcp/` so future contributors can locate it and understand the distinction.apps/server/src/manager.ts (1)
472-482: Consider extracting the notification logger.For consistency with
portLog,worktreeLog, andlinearLog(defined at module level on lines 27-29), consider extracting the notification logger:+const notificationLog = log.get("notification");Then use
notificationLoginstead of creating it inline each timeemitNotificationis called.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/server/src/manager.ts` around lines 472 - 482, Extract a module-level notification logger like the existing portLog/worktreeLog/linearLog and reuse it inside emitNotification instead of creating it on every call: add a top-level const notificationLog = log.get("notification") (next to portLog/worktreeLog/linearLog) and then replace the inline creation in emitNotification with that notificationLog; keep the same context object construction (domain/action/projectName) and call notificationLog.error(...) or notificationLog.info(...) as currently done.docs/superpowers/specs/2026-03-17-unified-logger-design.md (1)
172-172: Minor: Consider hyphenating "level/status".Static analysis suggests "level-status" or rewording for clarity. The current text is understandable, but a small adjustment would improve readability.
📝 Suggested rewording
-Document level/status mapping with comments on each method. +Document the level-to-status mapping with comments on each method.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/superpowers/specs/2026-03-17-unified-logger-design.md` at line 172, The phrase "level/status" in the document should be hyphenated or reworded for clarity; replace occurrences of "level/status" with either "level-status" or a clearer phrase like "log level and status mapping" (e.g., update the heading or sentence containing "Document level/status mapping with comments on each method") so the intent reads smoothly and follows style guidance.apps/server/tsup.config.ts (1)
16-27: Consider handling spawn errors in watch mode.If
dist/standalone.jsfails to start (e.g., syntax error, missing dependency), the spawn call will fail silently or the process will exit without clear feedback. Adding an error listener would help diagnose startup failures during development.♻️ Proposed enhancement for error visibility
async onSuccess() { if (process.argv.includes("--watch")) { const server = spawn("node", ["dist/standalone.js"], { stdio: "inherit" }); + server.on("error", (err) => { + console.error("Failed to start server:", err.message); + }); return () => { server.kill(); }; } else {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/server/tsup.config.ts` around lines 16 - 27, The onSuccess handler's watch-mode spawn of the server (spawn("node", ["dist/standalone.js"])) lacks error handling; attach listeners to the returned child (server) for 'error' and 'exit' (or 'close') to log startup failures and exit codes, and ensure any non-zero exit triggers a visible message or process.exit if appropriate; update the onSuccess watch branch to add server.on('error', ...) and server.on('exit'/'close', ...) alongside the existing server.kill cleanup so startup failures are surfaced during development.apps/server/src/index.ts (2)
384-401: Consider logging integration verification failures at debug level.The Jira and Linear connection tests silently catch errors and return
{ ok: false }. While the boolean result is sufficient for the API response, logging these failures at debug level would aid troubleshooting without noise.♻️ Optional improvement
// Jira: test API connection (async () => { const creds = loadJiraCredentials(configDir); if (!creds) return null; try { await testJiraConnection(creds, configDir); return { ok: true }; - } catch { + } catch (err) { + log.debug("Jira connection verification failed", { + domain: "integrations", + error: err instanceof Error ? err.message : String(err), + }); return { ok: false }; } })(),🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/server/src/index.ts` around lines 384 - 401, The Jira and Linear connection checks swallow exceptions and return { ok: false } with no diagnostic output; update the two catch blocks surrounding testJiraConnection(creds, configDir) and testLinearConnection(creds) to log the caught error at debug level (e.g., using the existing logger or processLogger) before returning { ok: false } so failures are recorded for troubleshooting while keeping the API behavior unchanged.
604-606: Silent catch for server.json write is acceptable but could use debug logging.While server.json is non-critical for operation, silent failures make it harder to diagnose agent discovery issues.
♻️ Optional improvement
try { writeFileSync( serverJsonPath, JSON.stringify({ url: `http://localhost:${actualPort}`, pid: process.pid }, null, 2), ); - } catch { - // Non-critical + } catch (err) { + log.debug("Failed to write server.json for agent discovery", { + domain: "startup", + serverJsonPath, + error: err instanceof Error ? err.message : String(err), + }); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/server/src/index.ts` around lines 604 - 606, The silent catch around the server.json write should capture the error and emit a debug-level log so failures are discoverable; update the catch block in apps/server/src/index.ts to use catch (err) and log a concise debug message like "Failed to write server.json" including the err details using the existing logger (e.g. processLogger or logger) and fall back to console.debug if no logger is available.libs/shared/src/task-context.ts (1)
298-300: Silent catches in Git exclude utilities.Both
getWorktreeGitExcludePathandensureGitExcludesilently swallow errors. While these are non-critical operations (the app works without git excludes), silent failures make debugging difficult when git excludes unexpectedly don't work.Since this is a shared library, adding a logger dependency may not be appropriate. Consider either:
- Re-throwing with a descriptive message for the caller to handle
- Accepting the silent fallback for this truly non-critical path
Given the non-critical nature and that these are internal helpers, the current approach is acceptable but worth noting.
Also applies to: 319-321
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@libs/shared/src/task-context.ts` around lines 298 - 300, The silent catch blocks in getWorktreeGitExcludePath and ensureGitExclude swallow errors and hide useful debugging info; replace those empty catch blocks by rethrowing a descriptive error that includes the original error (e.g., throw new Error(`getWorktreeGitExcludePath failed: ${err?.message || err}`) or rethrow err after augmenting its message) so callers can handle/log failures, ensuring you reference these two helpers (getWorktreeGitExcludePath and ensureGitExclude) when locating the catch sites to change.docs/superpowers/plans/2026-03-17-unified-logger.md (1)
115-127: Clarify the intentional console.log fallback in logger implementation.The proposed
started()implementation usesconsole.logwhen native bindings aren't available. While this technically violates the "no console.log" guideline, it's the correct approach for the logger's own fallback path (can't use the logger to log logger failures). Consider adding a brief inline comment explaining this exception for future maintainers.📝 Suggested clarification
if (!this.native) { + // Fallback when native bindings unavailable - console is acceptable here + // since we can't use the logger to log its own fallback behavior console.log(`▶ ${message}`, ...(ctx ? [ctx] : [])); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/superpowers/plans/2026-03-17-unified-logger.md` around lines 115 - 127, The started() method intentionally uses console.log as a fallback when native bindings are missing; add a brief inline comment above the console.log call explaining that this is an explicit, deliberate exception to the "no console.log" rule because the logger cannot rely on itself to report logger initialization/fallback errors (see started(), normalizeContext(), getBindings(), bindings.LoggerStarted and this.native usage), so future maintainers understand why console.log is used here and that dispatch("info", ...) still handles normal logging.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/server/package.json`:
- Around line 6-8: The package exports currently point to TypeScript sources
("./src/*.ts") which causes runtime import failures; change the exports mapping
in package.json to reference compiled JS artifacts (e.g., "./dist/*.js" or
explicit entries like "./manager": "./dist/manager.js" and "./index":
"./dist/index.js") and ensure your build (tsup) actually emits those files (or
adjust the build to produce the needed outputs such as manager/index and
standalone). Update the exports to match the actual dist outputs so runtime
imports like "@openkit/server/manager" and "@openkit/server/index" resolve to
.js files.
In `@apps/server/src/logger.ts`:
- Line 5: Add a Vitest unit test file named logger.test.ts that locks the module
export surface for apps/server/src/logger.ts by importing the module and
asserting that Logger and LogLevel are present exports and that LogEntry and
LogSink are not exported; use named-import checks (e.g., checking keys of the
imported module or typeof checks) to ensure Logger and LogLevel exist and that
attempting to access LogEntry or LogSink yields undefined or is not a key, and
include clear test names like "exports only Logger and LogLevel" and "does not
export LogEntry or LogSink" so CI fails if those removed types reappear.
In `@apps/server/src/routes/agent-cli.ts`:
- Around line 88-90: In the catch block that currently computes message and
returns c.json({ success: false, agent: config.agent, error: message }, 500),
replace the direct exposure of error.message with a generic client-facing
message and add a structured ops log that records the full error and domain
metadata; specifically, log the caught error (the Error object) using the app's
ops logger (e.g., opsLogger.error or logger.error) with fields { domain:
"agent-cli", agent: config.agent, route: "check-status" } and include error
stack or serialized error, then return a 500 JSON with a non-sensitive message
like "Internal server error" (and optionally an error code) instead of the raw
message. Ensure you reference the same catch context (the variable error) and
the existing response usage of c.json and config.agent so the change is
localized to this catch block.
In `@apps/server/src/routes/claude-plugins.ts`:
- Around line 486-498: The cliLog.debug call in the claude execution block is
logging raw environment values (HOME, SHELL, TERM and all CLAUDE_* values) which
can leak secrets/PII; update the cliLog.debug invocation (the block that builds
command, binaryExists, HOME, SHELL, TERM, claudeEnvVars) to avoid raw values by
either (a) removing HOME and SHELL entirely and only emitting a boolean like
homeSet/shellSet, (b) for claudeEnvVars emit only the keys or map each value to
a masked placeholder (e.g., "[REDACTED]" or a short hash) instead of the real
value, or (c) implement a small maskEnvValue helper and apply it to each env
value; change the Object.fromEntries(Object.entries(env).filter(([k]) =>
k.startsWith("CLAUDE_"))) usage accordingly so logs contain no raw env values
but still useful diagnostics.
In `@apps/server/src/routes/logs.ts`:
- Around line 102-127: The handler currently casts metaStatus directly to
OpsLogStatus when building the opsLog.addEvent payload; instead validate
metaStatus against VALID_STATUSES (the same list used in the single-entry
endpoint) before using it. Update the status assignment in the opsLog.addEvent
call to use metaStatus only if typeof metaStatus === "string" &&
VALID_STATUSES.includes(metaStatus), otherwise fall back to defaultStatus;
reference the symbols metaStatus, VALID_STATUSES, opsLog.addEvent, and
defaultStatus so you can locate and change the status expression accordingly.
In `@apps/server/src/routes/terminal.ts`:
- Around line 44-51: The context object construction allows options.metadata to
overwrite the fixed domain value; update the assembly of context in the code
that creates the context object (the context literal where domain: "terminal",
action: options.action, status: ..., worktreeId: ..., projectName:
getProjectName(), ...options.metadata) so that domain cannot be
overridden—either spread ...options.metadata before the fixed fields or
explicitly remove/ignore metadata.domain (e.g., delete or omit metadata.domain)
before spreading; ensure the final context always contains domain: "terminal"
and reference the context creation site and the options.metadata spread to make
the change.
- Line 5: Replace the parent-relative import of log ("import { log } from
\"../logger\"") in terminal.ts with the project's configured logger alias used
elsewhere in the repo (use the same alias pattern as other app/lib imports, e.g.
the repo's configured "@/..." or "@app/..." logger alias) so the import complies
with the app/lib path policy; update the import statement for the symbol log in
apps/server/src/routes/terminal.ts and run lint to ensure it now passes the
import-boundary rule.
In `@apps/web-app/package.json`:
- Line 14: The workspace uses the "check:types" npm script (see script name
"check:types") relying on the tsgo binary, but tsgo isn't declared anywhere; add
"tsgo" to the root package.json devDependencies with a proper version (e.g., the
latest stable semver you use across the repo) so the CLI can be resolved in all
packages, then run the lockfile install to ensure it is available in CI and dev
shells; update the root package.json devDependencies to include "tsgo":
"<version>" and commit the change.
In `@docs/MCP.md`:
- Around line 29-37: The documentation currently lists registry files
(`~/.openkit/mcp-servers.json`, `.openkit/mcp-env.json`) and API endpoints
(`/api/mcp-servers/*`, `/api/mcp-env/*`) without clarifying that these are
reference locations; update the MCP Server Management section to add a concise
sentence stating these files are reference points only and must not be manually
edited, and instruct readers to manage MCP servers and plugins via OpenKit UI
and the MCP tooling/API (e.g., use the OpenKit UI, CLI and `/api/mcp-servers/*`
endpoints) to avoid conflicts with project guidance.
In `@libs/agents/README.md`:
- Around line 24-30: Update the "Deployed To" column in libs/agents/README.md to
clarify that deployment is via symlink rather than direct file writes: for
entries like `claude-skill.md` (currently showing
`~/.claude/skills/work/SKILL.md`) and others (`cursor-rule.md` ->
`.cursor/rules/OpenKit.mdc`, `vscode-prompt.md` ->
`.github/prompts/work.prompt.md`), change the wording to indicate these are
symlink targets created from agent-specific directories (e.g. symlinked from
`~/.openkit/skills/*` into the shown paths) and add a brief parenthetical note
such as “(deployed via symlink from agent skills dir)” to each affected row so
readers understand the actual deployment mechanism.
In `@libs/shared/src/task-context.ts`:
- Around line 324-327: writeTaskMd can throw when writing TASK.md; existing
silent catch blocks calling it must be replaced with proper logging. In the
catch blocks in apps/server/src/routes/notes.ts (all listed ranges) and
apps/server/src/manager.ts (around the noted lines) capture the thrown error and
call the project logger (the existing logger instance used in those files, e.g.,
serverLogger/processLogger) with an error/warn level, include { domain:
"task-md" }, the caught error, and actionable context (worktreePath and any
available IDs like source, issueId, worktreeId) so the log message reads like
"Failed to write TASK.md" plus the error and the context object; do this instead
of swallowing the exception. Ensure the error logging preserves stack/exception
details and does not change control flow beyond logging.
---
Outside diff comments:
In `@apps/server/src/routes/claude-plugins.ts`:
- Around line 466-577: The change to runClaude introduced new CLI logging
branches (start log plus success/warn/error on close and an error handler) but
no tests were added; create a co-located Vitest test file next to
claude-plugins.ts that covers four scenarios: (1) non-zero exit → verify
cliLog.error is called with status "failed" and exitCode present, (2) zero exit
with empty stdout → verify cliLog.warn called with status "success" but empty
stdout, (3) zero exit with non-empty stdout → verify cliLog.success called and
stdout is included, and (4) spawn error → simulate spawn emitting "error" and
verify cliLog.error is called; in tests, stub/spy/mock spawn/child process
behavior used by runClaude (and spy cliLog methods) so you can emit
stdout/stderr data, "close" with codes, and "error" events and assert the logged
payloads (check command.exitCode/durationMs/stdout/stderr and status fields)
using Vitest APIs and restore mocks after each test.
In `@apps/server/src/task-context.ts`:
- Around line 82-84: The silent catch in the local task loading code (inside the
function that reads/parses tasks in task-context.ts) should log the error and
file path before returning null: add an import for log from "./logger" at top
and update the catch block in the loader (the try/catch that currently does `}
catch { return null; }`) to call log.error or similar with a clear message
including the task file path/identifier (e.g., the variable holding the path
used to load the task) and the caught error, then return null as before.
- Around line 130-132: The empty catch in task-context.ts that currently
swallows parse errors should be replaced with a warn-level log that includes the
file path and source content plus the caught error for diagnosability: inside
the catch block, call the module's logger (e.g., logger or processLogger used
elsewhere in this file) to log a message like "Failed to parse file" including
the filePath and source variables and the caught error object; if parsing truly
cannot be tolerated in this context, re-throw the error instead of swallowing
it.
In `@libs/logger/browser/src/index.ts`:
- Around line 30-33: The empty catch in the WASM bootstrap swallows load
failures; change the catch to capture the error (e.g., catch (err)) and emit a
minimal developer-facing message using console.warn or console.error with
context (for example: "WASM logger failed to load, falling back to no-op
logger") and include the captured error object; update the catch block in
libs/logger/browser/src/index.ts where WASM loading occurs so the fallback to
no-op logger remains but the failure is logged for diagnostics.
---
Nitpick comments:
In `@apps/server/src/index.ts`:
- Around line 384-401: The Jira and Linear connection checks swallow exceptions
and return { ok: false } with no diagnostic output; update the two catch blocks
surrounding testJiraConnection(creds, configDir) and testLinearConnection(creds)
to log the caught error at debug level (e.g., using the existing logger or
processLogger) before returning { ok: false } so failures are recorded for
troubleshooting while keeping the API behavior unchanged.
- Around line 604-606: The silent catch around the server.json write should
capture the error and emit a debug-level log so failures are discoverable;
update the catch block in apps/server/src/index.ts to use catch (err) and log a
concise debug message like "Failed to write server.json" including the err
details using the existing logger (e.g. processLogger or logger) and fall back
to console.debug if no logger is available.
In `@apps/server/src/manager.ts`:
- Around line 472-482: Extract a module-level notification logger like the
existing portLog/worktreeLog/linearLog and reuse it inside emitNotification
instead of creating it on every call: add a top-level const notificationLog =
log.get("notification") (next to portLog/worktreeLog/linearLog) and then replace
the inline creation in emitNotification with that notificationLog; keep the same
context object construction (domain/action/projectName) and call
notificationLog.error(...) or notificationLog.info(...) as currently done.
In `@apps/server/tsup.config.ts`:
- Around line 16-27: The onSuccess handler's watch-mode spawn of the server
(spawn("node", ["dist/standalone.js"])) lacks error handling; attach listeners
to the returned child (server) for 'error' and 'exit' (or 'close') to log
startup failures and exit codes, and ensure any non-zero exit triggers a visible
message or process.exit if appropriate; update the onSuccess watch branch to add
server.on('error', ...) and server.on('exit'/'close', ...) alongside the
existing server.kill cleanup so startup failures are surfaced during
development.
In `@docs/superpowers/plans/2026-03-17-unified-logger.md`:
- Around line 115-127: The started() method intentionally uses console.log as a
fallback when native bindings are missing; add a brief inline comment above the
console.log call explaining that this is an explicit, deliberate exception to
the "no console.log" rule because the logger cannot rely on itself to report
logger initialization/fallback errors (see started(), normalizeContext(),
getBindings(), bindings.LoggerStarted and this.native usage), so future
maintainers understand why console.log is used here and that dispatch("info",
...) still handles normal logging.
In `@docs/superpowers/specs/2026-03-17-unified-logger-design.md`:
- Line 172: The phrase "level/status" in the document should be hyphenated or
reworded for clarity; replace occurrences of "level/status" with either
"level-status" or a clearer phrase like "log level and status mapping" (e.g.,
update the heading or sentence containing "Document level/status mapping with
comments on each method") so the intent reads smoothly and follows style
guidance.
In `@libs/agents/README.md`:
- Line 10: Update the README entry for the instruction templates to remove
ambiguity around the removed MCP server by either renaming the directory label
or adding a clarifying note: change the mention of `src/mcp/` to something like
`src/instructions/ (formerly src/mcp/)` or append a short sentence stating that
these are only instruction/skill templates and not an MCP server implementation;
ensure the README text references the directory name `src/mcp/` so future
contributors can locate it and understand the distinction.
In `@libs/shared/src/task-context.ts`:
- Around line 298-300: The silent catch blocks in getWorktreeGitExcludePath and
ensureGitExclude swallow errors and hide useful debugging info; replace those
empty catch blocks by rethrowing a descriptive error that includes the original
error (e.g., throw new Error(`getWorktreeGitExcludePath failed: ${err?.message
|| err}`) or rethrow err after augmenting its message) so callers can handle/log
failures, ensuring you reference these two helpers (getWorktreeGitExcludePath
and ensureGitExclude) when locating the catch sites to change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ed40aa9e-01a6-4f80-a870-da5e7c7ea71b
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (106)
AGENTS.mdCLAUDE.mdapps/cli/package.jsonapps/cli/project.jsonapps/cli/src/electron-entry.tsapps/cli/src/index.tsapps/cli/tsconfig.jsonapps/cli/tsup.config.tsapps/desktop-app/package.jsonapps/desktop-app/project.jsonapps/desktop-app/tsconfig.jsonapps/desktop-app/tsup.config.tsapps/mobile-app/package.jsonapps/mobile-app/project.jsonapps/server/package.jsonapps/server/project.jsonapps/server/src/commit-message.test.tsapps/server/src/feature-flags.test.tsapps/server/src/feature-flags.tsapps/server/src/git-policy.test.tsapps/server/src/index.tsapps/server/src/lib/builtin-instructions.tsapps/server/src/logger.tsapps/server/src/manager.tsapps/server/src/mcp-server-factory.tsapps/server/src/notes-manager.tsapps/server/src/ops-log.tsapps/server/src/routes/agent-cli.tsapps/server/src/routes/claude-plugins.tsapps/server/src/routes/config.tsapps/server/src/routes/logs.tsapps/server/src/routes/mcp-transport.tsapps/server/src/routes/mcp.tsapps/server/src/routes/tasks.tsapps/server/src/routes/terminal.tsapps/server/src/routes/worktrees.tsapps/server/src/task-context.tsapps/server/tsconfig.jsonapps/server/tsup.config.tsapps/web-app/package.jsonapps/web-app/project.jsonapps/web-app/src/components/IntegrationsPanel.tsxapps/web-app/src/components/ProjectSetupScreen.tsxapps/web-app/src/components/detail/DetailPanel.tsxapps/web-app/src/hooks/api.tsapps/web-app/src/hooks/useApi.tsapps/web-app/src/hooks/usePerformanceMetrics.test.tsapps/web-app/src/test/mocks/integrations.tsapps/web-app/src/test/server-bridge.tsapps/web-app/tsconfig.jsonapps/web-app/vite.config.tsapps/website/astro.config.tsapps/website/package.jsonapps/website/project.jsonapps/website/tsconfig.jsondocs/AGENTS.mddocs/API.mddocs/ARCHITECTURE.mddocs/CLI.mddocs/CONFIGURATION.mddocs/DEVELOPMENT.mddocs/MCP.mddocs/NOTIFICATIONS.mddocs/PROJECT_STRUCTURE.mddocs/superpowers/plans/2026-03-17-remove-openkit-mcp-server.mddocs/superpowers/plans/2026-03-17-unified-logger.mddocs/superpowers/specs/2026-03-17-unified-logger-design.mdlibs/agents/README.mdlibs/agents/package.jsonlibs/agents/project.jsonlibs/agents/src/actions.tslibs/agents/src/instructions.tslibs/agents/src/mcp.tslibs/agents/src/mcp/mcp-server.mdlibs/agents/src/mcp/mcp-work-on-task.mdlibs/agents/tsconfig.jsonlibs/integrations/package.jsonlibs/integrations/project.jsonlibs/integrations/tsconfig.jsonlibs/logger/browser/package.jsonlibs/logger/browser/src/index.tslibs/logger/browser/src/types.tslibs/logger/cgo/exports.golibs/logger/logger.golibs/logger/node/package.jsonlibs/logger/node/src/bindings.test.tslibs/logger/node/src/bindings.tslibs/logger/node/src/index.test.tslibs/logger/node/src/index.tslibs/logger/node/src/types.tslibs/logger/node/vitest.config.tslibs/logger/package.jsonlibs/logger/project.jsonlibs/logger/python/bindings.pylibs/logger/python/logger.pylibs/logger/ts_utils.tslibs/logger/wasm/main.golibs/logger/zig/logger.ziglibs/shared/package.jsonlibs/shared/project.jsonlibs/shared/src/commit-message.tslibs/shared/src/git-policy.tslibs/shared/src/notes-types.tslibs/shared/src/task-context.tsnx.jsonpackage.json
💤 Files with no reviewable changes (26)
- apps/cli/src/index.ts
- libs/logger/browser/src/types.ts
- libs/integrations/tsconfig.json
- libs/logger/node/src/types.ts
- apps/server/src/feature-flags.test.ts
- apps/server/src/routes/mcp.ts
- apps/server/src/feature-flags.ts
- docs/DEVELOPMENT.md
- apps/web-app/src/test/server-bridge.ts
- libs/logger/node/src/index.test.ts
- apps/web-app/src/test/mocks/integrations.ts
- libs/agents/src/instructions.ts
- apps/web-app/src/hooks/useApi.ts
- libs/agents/src/mcp.ts
- docs/PROJECT_STRUCTURE.md
- libs/agents/src/mcp/mcp-work-on-task.md
- apps/server/src/ops-log.ts
- apps/server/src/routes/mcp-transport.ts
- libs/agents/src/mcp/mcp-server.md
- apps/web-app/src/components/ProjectSetupScreen.tsx
- apps/cli/src/electron-entry.ts
- apps/server/src/mcp-server-factory.ts
- libs/logger/node/src/bindings.test.ts
- libs/agents/src/actions.ts
- libs/logger/node/vitest.config.ts
- apps/web-app/src/hooks/api.ts
| "exports": { | ||
| "./*": "./src/*.ts" | ||
| }, |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "package exports:"
jq '.exports' apps/server/package.json
echo
echo "Runtime-style imports of `@openkit/server` (non-type imports):"
rg -nP --glob '*.{ts,tsx,js,jsx,mjs,cjs}' '^\s*import\s+(?!type\b)[^;]*from\s+["'"'"']@openkit/server(?:/[^"'"'"']+)?["'"'"']'
echo
echo "CommonJS requires of `@openkit/server`:"
rg -nP --glob '*.{ts,tsx,js,jsx,mjs,cjs}' 'require\(\s*["'"'"']@openkit/server(?:/[^"'"'"']+)?["'"'"']\s*\)'Repository: fum4/openkit
Length of output: 862
🏁 Script executed:
# Check if server package has a build/compile step
cat apps/server/package.json
echo "---"
echo "Checking for tsconfig in server package:"
cat apps/server/tsconfig.json 2>/dev/null || echo "No tsconfig.json in apps/server"
echo "---"
echo "Checking root tsconfig or build config:"
ls -la | grep -E 'tsconfig|webpack|rollup|vite|esbuild|babel' || echo "No obvious build config files at root"
echo "---"
echo "Checking for dist directory in server:"
ls -la apps/server/dist 2>/dev/null || echo "No dist directory"
echo "---"
echo "Checking server package.json main/exports more comprehensively:"
jq '{main, module, types, exports}' apps/server/package.jsonRepository: fum4/openkit
Length of output: 2179
🏁 Script executed:
# Check if there's a tsup config file
ls -la apps/server/tsup.config.* 2>/dev/null || echo "No tsup.config file"
echo "---"
echo "Checking for build:release or prepare scripts:"
jq '.scripts | keys[]' apps/server/package.json | grep -E 'build|prepare|release' || echo "None found"
echo "---"
echo "Checking how consumers actually build/use the server package:"
echo "Looking for workspace references:"
rg -l '@openkit/server' --glob '*.json' | head -5
echo "---"
echo "Checking pnpm workspace or root package.json for build process:"
cat pnpm-workspace.yaml 2>/dev/null || echo "No pnpm-workspace.yaml"Repository: fum4/openkit
Length of output: 510
🏁 Script executed:
cat apps/server/tsup.config.tsRepository: fum4/openkit
Length of output: 1237
Fix exports to point to compiled runtime artifacts.
The exports currently point to .ts source files, but the build (tsup) only bundles standalone to dist/standalone.js. Runtime imports like @openkit/server/manager and @openkit/server/index will fail for external consumers—they need compiled .js outputs, not TypeScript source. Either update exports to "./dist/*.js" (after ensuring tsup outputs all modules, not just standalone), or point to pre-built artifacts if distributing as a package.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/server/package.json` around lines 6 - 8, The package exports currently
point to TypeScript sources ("./src/*.ts") which causes runtime import failures;
change the exports mapping in package.json to reference compiled JS artifacts
(e.g., "./dist/*.js" or explicit entries like "./manager": "./dist/manager.js"
and "./index": "./dist/index.js") and ensure your build (tsup) actually emits
those files (or adjust the build to produce the needed outputs such as
manager/index and standalone). Update the exports to match the actual dist
outputs so runtime imports like "@openkit/server/manager" and
"@openkit/server/index" resolve to .js files.
| export const log = new Logger("server"); | ||
|
|
||
| export { Logger, type LogEntry, type LogSink, type LogLevel } from "@openkit/logger/node"; | ||
| export { Logger, type LogLevel } from "@openkit/logger/node"; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify whether removed logger types are still imported anywhere.
rg -nP --type=ts -C2 'import\s+type\s*\{[^}]*\b(LogEntry|LogSink)\b[^}]*\}\s+from\s+["'\''][^"'\'']*logger[^"'\'']*["'\'']'Repository: fum4/openkit
Length of output: 38
🏁 Script executed:
#!/bin/bash
# Check what's in apps/server/src around logger.ts
ls -la apps/server/src/logger* 2>/dev/null || echo "No logger files found"
# Show the full content of logger.ts to understand the change
echo "=== Content of logger.ts ==="
cat -n apps/server/src/logger.ts 2>/dev/null || echo "File not found"Repository: fum4/openkit
Length of output: 345
🏁 Script executed:
#!/bin/bash
# Search for any imports of LogEntry or LogSink in the server app specifically
echo "=== Searching for LogEntry/LogSink usage in server app ==="
rg -nP --type=ts 'LogEntry|LogSink' apps/server/ 2>/dev/null || echo "No matches found"Repository: fum4/openkit
Length of output: 131
🏁 Script executed:
#!/bin/bash
# Check git history to see what the line was before this change
echo "=== Check recent changes to logger.ts ==="
cd apps/server && git log --oneline -5 -- src/logger.ts 2>/dev/null || echo "No git history available"
cd - > /dev/null
# Show git diff for this specific file if available
echo "=== Checking git diff ==="
git diff HEAD -- apps/server/src/logger.ts 2>/dev/null || echo "No uncommitted changes"Repository: fum4/openkit
Length of output: 150
🏁 Script executed:
#!/bin/bash
# Check if there's a test file for logger.ts
echo "=== Checking for logger test files ==="
find apps/server/src -name "logger*.test.*" -o -name "logger*.spec.*"
echo "---"
ls -la apps/server/src/ | grep -i test || echo "No test files in logger directory"
# Check if there are any vitest config or test setup files
echo "=== Vitest configuration in server app ==="
find apps/server -name "vitest.config.*" -o -name "vite.config.*" | head -5Repository: fum4/openkit
Length of output: 1153
🏁 Script executed:
#!/bin/bash
# Try to understand the actual change - check parent commit if possible
echo "=== Checking git log for more context ==="
git show HEAD:apps/server/src/logger.ts 2>/dev/null || echo "Cannot show HEAD version"
echo "---"
echo "=== Checking if there's a staged/uncommitted version ==="
git status apps/server/src/logger.ts 2>/dev/nullRepository: fum4/openkit
Length of output: 376
🏁 Script executed:
#!/bin/bash
# Check git history more thoroughly to see if LogEntry/LogSink were ever exported
echo "=== Git log showing all changes to logger.ts ==="
git log --oneline --all -- apps/server/src/logger.ts
echo ""
echo "=== Show file at each commit to see progression ==="
git log --oneline --all -- apps/server/src/logger.ts | head -5 | while read commit _; do
echo "--- Commit: $commit ---"
git show "$commit:apps/server/src/logger.ts" 2>/dev/null || echo "File did not exist in this commit"
doneRepository: fum4/openkit
Length of output: 936
🏁 Script executed:
#!/bin/bash
# Check if there's mention of LogEntry or LogSink in `@openkit/logger` package
echo "=== Checking what's exported from `@openkit/logger/node` ==="
find . -path "*/node_modules" -prune -o -name "*.ts" -type f -print | xargs grep -l "export.*LogEntry\|export.*LogSink" 2>/dev/null | head -10Repository: fum4/openkit
Length of output: 114
Add test coverage for logger module export surface.
This commit removed LogEntry and LogSink from the re-exported types (line 5). Per coding guidelines, every code change must include corresponding tests. Create apps/server/src/logger.test.ts with a Vitest test that locks the module's export surface—specifically asserting that Logger and LogLevel are exported and that removed types are no longer exposed. This prevents accidental re-introduction of stale types.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/server/src/logger.ts` at line 5, Add a Vitest unit test file named
logger.test.ts that locks the module export surface for
apps/server/src/logger.ts by importing the module and asserting that Logger and
LogLevel are present exports and that LogEntry and LogSink are not exported; use
named-import checks (e.g., checking keys of the imported module or typeof
checks) to ensure Logger and LogLevel exist and that attempting to access
LogEntry or LogSink yields undefined or is not a key, and include clear test
names like "exports only Logger and LogLevel" and "does not export LogEntry or
LogSink" so CI fails if those removed types reappear.
| } catch (error) { | ||
| const message = error instanceof Error ? error.message : "Failed to check CLI status"; | ||
| return c.json({ success: false, agent: config.agent, error: message }, 500); |
There was a problem hiding this comment.
Add structured error logging in this catch path and avoid exposing raw internal errors.
This catch currently returns a 500 response but does not emit an ops log, which makes production diagnosis hard. Also, returning raw error.message can leak internals.
Suggested patch for the catch block
} catch (error) {
- const message = error instanceof Error ? error.message : "Failed to check CLI status";
- return c.json({ success: false, agent: config.agent, error: message }, 500);
+ const message = error instanceof Error ? error.message : "Failed to check CLI status";
+ log.error("Agent CLI status check failed", {
+ domain: "agent-cli",
+ agent: config.agent,
+ command: config.command,
+ error: message,
+ });
+ return c.json(
+ { success: false, agent: config.agent, error: "Failed to check CLI status" },
+ 500,
+ );
}As per coding guidelines, “Every catch block... must do something meaningful: log through the appropriate logger” and logs must include a domain field with actionable metadata.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/server/src/routes/agent-cli.ts` around lines 88 - 90, In the catch block
that currently computes message and returns c.json({ success: false, agent:
config.agent, error: message }, 500), replace the direct exposure of
error.message with a generic client-facing message and add a structured ops log
that records the full error and domain metadata; specifically, log the caught
error (the Error object) using the app's ops logger (e.g., opsLogger.error or
logger.error) with fields { domain: "agent-cli", agent: config.agent, route:
"check-status" } and include error stack or serialized error, then return a 500
JSON with a non-sensitive message like "Internal server error" (and optionally
an error code) instead of the raw message. Ensure you reference the same catch
context (the variable error) and the existing response usage of c.json and
config.agent so the change is localized to this catch block.
| cliLog.debug(`Starting: claude ${args.join(" ")}`, { | ||
| domain: "claude-cli", | ||
| action: "cli.exec", | ||
| message: `Starting: claude ${args.join(" ")}`, | ||
| level: "debug", | ||
| status: "started", | ||
| command: { command: resolvedPath, args, cwd }, | ||
| metadata: { | ||
| binaryExists, | ||
| HOME: env.HOME, | ||
| SHELL: env.SHELL, | ||
| TERM: env.TERM, | ||
| claudeEnvVars: Object.fromEntries( | ||
| Object.entries(env).filter(([k]) => k.startsWith("CLAUDE_")), | ||
| ), | ||
| }, | ||
| binaryExists, | ||
| HOME: env.HOME, | ||
| SHELL: env.SHELL, | ||
| TERM: env.TERM, | ||
| claudeEnvVars: Object.fromEntries( | ||
| Object.entries(env).filter(([k]) => k.startsWith("CLAUDE_")), | ||
| ), | ||
| }); |
There was a problem hiding this comment.
Avoid logging raw environment values (possible secret/PII leakage)
Line 492–497 logs raw HOME, SHELL, and all CLAUDE_* env values. That can expose tokens, secrets, and user-identifying paths in server logs.
Suggested hardening diff
- cliLog.debug(`Starting: claude ${args.join(" ")}`, {
+ cliLog.debug(`Starting: claude ${args.join(" ")}`, {
domain: "claude-cli",
action: "cli.exec",
status: "started",
command: { command: resolvedPath, args, cwd },
binaryExists,
- HOME: env.HOME,
- SHELL: env.SHELL,
- TERM: env.TERM,
- claudeEnvVars: Object.fromEntries(
- Object.entries(env).filter(([k]) => k.startsWith("CLAUDE_")),
- ),
+ hasHome: Boolean(env.HOME),
+ hasShell: Boolean(env.SHELL),
+ TERM: env.TERM,
+ claudeEnvVarKeys: Object.keys(env).filter((k) => k.startsWith("CLAUDE_")),
});🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/server/src/routes/claude-plugins.ts` around lines 486 - 498, The
cliLog.debug call in the claude execution block is logging raw environment
values (HOME, SHELL, TERM and all CLAUDE_* values) which can leak secrets/PII;
update the cliLog.debug invocation (the block that builds command, binaryExists,
HOME, SHELL, TERM, claudeEnvVars) to avoid raw values by either (a) removing
HOME and SHELL entirely and only emitting a boolean like homeSet/shellSet, (b)
for claudeEnvVars emit only the keys or map each value to a masked placeholder
(e.g., "[REDACTED]" or a short hash) instead of the real value, or (c) implement
a small maskEnvValue helper and apply it to each env value; change the
Object.fromEntries(Object.entries(env).filter(([k]) => k.startsWith("CLAUDE_")))
usage accordingly so logs contain no raw env values but still useful
diagnostics.
| // Extract well-known keys from metadata into top-level ops-log fields. | ||
| // Everything else stays in the metadata bag. | ||
| const { | ||
| action: metaAction, | ||
| status: metaStatus, | ||
| worktreeId: metaWorktreeId, | ||
| projectName: metaProjectName, | ||
| runId: metaRunId, | ||
| ...rest | ||
| } = entry.metadata ?? {}; | ||
|
|
||
| const cleanMetadata: Record<string, unknown> = { ...rest }; | ||
| if (entry.domain) cleanMetadata.domain = entry.domain; | ||
|
|
||
| const defaultStatus = entry.level === "error" ? "failed" : "info"; | ||
|
|
||
| opsLog.addEvent({ | ||
| source: entry.subsystem ? `${entry.system}.${entry.subsystem}` : entry.system, | ||
| action: "log", | ||
| action: typeof metaAction === "string" ? metaAction : "log", | ||
| message: entry.message, | ||
| level: entry.level === "warn" ? "warning" : (entry.level as OpsLogLevel), | ||
| status: entry.level === "error" ? "failed" : "info", | ||
| projectName, | ||
| metadata: Object.keys(metadata).length > 0 ? metadata : undefined, | ||
| status: typeof metaStatus === "string" ? (metaStatus as OpsLogStatus) : defaultStatus, | ||
| worktreeId: typeof metaWorktreeId === "string" ? metaWorktreeId : undefined, | ||
| projectName: typeof metaProjectName === "string" ? metaProjectName : projectName, | ||
| runId: typeof metaRunId === "string" ? metaRunId : undefined, | ||
| metadata: Object.keys(cleanMetadata).length > 0 ? cleanMetadata : undefined, |
There was a problem hiding this comment.
Consider validating metaStatus against VALID_STATUSES.
The extracted metaStatus is cast directly to OpsLogStatus (line 123) without validation, unlike the single-entry endpoint (line 49) which validates against VALID_STATUSES. An invalid status string from client metadata could bypass validation.
🛡️ Proposed fix
- status: typeof metaStatus === "string" ? (metaStatus as OpsLogStatus) : defaultStatus,
+ status:
+ typeof metaStatus === "string" && VALID_STATUSES.has(metaStatus as OpsLogStatus)
+ ? (metaStatus as OpsLogStatus)
+ : defaultStatus,🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/server/src/routes/logs.ts` around lines 102 - 127, The handler currently
casts metaStatus directly to OpsLogStatus when building the opsLog.addEvent
payload; instead validate metaStatus against VALID_STATUSES (the same list used
in the single-entry endpoint) before using it. Update the status assignment in
the opsLog.addEvent call to use metaStatus only if typeof metaStatus ===
"string" && VALID_STATUSES.includes(metaStatus), otherwise fall back to
defaultStatus; reference the symbols metaStatus, VALID_STATUSES,
opsLog.addEvent, and defaultStatus so you can locate and change the status
expression accordingly.
| const context = { | ||
| domain: "terminal", | ||
| action: options.action, | ||
| message: options.message, | ||
| level: options.level ?? (options.status === "failed" ? "error" : "info"), | ||
| status: options.status ?? "info", | ||
| worktreeId: options.worktreeId, | ||
| projectName: getProjectName(), | ||
| metadata: options.metadata, | ||
| }); | ||
| ...options.metadata, | ||
| }; |
There was a problem hiding this comment.
Prevent metadata from overriding the fixed domain field.
Line 50 spreads options.metadata after domain, so a metadata.domain value can silently reclassify terminal logs.
Suggested fix
- const context = {
- domain: "terminal",
- action: options.action,
- status: options.status ?? "info",
- worktreeId: options.worktreeId,
- projectName: getProjectName(),
- ...options.metadata,
- };
+ const context = {
+ ...options.metadata,
+ action: options.action,
+ status: options.status ?? "info",
+ worktreeId: options.worktreeId,
+ projectName: getProjectName(),
+ domain: "terminal",
+ };As per coding guidelines: "Always include a domain field in the metadata object to namespace logs by feature area."
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const context = { | |
| domain: "terminal", | |
| action: options.action, | |
| message: options.message, | |
| level: options.level ?? (options.status === "failed" ? "error" : "info"), | |
| status: options.status ?? "info", | |
| worktreeId: options.worktreeId, | |
| projectName: getProjectName(), | |
| metadata: options.metadata, | |
| }); | |
| ...options.metadata, | |
| }; | |
| const context = { | |
| ...options.metadata, | |
| action: options.action, | |
| status: options.status ?? "info", | |
| worktreeId: options.worktreeId, | |
| projectName: getProjectName(), | |
| domain: "terminal", | |
| }; |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/server/src/routes/terminal.ts` around lines 44 - 51, The context object
construction allows options.metadata to overwrite the fixed domain value; update
the assembly of context in the code that creates the context object (the context
literal where domain: "terminal", action: options.action, status: ...,
worktreeId: ..., projectName: getProjectName(), ...options.metadata) so that
domain cannot be overridden—either spread ...options.metadata before the fixed
fields or explicitly remove/ignore metadata.domain (e.g., delete or omit
metadata.domain) before spreading; ensure the final context always contains
domain: "terminal" and reference the context creation site and the
options.metadata spread to make the change.
| "test:watch": "vitest", | ||
| "test:coverage": "vitest run --coverage" | ||
| "test:coverage": "vitest run --coverage", | ||
| "check:types": "tsgo --noEmit -p tsconfig.json", |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Scripts using tsgo:"
fd package.json -X rg -n '"check:types"\s*:\s*"tsgo'
echo
echo "Where tsgo is declared as a dependency/devDependency:"
fd package.json -X rg -n '"tsgo"\s*:'Repository: fum4/openkit
Length of output: 983
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Check root package.json for tsgo
echo "=== Root package.json dependencies ==="
if [ -f package.json ]; then
rg -A 20 '"devDependencies"' package.json | head -30
fi
# Check pnpm-lock.yaml for tsgo references
echo
echo "=== tsgo in pnpm-lock.yaml ==="
if [ -f pnpm-lock.yaml ]; then
rg "tsgo" pnpm-lock.yaml | head -5
else
echo "pnpm-lock.yaml not found"
fi
# Check if there's a root node_modules or similar
echo
echo "=== Check workspace structure ==="
ls -la | head -20Repository: fum4/openkit
Length of output: 1958
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Check for pnpm workspace configuration
echo "=== pnpm-workspace.yaml ==="
if [ -f pnpm-workspace.yaml ]; then
cat pnpm-workspace.yaml
else
echo "File not found"
fi
# Double-check all package.json files for tsgo declarations (not just scripts)
echo
echo "=== All tsgo references across package.json files (full context) ==="
fd package.json -x bash -c 'echo "--- {} ---"; cat {} | rg -C 2 tsgo' 2>/dev/null || trueRepository: fum4/openkit
Length of output: 2552
Add tsgo to root devDependencies.
tsgo is used in 10 packages across the workspace (apps/cli, apps/desktop-app, apps/mobile-app, apps/web-app, apps/server, libs/agents, libs/integrations, libs/logger/browser, libs/logger/node, libs/shared) but is not declared in any package.json. This will cause pnpm check:types to fail in CI and dev shells.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/web-app/package.json` at line 14, The workspace uses the "check:types"
npm script (see script name "check:types") relying on the tsgo binary, but tsgo
isn't declared anywhere; add "tsgo" to the root package.json devDependencies
with a proper version (e.g., the latest stable semver you use across the repo)
so the CLI can be resolved in all packages, then run the lockfile install to
ensure it is available in CI and dev shells; update the root package.json
devDependencies to include "tsgo": "<version>" and commit the change.
| For documentation on: | ||
|
|
||
| If no running server is found, the CLI starts an **in-process** MCP server with its own `WorktreeManager`, `NotesManager`, and `HooksManager`. It communicates directly over stdio without any HTTP intermediary. | ||
| - **MCP server registry** (`~/.openkit/mcp-servers.json`) | ||
| - **Per-project environment variable overrides** (`.openkit/mcp-env.json`) | ||
| - **Deployment to agents** (Claude Code, Cursor, Gemini CLI, VS Code, Codex) | ||
| - **Scanning and discovery** | ||
| - **API endpoints** (`/api/mcp-servers/*`, `/api/mcp-env/*`) | ||
|
|
||
| This mode is useful when you want MCP tools without running the full web UI -- for example, in a CI environment or a headless agent session. | ||
|
|
||
| **Trade-off:** Standalone mode cannot share state with the web UI. If you start the UI later, it will have its own separate manager instance. | ||
|
|
||
| ## HTTP Transport | ||
|
|
||
| For MCP clients that support HTTP-based transport directly (without stdio), OpenKit exposes a streamable HTTP endpoint: | ||
|
|
||
| - **Endpoint:** `POST /mcp` (GET and DELETE return 405 — SSE and session management are not needed) | ||
| - **Transport:** `WebStandardStreamableHTTPServerTransport` from the MCP SDK, created per request (stateless mode) | ||
| - **Session management:** Stateless (no session tracking). OpenKit is a single-user local dev tool, so session multiplexing is unnecessary. | ||
| - **Response format:** JSON responses enabled (`enableJsonResponse: true`) | ||
|
|
||
| This endpoint is registered automatically when the OpenKit HTTP server starts. Proxy mode uses this endpoint internally. | ||
|
|
||
| ## Complete Tool Reference | ||
|
|
||
| All tools are defined in `libs/agents/src/actions.ts` and registered on the MCP server via `apps/server/src/mcp-server-factory.ts`. Every tool returns JSON content. | ||
|
|
||
| ### Issue Browsing | ||
|
|
||
| | Tool | Description | Parameters | | ||
| | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | | ||
| | `list_jira_issues` | List your assigned Jira issues (unresolved). Optionally search by text. | `query` (string, optional) -- text search to filter issues | | ||
| | `get_jira_issue` | Get full details of a Jira issue including description and comments. Checks locally cached data first, only fetches from Jira API if not found locally. | `issueKey` (string, **required**) -- e.g. `PROJ-123` or just `123` if default project is configured | | ||
| | `list_linear_issues` | List your assigned Linear issues (open/in progress). Optionally search by text. | `query` (string, optional) -- text search to filter issues | | ||
| | `get_linear_issue` | Get full details of a Linear issue including description. Checks locally cached data first, only fetches from Linear API if not found locally. | `identifier` (string, **required**) -- e.g. `ENG-123` or just `123` if default team is configured | | ||
|
|
||
| ### Worktree Management | ||
|
|
||
| | Tool | Description | Parameters | | ||
| | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | | ||
| | `list_worktrees` | List all worktrees with their status, branch, ports, and git/PR info. | _(none)_ | | ||
| | `create_worktree` | Create a new git worktree from a branch name. Use `create_from_jira` or `create_from_linear` instead when the user provides an issue key. | `branch` (string, **required**) -- git branch name; `name` (string, optional) -- directory name | | ||
| | `create_from_jira` | Create a worktree from a Jira issue key. Fetches the issue, saves task data locally, creates worktree with issue key as branch name. | `issueKey` (string, **required**) -- e.g. `PROJ-123` or `123` | | ||
| | `create_from_linear` | Create a worktree from a Linear issue identifier. Fetches the issue, saves task data locally, creates worktree with identifier as branch name. | `identifier` (string, **required**) -- e.g. `ENG-123` or `123` | | ||
| | `start_worktree` | Start the dev server in a worktree (allocates port offset, spawns process). | `id` (string, **required**) -- worktree ID | | ||
| | `stop_worktree` | Stop the running dev server in a worktree. | `id` (string, **required**) -- worktree ID | | ||
| | `remove_worktree` | Remove a worktree (stops it first if running, then deletes directory and git worktree reference). | `id` (string, **required**) -- worktree ID | | ||
| | `get_logs` | Get recent output logs from a running worktree (up to 100 lines). | `id` (string, **required**) -- worktree ID | | ||
|
|
||
| ### Git Operations | ||
|
|
||
| All git operations are subject to the agent git policy. Call `get_git_policy` first to check whether an operation is allowed. | ||
|
|
||
| | Tool | Description | Parameters | | ||
| | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- | | ||
| | `commit` | Stage all changes and commit in a worktree. Requires GitHub integration. Commit message may be auto-formatted by project-configured rules. | `id` (string, **required**) -- worktree ID; `message` (string, **required**) -- commit message | | ||
| | `push` | Push commits in a worktree to the remote. Requires GitHub integration. | `id` (string, **required**) -- worktree ID | | ||
| | `create_pr` | Create a GitHub pull request for a worktree branch. Requires GitHub integration. Follows push policy. | `id` (string, **required**) -- worktree ID; `title` (string, **required**) -- PR title; `body` (string, optional) -- PR description | | ||
| | `get_git_policy` | Check whether agent git operations (commit, push, create_pr) are allowed for a worktree. | `id` (string, **required**) -- worktree ID | | ||
|
|
||
| ### Task Context & Notes | ||
|
|
||
| | Tool | Description | Parameters | | ||
| | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | `get_task_context` | Get full task context for a worktree: issue details, description, comments, AI context directions, todo checklist, and worktree path. Also regenerates `TASK.md`. | `worktreeId` (string, **required**) | | ||
| | `read_issue_notes` | Read AI context notes for a worktree or issue. Returns directions and todo checklist. | `worktreeId` (string, optional); `source` (string, optional) -- `"jira"`, `"linear"`, or `"local"`; `issueId` (string, optional). Provide either `worktreeId` or both `source` and `issueId`. | | ||
| | `update_todo` | Add, toggle, or delete a todo checklist item on an issue. The user monitors progress through these checkboxes in real-time. | `source` (string, **required**) -- `"jira"`, `"linear"`, or `"local"`; `issueId` (string, **required**); `action` (string, **required**) -- `"add"`, `"toggle"`, or `"delete"`; `todoId` (string, optional) -- required for toggle/delete; `text` (string, optional) -- required for add | | ||
|
|
||
| ### Activity Feed | ||
|
|
||
| | Tool | Description | Parameters | | ||
| | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ||
| | `notify` | Send a free-form status update to the openkit activity feed. Use to keep the user informed about progress on long-running tasks. Other tool calls are tracked automatically. | `message` (string, **required**) -- status message; `severity` (string, optional) -- `"info"` (default), `"warning"`, or `"error"`; `worktreeId` (string, optional) -- related worktree ID; `requiresUserAction` (boolean, optional) -- mark when user input is required | | ||
|
|
||
| ### Configuration | ||
|
|
||
| | Tool | Description | Parameters | | ||
| | ------------ | ------------------------------------------------------- | ---------- | | ||
| | `get_config` | Get the current OpenKit configuration and project name. | _(none)_ | | ||
|
|
||
| ### Hooks | ||
|
|
||
| | Tool | Description | Parameters | | ||
| | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | `get_hooks_config` | Get the hooks configuration, including command steps and skill references organized by trigger type. | _(none)_ | | ||
| | `run_hooks` | Run hook command steps for a worktree. Steps matching the trigger type run in parallel. | `worktreeId` (string, **required**); `trigger` (string, optional) -- `"pre-implementation"`, `"post-implementation"` (default), `"custom"`, `"on-demand"`, `"worktree-created"`, or `"worktree-removed"` | | ||
| | `report_hook_status` | Report a skill hook status. Call TWICE: once BEFORE invoking a skill (without `success`/`summary`) to show a loading state in the UI, and once AFTER with the result. | `worktreeId` (string, **required**); `skillName` (string, **required**); `trigger` (string, optional) -- hook trigger phase; `success` (boolean, optional -- omit for start); `summary` (string, optional -- omit for start); `content` (string, optional) -- detailed markdown; `filePath` (string, optional) -- absolute path to an MD report file | | ||
| | `get_hooks_status` | Get the current/last hook run status for a worktree, including step results. | `worktreeId` (string, **required**) | | ||
|
|
||
| ## MCP Prompt: `work-on-task` | ||
|
|
||
| In addition to tools, the MCP server registers a **prompt** called `work-on-task`. Agents that support MCP prompts can invoke it with an `issueId` parameter. It returns a structured message that guides the agent through the full workflow: | ||
|
|
||
| 1. Determine the issue type and call the appropriate creation tool (`create_from_jira` or `create_from_linear`) | ||
| 2. Poll `list_worktrees` until the worktree status is `stopped` (creation complete) | ||
| 3. Navigate to the worktree directory | ||
| 4. Call `get_hooks_config` to discover hooks — run pre-implementation command hooks with `run_hooks` (`trigger: "pre-implementation"`) before starting work | ||
| 5. Read `TASK.md` for full context | ||
| 6. Start implementing the task | ||
| 7. After completing all work and post-implementation hooks, ask the user if they'd like to start the worktree dev server automatically | ||
|
|
||
| ## MCP Instructions | ||
|
|
||
| The MCP server sends an instructions prompt to connected agents. This prompt teaches agents the "work-on-task" workflow and how to use the tools correctly. Here is the full text: | ||
|
|
||
| ``` | ||
| OpenKit manages git worktrees with automatic port offsetting. | ||
|
|
||
| IMPORTANT: When a user mentions an issue key, ticket number, or says "work on <something>", | ||
| you should immediately use the appropriate OpenKit MCP tool to create a worktree. | ||
| Do NOT read .openkit/ files or make HTTP requests to the OpenKit server. All communication goes through these MCP tools. | ||
|
|
||
| ## Quick Start | ||
| - Issue key like "PROJ-123" or number like "456" -> call create_from_jira with issueKey param | ||
| - Linear identifier like "ENG-42" or "NOM-10" -> call create_from_linear with identifier param | ||
| - Branch name -> call create_worktree directly with branch param | ||
| - "show my issues" -> call list_jira_issues or list_linear_issues | ||
|
|
||
| ## After Creating a Worktree | ||
| 1. Poll list_worktrees until status is 'stopped' (creation done) | ||
| 2. Navigate to the worktree path returned in the response | ||
| 3. Call get_hooks_config to discover all configured hooks (pre-implementation, post-implementation, custom, on-demand, plus lifecycle triggers) | ||
| 4. Run any pre-implementation hooks BEFORE starting work (see Hooks section below) | ||
| 5. Read TASK.md for full context (includes issue details, AI directions, and a todo checklist) | ||
| 6. Work through the todo items in order -- toggle each one as you complete it using update_todo | ||
| 7. Follow any directions in the AI Context section | ||
|
|
||
| ## While Working in a Worktree | ||
| - get_task_context -- refresh full task details, AI context, and todo checklist | ||
| - update_todo -- IMPORTANT: mark todo items as done (toggle) as you complete them. The user tracks your progress through these checkboxes in real-time. | ||
| - start_worktree -- launch the dev server | ||
| - commit, push, create_pr -- git operations | ||
|
|
||
| ## Issue Data | ||
| - get_jira_issue and get_linear_issue check locally cached data first. They only fetch from the remote API if no local data is found. | ||
| - Prefer these tools over reading .openkit/ files directly. | ||
|
|
||
| ## Todo Workflow | ||
| Todos are a checklist of sub-tasks defined by the user. They appear in TASK.md and in get_task_context output. | ||
| 1. Before starting work, read the todos to understand what needs to be done | ||
| 2. As you complete each item, call update_todo with action="toggle" to check it off | ||
| 3. The user sees checkbox state update in real-time in the UI | ||
| 4. You can also add new todos with action="add" if you discover additional sub-tasks | ||
|
|
||
| ## Git Policy | ||
| The project owner can restrict agent git operations. Before calling commit, push, or create_pr: | ||
| 1. Call get_git_policy with the worktree ID to check if the operation is allowed | ||
| 2. If not allowed, inform the user and suggest they enable it in Settings or per-worktree | ||
| 3. When committing, the commit message may be automatically formatted by a project-configured rule | ||
|
|
||
| ## Hooks | ||
| Hooks run at different points in the workflow. Call get_hooks_config EARLY (right after worktree creation) to discover all configured hooks. | ||
|
|
||
| There are six trigger types: | ||
| - **pre-implementation**: Run BEFORE you start coding. These set up context, run scaffolding, or enforce prerequisites. | ||
| - **post-implementation**: Run AFTER you finish implementing. These validate changes (type checks, linting, tests, code review). | ||
| - **custom**: Run when a natural-language condition is met (e.g. "when changes touch database models"). Check conditions as you work and run matching hooks when appropriate. | ||
| - **on-demand**: Only run when explicitly requested by the user. Do not run these automatically. | ||
| - **worktree-created**: Runs automatically after worktree creation via CLI-backed flows. | ||
| - **worktree-removed**: Runs automatically after worktree removal via CLI-backed flows. | ||
|
|
||
| Lifecycle create/remove flows automatically execute command steps. Prompt and skill hooks for these triggers are still discovered via `get_hooks_config` and can be reported through `report_hook_status` when agents run them. | ||
|
|
||
| ### Workflow | ||
| 1. Call get_hooks_config immediately after entering a worktree to see all hooks | ||
| 2. Before running any hook, skill, or command -- inform the user what you are about to run and why | ||
| 3. After running -- summarize results AND report them via report_hook_status (call twice: once before invoking without success/summary to show loading, once after with the result; pass `trigger` whenever possible) | ||
| 4. Run pre-implementation command hooks with `run_hooks` (`trigger: "pre-implementation"`) before starting work | ||
| 5. While working, check custom hook conditions -- if your changes match a condition, run those hooks | ||
| 6. After completing work, run post-implementation hooks | ||
| 7. Call get_hooks_status to verify all steps passed | ||
| 8. After all work and hooks are done, ask the user if they'd like to start the worktree dev server automatically (via start_worktree) | ||
|
|
||
| ## Skill Report Files | ||
| For skills that produce detailed output (e.g. code review, changes summary, test instructions, explanations), write the full report to a markdown file in the issue folder and pass the absolute path via the filePath parameter in report_hook_status. The user can then open and preview the report from the UI. | ||
| - File naming: {issueDir}/skill-{skillName}.md (e.g. skill-code-review.md) — issueDir is returned by get_task_context | ||
| - The summary field should be a short one-liner; the file contains the full report | ||
| - The content field can be omitted when filePath is provided | ||
|
|
||
| ## Activity Feed | ||
| Use the notify tool to keep the user informed about progress on long-running tasks. | ||
| The activity feed shows real-time updates in the UI. | ||
| - Call notify with a short message describing what you're doing or what just happened | ||
| - Use severity to indicate the nature: info (default), warning, or error | ||
| - Include worktreeId when the update relates to a specific worktree | ||
| - Set `requiresUserAction: true` when you need user input to proceed | ||
| - Don't over-notify — one update per meaningful progress milestone is enough | ||
| - Other tool calls (commit, push, create_pr, run_hooks, report_hook_status) are automatically tracked | ||
|
|
||
| ## Skill-Specific Guidelines | ||
| - Code review: thorough investigation — read actual code, trace logic, check for bugs, edge cases, security | ||
| - Changes summary: technical, well-structured, bullet points grouped by area | ||
| - Test writing: check if a testing framework exists first; if not, ask the user about integrating one | ||
| - Explain like I'm 5: simple language, analogies, accessible to non-technical readers | ||
| ``` | ||
|
|
||
| ## Setup | ||
|
|
||
| ### As a Claude Code MCP Server | ||
|
|
||
| Add to your `.mcp.json` (project-level) or `~/.claude/claude_desktop_config.json` (global): | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "OpenKit": { | ||
| "command": "openkit", | ||
| "args": ["mcp"] | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| When configured this way, `openkit mcp` runs as a stdio-based MCP server. It will automatically detect whether a OpenKit HTTP server is running and choose proxy or standalone mode accordingly. | ||
|
|
||
| ### As HTTP Transport | ||
|
|
||
| For MCP clients that support direct HTTP connections (no stdio wrapper needed): | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "OpenKit": { | ||
| "url": "http://localhost:6969/mcp" | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Replace `6969` with your configured `serverPort` if different. This requires the OpenKit HTTP server to be running (`OpenKit` or `openkit connect`). | ||
|
|
||
| ### Verifying the Connection | ||
|
|
||
| Once configured, the agent should have access to all OpenKit tools. You can verify by asking the agent to call `list_worktrees` or `get_config`. If the connection is working, it will return your project configuration and any existing worktrees. | ||
| See [MCP Server Management](./AGENTS.md#mcp-server-management) and the [API Reference](./API.md#mcp-servers-registry) sections. |
There was a problem hiding this comment.
Clarify that registry/env locations are reference points, not manual-edit instructions.
This section lists file paths, but should explicitly remind users to manage MCP servers via OpenKit UI/API tooling to avoid conflicting with project guidance.
Suggested doc tweak
For documentation on:
@@
- **API endpoints** (`/api/mcp-servers/*`, `/api/mcp-env/*`)
+Note: Prefer managing MCP server configuration through OpenKit UI/tools and API flows rather than editing these files directly.
+
See [MCP Server Management](./AGENTS.md#mcp-server-management) and the [API Reference](./API.md#mcp-servers-registry) sections.Based on learnings: "Plugins and servers must be installed and configured through OpenKit's UI and MCP tools, not manual file editing."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/MCP.md` around lines 29 - 37, The documentation currently lists registry
files (`~/.openkit/mcp-servers.json`, `.openkit/mcp-env.json`) and API endpoints
(`/api/mcp-servers/*`, `/api/mcp-env/*`) without clarifying that these are
reference locations; update the MCP Server Management section to add a concise
sentence stating these files are reference points only and must not be manually
edited, and instruct readers to manage MCP servers and plugins via OpenKit UI
and the MCP tooling/API (e.g., use the OpenKit UI, CLI and `/api/mcp-servers/*`
endpoints) to avoid conflicts with project guidance.
| | File | Export | Deployed To | Purpose | | ||
| | ------------------ | --------------- | -------------------------------- | ----------------------------------------------------------------------------------- | | ||
| | `instructions.md` | _(internal)_ | -- | CLI-first workflow steps, interpolated into claude/cursor/vscode via `{{WORKFLOW}}` | | ||
| | `claude-skill.md` | `CLAUDE_SKILL` | `~/.claude/skills/work/SKILL.md` | Claude Code work skill (CLI-first, injected `{{WORKFLOW}}`) | | ||
| | `cursor-rule.md` | `CURSOR_RULE` | `.cursor/rules/OpenKit.mdc` | Cursor rule | | ||
| | `vscode-prompt.md` | `VSCODE_PROMPT` | `.github/prompts/work.prompt.md` | VS Code Copilot prompt | | ||
|
|
There was a problem hiding this comment.
Clarify “Deployed To” as symlink target vs direct write path.
The table currently reads like claude-skill.md is directly written to ~/.claude/skills/work/SKILL.md. If actual behavior is link-based deployment via ~/.openkit/skills/*, this wording can mislead users and contributors.
Suggested doc tweak
-| `claude-skill.md` | `CLAUDE_SKILL` | `~/.claude/skills/work/SKILL.md` | Claude Code work skill (CLI-first, injected `{{WORKFLOW}}`) |
+| `claude-skill.md` | `CLAUDE_SKILL` | `~/.claude/skills/work/SKILL.md` (symlink to `~/.openkit/skills/...`) | Claude Code work skill (CLI-first, injected `{{WORKFLOW}}`) |Based on learnings: Skills are deployed to agents via symlinks from agent-specific skills directories.
🧰 Tools
🪛 LanguageTool
[uncategorized] ~29-~29: The official name of this software platform is spelled with a capital “H”.
Context: ... vscode-prompt.md | VSCODE_PROMPT | .github/prompts/work.prompt.md | VS Code Copil...
(GITHUB)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@libs/agents/README.md` around lines 24 - 30, Update the "Deployed To" column
in libs/agents/README.md to clarify that deployment is via symlink rather than
direct file writes: for entries like `claude-skill.md` (currently showing
`~/.claude/skills/work/SKILL.md`) and others (`cursor-rule.md` ->
`.cursor/rules/OpenKit.mdc`, `vscode-prompt.md` ->
`.github/prompts/work.prompt.md`), change the wording to indicate these are
symlink targets created from agent-specific directories (e.g. symlinked from
`~/.openkit/skills/*` into the shown paths) and add a brief parenthetical note
such as “(deployed via symlink from agent skills dir)” to each affected row so
readers understand the actual deployment mechanism.
| export function writeTaskMd(worktreePath: string, content: string): void { | ||
| writeFileSync(path.join(worktreePath, "TASK.md"), content); | ||
| ensureGitExclude(worktreePath); | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check how callers handle potential writeTaskMd failures
rg -nA5 'writeTaskMd\(' --type=tsRepository: fum4/openkit
Length of output: 1199
🏁 Script executed:
#!/bin/bash
# Get full context of the call sites in task-context.ts
echo "=== apps/server/src/task-context.ts around line 31 ==="
sed -n '20,40p' apps/server/src/task-context.ts | cat -n
echo ""
echo "=== apps/server/src/task-context.ts around line 155 ==="
sed -n '145,165p' apps/server/src/task-context.ts | cat -n
echo ""
echo "=== apps/server/src/manager.ts around line 1287 ==="
sed -n '1280,1300p' apps/server/src/manager.ts | cat -nRepository: fum4/openkit
Length of output: 2494
🏁 Script executed:
#!/bin/bash
# Get the function name containing line 155
sed -n '140,165p' apps/server/src/task-context.ts | head -30
echo ""
echo "=== Search for callers of writeWorktreeTaskMd ==="
rg -n 'writeWorktreeTaskMd\(' --type=ts -A 3
echo ""
echo "=== Check imports to verify writeTaskMd source ==="
head -20 apps/server/src/task-context.tsRepository: fum4/openkit
Length of output: 1608
🏁 Script executed:
#!/bin/bash
# Get function signature for line 155
sed -n '140,165p' apps/server/src/task-context.ts | grep -B 30 'writeTaskMd' | head -50
echo ""
echo "=== Search for callers of the function at line 155 ==="
# First, let's identify the function name more clearly
sed -n '135,160p' apps/server/src/task-context.ts | cat -nRepository: fum4/openkit
Length of output: 1424
🏁 Script executed:
#!/bin/bash
# Search for callers of writeWorktreeTaskMd and regenerateTaskMd
echo "=== Callers of writeWorktreeTaskMd ==="
rg -n 'writeWorktreeTaskMd\(' --type=ts -B 2 -A 2 | grep -v '^--$'
echo ""
echo "=== Callers of regenerateTaskMd ==="
rg -n 'regenerateTaskMd\(' --type=ts -B 2 -A 2 | grep -v '^--$'Repository: fum4/openkit
Length of output: 2127
🏁 Script executed:
#!/bin/bash
# Search more broadly for writeWorktreeTaskMd usage
echo "=== All references to writeWorktreeTaskMd ==="
rg 'writeWorktreeTaskMd' --type=ts
echo ""
echo "=== Check if writeWorktreeTaskMd is actually used (not just exported) ==="
rg 'writeWorktreeTaskMd\(' --type=tsRepository: fum4/openkit
Length of output: 314
🏁 Script executed:
#!/bin/bash
# Check what happens in the catch blocks of regenerateTaskMd calls
echo "=== Catch block at notes.ts:67 area ==="
sed -n '66,75p' apps/server/src/routes/notes.ts | cat -n
echo ""
echo "=== Catch block at notes.ts:102 area ==="
sed -n '101,110p' apps/server/src/routes/notes.ts | cat -n
echo ""
echo "=== Catch block at notes.ts:136 area ==="
sed -n '135,144p' apps/server/src/routes/notes.ts | cat -n
echo ""
echo "=== Catch block at notes.ts:211 area ==="
sed -n '210,219p' apps/server/src/routes/notes.ts | cat -n
echo ""
echo "=== Catch block at notes.ts:242 area ==="
sed -n '241,250p' apps/server/src/routes/notes.ts | cat -nRepository: fum4/openkit
Length of output: 1981
🏁 Script executed:
#!/bin/bash
# Get the catch block content - need more lines
echo "=== Catch blocks in notes.ts routes ==="
sed -n '66,80p' apps/server/src/routes/notes.ts | cat -n
echo ""
sed -n '101,115p' apps/server/src/routes/notes.ts | cat -n
echo ""
sed -n '135,149p' apps/server/src/routes/notes.ts | cat -n
echo ""
sed -n '210,224p' apps/server/src/routes/notes.ts | cat -n
echo ""
sed -n '241,255p' apps/server/src/routes/notes.ts | cat -nRepository: fum4/openkit
Length of output: 2366
Silent catch blocks violate logging requirements — add error logs with actionable context.
writeTaskMd can throw on write failure, and while it's wrapped in try/catch at multiple call sites, these catch blocks are silent. Per coding guidelines, silent catch blocks are never acceptable. Even for non-critical operations, errors must be logged at warn/error level with actionable metadata: what operation failed, which inputs caused it, and relevant IDs (source, issueId, worktreeId, etc.) needed to reproduce the issue.
Update catch blocks in:
apps/server/src/routes/notes.ts(lines 67–78, 102–114, 136–148, 211–223, 242–254)apps/server/src/manager.ts(lines 1287–1290)
to log errors with domain (e.g., { domain: "task-md" }) and context instead of silently swallowing them.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@libs/shared/src/task-context.ts` around lines 324 - 327, writeTaskMd can
throw when writing TASK.md; existing silent catch blocks calling it must be
replaced with proper logging. In the catch blocks in
apps/server/src/routes/notes.ts (all listed ranges) and
apps/server/src/manager.ts (around the noted lines) capture the thrown error and
call the project logger (the existing logger instance used in those files, e.g.,
serverLogger/processLogger) with an error/warn level, include { domain:
"task-md" }, the caught error, and actionable context (worktreePath and any
available IDs like source, issueId, worktreeId) so the log message reads like
"Failed to write TASK.md" plus the error and the context object; do this instead
of swallowing the exception. Ensure the error logging preserves stack/exception
details and does not change control flow beyond logging.
- return consistent response shape from agent-cli error path (UI consumers expect label, command, installed, brewPackage on all responses) - use Pick<IssueNotes, "gitPolicy"> instead of inline type in GitPolicyNotesReader (prevents type divergence if IssueNotes.gitPolicy changes) - move sub-logger declarations after all imports in manager.ts - add 25 tests for shared Logger class and normalizeContext (ts_utils.ts had no test coverage after logger unification)
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
libs/logger/ts_utils.test.ts (1)
137-180: Tighten assertions for non-info()method argument wiringThese tests currently verify only invocation. Asserting full call args (
id,message, serialized context) would better protect against regressions in Go bridge payload formatting.Suggested assertion tightening
it("calls LoggerError for error()", () => { const bindings = createMockBindings(); const logger = new Logger(() => bindings, "S"); logger.error("msg"); - expect(bindings.LoggerError).toHaveBeenCalled(); + expect(bindings.LoggerError).toHaveBeenCalledWith(1, "msg", "{}"); }); it("calls LoggerDebug for debug()", () => { const bindings = createMockBindings(); const logger = new Logger(() => bindings, "S"); logger.debug("msg"); - expect(bindings.LoggerDebug).toHaveBeenCalled(); + expect(bindings.LoggerDebug).toHaveBeenCalledWith(1, "msg", "{}"); }); it("calls LoggerSuccess for success()", () => { const bindings = createMockBindings(); const logger = new Logger(() => bindings, "S"); logger.success("msg"); - expect(bindings.LoggerSuccess).toHaveBeenCalled(); + expect(bindings.LoggerSuccess).toHaveBeenCalledWith(1, "msg", "{}"); }); it("calls LoggerStarted for started()", () => { const bindings = createMockBindings(); const logger = new Logger(() => bindings, "S"); logger.started("msg"); - expect(bindings.LoggerStarted).toHaveBeenCalled(); + expect(bindings.LoggerStarted).toHaveBeenCalledWith(1, "msg", "{}"); }); it("calls LoggerPlain for plain()", () => { const bindings = createMockBindings(); const logger = new Logger(() => bindings, "S"); logger.plain("msg"); - expect(bindings.LoggerPlain).toHaveBeenCalled(); + expect(bindings.LoggerPlain).toHaveBeenCalledWith(1, "msg", "{}"); });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@libs/logger/ts_utils.test.ts` around lines 137 - 180, Replace the loose invocation checks for Logger.error/debug/success/started/plain with strict argument assertions: for each test that calls logger.error/debug/success/started/plain, call createMockBindings() and Logger(() => bindings, "S") as before, then assert the corresponding binding (bindings.LoggerError, bindings.LoggerDebug, bindings.LoggerSuccess, bindings.LoggerStarted, bindings.LoggerPlain) was called with the expected three arguments — id "S", message "msg", and the serialized context produced by the Logger (e.g., JSON.stringify({}) for the empty context) so the specs verify id, message and the serialized context payload rather than only that the function was invoked.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/server/src/manager.ts`:
- Around line 2560-2583: The logging currently treats a WORKTREE_EXISTS return
as a failure; update the terminal logging around createWorktree() (inspect
result, result.success, and result.code from createWorktree()) so that if
result.code === "WORKTREE_EXISTS" it is treated and logged as a success/reuse
(call linearLog.success) rather than linearLog.error; preserve and emit
actionable metadata (worktreeId, projectName from this.getProjectName(),
identifier, code, error) and add a reuse/status flag (e.g., status: "reused" or
reuse: true) so telemetry correctly reflects reuse vs real failure from the
createWorktree() path.
- Around line 2453-2459: The start log for the Linear worktree operation (the
linearLog.info call in the create worktree flow) is not paired with terminal
logs on early-return failure paths; update the method that contains this snippet
(the Linear worktree creation handler) so every exit logs a terminal outcome
using linearLog.error or linearLog.info as appropriate, include the same
metadata keys (domain:"linear", action:"linear.worktree.create", projectName
from this.getProjectName(), identifier, hasBranchOverride) and add an error/
reason field when failing (e.g., credential missing, identifier resolution
failure, issue fetch failure), and ensure the successful completion path also
emits a terminal success log with matching metadata and a status="success"
marker.
---
Nitpick comments:
In `@libs/logger/ts_utils.test.ts`:
- Around line 137-180: Replace the loose invocation checks for
Logger.error/debug/success/started/plain with strict argument assertions: for
each test that calls logger.error/debug/success/started/plain, call
createMockBindings() and Logger(() => bindings, "S") as before, then assert the
corresponding binding (bindings.LoggerError, bindings.LoggerDebug,
bindings.LoggerSuccess, bindings.LoggerStarted, bindings.LoggerPlain) was called
with the expected three arguments — id "S", message "msg", and the serialized
context produced by the Logger (e.g., JSON.stringify({}) for the empty context)
so the specs verify id, message and the serialized context payload rather than
only that the function was invoked.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 32d28a9f-df90-4b0e-9150-f7f8a7ce8932
📒 Files selected for processing (8)
.claude/skills/work-on-taskapps/server/src/manager.tsapps/server/src/routes/agent-cli.tslibs/logger/package.jsonlibs/logger/ts_utils.test.tslibs/logger/vitest.config.tslibs/shared/src/git-policy.tsvitest.workspace.ts
✅ Files skipped from review due to trivial changes (1)
- .claude/skills/work-on-task
🚧 Files skipped from review as they are similar to previous changes (3)
- libs/logger/package.json
- apps/server/src/routes/agent-cli.ts
- libs/shared/src/git-policy.ts
| linearLog.info(`Create worktree requested from Linear issue ${identifier}`, { | ||
| domain: "linear", | ||
| action: "linear.worktree.create", | ||
| level: "info", | ||
| status: "info", | ||
| message: `Create worktree requested from Linear issue ${identifier}`, | ||
| projectName: this.getProjectName() ?? undefined, | ||
| metadata: { | ||
| identifier, | ||
| hasBranchOverride: Boolean(branch?.trim()), | ||
| }, | ||
| identifier, | ||
| hasBranchOverride: Boolean(branch?.trim()), | ||
| }); |
There was a problem hiding this comment.
Start log is not paired with terminal logs on all exits.
This operation logs start, but several early-return failure paths (credentials, identifier resolution, issue fetch) return without terminal outcome logs, leaving incomplete traces.
Suggested patch
@@
const creds = loadLinearCredentials(this.configDir);
if (!creds) {
+ linearLog.error("Failed to create worktree from Linear issue", {
+ domain: "linear",
+ action: "linear.worktree.create",
+ status: "failed",
+ projectName: this.getProjectName() ?? undefined,
+ identifier,
+ stage: "load-credentials",
+ error: "Linear credentials not configured",
+ });
return { success: false, error: "Linear credentials not configured" };
}
@@
try {
resolvedId = resolveLinearIdentifier(identifier, projectConfig);
} catch (err) {
+ linearLog.error("Failed to create worktree from Linear issue", {
+ domain: "linear",
+ action: "linear.worktree.create",
+ status: "failed",
+ projectName: this.getProjectName() ?? undefined,
+ identifier,
+ stage: "resolve-identifier",
+ error: err instanceof Error ? err.message : "Invalid identifier",
+ });
return {
success: false,
error: err instanceof Error ? err.message : "Invalid identifier",
};
}
@@
try {
issueDetail = await fetchLinearIssue(resolvedId, creds);
} catch (err) {
+ linearLog.error("Failed to create worktree from Linear issue", {
+ domain: "linear",
+ action: "linear.worktree.create",
+ status: "failed",
+ projectName: this.getProjectName() ?? undefined,
+ identifier: resolvedId,
+ stage: "fetch-issue",
+ error: err instanceof Error ? err.message : "Failed to fetch issue",
+ });
return {
success: false,
error: err instanceof Error ? err.message : "Failed to fetch issue",
};
}As per coding guidelines: "Treat ops logging as mandatory for all agent/workflow operations. Always log start and terminal outcome (success/failure) for ... workflow transitions ...".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/server/src/manager.ts` around lines 2453 - 2459, The start log for the
Linear worktree operation (the linearLog.info call in the create worktree flow)
is not paired with terminal logs on early-return failure paths; update the
method that contains this snippet (the Linear worktree creation handler) so
every exit logs a terminal outcome using linearLog.error or linearLog.info as
appropriate, include the same metadata keys (domain:"linear",
action:"linear.worktree.create", projectName from this.getProjectName(),
identifier, hasBranchOverride) and add an error/ reason field when failing
(e.g., credential missing, identifier resolution failure, issue fetch failure),
and ensure the successful completion path also emits a terminal success log with
matching metadata and a status="success" marker.
| if (result.success) { | ||
| linearLog.success(`Created worktree from Linear issue ${resolvedId}`, { | ||
| domain: "linear", | ||
| action: "linear.worktree.create", | ||
| worktreeId: result.worktreeId, | ||
| projectName: this.getProjectName() ?? undefined, | ||
| identifier: resolvedId, | ||
| success: result.success, | ||
| code: result.code ?? null, | ||
| worktreeId: result.worktreeId ?? null, | ||
| error: result.error ?? null, | ||
| }, | ||
| }); | ||
| }); | ||
| } else { | ||
| linearLog.error(`Failed to create worktree from Linear issue ${resolvedId}`, { | ||
| domain: "linear", | ||
| action: "linear.worktree.create", | ||
| status: "failed", | ||
| worktreeId: result.worktreeId, | ||
| projectName: this.getProjectName() ?? undefined, | ||
| identifier: resolvedId, | ||
| success: result.success, | ||
| code: result.code ?? null, | ||
| error: result.error ?? null, | ||
| }); | ||
| } |
There was a problem hiding this comment.
WORKTREE_EXISTS reuse path is currently logged as failure.
When createWorktree() returns WORKTREE_EXISTS, this method later treats it as a successful reuse, but this block logs an error first. That creates false failure telemetry.
Suggested patch
@@
- if (result.success) {
+ const reusedExisting =
+ !result.success && result.code === "WORKTREE_EXISTS" && Boolean(result.worktreeId);
+
+ if (result.success || reusedExisting) {
linearLog.success(`Created worktree from Linear issue ${resolvedId}`, {
domain: "linear",
action: "linear.worktree.create",
- worktreeId: result.worktreeId,
+ status: "success",
+ worktreeId: result.worktreeId ?? resolvedId,
projectName: this.getProjectName() ?? undefined,
identifier: resolvedId,
- success: result.success,
+ success: true,
+ reusedExisting,
code: result.code ?? null,
error: result.error ?? null,
});
} else {
linearLog.error(`Failed to create worktree from Linear issue ${resolvedId}`, {As per coding guidelines: "Treat ops logging as mandatory for all agent/workflow operations. Always log start and terminal outcome (success/failure)..." and "Include actionable metadata in error logs...".
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (result.success) { | |
| linearLog.success(`Created worktree from Linear issue ${resolvedId}`, { | |
| domain: "linear", | |
| action: "linear.worktree.create", | |
| worktreeId: result.worktreeId, | |
| projectName: this.getProjectName() ?? undefined, | |
| identifier: resolvedId, | |
| success: result.success, | |
| code: result.code ?? null, | |
| worktreeId: result.worktreeId ?? null, | |
| error: result.error ?? null, | |
| }, | |
| }); | |
| }); | |
| } else { | |
| linearLog.error(`Failed to create worktree from Linear issue ${resolvedId}`, { | |
| domain: "linear", | |
| action: "linear.worktree.create", | |
| status: "failed", | |
| worktreeId: result.worktreeId, | |
| projectName: this.getProjectName() ?? undefined, | |
| identifier: resolvedId, | |
| success: result.success, | |
| code: result.code ?? null, | |
| error: result.error ?? null, | |
| }); | |
| } | |
| const reusedExisting = | |
| !result.success && result.code === "WORKTREE_EXISTS" && Boolean(result.worktreeId); | |
| if (result.success || reusedExisting) { | |
| linearLog.success(`Created worktree from Linear issue ${resolvedId}`, { | |
| domain: "linear", | |
| action: "linear.worktree.create", | |
| status: "success", | |
| worktreeId: result.worktreeId ?? resolvedId, | |
| projectName: this.getProjectName() ?? undefined, | |
| identifier: resolvedId, | |
| success: true, | |
| reusedExisting, | |
| code: result.code ?? null, | |
| error: result.error ?? null, | |
| }); | |
| } else { | |
| linearLog.error(`Failed to create worktree from Linear issue ${resolvedId}`, { | |
| domain: "linear", | |
| action: "linear.worktree.create", | |
| status: "failed", | |
| worktreeId: result.worktreeId, | |
| projectName: this.getProjectName() ?? undefined, | |
| identifier: resolvedId, | |
| success: result.success, | |
| code: result.code ?? null, | |
| error: result.error ?? null, | |
| }); | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/server/src/manager.ts` around lines 2560 - 2583, The logging currently
treats a WORKTREE_EXISTS return as a failure; update the terminal logging around
createWorktree() (inspect result, result.success, and result.code from
createWorktree()) so that if result.code === "WORKTREE_EXISTS" it is treated and
logged as a success/reuse (call linearLog.success) rather than linearLog.error;
preserve and emit actionable metadata (worktreeId, projectName from
this.getProjectName(), identifier, code, error) and add a reuse/status flag
(e.g., status: "reused" or reuse: true) so telemetry correctly reflects reuse vs
real failure from the createWorktree() path.
- convert .claude/skills/work-on-task from symlink to real directory (absolute path to ~/.openkit/skills breaks on other machines and CI) - use relative paths when creating skill deploy symlinks (path.relative makes symlinks portable across environments)
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/server/src/routes/skills.ts (1)
191-222:⚠️ Potential issue | 🟠 MajorAdd mandatory ops logging for deploy lifecycle.
createDeployperforms a workflow operation but does not log start/success/failure (including failure context). This makes production diagnosis harder and violates the logger policy.As per coding guidelines, "Treat ops logging as mandatory for all agent/workflow operations. Always log start and terminal outcome (success/failure) ... Always include a
domainfield in the metadata object."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/server/src/routes/skills.ts` around lines 191 - 222, The createDeploy function lacks ops logging; add start/success/failure logs around the workflow using the existing logger (e.g., processLogger) and include a metadata object with domain (e.g., domain: "deploy"), plus contextual fields like linkPath and targetPath; log at function entry (start), on successful symlink creation (success), and in the catch blocks (failure) including the full error message/stack (e instanceof Error ? e.message : String(e)) and any branching failures (e.g., non-symlink directory case) so every terminal outcome is recorded with domain metadata.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.claude/skills/work-on-task/SKILL.md:
- Around line 1-6: The SKILL.md frontmatter for the "work-on-task" skill is
missing required fields; update the YAML at the top of the file (the existing
frontmatter containing name, description, and argument-hint) to include the
missing keys: allowed-tools, context, agent, model, disable-model-invocation,
and mode; populate allowed-tools with the toolset this skill uses (e.g.,
["openkit-cli"] or similar), set context to a short description of
runtime/context, set agent to the agent type (e.g., "assistant" or
"tool-runner"), set model to the model name or family expected, set
disable-model-invocation to true/false per behavior, and set mode to the
intended execution mode (e.g., "automatic" or "manual"), ensuring all values
follow YAML syntax and remain consistent with the existing
name/description/argument-hint fields for the work-on-task skill.
- Line 63: Remove the guidance sentence "Keep MCP tooling as fallback; do not
remove MCP configuration." from the SKILL.md content and replace it with the new
policy language: state that MCP should not be used for new work, no new MCP
features should be developed, and MCP code should only be changed for targeted
legacy fixes; update nearby text to prefer CLI and core app flows for new
capabilities and ensure the document references the policy rather than keeping
MCP as a fallback.
- Around line 52-53: Replace the MCP flow reference in SKILL.md (the line that
says "MCP flow: call `notify` with `requiresUserAction: true`.") with the
CLI-based instruction to prompt for user input; specifically remove the "MCP
flow" bullet and add a bullet instructing to run `openkit activity await-input
--message "<what you need>"` so the skill uses the CLI await-input flow instead
of MCP.
In `@apps/server/src/routes/skills.ts`:
- Around line 217-218: The change that creates relative symlinks using
path.relative and symlinkSync (variables relativePath, linkPath, targetPath)
lacks a co-located Vitest unit test; add a new test next to the skills route
that creates a temporary target and link, asserts the symlink was created with
the expected relative target, and verifies resolution via isSymlinkToRegistry so
both creation and resolution checks pass; use Vitest's before/after hooks to
create/cleanup temp files and ensure assertions cover both the relative target
content and that isSymlinkToRegistry(linkPath) returns true.
---
Outside diff comments:
In `@apps/server/src/routes/skills.ts`:
- Around line 191-222: The createDeploy function lacks ops logging; add
start/success/failure logs around the workflow using the existing logger (e.g.,
processLogger) and include a metadata object with domain (e.g., domain:
"deploy"), plus contextual fields like linkPath and targetPath; log at function
entry (start), on successful symlink creation (success), and in the catch blocks
(failure) including the full error message/stack (e instanceof Error ? e.message
: String(e)) and any branching failures (e.g., non-symlink directory case) so
every terminal outcome is recorded with domain metadata.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ec0c8439-c609-426e-903f-34ea9aa86590
📒 Files selected for processing (2)
.claude/skills/work-on-task/SKILL.mdapps/server/src/routes/skills.ts
| --- | ||
| name: work-on-task | ||
| description: Use OpenKit CLI to fetch task details, create a worktree, run checks, and implement. | ||
| user-invocable: true | ||
| argument-hint: <source> <id> (or just <issue-id> when source is obvious) | ||
| --- |
There was a problem hiding this comment.
Add missing required YAML frontmatter fields.
The frontmatter is missing several required fields. Based on learnings, each SKILL.md file must include: name, description, allowed-tools, context, agent, model, argument-hint, disable-model-invocation, user-invocable, and mode.
Currently missing:
allowed-toolscontextagentmodeldisable-model-invocationmode
📝 Suggested frontmatter structure
---
name: work-on-task
description: Use OpenKit CLI to fetch task details, create a worktree, run checks, and implement.
user-invocable: true
argument-hint: <source> <id> (or just <issue-id> when source is obvious)
+allowed-tools: []
+context: []
+agent: ""
+model: ""
+disable-model-invocation: false
+mode: ""
---Note: You'll need to provide appropriate values for these fields based on the skill's requirements.
Based on learnings: "Each SKILL.md file must include YAML frontmatter with: name, description, allowed-tools, context, agent, model, argument-hint, disable-model-invocation, user-invocable, and mode fields"
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| --- | |
| name: work-on-task | |
| description: Use OpenKit CLI to fetch task details, create a worktree, run checks, and implement. | |
| user-invocable: true | |
| argument-hint: <source> <id> (or just <issue-id> when source is obvious) | |
| --- | |
| --- | |
| name: work-on-task | |
| description: Use OpenKit CLI to fetch task details, create a worktree, run checks, and implement. | |
| user-invocable: true | |
| argument-hint: <source> <id> (or just <issue-id> when source is obvious) | |
| allowed-tools: [] | |
| context: [] | |
| agent: "" | |
| model: "" | |
| disable-model-invocation: false | |
| mode: "" | |
| --- |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.claude/skills/work-on-task/SKILL.md around lines 1 - 6, The SKILL.md
frontmatter for the "work-on-task" skill is missing required fields; update the
YAML at the top of the file (the existing frontmatter containing name,
description, and argument-hint) to include the missing keys: allowed-tools,
context, agent, model, disable-model-invocation, and mode; populate
allowed-tools with the toolset this skill uses (e.g., ["openkit-cli"] or
similar), set context to a short description of runtime/context, set agent to
the agent type (e.g., "assistant" or "tool-runner"), set model to the model name
or family expected, set disable-model-invocation to true/false per behavior, and
set mode to the intended execution mode (e.g., "automatic" or "manual"),
ensuring all values follow YAML syntax and remain consistent with the existing
name/description/argument-hint fields for the work-on-task skill.
| - MCP flow: call `notify` with `requiresUserAction: true`. | ||
| - Terminal flow: run `openkit activity await-input --message "<what you need>"`. |
There was a problem hiding this comment.
Remove MCP flow reference; use CLI-based approach.
This skill references "MCP flow" for user notifications, which contradicts the PR's objective to remove MCP server and replace it with the skills API. The skill should use CLI-based flows exclusively.
Consider replacing with:
- Run `openkit activity await-input --message "<what you need>"` to prompt for user input.Based on learnings: "Do not use MCP for new work. Do not develop new MCP features. Do not refactor MCP code unless explicitly requested for a targeted legacy fix. Prefer CLI and core app flows for all new capabilities."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.claude/skills/work-on-task/SKILL.md around lines 52 - 53, Replace the MCP
flow reference in SKILL.md (the line that says "MCP flow: call `notify` with
`requiresUserAction: true`.") with the CLI-based instruction to prompt for user
input; specifically remove the "MCP flow" bullet and add a bullet instructing to
run `openkit activity await-input --message "<what you need>"` so the skill uses
the CLI await-input flow instead of MCP.
| - Prefer non-interactive commands and flags (`--init`) to avoid blocked prompts. | ||
| - Never skip or reorder workflow phases. Always emit checkpoints in canonical order. | ||
| - Never claim completion when `openkit activity check-flow` is failing. | ||
| - Keep MCP tooling as fallback; do not remove MCP configuration. |
There was a problem hiding this comment.
Remove guidance to keep MCP tooling.
Line 63 advises "Keep MCP tooling as fallback; do not remove MCP configuration," which contradicts this PR's objective to remove MCP server support and the learning that MCP should not be used for new work.
🔧 Suggested fix
- Announce major commands before running them.
- Prefer non-interactive commands and flags (`--init`) to avoid blocked prompts.
- Never skip or reorder workflow phases. Always emit checkpoints in canonical order.
- Never claim completion when `openkit activity check-flow` is failing.
-- Keep MCP tooling as fallback; do not remove MCP configuration.Based on learnings: "Do not use MCP for new work. Do not develop new MCP features. Do not refactor MCP code unless explicitly requested for a targeted legacy fix. Prefer CLI and core app flows for all new capabilities."
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - Keep MCP tooling as fallback; do not remove MCP configuration. | |
| - Announce major commands before running them. | |
| - Prefer non-interactive commands and flags (`--init`) to avoid blocked prompts. | |
| - Never skip or reorder workflow phases. Always emit checkpoints in canonical order. | |
| - Never claim completion when `openkit activity check-flow` is failing. |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.claude/skills/work-on-task/SKILL.md at line 63, Remove the guidance
sentence "Keep MCP tooling as fallback; do not remove MCP configuration." from
the SKILL.md content and replace it with the new policy language: state that MCP
should not be used for new work, no new MCP features should be developed, and
MCP code should only be changed for targeted legacy fixes; update nearby text to
prefer CLI and core app flows for new capabilities and ensure the document
references the policy rather than keeping MCP as a fallback.
| const relativePath = path.relative(path.dirname(linkPath), targetPath); | ||
| symlinkSync(relativePath, linkPath); |
There was a problem hiding this comment.
Missing tests for the new relative symlink behavior.
This TS behavior change should include a co-located Vitest case that verifies both link creation (relative target) and resolution checks (e.g., isSymlinkToRegistry) still succeed.
As per coding guidelines, "Every code change — feature, bugfix, or refactor — must include corresponding tests. Tests are co-located with source files ... Always use Vitest for testing."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/server/src/routes/skills.ts` around lines 217 - 218, The change that
creates relative symlinks using path.relative and symlinkSync (variables
relativePath, linkPath, targetPath) lacks a co-located Vitest unit test; add a
new test next to the skills route that creates a temporary target and link,
asserts the symlink was created with the expected relative target, and verifies
resolution via isSymlinkToRegistry so both creation and resolution checks pass;
use Vitest's before/after hooks to create/cleanup temp files and ensure
assertions cover both the relative target content and that
isSymlinkToRegistry(linkPath) returns true.
|
/package |
Summary by CodeRabbit
Removed Features
openkit mcpCLI command./api/mcp/status,/api/mcp/setup,/api/mcp/remove,/api/config/features).Documentation
Chores
check:types,check:format,check:lint,fix:format,fix:lint).