Skip to content

AdventureAdept/d365-tools

Repository files navigation

🦞 D365 Tools

A lightning-fast CLI to browse Dataverse schema and analyze dependency impact before you break production.

Status License Node TypeScript


🎬 Quick Demo

[INSERT: 10-second terminal GIF showing d365ai impact search account.tvs_city in action]

Figure: Finding all uses of a field in 2 seconds


✨ Features

πŸ—‚οΈ Schema Management

  • Browse Schema β€” Explore entities, attributes, and relationships
  • Search Entities β€” Find entities and fields instantly
  • Export Schema β€” Export as JSON, Markdown, or CSV
  • Delta Sync β€” 10-20x faster incremental updates (3-5s vs 60s)
  • Multi-Environment β€” Manage connections to Dev, Test, Prod
  • VS Code Extension β€” Tree view, search panel, Code Lens

πŸ” Impact Analysis

  • Dependency Detection β€” Find all uses of an entity or field
  • Multi-Source Scanning:
    • Dataverse API (relationships, workflows, business rules)
    • JavaScript web resources
    • C# plugin code (Azure DevOps integration)
  • Field-Level Analysis β€” Search specific field usage (e.g., account.tvs_city)
  • Code Context β€” Shows line numbers and code snippets
  • Visual Graphs β€” Interactive dependency visualization
  • Impact Reports β€” Markdown/JSON reports for change review

⚑ Quick Start (5 Minutes)

Prerequisites

  • βœ… Node.js 18.0+
  • βœ… Dataverse environment URL (e.g., https://yourorg.crm.dynamics.com)
  • βœ… Azure AD App Registration (for non-interactive login) OR use interactive device flow

Install

# Clone and install locally
git clone https://github.com/AdventureAdept/d365-tools.git
cd d365-tools
npm install
npm link

Connect

d365ai env connect

You'll be prompted for:

  • Organization URL
  • Client name (friendly name for this connection)
  • Interactive login via device code (or provide Client ID/Secret for service principal)

Pull Schema

d365ai schema pull

Search & Analyze

# Search for entities
d365ai search entity account

# Find field dependencies (prevents breaking changes!)
d365ai impact search account.tvs_city

# Analyze full impact before renaming
d365ai impact analyze account --full

πŸ“Έ Visual Proof

VS Code Extension

[INSERT: Screenshot of VS Code Tree View showing entity browser]

Figure: Browse Dataverse schema directly in VS Code

Dependency Graph

[INSERT: Screenshot of interactive dependency graph visualization]

Figure: Visual impact analysis before schema changes

Terminal Demo

[INSERT: GIF created with vhs showing delta sync speed]

Figure: Delta sync completes in 3 seconds (vs 60 seconds for full sync)


πŸ—οΈ Architecture

.
β”œβ”€β”€ πŸ“‚ src
β”‚   β”œβ”€β”€ πŸ”Œ api/          # Dataverse & Azure DevOps connectivity
β”‚   β”œβ”€β”€ πŸ› οΈ commands/     # CLI entry points (d365ai)
β”‚   β”œβ”€β”€ πŸ—‚οΈ schema/       # Schema management (browse, search, export)
β”‚   └── πŸ” impact/       # Impact analysis (dependencies, graphs)
β”œβ”€β”€ πŸ’» vscode-extension/ # Tree view, WebView, Code Lens
β”œβ”€β”€ πŸ“š docs/
β”‚   β”œβ”€β”€ tutorials/       # How-to guides
β”‚   β”œβ”€β”€ reference/       # CLI flags, API docs
β”‚   └── explanation/     # Architecture, design decisions
└── πŸ§ͺ tests/            # Unit & Integration (Vitest)

πŸš€ Performance

Delta Sync: 10-20x Faster

Sync Type Time API Calls
Full Sync 60s 500+
Delta Sync 3-5s 10-20

How? Uses ETag headers and delta-token tracking to fetch only changed metadata since last sync.


πŸ”’ Security

Token Storage

βœ… OS Keychain/Secret Store - Tokens encrypted using:

  • Windows: Credential Manager
  • macOS: Keychain
  • Linux: libsecret (GNOME Keyring/KWallet)

Never stored in plain text!

Authentication

  • MSAL.js with device flow (interactive)
  • Service Principal support (client credentials)
  • Automatic token refresh (no manual re-auth)

🎯 Common Workflows

πŸ”§ Rename Field Safely

Problem: Need to rename account.tvs_city to account.tvs_municipality

# 1. Find all usages first
d365ai impact search account.tvs_city --show-code

# 2. Review output (plugins, web resources, workflows)
# 3. Update code, test, then rename in Dataverse

Why: Prevents 5 hidden dependencies from breaking production.


πŸ—‘οΈ Delete Entity Safely

Problem: Is it safe to delete tvs_log entity?

# 1. Analyze full impact
d365ai impact analyze tvs_log --full

# 2. Review: Shows 3 plugins, 2 workflows, 1 view
# 3. Remove dependencies first, then delete

Why: Prevents orphaned code and broken workflows.


πŸ“‹ Code Review - Audit Field Access

Problem: Who's accessing account.creditlimit?

# Audit field usage with code context
d365ai impact search account.creditlimit --show-code

Check: Validation, security roles, logging.


πŸ” Find & Browse Schema

Problem: Need logical name for "city" field

# Search across all entities
d365ai search field city

# Or search in specific entity
d365ai search field city --entity account

Why: Faster than opening D365 or XrmToolBox.


πŸ“– Documentation

Type Content
πŸ“š Tutorials Connect to Dataverse β€’ Analyze Impact β€’ Before Renaming Field
πŸ“‹ Reference CLI Commands β€’ API Reference
πŸ’‘ Explanation Architecture β€’ Delta Sync Design

πŸ› οΈ Development Setup

Clone & Install

git clone https://github.com/AdventureAdept/d365-tools.git
cd d365-tools
npm install

Link Locally (for testing)

npm link
d365ai --version  # Test your local changes

Run Tests

npm test

Build

npm run build

🀝 Contributing

Quick Start for Contributors

  1. Fork the repository
  2. Create branch: git checkout -b feature/your-feature
  3. Make changes and test locally with npm link
  4. Run tests: npm test
  5. Submit PR with description of changes

Development Tips

  • Use npm link to test CLI changes in real-time
  • Run npm run watch for auto-rebuild during development
  • Add tests for new features (Vitest)
  • Update docs in the same PR as code changes

πŸ“„ License

MIT License - see LICENSE for details.


πŸ™ Acknowledgments


πŸ“ž Support

Questions?


Made with ❀️ for Dynamics 365 developers

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors