Title: feat(forge-ai): scaffold forge-ai crate with AiProvider trait, request types, and MockProvider · Issue #86 · elcode-id/elcode-forge · GitHub
Open Graph Title: feat(forge-ai): scaffold forge-ai crate with AiProvider trait, request types, and MockProvider · Issue #86 · elcode-id/elcode-forge
X Title: feat(forge-ai): scaffold forge-ai crate with AiProvider trait, request types, and MockProvider · Issue #86 · elcode-id/elcode-forge
Description: 1. Context & Objective Scaffold the new crates/forge-ai domain crate (depending ONLY on forge-core per DAG rules) with the AiProvider trait, request/response/usage types, ensure_ai_enabled guard, and deterministic MockProvider for offlin...
Open Graph Description: 1. Context & Objective Scaffold the new crates/forge-ai domain crate (depending ONLY on forge-core per DAG rules) with the AiProvider trait, request/response/usage types, ensure_ai_enabled guard, a...
X Description: 1. Context & Objective Scaffold the new crates/forge-ai domain crate (depending ONLY on forge-core per DAG rules) with the AiProvider trait, request/response/usage types, ensure_ai_enabled guar...
Opengraph URL: https://github.com/elcode-id/elcode-forge/issues/86
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"feat(forge-ai): scaffold forge-ai crate with AiProvider trait, request types, and MockProvider","articleBody":"## 1. Context & Objective\nScaffold the new `crates/forge-ai` domain crate (depending ONLY on `forge-core` per DAG rules) with the `AiProvider` trait, request/response/usage types, `ensure_ai_enabled` guard, and deterministic `MockProvider` for offline testing (PRD §19).\n\n- **Parent Epic:** #82\n- **GitFlow Branch:** `feat/forge-086-forge-ai-scaffold`\n- **Execution Wave:** `wave-10`\n- **DAG Dependencies:** Depends on #85\n- **Estimated Size:** ~240 LOC (`\u003c 400 LOC`)\n\n## 2. Target Files\n- `Cargo.toml` *(MODIFY: add `crates/forge-ai` member and workspace dependencies `forge-ai`, `ureq`)*\n- `crates/forge-ai/Cargo.toml` *(NEW)*\n- `crates/forge-ai/src/lib.rs` *(NEW)*\n- `crates/forge-ai/src/provider.rs` *(NEW: `AiProvider` trait + `ensure_ai_enabled`)*\n- `crates/forge-ai/src/types.rs` *(NEW: `AiRequest`, `AiMessage`, `AiRole`, `AiResponse`, `TokenUsage`)*\n- `crates/forge-ai/src/mock.rs` *(NEW: `MockProvider` with scripted responses and recorded requests)*\n- `AGENTS.md` *(MODIFY: add `crates/forge-ai/` to Section 1 topology and DAG)*\n- `docs/ARCHITECTURE_STATE.md` *(MODIFY)*\n\n## 3. Public Contract\n```rust\npub trait AiProvider {\n fn name(&self) -> &'static str;\n fn generate(&self, req: &AiRequest) -> Result\u003cAiResponse, ForgeError>;\n fn stream(&self, req: &AiRequest, on_chunk: &mut dyn FnMut(&str)) -> Result\u003cAiResponse, ForgeError>;\n fn embed(&self, inputs: &[String]) -> Result\u003cVec\u003cVec\u003cf32>>, ForgeError>;\n fn structured_output(&self, req: &AiRequest, schema: &serde_json::Value) -> Result\u003cserde_json::Value, ForgeError>;\n}\n\npub fn ensure_ai_enabled(cfg: &AiConfig) -> Result\u003c(), ForgeError>;\n```\n\n## 4. Security & Privacy Invariants\n- `crates/forge-ai` depends ONLY on `forge-core`, `serde`, `serde_json`, `ureq`, and `blake3`.\n- Zero-panic policy enforced across all modules.\n- `ensure_ai_enabled` returns an actionable `ForgeError::Ai` when `cfg.enabled == false`.\n\n## 5. Definition of Done & Verification (Tier 3)\n- Unit tests for `MockProvider` (`generate`, `stream`, `embed`, `structured_output`, request recording) and `ensure_ai_enabled`.\n- **Selective Verification Gate (Tier 3):**\n 1. `cargo fmt --all -- --check`\n 2. `cargo clippy --workspace --all-targets -- -D warnings`\n 3. `cargo test --workspace --lib --bins`","author":{"url":"https://github.com/luksluki","@type":"Person","name":"luksluki"},"datePublished":"2026-10-19T14:21:20Z","url":"https://github.com/elcode-id/elcode-forge/issues/86"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7b63d378-126a-9764-9377-5499cd17d01d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B980:2BB6A1:16057B:1E2B37:6B059792 |
| html-safe-nonce | c229a55a2b7936d6cb72e77a189d8c8fe93d5553ae997f4b0694771b0fc5a455 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOTgwOjJCQjZBMToxNjA1N0I6MUUyQjM3OjZCMDU5NzkyIiwidmlzaXRvcl9pZCI6IjE4MDg2NTA4Mjc5NTU4MDQwNTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f8cf18985734ed9a9d181a5264347be73eb452a11f49bca6bf3fd27171a5e1ad |
| hovercard-subject-tag | issue:5925646442 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/elcode-id/elcode-forge/86/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0f79dd89045c064683f74f4ac9f5e166e6e72f5c5e46d457c1be4dcc35e1383b/elcode-id/elcode-forge/issues/86 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0f79dd89045c064683f74f4ac9f5e166e6e72f5c5e46d457c1be4dcc35e1383b/elcode-id/elcode-forge/issues/86 |
| og:image:alt | 1. Context & Objective Scaffold the new crates/forge-ai domain crate (depending ONLY on forge-core per DAG rules) with the AiProvider trait, request/response/usage types, ensure_ai_enabled guard, a... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | luksluki |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3b72fd2385d76a50ce0fe937d50bb4a81434432c4fd47866074a26f6cd03623f |
| turbo-cache-control | no-preview |
| go-import | github.com/elcode-id/elcode-forge git https://github.com/elcode-id/elcode-forge.git |
| octolytics-dimension-user_id | 337957755 |
| octolytics-dimension-user_login | elcode-id |
| octolytics-dimension-repository_id | 1423983661 |
| octolytics-dimension-repository_nwo | elcode-id/elcode-forge |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1423983661 |
| octolytics-dimension-repository_network_root_nwo | elcode-id/elcode-forge |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 58e2bd32336f3dcee343ec627a4d09c7c444e214 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width