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,367 @@
|
|
|
1
|
+
// Nautical visual effects system for submarine dashboard
|
|
2
|
+
// Bubbles, sonar pings, sparkles, depth gauge, pipe flow, and hull glow
|
|
3
|
+
|
|
4
|
+
import { ParticleSystem } from "./particles";
|
|
5
|
+
import { nautical, layout, timing } from "../design/submarine-theme";
|
|
6
|
+
import { drawText, drawCircle } from "./renderer";
|
|
7
|
+
|
|
8
|
+
export interface SonarPing {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
color: string;
|
|
12
|
+
time: number;
|
|
13
|
+
duration: number;
|
|
14
|
+
rings: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface PipeFlow {
|
|
18
|
+
fromX: number;
|
|
19
|
+
fromY: number;
|
|
20
|
+
toX: number;
|
|
21
|
+
toY: number;
|
|
22
|
+
color: string;
|
|
23
|
+
offset: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export class NauticalEffects {
|
|
27
|
+
private particles: ParticleSystem;
|
|
28
|
+
private sonarPings: SonarPing[] = [];
|
|
29
|
+
private pipeFlows: PipeFlow[] = [];
|
|
30
|
+
private activeCompartments: Set<string> = new Set();
|
|
31
|
+
private depthProgress: number = 0;
|
|
32
|
+
private time: number = 0;
|
|
33
|
+
|
|
34
|
+
constructor() {
|
|
35
|
+
this.particles = new ParticleSystem();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
update(dt: number): void {
|
|
39
|
+
this.time += dt;
|
|
40
|
+
this.particles.update(dt);
|
|
41
|
+
|
|
42
|
+
// Update sonar pings
|
|
43
|
+
for (let i = this.sonarPings.length - 1; i >= 0; i--) {
|
|
44
|
+
this.sonarPings[i].time += dt;
|
|
45
|
+
if (this.sonarPings[i].time >= this.sonarPings[i].duration) {
|
|
46
|
+
this.sonarPings.splice(i, 1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Update pipe flows (animate dash offset)
|
|
51
|
+
for (const flow of this.pipeFlows) {
|
|
52
|
+
flow.offset -= timing.pipeFlowSpeed * dt;
|
|
53
|
+
// Reset offset when it goes too far
|
|
54
|
+
if (flow.offset < -10) {
|
|
55
|
+
flow.offset = 0;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Emit ambient bubbles (low probability per frame)
|
|
60
|
+
if (Math.random() < 0.05) {
|
|
61
|
+
const x = Math.random() * 800 - 400;
|
|
62
|
+
const y = Math.random() * 600;
|
|
63
|
+
this.emitAmbientBubbles(800, 600);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
draw(ctx: CanvasRenderingContext2D, width: number, height: number): void {
|
|
68
|
+
// Draw background effects (before compartments)
|
|
69
|
+
// Note: This is called by scene, order controlled by caller
|
|
70
|
+
|
|
71
|
+
// Draw overlays (after compartments)
|
|
72
|
+
this.drawSonarPings(ctx);
|
|
73
|
+
this.drawPipeFlows(ctx);
|
|
74
|
+
this.particles.draw(ctx);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// ── Bubble effects ──────────────────────────────────────────────
|
|
78
|
+
|
|
79
|
+
emitBubbles(x: number, y: number, count: number = 3): void {
|
|
80
|
+
for (let i = 0; i < count; i++) {
|
|
81
|
+
const angle = Math.random() * Math.PI * 2;
|
|
82
|
+
const speed = Math.random() * 10 + 5;
|
|
83
|
+
|
|
84
|
+
this.particles.emit(
|
|
85
|
+
x + Math.cos(angle) * 8,
|
|
86
|
+
y + Math.sin(angle) * 8,
|
|
87
|
+
"ambient",
|
|
88
|
+
nautical.bubbleColor,
|
|
89
|
+
1,
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
// Customize the last emitted particle for bubble behavior
|
|
93
|
+
const particle = (this.particles as any).particles[
|
|
94
|
+
(this.particles as any).particles.length - 1
|
|
95
|
+
];
|
|
96
|
+
if (particle) {
|
|
97
|
+
particle.vx = (Math.random() - 0.5) * 6; // Slight horizontal drift
|
|
98
|
+
particle.vy = -(Math.random() * 10 + 15); // Rise upward
|
|
99
|
+
particle.size = Math.random() * 2.5 + 1.5;
|
|
100
|
+
particle.maxLife = Math.random() * 3 + 3; // 3-6s lifetime
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
emitAmbientBubbles(width: number, height: number): void {
|
|
106
|
+
const x = Math.random() * width;
|
|
107
|
+
const y = Math.random() * height;
|
|
108
|
+
this.emitBubbles(x, y, Math.random() < 0.5 ? 1 : 2);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// ── Sonar effects ──────────────────────────────────────────────
|
|
112
|
+
|
|
113
|
+
emitSonarPing(x: number, y: number, color: string): void {
|
|
114
|
+
this.sonarPings.push({
|
|
115
|
+
x,
|
|
116
|
+
y,
|
|
117
|
+
color,
|
|
118
|
+
time: 0,
|
|
119
|
+
duration: timing.sonarPingDuration,
|
|
120
|
+
rings: timing.sonarPingRings,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// ── Sparkle effects ────────────────────────────────────────────
|
|
125
|
+
|
|
126
|
+
emitSparkle(x: number, y: number): void {
|
|
127
|
+
const count = Math.random() * 4 + 8; // 8-12 particles
|
|
128
|
+
for (let i = 0; i < count; i++) {
|
|
129
|
+
this.particles.emit(x, y, "burst", nautical.sparkleColor, 1);
|
|
130
|
+
}
|
|
131
|
+
// Customize burst particles for sparkle behavior
|
|
132
|
+
const particles = (this.particles as any).particles;
|
|
133
|
+
for (
|
|
134
|
+
let i = Math.max(0, particles.length - count);
|
|
135
|
+
i < particles.length;
|
|
136
|
+
i++
|
|
137
|
+
) {
|
|
138
|
+
const p = particles[i];
|
|
139
|
+
p.maxLife = 0.4;
|
|
140
|
+
p.size = Math.random() * 1.5 + 1;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// ── Compartment glow ───────────────────────────────────────────
|
|
145
|
+
|
|
146
|
+
setActiveCompartment(stage: string, active: boolean): void {
|
|
147
|
+
if (active) {
|
|
148
|
+
this.activeCompartments.add(stage);
|
|
149
|
+
} else {
|
|
150
|
+
this.activeCompartments.delete(stage);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// ── Depth gauge ────────────────────────────────────────────────
|
|
155
|
+
|
|
156
|
+
setDepthProgress(progress: number): void {
|
|
157
|
+
this.depthProgress = Math.max(0, Math.min(1, progress));
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// ── Pipe flows ─────────────────────────────────────────────────
|
|
161
|
+
|
|
162
|
+
addPipeFlow(
|
|
163
|
+
from: { x: number; y: number },
|
|
164
|
+
to: { x: number; y: number },
|
|
165
|
+
color: string,
|
|
166
|
+
): void {
|
|
167
|
+
this.pipeFlows.push({
|
|
168
|
+
fromX: from.x,
|
|
169
|
+
fromY: from.y,
|
|
170
|
+
toX: to.x,
|
|
171
|
+
toY: to.y,
|
|
172
|
+
color,
|
|
173
|
+
offset: 0,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
clearPipeFlows(): void {
|
|
178
|
+
this.pipeFlows = [];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// ── Drawing methods ────────────────────────────────────────────
|
|
182
|
+
|
|
183
|
+
drawSonarPings(ctx: CanvasRenderingContext2D): void {
|
|
184
|
+
for (const ping of this.sonarPings) {
|
|
185
|
+
const progress = ping.time / ping.duration;
|
|
186
|
+
|
|
187
|
+
for (let ringIdx = 0; ringIdx < ping.rings; ringIdx++) {
|
|
188
|
+
// Each ring starts with a delay
|
|
189
|
+
const ringDelay = (ringIdx / ping.rings) * 0.4;
|
|
190
|
+
const ringProgress =
|
|
191
|
+
Math.max(0, progress - ringDelay) / (1 - ringDelay);
|
|
192
|
+
|
|
193
|
+
if (ringProgress <= 0) continue;
|
|
194
|
+
|
|
195
|
+
const maxRadius = 80;
|
|
196
|
+
const radius = ringProgress * maxRadius;
|
|
197
|
+
const alpha = Math.max(0, 0.6 * (1 - ringProgress));
|
|
198
|
+
const lineWidth = Math.max(0.5, 2 * (1 - ringProgress));
|
|
199
|
+
|
|
200
|
+
ctx.save();
|
|
201
|
+
ctx.globalAlpha = alpha;
|
|
202
|
+
ctx.strokeStyle = ping.color;
|
|
203
|
+
ctx.lineWidth = lineWidth;
|
|
204
|
+
drawCircle(
|
|
205
|
+
ctx,
|
|
206
|
+
ping.x,
|
|
207
|
+
ping.y,
|
|
208
|
+
radius,
|
|
209
|
+
undefined,
|
|
210
|
+
ping.color,
|
|
211
|
+
lineWidth,
|
|
212
|
+
);
|
|
213
|
+
ctx.restore();
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
drawDepthGauge(
|
|
219
|
+
ctx: CanvasRenderingContext2D,
|
|
220
|
+
x: number,
|
|
221
|
+
y: number,
|
|
222
|
+
height: number,
|
|
223
|
+
): void {
|
|
224
|
+
const width = layout.depthGaugeWidth;
|
|
225
|
+
const gaugeHeight = height * 0.8;
|
|
226
|
+
const gaugeY = y + (height - gaugeHeight) / 2;
|
|
227
|
+
|
|
228
|
+
// Background
|
|
229
|
+
ctx.fillStyle = nautical.depthGaugeBg;
|
|
230
|
+
ctx.fillRect(x, gaugeY, width, gaugeHeight);
|
|
231
|
+
|
|
232
|
+
// Fill (from bottom)
|
|
233
|
+
const fillHeight = gaugeHeight * this.depthProgress;
|
|
234
|
+
ctx.fillStyle = nautical.depthGaugeFill;
|
|
235
|
+
ctx.fillRect(x, gaugeY + gaugeHeight - fillHeight, width, fillHeight);
|
|
236
|
+
|
|
237
|
+
// Border
|
|
238
|
+
ctx.strokeStyle = nautical.depthGaugeBorder;
|
|
239
|
+
ctx.lineWidth = 1;
|
|
240
|
+
ctx.strokeRect(x, gaugeY, width, gaugeHeight);
|
|
241
|
+
|
|
242
|
+
// Stage notches
|
|
243
|
+
const stages = 11;
|
|
244
|
+
for (let i = 0; i <= stages; i++) {
|
|
245
|
+
const notchY = gaugeY + (gaugeHeight * i) / stages;
|
|
246
|
+
ctx.strokeStyle = nautical.depthGaugeBorder;
|
|
247
|
+
ctx.lineWidth = 1;
|
|
248
|
+
ctx.beginPath();
|
|
249
|
+
ctx.moveTo(x - 4, notchY);
|
|
250
|
+
ctx.lineTo(x, notchY);
|
|
251
|
+
ctx.stroke();
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Label "DEPTH"
|
|
255
|
+
ctx.save();
|
|
256
|
+
ctx.translate(x - 12, gaugeY + gaugeHeight / 2);
|
|
257
|
+
ctx.rotate(-Math.PI / 2);
|
|
258
|
+
drawText(ctx, "DEPTH", 0, 0, {
|
|
259
|
+
font: "tiny",
|
|
260
|
+
color: nautical.labelColor,
|
|
261
|
+
align: "center",
|
|
262
|
+
baseline: "middle",
|
|
263
|
+
});
|
|
264
|
+
ctx.restore();
|
|
265
|
+
|
|
266
|
+
// Percentage at bottom
|
|
267
|
+
const percent = Math.round(this.depthProgress * 100);
|
|
268
|
+
drawText(ctx, `${percent}%`, x + width / 2, gaugeY + gaugeHeight + 8, {
|
|
269
|
+
font: "caption",
|
|
270
|
+
color: nautical.labelActive,
|
|
271
|
+
align: "center",
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
drawPipeFlows(ctx: CanvasRenderingContext2D): void {
|
|
276
|
+
for (const flow of this.pipeFlows) {
|
|
277
|
+
ctx.save();
|
|
278
|
+
ctx.strokeStyle = flow.color;
|
|
279
|
+
ctx.lineWidth = layout.pipeWidth;
|
|
280
|
+
ctx.globalAlpha = 0.4;
|
|
281
|
+
ctx.setLineDash([6, 4]);
|
|
282
|
+
ctx.lineDashOffset = flow.offset;
|
|
283
|
+
|
|
284
|
+
ctx.beginPath();
|
|
285
|
+
ctx.moveTo(flow.fromX, flow.fromY);
|
|
286
|
+
ctx.lineTo(flow.toX, flow.toY);
|
|
287
|
+
ctx.stroke();
|
|
288
|
+
|
|
289
|
+
ctx.restore();
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
drawCompartmentGlow(
|
|
294
|
+
ctx: CanvasRenderingContext2D,
|
|
295
|
+
compartment: { x: number; y: number; width: number; height: number },
|
|
296
|
+
color: string,
|
|
297
|
+
): void {
|
|
298
|
+
ctx.save();
|
|
299
|
+
ctx.shadowColor = color;
|
|
300
|
+
ctx.shadowBlur = 12;
|
|
301
|
+
ctx.shadowOffsetX = 0;
|
|
302
|
+
ctx.shadowOffsetY = 0;
|
|
303
|
+
|
|
304
|
+
ctx.strokeStyle = color;
|
|
305
|
+
ctx.lineWidth = 2;
|
|
306
|
+
ctx.globalAlpha = 0.3;
|
|
307
|
+
|
|
308
|
+
// Draw a rectangle slightly larger than the compartment
|
|
309
|
+
const inset = -2;
|
|
310
|
+
ctx.strokeRect(
|
|
311
|
+
compartment.x + inset,
|
|
312
|
+
compartment.y + inset,
|
|
313
|
+
compartment.width - inset * 2,
|
|
314
|
+
compartment.height - inset * 2,
|
|
315
|
+
);
|
|
316
|
+
|
|
317
|
+
ctx.restore();
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
drawPortholeGlow(
|
|
321
|
+
ctx: CanvasRenderingContext2D,
|
|
322
|
+
portholes: { x: number; y: number }[],
|
|
323
|
+
): void {
|
|
324
|
+
const glowIntensity = 0.4 + 0.3 * Math.sin(this.time * Math.PI);
|
|
325
|
+
|
|
326
|
+
for (const porthole of portholes) {
|
|
327
|
+
ctx.save();
|
|
328
|
+
|
|
329
|
+
// Create radial gradient
|
|
330
|
+
const gradient = ctx.createRadialGradient(
|
|
331
|
+
porthole.x,
|
|
332
|
+
porthole.y,
|
|
333
|
+
0,
|
|
334
|
+
porthole.x,
|
|
335
|
+
porthole.y,
|
|
336
|
+
layout.portholeRadius * 2,
|
|
337
|
+
);
|
|
338
|
+
gradient.addColorStop(0, nautical.portholeGlow);
|
|
339
|
+
gradient.addColorStop(1, "rgba(0, 212, 255, 0)");
|
|
340
|
+
|
|
341
|
+
ctx.fillStyle = gradient;
|
|
342
|
+
ctx.globalAlpha = glowIntensity * 0.6;
|
|
343
|
+
ctx.beginPath();
|
|
344
|
+
ctx.arc(
|
|
345
|
+
porthole.x,
|
|
346
|
+
porthole.y,
|
|
347
|
+
layout.portholeRadius * 2,
|
|
348
|
+
0,
|
|
349
|
+
Math.PI * 2,
|
|
350
|
+
);
|
|
351
|
+
ctx.fill();
|
|
352
|
+
|
|
353
|
+
ctx.restore();
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// ── Cleanup ────────────────────────────────────────────────────
|
|
358
|
+
|
|
359
|
+
clear(): void {
|
|
360
|
+
this.particles.clear();
|
|
361
|
+
this.sonarPings = [];
|
|
362
|
+
this.pipeFlows = [];
|
|
363
|
+
this.activeCompartments.clear();
|
|
364
|
+
this.depthProgress = 0;
|
|
365
|
+
this.time = 0;
|
|
366
|
+
}
|
|
367
|
+
}
|