@sinkaroid/rust-shapeshift 1.0.10 → 1.0.12
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/README.md +7 -7
- package/package.json +6 -6
- package/skills/rust-shapeshift/SKILL.md +16 -11
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ Before selecting libraries, AI agents must determine both the operating mode and
|
|
|
15
15
|
1. **The Shapeshifter (Migration & Modernization Mode)**:
|
|
16
16
|
Translates backend services from any runtime (JavaScript/TypeScript, Python, Java, etc.) into idiomatic Rust without carrying over garbage collection habits, DOM retention leaks, unbounded maps, or per-request connection allocations.
|
|
17
17
|
2. **The Native Architect (Greenfield Mode)**:
|
|
18
|
-
Architects native Rust services from scratch targeting
|
|
18
|
+
Architects native Rust services from scratch targeting baseline memory consumption (<50MB RSS), stack inlining (`compact_str`), bounded buffers, zero-copy parsing, and deterministic resource lifecycles.
|
|
19
19
|
|
|
20
20
|
### 2. Workload Archetypes & Framework Adaptability
|
|
21
21
|
|
|
@@ -154,18 +154,18 @@ Your agent will automatically clone, index, and apply the 58 production engineer
|
|
|
154
154
|
|
|
155
155
|
---
|
|
156
156
|
|
|
157
|
-
###
|
|
157
|
+
### Commands
|
|
158
158
|
|
|
159
159
|
```bash
|
|
160
|
-
rust-shapeshift list
|
|
161
|
-
rust-shapeshift audit
|
|
162
|
-
rust-shapeshift mcp
|
|
163
|
-
rust-shapeshift init
|
|
160
|
+
rust-shapeshift list
|
|
161
|
+
rust-shapeshift audit
|
|
162
|
+
rust-shapeshift mcp
|
|
163
|
+
rust-shapeshift init
|
|
164
164
|
```
|
|
165
165
|
|
|
166
166
|
---
|
|
167
167
|
|
|
168
|
-
###
|
|
168
|
+
### MCP
|
|
169
169
|
|
|
170
170
|
Connect `rust-shapeshift` directly as an active tool server in **Claude Code, Cursor, Windsurf, or Antigravity**:
|
|
171
171
|
|
package/package.json
CHANGED
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"name": "@sinkaroid/rust-shapeshift",
|
|
28
28
|
"optionalDependencies": {
|
|
29
|
-
"@sinkaroid/rust-shapeshift-darwin-arm64": "1.0.
|
|
30
|
-
"@sinkaroid/rust-shapeshift-darwin-x64": "1.0.
|
|
31
|
-
"@sinkaroid/rust-shapeshift-linux-arm64": "1.0.
|
|
32
|
-
"@sinkaroid/rust-shapeshift-linux-x64": "1.0.
|
|
33
|
-
"@sinkaroid/rust-shapeshift-win32-x64": "1.0.
|
|
29
|
+
"@sinkaroid/rust-shapeshift-darwin-arm64": "1.0.12",
|
|
30
|
+
"@sinkaroid/rust-shapeshift-darwin-x64": "1.0.12",
|
|
31
|
+
"@sinkaroid/rust-shapeshift-linux-arm64": "1.0.12",
|
|
32
|
+
"@sinkaroid/rust-shapeshift-linux-x64": "1.0.12",
|
|
33
|
+
"@sinkaroid/rust-shapeshift-win32-x64": "1.0.12"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"build": "cargo build --release",
|
|
44
44
|
"test": "node bin/rust-shapeshift.js --help"
|
|
45
45
|
},
|
|
46
|
-
"version": "1.0.
|
|
46
|
+
"version": "1.0.12"
|
|
47
47
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: rust-shapeshift
|
|
3
3
|
author: "@sinkaroid"
|
|
4
|
-
version: "1.0.
|
|
4
|
+
version: "1.0.12"
|
|
5
5
|
repository: "https://github.com/sinkaroid"
|
|
6
6
|
description: Master modern Rust (1.80+ / 2024 Edition) specialized in extreme memory and runtime efficiency. Expert in transforming backend services from any runtime into lean, production-grade Rust with Axum 0.8 as canonical reference architecture while remaining fully stack-adaptable (Actix Web, Salvo, Loco, std::net). Eliminates hundreds of MBs of RSS bloat via framework selection, allocator tuning, DOM pruning, zero-copy parsing, and bounded concurrency. Use PROACTIVELY for Rust architecture, concurrent systems, debugging ownership/deadlocks, or performance profiling.
|
|
7
7
|
metadata:
|
|
@@ -50,7 +50,9 @@ You are an expert Rust systems architect and concurrency engineer specialized in
|
|
|
50
50
|
To eliminate architectural confusion and ensure consistent agent behavior across different project stacks, this skill enforces a strict separation between **Universal Memory/Systems Foundations** and **HTTP Transport Layering**:
|
|
51
51
|
|
|
52
52
|
### 1. The Systems & Memory Core is 100% Framework-Agnostic
|
|
53
|
+
|
|
53
54
|
Over 70% of this skill focuses on hardware-, kernel-, allocator-, and compiler-level optimizations that apply to **every Rust codebase**, regardless of the web framework chosen:
|
|
55
|
+
|
|
54
56
|
- **Linux Allocator Hygiene**: `MALLOC_ARENA_MAX=2`, `libc::malloc_trim(0)`, musl vs glibc trade-offs, and Docker C-ABI pairing.
|
|
55
57
|
- **Data Layout & Zero Churn**: Stack inlining (`compact_str`), capacity trimming (`Box<str>`, `Box<[T]>`), enum boxing, struct alignment (`#[repr(align(64))]`), and arena allocation (`bumpalo`).
|
|
56
58
|
- **Low-Level Throughput**: Bounds Check Elimination (BCE), SIMD vector parsing, Profile-Guided Optimization (PGO), `io_uring`, and NUMA HugePages.
|
|
@@ -58,21 +60,24 @@ Over 70% of this skill focuses on hardware-, kernel-, allocator-, and compiler-l
|
|
|
58
60
|
- **The Koburi Pattern (Archetype B)**: Zero-async, zero-dependency `std::net` / `UnixStream` minimal daemons under 1MB idle RSS.
|
|
59
61
|
|
|
60
62
|
### 2. Axum 0.8 as the Canonical Reference Implementation
|
|
63
|
+
|
|
61
64
|
Axum 0.8 is adopted as the primary reference standard across HTTP-specific reference guides because of its official Tokio ecosystem alignment, Tower middleware composition, and strict type-level extractor safety.
|
|
62
65
|
|
|
63
66
|
### 3. Mandatory AI Agent Contract for Alternative Frameworks
|
|
67
|
+
|
|
64
68
|
When project constraints or user requirements dictate an alternative framework based on [`framework_and_stack_selection_matrix.md`](skills/rust-shapeshift/resources/framework_and_stack_selection_matrix.md) (such as **Actix Web** for maximum raw throughput, **Salvo** for ultra-clean routing ergonomics, **Loco** for full-stack productivity, or **std::net** for minimalist daemons):
|
|
69
|
+
|
|
65
70
|
> **MANDATORY DIRECTIVE**: The AI agent **MUST NOT** force Axum onto the workspace. Instead, the agent **MUST adapt** the core zero-cost memory and safety principles into the target framework using the **Framework Adaptation Rosetta Stone** below:
|
|
66
71
|
|
|
67
|
-
| Architectural Primitive
|
|
68
|
-
|
|
69
|
-
| **Zero-Allocation Error Envelope**
|
|
70
|
-
| **Normalized Metric Routing (Cardinality Safe)** | `req.extensions().get::<MatchedPath>()`
|
|
71
|
-
| **Shared Application State**
|
|
72
|
-
| **Zero-Downtime Rate Limiting Middleware**
|
|
73
|
-
| **Low-Memory WebSocket Upgrades**
|
|
74
|
-
| **Chunked Streaming Response**
|
|
75
|
-
| **Graceful Shutdown Signal**
|
|
72
|
+
| Architectural Primitive | Axum 0.8 (Canonical Reference) | Actix Web | Salvo | Minimal std::net (Koburi) |
|
|
73
|
+
| ------------------------------------------------ | ------------------------------------------------------------ | --------------------------------------- | ------------------------------------------------ | -------------------------------------------------- |
|
|
74
|
+
| **Zero-Allocation Error Envelope** | `impl IntoResponse for AppError` | `impl ResponseError for AppError` | `#[salvo::async_trait] impl Writer for AppError` | Custom byte serializer over `TcpStream::write_all` |
|
|
75
|
+
| **Normalized Metric Routing (Cardinality Safe)** | `req.extensions().get::<MatchedPath>()` | `req.match_pattern()` | `req.params()` | Static route enum matching |
|
|
76
|
+
| **Shared Application State** | `axum::extract::State(Arc<AppState>)` | `actix_web::web::Data<AppState>` | `depot.obtain::<Arc<AppState>>()` | Passed by borrowed reference `&AppState` |
|
|
77
|
+
| **Zero-Downtime Rate Limiting Middleware** | `axum::middleware::from_fn_with_state` | `actix_web::dev::Transform` / `wrap_fn` | `#[handler] fn rate_limit(...)` | Inline bucket check before connection accept |
|
|
78
|
+
| **Low-Memory WebSocket Upgrades** | `axum::extract::ws::{WebSocket, Message}` (4KB tuned buffer) | `actix-ws` with session framing | `salvo::websocket::WebSocket` | Custom lightweight framing over raw TCP |
|
|
79
|
+
| **Chunked Streaming Response** | `axum::body::Body::from_stream` | `HttpResponse::Ok().streaming(stream)` | `Response::streaming(stream)` | Sequential `std::io::copy` to socket buffer |
|
|
80
|
+
| **Graceful Shutdown Signal** | `axum::serve().with_graceful_shutdown()` | `actix_web::HttpServer::stop()` | `salvo::Server::stop()` | Polling atomic flag / SIGINT listener |
|
|
76
81
|
|
|
77
82
|
---
|
|
78
83
|
|
|
@@ -105,6 +110,7 @@ Master modern Rust (1.80+ / 2024 Edition) features, advanced type system mechani
|
|
|
105
110
|
### Active MCP Tool Capabilities (Optional Stdio Server)
|
|
106
111
|
|
|
107
112
|
When registered as an MCP server (`rust-shapeshift mcp` or `npx @sinkaroid/rust-shapeshift mcp`), AI agents can directly invoke active memory and runtime tools:
|
|
113
|
+
|
|
108
114
|
- `audit_memory_antipatterns`: Automatically scans workspace files for glibc arena traps (`MALLOC_ARENA_MAX=2`), unoptimized release profiles, synchronous locks across `.await`, and synthetic test fixtures.
|
|
109
115
|
- `inspect_struct_layout`: Computes struct padding bytes, alignment boundaries, field reordering, and cache-line false-sharing hazards.
|
|
110
116
|
- `calculate_hardware_budget`: Computes worst-case RSS ceilings and safe per-connection buffers to prevent Linux OOMKilled (Exit Code 137).
|
|
@@ -365,4 +371,3 @@ Consult the attached reference guides for complete, production-tested code templ
|
|
|
365
371
|
- `resources/lock_free_ring_buffers_and_disruptor.md` — High-throughput zero-allocation queues via cache-aligned power-of-two circular ring buffers (rtrb, ArrayQueue) and Disruptor pattern.
|
|
366
372
|
- `resources/production_memory_leak_diagnostics_and_ebpf.md` — Diagnosing memory leaks in production with LLVM LeakSanitizer (-Zsanitizer=leak), jemalloc-ctl live heap dumps, and zero-overhead eBPF (bcc memleak) container tracing.
|
|
367
373
|
- `resources/zero_cost_state_machines_and_enum_dispatch.md` — Eliminating dynamic dispatch (Box<dyn Trait>) and vtable overhead via compile-time enum_dispatch and zero-cost typestate state machines.
|
|
368
|
-
|