open-index/open-npm huggingface dataset:
npm package: @gibsonmurray/react-hooks
Description: A collection of custom React hooks
Author: Gibson Murray
Latest version: 1.0.18

# React Custom Hooks Documentation

This documentation covers a collection of custom React hooks that provide various functionalities to enhance your React applications.

## Table of Contents

-   [useArray](./hooks/useArray.tsx)
-   [useAsync](./hooks/useAsync.tsx)
-   [useClickOutside](./hooks/useClickOutside.tsx)
-   [useClipboard](./hooks/useClipboard.tsx)
-   [useCookie](./hooks/useCookie.tsx)
-   [useDarkMode](./hooks/useDarkMode.tsx)
-   [useDebounce](./hooks/useDebounce.tsx)
-   [useDebug](./hooks/useDebug.tsx)
-   [useDeepEffect](./hooks/useDeepEffect.tsx)
-   [useDocumentTitle](./hooks/useDocumentTitle.tsx)
-   [useDragDrop](./hooks/useDragDrop.tsx)
-   [useEventListener](./hooks/useEventListener.tsx)
-   [useFetch](./hooks/useFetch.tsx)
-   [useFlipGSAP](./hooks/useFlipGSAP.tsx)
-   [useForm](./hooks/useForm.tsx)
-   [useGeolocation](./hooks/useGeolocation.tsx)
-   [useGlobalState](./hooks/useGlobalState.tsx)
-   [useHover](./hooks/useHover.tsx)
-   [useIdle](./hooks/useIdle.tsx)
-   [useImageLoad](./hooks/useImageLoad.tsx)
-   [useKeyPress](./hooks/useKeyPress.tsx)
-   [useLockScroll](./hooks/useLockScroll.tsx)
-   [useLongPress](./hooks/useLongPress.tsx)
-   [useMediaDevices](./hooks/useMediaDevices.tsx)
-   [useMediaQuery](./hooks/useMediaQuery.tsx)
-   [useMounted](./hooks/useMounted.tsx)
-   [useMouse](./hooks/useMouse.tsx)
-   [useOnlineStatus](./hooks/useOnlineStatus.tsx)
-   [useOnScreen](./hooks/useOnScreen.tsx)
-   [useOrientation](./hooks/useOrientation.tsx)
-   [usePermission](./hooks/usePermission.tsx)
-   [usePrevious](./hooks/usePrevious.tsx)
-   [useRenderCount](./hooks/useRenderCount.tsx)
-   [useScript](./hooks/useScript.tsx)
-   [useSize](./hooks/useSize.tsx)
-   [useStateHistory](./hooks/useStateHistory.tsx)
-   [useStateValidation](./hooks/useStateValidation.tsx)
-   [useLocalStorage](./hooks/useLocalStorage.tsx)
-   [useSessionStorage](./hooks/useSessionStorage.tsx)
-   [useTimeout](./hooks/useTimeout.tsx)
-   [useToggle](./hooks/useToggle.tsx)
-   [useUnmounted](./hooks/useUnmounted.tsx)
-   [useUpdated](./hooks/useUpdated.tsx)
-   [useWindowSize](./hooks/useWindowSize.tsx)

## Use the CLI
There is a CLI that can be used to import the hooks into your project where you can directly edit them.

This is the repository for the CLI: [gibsonmurray/ghooks-cli](https://github.com/gibsonmurray/ghooks-cli)

## License

This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more details.
npm package: @gichigi/revolut-account-migration
Description: A prompt to walk you through migrating your Revolut account from one country to another
Author: Tahi Gichigi
Latest version: 1.0.0

# /revolut-account-migration

A prompt to walk someone through a Revolut account migration from one country to another.

For best results, run `/revolut-account-migration` before closing your account.

## Usage

```bash
npx @gichigi/revolut-account-migration
```

This will print the full migration prompt to your terminal. Copy it into any AI conversation (Claude, ChatGPT, etc.), upload your Revolut CSV statement exports, and follow the steps.

## What it does

Walks you through the full process of closing a Revolut account in one country and opening a new one in another. Covers:

- Statement exports (before you lose access)
- Recurring payment mapping from your CSVs
- Direct debit migration
- Standing orders and transfers
- Zeroing out vaults, crypto, and sub-accounts
- Safe closure timing
- Rebuilding payments on the new account

**Export first. Close second. Don't wing it.**

## Made by

[Mooch](https://mooch.agency) — built by Tahi Gichigi

---

Version: v1.0 | Last updated: 20 Mar 2026
npm package: @gicho/core
Description: A collection of base utilities for happy coding with TypeScript.
Author: Lucas Choi
Latest version: 0.0.1-alpha.4

# gicho

### *IMPORTANT :: For now, This is UNDER CONSTRUCTION.*

---

**A collection of base utilities for happy coding with TypeScript.**
_gicho_ means **foundation, basis** in Korean — modern essential tools for faster, more efficient development.

---

## ✨ Why gicho?

- 🧩 **Type-safe utility functions** — written in modern TypeScript
- 💨 **100% ESM** — no CommonJS, no legacy build
- 🌿 **Zero dependencies** — lightweight and fast by design
- 💛 **Made for joyful development** — simple tools you'll enjoy using

---

## 📦 Installation

```bash
npm install gicho
# or
pnpm add gicho
```

---

## License

MIT License. Made with ❤️
npm package: @gicm/activity-logger
Description: On-chain activity logging for gICM Orchestrator (SQLite + Solana + Arweave)
Author: Mirko Basil Dölger
Latest version: 0.1.0

# @gicm/activity-logger

On-chain activity logging for gICM - SQLite, Solana, and Arweave support.

## Installation

```bash
npm install @gicm/activity-logger
# or
pnpm add @gicm/activity-logger
```

## Features

- **SQLite Storage** - Local activity logging with SQLite
- **Solana Memos** - On-chain activity anchoring via SPL Memo
- **Arweave Archival** - Permanent storage via Irys/Arweave

## Usage

```typescript
import { ActivityLogger } from "@gicm/activity-logger";

const logger = new ActivityLogger({
  sqlite: { path: "./logs.db" },
  solana: { rpcUrl: process.env.SOLANA_RPC_URL },
});

await logger.log({
  type: "trade",
  action: "swap",
  data: { from: "SOL", to: "USDC", amount: 100 },
});
```

## Exports

```typescript
// Main logger
import { ActivityLogger } from "@gicm/activity-logger";

// SQLite storage
import { SQLiteLogger } from "@gicm/activity-logger/db";

// Solana integration
import { SolanaLogger } from "@gicm/activity-logger/solana";

// Arweave integration
import { ArweaveLogger } from "@gicm/activity-logger/arweave";
```

## License

MIT
npm package: @gicm/agent-core
Description: Core utilities for gICM Web3 AI agents - shared types, base classes, and chain abstractions
Author: Mirko Basil Dölger
Latest version: 1.0.0

# @gicm/agent-core

> Core utilities for gICM Web3 AI agents - shared types, base classes, and chain abstractions

[![npm version](https://badge.fury.io/js/@gicm%2Fagent-core.svg)](https://www.npmjs.com/package/@gicm/agent-core)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Installation

```bash
npm install @gicm/agent-core
# or
pnpm add @gicm/agent-core
```

## Features

- **BaseAgent Class**: Event-driven agent foundation with progress tracking
- **LLM Client**: Universal client for Claude, GPT-4, Gemini with effort optimization
- **Chain Abstractions**: Solana and EVM chain utilities
- **Type Safety**: Full TypeScript with Zod validation

## Quick Start

```typescript
import { BaseAgent, createLLMClient } from "@gicm/agent-core";

// Create an LLM client
const llm = createLLMClient({
  provider: "anthropic",
  model: "claude-opus-4-5-20251101",
  effort: "medium", // Token optimization
});

const response = await llm.chat([
  { role: "user", content: "Analyze this token..." }
]);
```

## LLM Client with Opus 4.5 Features

```typescript
import { createPowerClient, createBalancedClient } from "@gicm/agent-core/llm";

// High-power mode with extended thinking
const powerClient = createPowerClient({
  extendedThinking: {
    enabled: true,
    budgetTokens: 16000,
  },
});

// Balanced mode for everyday use (50% token savings)
const balancedClient = createBalancedClient();
```

## Creating Custom Agents

```typescript
import { BaseAgent } from "@gicm/agent-core";

class MyAgent extends BaseAgent {
  async run(input: unknown): Promise<unknown> {
    this.emit("started");
    this.emit("progress", 50, "Processing...");

    // Your agent logic here
    const result = await this.processInput(input);

    this.emit("completed", result);
    return result;
  }
}
```

## Exports

| Export | Description |
|--------|-------------|
| `@gicm/agent-core` | Main exports (BaseAgent, types) |
| `@gicm/agent-core/llm` | LLM client and utilities |
| `@gicm/agent-core/chains` | Chain abstractions (Solana, EVM) |

## License

MIT - Built by [gICM](https://gicm.dev)
npm package: @gicm/audit-agent
Description: AI-powered smart contract security auditor - vulnerability detection for Solidity & Rust
Author: Mirko Basil Dölger
Latest version: 1.0.1

# @gicm/audit-agent

> AI-powered smart contract security auditor - Vulnerability detection for Solidity & Rust

[![npm version](https://badge.fury.io/js/@gicm%2Faudit-agent.svg)](https://www.npmjs.com/package/@gicm/audit-agent)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Installation

```bash
npm install @gicm/audit-agent
# or
pnpm add @gicm/audit-agent
```

## Features

- **Solidity Auditing**: Reentrancy, overflow, access control
- **Rust/Anchor Auditing**: PDA validation, signer checks
- **OWASP Coverage**: Top smart contract vulnerabilities
- **Report Generation**: Detailed findings with severity

## Quick Start

```typescript
import { AuditAgent } from "@gicm/audit-agent";

const agent = new AuditAgent();

const report = await agent.run({
  source: "./contracts/MyContract.sol",
  depth: "comprehensive",
});
```

## License

MIT - Built by [gICM](https://gicm.dev)
npm package: @gicm/autonomy
Description: Level 2+ Autonomy system for gICM platform - bounded autonomous execution with human oversight
Author: Mirko Basil Dölger
Latest version: 1.0.1

# @gicm/autonomy

> Level 2+ Bounded Autonomous Execution with Human Oversight

[![npm version](https://badge.fury.io/js/@gicm%2Fautonomy.svg)](https://www.npmjs.com/package/@gicm/autonomy)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Installation

```bash
npm install @gicm/autonomy
# or
pnpm add @gicm/autonomy
```

## Features

- **Risk Classification**: Score actions 0-100 based on financial impact, reversibility, category
- **Decision Routing**: auto_execute | queue_approval | escalate | reject
- **Boundary Enforcement**: Daily limits, value thresholds, blocked operations
- **Approval Queue**: Priority-ordered with auto-expiration and batch operations
- **Audit Trail**: Hash-chain integrity for complete action history

## Quick Start

```typescript
import { AutonomyEngine } from "@gicm/autonomy";

const autonomy = new AutonomyEngine({
  autonomyLevel: 2, // Bounded autonomy
  boundaries: {
    financial: { maxAutoExpense: 50, maxDailySpend: 100 },
    content: { maxAutoPostsPerDay: 10 },
  },
});

// Route an action
const decision = await autonomy.route({
  type: "trading",
  name: "dca_buy",
  description: "DCA buy 10 SOL",
  value: 10,
  category: "trading",
});

if (decision.action === "auto_execute") {
  // Safe to execute automatically
  await executeAction();
} else if (decision.action === "queue_approval") {
  // Needs human approval
  console.log(`Queued for approval: ${decision.requestId}`);
}
```

## CLI Commands

```bash
gicm-autonomy status           # Show engine status
gicm-autonomy queue            # List pending approvals
gicm-autonomy approve <id>     # Approve a request
gicm-autonomy reject <id>      # Reject a request
gicm-autonomy batch-approve    # Batch approve (--safe, --category)
gicm-autonomy boundaries       # Show/update boundaries
gicm-autonomy audit            # View audit log
```

## Risk Thresholds

| Risk Score | Category | Action |
|------------|----------|--------|
| 0-20 | Safe | auto_execute |
| 21-40 | Low | auto_execute or queue |
| 41-60 | Medium | queue_approval |
| 61-80 | High | escalate |
| 81-100 | Critical | reject |

## Exports

| Export | Description |
|--------|-------------|
| `@gicm/autonomy` | Main AutonomyEngine |
| `@gicm/autonomy/decision` | RiskClassifier, BoundaryChecker |
| `@gicm/autonomy/execution` | AutoExecutor, RollbackManager |
| `@gicm/autonomy/approval` | ApprovalQueue, BatchApproval |
| `@gicm/autonomy/audit` | AuditLogger |

## License

MIT - Built by [gICM](https://gicm.dev)
npm package: @gicm/backtester
Description: Trading backtester - strategy testing, risk analytics, Monte Carlo simulation
Author: Mirko Basil Dölger
Latest version: 0.1.1

# @gicm/backtester

Trading strategy backtester with Monte Carlo simulation and risk analytics.

## Installation

```bash
npm install @gicm/backtester
# or
pnpm add @gicm/backtester
```

## Features

- **Strategy Testing** - Backtest trading strategies against historical data
- **Risk Analytics** - Sharpe ratio, max drawdown, win rate calculations
- **Monte Carlo** - Statistical simulation for strategy validation
- **CLI Tool** - Command-line interface for quick backtests

## Usage

```typescript
import { Backtester, Strategy } from "@gicm/backtester";

const strategy: Strategy = {
  name: "Simple MA Crossover",
  entry: (data) => data.sma20 > data.sma50,
  exit: (data) => data.sma20 < data.sma50,
};

const backtester = new Backtester();
const results = await backtester.run({
  strategy,
  data: priceData,
  initialCapital: 10000,
});

console.log(results.metrics);
// { sharpeRatio: 1.5, maxDrawdown: -12%, winRate: 58% }
```

## CLI

```bash
# Run backtest
gicm-backtest --strategy ma-crossover --pair SOL/USDC

# Monte Carlo simulation
gicm-backtest --monte-carlo --iterations 1000
```

## License

MIT
npm package: @gicm/bridge-agent
Description: Cross-chain bridge agent - Wormhole, LayerZero, DeBridge integration
Author: Mirko Basil Dölger
Latest version: 0.1.1

# @gicm/bridge-agent

> Cross-chain bridge agent - Wormhole, LayerZero, DeBridge integration

[![npm version](https://badge.fury.io/js/@gicm%2Fbridge-agent.svg)](https://www.npmjs.com/package/@gicm/bridge-agent)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Installation

```bash
npm install @gicm/bridge-agent
# or
pnpm add @gicm/bridge-agent
```

## Features

- **Wormhole**: Multi-chain message passing
- **LayerZero**: Omnichain interoperability
- **DeBridge**: Cross-chain swaps and transfers
- **Route Optimization**: Find best bridge paths

## License

MIT - Built by [gICM](https://gicm.dev)
npm package: @gicm/builder-agent
Description: Code generation agent for gICM - builds integrations from approved discoveries
Author: Mirko Basil Dölger
Latest version: 0.1.1

# @gicm/builder-agent

> Code generation agent - Builds integrations from approved discoveries

[![npm version](https://badge.fury.io/js/@gicm%2Fbuilder-agent.svg)](https://www.npmjs.com/package/@gicm/builder-agent)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Installation

```bash
npm install @gicm/builder-agent
# or
pnpm add @gicm/builder-agent
```

## Features

- **Template System**: basic, tool_agent, trading_agent, research_agent
- **TypeScript Generation**: Full type safety
- **Test Generation**: Vitest test suites
- **Documentation**: Auto-generate READMEs

## License

MIT - Built by [gICM](https://gicm.dev)
npm package: @gicm/dao-agent
Description: DAO governance agent - Snapshot, Tally, Realms integration
Author: Mirko Basil Dölger
Latest version: 0.1.1

# @gicm/dao-agent

> DAO governance agent - Snapshot, Tally, Realms integration

[![npm version](https://badge.fury.io/js/@gicm%2Fdao-agent.svg)](https://www.npmjs.com/package/@gicm/dao-agent)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Installation

```bash
npm install @gicm/dao-agent
# or
pnpm add @gicm/dao-agent
```

## Features

- **Snapshot**: Off-chain voting and proposals
- **Tally**: On-chain governance for EVM DAOs
- **Realms**: Solana DAO governance
- **Proposal Tracking**: Monitor and vote on proposals

## License

MIT - Built by [gICM](https://gicm.dev)
npm package: @gicm/decision-agent
Description: LLM-powered decision engine for evaluating discoveries in gICM Orchestrator
Author: Mirko Basil Dölger
Latest version: 0.1.1

# @gicm/decision-agent

> LLM-powered decision engine for evaluating discoveries

[![npm version](https://badge.fury.io/js/@gicm%2Fdecision-agent.svg)](https://www.npmjs.com/package/@gicm/decision-agent)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Installation

```bash
npm install @gicm/decision-agent
# or
pnpm add @gicm/decision-agent
```

## Features

- **Multi-Factor Scoring**: userDemand, competitiveValue, technicalFit, effort, impact
- **LLM Integration**: Claude/GPT-4 powered analysis
- **Confidence Metrics**: Tracks prediction accuracy
- **Threshold Filtering**: Auto-approve/reject based on scores

## Quick Start

```typescript
import { DecisionAgent } from "@gicm/decision-agent";

const agent = new DecisionAgent({
  model: "claude-opus-4-5-20251101",
  approvalThreshold: 75,
});

const decision = await agent.evaluate({
  discovery: {
    title: "New MCP server pattern",
    source: "github",
    url: "https://github.com/...",
  },
});

console.log(decision.score); // 0-100
console.log(decision.recommendation); // "approve" | "reject" | "review"
```

## License

MIT - Built by [gICM](https://gicm.dev)
npm package: @gicm/defi-agent
Description: AI-powered DeFi analytics agent - token analysis, yield optimization, liquidity monitoring
Author: Mirko Basil Dölger
Latest version: 1.0.1

# @gicm/defi-agent

> AI-powered DeFi analytics - Token analysis, yield optimization, liquidity monitoring

[![npm version](https://badge.fury.io/js/@gicm%2Fdefi-agent.svg)](https://www.npmjs.com/package/@gicm/defi-agent)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Installation

```bash
npm install @gicm/defi-agent
# or
pnpm add @gicm/defi-agent
```

## Features

- **Token Analysis**: Birdeye, DexScreener integration
- **Yield Optimization**: Find best APY opportunities
- **Liquidity Monitoring**: Track pool depths and slippage
- **Risk Scoring**: Evaluate token safety

## Quick Start

```typescript
import { DefiAgent } from "@gicm/defi-agent";

const agent = new DefiAgent({
  providers: ["birdeye", "dexscreener"],
});

const analysis = await agent.run({
  command: "analyze SOL/USDC liquidity",
});
```

## License

MIT - Built by [gICM](https://gicm.dev)
npm package: @gicm/deployer-agent
Description: Deployment agent for gICM - publishes to registry, npm, and GitHub
Author: Mirko Basil Dölger
Latest version: 0.1.1

# @gicm/deployer-agent

> Deployment agent - Publishes to registry, npm, and GitHub

[![npm version](https://badge.fury.io/js/@gicm%2Fdeployer-agent.svg)](https://www.npmjs.com/package/@gicm/deployer-agent)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Installation

```bash
npm install @gicm/deployer-agent
# or
pnpm add @gicm/deployer-agent
```

## Features

- **npm Publishing**: Automated package publishing
- **GitHub Releases**: Create releases with changelogs
- **Registry Sync**: Sync to gICM marketplace
- **Version Bumping**: Semantic versioning

## License

MIT - Built by [gICM](https://gicm.dev)
npm package: @gicm/gicm-autonomy
Description: gICM Autonomy Level 2 - Bounded autonomous decision-making system
Author: Mirko Basil Dölger
Latest version: 0.1.0

# @gicm/gicm-autonomy

gICM Autonomy Level 2 - Bounded autonomous decision-making system.

## Installation

```bash
npm install @gicm/gicm-autonomy
# or
pnpm add @gicm/gicm-autonomy
```

## Features

- **Autonomy Levels** - Level 1 (manual) to Level 4 (full autonomous)
- **Risk Classification** - Automatic risk scoring for actions
- **Boundary Enforcement** - Configurable limits and thresholds
- **Decision Routing** - Auto-execute, queue approval, or escalate

## Usage

```typescript
import { AutonomyEngine } from "@gicm/gicm-autonomy";

const autonomy = new AutonomyEngine({
  level: 2, // Bounded autonomy
  boundaries: {
    maxAutoExpense: 50,
    maxDailySpend: 100,
  },
});

// Route an action through the autonomy engine
const decision = await autonomy.route({
  type: "trading",
  action: "dca_buy",
  value: 25,
});

console.log(decision);
// { action: "auto_execute", reason: "Within boundaries" }
```

## CLI

```bash
# Start autonomy engine
gicm-autonomy start

# View pending approvals
gicm-autonomy queue

# Approve an action
gicm-autonomy approve <id>
```

## License

MIT
npm package: @gicm/gicm-orchestrator
Description: The Brain - Autonomous orchestrator for gICM that discovers, evaluates, and integrates valuable tech
Author: Mirko Basil Dölger
Latest version: 0.1.1

# @gicm/gicm-orchestrator

The Brain - Autonomous orchestrator that discovers, evaluates, and integrates valuable tech.

## Installation

```bash
npm install @gicm/gicm-orchestrator
# or
pnpm add @gicm/gicm-orchestrator
```

## Features

- **Discovery** - Hunt for valuable tech across GitHub, HackerNews, Twitter
- **Evaluation** - LLM-powered scoring of opportunities
- **Building** - Automated code generation and integration
- **Deployment** - Autonomous deployment with quality gates

## Usage

```typescript
import { Orchestrator } from "@gicm/gicm-orchestrator";

const orchestrator = new Orchestrator({
  hunters: ["github", "hackernews", "twitter"],
  autoApproveThreshold: 80,
});

// Start the orchestrator
await orchestrator.start();

// Listen for discoveries
orchestrator.on("discovery", (item) => {
  console.log("Found:", item.title, "Score:", item.score);
});
```

## CLI

```bash
# Start the orchestrator
gicm-orchestrator start

# Trigger discovery manually
gicm-orchestrator discover

# View backlog
gicm-orchestrator backlog
```

## Agents

The orchestrator coordinates these agents:
- **Hunter Agent** - Discovers opportunities
- **Decision Agent** - Evaluates and scores
- **Builder Agent** - Generates code
- **Refactor Agent** - Improves code quality
- **Deployer Agent** - Handles deployment

## License

MIT
npm package: @gicm/growth-engine
Description: Automated growth engine for gICM platform - blog, social, SEO
Author: Mirko Basil Dölger
Latest version: 1.0.1

# @gicm/growth-engine

> Autonomous content and marketing automation - 10x traffic every 6 months

[![npm version](https://badge.fury.io/js/@gicm%2Fgrowth-engine.svg)](https://www.npmjs.com/package/@gicm/growth-engine)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Installation

```bash
npm install @gicm/growth-engine
# or
pnpm add @gicm/growth-engine
```

## Features

- **Blog Generator**: AI-powered posts with SEO optimization
- **Twitter Automation**: Scheduled posting and engagement
- **SEO System**: Keyword research and content optimization
- **Cron Automation**: Weekly blogs, daily tweets

## Quick Start

```typescript
import { GrowthEngine } from "@gicm/growth-engine";

const engine = new GrowthEngine({
  twitter: {
    apiKey: process.env.TWITTER_API_KEY,
    postsPerDay: 5,
  },
  blog: {
    postsPerWeek: 3,
    seoOptimize: true,
  },
});

await engine.start();
```

## CLI Commands

```bash
gicm-growth start              # Start autonomous engine
gicm-growth generate blog      # Generate blog post
gicm-growth generate tweet     # Generate tweets
gicm-growth keywords <topic>   # Research keywords
gicm-growth status             # Show engine metrics
```

## License

MIT - Built by [gICM](https://gicm.dev)
npm package: @gicm/hub
Description: Integration hub connecting all gICM engines
Author: Mirko Basil Dölger
Latest version: 1.0.1

# @gicm/hub

Integration hub connecting all gICM engines with real-time events and APIs.

## Installation

```bash
npm install @gicm/hub
# or
pnpm add @gicm/hub
```

## Features

- **Event Bus** - Real-time event routing between components
- **API Server** - Fastify-based REST and WebSocket APIs
- **Engine Coordination** - Connects Hyper Brain and other engines
- **CLI Interface** - Easy management via command line

## Usage

```typescript
import { Hub } from "@gicm/hub";

const hub = new Hub();

// Listen for events
hub.on("brain:insight", (data) => {
  console.log("New insight:", data);
});

// Start the hub
await hub.start({ port: 4000 });
```

## CLI

```bash
# Start the hub
gicm-hub start

# Check status
gicm-hub status
```

## License

MIT
npm package: @gicm/hunter-agent
Description: Tech discovery agent for gICM - hunts GitHub, HackerNews, and Twitter for valuable opportunities
Author: Mirko Basil Dölger
Latest version: 0.1.1

# @gicm/hunter-agent

> Tech discovery agent - Hunts GitHub, HackerNews, and Twitter for valuable opportunities

[![npm version](https://badge.fury.io/js/@gicm%2Fhunter-agent.svg)](https://www.npmjs.com/package/@gicm/hunter-agent)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Installation

```bash
npm install @gicm/hunter-agent
# or
pnpm add @gicm/hunter-agent
```

## Features

- **GitHub Hunter**: Trending repos, new releases, AI tools
- **HackerNews Hunter**: Top stories, Show HN, tech discussions
- **Twitter Hunter**: Crypto influencers, trending topics
- **Unified Discovery**: Aggregates and scores all sources

## Quick Start

```typescript
import { HunterAgent } from "@gicm/hunter-agent";

const hunter = new HunterAgent({
  sources: ["github", "hackernews", "twitter"],
  schedule: "0 */2 * * *", // Every 2 hours
});

const discoveries = await hunter.run();
```

## Exports

| Export | Description |
|--------|-------------|
| `@gicm/hunter-agent` | Main HunterAgent |
| `@gicm/hunter-agent/sources` | Individual source hunters |

## License

MIT - Built by [gICM](https://gicm.dev)
npm package: @gicm/hyper-brain
Description: gICM HYPER BRAIN - Knowledge ingestion, learning, and prediction system
Author: Mirko Basil Dölger
Latest version: 1.0.1

# @gicm/hyper-brain

gICM HYPER BRAIN - Knowledge ingestion, learning, and prediction system.

## Installation

```bash
npm install @gicm/hyper-brain
# or
pnpm add @gicm/hyper-brain
```

## Features

- **Knowledge Ingestion** - Ingest and process diverse data sources
- **Learning System** - Pattern recognition and continuous learning
- **Prediction Engine** - Generate predictions based on learned patterns
- **Win Tracking** - Track successes and optimize strategies

## Usage

```typescript
import { HyperBrain } from "@gicm/hyper-brain";

const brain = new HyperBrain({
  anthropicApiKey: process.env.ANTHROPIC_API_KEY,
});

// Ingest knowledge
await brain.ingest({
  source: "github",
  data: repoAnalysis,
});

// Search knowledge base
const results = await brain.search("solana defi patterns");

// Get predictions
const prediction = await brain.predict({
  context: "market conditions",
  query: "optimal entry point",
});
```

## CLI

```bash
# Start the brain
gicm-brain start

# Ingest data
gicm-brain ingest --source github

# Search knowledge
gicm-brain search "defi yield strategies"

# View wins
gicm-brain wins

# Statistics
gicm-brain stats
```

## License

MIT
npm package: @gicm/integration-hub
Description: gICM Integration Hub - Central event bus, API gateway, and workflow automation
Author: Mirko Basil Dölger
Latest version: 0.1.1

# @gicm/integration-hub

Central event bus, API gateway, and workflow automation for gICM platform.

## Installation

```bash
npm install @gicm/integration-hub
# or
pnpm add @gicm/integration-hub
```

## Features

- **Event Bus** - Centralized event routing between engines
- **API Gateway** - Unified REST/WebSocket API
- **Workflow Automation** - Cron-based task scheduling
- **Engine Integration** - Connects Money, Growth, Product engines

## Usage

```typescript
import { IntegrationHub } from "@gicm/integration-hub";

const hub = new IntegrationHub();

// Subscribe to events
hub.on("trade:executed", (event) => {
  console.log("Trade executed:", event);
});

// Publish events
hub.emit("discovery:found", {
  type: "github",
  repo: "cool-project",
  score: 85,
});

// Start API server
await hub.start({ port: 4000 });
```

## CLI

```bash
# Start the integration hub
gicm-hub start

# Start with custom port
gicm-hub start --port 5000
```

## API Endpoints

- `GET /health` - Health check
- `GET /events` - List recent events
- `POST /emit` - Emit an event
- `WS /ws` - WebSocket connection for real-time events

## License

MIT
npm package: @gicm/mcp-server
Description: MCP server for gICM marketplace - semantic search for agents, skills, MCPs, and workflows
Author: gICM
Latest version: 1.0.1

# @gicm/mcp-server

MCP (Model Context Protocol) server for gICM marketplace. Provides semantic search over 390+ components directly in Claude Code, Cursor, and Windsurf.

## Features

- **search_components** - Find agents, skills, MCPs, workflows by natural language
- **search_codebase** - Semantic search across indexed Git repositories
- **get_file_context** - Get specific lines from indexed files
- **index_repository** - Queue Git repos for indexing

## Installation

### Claude Code

Add to `~/.config/claude/mcp_servers.json`:

```json
{
  "mcpServers": {
    "gicm-context": {
      "command": "npx",
      "args": ["-y", "@gicm/mcp-server"],
      "env": {
        "QDRANT_URL": "http://localhost:6333",
        "GEMINI_API_KEY": "${GEMINI_API_KEY}"
      }
    }
  }
}
```

### Cursor

Add to `.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "gicm-context": {
      "command": "npx",
      "args": ["-y", "@gicm/mcp-server"]
    }
  }
}
```

## Prerequisites

1. **Qdrant** running on `localhost:6333`
2. **Gemini API Key** for embeddings (free tier available)
3. **Indexed gICM registry** (run the indexer first)

## Quick Start

```bash
# Start Qdrant (from services/context-engine/)
docker compose up -d

# Index gICM registry
cd services/context-engine
python scripts/index-gicm-registry.py

# Now Claude Code can use the MCP server!
```

## Usage Examples

In Claude Code, Cursor, or Windsurf:

```
"Find me a Solana trading bot agent"
→ Uses search_components to find relevant agents

"Search for authentication code"
→ Uses search_codebase to find auth implementations

"Index the repo https://github.com/user/project"
→ Queues repository for indexing
```

## Environment Variables

| Variable | Description | Default |
|----------|-------------|---------|
| `QDRANT_URL` | Qdrant server URL | `http://localhost:6333` |
| `INDEXER_API` | Indexer service URL | `http://localhost:8000` |
| `GEMINI_API_KEY` | Gemini API key (free tier) | Required |

## Development

```bash
cd packages/mcp-server
npm install
npm run dev
```

## License

MIT
npm package: @gicm/money-engine
Description: Self-funding engine for gICM platform
Author: Mirko Basil Dölger
Latest version: 1.0.0

# @gicm/money-engine

> Self-funding DeFi engine for the gICM platform

[![npm version](https://badge.fury.io/js/@gicm%2Fmoney-engine.svg)](https://www.npmjs.com/package/@gicm/money-engine)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Installation

```bash
npm install @gicm/money-engine
# or
pnpm add @gicm/money-engine
```

## Features

- **Treasury Management**: SOL/USDC balances and allocations
- **DCA Trading Bots**: Paper, micro, and live trading modes
- **Expense Tracking**: Auto-pay for infrastructure costs
- **Risk Management**: Position sizing and stop-losses

## Quick Start

```typescript
import { MoneyEngine } from "@gicm/money-engine";

const engine = new MoneyEngine({
  mode: "paper", // paper | micro | live
  dcaConfig: {
    asset: "SOL",
    amount: 10,
    schedule: "0 */4 * * *", // Every 4 hours
  },
});

await engine.start();
```

## CLI Commands

```bash
gicm-money start     # Start the engine
gicm-money status    # Show financial status
gicm-money expenses  # Show expense breakdown
gicm-money trade     # Trigger manual DCA
```

## License

MIT - Built by [gICM](https://gicm.dev)
npm package: @gicm/nft-agent
Description: NFT operations agent - Metaplex, OpenSea, Magic Eden integration
Author: Mirko Basil Dölger
Latest version: 0.1.1

# @gicm/nft-agent

> NFT operations agent - Metaplex, OpenSea, Magic Eden integration

[![npm version](https://badge.fury.io/js/@gicm%2Fnft-agent.svg)](https://www.npmjs.com/package/@gicm/nft-agent)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Installation

```bash
npm install @gicm/nft-agent
# or
pnpm add @gicm/nft-agent
```

## Features

- **Metaplex**: Solana NFT minting and management
- **OpenSea**: EVM NFT marketplace operations
- **Magic Eden**: Solana marketplace integration
- **Collection Analysis**: Floor price, volume tracking

## License

MIT - Built by [gICM](https://gicm.dev)
npm package: @gicm/orchestrator
Description: Multi-agent orchestration - workflow coordination and routing
Author: Mirko Basil Dölger
Latest version: 0.1.1

# @gicm/orchestrator

> Multi-agent orchestration - Workflow coordination and routing

[![npm version](https://badge.fury.io/js/@gicm%2Forchestrator.svg)](https://www.npmjs.com/package/@gicm/orchestrator)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Installation

```bash
npm install @gicm/orchestrator
# or
pnpm add @gicm/orchestrator
```

## Features

- **Multi-Agent Coordination**: Route tasks to specialized agents
- **Workflow Engine**: Define complex multi-step workflows
- **Event Bus**: Pub/sub for agent communication
- **Autonomy Integration**: Bounded autonomous execution

## Quick Start

```typescript
import { Orchestrator } from "@gicm/orchestrator";

const orchestrator = new Orchestrator({
  agents: {
    wallet: walletAgent,
    defi: defiAgent,
    hunter: hunterAgent,
  },
});

// Route a complex task
const result = await orchestrator.run({
  task: "Find and buy the best yield opportunity under 10 SOL",
});
```

## License

MIT - Built by [gICM](https://gicm.dev)
npm package: @gicm/platform-adapters
Description: Platform adapters for Bolt, Lovable, and universal AI code editors
Author: Mirko Basil Dölger
Latest version: 1.0.0

# @gicm/platform-adapters

Platform adapters for Bolt, Lovable, and universal AI code editors.

## Installation

```bash
npm install @gicm/platform-adapters
# or
pnpm add @gicm/platform-adapters
```

## Features

- **Bolt Adapter** - Integration with Bolt.new
- **Lovable Adapter** - Integration with Lovable.dev
- **Universal Adapter** - Works with any AI code editor

## Usage

```typescript
// Main exports
import { BoltAdapter, LovableAdapter, UniversalAdapter } from "@gicm/platform-adapters";

// Or import specific adapters
import { BoltAdapter } from "@gicm/platform-adapters/bolt";
import { LovableAdapter } from "@gicm/platform-adapters/lovable";
import { UniversalAdapter } from "@gicm/platform-adapters/universal";
```

### Bolt Adapter

```typescript
import { BoltAdapter } from "@gicm/platform-adapters/bolt";

const adapter = new BoltAdapter();
const context = adapter.extractContext(element);
```

### Lovable Adapter

```typescript
import { LovableAdapter } from "@gicm/platform-adapters/lovable";

const adapter = new LovableAdapter();
const context = adapter.extractContext(element);
```

### Universal Adapter

```typescript
import { UniversalAdapter } from "@gicm/platform-adapters/universal";

const adapter = new UniversalAdapter({
  platform: "custom",
});
const context = adapter.extractContext(element);
```

## License

MIT
npm package: @gicm/product-engine
Description: Automated product development engine - discovery, building, deployment
Author: Mirko Basil Dölger
Latest version: 1.0.1

# @gicm/product-engine

> Autonomous product development - Discovery, building, quality, deployment

[![npm version](https://badge.fury.io/js/@gicm%2Fproduct-engine.svg)](https://www.npmjs.com/package/@gicm/product-engine)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Installation

```bash
npm install @gicm/product-engine
# or
pnpm add @gicm/product-engine
```

## Features

- **Discovery System**: Scans competitors, GitHub trends, HackerNews
- **Opportunity Evaluation**: LLM-powered scoring
- **Agent Builder**: Auto-generates agents from templates
- **Quality Gate**: Automated testing + AI code review

## Quick Start

```typescript
import { ProductEngine } from "@gicm/product-engine";

const engine = new ProductEngine({
  discoveryInterval: "0 */6 * * *", // Every 6 hours
  autoApproveThreshold: 80,
});

await engine.start();
```

## CLI Commands

```bash
gicm-product start          # Start autonomous engine
gicm-product discover       # Run discovery now
gicm-product backlog        # View opportunity backlog
gicm-product approve <id>   # Approve for building
gicm-product build          # Build next approved
gicm-product status         # Show engine metrics
```

## License

MIT - Built by [gICM](https://gicm.dev)
npm package: @gicm/ptc-coordinator
Description: Programmatic Tool Calling (PTC) Coordinator - Orchestrate gICM agents via generated code pipelines
Author: Mirko Basil Dölger
Latest version: 1.0.1

# @gicm/ptc-coordinator

Programmatic Tool Calling (PTC) Coordinator - Orchestrate gICM agents via generated code pipelines.

## Installation

```bash
npm install @gicm/ptc-coordinator
# or
pnpm add @gicm/ptc-coordinator
```

## Features

- **Pipeline Generation** - LLM generates executable pipelines
- **Tool Orchestration** - Coordinate multiple agents
- **Template Library** - Pre-built pipeline templates
- **Type-Safe** - Full TypeScript support with Zod validation

## Usage

```typescript
import { PTCCoordinator } from "@gicm/ptc-coordinator";

const coordinator = new PTCCoordinator();

// Execute a natural language request
const result = await coordinator.execute(
  "Analyze SOL/USDC, check wallet balance, and suggest entry points"
);

// The coordinator:
// 1. Generates a pipeline from the request
// 2. Executes each step with appropriate agents
// 3. Returns structured results
```

### Using Templates

```typescript
import { templates } from "@gicm/ptc-coordinator/templates";

// Use a pre-built template
const pipeline = templates.tradingAnalysis({
  pair: "SOL/USDC",
  timeframe: "4h",
});

const result = await coordinator.runPipeline(pipeline);
```

## How It Works

1. **Parse Request** - Natural language to structured intent
2. **Generate Pipeline** - Create executable code steps
3. **Validate** - Type-check with Zod schemas
4. **Execute** - Run agents in sequence/parallel
5. **Aggregate** - Combine results and return

## License

MIT
npm package: @gicm/quantagent
Description: Multi-agent LLM trading signals for crypto - gICM marketplace skill
Author: Mirko Basil Dölger
Latest version: 1.0.0

# @gicm/quantagent

Multi-agent LLM trading signals for crypto - technical analysis meets AI.

## Installation

```bash
npm install @gicm/quantagent
# or
pnpm add @gicm/quantagent
```

## Features

- **Multi-Agent Analysis** - Multiple AI personas analyze trades
- **Technical Indicators** - RSI, MACD, Moving Averages, Bollinger Bands
- **Consensus Scoring** - Weighted voting from multiple agents
- **React Components** - Ready-to-use UI components

## Usage

```typescript
import { QuantAgent, analyze } from "@gicm/quantagent";

const agent = new QuantAgent({
  anthropicApiKey: process.env.ANTHROPIC_API_KEY,
});

const signal = await agent.analyze({
  symbol: "SOL/USDC",
  timeframe: "4h",
  indicators: ["rsi", "macd", "bb"],
});

console.log(signal);
// {
//   direction: "long",
//   confidence: 0.78,
//   agents: ["Technical", "Momentum", "Sentiment"],
//   reasoning: "Strong bullish divergence..."
// }
```

## CLI

```bash
# Analyze a trading pair
quantagent analyze SOL/USDC --timeframe 4h

# Get quick signal
quantagent signal BTC/USDC
```

## React Components

```tsx
import { SignalCard, TradingPanel } from "@gicm/quantagent/components";

function App() {
  return <SignalCard symbol="SOL/USDC" />;
}
```

## License

MIT
npm package: @gicm/refactor-agent
Description: Code quality and refactoring agent for gICM
Author: Mirko Basil Dölger
Latest version: 0.1.1

# @gicm/refactor-agent

> Code quality and refactoring agent

[![npm version](https://badge.fury.io/js/@gicm%2Frefactor-agent.svg)](https://www.npmjs.com/package/@gicm/refactor-agent)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Installation

```bash
npm install @gicm/refactor-agent
# or
pnpm add @gicm/refactor-agent
```

## Features

- **Code Analysis**: Identify refactoring opportunities
- **Pattern Matching**: Apply consistent patterns
- **Type Improvements**: Enhance TypeScript types
- **Dead Code Removal**: Clean unused code

## License

MIT - Built by [gICM](https://gicm.dev)
npm package: @gicm/social-agent
Description: Social media agent - Twitter, Telegram, Discord, Farcaster integration
Author: Mirko Basil Dölger
Latest version: 0.1.1

# @gicm/social-agent

> Social media agent - Twitter, Telegram, Discord, Farcaster integration

[![npm version](https://badge.fury.io/js/@gicm%2Fsocial-agent.svg)](https://www.npmjs.com/package/@gicm/social-agent)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Installation

```bash
npm install @gicm/social-agent
# or
pnpm add @gicm/social-agent
```

## Features

- **Twitter/X**: Post, reply, monitor trends
- **Telegram**: Bot and channel management
- **Discord**: Server automation and moderation
- **Farcaster**: Decentralized social posting

## License

MIT - Built by [gICM](https://gicm.dev)
npm package: @gicm/wallet-agent
Description: AI-powered wallet operations agent - natural language transactions via Coinbase AgentKit & Solana Agent Kit
Author: Mirko Basil Dölger
Latest version: 1.0.1

# @gicm/wallet-agent

> AI-powered wallet operations - Natural language transactions via Coinbase AgentKit & Solana Agent Kit

[![npm version](https://badge.fury.io/js/@gicm%2Fwallet-agent.svg)](https://www.npmjs.com/package/@gicm/wallet-agent)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Installation

```bash
npm install @gicm/wallet-agent
# or
pnpm add @gicm/wallet-agent
```

## Features

- **Multi-Chain Support**: Solana and EVM chains
- **Natural Language**: "Swap 1 SOL for USDC" style commands
- **Coinbase AgentKit**: Enterprise-grade EVM operations
- **Solana Agent Kit**: Native Solana transactions
- **Type-Safe**: Full TypeScript with Zod validation

## Quick Start

```typescript
import { WalletAgent } from "@gicm/wallet-agent";

const agent = new WalletAgent({
  chain: "solana",
  // privateKey from env
});

// Execute natural language command
const result = await agent.run({
  command: "swap 1 SOL for USDC on Jupiter",
});

console.log(result.txHash);
```

## Supported Operations

| Operation | Description |
|-----------|-------------|
| `swap` | Token swaps via DEX aggregators |
| `transfer` | Send tokens to addresses |
| `balance` | Check wallet balances |
| `stake` | Stake SOL or tokens |
| `bridge` | Cross-chain transfers |

## License

MIT - Built by [gICM](https://gicm.dev)
npm package: @gicm/wins
Description: gICM Win Tracker - Track wins, streaks, achievements
Author: Mirko Basil Dölger
Latest version: 1.0.0

# @gicm/wins

gICM Win Tracker - Track wins, streaks, and achievements.

## Installation

```bash
npm install @gicm/wins
# or
pnpm add @gicm/wins
```

## Features

- **Win Tracking** - Record and track wins
- **Streaks** - Track winning and losing streaks
- **Achievements** - Unlock achievements based on performance
- **CLI Interface** - Command-line win management

## Usage

```typescript
import { WinTracker } from "@gicm/wins";

const tracker = new WinTracker();

// Record a win
tracker.recordWin({
  type: "trade",
  profit: 150,
  details: "SOL/USDC swing trade",
});

// Get current streak
const streak = tracker.getCurrentStreak();
console.log(`Current streak: ${streak} wins`);

// Get statistics
const stats = tracker.getStats();
console.log(stats);
// { totalWins: 42, bestStreak: 7, winRate: 68% }
```

## CLI

```bash
# Record a win
wins add "Successful arbitrage trade"

# View all wins
wins list

# View stats
wins stats

# Check achievements
wins achievements
```

## License

MIT
npm package: @giddyup/cli
Description: See https://github.com/tokenrodeo/Rodeo for full documentation.
Author: Ian Hunter
Latest version: 0.0.21

# Token Rodeo

See [https://github.com/tokenrodeo/Rodeo](https://github.com/tokenrodeo/Rodeo) for full documentation or [https://github.com/tokenrodeo/Rodeo](https://github.com/tokenrodeo/Rodeo) for repository.
npm package: @gidea/gateway-mount
Description: Gateway service mount types, Redis key helpers, and YAML parsing (Nacos-style namespace support)
Latest version: 0.0.4

# @gidea/gateway-mount

Gateway service mount types, Redis key helpers, and YAML parsing. Used by **g-gateway** and **g-gateway-admin** for Nacos-style namespace-scoped layout.

## Exports

- **Types**: `ServiceMount`, `ServiceInstance`, `AuthStrategy`, `SubRouteAuth`, `ServiceRegistryYaml`, `ServiceRegistryYamlEntry`, `ServiceRegistrationOptions`, `ConfigFetchOptions`
- **Constants**: `HEARTBEAT_TTL_SEC`, `HEARTBEAT_INTERVAL_MS`, `EVICTION_INTERVAL_MS`, `DEFAULT_NAMESPACE_ID`
- **Legacy keys** (flat layout): `registryHashKey(prefix, serviceKey)`, `configHashKey(prefix, namespace)`
- **Namespace-scoped keys** (Nacos-style): `nsServicesKey(nsId)`, `nsConfigsKey(nsId)`, `nsServiceInstancesKey(nsId, serviceKey)`, `configHashField(group, dataId)`, `parseConfigHashField(field)`
- **YAML**: `parseServiceRegistry(yaml)` → `ServiceMount[]`

## Redis key layout (namespace-scoped)

- `gidea:ns:{nsId}:services` → JSON array of `ServiceMount`
- `gidea:ns:{nsId}:configs` → Hash, field `group::dataId`, value JSON config item
- `gidea:ns:{nsId}:svc:{serviceKey}:instances` → Hash, instanceId → JSON `ServiceInstance`

## Build

```bash
pnpm build
```

## Workspace usage

In this monorepo, g-gateway and g-gateway-admin depend on `workspace:*`. After adding the package, run `pnpm install` from the repo root.
npm package: @gidea/nest-common
Description: Shared NestJS building blocks for WeChat mini-program backends
Latest version: 0.0.3

# @gidea/nest-common

面向微信小程序后端的 NestJS 通用能力库，提供装饰器、守卫、过滤器、拦截器、日志、中间件等，可与 `NestMiniappModule` 一键接入。

## 安装

```bash
npm i @gidea/nest-common
# 或
pnpm add @gidea/nest-common
```

**Peer 依赖**：需在业务项目中安装 `@nestjs/common`、`@nestjs/core`（>=10），以及 `reflect-metadata`、`rxjs`。若使用 JWT 守卫，需安装 `@nestjs/jwt`。

## 快速使用

在根模块中引入 `NestMiniappModule`，即可全局注册：

- **AppLogger**：可注入的日志服务（TRANSIENT）
- **HttpExceptionFilter**：统一 HTTP 异常与错误码响应
- **LoggingInterceptor**：请求/响应日志
- **OpenIdGuard**：基于 openid 的鉴权守卫（需配合小程序登录）

```ts
import { Module } from '@nestjs/common'
import { NestMiniappModule } from '@gidea/nest-common'

@Module({
  imports: [NestMiniappModule],
  // ...
})
export class AppModule {}
```

## 导出内容

### 模块

- `NestMiniappModule`：一键注册上述全局能力

### 装饰器

- `@Public()`：标记接口无需鉴权（跳过 OpenIdGuard）
- `@OpenId()`：在 handler 参数上注入当前用户的 openid

### 守卫

- `OpenIdGuard`：校验请求中的 openid（Header/Query），未通过返回 401
- `ApiKeyGuard`：API Key 校验，可用于内部或管理接口
- `JwtGuard`：JWT 鉴权（依赖 `@nestjs/jwt`，可选）

### 过滤器 / 拦截器 / 中间件

- `HttpExceptionFilter`：将异常转为统一 `{ code, message, data }` 响应
- `LoggingInterceptor`：请求开始与结束的日志
- `RequestIdMiddleware`：为请求注入 requestId（需自行注册）

### 常量

- `HTTP_STATUS`、`ERROR_CODE`、`ERROR_MSG`：状态码与错误码
- `AUTH_HEADER`、`AUTH_BEARER_PREFIX`、`QUERY_TOKEN_KEY`：鉴权相关常量

### 工具与类型

- `getBearerToken(request)`：从请求中解析 Bearer token
- `toNumber(value, default?)`：安全转数字
- `AppLogger`：日志服务
- `IApiResult`、`IApiError`、`IRequestWithOpenId` 等类型

## 脚本

```bash
pnpm run build      # 构建 ESM + CJS + 类型
pnpm run dev        # 监听源码变更并构建
pnpm run typecheck  # 仅类型检查
```

## License

MIT