ruvector/docs/publishing/NPM_TOKEN_SETUP.md
rUv 6c00b84e1d
feat(micro-hnsw-wasm): Add Neuromorphic HNSW v2.3 with SNN Integration (#40)
* docs: Add comprehensive GNN v2 implementation plans

Add 22 detailed planning documents for 19 advanced GNN features:

Tier 1 (Immediate - 3-6 months):
- GNN-Guided HNSW Routing (+25% QPS)
- Incremental Graph Learning/ATLAS (10-100x faster updates)
- Neuro-Symbolic Query Execution (hybrid neural + logical)

Tier 2 (Medium-Term - 6-12 months):
- Hyperbolic Embeddings (Poincaré ball model)
- Degree-Aware Adaptive Precision (2-4x memory reduction)
- Continuous-Time Dynamic GNN (concept drift detection)

Tier 3 (Research - 12+ months):
- Graph Condensation (10-100x smaller graphs)
- Native Sparse Attention (8-15x GPU speedup)
- Quantum-Inspired Attention (long-range dependencies)

Novel Innovations (10 experimental features):
- Gravitational Embedding Fields, Causal Attention Networks
- Topology-Aware Gradient Routing, Embedding Crystallization
- Semantic Holography, Entangled Subspace Attention
- Predictive Prefetch Attention, Morphological Attention
- Adversarial Robustness Layer, Consensus Attention

Includes comprehensive regression prevention strategy with:
- Feature flag system for safe rollout
- Performance baseline (186 tests + 6 search_v2 tests)
- Automated rollback mechanisms

Related to #38

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat(micro-hnsw-wasm): Add neuromorphic HNSW v2.3 with SNN integration

## New Crate: micro-hnsw-wasm v2.3.0
- Published to crates.io: https://crates.io/crates/micro-hnsw-wasm
- 11.8KB WASM binary with 58 exported functions
- Neuromorphic vector search combining HNSW + Spiking Neural Networks

### Core Features
- HNSW graph-based approximate nearest neighbor search
- Multi-distance metrics: L2, Cosine, Dot product
- GNN extensions: typed nodes, edge weights, neighbor aggregation
- Multi-core sharding: 256 cores × 32 vectors = 8K total

### Spiking Neural Network (SNN)
- LIF (Leaky Integrate-and-Fire) neurons with membrane dynamics
- STDP (Spike-Timing Dependent Plasticity) learning
- Spike propagation through graph topology
- HNSW→SNN bridge for similarity-driven neural activation

### Novel Neuromorphic Features (v2.3)
- Spike-Timing Vector Encoding (rate-to-time conversion)
- Homeostatic Plasticity (self-stabilizing thresholds)
- Oscillatory Resonance (40Hz gamma synchronization)
- Winner-Take-All Circuits (competitive selection)
- Dendritic Computation (nonlinear branch integration)
- Temporal Pattern Recognition (spike history matching)
- Combined Neuromorphic Search pipeline

### Performance Optimizations
- 5.5x faster SNN tick (2,726ns → 499ns)
- 18% faster STDP learning
- Pre-computed reciprocal constants
- Division elimination in hot paths

### Documentation & Organization
- Reorganized docs into subdirectories (gnn/, implementation/, publishing/, status/)
- Added comprehensive README with badges, SEO, citations
- Added benchmark.js and test_wasm.js test suites
- Added DEEP_REVIEW.md with performance analysis
- Added Verilog RTL for ASIC synthesis

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-01 22:30:15 -05:00

5.9 KiB

NPM Token Setup Guide

Quick Setup

1. Generate NPM Access Token

  1. Go to https://www.npmjs.com/settings/[your-username]/tokens
  2. Click "Generate New Token""Classic Token"
  3. Select "Automation" type (for CI/CD)
  4. Copy the generated token (starts with npm_...)

2. Add Token to GitHub Repository

  1. Go to your repository: https://github.com/ruvnet/ruvector
  2. Navigate to SettingsSecrets and variablesActions
  3. Click "New repository secret"
  4. Name: NPM_TOKEN
  5. Value: Paste your npm token
  6. Click "Add secret"

3. Verify Token Works

After adding the secret, re-run the publishing workflow:

# Delete and recreate the tag to trigger workflow again
git tag -d v0.1.2
git push origin :refs/tags/v0.1.2

# Create and push tag again
git tag v0.1.2 -a -m "Release v0.1.2"
git push origin v0.1.2

Or manually trigger the workflow:

gh workflow run "Build Native Modules"

Detailed Instructions

Creating NPM Access Token

Requirements

  • NPM account with publish permissions
  • Member of @ruvector organization (if scoped package)

Token Types

Automation Token (Recommended for CI/CD)

  • No IP restrictions
  • Works in GitHub Actions
  • Can publish packages
  • ⚠️ Never expires (revoke if compromised)

Granular Access Token (More Secure)

  • Can set expiration
  • Can limit to specific packages
  • Can restrict IPs
  • ⚠️ May require re-authentication

Steps

  1. Login to NPM

    npm login
    
  2. Navigate to Token Settings

  3. Generate New Token

    • Click "Generate New Token"
    • Choose "Classic Token"
    • Select "Automation" type
    • Optionally set:
      • Token name/description
      • IP allowlist (leave empty for GitHub Actions)
      • CIDR ranges if needed
  4. Copy Token

    • Token format: npm_xxxxxxxxxxxxxxxxxxxxxxxxxx
    • ⚠️ Save immediately - shown only once
    • Store securely (password manager recommended)

Adding to GitHub Repository

Via Web Interface

  1. Navigate to Repository Settings

    https://github.com/ruvnet/ruvector/settings/secrets/actions
    
  2. Add New Secret

    • Click "New repository secret"
    • Name: NPM_TOKEN (exact name required)
    • Value: Your npm token
    • Click "Add secret"
  3. Verify Secret Added

    • Secret should appear in list
    • Value is masked (••••)
    • Can update but not view

Via GitHub CLI

# Set repository secret
gh secret set NPM_TOKEN --body "npm_your_token_here"

# Verify secret exists
gh secret list

Testing Authentication

Test Locally (Optional)

# Test token works
echo "//registry.npmjs.com/:_authToken=\${NPM_TOKEN}" > .npmrc
export NPM_TOKEN="your_token_here"
npm whoami

Test in GitHub Actions

Create test workflow or check existing run:

# View latest workflow run
gh run list --limit 1

# Check for authentication errors
gh run view --log | grep -i "auth\|token\|login"

Troubleshooting

Token Not Working

Symptom:

npm error code ENEEDAUTH
npm error need auth

Checks:

  1. Secret name is exactly NPM_TOKEN
  2. Token starts with npm_
  3. Token type is "Automation" or "Publish"
  4. Token hasn't expired
  5. Account has publish permissions

Solutions:

  • Regenerate token
  • Check token permissions
  • Verify organization access
  • Check IP restrictions

Permission Denied

Symptom:

npm error code E403
npm error 403 Forbidden

Checks:

  1. Have publish permissions for package
  2. Member of @ruvector org (if scoped)
  3. Package name not taken
  4. Not blocked by npm

Solutions:

# Check package ownership
npm owner ls @ruvector/core

# Add yourself as owner
npm owner add <username> @ruvector/core

# Check if package exists
npm view @ruvector/core

Token Expired

Symptom:

npm error code EAUTHIP
npm error Unable to authenticate

Solution:

  1. Generate new token
  2. Update GitHub secret
  3. Re-run workflow

Wrong Package Directory

Symptom:

npm error Cannot find package.json
npm error code ENOENT

Solution: Check workflow working directory:

- name: Publish main package
  working-directory: npm/packages/ruvector  # ← Verify correct path
  run: npm publish --access public

Security Best Practices

Token Security

  • Never commit tokens to git
  • Use automation tokens for CI/CD
  • Rotate tokens periodically
  • Revoke compromised tokens immediately
  • Use granular tokens when possible
  • Set IP restrictions if feasible
  • Monitor npm audit logs

GitHub Secrets

  • Use repository secrets (not environment)
  • Limit who can view/edit secrets
  • Use environments for staging/prod
  • Enable branch protection
  • Require approvals for deployments
  • Audit secret access logs

Additional Security

# Use environment protection
publish:
  environment:
    name: npm-production
    url: https://www.npmjs.com/package/@ruvector/core
  needs: build

Alternative: Manual Publishing

If you prefer not to use automated publishing:

# 1. Build all platforms locally
npm run build

# 2. Login to npm
npm login

# 3. Publish manually
cd npm/packages/ruvector
npm publish --access public

Verification

After adding token:

# 1. Trigger new build
git tag v0.1.2 -f
git push origin v0.1.2 -f

# 2. Monitor workflow
gh run watch

# 3. Verify publication
npm view @ruvector/core versions

Support

If issues persist:


Important: Keep your NPM token secure and never share it publicly!