Skip to content

feat: add ai-armor module - #1436

Open
billymaulana wants to merge 5 commits into
nuxt:mainfrom
billymaulana:feat/add-ai-armor
Open

billymaulana wants to merge 5 commits into
nuxt:mainfrom
billymaulana:feat/add-ai-armor

Conversation

@billymaulana

Copy link
Copy Markdown
Contributor

Module Information

Description

Production AI toolkit for Nuxt with:

  • Rate Limiting — Sliding window, fixed window, or token bucket per IP/user/key
  • Cost Tracking — Real-time daily/monthly spend with budget alerts
  • Safety Guardrails — Prompt injection detection, PII filtering
  • Auto-Imported Composables — useArmorCost(), useArmorStatus(), useArmorSafety()
  • Server API Routes — Admin endpoints for monitoring
  • TypeScript First — Full type safety

Works with OpenAI, Google, Anthropic, Mistral, and 15+ AI providers.

Quick Setup

npx nuxi module add @ai-armor/nuxt
export default defineNuxtConfig({
  modules: ['@ai-armor/nuxt'],
  aiArmor: {
    rateLimit: { strategy: 'sliding-window', rules: [{ key: 'ip', limit: 30, window: '1m' }] },
    budget: { daily: 50, monthly: 500, onExceeded: 'warn' },
    safety: { promptInjection: true, piiDetection: true },
  },
})

Checklist

  • Published on npm (@ai-armor/nuxt@0.1.6)
  • MIT License
  • TypeScript support with exported types
  • Documentation site live
  • Tests passing (392 tests, 99.6% coverage)
  • ESM only
  • defineNuxtModule with proper meta

@coderabbitai

coderabbitai Bot commented Mar 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f58f08e7-6756-4a54-85de-964585426d53
Commits

Reviewing files that changed from the base of the PR and between 130b063 and c023c71.

Files ignored due to path filters: 1
  • icons/ai-armor.svg is excluded by !**/*.svg
Files selected for processing: 1
  • modules/ai-armor.yml

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Walkthrough

A new module manifest file modules/ai-armor.yml was added describing the ai-armor Nuxt module. The manifest provides package metadata (name, description), entry points (repo, npm), links (icon, github, website, learn_more), classification fields (category, type), maintainer info, and a Nuxt compatibility constraint set to >=3.0.0. No runtime code or exported API changes were made.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Priority: Normal

Merge Risk: Minimal · up to c023c

The metadata update is mergeable with normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly identifies the main change: adding the ai-armor module.
Description check Passed The description explains the module, provides setup details, and lists key metadata and checks. The optional linked issue section is not required.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
modules/ai-armor.yml (1)

16-16: Consider omitting the empty requires field.

In YAML, an empty object can be omitted entirely. If there are no Nuxt-specific module dependencies, the requires field can be removed for cleaner syntax. However, keeping it explicit is also acceptable.

♻️ Optional cleanup
 compatibility:
   nuxt: '>=3.0.0'
-  requires: {}

Based on learnings: In YAML manifests within Nuxt modules, the requires field is for Nuxt-specific module/build-time dependencies and bridge compatibility, not npm dependencies.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@modules/ai-armor.yml` at line 16, Remove the empty top-level "requires" field
from the module YAML manifest: since it contains an empty object (requires: {}),
delete that key entirely from the module manifest root to produce cleaner YAML;
if you prefer to keep it explicit you can leave it, but otherwise remove the
"requires" entry.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@modules/ai-armor.yml`:
- Line 16: Remove the empty top-level "requires" field from the module YAML
manifest: since it contains an empty object (requires: {}), delete that key
entirely from the module manifest root to produce cleaner YAML; if you prefer to
keep it explicit you can leave it, but otherwise remove the "requires" entry.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1072aafe-65cf-4001-8ba9-5fb24e6f8641

📥 Commits

Reviewing files that changed from the base of the PR and between da52820 and b9974d5.

⛔ Files ignored due to path filters (1)
  • icons/ai-armor.svg is excluded by !**/*.svg
📒 Files selected for processing (1)
  • modules/ai-armor.yml

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants