Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion packages/opencode-warcraft-notifications-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@
"prepublishOnly": "bun run build && bun test && bun run verify:package"
},
"dependencies": {
"@pantheon-org/opencode-config": "workspace:*",
"@pantheon-org/opencode-notification": "workspace:*",
"csstype": "^3.1.3",
"undici-types": "^7.16.0",
"zod": "^4.1.8"
},
"devDependencies": {
"@nx/js": "22.1.3",
"@opencode-ai/plugin": "^1.0.133",
"@opencode-ai/plugin": "^1.1.47",
"@swc/cli": "~0.6.0",
"@swc/helpers": "~0.5.11",
"@types/bun": "^1.3.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ async function processDirectory(dirPath, baseDir = DIST_DIR) {
} else if (entry.isFile() && entry.name.endsWith('.html')) {
const wasFixed = await fixLinksInFile(fullPath);
if (wasFixed) {
const _relativePath = fullPath.replace(`${baseDir}/`, '');
const relativePath = fullPath.replace(`${baseDir}/`, '');
console.log(` ✓ Fixed links in ${relativePath}`);
fixedCount++;
}
}
Expand All @@ -101,11 +102,17 @@ async function processDirectory(dirPath, baseDir = DIST_DIR) {
* Main process
*/
async function main() {
console.log('🔗 Fixing internal links in HTML files...\n');
console.log(`Base path: ${BASE_PATH}`);
console.log(`Dist directory: ${DIST_DIR}\n`);

try {
const fixedCount = await processDirectory(DIST_DIR);

if (fixedCount > 0) {
console.log(`\n✅ Fixed links in ${fixedCount} HTML file(s)!`);
} else {
console.log('\n✨ No links needed fixing!');
}
process.exit(0);
} catch (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ const faviconSVG = blockyTextToSVG('W', {
// Write to public directory
const outputPath = join(publicDir, 'favicon.svg');
writeFileSync(outputPath, faviconSVG);

console.log('✓ Generated: public/favicon.svg');
console.log(' Character: W');
console.log(' Theme: dark');
console.log(' Block size: 8px');
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,16 @@ async function processDirectory(dirPath) {
* Main test process
*/
async function main() {
console.log('🔍 Testing internal links in HTML files...\n');
console.log(`Base path: ${BASE_PATH}`);
console.log(`Dist directory: ${DIST_DIR}\n`);

try {
// Collect all links
const allLinks = await processDirectory(DIST_DIR);

console.log(`Found ${allLinks.size} unique internal link(s)\n`);

// Check each link
const brokenLinks = [];
const missingBasePathLinks = [];
Expand Down Expand Up @@ -195,6 +201,8 @@ async function main() {
console.error('⚠️ Links are missing base path. Run: bun run fix-links\n');
process.exit(1);
}

console.log('✅ All internal links are valid!');
process.exit(0);
} catch (error) {
console.error('\n❌ Link testing failed:', error.message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

import { copyFile, mkdir, readdir, readFile, writeFile } from 'node:fs/promises';
import { basename, dirname, join } from 'node:path';
import { basename, dirname, join, relative } from 'node:path';
import { fileURLToPath } from 'node:url';

const __filename = fileURLToPath(import.meta.url);
Expand Down Expand Up @@ -87,12 +87,14 @@ async function copyMarkdownFiles(sourceDir, targetDir, relativePath = '') {
} else if (entry.isFile() && entry.name.endsWith('.md')) {
// Process markdown files (add frontmatter if needed)
await processMarkdownFile(sourcePath, targetPath);
console.log(` ✓ ${currentRelativePath}`);
} else if (
entry.isFile() &&
(entry.name.endsWith('.json') || entry.name.endsWith('.example') || entry.name.endsWith('.schema'))
) {
// Copy non-markdown files as-is
await copyFile(sourcePath, targetPath);
console.log(` ✓ ${currentRelativePath}`);
}
}
}
Expand All @@ -101,12 +103,18 @@ async function copyMarkdownFiles(sourceDir, targetDir, relativePath = '') {
* Main transformation process
*/
async function transform() {
console.log('🔄 Transforming documentation...\n');
console.log(`Source: ${relative(process.cwd(), SOURCE_DIR)}`);
console.log(`Target: ${relative(process.cwd(), TARGET_DIR)}\n`);

try {
// Ensure target directory exists
await mkdir(TARGET_DIR, { recursive: true });

// Copy all markdown files
await copyMarkdownFiles(SOURCE_DIR, TARGET_DIR);

console.log('\n✅ Documentation transformation complete!');
process.exit(0);
} catch (error) {
console.error('\n❌ Transformation failed:', error.message);
Expand Down
31 changes: 26 additions & 5 deletions packages/opencode-warcraft-notifications-plugin/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,31 @@
"check-mirror-exists": {
"executor": "@pantheon-org/tools:check-mirror-exists"
},
"lint": {
"executor": "nx:run-commands",
"options": {
"command": "biome check --write .",
"cwd": "packages/opencode-warcraft-notifications-plugin"
},
"cache": true,
"inputs": ["default", "{workspaceRoot}/biome.json", "{projectRoot}/biome.json"]
},
"format": {
"executor": "nx:run-commands",
"options": {
"command": "biome format --write .",
"cwd": "packages/opencode-warcraft-notifications-plugin"
},
"cache": true,
"inputs": ["default", "{workspaceRoot}/biome.json", "{projectRoot}/biome.json"]
},
"validate:tsdoc": {
"executor": "@pantheon-org/tools:validate-tsdoc",
"options": {
"projectRoot": "packages/opencode-warcraft-notifications-plugin"
},
"cache": true
},
"type-check": {
"executor": "nx:run-commands",
"options": {
Expand All @@ -46,11 +71,7 @@
},
"dev-proxy": {
"executor": "@pantheon-org/tools:dev-proxy",
"options": {
"plugins": ["opencode-warcraft-notifications-plugin"],
"symlinkRoot": ".opencode/plugin",
"apply": true
}
"options": {}
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dev-proxy configuration has been emptied, removing the 'plugins', 'symlinkRoot', and 'apply' options that were previously present. This change appears inconsistent with similar configurations in other packages (e.g., opencode-agent-loader-plugin at line 45-51 of its project.json) and may break the dev-proxy functionality. If this is intentional, please add a comment explaining why these options were removed. Otherwise, restore the configuration with appropriate values.

Suggested change
"options": {}
"options": {
"plugins": ["opencode-warcraft-notifications-plugin"],
"symlinkRoot": "packages",
"apply": "dev"
}

Copilot uses AI. Check for mistakes.
},
"test": {
"executor": "nx:run-commands",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { copyFile, exists, mkdir, readdir } from 'node:fs/promises';
import { access, copyFile, mkdir, readdir } from 'node:fs/promises';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';

Expand Down Expand Up @@ -26,7 +26,8 @@ const ensureDirExists = async (dir: string): Promise<boolean> => {

const fileExists = async (path: string): Promise<boolean> => {
try {
return await exists(path);
await access(path);
return true;
} catch {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ it('getConfigDir handles win32 and XDG overrides', () => {
} finally {
// restore
Object.defineProperty(process, 'platform', { value: origPlatform, configurable: true });
if (origXdg === undefined) process.env.XDG_CONFIG_HOME = undefined;
if (origXdg === undefined) delete process.env.XDG_CONFIG_HOME;
else process.env.XDG_CONFIG_HOME = origXdg;
if (origAppData === undefined) process.env.APPDATA = undefined;
if (origAppData === undefined) delete process.env.APPDATA;
else process.env.APPDATA = origAppData;
}
});
Expand Down Expand Up @@ -208,15 +208,15 @@ it('getConfigDir falls back to ~/.config when XDG_CONFIG_HOME is unset', () => {
const origXdg = process.env.XDG_CONFIG_HOME;
try {
Object.defineProperty(process, 'platform', { value: 'linux', configurable: true });
process.env.XDG_CONFIG_HOME = undefined;
delete process.env.XDG_CONFIG_HOME;
const dir = getConfigDir();
expect(typeof dir).toBe('string');
expect(dir).toContain('.config');
} finally {
if (origPlatformDescriptor) {
Object.defineProperty(process, 'platform', origPlatformDescriptor);
}
if (origXdg === undefined) process.env.XDG_CONFIG_HOME = undefined;
if (origXdg === undefined) delete process.env.XDG_CONFIG_HOME;
else process.env.XDG_CONFIG_HOME = origXdg;
}
});
Expand All @@ -226,15 +226,15 @@ it('getConfigDir falls back to AppData\\Roaming when APPDATA is unset on win32',
const origAppData = process.env.APPDATA;
try {
Object.defineProperty(process, 'platform', { value: 'win32', configurable: true });
process.env.APPDATA = undefined;
delete process.env.APPDATA;
const dir = getConfigDir();
expect(typeof dir).toBe('string');
expect(dir).toContain('AppData');
} finally {
if (origPlatformDescriptor) {
Object.defineProperty(process, 'platform', origPlatformDescriptor);
}
if (origAppData === undefined) process.env.APPDATA = undefined;
if (origAppData === undefined) delete process.env.APPDATA;
else process.env.APPDATA = origAppData;
}
});
Expand Down Expand Up @@ -267,7 +267,7 @@ it('loadPluginConfig reads from XDG_CONFIG_HOME when present', async () => {
} finally {
// restore platform and env
Object.defineProperty(process, 'platform', { value: origPlatform, configurable: true });
if (origXdg === undefined) process.env.XDG_CONFIG_HOME = undefined;
if (origXdg === undefined) delete process.env.XDG_CONFIG_HOME;
else process.env.XDG_CONFIG_HOME = origXdg;
}
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('Plugin configuration coverage tests', () => {
}
} finally {
if (origDebug === undefined) {
process.env.DEBUG_OPENCODE = undefined;
delete process.env.DEBUG_OPENCODE;
} else {
process.env.DEBUG_OPENCODE = origDebug;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { exists } from 'node:fs/promises';
import { access } from 'node:fs/promises';
import { join } from 'node:path';

import { createLogger } from '../logger.js';
Expand Down Expand Up @@ -34,7 +34,9 @@ const debugInfo = (message: string, context?: Record<string, unknown>): void =>
const tryLoadFromPath = async (configPath: string, pluginName: string): Promise<WarcraftNotificationConfig | null> => {
debugLog('Checking configuration path', { configPath });

if (!(await exists(configPath))) {
try {
await access(configPath);
} catch {
debugLog('Configuration file not found', { configPath });
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const getPackageName = (): string | null => {
];

if (DEBUG) {
console.log('[opencode-warcraft-notifications] Looking for package.json in:', locations);
}

for (const pkgPath of locations) {
Expand All @@ -64,11 +65,13 @@ export const getPackageName = (): string | null => {
};
if (pkg && typeof pkg.name === 'string') {
if (DEBUG) {
console.log('[opencode-warcraft-notifications] Found package name:', pkg.name, 'from:', pkgPath);
}
return pkg.name;
}
} catch (_err) {
} catch (err) {
if (DEBUG) {
console.log('[opencode-warcraft-notifications] Failed to read:', pkgPath, err);
}
}
}
Expand Down
Loading
Loading