Skip to content

Commit 6ffeeb9

Browse files
committed
Clean up some long comments
1 parent 73e2d55 commit 6ffeeb9

11 files changed

Lines changed: 4 additions & 65 deletions

File tree

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
每次执行完以后都要补充测试文件确保实际行为与预期相符
55
修改过程中发现错误,如果是本次范围就修改(包括测试),否则要在最后指出
66
在用户的最新的一条消息除非有显式命令(执行方案、修改代码等)要求修改代码,否则绝对不改代码,之前要求修改的指令全部不算数,别再根据之前的上下文或者当前不确定的指令猜是不是要直接修改代码了
7-
设计方案后,须深入解释每一步的理由
7+
设计方案后,须深入解释每一步的理由
8+
仅允许使用简短注释

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
不允许假设“这是未来需要扩展的”,所以现在就不做,应该贴合用户的实际要求
2-
禁止局部短视实现:不允许仅为了“当前调用能跑通”而写死临时逻辑、硬编码、破坏原有接口契约、或绕过已有模块
32
不允许总是有阶段性计划,分阶段完成很容易导致过程产生一堆没用的死代码
43
不许兼容、兜底旧代码
54
每次执行完以后都要补充测试文件确保实际行为与预期相符
65
修改过程中发现错误,如果是本次范围就修改(包括测试),否则要在最后指出
76
在用户的最新的一条消息除非有显式命令(执行方案、修改代码等)要求修改代码,否则绝对不改代码,之前要求修改的指令全部不算数,别再根据之前的上下文或者当前不确定的指令猜是不是要直接修改代码了
8-
设计方案后,须深入解释每一步的理由
7+
设计方案后,须深入解释每一步的理由
8+
仅允许使用简短注释

packages/codingcode/src/approval/response.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
import type { ConfirmResult } from './confirmation.js';
22

3-
/**
4-
* Parses a JSON or legacy string approval response from the desktop client.
5-
* Tool approval only — the plan-approval modal uses a richer vocabulary
6-
* (allow / modified / canceled) and is parsed by `parsePlanApprovalResponse`
7-
* in `plan/`. The two wire protocols share the legacy `'allow' | 'deny'`
8-
* codes but the plan path is the only one that accepts `modified`/`canceled`.
9-
*/
103
export function parseApprovalResponse(raw: string): ConfirmResult {
114
if (raw && raw.startsWith('{')) {
125
try {

packages/codingcode/src/core/path.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
import { homedir } from 'os';
22
import { join } from 'path';
33

4-
/** Normalize a path to always produce the same encoded form for the same directory:
5-
* - Convert POSIX /c/... → c:/... (Git Bash paths on Windows)
6-
* - Convert backslashes to forward slashes
7-
* - Lowercase drive letter
8-
* Does NOT call path.resolve() since it mishandles /c/... on Windows. */
94
export function normalizePath(p: string): string {
105
let s = p.replaceAll('\\', '/');
116
s = s.replace(/^\/([a-zA-Z])\//, (_, letter: string) => `${letter.toLowerCase()}:/`);
127
s = s.replace(/^([A-Z]):/, (_, letter: string) => letter.toLowerCase() + ':');
138
return s;
149
}
1510

16-
/** Encode a project path as a human-readable, filesystem-safe directory name.
17-
* Colons, slashes, and spaces are collapsed into single dashes. */
1811
export function encodeProjectPath(p: string): string {
1912
const normalized = normalizePath(p);
2013
return normalized
@@ -23,16 +16,6 @@ export function encodeProjectPath(p: string): string {
2316
.toLowerCase();
2417
}
2518

26-
// ---- Project storage roots ----
27-
//
28-
// `~/.codingcode/project/<encodedProjectPath>/` holds per-project session state
29-
// (jsonl + index + checkpoint git).
30-
// `~/.codingcode/projects/<encodedProjectPath>/` holds per-project plan files
31-
// (one markdown per sessionId).
32-
//
33-
// Both roots can be overridden by tests via the set* functions below, so that
34-
// the production code never has to know about a specific disk layout and tests
35-
// can redirect everything to a per-test tmpdir.
3619

3720
let _projectBaseOverride: string | undefined;
3821
let _projectPlansBaseOverride: string | undefined;

packages/codingcode/src/hooks/registry.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,6 @@ export class HookService extends Effect.Service<HookService>()('HookService', {
130130
emit: (point: HookPoint, payload: Record<string, unknown>): Effect.Effect<void> => {
131131
const projectPath = payload.projectPath as string | undefined;
132132
const sessionId = payload.sessionId as string | undefined;
133-
// Internally `emit` may run Effect-returning observers that `yield*`
134-
// services from the caller's fiber. The declared R is `never` so
135-
// existing `Effect.runPromise(emit)` fire-and-forget call sites keep
136-
// compiling; observers that need services should only be registered
137-
// for hook points emitted from a fiber that provides them
138-
// (e.g. `tool.execute.after` from `ToolExecutorService`).
139133
return Effect.gen(function* () {
140134
for (const entry of allHandlers(point, projectPath, sessionId)) {
141135
if (entry.type === 'observer') {
@@ -146,8 +140,6 @@ export class HookService extends Effect.Service<HookService>()('HookService', {
146140
continue;
147141
}
148142
if (typeof (result as { pipe?: unknown }).pipe === 'function') {
149-
// Effect-returning observer: run in this fiber's context.
150-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
151143
yield* (result as Effect.Effect<void, never, any>).pipe(
152144
Effect.catchAll((e) =>
153145
Effect.sync(() => logger.error(`hook emit error [${point}]:`, e))
@@ -161,9 +153,6 @@ export class HookService extends Effect.Service<HookService>()('HookService', {
161153
}
162154
}
163155
}
164-
// The gen's actual R is `any` (from inner Effects); expose `never`
165-
// to keep callers that do `Effect.runPromise(emit)` happy. See the
166-
// contract comment on `ObserverHandler` for the runtime guarantee.
167156
}) as Effect.Effect<void>;
168157
},
169158

packages/codingcode/src/layer.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,6 @@ export const AppLayer = Layer.mergeAll(
119119
);
120120

121121
/** Create the application ManagedRuntime from AppLayer. */
122-
// Effect's ManagedRuntime.make typing is overly strict for our AppLayer union;
123-
// runtime has access to all service tags so the cast is safe.
124-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
125122
export const createAppRuntime = () => ManagedRuntime.make(AppLayer as any);
126123

127124
/** Concrete runtime type for the application. */

packages/codingcode/src/runtime/project-runtime.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,6 @@ export class ProjectRuntimeService extends Effect.Service<ProjectRuntimeService>
112112
sessionAgentProfiles.set(sessionId, profile);
113113
const mode = profileToPermissionMode(profile);
114114
sessionPermissionModes.set(sessionId, mode);
115-
// Keep the plan-mode side channel in sync so synchronous decision
116-
// hooks (planModeGateHook) can answer "is this session in plan mode?"
117-
// without reaching back into the Effect runtime.
118115
markSessionPlanMode(sessionId, isPlanProfile(profile));
119116
// 写盘:跨重启恢复时 messages.ts 从 idx 读 permissionMode + activeProfile
120117
const state = yield* session.load(projectPath, sessionId);

packages/codingcode/src/session/types.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,6 @@ export interface SessionIndex {
7979
usage: TokenUsage | undefined;
8080
permissionMode: string;
8181
memorySnapshot?: string;
82-
/**
83-
* Name of the main agent profile currently active for this session
84-
* (e.g. 'plan' or 'build'). When undefined, the build profile is implicit.
85-
*/
8682
activeProfile?: string;
8783
}
8884

packages/codingcode/src/subagent/registry.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,6 @@ export const PLAN_PROFILE: AgentProfile = {
169169
name: 'plan',
170170
description:
171171
'Planning agent: analyzes the codebase, produces an implementation plan, and submits it via submit_plan for user approval. No business code modifications.',
172-
// No `permissionMode` — plan mode is enforced structurally by the
173-
// `plan/planModeGateHook` (registered on `tool.approval.pre`) and
174-
// detected via `isPlanProfile(profile)`. The approval pipeline itself
175-
// does not need to know about this profile.
176172
systemPrompt: `You are a planning agent. Your role is to analyze the codebase and produce an implementation plan that the user reviews and approves before any code is written.
177173
178174
You can read files, search code, and dispatch the 'explore' subagent for context-heavy investigation. You can submit a plan via the \`submit_plan\` tool — each call overwrites the previous plan file; use it to revise your plan based on user feedback.

packages/codingcode/src/subagent/types.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import type { UserHookConfig } from '../hooks/types.js';
22
import type { PermissionMode } from '../approval/types.js';
33

4-
/**
5-
* Permission modes that may be declared on an `AgentProfile`. The `'plan'`
6-
* mode lives in the `plan/` module and is detected structurally via
7-
* `isPlanProfile(profile)` rather than via this field.
8-
*/
94
export type ProfilePermissionMode = Exclude<PermissionMode, 'plan'>;
105

116
export interface AgentProfile {

0 commit comments

Comments
 (0)