Commit Graph

765 Commits

Author SHA1 Message Date
kingboung
3780b517c5 chore: switch review skill download branch to main
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 14:44:55 +08:00
kingboung
37f53440f3 Merge remote-tracking branch 'origin/main' into feat/migrate-review-agents 2026-05-12 11:49:50 +08:00
kingboung
c3e19d7d2a refactor: migrate review skills from registerBundledSkill to extract-to-disk
Replace registerBundledSkill() with runtime extract-to-disk + standard
skill scanner discovery, aligning with upstream opencode PR #360 approach.

- Add extractBundledSkill() to generate script output
- Create extension.ts for runtime skill extraction to ~/.claude/skills/
- Remove reviewSkills.ts (registerBundledSkill registration)
- Update bundled/index.ts to call Extension.initializeBuiltinSkills()
- Add build:builtin-review script to package.json

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 11:49:38 +08:00
kingboung
e68415c7e9 fix: add Skill tool to allowedTools and restore locale templates
- Add 'Skill' to allowedTools so model can invoke Skill tool to load
  review/security-review SKILL.md content
- Restore src/costrict/command/locales/ with zh-CN/en templates telling
  model to use Skill tool (aligns with opencode PR #360 approach)
- Remove model: 'inherit' from review registration (was resolving to
  wrong model, strict:plan works without it)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 10:50:43 +08:00
geroge
eb955e44b8
Merge pull request #63 from Askhz/feat/costrict-max-tokens
feat(costrict): 根据模型列表动态设置 max_tokens 参数
2026-05-12 10:20:11 +08:00
Askhz
158ead6cbe Merge branch 'main' into feat/costrict-max-tokens 2026-05-12 10:16:21 +08:00
geroge
62398b2dcc
Merge pull request #60 from y574444354/feat/migrate-review-agents
feat: migrate review system to bundled skill files mechanism
2026-05-12 10:11:29 +08:00
geroge
ba39b17a7e
Merge pull request #56 from Askhz/chore/remove-attribution-header
chore: remove x-anthropic-billing-header from system prompt
2026-05-12 10:11:03 +08:00
geroge
d1197c2efc
Merge pull request #54 from Askhz/feat/costrict-agent-type-header
feat: add agent-type request header to CoStrict provider
2026-05-12 10:10:48 +08:00
geroge
206cd1f4d4
Merge pull request #53 from Askhz/fix/undici-dependency-missing
fix: 设置https_proxy参数时启动csc卡住
2026-05-12 10:10:23 +08:00
Askhz
1970c698ea feat(costrict): 根据模型列表动态设置 max_tokens 参数
从 /ai-gateway/api/v1/models 返回的模型信息中读取 maxTokensKey
和 maxTokens 字段,发送请求时动态注入对应参数名和参数值。
maxTokensKey 缺失时默认使用 max_tokens,maxTokens 无值时不传该参数。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 21:23:28 +08:00
kingboung
c431001a4a Merge remote-tracking branch 'origin/main' into feat/migrate-review-agents 2026-05-11 20:54:55 +08:00
kingboung
62efcef508 refactor: consolidate review skill registration and fix command conflicts
- Merge strict:review/strict:security-review into reviewSkills.ts (single
  file registers all four commands: /review, /security-review,
  /strict:review, /strict:security-review)
- Remove conflicting prompt commands from src/commands/ (review.ts,
  security-review.ts) so bundled skills take precedence
- Remove REVIEW_AGENTS import from builtInAgents.ts and mcp.ts
- Remove agent generation logic from generate-review-builtin.ts
- Configure allowedTools and model: 'inherit' per claudecode spec
- Switch test branch to optimize/agent-prompts

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 20:52:18 +08:00
linkai0924
d9bc165378
Merge pull request #61 from y574444354/feat/add-timestamp-to-version
Feat/add timestamp to version
2026-05-11 20:43:26 +08:00
林凯90331
f8d4feee98 feat(rawDump): disable raw dump by default
Invert the enablement logic so raw dump is disabled unless

CSC_DISABLE_RAW_DUMP or COSTRICT_DISABLE_RAW_DUMP is explicitly

set to 0 or false.

Signed-off-by: 林凯90331 <90331@sangfor.com>

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-11 20:41:56 +08:00
林凯90331
e8dca4d3bd feat(cli): add git commit hash and build time to --version output
Include commit short hash and formatted build timestamp in the

version string, matching the output format of cs --version.

Signed-off-by: 林凯90331 <90331@sangfor.com>

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-11 20:27:22 +08:00
kingboung
a5235ab03c Merge remote-tracking branch 'origin/main' into feat/migrate-review-agents 2026-05-11 20:21:16 +08:00
kingboung
e3ba147dbe refactor: migrate review system to bundled skill files mechanism
Replace custom extension.ts initialization and agent-based routing with
csc's built-in registerBundledSkill({ files }) mechanism. Review and
security-review skills are now registered with embedded files that
get lazily extracted to disk on first invocation. Locale is resolved
at startup via getResolvedLanguage().

- Remove agent generation from generate-review-builtin.ts (skill-only)
- Remove extension.ts, REVIEW_AGENTS registration, strict:* skills
- Add reviewSkills.ts with registerReviewSkills() for unified registration
- Adapt to new costrict-review index.json format (skills-only, new paths)
- Remove src/costrict/command/locales/ (no longer needed)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 20:19:05 +08:00
linkai0924
ab2195b5d1
Merge pull request #59 from y574444354/feat/package-binary
build(scripts): add bun compile scripts for linux and windows binaries
2026-05-11 17:50:46 +08:00
林凯90331
5515699125 build(scripts): add bun compile scripts for linux and windows binaries
Wrap bun build --compile to produce self-contained executables for linux-x64 (glibc/musl) and windows-x64, each in modern (AVX2) and baseline (SSE2) variants. The build:binary:* aliases run the existing build pipeline first so dist/cli.js post-processing (feature flags, import.meta.require) stays in effect.

Signed-off-by: 林凯90331 <90331@sangfor.com>

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-11 17:46:44 +08:00
Askhz
5d288c4290 chore: remove x-anthropic-billing-header from system prompt 2026-05-11 11:47:39 +08:00
y574444354
dbef683bb2 docs: update contributors 2026-05-11 03:45:52 +00:00
linkai0924
6651109d9c
Merge pull request #55 from y574444354/fix/batch-work-issue
fix(rawDump): prevent batch worker concurrency cascade and add fetch …
2026-05-11 11:41:18 +08:00
林凯90331
1240a1a499 fix(rawDump): prevent batch worker concurrency cascade and add fetch timeout
- Add in-process isRunning flag to block reentrant runBatch (file lock
  fails when pid === process.pid)
- Replace setInterval + double immediate trigger with self-scheduling
  setTimeout that only fires after previous batch awaits
- Move clearQueue() to right after readQueue() so any unexpected
  concurrent runBatch sees an empty queue and exits immediately
- Cache repoInfo and workingTreeDiff in processTask, pass into all three
  upload functions to halve git invocations per task
- Add 30s AbortController timeout on postJson fetch so the worker no
  longer hangs indefinitely on unresponsive networks

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 11:34:44 +08:00
Askhz
4dcb3a2107 feat: add agent-type request header to CoStrict provider
在 CoStrict provider 的所有 API 请求中注入 agent-type header,
反映当前会话所使用的 agent 或 skill,默认值为 "build"。

- fetch.ts: createCoStrictFetch 接受可选 agentType 参数,PascalCase
  自动转 kebab-case(StrictSpec → strict-spec),注入 agent-type header
- index.ts: queryModelCoStrict 读取 getMainThreadAgentType()(--agent 启动)
  或 getActiveSkillName()(slash skill 触发)作为 agentType
- models.ts: /v1/models 请求添加 User-Agent: csc/{VERSION} header
- state.ts: 新增 activeSkillName 状态及 getter/setter
- processSlashCommand.tsx: inline skill 和 fork skill(context:fork)
  触发时均调用 setActiveSkillName 记录当前 skill/agent 名
- caches.ts: /clear 时调用 setActiveSkillName(undefined) 重置状态,
  避免新会话继承上一会话的 agent-type

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 11:17:02 +08:00
Askhz
636e40a991 fix: move undici to dependencies to fix Node.js startup hang when https_proxy is set
When https_proxy is configured, configureGlobalAgents() calls __require("undici")
synchronously. In the npm package, undici was listed as devDependencies and thus
absent from node_modules after installation. Node.js 22 would then attempt to load
its built-in ESM undici via CJS require(), causing an ESM/CJS interop deadlock that
hung the process indefinitely with no way to interrupt it.

Moving undici to dependencies ensures it is installed as a CJS-compatible module,
allowing __require("undici") to resolve correctly under Node.js.
2026-05-10 00:35:18 +08:00
linkai0924
61b1b595bf
Merge pull request #51 from y574444354/fix/compile-code-reivew
fix: code-review compile issue
2026-05-09 17:33:16 +08:00
林凯90331
2fa9f1616f fix: code-review compile issue 2026-05-09 17:32:33 +08:00
yhangf
3ec07bd2ec Merge branches 'feature/spec-pro' and 'main' of https://github.com/y574444354/csc into feature/spec-pro 2026-05-09 16:10:01 +08:00
yhangf
396e4cdbe3 feat(agents): propagate allowedAgentTypes from agent tool resolution to query engine 2026-05-09 15:15:10 +08:00
yhangf
1efba6b17a feat(cli): resolve agent tools based on main thread agent definition in headless streaming 2026-05-09 14:18:10 +08:00
yhangf
ba2aad5c09 feat(permissions): auto-select AskUserQuestion answers in headless mode
- Add headless fallback in `hasPermissionsToUseToolInner` that respects
  `askUserQuestionTimeoutSeconds` from settings (default 600s) when
  `shouldAvoidPermissionPrompts` is true, instead of hanging indefinitely
- Set `shouldAvoidPermissionPrompts: true` on `toolPermissionContext` in
  `-p` (pipe/headless) mode so the new path is triggered
- Hoist `parsedInput` before the try block so the headless path can use
  Zod-transformed input (includes defaults like `multiSelect: false`)
2026-05-08 17:57:15 +08:00
yhangf
697ee49752 feat(query-engine): pass mainThreadAgentDefinition to support built-in agent system prompts 2026-05-08 14:43:11 +08:00
geroge
684b81457c
Merge pull request #46 from y574444354/feat/favorite-migrate
feat: migrate favorite command from opencode to csc
2026-05-08 09:36:24 +08:00
geroge
0e01c5a02f
Merge pull request #44 from Askhz/fix/disable-fork-subagent-default
fix: 默认关闭 FORK_SUBAGENT feature flag
2026-05-08 09:35:46 +08:00
geroge
85aaeb9a7a
Merge pull request #43 from y574444354/feat/migrate-review-agents
feat: migrate review agents to unified costrict-review repo
2026-05-08 09:35:24 +08:00
林凯90331
dacbf1f7ab feat: migrate favorite command from opencode to csc
- Add /favorite REPL slash command with list/view/download/load/unload/uninstall

- Implement core favorite logic in src/costrict/favorite/ using createCoStrictFetch

- Extend GlobalConfig with agents and commands fields for config-layer storage

- Adapt skill load/unload to csc's directory-scanning mechanism (~/.claude/skills/)

- Adapt MCP load/unload to csc's mcpServers config via saveGlobalConfig()

- Decouple from opencode-specific deps: jsonc-parser, Config.invalidate, Filesystem.*

Signed-off-by: 林凯90331 <90331@sangfor.com>

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-08 08:20:57 +08:00
linkai0924
7363519887
Merge pull request #45 from y574444354/feat/report-raw-dump
feat(rawDump): add session data raw-dump reporting module
2026-05-07 22:16:02 +08:00
林凯90331
f3ece2f469 refactor(rawDump): prevent 429 with queue + batch worker
Replace per-turn detached workers with a file-backed queue consumed by
a single long-running batch worker (30s interval, 0-10s jitter).

- queue.ts, batchWorker.ts: file queue with pid-based lock for worker
  singleton; tasks deduped by sessionID:messageID before processing
- worker.ts: retry with backoff (5s, 10s) for 429 and network errors;
  update commit state per upload so partial failures resume cleanly;
  export auth, loadSessionMessages, getSessionDirectory and upload*
  helpers for batchWorker reuse
- git.ts: cap commit log at 50 entries within last 7 days; pause 500ms
  every 10 commits to spread load
- worker.ts: resolve session jsonl via ~/.claude/projects/{normalized}
  with fallbacks, scanning for the file containing the target session
- logger.ts: file + stderr logger gated by CSC_RAW_DUMP_DEBUG, default
  silent
- sessionDataUploader.ts: implement createSessionTurnUploader to pick
  the last assistant message; query.ts fires uploadSessionTurn after
  query_api_streaming_end (non-blocking)

Signed-off-by: 林凯90331 <90331@sangfor.com>
Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-07 21:45:20 +08:00
kingboung
00e37eeccd fix: use new URL() for cwd path in build.ts review generation step
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 18:41:41 +08:00
林凯90331
28d4f1f4e5 feat(rawDump): add session data raw-dump reporting module
Introduce a framework-decoupled raw-dump module that uploads conversation, summary, and commits data to the CoStrict server in a non-blocking detached worker process.

- Add src/services/rawDump/ with index, types, state, spawn, git, worker, and README

- Implement reportTurn and reportSession entry points with in-memory dedup and env-based disable switch (CSC_DISABLE_RAW_DUMP / COSTRICT_DISABLE_RAW_DUMP)

- Replace sessionDataUploader stub with uploadSessionTurn that delegates to reportTurn

Signed-off-by: 林凯90331 <90331@sangfor.com>

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-07 17:27:56 +08:00
Askhz
f8a4ae7083 fix: 默认关闭 FORK_SUBAGENT feature flag
开启时会强制所有 Agent 工具调用走异步路径,导致 run_in_background
参数失效,子 agent 始终在后台运行。如需启用请设置 FEATURE_FORK_SUBAGENT=1。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 17:20:59 +08:00
kingboung
083e2a7cfc chore: add gray-matter dependency for frontmatter parsing
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 17:04:08 +08:00
kingboung
49204031fb chore: remove superpowers docs directory
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 16:52:12 +08:00
kingboung
a1d3a3db2d chore: untrack generated review builtin files from git index
Files are still present on disk and generated by build:review-builtin.
.gitignore rules prevent them from being re-committed.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 11:49:07 +08:00
kingboung
3beeaa545e ci: add review agent generation step to build and CI
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 11:46:05 +08:00
kingboung
4054ae9f4b feat: migrate review agents and skills to unified costrict-review repo
- Add generate-review-builtin.ts script (downloads from zgsm-ai/costrict-review)
- Add review module (index.ts, extension.ts) with locale-aware skill init
- Add CommandLocale module with zh-CN/en templates for /review and /security-review
- Integrate REVIEW_AGENTS into builtInAgents.ts
- Route /review command to CoStrictReviewer agent
- Simplify /security-review to use Skill tool with locale templates
- Remove old generate-skills.ts and inline security-review skill

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 09:40:24 +08:00
kingboung
abf67ea914 feat: add generate-review-builtin script for unified review resource generation
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 09:36:47 +08:00
kingboung
e4025f5d79 chore: add review module stubs and gitignore rules
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 09:34:18 +08:00
kingboung
65c347a151 docs: add design spec for migrating review agents to unified costrict-review repo
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 09:00:43 +08:00