@hivehub/rulebook 2.0.0 → 3.0.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.
Files changed (188) hide show
  1. package/README.md +779 -654
  2. package/dist/cli/commands.d.ts +22 -0
  3. package/dist/cli/commands.d.ts.map +1 -1
  4. package/dist/cli/commands.js +291 -8
  5. package/dist/cli/commands.js.map +1 -1
  6. package/dist/core/claude-mcp.d.ts +32 -0
  7. package/dist/core/claude-mcp.d.ts.map +1 -0
  8. package/dist/core/claude-mcp.js +92 -0
  9. package/dist/core/claude-mcp.js.map +1 -0
  10. package/dist/core/config-manager.d.ts.map +1 -1
  11. package/dist/core/config-manager.js +27 -6
  12. package/dist/core/config-manager.js.map +1 -1
  13. package/dist/core/generator.d.ts.map +1 -1
  14. package/dist/core/generator.js +98 -49
  15. package/dist/core/generator.js.map +1 -1
  16. package/dist/core/migrator.d.ts +13 -0
  17. package/dist/core/migrator.d.ts.map +1 -1
  18. package/dist/core/migrator.js +76 -9
  19. package/dist/core/migrator.js.map +1 -1
  20. package/dist/core/openspec-migrator.d.ts +1 -1
  21. package/dist/core/openspec-migrator.d.ts.map +1 -1
  22. package/dist/core/openspec-migrator.js +14 -7
  23. package/dist/core/openspec-migrator.js.map +1 -1
  24. package/dist/core/workflow-generator.js +297 -176
  25. package/dist/core/workflow-generator.js.map +1 -1
  26. package/dist/index.js +40 -1
  27. package/dist/index.js.map +1 -1
  28. package/dist/mcp/rulebook-server.d.ts.map +1 -1
  29. package/dist/mcp/rulebook-server.js +255 -74
  30. package/dist/mcp/rulebook-server.js.map +1 -1
  31. package/dist/memory/hnsw-index.d.ts +63 -0
  32. package/dist/memory/hnsw-index.d.ts.map +1 -0
  33. package/dist/memory/hnsw-index.js +421 -0
  34. package/dist/memory/hnsw-index.js.map +1 -0
  35. package/dist/memory/memory-cache.d.ts +33 -0
  36. package/dist/memory/memory-cache.d.ts.map +1 -0
  37. package/dist/memory/memory-cache.js +85 -0
  38. package/dist/memory/memory-cache.js.map +1 -0
  39. package/dist/memory/memory-hooks.d.ts +42 -0
  40. package/dist/memory/memory-hooks.d.ts.map +1 -0
  41. package/dist/memory/memory-hooks.js +193 -0
  42. package/dist/memory/memory-hooks.js.map +1 -0
  43. package/dist/memory/memory-manager.d.ts +55 -0
  44. package/dist/memory/memory-manager.d.ts.map +1 -0
  45. package/dist/memory/memory-manager.js +209 -0
  46. package/dist/memory/memory-manager.js.map +1 -0
  47. package/dist/memory/memory-search.d.ts +42 -0
  48. package/dist/memory/memory-search.d.ts.map +1 -0
  49. package/dist/memory/memory-search.js +166 -0
  50. package/dist/memory/memory-search.js.map +1 -0
  51. package/dist/memory/memory-store.d.ts +59 -0
  52. package/dist/memory/memory-store.d.ts.map +1 -0
  53. package/dist/memory/memory-store.js +394 -0
  54. package/dist/memory/memory-store.js.map +1 -0
  55. package/dist/memory/memory-types.d.ts +69 -0
  56. package/dist/memory/memory-types.d.ts.map +1 -0
  57. package/dist/memory/memory-types.js +7 -0
  58. package/dist/memory/memory-types.js.map +1 -0
  59. package/dist/memory/memory-vectorizer.d.ts +29 -0
  60. package/dist/memory/memory-vectorizer.d.ts.map +1 -0
  61. package/dist/memory/memory-vectorizer.js +104 -0
  62. package/dist/memory/memory-vectorizer.js.map +1 -0
  63. package/dist/types.d.ts +7 -0
  64. package/dist/types.d.ts.map +1 -1
  65. package/package.json +107 -106
  66. package/templates/cli/CLAUDE_CODE.md +114 -13
  67. package/templates/commands/rulebook-memory-save.md +48 -0
  68. package/templates/commands/rulebook-memory-search.md +47 -0
  69. package/templates/commands/rulebook-task-apply.md +2 -2
  70. package/templates/commands/rulebook-task-archive.md +2 -2
  71. package/templates/commands/rulebook-task-create.md +2 -2
  72. package/templates/commands/rulebook-task-list.md +2 -2
  73. package/templates/commands/rulebook-task-show.md +2 -2
  74. package/templates/commands/rulebook-task-validate.md +2 -2
  75. package/templates/git/CI_CD_PATTERNS.md +4 -4
  76. package/templates/git/GITHUB_ACTIONS.md +3 -3
  77. package/templates/git/GITLAB_CI.md +4 -4
  78. package/templates/git/SECRETS_MANAGEMENT.md +4 -4
  79. package/templates/hooks/COMMIT_MSG.md +4 -4
  80. package/templates/hooks/POST_CHECKOUT.md +3 -3
  81. package/templates/hooks/PREPARE_COMMIT_MSG.md +3 -3
  82. package/templates/hooks/PRE_COMMIT.md +4 -4
  83. package/templates/hooks/PRE_PUSH.md +4 -4
  84. package/templates/modules/MEMORY.md +63 -0
  85. package/templates/skills/cli/aider/SKILL.md +59 -0
  86. package/templates/skills/cli/amazon-q/SKILL.md +35 -0
  87. package/templates/skills/cli/auggie/SKILL.md +42 -0
  88. package/templates/skills/cli/claude/SKILL.md +42 -0
  89. package/templates/skills/cli/claude-code/SKILL.md +146 -0
  90. package/templates/skills/cli/cline/SKILL.md +42 -0
  91. package/templates/skills/cli/codebuddy/SKILL.md +30 -0
  92. package/templates/skills/cli/codeium/SKILL.md +30 -0
  93. package/templates/skills/cli/codex/SKILL.md +31 -0
  94. package/templates/skills/cli/continue/SKILL.md +44 -0
  95. package/templates/skills/cli/cursor-cli/SKILL.md +38 -0
  96. package/templates/skills/cli/factory/SKILL.md +28 -0
  97. package/templates/skills/cli/gemini/SKILL.md +45 -0
  98. package/templates/skills/cli/kilocode/SKILL.md +28 -0
  99. package/templates/skills/cli/opencode/SKILL.md +28 -0
  100. package/templates/skills/core/agent-automation/SKILL.md +194 -0
  101. package/templates/skills/core/dag/SKILL.md +314 -0
  102. package/templates/skills/core/documentation-rules/SKILL.md +47 -0
  103. package/templates/skills/core/quality-enforcement/SKILL.md +78 -0
  104. package/templates/skills/frameworks/angular/SKILL.md +46 -0
  105. package/templates/skills/frameworks/django/SKILL.md +93 -0
  106. package/templates/skills/frameworks/electron/SKILL.md +157 -0
  107. package/templates/skills/frameworks/flask/SKILL.md +48 -0
  108. package/templates/skills/frameworks/flutter/SKILL.md +65 -0
  109. package/templates/skills/frameworks/jquery/SKILL.md +42 -0
  110. package/templates/skills/frameworks/laravel/SKILL.md +48 -0
  111. package/templates/skills/frameworks/nestjs/SKILL.md +53 -0
  112. package/templates/skills/frameworks/nextjs/SKILL.md +137 -0
  113. package/templates/skills/frameworks/nuxt/SKILL.md +50 -0
  114. package/templates/skills/frameworks/rails/SKILL.md +76 -0
  115. package/templates/skills/frameworks/react/SKILL.md +48 -0
  116. package/templates/skills/frameworks/react-native/SKILL.md +57 -0
  117. package/templates/skills/frameworks/spring/SKILL.md +49 -0
  118. package/templates/skills/frameworks/symfony/SKILL.md +46 -0
  119. package/templates/skills/frameworks/vue/SKILL.md +46 -0
  120. package/templates/skills/frameworks/zend/SKILL.md +45 -0
  121. package/templates/skills/ides/copilot/SKILL.md +47 -0
  122. package/templates/skills/ides/cursor/SKILL.md +53 -0
  123. package/templates/skills/ides/jetbrains-ai/SKILL.md +45 -0
  124. package/templates/skills/ides/replit/SKILL.md +46 -0
  125. package/templates/skills/ides/tabnine/SKILL.md +39 -0
  126. package/templates/skills/ides/vscode/SKILL.md +50 -0
  127. package/templates/skills/ides/windsurf/SKILL.md +46 -0
  128. package/templates/skills/ides/zed/SKILL.md +42 -0
  129. package/templates/skills/languages/ada/SKILL.md +68 -0
  130. package/templates/skills/languages/c/SKILL.md +343 -0
  131. package/templates/skills/languages/cpp/SKILL.md +753 -0
  132. package/templates/skills/languages/csharp/SKILL.md +427 -0
  133. package/templates/skills/languages/dart/SKILL.md +342 -0
  134. package/templates/skills/languages/elixir/SKILL.md +464 -0
  135. package/templates/skills/languages/erlang/SKILL.md +371 -0
  136. package/templates/skills/languages/go/SKILL.md +655 -0
  137. package/templates/skills/languages/haskell/SKILL.md +187 -0
  138. package/templates/skills/languages/java/SKILL.md +617 -0
  139. package/templates/skills/languages/javascript/SKILL.md +641 -0
  140. package/templates/skills/languages/julia/SKILL.md +107 -0
  141. package/templates/skills/languages/kotlin/SKILL.md +521 -0
  142. package/templates/skills/languages/lisp/SKILL.md +110 -0
  143. package/templates/skills/languages/lua/SKILL.md +84 -0
  144. package/templates/skills/languages/objectivec/SKILL.md +100 -0
  145. package/templates/skills/languages/php/SKILL.md +426 -0
  146. package/templates/skills/languages/python/SKILL.md +692 -0
  147. package/templates/skills/languages/r/SKILL.md +360 -0
  148. package/templates/skills/languages/ruby/SKILL.md +431 -0
  149. package/templates/skills/languages/rust/SKILL.md +487 -0
  150. package/templates/skills/languages/sas/SKILL.md +83 -0
  151. package/templates/skills/languages/scala/SKILL.md +358 -0
  152. package/templates/skills/languages/solidity/SKILL.md +590 -0
  153. package/templates/skills/languages/sql/SKILL.md +147 -0
  154. package/templates/skills/languages/swift/SKILL.md +476 -0
  155. package/templates/skills/languages/zig/SKILL.md +275 -0
  156. package/templates/skills/modules/atlassian/SKILL.md +265 -0
  157. package/templates/skills/modules/context7/SKILL.md +64 -0
  158. package/templates/skills/modules/figma/SKILL.md +277 -0
  159. package/templates/skills/modules/github-mcp/SKILL.md +74 -0
  160. package/templates/skills/modules/grafana/SKILL.md +338 -0
  161. package/templates/skills/modules/memory/SKILL.md +73 -0
  162. package/templates/skills/modules/notion/SKILL.md +257 -0
  163. package/templates/skills/modules/playwright/SKILL.md +100 -0
  164. package/templates/skills/modules/rulebook-mcp/SKILL.md +166 -0
  165. package/templates/skills/modules/serena/SKILL.md +347 -0
  166. package/templates/skills/modules/supabase/SKILL.md +233 -0
  167. package/templates/skills/modules/synap/SKILL.md +79 -0
  168. package/templates/skills/modules/vectorizer/SKILL.md +73 -0
  169. package/templates/skills/services/azure-blob/SKILL.md +194 -0
  170. package/templates/skills/services/cassandra/SKILL.md +249 -0
  171. package/templates/skills/services/dynamodb/SKILL.md +318 -0
  172. package/templates/skills/services/elasticsearch/SKILL.md +357 -0
  173. package/templates/skills/services/gcs/SKILL.md +188 -0
  174. package/templates/skills/services/influxdb/SKILL.md +275 -0
  175. package/templates/skills/services/kafka/SKILL.md +351 -0
  176. package/templates/skills/services/mariadb/SKILL.md +193 -0
  177. package/templates/skills/services/memcached/SKILL.md +252 -0
  178. package/templates/skills/services/minio/SKILL.md +211 -0
  179. package/templates/skills/services/mongodb/SKILL.md +278 -0
  180. package/templates/skills/services/mysql/SKILL.md +368 -0
  181. package/templates/skills/services/neo4j/SKILL.md +257 -0
  182. package/templates/skills/services/oracle/SKILL.md +300 -0
  183. package/templates/skills/services/postgresql/SKILL.md +336 -0
  184. package/templates/skills/services/rabbitmq/SKILL.md +296 -0
  185. package/templates/skills/services/redis/SKILL.md +302 -0
  186. package/templates/skills/services/s3/SKILL.md +308 -0
  187. package/templates/skills/services/sqlite/SKILL.md +304 -0
  188. package/templates/skills/services/sqlserver/SKILL.md +304 -0
@@ -0,0 +1,487 @@
1
+ ---
2
+ name: "Rust"
3
+ description: "Execute these commands after EVERY implementation (see AGENT_AUTOMATION module for full workflow)."
4
+ version: "1.0.0"
5
+ category: "languages"
6
+ author: "Rulebook"
7
+ tags: ["languages", "language"]
8
+ dependencies: []
9
+ conflicts: []
10
+ ---
11
+ <!-- RUST:START -->
12
+ # Rust Project Rules
13
+
14
+ ## Agent Automation Commands
15
+
16
+ **CRITICAL**: Execute these commands after EVERY implementation (see AGENT_AUTOMATION module for full workflow).
17
+
18
+ ```bash
19
+ # Complete quality check sequence:
20
+ cargo fmt --all -- --check # Format check
21
+ cargo clippy --workspace --all-targets --all-features -- -D warnings # Lint
22
+ cargo test --workspace --all-features # All tests (100% pass)
23
+ cargo build --release # Build verification
24
+ cargo llvm-cov --all # Coverage (95%+ required)
25
+
26
+ # Security audit:
27
+ cargo audit # Vulnerability scan
28
+ cargo outdated # Check outdated deps
29
+ ```
30
+
31
+ ## Rust Edition and Toolchain
32
+
33
+ **CRITICAL**: Always use Rust Edition 2024 with nightly toolchain.
34
+
35
+ - **Edition**: 2024
36
+ - **Toolchain**: nightly 1.85+
37
+ - **Update**: Run `rustup update nightly` regularly
38
+
39
+ ### Formatting
40
+
41
+ - Use `rustfmt` with nightly toolchain
42
+ - Configuration in `rustfmt.toml` or `.rustfmt.toml`
43
+ - Always format before committing: `cargo +nightly fmt --all`
44
+ - CI must check formatting: `cargo +nightly fmt --all -- --check`
45
+
46
+ ### Linting
47
+
48
+ - Use `clippy` with `-D warnings` (warnings as errors)
49
+ - Fix all clippy warnings before committing
50
+ - Acceptable exceptions must be documented with `#[allow(clippy::...)]` and justification
51
+ - CI must enforce clippy: `cargo clippy --workspace -- -D warnings`
52
+
53
+ ### Testing
54
+
55
+ - **Location**: Tests in `/tests` directory for integration tests
56
+ - **Unit Tests**: In same file as implementation with `#[cfg(test)]`
57
+ - **Coverage**: Must meet project threshold (default 95%)
58
+ - **Tools**: Use `cargo-nextest` for faster test execution
59
+ - **Async**: Use `tokio::test` for async tests with Tokio runtime
60
+
61
+ Example test structure:
62
+ ```rust
63
+ #[cfg(test)]
64
+ mod tests {
65
+ use super::*;
66
+
67
+ #[test]
68
+ fn test_feature() {
69
+ // Test implementation
70
+ }
71
+
72
+ #[tokio::test]
73
+ async fn test_async_feature() {
74
+ // Async test implementation
75
+ }
76
+ }
77
+ ```
78
+
79
+ ### Test Categories: S2S and Slow Tests
80
+
81
+ **CRITICAL**: Tests must be categorized based on execution time and dependencies.
82
+
83
+ #### Test Time Limits
84
+
85
+ - **Fast Tests**: Must complete in ≤ 10-20 seconds
86
+ - **Slow Tests**: Any test taking > 10-20 seconds must be marked as slow
87
+ - **S2S Tests**: Tests requiring active server/database must be isolated and run on-demand
88
+
89
+ #### S2S (Server-to-Server) Tests
90
+
91
+ **Tests that require active servers, databases, or external services must be isolated using Cargo features.**
92
+
93
+ **Implementation**:
94
+
95
+ 1. **Create `s2s` feature in `Cargo.toml`**:
96
+ ```toml
97
+ [features]
98
+ default = []
99
+ s2s = [] # Enable server-to-server tests
100
+ ```
101
+
102
+ 2. **Mark S2S tests with feature flag**:
103
+ ```rust
104
+ #[cfg(test)]
105
+ mod tests {
106
+ use super::*;
107
+
108
+ // Regular fast test (always runs)
109
+ #[test]
110
+ fn test_local_computation() {
111
+ // Fast test, no external dependencies
112
+ }
113
+
114
+ // S2S test (only runs with --features s2s)
115
+ #[cfg(feature = "s2s")]
116
+ #[tokio::test]
117
+ async fn test_database_connection() {
118
+ // Requires active database server
119
+ let db = connect_to_database().await?;
120
+ // ... test implementation
121
+ }
122
+
123
+ #[cfg(feature = "s2s")]
124
+ #[tokio::test]
125
+ async fn test_api_integration() {
126
+ // Requires active API server
127
+ let client = create_api_client().await?;
128
+ // ... test implementation
129
+ }
130
+ }
131
+ ```
132
+
133
+ 3. **Run tests**:
134
+ ```bash
135
+ # Regular tests (excludes S2S)
136
+ cargo test
137
+
138
+ # Include S2S tests (requires active servers)
139
+ cargo test --features s2s
140
+
141
+ # CI/CD: Run S2S tests only when servers are available
142
+ cargo test --features s2s --test-args '--test-threads=1'
143
+ ```
144
+
145
+ #### Slow Tests
146
+
147
+ **Tests that take > 10-20 seconds must be marked and run separately.**
148
+
149
+ **Implementation**:
150
+
151
+ 1. **Create `slow` feature in `Cargo.toml`**:
152
+ ```toml
153
+ [features]
154
+ default = []
155
+ slow = [] # Enable slow tests
156
+ ```
157
+
158
+ 2. **Mark slow tests**:
159
+ ```rust
160
+ #[cfg(test)]
161
+ mod tests {
162
+ use super::*;
163
+
164
+ // Fast test (always runs)
165
+ #[test]
166
+ fn test_quick_operation() {
167
+ // Completes in < 1 second
168
+ }
169
+
170
+ // Slow test (only runs with --features slow)
171
+ #[cfg(feature = "slow")]
172
+ #[test]
173
+ fn test_heavy_computation() {
174
+ // Takes 30+ seconds
175
+ // Heavy processing, large dataset, etc.
176
+ }
177
+
178
+ #[cfg(feature = "slow")]
179
+ #[tokio::test]
180
+ async fn test_large_file_processing() {
181
+ // Processes large files, takes > 20 seconds
182
+ }
183
+ }
184
+ ```
185
+
186
+ 3. **Run tests**:
187
+ ```bash
188
+ # Regular tests (excludes slow)
189
+ cargo test
190
+
191
+ # Include slow tests
192
+ cargo test --features slow
193
+
194
+ # Run both S2S and slow tests
195
+ cargo test --features s2s,slow
196
+ ```
197
+
198
+ #### Best Practices
199
+
200
+ - ✅ **Always run fast tests** in CI/CD by default
201
+ - ✅ **Isolate S2S tests** - never run them in standard test suite
202
+ - ✅ **Mark slow tests** - prevent CI/CD timeouts
203
+ - ✅ **Document requirements** - specify which servers/services are needed for S2S tests
204
+ - ✅ **Use timeouts** - Set appropriate timeouts for S2S tests: `tokio::time::timeout(Duration::from_secs(30), test_fn).await?`
205
+ - ❌ **Never mix** fast and slow/S2S tests in same test run
206
+ - ❌ **Never require** external services for standard test suite
207
+ - ❌ **Never exceed** 10-20 seconds for regular tests
208
+
209
+ ## Async Programming
210
+
211
+ **CRITICAL**: Follow Tokio best practices for async code.
212
+
213
+ - **Runtime**: Use Tokio for async runtime
214
+ - **Blocking**: Never block in async context - use `spawn_blocking` for CPU-intensive tasks
215
+ - **Channels**: Use `tokio::sync::mpsc` or `tokio::sync::broadcast` for async communication
216
+ - **Timeouts**: Always set timeouts for network operations: `tokio::time::timeout`
217
+
218
+ Example:
219
+ ```rust
220
+ use tokio::time::{timeout, Duration};
221
+
222
+ async fn fetch_data() -> Result<Data, Error> {
223
+ timeout(Duration::from_secs(30), async {
224
+ // Network operation
225
+ }).await?
226
+ }
227
+ ```
228
+
229
+ ## Dependency Management
230
+
231
+ **CRITICAL**: Always verify latest versions before adding dependencies.
232
+
233
+ ### Before Adding Any Dependency
234
+
235
+ 1. **Check Context7 for latest version**:
236
+ - Use MCP Context7 tool if available
237
+ - Search for the crate documentation
238
+ - Verify the latest stable version
239
+ - Review breaking changes and migration guides
240
+
241
+ 2. **Example Workflow**:
242
+ ```
243
+ Adding tokio → Check crates.io and docs.rs
244
+ Adding serde → Verify latest version with security updates
245
+ Adding axum → Check for breaking changes in latest version
246
+ ```
247
+
248
+ 3. **Document Version Choice**:
249
+ - Note why specific version chosen in `Cargo.toml` comments
250
+ - Document any compatibility constraints
251
+ - Update CHANGELOG.md with new dependencies
252
+
253
+ ### Dependency Guidelines
254
+
255
+ - ✅ Use latest stable versions
256
+ - ✅ Check for security advisories: `cargo audit`
257
+ - ✅ Prefer well-maintained crates (active development, good documentation)
258
+ - ✅ Minimize dependency count
259
+ - ✅ Use workspace dependencies for monorepos
260
+ - ❌ Don't use outdated versions without justification
261
+ - ❌ Don't add dependencies without checking latest version
262
+
263
+ ## Codespell Configuration
264
+
265
+ **CRITICAL**: Use codespell to catch typos in code and documentation.
266
+
267
+ Install: `pip install 'codespell[toml]'`
268
+
269
+ Configuration in `pyproject.toml`:
270
+ ```toml
271
+ [tool.codespell]
272
+ skip = "*.lock,*.json,target,node_modules,.git"
273
+ ignore-words-list = "crate,ser,deser"
274
+ ```
275
+
276
+ Or run with flags:
277
+ ```bash
278
+ codespell \
279
+ --skip="*.lock,*.json,target,node_modules,.git" \
280
+ --ignore-words-list="crate,ser,deser"
281
+ ```
282
+
283
+ ## Error Handling
284
+
285
+ - Use `Result<T, E>` for recoverable errors
286
+ - Use `thiserror` for custom error types
287
+ - Use `anyhow` for application-level error handling
288
+ - Document error conditions in function docs
289
+ - Never use `unwrap()` or `expect()` in production code without justification
290
+
291
+ Example:
292
+ ```rust
293
+ use thiserror::Error;
294
+
295
+ #[derive(Error, Debug)]
296
+ pub enum MyError {
297
+ #[error("IO error: {0}")]
298
+ Io(#[from] std::io::Error),
299
+
300
+ #[error("Invalid input: {0}")]
301
+ InvalidInput(String),
302
+ }
303
+
304
+ pub fn process_data(input: &str) -> Result<Data, MyError> {
305
+ // Implementation
306
+ }
307
+ ```
308
+
309
+ ## Documentation
310
+
311
+ - **Public APIs**: Must have doc comments (`///`)
312
+ - **Examples**: Include examples in doc comments
313
+ - **Modules**: Document module purpose with `//!`
314
+ - **Unsafe**: Always document safety requirements for `unsafe` code
315
+ - **Run doctests**: `cargo test --doc`
316
+
317
+ Example:
318
+ ```rust
319
+ /// Processes the input data and returns a result.
320
+ ///
321
+ /// # Arguments
322
+ ///
323
+ /// * `input` - The input string to process
324
+ ///
325
+ /// # Examples
326
+ ///
327
+ /// ```
328
+ /// use mylib::process;
329
+ /// let result = process("hello");
330
+ /// assert_eq!(result, "HELLO");
331
+ /// ```
332
+ ///
333
+ /// # Errors
334
+ ///
335
+ /// Returns `MyError::InvalidInput` if input is empty.
336
+ pub fn process(input: &str) -> Result<String, MyError> {
337
+ // Implementation
338
+ }
339
+ ```
340
+
341
+ ## Project Structure
342
+
343
+ ```
344
+ project/
345
+ ├── Cargo.toml # Package manifest
346
+ ├── Cargo.lock # Dependency lock file (commit this)
347
+ ├── README.md # Project overview (allowed in root)
348
+ ├── CHANGELOG.md # Version history (allowed in root)
349
+ ├── AGENTS.md # AI assistant rules (allowed in root)
350
+ ├── LICENSE # Project license (allowed in root)
351
+ ├── CONTRIBUTING.md # Contribution guidelines (allowed in root)
352
+ ├── CODE_OF_CONDUCT.md # Code of conduct (allowed in root)
353
+ ├── SECURITY.md # Security policy (allowed in root)
354
+ ├── src/
355
+ │ ├── lib.rs # Library root (for libraries)
356
+ │ ├── main.rs # Binary root (for applications)
357
+ │ └── ...
358
+ ├── tests/ # Integration tests
359
+ ├── examples/ # Example code
360
+ ├── benches/ # Benchmarks
361
+ └── docs/ # Project documentation
362
+ ```
363
+
364
+ ## CI/CD Requirements
365
+
366
+ Must include GitHub Actions workflows for:
367
+
368
+ 1. **Testing** (`rust-test.yml`):
369
+ - Test on ubuntu-latest, windows-latest, macos-latest
370
+ - Use `cargo-nextest` for fast test execution
371
+ - Upload test results
372
+
373
+ 2. **Linting** (`rust-lint.yml`):
374
+ - Format check: `cargo +nightly fmt --all -- --check`
375
+ - Clippy: `cargo clippy --workspace -- -D warnings`
376
+ - All targets: `cargo clippy --workspace --all-targets -- -D warnings`
377
+
378
+ 3. **Codespell** (`codespell.yml`):
379
+ - Check for typos in code and documentation
380
+ - Fail on errors
381
+
382
+ ## Crate Publication
383
+
384
+ ### Publishing to crates.io
385
+
386
+ **Prerequisites:**
387
+ 1. Create account at https://crates.io
388
+ 2. Generate API token: `cargo login`
389
+ 3. Add `CARGO_TOKEN` to GitHub repository secrets
390
+
391
+ **Cargo.toml Configuration:**
392
+
393
+ ```toml
394
+ [package]
395
+ name = "your-crate-name"
396
+ version = "1.0.0"
397
+ edition = "2024"
398
+ authors = ["Your Name <your.email@example.com>"]
399
+ license = "MIT OR Apache-2.0"
400
+ description = "A short description of your crate"
401
+ documentation = "https://docs.rs/your-crate-name"
402
+ homepage = "https://github.com/your-org/your-crate-name"
403
+ repository = "https://github.com/your-org/your-crate-name"
404
+ readme = "README.md"
405
+ keywords = ["your", "keywords", "here"]
406
+ categories = ["category"]
407
+ exclude = [
408
+ ".github/",
409
+ "tests/",
410
+ "benches/",
411
+ "examples/",
412
+ "*.sh",
413
+ ]
414
+
415
+ [package.metadata.docs.rs]
416
+ all-features = true
417
+ rustdoc-args = ["--cfg", "docsrs"]
418
+ ```
419
+
420
+ **Publishing Workflow:**
421
+
422
+ 1. Update version in Cargo.toml
423
+ 2. Update CHANGELOG.md
424
+ 3. Run quality checks:
425
+ ```bash
426
+ cargo fmt --all
427
+ cargo clippy --workspace --all-targets -- -D warnings
428
+ cargo test --all-features
429
+ cargo doc --no-deps --all-features
430
+ ```
431
+ 4. Create git tag: `git tag v1.0.0 && git push --tags`
432
+ 5. GitHub Actions automatically publishes to crates.io
433
+ 6. Or manual publish: `cargo publish`
434
+
435
+ **Publishing Checklist:**
436
+
437
+ - ✅ All tests passing (`cargo test --all-features`)
438
+ - ✅ No clippy warnings (`cargo clippy -- -D warnings`)
439
+ - ✅ Code formatted (`cargo fmt --all -- --check`)
440
+ - ✅ Documentation builds (`cargo doc --no-deps`)
441
+ - ✅ Version updated in Cargo.toml
442
+ - ✅ CHANGELOG.md updated
443
+ - ✅ README.md up to date
444
+ - ✅ LICENSE file present
445
+ - ✅ Package size < 10MB (check with `cargo package --list`)
446
+ - ✅ Verify with `cargo publish --dry-run`
447
+
448
+ **Semantic Versioning:**
449
+
450
+ Follow [SemVer](https://semver.org/) strictly:
451
+ - **MAJOR**: Breaking API changes
452
+ - **MINOR**: New features (backwards compatible)
453
+ - **PATCH**: Bug fixes (backwards compatible)
454
+
455
+ **Documentation:**
456
+
457
+ - Use `///` for public API documentation
458
+ - Include examples in doc comments
459
+ - Use `#![deny(missing_docs)]` for libraries
460
+ - Test documentation examples with `cargo test --doc`
461
+
462
+ ```rust
463
+ /// Processes the input data and returns a result.
464
+ ///
465
+ /// # Arguments
466
+ ///
467
+ /// * `input` - The input string to process
468
+ ///
469
+ /// # Examples
470
+ ///
471
+ /// ```
472
+ /// use your_crate::process;
473
+ ///
474
+ /// let result = process("hello");
475
+ /// assert_eq!(result, "HELLO");
476
+ /// ```
477
+ ///
478
+ /// # Errors
479
+ ///
480
+ /// Returns an error if the input is empty.
481
+ pub fn process(input: &str) -> Result<String, Error> {
482
+ // Implementation
483
+ }
484
+ ```
485
+
486
+ <!-- RUST:END -->
487
+
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: "SAS"
3
+ description: "Execute these commands after EVERY implementation (see AGENT_AUTOMATION module for full workflow)."
4
+ version: "1.0.0"
5
+ category: "languages"
6
+ author: "Rulebook"
7
+ tags: ["languages", "language"]
8
+ dependencies: []
9
+ conflicts: []
10
+ ---
11
+ <!-- SAS:START -->
12
+ # SAS Project Rules
13
+
14
+ ## Agent Automation Commands
15
+
16
+ **CRITICAL**: Execute these commands after EVERY implementation (see AGENT_AUTOMATION module for full workflow).
17
+
18
+ ```bash
19
+ # Complete quality check sequence:
20
+ # Run SAS code validation (project-specific)
21
+ # Run SASUnit tests
22
+ # Check log files for errors/warnings
23
+
24
+ # SAS projects typically use:
25
+ sas -sysin validate_code.sas # Code validation
26
+ sas -sysin run_tests.sas # Run SASUnit tests
27
+ ```
28
+
29
+ ## SAS Configuration
30
+
31
+ **CRITICAL**: Use SAS 9.4+ with code validation and testing.
32
+
33
+ - **Version**: SAS 9.4+ or Viya 3.5+
34
+ - **Linter**: SAS Code Analyzer
35
+ - **Testing**: SASUnit or custom test frameworks
36
+ - **Version Control**: Track all .sas files
37
+
38
+ ## Code Quality Standards
39
+
40
+ ### Mandatory Quality Checks
41
+
42
+ **IMPORTANT**: These commands MUST match your GitHub Actions workflows!
43
+
44
+ ```bash
45
+ # Pre-Commit Checklist (MUST match .github/workflows/*.yml)
46
+
47
+ # 1. Validate SAS code syntax (matches workflow)
48
+ sas -sysin your_program.sas -nosplash -print /dev/null
49
+
50
+ # 2. Run SASUnit tests (matches workflow)
51
+ %include "sasunit/run_all_tests.sas";
52
+
53
+ # 3. Check for warnings and errors (matches workflow)
54
+ grep -i "ERROR\|WARNING" your_program.log
55
+
56
+ # If ANY fails: ❌ DO NOT COMMIT - Fix first!
57
+ ```
58
+
59
+ **Why This Matters:**
60
+ - SAS code with syntax errors will fail in production
61
+ - Missing test validation = data processing errors
62
+
63
+ ### Code Style
64
+
65
+ ```sas
66
+ /* Good: Clear, commented, structured */
67
+ %macro process_data(input_ds=, output_ds=, threshold=0.5);
68
+ %* Validate inputs;
69
+ %if %length(&input_ds) = 0 %then %do;
70
+ %put ERROR: input_ds parameter required;
71
+ %return;
72
+ %end;
73
+
74
+ /* Process data */
75
+ data &output_ds;
76
+ set &input_ds;
77
+ where value > &threshold;
78
+ run;
79
+ %mend;
80
+ ```
81
+
82
+ <!-- SAS:END -->
83
+