ShellRaining Documentation

website·Indexed 31 days ago

https://shellraining.xyz

A personal knowledge base and technical documentation collection covering source code analysis (WaveSurfer, VitePress, hlchunk), Model Context Protocol (MCP) architecture and registry, web fundamentals (Promises/A+, XSS, DOM), and development tool guides for Vite, Tree-sitter, and TypeScript.

Tokens
71.8K
Snippets
310
Records
455
Agent score
58%

What's inside ShellRaining Docs

  1. Overview of Tree-sitter

    Tree-sitter is a parser generator tool and an incremental parsing library. It generates a precise concrete syntax tree (CST) from source code. It is written in C but provides bindings for multiple languages (e.g., Node.js), allowing developers to use language-specific grammar rules to parse source code into a tree structure.
  2. Overview of Alma Desktop AI Agent

    Alma is a desktop agent application that allows users to orchestrate various AI service providers (such as ChatGPT, Anthropic, and Gemini). It supports the ACP protocol to utilize APIs from other applications and provides a user-friendly interface for API provider configuration.
  3. Overview of essential Rust core library types

    Beyond basic scalar and compound types, Rust's core library includes several essential types for memory and function management:

    • Slice: A dynamically sized view into a sequence.
    • str: A string slice.
    • Reference: A pointer to another value without owning it.
    • Pointer: Raw pointers for low-level memory access.
    • fn: Function pointers.
  4. Overview of the MCP Registry ecosystem

    The MCP Registry is a centralized service (similar to an app store) that provides a list of available MCP servers to various MCP clients. It does not host the actual server code; instead, it stores metadata and references to where the code is hosted (e.g., npm, PyPI).

    Key architectural constraints:

    • No Code Hosting: The registry never hosts actual MCP server code.
    • No Quality Ranking: It does not evaluate or rank servers.
    • No Advanced Search: It does not provide vector search or advanced search for end-users.
    • No Tags/Categories: To reduce moderation overhead, it does not provide server tagging or categorization.

    Clients typically do not query the official registry directly. Instead, they use intermediate mirrors (Marketplaces/Aggregators) that perform ETL (Extract, Transform, Load) operations on the registry data to enhance it before serving it to the end-user.

  5. Access module metadata using import.meta

    import.meta is a host-defined object with a null prototype used to access metadata about the current module. Common properties include:

    1. url: The full URL of the module (including query parameters and fragments). In Node.js, this is the file path with the file:// protocol.
    2. resolve: A method to resolve a module identifier relative to the current module's URL.
  6. Understand the DOM Tree and Node Types

    The DOM (Document Object Model) represents a web page as a tree of nodes, typically rooted at the <html> element. Common node types include:

    1. document: The root node of the document.
    2. element: HTML tags like <div>, <pre>, etc.
    3. text: The actual text content within elements.
    4. comment: HTML comments.
  7. Understand and use the MCP roots client capability

    The roots capability is declared by the client during initialization. When enabled, it informs the server that it can perform operations (such as reading or writing) on the client's filesystem within the boundaries defined by these roots. This is typically used to identify project root directories, codebase locations, or configuration paths. It is primarily useful for servers communicating via stdio rather than remote transports.
  8. Understand the basic principles of spectrogram generation

    Generating a spectrogram involves several key steps to transform raw audio into a visual frequency representation:

    1. Audio Acquisition: Obtain the audio file.
    2. PCM Conversion: Parse the audio into Pulse Code Modulation (PCM) format, which represents the amplitude of the audio waveform as discrete digital values.
    3. Fast Fourier Transform (FFT): Apply FFT to the PCM data. A sampling length (fftSample) is required. A larger fftSample provides finer frequency resolution but increases computational load and can cause temporal blurring (longer streaks in the time dimension).
    4. Overlap Handling: To maintain accuracy, an noverlap value is used to determine the overlap between FFT windows. For example, a 75% overlap means the window steps forward by 25% of the sample length each time.
    5. Resampling: Since the number of FFT time segments may not match the canvas pixel width, the data is resampled (using algorithms like bilinear or Lanczos interpolation) to fit the display area.
    6. Color Mapping: The resulting intensity matrix is mapped to colors using a colorMap to visualize frequency strength.
  9. How VitePress resolves and provides user configuration

    VitePress handles user configuration through a server-client flow. On the server, it resolves the .vitepress/config.ts file using a resolveConfig function during the creation of the Vite development server. To make this configuration available to the client, VitePress uses a Vite plugin that creates a virtual module @siteData. When the client requests this module, the server serializes the configuration data and returns it as a JavaScript module containing a deserialization function. On the client side, this data is initialized via initData and injected into the Vue application using the provide API, allowing components to access the configuration via useData.
  10. Understand dotfiles storage locations

    Dotfiles are hidden files (starting with a dot) used as configuration for tools. They are typically stored in one of three locations:

    1. Project Root: Specific to a project (e.g., .prettierrc.json).
    2. Home Directory: User-specific global configs (e.g., ~/.zshrc).
    3. XDG Config Home: Defined by the $XDG_CONFIG_HOME environment variable, defaulting to $HOME/.config (e.g., ~/.config/nvim/init.lua).
  11. Compare ES6 import vs CommonJS require

    There are fundamental differences between import (ES6) and require (CommonJS):

    • Binding vs Copying: import provides a live reference to the module's content. require imports a shallow copy of the exported object. If a value is changed inside the module, import reflects the change, while require may not if the value was a primitive copied during export.
    • Static vs Dynamic: import is resolved during the compilation phase and must be placed at the top level of the file. require is a function that can be called dynamically anywhere in the code.
    // Example of require's shallow copy behavior
    // lib.js
    let counter = 3;
    function incCounter() {
        counter++;
    }
    module.exports = {
      counter: counter,
      incCounter: incCounter,
    };
    
    // main.js
    const mod = require('./lib');
    console.log(mod.counter);  // 3
    mod.incCounter();
    console.log(mod.counter); // 3 (Still 3 because counter was copied by value)
  12. Understand Alma's Memory System

    Alma uses a hybrid memory architecture based on a SQLite vector database stored at ~/Library/Application Support/alma/chat_threads.db. It consists of two main mechanisms:

    1. Structured Memory System: A Tool Model analyzes conversations to extract key information, categorizing it as 'Permanent' or 'Temporary'. It generates 1536-dimension embeddings (compatible with OpenAI, Google Gemini, and AiHubMix). Semantic search is performed during conversations with a similarity threshold of 0.1, returning up to 5 relevant memories. Temporary memories are cleared after the session.
    2. SearchChatHistory Tool: Instead of a standalone retrieval tool, Alma provides a SearchChatHistory tool that allows the AI to perform keyword-based searches across the full chat history to find details not captured by the structured memory system.