Skip to content

feat(commands): /loop /schedule /team-onboarding + expand /logout (#43 #58 #60 #63) - #88

Merged
Crsei merged 1 commit into
Crsei:rust-litefrom
yaohaowei0914:claude/busy-burnell-116f58
Apr 21, 2026
Merged

feat(commands): /loop /schedule /team-onboarding + expand /logout (#43 #58 #60 #63)#88
Crsei merged 1 commit into
Crsei:rust-litefrom
yaohaowei0914:claude/busy-burnell-116f58

Conversation

@yaohaowei0914

Copy link
Copy Markdown
Contributor

Summary

Ships the scheduling/automation (#58, #60) and onboarding/logout (#43, #63) groups as one change because they share infrastructure.

  • services/scheduler — JSON-backed recurring-task store (interval parsing, cross-process lockfile, atomic writes). Shared by /loop and /schedule.
  • services/onboarding — persistent first-run state consumed by both the expanded /logout and /team-onboarding.

What's in it

/loop#58

commands/loop_cmd.rs

  • /loop <interval> <payload> creates a recurring task; plain-prompt payloads return CommandResult::Query so they run once immediately (matching the Bun reference). Slash-command payloads are registered but not auto-dispatched (avoids re-entering /loop).
  • Subcommands: list, remove, trigger, pause, resume, help.
  • Intervals: 30s / 5m / 1h / 2d / */10 * * * * (full cron is future work; only the minute stride is honored today, with a clear error for anything richer).

/schedule#60

commands/schedule.rs

  • Raw management surface over the same store: add, list, show, remove, pause, resume, trigger, due.
  • Local cron is the first milestone. Help output and /schedule remote … both explicitly flag the remote-triggers capability as separate and not yet implemented, keeping the two lines un-blurred per the issue's guidance.

/logout#43

commands/logout.rs

  • Expanded from "clear credentials" to a structured LogoutReport:
    • Keychain + credentials.json cleared (via existing auth::oauth_logout).
    • Onboarding state reset in place (update + reset_for_logout) so display_name — a preference, not an identity artifact — survives.
    • ANTHROPIC_API_KEY / ANTHROPIC_AUTH_TOKEN env overrides detected and surfaced as follow-up.
    • Managed (policy) settings path reported but never touched — those are admin-owned.
  • Idempotent: returns a friendly no-op report when nothing is present.

/team-onboarding#63

commands/team_onboarding.rs

  • Generates a Markdown teammate guide grounded in real local state, not a template: CLAUDE.md, README.md, git origin/branch, skills registry, teams on disk, scheduled tasks, onboarding status.
  • /team-onboarding save [path] writes to a file (default ONBOARDING_TEAM.md).
  • Risk areas are keyed off project state (e.g. missing CLAUDE.md, incomplete auth onboarding, first-run flag).

Tests

  • 21 scheduler (interval + task + store) + 4 onboarding unit tests
  • 9 /loop + 10 /schedule + 9 /logout + 14 /team-onboarding handler tests
  • Command-registry assertions for new names/aliases (loop, schedule + cron, team-onboarding + teamonboarding)
  • Full non-UI suite passes serially (1253/1253). The 12 failures seen under parallel runs are pre-existing concurrency flakes in unrelated modules (teams::, commands::branch, tools::worktree, etc.) — verified by running them in isolation on both base and HEAD.

Test plan

  • cargo build -p claude-code-rs — clean (only 2 pre-existing warnings in web/handlers.rs)
  • cargo test -p claude-code-rs --bin claude-code-rs services::scheduler
  • cargo test -p claude-code-rs --bin claude-code-rs services::onboarding
  • cargo test -p claude-code-rs --bin claude-code-rs commands::loop_cmd
  • cargo test -p claude-code-rs --bin claude-code-rs commands::schedule
  • cargo test -p claude-code-rs --bin claude-code-rs commands::logout
  • cargo test -p claude-code-rs --bin claude-code-rs commands::team_onboarding
  • cargo test -p claude-code-rs --bin claude-code-rs commands::tests (registry)
  • cargo test -p claude-code-rs --bin claude-code-rs -- --test-threads=1 (full suite serially)

Reviewer notes

  • On-disk layout: scheduled tasks live at {data_root}/scheduled_tasks.json, guarded by a sibling .json.lock file; onboarding state at {data_root}/onboarding.json. Both use atomic write-to-tmp + rename so crashes mid-write don't corrupt state.
  • SchedulerKind::RemoteTrigger is reserved in the enum even though it's rejected at insert time today — this means on-disk state survives when the remote capability lands, without a breaking schema change.
  • /team-onboarding reads project state at invocation time; it never caches, so regenerating always reflects the current repo.

🤖 Generated with Claude Code

…sei#43 Crsei#58 Crsei#60 Crsei#63)

Ship scheduling/automation and onboarding/logout groups as one change
because they share infrastructure:

- services/scheduler — JSON-backed recurring-task store with interval
  parsing, cross-process lockfile, and atomic writes. Used by both
  /loop (user-friendly wrapper, runs payload once immediately when it's
  a plain prompt) and /schedule (raw local-cron management; `remote`
  subcommand is explicitly refused until OAuth/remote-agent groundwork
  lands).
- services/onboarding — shared onboarding state (`onboarding.json`)
  consumed by the expanded /logout reset flow and by /team-onboarding
  for tailored guide generation.
- /logout — structured `LogoutReport` that clears credentials, resets
  onboarding (preserving display_name), and surfaces env overrides +
  managed-settings path without touching policy files.
- /team-onboarding — Markdown guide grounded in real local state
  (CLAUDE.md, README.md, git origin/branch, skills registry, teams on
  disk, scheduled tasks). `save [path]` writes to a file.

Tests: 21 scheduler + 4 onboarding + 9 loop + 10 schedule + 9 logout
+ 14 team-onboarding + registry assertions. Full non-UI suite passes
serially (1253/1253); parallel-run failures are pre-existing flakes
in unrelated modules.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Crsei
Crsei merged commit e082c80 into Crsei:rust-lite Apr 21, 2026
1 of 4 checks passed
yaohaowei0914 pushed a commit to yaohaowei0914/claude-code-rust that referenced this pull request Apr 21, 2026
Integrates the fork-agent infrastructure and ancillary command/IPC
updates that landed on rust-lite after this branch opened:

- PR Crsei#85: fork-agent infra + /btw /simplify /advisor (Crsei#33 Crsei#37 Crsei#62)
- PR Crsei#87: MCP/plugin/reload-plugins/ide/reload-plugins commands (Crsei#41 Crsei#44 Crsei#47 Crsei#49)
- PR Crsei#88: /loop /schedule /team-onboarding (Crsei#43 Crsei#58 Crsei#60 Crsei#63)

## Conflict resolution

Git's recursive merge handled every hunk on its own — each of the five
files flagged as overlapping had non-overlapping line ranges between
my workspace-split edits and rust-lite's feature edits:

- `crates/cc-engine/src/types/app_state.rs` — my move to cc-engine vs.
  advisor/fork-related AppState fields. Clean auto-merge.
- `crates/claude-code-rs/src/engine/agent/mod.rs` — my `cc_types::agent_*`
  import rewrites vs. rust-lite's `pub mod fork;` addition. Clean.
- `crates/claude-code-rs/src/engine/lifecycle/deps.rs` — my
  `cc_types::background_agents` retyping and `hook_runner()` impl vs.
  rust-lite's `advisor_model` stripping logic. Clean.
- `crates/claude-code-rs/src/query/deps.rs` — my `hook_runner()` /
  `drain_background_results` signature changes vs. rust-lite's new
  `ModelCallParams::advisor_model` field. Clean.
- `crates/claude-code-rs/src/query/loop_impl.rs` — my hook-runner-trait
  rewiring vs. rust-lite's advisor model plumbing. Clean.

All 40+ other touched files (api/*, commands/*, ide/*, ipc/*,
services/*, etc.) merged without conflict — they're in regions my
branch didn't touch.

## Verification

- `cargo check --workspace`: clean (2 pre-existing warnings).
- `cargo test -p cc-types`: 4/4 passing (teams + background_agents).
- `cargo test -p cc-engine`: status_line + types suite unchanged.
- `cargo test --bin claude-code-rs engine::agent query::loop_impl`:
  69/69 passing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants