Commit Graph

13 Commits

Author SHA1 Message Date
greyfreedom 3df018994f feat(config): load typed ask permissions file
(cherry picked from commit fb77cf1e0946a061376e5e9a8fc9422dddd98419)
2026-06-01 05:43:26 -07:00
HUQIANTAO 9bf14e9825 docs(state): add doc comments to all public types (#2452)
* docs(state): add doc comments to all public types

* docs(execpolicy): add doc comments to all public types

* test(web): add unit tests for pure helper functions

Add vitest configuration and tests for:
- relativeTime: time formatting (just now, minutes, hours, days, months, years)
- lastPageFromLink: GitHub Link header pagination parsing

These are the first tests for the web frontend. The test framework
(vitest) was already in package.json but had no config or test files.

---------

Co-authored-by: Hu Qiantao <huqiantao@HudeMacBook-Air.local>
2026-05-31 11:08:16 -07:00
Hunter Bown 8f095b882f feat(execpolicy): add typed ask rule foundation (#2404)
* feat(execpolicy): add typed ask rule foundation

* fix(execpolicy): tighten typed ask diagnostics

---------

Co-authored-by: greyfreedom <greyfreedom@163.com>
2026-05-31 01:37:15 -07:00
Hunter Bown c6d73d98de refactor(crates): rename workspace members to codewhale-*
Rename the 14 workspace member crates from `deepseek-*` (and
`deepseek-tui-*`) to `codewhale-*`. Internal-only — binary names
(`deepseek` and `deepseek-tui`) are intentionally untouched in this
phase; they move in the next phase along with the deprecation shims.

Affects:
- 14 `[package] name = "..."` declarations.
- All inter-crate `[dependencies]` entries that referenced the old
  package names.
- All `use deepseek_*::...` statements rewritten to `use codewhale_*`.
- Cargo.lock regenerated.

CI workflows and release scripts that pass `-p deepseek-*` still
reference the old names; those move with the binary rename phase so
that pair lands together.

Local gates green: `cargo check --workspace --all-targets --locked`,
`cargo fmt --all -- --check`, `cargo clippy --workspace --all-targets
--all-features --locked -- -D warnings`, `cargo test --workspace
--all-features --locked` (3226+ pass, 0 fail).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 10:21:33 -05:00
Zhang Yonglun 0428f08625 fix(tests): cover approval decision branches 2026-05-10 08:15:19 -05:00
Hunter Bown 02fc16e10f style: clippy sweep across community PRs (-D warnings)
13 clippy errors had accumulated from squash-merged community PRs:
collapsible-if (10), needless-late-init (1), derivable-impls (1),
sort-unstable hint (1). All auto-fixable mechanical lints — no
behaviour change. Required to satisfy CI's
`cargo clippy --workspace --all-targets --all-features --locked
-- -D warnings` gate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 02:15:16 -05:00
Hunter Bown a9dcf2b6e6 style: cargo fmt sweep across community PRs
47 fmt drifts had accumulated from the squash-merged community PRs on
this branch (#653, #654, #655, #645, #658, #668, #659, #661, #660,
#667, #656). Pure formatting — no behavioural changes — applied via
`cargo fmt --all` to satisfy CI's `cargo fmt --all -- --check` gate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 01:57:25 -05:00
Hunter Bown ca9fccc0da fix: address review findings — broken test, expect() panic, misleading docstring
#651: fix test assertion — section_bg now Color::Reset (was DEEPSEEK_INK)
#645: replace expect() with Result in OpenSandboxBackend::new()
#653: correct resolve_prefixes docstring to describe deny-always-wins
2026-05-05 00:42:42 -05:00
Hunter Bown e25cb4e38b fix(build): add missing arity_dict field in ExecPolicyEngine::with_rulesets 2026-05-05 00:17:24 -05:00
Hunter Bown 8dca6deee2 feat(execpolicy): layered permission rulesets (#653) 2026-05-05 00:16:27 -05:00
wangfengcsu 9dea4ed256 feat(execpolicy): bash arity dictionary for command-prefix allow rules (closes #410)
Add `crates/execpolicy/src/bash_arity.rs` with a hand-curated `BashArityDict`
struct (160+ entries, 30+ command families: git, npm, yarn, pnpm, cargo,
docker, kubectl, go, pip, gh, rustup, deno, bun, aws, terraform, helm, make).

Wire arity-aware prefix matching into:
- `crates/tui/src/command_safety.rs` — new public `prefix_allow_matches()`
  function so `auto_allow = ["git status"]` matches `git status -s` /
  `git status --porcelain` but NOT `git push`.
- `crates/tui/src/execpolicy/rules.rs` — `ExecPolicyConfig::evaluate()` now
  checks allow rules via `prefix_allow_matches` before falling back to the
  existing regex/wildcard `pattern_matches` path.
- `crates/execpolicy/src/lib.rs` — `ExecPolicyEngine` uses `BashArityDict`
  for trusted-prefix matching; backward-compatible with existing exact-match
  deny rules.

`cargo +nightly check` passes. 0 errors, 0 warnings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 16:28:42 -07:00
wangfengcsu 210540dbb6 feat(execpolicy): layered permission rulesets — defaults+agent+user (closes #415)
Add RulesetLayer enum (BuiltinDefault < Agent < User) and Ruleset struct
so the engine can stack multiple named permission layers. Higher-priority
layers shadow lower ones; within a layer, longest matching prefix wins.

- ExecPolicyEngine::with_rulesets() builds from explicit layers
- add_ruleset() inserts and re-sorts by priority
- resolve_prefixes() merges all layers + legacy flat lists
- Existing new(trusted, denied) constructor unchanged — backward compatible

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 16:25:44 -07:00
Hunter Bown 37186c3d95 Workspace migration: split into modular crates, parity CI, release updates
- Convert root to Cargo workspace with crates/ layout
- Add deepseek-* crates mirroring Codex architecture
- Add parity CI workflow with snapshot/protocol/state tests
- Update release workflow to build both deepseek and deepseek-tui binaries
- Bump version to 0.3.28
2026-03-02 17:52:46 -06:00