Skip to content
Closed
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
24 changes: 24 additions & 0 deletions .github/workflows/claude-project-scope-probe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Claude project scope probe

on:
workflow_dispatch:
pull_request:
branches: [next]

permissions:
contents: read

jobs:
windows:
if: github.event_name == 'workflow_dispatch' || github.head_ref == 'chore/claude-windows-scope-probe'
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "22"
- run: npm install -g @anthropic-ai/claude-code
- run: node scripts/probe-claude-project-scope.cjs
45 changes: 45 additions & 0 deletions scripts/probe-claude-project-scope.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env node
const { spawnSync } = require("node:child_process");
const fs = require("node:fs");
const os = require("node:os");
const path = require("node:path");

const root = fs.mkdtempSync(path.join(os.tmpdir(), "aidd-claude-scope-"));
const project = path.join(root, "project-a");
const otherProject = path.join(root, "project-b");
const home = path.join(root, "home");
const env = { ...process.env, HOME: home, CLAUDE_CONFIG_DIR: path.join(home, ".claude") };

function run(args) {
const result = spawnSync("claude", args, {
cwd: project,
env,
encoding: "utf8",
timeout: 120000,
// npm exposes Claude as claude.cmd on Windows. The production adapter uses cmd.exe too.
shell: process.platform === "win32",
});
if (result.error || result.status !== 0) {
throw new Error(`claude ${args.join(" ")} failed: ${result.stderr || result.error?.message || result.status}`);
}
}

try {
fs.mkdirSync(project, { recursive: true });
fs.mkdirSync(otherProject, { recursive: true });
run(["plugin", "marketplace", "add", process.cwd(), "--scope", "local"]);
run(["plugin", "install", "aidd-context@aidd-framework", "--yes", "--scope", "local"]);

const settings = path.join(project, ".claude", "settings.local.json");
if (!fs.existsSync(settings)) throw new Error("project scope wrote no .claude/settings.local.json");
const enabled = JSON.parse(fs.readFileSync(settings, "utf8")).enabledPlugins;
if (enabled?.["aidd-context@aidd-framework"] !== true) {
throw new Error("project settings do not enable aidd-context@aidd-framework");
}
if (fs.existsSync(path.join(otherProject, ".claude", "settings.local.json"))) {
throw new Error("a second project received the local plugin settings");
}
console.log("Claude project-scope install is isolated: project A enabled, project B untouched.");
} finally {
fs.rmSync(root, { recursive: true, force: true });
}
Loading