JSPM

@vandanach/flowlens

1.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 27
  • Score
    100M100P100Q52464F
  • License MIT

Developer Friction Intelligence Agent - Powered by GitHub Models API. Detects code friction through behavioral analysis and provides AI-powered insights.

Package Exports

  • @vandanach/flowlens
  • @vandanach/flowlens/dist/cli.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@vandanach/flowlens) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

๐Ÿ” FlowLens โ€” Developer Friction Intelligence Agent

"Turn invisible developer pain into visible, actionable insights using AI-powered behavioral analysis"

CLI-Native โ€ข Privacy-First โ€ข AI-Powered

npm version License: MIT Node.js Version


๐ŸŽฏ The Problem FlowLens Solves

Developers waste 23% of their time struggling with "friction" โ€” confusing code, hidden dependencies, and technical debt.

Traditional code analysis measures complexity metrics, but not what really matters: How hard is this code to work with?

Real Developer Pain:

  • ๐Ÿ”„ Returning to the same file repeatedly confusing interfaces
  • โฑ๏ธ Spending hours on simple changes โ†’ complex logic
  • โœ๏ธ High code churn โ†’ unstable requirements
  • ๐Ÿ”— Always editing files together โ†’ hidden coupling
  • ๐Ÿงช Rapid edit-test-edit cycles โ†’ "stuck loops"

The gap: Managers can't see WHERE problems are. Developers don't know WHAT to fix first. Metrics don't explain WHY.


๐Ÿ’ก The Solution

FlowLens watches how developers actually code and uses AI-powered analysis to transform behavioral data into specific, actionable improvements.

๐Ÿ”„ How It Works:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Daemon    โ”‚ โ”€โ”€โ”€โ–ถ โ”‚   Behavior   โ”‚ โ”€โ”€โ”€โ–ถ โ”‚   AI Analysis    โ”‚
โ”‚   Watches   โ”‚      โ”‚   Analysis   โ”‚      โ”‚  (GitHub Models  โ”‚
โ”‚  Codebase   โ”‚      โ”‚   Engine     โ”‚      โ”‚      API)        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚                     โ”‚                       โ”‚
       โ–ผ                     โ–ผ                       โ–ผ
   File edits         Friction scores        Actionable insights
   Time tracking      Pattern detection      Specific fixes
   Git history        ROI calculations       Priority ranking

๐Ÿš€ Quick Start

Installation

# Install globally
npm install -g @vandanach/flowlens

# Or use directly with npx
npx @vandanach/flowlens

Usage

# 1. Initialize in your project
flowlens init

# 2. Start background daemon
flowlens start

# 3. Code normally for a few days...
# (FlowLens watches silently in the background)

# 4. Generate insights
flowlens analyze

# 5. Create visual report
flowlens report

That's it! Zero configuration. 100% privacy. All data stays local.


โœจ Key Features

1. Behavioral Friction Detection

Measures actual developer struggle:

  • โฑ๏ธ Time spent on files (cognitive load signal)
  • ๐Ÿ”„ Revisit frequency (confusion indicator)
  • โœ๏ธ Code churn rate (instability marker)
  • ๐Ÿ”— Co-edit patterns (hidden dependencies)
  • ๐Ÿงช Test frequency (debugging loops)

2. AI-Powered Insights

Intelligent analysis that understands your code:

  • ๐ŸŽฏ Context-aware recommendations
  • ๐Ÿ” Root cause analysis
  • ๐Ÿ’ก Specific, actionable fixes
  • ๐Ÿ“Š ROI calculations
  • ๐Ÿšจ Priority ranking

3. Visual Reports

Beautiful HTML dashboards with:

  • ๐ŸŽจ Friction heatmaps
  • ๐Ÿ“ˆ Trend analysis
  • ๐Ÿ’ฐ Time-saved estimates
  • ๐Ÿ”— Coupling detection
  • โšก Priority recommendations

4. Privacy-First Architecture

  • โœ… 100% local data storage
  • โœ… No external servers
  • โœ… Git-ignored by default
  • โœ… Configurable exclusions
  • โœ… Easy data deletion

๐Ÿ“Š Example Analysis

FlowLens generates insights like:

๐Ÿ”ฅ HIGH FRICTION: auth/middleware.ts (78/100)

๐Ÿ“‰ Behavioral Signals:
+ 15 revisits in 3 days
+ 2.5 hours total time spent
+ 67% code churn (lines changed/total)
+ 8 files always edited together

๐Ÿค– AI Analysis:
"This middleware runs on every request but contains expensive
database queries inside the authentication check. The high revisit
count suggests developers struggle to understand the flow.

Specific Issues:
1. User lookup happens on every request (not cached)
2. Permission checks mixed with authentication logic
3. Implicit dependency on SessionStore not obvious from imports

Recommendations:
1. Add Redis caching layer for user lookups
2. Move authentication to separate middleware
3. Extract permissions to dedicated service
4. Add JSDoc explaining the request flow"

๐Ÿ’ฐ ROI Impact:
Fixing this file could save ~5 hours/week per developer
Estimated team savings: $3,200/month (4 devs ร— $20k/year avg friction cost)

๐Ÿค– AI Integration

How AI Analysis Works

FlowLens uses GitHub Models API to provide intelligent analysis of code friction:

// src/ai/client.ts - AI Integration

export class CopilotClient {
  async getFileInsight(context: PromptContext): Promise<InsightResult> {
    // 1. Build rich context from behavioral data
    const prompt = PromptBuilder.buildFileAnalysisPrompt({
      filePath: context.filePath,
      frictionScore: context.frictionScore,  // Behavioral metrics
      sourceCode: context.sourceCode,         // Actual code
      gitHistory: context.gitHistory,         // Commit patterns
      patterns: context.patterns,             // Detected anti-patterns
    });

    // 2. Call GitHub Models API with behavioral context
    const response = await fetch('https://models.inference.ai.azure.com/chat/completions', {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${process.env.GITHUB_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        messages: [
          {
            role: 'system',
            content: 'You are analyzing developer friction based on behavioral data...'
          },
          {
            role: 'user',
            content: prompt
          }
        ],
        model: 'gpt-4o',
        temperature: 0.7,
        max_tokens: 2000,
      }),
    });

    // 3. Return actionable insights
    return {
      insight: response.choices[0].message.content,
      cached: false,
      timestamp: Date.now(),
    };
  }
}

Key Benefits:

  1. Behavioral Context โ€” AI sees HOW developers struggle, not just WHAT code exists
  2. Automatic Detection โ€” No manual code review needed
  3. Continuous Monitoring โ€” Track improvements over time
  4. Measurable ROI โ€” Data-driven prioritization with cost calculations
  5. Privacy-First โ€” All data stays local, only analysis sent to AI

๐Ÿ“ฆ Architecture

flowlens/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ daemon/         # Background file system watcher
โ”‚   โ”‚   โ”œโ”€โ”€ manager.ts  # Process lifecycle
โ”‚   โ”‚   โ””โ”€โ”€ watcher.ts  # Chokidar-based monitoring
โ”‚   โ”œโ”€โ”€ core/           # Friction analysis engine
โ”‚   โ”‚   โ”œโ”€โ”€ analyzer.ts # Scoring algorithm
โ”‚   โ”‚   โ”œโ”€โ”€ git.ts      # Git integration
โ”‚   โ”‚   โ””โ”€โ”€ config.ts   # Configuration management
โ”‚   โ”œโ”€โ”€ ai/             # AI integration (GitHub Models API)
โ”‚   โ”‚   โ”œโ”€โ”€ client.ts   # Copilot API client
โ”‚   โ”‚   โ””โ”€โ”€ prompts.ts  # Prompt engineering
โ”‚   โ”œโ”€โ”€ database/       # Local data storage
โ”‚   โ”‚   โ””โ”€โ”€ store.ts    # SQLite (sql.js)
โ”‚   โ”œโ”€โ”€ reporting/      # Report generation
โ”‚   โ”‚   โ”œโ”€โ”€ html.ts     # HTML generator
โ”‚   โ”‚   โ””โ”€โ”€ insights.ts # Smart insights
โ”‚   โ””โ”€โ”€ cli.ts         # Commander.js CLI
โ”œโ”€โ”€ dist/              # Compiled JavaScript
โ””โ”€โ”€ package.json

Tech Stack:

  • TypeScript โ€” Type-safe development
  • Node.js 18+ โ€” Cross-platform daemon
  • SQLite (sql.js) โ€” Pure JS, no native deps
  • Chokidar โ€” Reliable file watching
  • Simple-git โ€” Git operations
  • GitHub Models API โ€” AI-powered insights
  • Commander.js โ€” CLI framework

๐Ÿ”ง Advanced Usage

File Exclusions

# List current exclusions
flowlens exclude list

# Add specific files
flowlens exclude add "**/*.test.js"
flowlens exclude add "package.json"

# Add common defaults automatically
flowlens exclude add-default
# (adds package-lock.json, yarn.lock, *.min.js, *.map, etc.)

# Remove exclusion
flowlens exclude remove "**/*.test.js"

Configuration

Edit .flowlens/config.json:

{
  "sessionGapMinutes": 5,
  "dataRetentionDays": 30,
  "excludePatterns": [
    "**/node_modules/**",
    "**/.git/**",
    "**/dist/**",
    "**/package-lock.json",
    "**/*.min.js"
  ],
  "copilotEnabled": true
}

Environment Variables

# Set GitHub token (get one at https://github.com/settings/tokens)
export GITHUB_TOKEN="your-token-here"

# Or create a .env file
cp .env.example .env
# Edit .env and add your GitHub token

# Optional: Choose a different model (default: gpt-4o)
export GITHUB_COPILOT_MODEL="gpt-4o-mini"

Note: FlowLens uses GitHub Models API (models.github.com), GitHub's free AI service. A standard GitHub Personal Access Token is all you need - no special Copilot subscription required for basic usage.


๐Ÿ“ˆ Measuring Impact

Before vs. After

Metric Before After FlowLens
Refactoring decisions Gut feel Data-driven
Friction visibility None Quantified
Prioritization Random ROI-based
Improvement tracking Impossible Measurable
Developer satisfaction Unknown Improving

Real Impact:

"We used FlowLens to identify our top 3 friction points. After refactoring them based on Copilot's recommendations, we saved 12 hours per developer per week."

โ€” Engineering Lead

๐Ÿ’ฐ 12 hours/week ร— 10 devs ร— $75/hour = $9,000/week saved


๐Ÿ› ๏ธ Development

Setup

git clone https://github.com/yourusername/flowlens.git
cd flowlens
npm install
npm run build
npm link  # Makes 'flowlens' available globally

Project Structure

  • src/ โ€” TypeScript source
  • dist/ โ€” Compiled JavaScript
  • .flowlens/ โ€” Local data (git-ignored)
  • reports/ โ€” Generated HTML reports

๐Ÿ“‹ Roadmap

  • Core friction detection engine
  • AI-powered insights integration
  • HTML report generation
  • File exclusion system
  • Privacy controls
  • VS Code extension
  • GitHub Action for CI/CD
  • Team analytics dashboard
  • Slack/Teams notifications
  • Historical trend analysis

๐Ÿค Contributing

Contributions welcome! See CONTRIBUTING.md.

Development Commands

npm run build          # Compile TypeScript
npm run dev           # Development mode
npm test              # Run tests

๐Ÿ“„ License

MIT ยฉ 2026 FlowLens Contributors


๐Ÿ™ Acknowledgments

  • The open-source community for inspiration and tools
  • Every developer who struggles with technical debt daily
  • Contributors who help make FlowLens better


Stop guessing. Start measuring. Fix what matters.
Built with โค๏ธ by developers, for developers