Rules for an AI coding agent to filter out generic AI-generated UI designs, text, and code.
JavaScript accessibilityagent-skillsai-agentsai-coding-agentai-slopanti-slopclaude-codecopywritingdesign-rulesui-design
fix(cli): write no pointer when the installer runs from home (#48)
Fajar Hidayat28bfac4442c9
diff --git a/cli/index.mjs b/cli/index.mjsindex 8c8859d..bedb412 100644--- a/cli/index.mjs+++ b/cli/index.mjs@@ -7,6 +7,7 @@ import { configureMode } from './lib/settings.mjs'import {CORE,AGENTS,+ atHome,skillSourceDir,resolveTargets,detectAgents,@@ -178,6 +179,8 @@ async function main() {if (pointers.length > 0) {log.step('Pointer written to ' + pointers.map((p) => path.basename(p)).join(', '))+ } else if (location === 'project' && atHome()) {+ log.warn('This is your home folder, so no pointer was written: one here would load in every project. Run it inside a project for a pointer.')}const folderCount = new Set(written.map((w) => path.dirname(w.path))).sizediff --git a/cli/lib/install.mjs b/cli/lib/install.mjsindex e909810..9aadf85 100644--- a/cli/lib/install.mjs+++ b/cli/lib/install.mjs@@ -426,7 +426,18 @@ function writeBlock(entry, block) {fs.writeFileSync(entry, body + eol)}+// From the home folder the project scope is the global one, and an entry file written+// there (~/CLAUDE.md, ~/AGENTS.md) is loaded by agents in every project under it.+export function atHome() {+ try {+ return fs.realpathSync(process.cwd()) === fs.realpathSync(os.homedir())+ } catch {+ return false // a HOME that does not exist, as in some CI containers+ }+}+export function updatePointers({ targets, skills }) {+ if (atHome()) return []const entries = new Map()for (const t of targets) {if (fs.existsSync(path.join(t.path, CORE))) {@@ -460,12 +471,11 @@ export function updateAll({ locations = ['project', 'global'] } = {}) {const projectTargets = []const projectSkills = new Set()- // Run from the home folder, the project scope is the global one: each folder was updated- // twice and a pointer landed in ~/CLAUDE.md, which agents then load in every project.- const atHome = fs.realpathSync(process.cwd()) === fs.realpathSync(os.homedir())+ // From home, each folder would be updated a second time as a project folder.+ const home = atHome()for (const location of locations) {- if (location === 'project' && atHome) continue+ if (location === 'project' && home) continuefor (const target of resolveTargets(location)) {if (!fs.existsSync(path.join(target.path, CORE))) continueconst skills = SKILL_NAMES.filter((s) => fs.existsSync(path.join(target.path, s)))diff --git a/cli/scripts/smoke-worker.mjs b/cli/scripts/smoke-worker.mjsindex d27256f..9bd2140 100644--- a/cli/scripts/smoke-worker.mjs+++ b/cli/scripts/smoke-worker.mjs@@ -395,6 +395,7 @@ try {process.chdir(fakeHome)check('L update from home touches each folder once', updateAll().results.map((r) => r.location), ['global'])check('L update from home writes no pointer', fs.existsSync(path.join(fakeHome, 'CLAUDE.md')), false)+ check('L install from home writes no pointer', updatePointers({ targets: resolveTargets('project', ['claude']), skills: [CORE] }), [])} finally {process.chdir(here)process.env = savedEnv