Closes the three problems in the AGENTS.md block: - the block went to AGENTS.md whatever the agent, and carried an `@` import that Claude Code does not need and Codex does not expand. It now goes to CLAUDE.md for Claude Code and AGENTS.md for Codex and Antigravity, and names the installed skills instead of importing 46 KB of core into every session - the markers now match the wizard's, so whichever install path runs last replaces the block instead of adding a second one - a global install no longer creates ~/.agents/skills and ~/.codex/skills for tools the user does not have; it uses the same parent-exists check the project path already used, with Claude Code always included smoke-worker gains an idempotency check on the entry file.
46 lines
1.5 KiB
JavaScript
46 lines
1.5 KiB
JavaScript
#!/usr/bin/env node
|
|
import fs from 'node:fs'
|
|
import os from 'node:os'
|
|
import path from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
import { spawnSync } from 'node:child_process'
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
const worker = path.join(__dirname, 'smoke-worker.mjs')
|
|
|
|
function tree(dir, prefix = '') {
|
|
const out = []
|
|
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
const p = path.join(dir, entry.name)
|
|
if (entry.isDirectory()) {
|
|
out.push(prefix + entry.name + '/')
|
|
out.push(...tree(p, prefix + ' '))
|
|
} else {
|
|
out.push(prefix + entry.name)
|
|
}
|
|
}
|
|
return out
|
|
}
|
|
|
|
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'antislop-smoke-'))
|
|
const result = spawnSync(process.execPath, [worker], { cwd: tmp, encoding: 'utf8' })
|
|
console.log('--- worker output ---')
|
|
console.log(result.stdout.trim())
|
|
if (result.status !== 0) console.log('worker stderr:', result.stderr)
|
|
|
|
console.log('\n--- files written to temp project ---')
|
|
console.log(tree(tmp).join('\n'))
|
|
|
|
for (const name of ['CLAUDE.md', 'AGENTS.md']) {
|
|
const entry = path.join(tmp, name)
|
|
if (!fs.existsSync(entry)) continue
|
|
console.log(`\n--- ${name} ---`)
|
|
console.log(fs.readFileSync(entry, 'utf8'))
|
|
}
|
|
|
|
const coreSkill = path.join(tmp, '.claude', 'skills', 'antislop', 'SKILL.md')
|
|
console.log('\ncore SKILL.md exists:', fs.existsSync(coreSkill))
|
|
|
|
fs.rmSync(tmp, { recursive: true, force: true })
|
|
console.log('\ncleaned up temp project.')
|