Skip to content
This repository was archived by the owner on Apr 6, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"metadata-batch-cli": "NODE_NO_WARNINGS=1 node --loader ts-node/esm utils/metadata-batch-cli.ts",
"metadata-batch-cli:dry": "pnpm metadata-batch-cli --dry-run",
"metadata-batch-cli:verbose": "pnpm metadata-batch-cli --verbose",
"validate-metadata": "CHANGED_FILES=$(git diff --name-only HEAD) NODE_NO_WARNINGS=1 node --loader ts-node/esm utils/metadata-manager.ts",
"validate-metadata": "CHANGED_FILES=$(git diff --name-only HEAD) pnpm metadata-batch-cli:dry",
"validate-pr-metadata": "NODE_NO_WARNINGS=1 node --loader ts-node/esm utils/metadata-manager.ts --pr",
"dev": "next dev",
"build": "next build",
Expand Down
1 change: 0 additions & 1 deletion pages/app-developers/interop.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ personas:
- protocol-developer
categories:
- protocol
- architecture
- mainnet
is_imported_content: 'true'
---
Expand Down
2 changes: 1 addition & 1 deletion pages/app-developers/tools/build/account-abstraction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ personas:
categories:
- account-abstraction
- paymasters
- Transactions
- transactions
is_imported_content: 'false'
---

Expand Down
3 changes: 1 addition & 2 deletions pages/app-developers/tutorials.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ description: >-
topics such as bridging tokens, deploying contracts, and estimating
transaction costs.
lang: en-US
content_type: guide
content_type: landing-page
topic: app-dev-tutorials
personas:
- app-developer
categories:
- mainnet
- testnet
- reference
is_imported_content: 'false'
---

Expand Down
13 changes: 3 additions & 10 deletions pages/app-developers/tutorials/supersim.mdx
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
---
title: Supersim guides and tutorials
description: >-
A collection of guides and tutorials to understanding and working with
Supersim, including getting started, CLI reference, and chain environment.
description: A collection of guides and tutorials to understanding and working with Supersim.
lang: en-US
content_type: tutorial
topic: supersim-guides-and-tutorials
personas:
- app-developer
categories:
- supersim
- devnets
- testing
- protocol
personas: app-developer
categories: ['supersim', 'devnets', 'cli']
is_imported_content: 'false'
---

Expand Down
100 changes: 61 additions & 39 deletions utils/metadata-batch-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { updateMetadata as updateMetadataFile } from './metadata-manager'
import matter from 'gray-matter'
import { analyzeContent } from './metadata-analyzer'
import { MetadataResult } from './types/metadata-types'
import { generateMetadata } from './metadata-manager'
import globby from 'globby'

// @ts-ignore
const globModule = await import('glob')
Expand Down Expand Up @@ -174,12 +176,12 @@ async function processFiles(files: string[], options: CliOptions): Promise<{
const content = await fs.readFile(file, 'utf8')
const { data: frontmatter } = matter(content)
const analysis = analyzeContent(content, file, options.verbose)
const result = await updateMetadataFile(file, {
dryRun: true,
verbose: false,
const result = await updateMetadataFile(file, {
dryRun: options.dryRun,
verbose: options.verbose,
analysis,
validateOnly: true,
prMode: true
validateOnly: false,
prMode: false
})

console.log(`\n${colors.blue}📄 ${file}${colors.reset}`)
Expand All @@ -199,7 +201,7 @@ async function processFiles(files: string[], options: CliOptions): Promise<{
stats.needsReview++
} else {
if (!options.dryRun) {
await updateMetadataFile(file, {
await updateMetadataFile(file, {
dryRun: false,
verbose: options.verbose || false,
analysis,
Expand Down Expand Up @@ -231,50 +233,70 @@ async function processFiles(files: string[], options: CliOptions): Promise<{

async function main() {
try {
console.log('Checking metadata...')
const isDryRun = process.argv.includes('--dry-run')
const isVerbose = process.argv.includes('--verbose')

let modifiedFiles: string[] = []

// Check if we have a direct glob pattern argument
const globPattern = process.argv.find(arg => arg.includes('*.mdx'))
if (globPattern) {
modifiedFiles = await globModule.glob(globPattern)
// Get files from either CHANGED_FILES or command line glob patterns
let mdxFiles = []
if (process.env.CHANGED_FILES) {
mdxFiles = process.env.CHANGED_FILES.split('\n').filter(Boolean)
} else {
// Fall back to CHANGED_FILES if no glob pattern
const gitOutput = process.env.CHANGED_FILES || ''
modifiedFiles = gitOutput
.split('\n')
.filter(file => file.trim())
.filter(file => file.endsWith('.mdx'))
.map(file => path.resolve(process.cwd(), file))
}

if (modifiedFiles.length === 0) {
console.log(`${colors.green}✓ No MDX files to check${colors.reset}`)
process.exit(0)
// Get glob patterns from command line args (skip the first two args)
const patterns = process.argv.slice(2).filter(arg => !arg.startsWith('--'))
if (patterns.length > 0) {
mdxFiles = await globby(patterns)
}
}

// Validate file paths
const validFiles = await validateFilePaths(modifiedFiles)

if (validFiles.length === 0) {
console.log(`${colors.yellow}⚠️ No valid files to check${colors.reset}`)
mdxFiles = mdxFiles.filter(file => file.endsWith('.mdx'))

if (mdxFiles.length === 0) {
console.log('✓ No MDX files to check')
process.exit(0)
}

console.log(`Found ${validFiles.length} valid files to check`)
console.log(`Found ${mdxFiles.length} valid files to check\n`)

const options: CliOptions = {
dryRun: process.argv.includes('--dry-run'),
verbose: process.argv.includes('--verbose')
let processedCount = 0
let needsReviewCount = 0

for (const file of mdxFiles) {
try {
const metadata = await generateMetadata(file)
const result = await updateMetadataFile(file, {
dryRun: isDryRun,
verbose: isVerbose,
validateOnly: false,
prMode: false,
analysis: metadata
})

processedCount++

// Show metadata for each file
console.log(`\nFile: ${file}`)
console.log('Categories:', metadata.categories?.join(', ') || 'none')

if (!result.isValid) {
needsReviewCount++
console.log('\x1b[33m⚠️ Review needed:\x1b[0m')
result.errors.forEach(error => console.log(` → ${error}`))
}
} catch (error) {
console.error(`Error processing ${file}:`, error)
}
}

const { hasErrors, stats } = await processFiles(validFiles, options)
// Don't exit with error code - we want this to be non-blocking
process.exit(0)
// Summary with colors
console.log(`\n${processedCount} files processed`)
if (needsReviewCount === 0) {
console.log('\x1b[32m✓ All files have valid metadata\x1b[0m')
} else {
console.log(`\x1b[33m⚠️ ${needsReviewCount} files need review\x1b[0m`)
}
} catch (error) {
console.error(`${colors.yellow}⚠️ Error: ${error}${colors.reset}`)
process.exit(0)
console.error('\x1b[31mError:\x1b[0m', error)
process.exit(1)
}
}

Expand Down
7 changes: 6 additions & 1 deletion utils/metadata-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,19 @@ export async function generateMetadata(filePath: string): Promise<MetadataResult
categories = categories.split(',').map(c => c.trim())
}

let personas = existingMetadata.personas || []
if (typeof personas === 'string') {
personas = [personas]
}

const metadata: MetadataResult = {
...existingMetadata,
...analysis,
title: existingMetadata.title || '',
lang: existingMetadata.lang || 'en',
description: existingMetadata.description || '',
topic: existingMetadata.topic || '',
personas: existingMetadata.personas || [],
personas: personas,
content_type: existingMetadata.content_type || '',
categories: categories,
is_imported_content: existingMetadata.is_imported_content || 'false',
Expand Down