shipwright-cli 3.1.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/code-reviewer.md +2 -0
- package/.claude/agents/devops-engineer.md +2 -0
- package/.claude/agents/doc-fleet-agent.md +2 -0
- package/.claude/agents/pipeline-agent.md +2 -0
- package/.claude/agents/shell-script-specialist.md +2 -0
- package/.claude/agents/test-specialist.md +2 -0
- package/.claude/hooks/agent-crash-capture.sh +32 -0
- package/.claude/hooks/post-tool-use.sh +3 -2
- package/.claude/hooks/pre-tool-use.sh +35 -3
- package/README.md +22 -8
- package/claude-code/hooks/config-change.sh +18 -0
- package/claude-code/hooks/instructions-reloaded.sh +7 -0
- package/claude-code/hooks/worktree-create.sh +25 -0
- package/claude-code/hooks/worktree-remove.sh +20 -0
- package/config/code-constitution.json +130 -0
- package/config/defaults.json +25 -2
- package/config/policy.json +1 -1
- package/dashboard/middleware/auth.ts +134 -0
- package/dashboard/middleware/constants.ts +21 -0
- package/dashboard/public/index.html +8 -6
- package/dashboard/public/styles.css +176 -97
- package/dashboard/routes/auth.ts +38 -0
- package/dashboard/server.ts +117 -25
- package/dashboard/services/config.ts +26 -0
- package/dashboard/services/db.ts +118 -0
- package/dashboard/src/canvas/pixel-agent.ts +298 -0
- package/dashboard/src/canvas/pixel-sprites.ts +440 -0
- package/dashboard/src/canvas/shipyard-effects.ts +367 -0
- package/dashboard/src/canvas/shipyard-scene.ts +616 -0
- package/dashboard/src/canvas/submarine-layout.ts +267 -0
- package/dashboard/src/components/header.ts +8 -7
- package/dashboard/src/core/api.ts +5 -0
- package/dashboard/src/core/router.ts +1 -0
- package/dashboard/src/design/submarine-theme.ts +253 -0
- package/dashboard/src/main.ts +2 -0
- package/dashboard/src/types/api.ts +12 -1
- package/dashboard/src/views/activity.ts +2 -1
- package/dashboard/src/views/metrics.ts +69 -1
- package/dashboard/src/views/shipyard.ts +39 -0
- package/dashboard/types/index.ts +166 -0
- package/docs/plans/2026-02-28-compound-audit-and-shipyard-design.md +186 -0
- package/docs/plans/2026-02-28-skipper-shipwright-implementation-plan.md +1182 -0
- package/docs/plans/2026-02-28-skipper-shipwright-integration-design.md +531 -0
- package/docs/plans/2026-03-01-ai-powered-skill-injection-design.md +298 -0
- package/docs/plans/2026-03-01-ai-powered-skill-injection-plan.md +1109 -0
- package/docs/plans/2026-03-01-capabilities-cleanup-plan.md +658 -0
- package/docs/plans/2026-03-01-clean-architecture-plan.md +924 -0
- package/docs/plans/2026-03-01-compound-audit-cascade-design.md +191 -0
- package/docs/plans/2026-03-01-compound-audit-cascade-plan.md +921 -0
- package/docs/plans/2026-03-01-deep-integration-plan.md +851 -0
- package/docs/plans/2026-03-01-pipeline-audit-trail-design.md +145 -0
- package/docs/plans/2026-03-01-pipeline-audit-trail-plan.md +770 -0
- package/docs/plans/2026-03-01-refined-depths-brand-design.md +382 -0
- package/docs/plans/2026-03-01-refined-depths-implementation.md +599 -0
- package/docs/plans/2026-03-01-skipper-kernel-integration-design.md +203 -0
- package/docs/plans/2026-03-01-unified-platform-design.md +272 -0
- package/docs/plans/2026-03-07-claude-code-feature-integration-design.md +189 -0
- package/docs/plans/2026-03-07-claude-code-feature-integration-plan.md +1165 -0
- package/docs/research/BACKLOG_QUICK_REFERENCE.md +352 -0
- package/docs/research/CUTTING_EDGE_RESEARCH_2026.md +546 -0
- package/docs/research/RESEARCH_INDEX.md +439 -0
- package/docs/research/RESEARCH_SOURCES.md +440 -0
- package/docs/research/RESEARCH_SUMMARY.txt +275 -0
- package/docs/superpowers/specs/2026-03-10-pipeline-quality-revolution-design.md +341 -0
- package/package.json +2 -2
- package/scripts/lib/adaptive-model.sh +427 -0
- package/scripts/lib/adaptive-timeout.sh +316 -0
- package/scripts/lib/audit-trail.sh +309 -0
- package/scripts/lib/auto-recovery.sh +471 -0
- package/scripts/lib/bandit-selector.sh +431 -0
- package/scripts/lib/bootstrap.sh +104 -2
- package/scripts/lib/causal-graph.sh +455 -0
- package/scripts/lib/compat.sh +126 -0
- package/scripts/lib/compound-audit.sh +337 -0
- package/scripts/lib/constitutional.sh +454 -0
- package/scripts/lib/context-budget.sh +359 -0
- package/scripts/lib/convergence.sh +594 -0
- package/scripts/lib/cost-optimizer.sh +634 -0
- package/scripts/lib/daemon-adaptive.sh +14 -2
- package/scripts/lib/daemon-dispatch.sh +106 -17
- package/scripts/lib/daemon-failure.sh +34 -4
- package/scripts/lib/daemon-patrol.sh +25 -4
- package/scripts/lib/daemon-poll-github.sh +361 -0
- package/scripts/lib/daemon-poll-health.sh +299 -0
- package/scripts/lib/daemon-poll.sh +27 -611
- package/scripts/lib/daemon-state.sh +119 -66
- package/scripts/lib/daemon-triage.sh +10 -0
- package/scripts/lib/dod-scorecard.sh +442 -0
- package/scripts/lib/error-actionability.sh +300 -0
- package/scripts/lib/formal-spec.sh +461 -0
- package/scripts/lib/helpers.sh +180 -5
- package/scripts/lib/intent-analysis.sh +409 -0
- package/scripts/lib/loop-convergence.sh +350 -0
- package/scripts/lib/loop-iteration.sh +682 -0
- package/scripts/lib/loop-progress.sh +48 -0
- package/scripts/lib/loop-restart.sh +185 -0
- package/scripts/lib/memory-effectiveness.sh +506 -0
- package/scripts/lib/mutation-executor.sh +352 -0
- package/scripts/lib/outcome-feedback.sh +521 -0
- package/scripts/lib/pipeline-cli.sh +336 -0
- package/scripts/lib/pipeline-commands.sh +1216 -0
- package/scripts/lib/pipeline-detection.sh +101 -3
- package/scripts/lib/pipeline-execution.sh +897 -0
- package/scripts/lib/pipeline-github.sh +28 -3
- package/scripts/lib/pipeline-intelligence-compound.sh +431 -0
- package/scripts/lib/pipeline-intelligence-scoring.sh +407 -0
- package/scripts/lib/pipeline-intelligence-skip.sh +181 -0
- package/scripts/lib/pipeline-intelligence.sh +104 -1138
- package/scripts/lib/pipeline-quality-bash-compat.sh +182 -0
- package/scripts/lib/pipeline-quality-checks.sh +17 -711
- package/scripts/lib/pipeline-quality-gates.sh +563 -0
- package/scripts/lib/pipeline-stages-build.sh +730 -0
- package/scripts/lib/pipeline-stages-delivery.sh +965 -0
- package/scripts/lib/pipeline-stages-intake.sh +1133 -0
- package/scripts/lib/pipeline-stages-monitor.sh +407 -0
- package/scripts/lib/pipeline-stages-review.sh +1022 -0
- package/scripts/lib/pipeline-stages.sh +161 -2901
- package/scripts/lib/pipeline-state.sh +36 -5
- package/scripts/lib/pipeline-util.sh +487 -0
- package/scripts/lib/policy-learner.sh +438 -0
- package/scripts/lib/process-reward.sh +493 -0
- package/scripts/lib/project-detect.sh +649 -0
- package/scripts/lib/quality-profile.sh +334 -0
- package/scripts/lib/recruit-commands.sh +885 -0
- package/scripts/lib/recruit-learning.sh +739 -0
- package/scripts/lib/recruit-roles.sh +648 -0
- package/scripts/lib/reward-aggregator.sh +458 -0
- package/scripts/lib/rl-optimizer.sh +362 -0
- package/scripts/lib/root-cause.sh +427 -0
- package/scripts/lib/scope-enforcement.sh +445 -0
- package/scripts/lib/session-restart.sh +493 -0
- package/scripts/lib/skill-memory.sh +300 -0
- package/scripts/lib/skill-registry.sh +775 -0
- package/scripts/lib/spec-driven.sh +476 -0
- package/scripts/lib/test-helpers.sh +18 -7
- package/scripts/lib/test-holdout.sh +429 -0
- package/scripts/lib/test-optimizer.sh +511 -0
- package/scripts/shipwright-file-suggest.sh +45 -0
- package/scripts/skills/adversarial-quality.md +61 -0
- package/scripts/skills/api-design.md +44 -0
- package/scripts/skills/architecture-design.md +50 -0
- package/scripts/skills/brainstorming.md +43 -0
- package/scripts/skills/data-pipeline.md +44 -0
- package/scripts/skills/deploy-safety.md +64 -0
- package/scripts/skills/documentation.md +38 -0
- package/scripts/skills/frontend-design.md +45 -0
- package/scripts/skills/generated/.gitkeep +0 -0
- package/scripts/skills/generated/_refinements/.gitkeep +0 -0
- package/scripts/skills/generated/_refinements/adversarial-quality.patch.md +3 -0
- package/scripts/skills/generated/_refinements/architecture-design.patch.md +3 -0
- package/scripts/skills/generated/_refinements/brainstorming.patch.md +3 -0
- package/scripts/skills/generated/cli-version-management.md +29 -0
- package/scripts/skills/generated/collection-system-validation.md +99 -0
- package/scripts/skills/generated/large-scale-c-refactoring-coordination.md +97 -0
- package/scripts/skills/generated/pattern-matching-similarity-scoring.md +195 -0
- package/scripts/skills/generated/test-parallelization-detection.md +65 -0
- package/scripts/skills/observability.md +79 -0
- package/scripts/skills/performance.md +48 -0
- package/scripts/skills/pr-quality.md +49 -0
- package/scripts/skills/product-thinking.md +43 -0
- package/scripts/skills/security-audit.md +49 -0
- package/scripts/skills/systematic-debugging.md +40 -0
- package/scripts/skills/testing-strategy.md +47 -0
- package/scripts/skills/two-stage-review.md +52 -0
- package/scripts/skills/validation-thoroughness.md +55 -0
- package/scripts/sw +9 -3
- package/scripts/sw-activity.sh +9 -8
- package/scripts/sw-adaptive.sh +8 -7
- package/scripts/sw-adversarial.sh +2 -1
- package/scripts/sw-architecture-enforcer.sh +3 -1
- package/scripts/sw-auth.sh +12 -2
- package/scripts/sw-autonomous.sh +5 -1
- package/scripts/sw-changelog.sh +4 -1
- package/scripts/sw-checkpoint.sh +2 -1
- package/scripts/sw-ci.sh +15 -6
- package/scripts/sw-cleanup.sh +4 -26
- package/scripts/sw-code-review.sh +45 -20
- package/scripts/sw-connect.sh +2 -1
- package/scripts/sw-context.sh +2 -1
- package/scripts/sw-cost.sh +107 -5
- package/scripts/sw-daemon.sh +71 -11
- package/scripts/sw-dashboard.sh +3 -1
- package/scripts/sw-db.sh +71 -20
- package/scripts/sw-decide.sh +8 -2
- package/scripts/sw-decompose.sh +360 -17
- package/scripts/sw-deps.sh +4 -1
- package/scripts/sw-developer-simulation.sh +4 -1
- package/scripts/sw-discovery.sh +378 -5
- package/scripts/sw-doc-fleet.sh +4 -1
- package/scripts/sw-docs-agent.sh +3 -1
- package/scripts/sw-docs.sh +2 -1
- package/scripts/sw-doctor.sh +453 -2
- package/scripts/sw-dora.sh +4 -1
- package/scripts/sw-durable.sh +12 -7
- package/scripts/sw-e2e-orchestrator.sh +17 -16
- package/scripts/sw-eventbus.sh +13 -4
- package/scripts/sw-evidence.sh +364 -12
- package/scripts/sw-feedback.sh +550 -9
- package/scripts/sw-fix.sh +20 -1
- package/scripts/sw-fleet-discover.sh +6 -2
- package/scripts/sw-fleet-viz.sh +9 -4
- package/scripts/sw-fleet.sh +5 -1
- package/scripts/sw-github-app.sh +18 -4
- package/scripts/sw-github-checks.sh +3 -2
- package/scripts/sw-github-deploy.sh +3 -2
- package/scripts/sw-github-graphql.sh +18 -7
- package/scripts/sw-guild.sh +5 -1
- package/scripts/sw-heartbeat.sh +5 -30
- package/scripts/sw-hello.sh +67 -0
- package/scripts/sw-hygiene.sh +10 -3
- package/scripts/sw-incident.sh +273 -5
- package/scripts/sw-init.sh +18 -2
- package/scripts/sw-instrument.sh +10 -2
- package/scripts/sw-intelligence.sh +44 -7
- package/scripts/sw-jira.sh +5 -1
- package/scripts/sw-launchd.sh +2 -1
- package/scripts/sw-linear.sh +4 -1
- package/scripts/sw-logs.sh +4 -1
- package/scripts/sw-loop.sh +436 -1076
- package/scripts/sw-memory.sh +357 -3
- package/scripts/sw-mission-control.sh +6 -1
- package/scripts/sw-model-router.sh +483 -27
- package/scripts/sw-otel.sh +15 -4
- package/scripts/sw-oversight.sh +14 -5
- package/scripts/sw-patrol-meta.sh +334 -0
- package/scripts/sw-pipeline-composer.sh +7 -1
- package/scripts/sw-pipeline-vitals.sh +12 -6
- package/scripts/sw-pipeline.sh +54 -2653
- package/scripts/sw-pm.sh +16 -8
- package/scripts/sw-pr-lifecycle.sh +2 -1
- package/scripts/sw-predictive.sh +17 -5
- package/scripts/sw-prep.sh +185 -2
- package/scripts/sw-ps.sh +5 -25
- package/scripts/sw-public-dashboard.sh +17 -4
- package/scripts/sw-quality.sh +14 -6
- package/scripts/sw-reaper.sh +8 -25
- package/scripts/sw-recruit.sh +156 -2303
- package/scripts/sw-regression.sh +19 -12
- package/scripts/sw-release-manager.sh +3 -1
- package/scripts/sw-release.sh +4 -1
- package/scripts/sw-remote.sh +3 -1
- package/scripts/sw-replay.sh +7 -1
- package/scripts/sw-retro.sh +158 -1
- package/scripts/sw-review-rerun.sh +3 -1
- package/scripts/sw-scale.sh +14 -5
- package/scripts/sw-security-audit.sh +6 -1
- package/scripts/sw-self-optimize.sh +173 -6
- package/scripts/sw-session.sh +9 -3
- package/scripts/sw-setup.sh +3 -1
- package/scripts/sw-stall-detector.sh +406 -0
- package/scripts/sw-standup.sh +15 -7
- package/scripts/sw-status.sh +3 -1
- package/scripts/sw-strategic.sh +14 -6
- package/scripts/sw-stream.sh +13 -4
- package/scripts/sw-swarm.sh +20 -7
- package/scripts/sw-team-stages.sh +13 -6
- package/scripts/sw-templates.sh +7 -31
- package/scripts/sw-testgen.sh +17 -6
- package/scripts/sw-tmux-pipeline.sh +4 -1
- package/scripts/sw-tmux-role-color.sh +2 -0
- package/scripts/sw-tmux-status.sh +1 -1
- package/scripts/sw-tmux.sh +37 -1
- package/scripts/sw-trace.sh +3 -1
- package/scripts/sw-tracker-github.sh +3 -0
- package/scripts/sw-tracker-jira.sh +3 -0
- package/scripts/sw-tracker-linear.sh +3 -0
- package/scripts/sw-tracker.sh +3 -1
- package/scripts/sw-triage.sh +3 -2
- package/scripts/sw-upgrade.sh +3 -1
- package/scripts/sw-ux.sh +5 -2
- package/scripts/sw-webhook.sh +5 -2
- package/scripts/sw-widgets.sh +9 -4
- package/scripts/sw-worktree.sh +15 -3
- package/scripts/test-skill-injection.sh +1233 -0
- package/templates/pipelines/autonomous.json +27 -3
- package/templates/pipelines/cost-aware.json +34 -8
- package/templates/pipelines/deployed.json +12 -0
- package/templates/pipelines/enterprise.json +12 -0
- package/templates/pipelines/fast.json +6 -0
- package/templates/pipelines/full.json +27 -3
- package/templates/pipelines/hotfix.json +6 -0
- package/templates/pipelines/standard.json +12 -0
- package/templates/pipelines/tdd.json +12 -0
|
@@ -0,0 +1,924 @@
|
|
|
1
|
+
# Stream 1: Clean Architecture Implementation Plan
|
|
2
|
+
|
|
3
|
+
> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
|
|
4
|
+
|
|
5
|
+
**Goal:** Decompose 5 Skipper Rust god-files into domain-oriented module trees without changing any behavior.
|
|
6
|
+
|
|
7
|
+
**Architecture:** Pure structural refactoring. Each god-file becomes a module directory. Functions move to domain-grouped files. The original file becomes a thin re-export module. All 2,190+ tests must continue to pass after every task.
|
|
8
|
+
|
|
9
|
+
**Tech Stack:** Rust modules, `pub use` re-exports, `mod` declarations.
|
|
10
|
+
|
|
11
|
+
**Important:** All file paths are relative to `skipper/`. Run all commands from the `skipper/` directory.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
### Task 1: Decompose routes.rs — Create Module Structure
|
|
16
|
+
|
|
17
|
+
**Files:**
|
|
18
|
+
|
|
19
|
+
- Create: `crates/skipper-api/src/routes/mod.rs`
|
|
20
|
+
- Create: `crates/skipper-api/src/routes/health.rs`
|
|
21
|
+
- Modify: `crates/skipper-api/src/server.rs` (update `mod routes` to `mod routes` pointing to directory)
|
|
22
|
+
|
|
23
|
+
**Step 1: Create the routes directory and mod.rs**
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
mkdir -p crates/skipper-api/src/routes
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Step 2: Copy routes.rs to routes/mod.rs**
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
cp crates/skipper-api/src/routes.rs crates/skipper-api/src/routes/mod.rs
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Step 3: Delete the original routes.rs**
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
rm crates/skipper-api/src/routes.rs
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Rust's module system will automatically resolve `mod routes` to `routes/mod.rs`.
|
|
42
|
+
|
|
43
|
+
**Step 4: Verify everything compiles and tests pass**
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
cargo build --workspace --lib
|
|
47
|
+
cargo test --workspace
|
|
48
|
+
cargo clippy --workspace --all-targets -- -D warnings
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Expected: All pass. This is a no-op restructure — `routes/mod.rs` has identical content to the old `routes.rs`.
|
|
52
|
+
|
|
53
|
+
**Step 5: Commit**
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
git add -A crates/skipper-api/src/routes/ crates/skipper-api/src/routes.rs
|
|
57
|
+
git commit -m "refactor(api): convert routes.rs to routes/ module directory"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
### Task 2: Extract Health & Status Routes
|
|
63
|
+
|
|
64
|
+
**Files:**
|
|
65
|
+
|
|
66
|
+
- Create: `crates/skipper-api/src/routes/health.rs`
|
|
67
|
+
- Modify: `crates/skipper-api/src/routes/mod.rs`
|
|
68
|
+
|
|
69
|
+
**Step 1: Create health.rs with the health/status functions**
|
|
70
|
+
|
|
71
|
+
Move these functions from `mod.rs` to `health.rs`:
|
|
72
|
+
|
|
73
|
+
- `health` (line ~2490)
|
|
74
|
+
- `health_detail` (line ~2510)
|
|
75
|
+
- `status` (line ~454)
|
|
76
|
+
- `shutdown` (line ~488)
|
|
77
|
+
- `version` (line ~867)
|
|
78
|
+
- `prometheus_metrics` (line ~2550)
|
|
79
|
+
|
|
80
|
+
At the top of `health.rs`, add the imports these functions need:
|
|
81
|
+
|
|
82
|
+
```rust
|
|
83
|
+
use crate::types::*;
|
|
84
|
+
use axum::extract::State;
|
|
85
|
+
use axum::http::StatusCode;
|
|
86
|
+
use axum::response::IntoResponse;
|
|
87
|
+
use axum::Json;
|
|
88
|
+
use std::sync::Arc;
|
|
89
|
+
use std::time::Instant;
|
|
90
|
+
|
|
91
|
+
use super::AppState;
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Step 2: In mod.rs, add the module declaration and re-export**
|
|
95
|
+
|
|
96
|
+
At the top of `mod.rs`, add:
|
|
97
|
+
|
|
98
|
+
```rust
|
|
99
|
+
mod health;
|
|
100
|
+
pub use health::*;
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Then delete the moved functions from `mod.rs`.
|
|
104
|
+
|
|
105
|
+
**Step 3: Verify**
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
cargo build --workspace --lib
|
|
109
|
+
cargo test --workspace
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Step 4: Commit**
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
git add crates/skipper-api/src/routes/
|
|
116
|
+
git commit -m "refactor(api): extract health & status routes to routes/health.rs"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
### Task 3: Extract Budget & Usage Routes
|
|
122
|
+
|
|
123
|
+
**Files:**
|
|
124
|
+
|
|
125
|
+
- Create: `crates/skipper-api/src/routes/budget.rs`
|
|
126
|
+
- Modify: `crates/skipper-api/src/routes/mod.rs`
|
|
127
|
+
|
|
128
|
+
**Step 1: Create budget.rs**
|
|
129
|
+
|
|
130
|
+
Move these functions:
|
|
131
|
+
|
|
132
|
+
- `budget_status` (~4154)
|
|
133
|
+
- `update_budget` (~4163)
|
|
134
|
+
- `agent_budget_status` (~4196)
|
|
135
|
+
- `agent_budget_ranking` (~4251)
|
|
136
|
+
- `usage_stats` (~4055)
|
|
137
|
+
- `usage_summary` (~4080)
|
|
138
|
+
- `usage_by_model` (~4100)
|
|
139
|
+
- `usage_daily` (~4122)
|
|
140
|
+
|
|
141
|
+
Add imports and `use super::AppState;`.
|
|
142
|
+
|
|
143
|
+
**Step 2: In mod.rs, add `mod budget; pub use budget::*;`**
|
|
144
|
+
|
|
145
|
+
Delete moved functions from `mod.rs`.
|
|
146
|
+
|
|
147
|
+
**Step 3: Verify**
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
cargo build --workspace --lib && cargo test --workspace
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**Step 4: Commit**
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
git add crates/skipper-api/src/routes/
|
|
157
|
+
git commit -m "refactor(api): extract budget & usage routes to routes/budget.rs"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
### Task 4: Extract Workflow & Trigger Routes
|
|
163
|
+
|
|
164
|
+
**Files:**
|
|
165
|
+
|
|
166
|
+
- Create: `crates/skipper-api/src/routes/workflows.rs`
|
|
167
|
+
- Modify: `crates/skipper-api/src/routes/mod.rs`
|
|
168
|
+
|
|
169
|
+
**Step 1: Create workflows.rs**
|
|
170
|
+
|
|
171
|
+
Move these functions:
|
|
172
|
+
|
|
173
|
+
- `create_workflow` (~508)
|
|
174
|
+
- `list_workflows` (~591)
|
|
175
|
+
- `run_workflow` (~609)
|
|
176
|
+
- `list_workflow_runs` (~646)
|
|
177
|
+
- `create_trigger` (~672)
|
|
178
|
+
- `list_triggers` (~745)
|
|
179
|
+
- `delete_trigger` (~773)
|
|
180
|
+
- `update_trigger` (~4408)
|
|
181
|
+
- `list_cron_jobs` (~8292)
|
|
182
|
+
- `create_cron_job` (~8324)
|
|
183
|
+
- `delete_cron_job` (~8342)
|
|
184
|
+
- `toggle_cron_job` (~8371)
|
|
185
|
+
- `cron_job_status` (~8402)
|
|
186
|
+
|
|
187
|
+
**Step 2: Add module declaration, re-export, delete from mod.rs**
|
|
188
|
+
|
|
189
|
+
**Step 3: Verify and commit**
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
cargo build --workspace --lib && cargo test --workspace
|
|
193
|
+
git add crates/skipper-api/src/routes/
|
|
194
|
+
git commit -m "refactor(api): extract workflow & trigger routes to routes/workflows.rs"
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
### Task 5: Extract Channel Routes
|
|
200
|
+
|
|
201
|
+
**Files:**
|
|
202
|
+
|
|
203
|
+
- Create: `crates/skipper-api/src/routes/channels.rs`
|
|
204
|
+
- Modify: `crates/skipper-api/src/routes/mod.rs`
|
|
205
|
+
|
|
206
|
+
**Step 1: Create channels.rs**
|
|
207
|
+
|
|
208
|
+
Move these functions AND the channel registry data:
|
|
209
|
+
|
|
210
|
+
- `list_channels` (~1782)
|
|
211
|
+
- `configure_channel` (~1834)
|
|
212
|
+
- `remove_channel` (~1934)
|
|
213
|
+
- `test_channel` (~1997)
|
|
214
|
+
- `reload_channels` (~2040)
|
|
215
|
+
- `whatsapp_qr_start` (~2068)
|
|
216
|
+
- `whatsapp_qr_status` (~2121)
|
|
217
|
+
- `list_templates` (~2263)
|
|
218
|
+
- `get_template` (~2301)
|
|
219
|
+
- `FieldType` enum (~1047)
|
|
220
|
+
- `ChannelField` struct (~1067)
|
|
221
|
+
- `ChannelMeta` struct (~1079)
|
|
222
|
+
- `CHANNEL_REGISTRY` const (~1096-1780)
|
|
223
|
+
|
|
224
|
+
This is the biggest extraction — ~750 lines of functions + ~700 lines of channel registry data.
|
|
225
|
+
|
|
226
|
+
**Step 2: Add module declaration, re-export, delete from mod.rs**
|
|
227
|
+
|
|
228
|
+
**Step 3: Verify and commit**
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
cargo build --workspace --lib && cargo test --workspace
|
|
232
|
+
git add crates/skipper-api/src/routes/
|
|
233
|
+
git commit -m "refactor(api): extract channel routes & registry to routes/channels.rs"
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
### Task 6: Extract Hands Routes
|
|
239
|
+
|
|
240
|
+
**Files:**
|
|
241
|
+
|
|
242
|
+
- Create: `crates/skipper-api/src/routes/hands.rs`
|
|
243
|
+
- Modify: `crates/skipper-api/src/routes/mod.rs`
|
|
244
|
+
|
|
245
|
+
**Step 1: Create hands.rs**
|
|
246
|
+
|
|
247
|
+
Move:
|
|
248
|
+
|
|
249
|
+
- `list_hands` (~3038)
|
|
250
|
+
- `list_active_hands` (~3073)
|
|
251
|
+
- `get_hand` (~3094)
|
|
252
|
+
- `check_hand_deps` (~3165)
|
|
253
|
+
- `install_hand_deps` (~3210)
|
|
254
|
+
- `activate_hand` (~3446)
|
|
255
|
+
- `pause_hand` (~3473)
|
|
256
|
+
- `resume_hand` (~3490)
|
|
257
|
+
- `deactivate_hand` (~3507)
|
|
258
|
+
- `hand_stats` (~3524)
|
|
259
|
+
- `hand_instance_browser` (~3594)
|
|
260
|
+
|
|
261
|
+
**Step 2: Add module declaration, re-export, delete from mod.rs**
|
|
262
|
+
|
|
263
|
+
**Step 3: Verify and commit**
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
cargo build --workspace --lib && cargo test --workspace
|
|
267
|
+
git add crates/skipper-api/src/routes/
|
|
268
|
+
git commit -m "refactor(api): extract hands routes to routes/hands.rs"
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
### Task 7: Extract Skills Routes
|
|
274
|
+
|
|
275
|
+
**Files:**
|
|
276
|
+
|
|
277
|
+
- Create: `crates/skipper-api/src/routes/skills.rs`
|
|
278
|
+
- Modify: `crates/skipper-api/src/routes/mod.rs`
|
|
279
|
+
|
|
280
|
+
**Step 1: Create skills.rs**
|
|
281
|
+
|
|
282
|
+
Move:
|
|
283
|
+
|
|
284
|
+
- `list_skills` (~2627)
|
|
285
|
+
- `install_skill` (~2669)
|
|
286
|
+
- `uninstall_skill` (~2701)
|
|
287
|
+
- `marketplace_search` (~2726)
|
|
288
|
+
- `clawhub_search` (~2768)
|
|
289
|
+
- `clawhub_browse` (~2830)
|
|
290
|
+
- `clawhub_skill_detail` (~2880)
|
|
291
|
+
- `clawhub_install` (~2943)
|
|
292
|
+
- `create_skill` (~6160)
|
|
293
|
+
- `get_agent_skills` (~5653)
|
|
294
|
+
- `set_agent_skills` (~5697)
|
|
295
|
+
|
|
296
|
+
**Step 2: Add module declaration, re-export, delete from mod.rs**
|
|
297
|
+
|
|
298
|
+
**Step 3: Verify and commit**
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
cargo build --workspace --lib && cargo test --workspace
|
|
302
|
+
git add crates/skipper-api/src/routes/
|
|
303
|
+
git commit -m "refactor(api): extract skills routes to routes/skills.rs"
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
### Task 8: Extract Agent Routes
|
|
309
|
+
|
|
310
|
+
**Files:**
|
|
311
|
+
|
|
312
|
+
- Create: `crates/skipper-api/src/routes/agents.rs`
|
|
313
|
+
- Modify: `crates/skipper-api/src/routes/mod.rs`
|
|
314
|
+
|
|
315
|
+
**Step 1: Create agents.rs**
|
|
316
|
+
|
|
317
|
+
Move all agent lifecycle + messaging + session functions:
|
|
318
|
+
|
|
319
|
+
- `spawn_agent` (~39)
|
|
320
|
+
- `list_agents` (~114)
|
|
321
|
+
- `resolve_attachments` (~146)
|
|
322
|
+
- `inject_attachments_into_session` (~197)
|
|
323
|
+
- `send_message` (~231)
|
|
324
|
+
- `get_agent_session` (~303)
|
|
325
|
+
- `kill_agent` (~424)
|
|
326
|
+
- `get_agent` (~884)
|
|
327
|
+
- `set_agent_mode` (~831)
|
|
328
|
+
- `send_message_stream` (~942) — this is the 839-line function
|
|
329
|
+
- `update_agent` (~4450)
|
|
330
|
+
- `update_agent_identity` (~6979)
|
|
331
|
+
- `patch_agent_config` (~7058)
|
|
332
|
+
- `clone_agent` (~7227)
|
|
333
|
+
- `list_agent_files` (~7331)
|
|
334
|
+
- `get_agent_file` (~7385)
|
|
335
|
+
- `set_agent_file` (~7482)
|
|
336
|
+
- `upload_file` (~7636)
|
|
337
|
+
- `serve_upload` (~7764)
|
|
338
|
+
- All session management: `list_agent_sessions`, `create_agent_session`, `switch_agent_session`, `reset_session`, `compact_session`, `stop_agent`
|
|
339
|
+
- All related request/response structs
|
|
340
|
+
|
|
341
|
+
**Step 2: Add module declaration, re-export, delete from mod.rs**
|
|
342
|
+
|
|
343
|
+
**Step 3: Verify and commit**
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
cargo build --workspace --lib && cargo test --workspace
|
|
347
|
+
git add crates/skipper-api/src/routes/
|
|
348
|
+
git commit -m "refactor(api): extract agent routes to routes/agents.rs"
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
### Task 9: Extract Network & A2A Routes
|
|
354
|
+
|
|
355
|
+
**Files:**
|
|
356
|
+
|
|
357
|
+
- Create: `crates/skipper-api/src/routes/network.rs`
|
|
358
|
+
- Modify: `crates/skipper-api/src/routes/mod.rs`
|
|
359
|
+
|
|
360
|
+
**Step 1: Create network.rs**
|
|
361
|
+
|
|
362
|
+
Move:
|
|
363
|
+
|
|
364
|
+
- `list_peers` (~3939)
|
|
365
|
+
- `network_status` (~3969)
|
|
366
|
+
- `a2a_agent_card` (~5018)
|
|
367
|
+
- `a2a_list_agents` (~5044)
|
|
368
|
+
- `a2a_send_task` (~5067)
|
|
369
|
+
- `a2a_get_task` (~5160)
|
|
370
|
+
- `a2a_cancel_task` (~5177)
|
|
371
|
+
- `a2a_list_external_agents` (~5203)
|
|
372
|
+
- `a2a_discover_external` (~5225)
|
|
373
|
+
- `a2a_send_external` (~5273)
|
|
374
|
+
- `a2a_external_task_status` (~5311)
|
|
375
|
+
- `mcp_http` (~5345)
|
|
376
|
+
|
|
377
|
+
**Step 2: Add module declaration, re-export, delete from mod.rs**
|
|
378
|
+
|
|
379
|
+
**Step 3: Verify and commit**
|
|
380
|
+
|
|
381
|
+
```bash
|
|
382
|
+
cargo build --workspace --lib && cargo test --workspace
|
|
383
|
+
git add crates/skipper-api/src/routes/
|
|
384
|
+
git commit -m "refactor(api): extract network & A2A routes to routes/network.rs"
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
### Task 10: Extract Remaining Routes
|
|
390
|
+
|
|
391
|
+
**Files:**
|
|
392
|
+
|
|
393
|
+
- Create: `crates/skipper-api/src/routes/settings.rs`
|
|
394
|
+
- Create: `crates/skipper-api/src/routes/security.rs`
|
|
395
|
+
- Modify: `crates/skipper-api/src/routes/mod.rs`
|
|
396
|
+
|
|
397
|
+
**Step 1: Create settings.rs**
|
|
398
|
+
|
|
399
|
+
Move:
|
|
400
|
+
|
|
401
|
+
- `get_config` (~4032)
|
|
402
|
+
- `config_set` (~8107)
|
|
403
|
+
- `config_reload` (~7982)
|
|
404
|
+
- `config_schema` (~8023)
|
|
405
|
+
- `list_models` (~4688)
|
|
406
|
+
- `list_aliases` (~4764)
|
|
407
|
+
- `get_model` (~4792)
|
|
408
|
+
- `list_providers` (~4837)
|
|
409
|
+
- `add_custom_model` (~4891)
|
|
410
|
+
- `remove_custom_model` (~4987)
|
|
411
|
+
- `set_model` (~5615)
|
|
412
|
+
- `set_provider_key` (~5825)
|
|
413
|
+
- `delete_provider_key` (~5901)
|
|
414
|
+
- `test_provider` (~5956)
|
|
415
|
+
- `set_provider_url` (~6044)
|
|
416
|
+
- `list_profiles` (~805)
|
|
417
|
+
- `get_agent_mcp_servers`, `set_agent_mcp_servers`, `list_mcp_servers`
|
|
418
|
+
|
|
419
|
+
**Step 2: Create security.rs**
|
|
420
|
+
|
|
421
|
+
Move:
|
|
422
|
+
|
|
423
|
+
- `security_status` (~4503)
|
|
424
|
+
- `audit_recent` (~3761)
|
|
425
|
+
- `audit_verify` (~3797)
|
|
426
|
+
- `logs_stream` (~3837)
|
|
427
|
+
|
|
428
|
+
**Step 3: Move remaining into appropriate files or a misc.rs**
|
|
429
|
+
|
|
430
|
+
Move all remaining functions (integrations, schedules, approvals, webhooks, device pairing, commands, copilot OAuth, KV store, migrations, deliveries) into:
|
|
431
|
+
|
|
432
|
+
- Create: `crates/skipper-api/src/routes/integrations.rs`
|
|
433
|
+
- Create: `crates/skipper-api/src/routes/misc.rs` (for smaller domains like approvals, pairing, commands, copilot)
|
|
434
|
+
|
|
435
|
+
**Step 4: mod.rs should now be ~50 lines**
|
|
436
|
+
|
|
437
|
+
```rust
|
|
438
|
+
// crates/skipper-api/src/routes/mod.rs
|
|
439
|
+
mod agents;
|
|
440
|
+
mod budget;
|
|
441
|
+
mod channels;
|
|
442
|
+
mod hands;
|
|
443
|
+
mod health;
|
|
444
|
+
mod integrations;
|
|
445
|
+
mod misc;
|
|
446
|
+
mod network;
|
|
447
|
+
mod security;
|
|
448
|
+
mod settings;
|
|
449
|
+
mod skills;
|
|
450
|
+
mod workflows;
|
|
451
|
+
|
|
452
|
+
pub use agents::*;
|
|
453
|
+
pub use budget::*;
|
|
454
|
+
pub use channels::*;
|
|
455
|
+
pub use hands::*;
|
|
456
|
+
pub use health::*;
|
|
457
|
+
pub use integrations::*;
|
|
458
|
+
pub use misc::*;
|
|
459
|
+
pub use network::*;
|
|
460
|
+
pub use security::*;
|
|
461
|
+
pub use settings::*;
|
|
462
|
+
pub use skills::*;
|
|
463
|
+
pub use workflows::*;
|
|
464
|
+
|
|
465
|
+
// Shared types used across route modules
|
|
466
|
+
pub struct AppState { /* ... stays here ... */ }
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
**Step 5: Verify and commit**
|
|
470
|
+
|
|
471
|
+
```bash
|
|
472
|
+
cargo build --workspace --lib && cargo test --workspace
|
|
473
|
+
cargo clippy --workspace --all-targets -- -D warnings
|
|
474
|
+
git add crates/skipper-api/src/routes/
|
|
475
|
+
git commit -m "refactor(api): extract remaining routes, mod.rs is now ~50 lines"
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
### Task 11: Decompose kernel.rs — Create Module Structure
|
|
481
|
+
|
|
482
|
+
**Files:**
|
|
483
|
+
|
|
484
|
+
- Create: `crates/skipper-kernel/src/kernel/mod.rs`
|
|
485
|
+
- Modify: existing kernel references
|
|
486
|
+
|
|
487
|
+
**Step 1: Create the kernel directory and copy**
|
|
488
|
+
|
|
489
|
+
```bash
|
|
490
|
+
mkdir -p crates/skipper-kernel/src/kernel
|
|
491
|
+
cp crates/skipper-kernel/src/kernel.rs crates/skipper-kernel/src/kernel/mod.rs
|
|
492
|
+
rm crates/skipper-kernel/src/kernel.rs
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
**Step 2: Verify**
|
|
496
|
+
|
|
497
|
+
```bash
|
|
498
|
+
cargo build --workspace --lib && cargo test --workspace
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
**Step 3: Commit**
|
|
502
|
+
|
|
503
|
+
```bash
|
|
504
|
+
git add -A crates/skipper-kernel/src/kernel/ crates/skipper-kernel/src/kernel.rs
|
|
505
|
+
git commit -m "refactor(kernel): convert kernel.rs to kernel/ module directory"
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
---
|
|
509
|
+
|
|
510
|
+
### Task 12: Extract Kernel Agent Lifecycle
|
|
511
|
+
|
|
512
|
+
**Files:**
|
|
513
|
+
|
|
514
|
+
- Create: `crates/skipper-kernel/src/kernel/agents.rs`
|
|
515
|
+
- Modify: `crates/skipper-kernel/src/kernel/mod.rs`
|
|
516
|
+
|
|
517
|
+
**Step 1: Create agents.rs**
|
|
518
|
+
|
|
519
|
+
Move from the `impl SkipperKernel` block:
|
|
520
|
+
|
|
521
|
+
- `spawn_agent` (~971)
|
|
522
|
+
- `spawn_agent_with_parent` (~976)
|
|
523
|
+
- `verify_signed_manifest` (~1109)
|
|
524
|
+
- `kill_agent` (~2553)
|
|
525
|
+
- Agent-related helpers: `manifest_to_capabilities` (~4205), `infer_provider_from_model` (~4279)
|
|
526
|
+
|
|
527
|
+
These methods stay as `impl SkipperKernel` methods but in the new file:
|
|
528
|
+
|
|
529
|
+
```rust
|
|
530
|
+
// crates/skipper-kernel/src/kernel/agents.rs
|
|
531
|
+
use super::*;
|
|
532
|
+
|
|
533
|
+
impl SkipperKernel {
|
|
534
|
+
// moved methods here
|
|
535
|
+
}
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
**Step 2: In mod.rs, add `mod agents;`**
|
|
539
|
+
|
|
540
|
+
No `pub use` needed — the methods are on `SkipperKernel` which is defined in mod.rs.
|
|
541
|
+
|
|
542
|
+
**Step 3: Verify and commit**
|
|
543
|
+
|
|
544
|
+
```bash
|
|
545
|
+
cargo build --workspace --lib && cargo test --workspace
|
|
546
|
+
git add crates/skipper-kernel/src/kernel/
|
|
547
|
+
git commit -m "refactor(kernel): extract agent lifecycle to kernel/agents.rs"
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
---
|
|
551
|
+
|
|
552
|
+
### Task 13: Extract Kernel Messaging
|
|
553
|
+
|
|
554
|
+
**Files:**
|
|
555
|
+
|
|
556
|
+
- Create: `crates/skipper-kernel/src/kernel/messaging.rs`
|
|
557
|
+
- Modify: `crates/skipper-kernel/src/kernel/mod.rs`
|
|
558
|
+
|
|
559
|
+
**Step 1: Create messaging.rs**
|
|
560
|
+
|
|
561
|
+
Move from `impl SkipperKernel`:
|
|
562
|
+
|
|
563
|
+
- `send_message` (~1130)
|
|
564
|
+
- `send_message_with_handle` (~1145)
|
|
565
|
+
- `send_message_streaming` (~1218) — 401 lines, the largest method
|
|
566
|
+
- `execute_wasm_agent` (~1619)
|
|
567
|
+
- `execute_python_agent` (~1700)
|
|
568
|
+
- `execute_llm_agent` (~1758) — 311 lines
|
|
569
|
+
|
|
570
|
+
**Step 2: Add `mod messaging;` to mod.rs**
|
|
571
|
+
|
|
572
|
+
**Step 3: Verify and commit**
|
|
573
|
+
|
|
574
|
+
```bash
|
|
575
|
+
cargo build --workspace --lib && cargo test --workspace
|
|
576
|
+
git add crates/skipper-kernel/src/kernel/
|
|
577
|
+
git commit -m "refactor(kernel): extract messaging to kernel/messaging.rs"
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
---
|
|
581
|
+
|
|
582
|
+
### Task 14: Extract Kernel Sessions, Config, Hands
|
|
583
|
+
|
|
584
|
+
**Files:**
|
|
585
|
+
|
|
586
|
+
- Create: `crates/skipper-kernel/src/kernel/sessions.rs`
|
|
587
|
+
- Create: `crates/skipper-kernel/src/kernel/config.rs`
|
|
588
|
+
- Create: `crates/skipper-kernel/src/kernel/hands.rs`
|
|
589
|
+
- Modify: `crates/skipper-kernel/src/kernel/mod.rs`
|
|
590
|
+
|
|
591
|
+
**Step 1: Create sessions.rs**
|
|
592
|
+
|
|
593
|
+
Move: `reset_session`, `list_agent_sessions`, `create_agent_session`, `switch_agent_session`, `save_session_summary`, `compact_agent_session`, `context_report`, `stop_agent_run`
|
|
594
|
+
|
|
595
|
+
**Step 2: Create config.rs**
|
|
596
|
+
|
|
597
|
+
Move: `set_agent_model`, `set_agent_skills`, `set_agent_mcp_servers`, `session_usage_cost`, `reload_config`, `apply_hot_actions`, `list_bindings`, `add_binding`, `remove_binding`
|
|
598
|
+
|
|
599
|
+
**Step 3: Create hands.rs**
|
|
600
|
+
|
|
601
|
+
Move: `activate_hand`, `deactivate_hand`, `pause_hand`, `resume_hand`
|
|
602
|
+
|
|
603
|
+
**Step 4: Add module declarations to mod.rs**
|
|
604
|
+
|
|
605
|
+
**Step 5: Verify and commit**
|
|
606
|
+
|
|
607
|
+
```bash
|
|
608
|
+
cargo build --workspace --lib && cargo test --workspace
|
|
609
|
+
git add crates/skipper-kernel/src/kernel/
|
|
610
|
+
git commit -m "refactor(kernel): extract sessions, config, hands to separate modules"
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
---
|
|
614
|
+
|
|
615
|
+
### Task 15: Extract Kernel Background, Networking, Tools
|
|
616
|
+
|
|
617
|
+
**Files:**
|
|
618
|
+
|
|
619
|
+
- Create: `crates/skipper-kernel/src/kernel/background.rs`
|
|
620
|
+
- Create: `crates/skipper-kernel/src/kernel/networking.rs`
|
|
621
|
+
- Create: `crates/skipper-kernel/src/kernel/tools.rs`
|
|
622
|
+
- Modify: `crates/skipper-kernel/src/kernel/mod.rs`
|
|
623
|
+
|
|
624
|
+
**Step 1: Create background.rs**
|
|
625
|
+
|
|
626
|
+
Move: `start_background_agents`, `start_heartbeat_monitor`, `start_background_for_agent`
|
|
627
|
+
|
|
628
|
+
**Step 2: Create networking.rs**
|
|
629
|
+
|
|
630
|
+
Move: `start_ofp_node`, `connect_mcp_servers`, `reload_extension_mcps`, `reconnect_extension_mcp`, `run_extension_health_loop`, `resolve_driver`
|
|
631
|
+
|
|
632
|
+
Also move the `impl PeerHandle for SkipperKernel` block (~4898-4964).
|
|
633
|
+
|
|
634
|
+
**Step 3: Create tools.rs**
|
|
635
|
+
|
|
636
|
+
Move: `available_tools`, `reload_skills`, `build_skill_summary`, `build_mcp_summary`, `collect_prompt_context`
|
|
637
|
+
|
|
638
|
+
**Step 4: Extract KernelHandle trait impl**
|
|
639
|
+
|
|
640
|
+
Create: `crates/skipper-kernel/src/kernel/handle_impl.rs`
|
|
641
|
+
|
|
642
|
+
Move the entire `impl KernelHandle for SkipperKernel` block (~4409-4893, 28 methods).
|
|
643
|
+
|
|
644
|
+
**Step 5: mod.rs should now contain only**
|
|
645
|
+
|
|
646
|
+
- `SkipperKernel` struct definition (~100 lines)
|
|
647
|
+
- `DeliveryTracker` struct + impl (~90 lines)
|
|
648
|
+
- `boot()` and `boot_with_config()` methods (~490 lines)
|
|
649
|
+
- `shutdown()` method (~40 lines)
|
|
650
|
+
- `set_self_handle()` and `self_arc()` helpers
|
|
651
|
+
- Free functions: `ensure_workspace`, `generate_identity_files`, `read_identity_file`, `gethostname`, `append_daily_memory_log`, `shared_memory_agent_id`
|
|
652
|
+
- Module declarations
|
|
653
|
+
- Tests
|
|
654
|
+
|
|
655
|
+
Total: ~800-900 lines. Down from 5,177.
|
|
656
|
+
|
|
657
|
+
**Step 6: Verify and commit**
|
|
658
|
+
|
|
659
|
+
```bash
|
|
660
|
+
cargo build --workspace --lib && cargo test --workspace
|
|
661
|
+
cargo clippy --workspace --all-targets -- -D warnings
|
|
662
|
+
git add crates/skipper-kernel/src/kernel/
|
|
663
|
+
git commit -m "refactor(kernel): extract background, networking, tools, KernelHandle impl"
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
---
|
|
667
|
+
|
|
668
|
+
### Task 16: Decompose tool_runner.rs — Create Module Structure
|
|
669
|
+
|
|
670
|
+
**Files:**
|
|
671
|
+
|
|
672
|
+
- Create: `crates/skipper-runtime/src/tools/mod.rs`
|
|
673
|
+
- Modify: `crates/skipper-runtime/src/lib.rs` or parent module
|
|
674
|
+
|
|
675
|
+
**Step 1: Create the tools directory and copy**
|
|
676
|
+
|
|
677
|
+
```bash
|
|
678
|
+
mkdir -p crates/skipper-runtime/src/tools
|
|
679
|
+
cp crates/skipper-runtime/src/tool_runner.rs crates/skipper-runtime/src/tools/mod.rs
|
|
680
|
+
rm crates/skipper-runtime/src/tool_runner.rs
|
|
681
|
+
```
|
|
682
|
+
|
|
683
|
+
**Step 2: Update any `mod tool_runner` to `mod tools`**
|
|
684
|
+
|
|
685
|
+
Check `crates/skipper-runtime/src/lib.rs` for `pub mod tool_runner;` and change to `pub mod tools;`. Also update the re-export path.
|
|
686
|
+
|
|
687
|
+
Search for `use skipper_runtime::tool_runner::` across the workspace and update to `use skipper_runtime::tools::`.
|
|
688
|
+
|
|
689
|
+
**Step 3: Verify**
|
|
690
|
+
|
|
691
|
+
```bash
|
|
692
|
+
cargo build --workspace --lib && cargo test --workspace
|
|
693
|
+
```
|
|
694
|
+
|
|
695
|
+
**Step 4: Commit**
|
|
696
|
+
|
|
697
|
+
```bash
|
|
698
|
+
git add -A crates/skipper-runtime/src/tools/ crates/skipper-runtime/src/tool_runner.rs crates/skipper-runtime/src/lib.rs
|
|
699
|
+
git add -A crates/ # catch any import path updates
|
|
700
|
+
git commit -m "refactor(runtime): convert tool_runner.rs to tools/ module directory"
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
**Note:** If the module rename causes too many import changes across the workspace, an alternative is to keep the file as `tool_runner.rs` but create a `tool_runner/` directory instead. The key is creating the module structure, not the name.
|
|
704
|
+
|
|
705
|
+
---
|
|
706
|
+
|
|
707
|
+
### Task 17: Extract Tool Implementations by Category
|
|
708
|
+
|
|
709
|
+
**Files:**
|
|
710
|
+
|
|
711
|
+
- Create: `crates/skipper-runtime/src/tools/filesystem.rs`
|
|
712
|
+
- Create: `crates/skipper-runtime/src/tools/web.rs`
|
|
713
|
+
- Create: `crates/skipper-runtime/src/tools/shell.rs`
|
|
714
|
+
- Create: `crates/skipper-runtime/src/tools/agents.rs`
|
|
715
|
+
- Create: `crates/skipper-runtime/src/tools/media.rs`
|
|
716
|
+
- Create: `crates/skipper-runtime/src/tools/browser.rs`
|
|
717
|
+
- Create: `crates/skipper-runtime/src/tools/collaboration.rs`
|
|
718
|
+
- Modify: `crates/skipper-runtime/src/tools/mod.rs`
|
|
719
|
+
|
|
720
|
+
**Step 1: Create filesystem.rs**
|
|
721
|
+
|
|
722
|
+
Move: `validate_path`, `resolve_file_path`, `tool_file_read`, `tool_file_write`, `tool_file_list`, `tool_apply_patch`
|
|
723
|
+
|
|
724
|
+
**Step 2: Create web.rs**
|
|
725
|
+
|
|
726
|
+
Move: `tool_web_fetch_legacy`, `tool_web_search_legacy`
|
|
727
|
+
|
|
728
|
+
**Step 3: Create shell.rs**
|
|
729
|
+
|
|
730
|
+
Move: `tool_shell_exec`
|
|
731
|
+
|
|
732
|
+
**Step 4: Create agents.rs**
|
|
733
|
+
|
|
734
|
+
Move: `require_kernel`, `tool_agent_send`, `tool_agent_spawn`, `tool_agent_list`, `tool_agent_kill`, `tool_memory_store`, `tool_memory_recall`, `tool_agent_find`
|
|
735
|
+
|
|
736
|
+
**Step 5: Create media.rs**
|
|
737
|
+
|
|
738
|
+
Move: `tool_image_analyze`, `detect_image_format`, `extract_image_dimensions`, `extract_jpeg_dimensions`, `format_file_size`, `tool_media_describe`, `tool_media_transcribe`, `tool_image_generate`, `tool_text_to_speech`, `tool_speech_to_text`
|
|
739
|
+
|
|
740
|
+
**Step 6: Create browser.rs**
|
|
741
|
+
|
|
742
|
+
Move: all `browser_*` tool functions + `tool_canvas_present`, `sanitize_canvas_html`
|
|
743
|
+
|
|
744
|
+
**Step 7: Create collaboration.rs**
|
|
745
|
+
|
|
746
|
+
Move: `tool_task_post`, `tool_task_claim`, `tool_task_complete`, `tool_task_list`, `tool_event_publish`, knowledge graph tools, scheduling tools, cron tools, channel tools, hand tools, A2A tools, process management tools, docker tool, location tool
|
|
747
|
+
|
|
748
|
+
**Step 8: mod.rs should now contain only**
|
|
749
|
+
|
|
750
|
+
- `execute_tool()` dispatch function (~350 lines)
|
|
751
|
+
- `builtin_tool_definitions()` (~670 lines)
|
|
752
|
+
- Security helpers: `check_taint_shell_exec`, `check_taint_net_fetch`
|
|
753
|
+
- Task-local state: `AGENT_CALL_DEPTH`, `CANVAS_MAX_BYTES`
|
|
754
|
+
- Module declarations + `pub use`
|
|
755
|
+
|
|
756
|
+
Total: ~1,100 lines. Down from 3,625.
|
|
757
|
+
|
|
758
|
+
**Step 9: Verify and commit**
|
|
759
|
+
|
|
760
|
+
```bash
|
|
761
|
+
cargo build --workspace --lib && cargo test --workspace
|
|
762
|
+
cargo clippy --workspace --all-targets -- -D warnings
|
|
763
|
+
git add crates/skipper-runtime/src/tools/
|
|
764
|
+
git commit -m "refactor(runtime): extract tool implementations into domain modules"
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
---
|
|
768
|
+
|
|
769
|
+
### Task 18: Decompose config.rs — Create Module Structure
|
|
770
|
+
|
|
771
|
+
**Files:**
|
|
772
|
+
|
|
773
|
+
- Create: `crates/skipper-types/src/config/mod.rs`
|
|
774
|
+
- Modify: `crates/skipper-types/src/lib.rs`
|
|
775
|
+
|
|
776
|
+
**Step 1: Create the config directory and copy**
|
|
777
|
+
|
|
778
|
+
```bash
|
|
779
|
+
mkdir -p crates/skipper-types/src/config
|
|
780
|
+
cp crates/skipper-types/src/config.rs crates/skipper-types/src/config/mod.rs
|
|
781
|
+
rm crates/skipper-types/src/config.rs
|
|
782
|
+
```
|
|
783
|
+
|
|
784
|
+
**Step 2: Verify**
|
|
785
|
+
|
|
786
|
+
```bash
|
|
787
|
+
cargo build --workspace --lib && cargo test --workspace
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
**Step 3: Commit**
|
|
791
|
+
|
|
792
|
+
```bash
|
|
793
|
+
git add -A crates/skipper-types/src/config/ crates/skipper-types/src/config.rs
|
|
794
|
+
git commit -m "refactor(types): convert config.rs to config/ module directory"
|
|
795
|
+
```
|
|
796
|
+
|
|
797
|
+
---
|
|
798
|
+
|
|
799
|
+
### Task 19: Extract Config Types by Domain
|
|
800
|
+
|
|
801
|
+
**Files:**
|
|
802
|
+
|
|
803
|
+
- Create: `crates/skipper-types/src/config/channels.rs`
|
|
804
|
+
- Create: `crates/skipper-types/src/config/models.rs`
|
|
805
|
+
- Create: `crates/skipper-types/src/config/budget.rs`
|
|
806
|
+
- Modify: `crates/skipper-types/src/config/mod.rs`
|
|
807
|
+
|
|
808
|
+
**Step 1: Identify the domain boundaries**
|
|
809
|
+
|
|
810
|
+
Read through config/mod.rs and identify:
|
|
811
|
+
|
|
812
|
+
- Channel-specific config structs (per-provider configs for Telegram, Discord, Slack, etc.)
|
|
813
|
+
- Model/provider config structs
|
|
814
|
+
- Budget/cost config structs
|
|
815
|
+
- Core `KernelConfig` struct and shared types stay in mod.rs
|
|
816
|
+
|
|
817
|
+
**Step 2: Extract channel configs to channels.rs**
|
|
818
|
+
|
|
819
|
+
Move all channel-specific structs (e.g., `TelegramConfig`, `DiscordConfig`, `SlackConfig`, `ChannelsConfig`, etc.) to `channels.rs`.
|
|
820
|
+
|
|
821
|
+
**Step 3: Extract model configs to models.rs**
|
|
822
|
+
|
|
823
|
+
Move model/provider structs to `models.rs`.
|
|
824
|
+
|
|
825
|
+
**Step 4: Extract budget configs to budget.rs**
|
|
826
|
+
|
|
827
|
+
Move budget-related structs to `budget.rs`.
|
|
828
|
+
|
|
829
|
+
**Step 5: mod.rs keeps core types**
|
|
830
|
+
|
|
831
|
+
`KernelConfig`, shared enums, `Default` impl. Re-exports sub-module types.
|
|
832
|
+
|
|
833
|
+
**Step 6: Verify and commit**
|
|
834
|
+
|
|
835
|
+
```bash
|
|
836
|
+
cargo build --workspace --lib && cargo test --workspace
|
|
837
|
+
cargo clippy --workspace --all-targets -- -D warnings
|
|
838
|
+
git add crates/skipper-types/src/config/
|
|
839
|
+
git commit -m "refactor(types): extract config types into domain modules"
|
|
840
|
+
```
|
|
841
|
+
|
|
842
|
+
---
|
|
843
|
+
|
|
844
|
+
### Task 20: Decompose main.rs (CLI) — Create Module Structure
|
|
845
|
+
|
|
846
|
+
**Files:**
|
|
847
|
+
|
|
848
|
+
- Create: `crates/skipper-cli/src/commands/mod.rs`
|
|
849
|
+
- Modify: `crates/skipper-cli/src/main.rs`
|
|
850
|
+
|
|
851
|
+
**Step 1: Create commands directory**
|
|
852
|
+
|
|
853
|
+
```bash
|
|
854
|
+
mkdir -p crates/skipper-cli/src/commands
|
|
855
|
+
```
|
|
856
|
+
|
|
857
|
+
**Step 2: Identify command groups in main.rs**
|
|
858
|
+
|
|
859
|
+
Read through main.rs and identify the match arms in the main dispatch function. Group by:
|
|
860
|
+
|
|
861
|
+
- Agent commands (spawn, list, kill, message)
|
|
862
|
+
- Hand commands (install, list, activate)
|
|
863
|
+
- Skill commands (create, list, install)
|
|
864
|
+
- Config commands (get, set, show)
|
|
865
|
+
- Channel commands (list, configure, test)
|
|
866
|
+
- Auth commands (login, register)
|
|
867
|
+
- Daemon commands (start, stop)
|
|
868
|
+
- Other commands
|
|
869
|
+
|
|
870
|
+
**Step 3: Extract each command group**
|
|
871
|
+
|
|
872
|
+
For each group, create a file (e.g., `commands/agent.rs`) and move the command handler functions there. Keep `main()` as a thin dispatcher.
|
|
873
|
+
|
|
874
|
+
**Step 4: Verify after each extraction**
|
|
875
|
+
|
|
876
|
+
```bash
|
|
877
|
+
cargo build --workspace --lib && cargo test --workspace
|
|
878
|
+
```
|
|
879
|
+
|
|
880
|
+
**Step 5: Final commit**
|
|
881
|
+
|
|
882
|
+
```bash
|
|
883
|
+
git add crates/skipper-cli/src/commands/ crates/skipper-cli/src/main.rs
|
|
884
|
+
git commit -m "refactor(cli): extract command handlers into commands/ module"
|
|
885
|
+
```
|
|
886
|
+
|
|
887
|
+
---
|
|
888
|
+
|
|
889
|
+
### Task 21: Final Verification & Cleanup
|
|
890
|
+
|
|
891
|
+
**Step 1: Full build and test**
|
|
892
|
+
|
|
893
|
+
```bash
|
|
894
|
+
cargo build --workspace --lib
|
|
895
|
+
cargo test --workspace
|
|
896
|
+
cargo clippy --workspace --all-targets -- -D warnings
|
|
897
|
+
```
|
|
898
|
+
|
|
899
|
+
**Step 2: Verify no god-files remain**
|
|
900
|
+
|
|
901
|
+
Check that no file exceeds ~1,500 lines:
|
|
902
|
+
|
|
903
|
+
```bash
|
|
904
|
+
find crates -name "*.rs" | xargs wc -l | sort -rn | head -20
|
|
905
|
+
```
|
|
906
|
+
|
|
907
|
+
Expected: The top files should be under 1,500 lines (except test files and `builtin_tool_definitions` which is a large data function).
|
|
908
|
+
|
|
909
|
+
**Step 3: Verify line count reduction**
|
|
910
|
+
|
|
911
|
+
| File | Before | After (mod.rs) | Extracted To |
|
|
912
|
+
| -------------- | ------ | -------------- | --------------- |
|
|
913
|
+
| routes.rs | 8,983 | ~50 | 12 domain files |
|
|
914
|
+
| kernel.rs | 5,177 | ~900 | 7 domain files |
|
|
915
|
+
| tool_runner.rs | 3,625 | ~1,100 | 7 domain files |
|
|
916
|
+
| config.rs | 3,579 | ~1,000 | 3 domain files |
|
|
917
|
+
| main.rs | 5,671 | ~200 | 8 command files |
|
|
918
|
+
|
|
919
|
+
**Step 4: Commit if any cleanup needed**
|
|
920
|
+
|
|
921
|
+
```bash
|
|
922
|
+
git add -A crates/
|
|
923
|
+
git commit -m "refactor: final cleanup after clean architecture decomposition"
|
|
924
|
+
```
|