Skip to content

Instantly share code, notes, and snippets.

Research: Enhancing AI Discoverability of Shared Packages in a Monorepo

This document outlines strategies to improve how AI tools can discover, understand, and utilize shared packages (especially UI components) within the Ezra monorepo. The goal is to make it easier for AI assistants to effectively leverage these internal libraries.

Current Context

The Ezra project utilizes a monorepo structure with shared packages, likely located in frontend/packages/. Unlike external registries like Shadcn, the primary need is to enhance discoverability within this existing monorepo structure for AI-driven development.

Strategies for AI Discoverability

@1forh
1forh / getNftImage.js
Last active January 11, 2025 19:25
Get an image of an NFT from the Algorand blockchain
import axios from 'axios';
import * as mfsha2 from 'multiformats/hashes/sha2';
import * as digest from 'multiformats/hashes/digest';
import { CID } from 'multiformats/cid';
const REGEX = 'template-ipfs://{ipfscid:(?<version>[01]):(?<codec>[a-z0-9-]+):(?<field>[a-z0-9-]+):(?<hash>[a-z0-9-]+)}';
const parseCID = (url, reserveAddress) => {
var matches = url.match(REGEX);
if (!matches) {
@1forh
1forh / MemeGrid.tsx
Created January 5, 2025 18:06
Meme Grid Component
'use client';
import toast from 'react-hot-toast';
const memes = [
'/memes/meme-1.png',
].sort();
const copyImageToClipboard = async (imageUrl: string) => {
try {
@1forh
1forh / generate.py
Created January 18, 2024 18:35
generate script
import os
import random
from PIL import Image
import json
import csv
# Get the current working directory
current_directory = os.path.dirname(os.path.abspath(__file__))
# Set the paths based on the current working directory
nfd-verify:3690058
@1forh
1forh / rarity-scores.js
Last active May 10, 2023 01:08
Algorand NFT - Rarity Scores
const rarityScore = getTraitRarityScore(nft, allNfts);
// https://medium.com/@nfthelperbot/understanding-nft-rarity-calculation-c724518efd63
// rarityScore = 1 ÷ ([Number of Items With That Trait Value] / [Total Number of Items in Collection])
function getTraitRarityScore(nft, allNfts) {
if (!nft?.metadata?.properties || Object.keys(nft.metadata.properties).length === 0) return 0;
const total = allNfts.length;
const traitFrequencies = getTraitFrequencies(allNfts);
const rarityScore = Object.entries(nft.metadata.properties).reduce((acc, [trait, value]) => {
@1forh
1forh / formatWordPressUrlsInString.js
Created December 23, 2022 15:56
Rewriting CMS URLS
export const formatWordPressUrlsInString = (str: string): string => {
if (!str) return '';
// from wizzy fields
const pageExp = `${process.env.NEXT_PUBLIC_WP_URL}/hoops_page`;
const postExp = `${process.env.NEXT_PUBLIC_WP_URL}/hoops_`;
const videoExp = `${process.env.NEXT_PUBLIC_WP_URL}/hoops_video`;
const teamExp = `${process.env.NEXT_PUBLIC_WP_URL}/hoops_team`;
const pageRegExp = new RegExp(pageExp, 'g');
const postRegExp = new RegExp(postExp, 'g');
<?php
add_action('admin_menu', 'admin_menu_mobile');
add_action('admin_menu', 'admin_menu_hoops');
add_action('admin_menu', 'admin_menu_football');
add_action('admin_menu', 'admin_menu_remove_items');
function admin_menu_remove_items () {
remove_menu_page('edit.php');
remove_menu_page('edit.php?post_type=page');
@1forh
1forh / skulis.js
Last active April 25, 2022 19:28
Skuli Frens - Algorand NFT Collection
export const frens = [
{
id: 544176827,
name: 'skuli frens #1',
unitname: 'sf001',
rank: 281,
arc69: { properties: { background: 'tealpink', skin: 'white', face: 'redeyes', head: 'bluedurag', body: 'redstrippedshirt' } },
image: 'https://ipfs.io/ipfs/bafkreiflc5bj3zdf5oe3dn2dmtqtyrzdroozgt7bi5nnwbun6wujthniuq#i',
href: 'https://www.nftexplorer.app/asset/544176827',
},