mirror of
https://github.com/tiennm99/miti99.git
synced 2026-09-18 04:19:49 +00:00
Extract newsletter scripts to a neutral scripts/newsletter/ engine and add side-by-side support for all three AI coding tools off one source of truth. - Move 9 scripts + substack config from .claude/skills/**/scripts to scripts/newsletter/ (history preserved); fix PROJECT_ROOT depth and cross-require/config paths; repoint all SKILL.md invocations - Add canonical AGENTS.md; reduce CLAUDE.md to an @AGENTS.md import - Add opencode.json (permissions, no MCP); skills auto-discovered in place - Add codex/prompts/*.md (6 prompts) + copy installers (install.sh/.ps1) - Add docs/multi-tool-usage.md (setup, per-tool invocation, teardown) + README pointer
38 lines
1.0 KiB
JavaScript
38 lines
1.0 KiB
JavaScript
#!/usr/bin/env node
|
|
// mt-webfetch fallback fetcher via defuddle.md
|
|
// Usage: node fetch.js <target_url>
|
|
// Exit codes: 0 = content returned, 1 = empty/failed, 2 = bad args
|
|
|
|
const url = process.argv[2];
|
|
if (!url) {
|
|
console.error("Usage: node fetch.js <target_url>");
|
|
process.exit(2);
|
|
}
|
|
|
|
const defuddleUrl = `https://defuddle.md/${url}`;
|
|
|
|
async function main() {
|
|
const controller = new AbortController();
|
|
const timeout = setTimeout(() => controller.abort(), 30000);
|
|
try {
|
|
const res = await fetch(defuddleUrl, {
|
|
redirect: "follow",
|
|
signal: controller.signal,
|
|
headers: { "User-Agent": "mt-webfetch/1.0" },
|
|
});
|
|
clearTimeout(timeout);
|
|
const body = await res.text();
|
|
if (!res.ok || !body || body.trim().length === 0) {
|
|
console.error(`mt-webfetch: defuddle returned ${res.status} / empty body for ${url}`);
|
|
process.exit(1);
|
|
}
|
|
process.stdout.write(body);
|
|
} catch (err) {
|
|
clearTimeout(timeout);
|
|
console.error(`mt-webfetch: fetch failed for ${url}: ${err.message}`);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
main();
|