mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-05-13 16:13:03 +08:00
fix: salvage remaining stale queue fixes (#1754)
This commit is contained in:
@@ -86,7 +86,7 @@ function gitInit(dir) {
|
||||
assert.strictEqual(commitResult.status, 0, commitResult.stderr);
|
||||
}
|
||||
|
||||
function runObserve({ homeDir, cwd }) {
|
||||
function runObserve({ homeDir, cwd, args = ['post'], extraEnv = {} }) {
|
||||
const payload = JSON.stringify({
|
||||
tool_name: 'Read',
|
||||
tool_input: { file_path: 'README.md' },
|
||||
@@ -95,7 +95,7 @@ function runObserve({ homeDir, cwd }) {
|
||||
cwd,
|
||||
});
|
||||
|
||||
return spawnSync('bash', [observeShPath, 'post'], {
|
||||
return spawnSync('bash', [observeShPath, ...args], {
|
||||
cwd: repoRoot,
|
||||
encoding: 'utf8',
|
||||
input: payload,
|
||||
@@ -107,6 +107,7 @@ function runObserve({ homeDir, cwd }) {
|
||||
CLAUDE_CODE_ENTRYPOINT: 'cli',
|
||||
ECC_HOOK_PROFILE: 'standard',
|
||||
ECC_SKIP_OBSERVE: '0',
|
||||
...extraEnv,
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -215,6 +216,40 @@ test('observe.sh writes project metadata for the git root when cwd is a subdirec
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
test('observe.sh falls back to CLAUDE_HOOK_EVENT_NAME when no phase argument is passed', () => {
|
||||
const testRoot = createTempDir();
|
||||
|
||||
try {
|
||||
const homeDir = path.join(testRoot, 'home');
|
||||
const repoDir = path.join(testRoot, 'repo');
|
||||
fs.mkdirSync(homeDir, { recursive: true });
|
||||
fs.mkdirSync(repoDir, { recursive: true });
|
||||
gitInit(repoDir);
|
||||
|
||||
const result = runObserve({
|
||||
homeDir,
|
||||
cwd: repoDir,
|
||||
args: [],
|
||||
extraEnv: { CLAUDE_HOOK_EVENT_NAME: 'PreToolUse' },
|
||||
});
|
||||
assert.strictEqual(result.status, 0, result.stderr);
|
||||
|
||||
const { projectDir } = readSingleProjectMetadata(homeDir);
|
||||
const observationsPath = path.join(projectDir, 'observations.jsonl');
|
||||
const observation = JSON.parse(fs.readFileSync(observationsPath, 'utf8').trim());
|
||||
assert.strictEqual(
|
||||
observation.event,
|
||||
'tool_start',
|
||||
'manual PreToolUse installs without argv should record tool_start'
|
||||
);
|
||||
assert.ok(Object.prototype.hasOwnProperty.call(observation, 'input'));
|
||||
assert.ok(!Object.prototype.hasOwnProperty.call(observation, 'output'));
|
||||
} finally {
|
||||
cleanupDir(testRoot);
|
||||
}
|
||||
});
|
||||
|
||||
test('observe.sh keeps the raw cwd when the directory is not inside a git repo', () => {
|
||||
const testRoot = createTempDir();
|
||||
|
||||
|
||||
@@ -25,21 +25,21 @@ const skillHealthDoc = fs.readFileSync(path.join(__dirname, '..', '..', 'command
|
||||
|
||||
test('sessions command uses shared inline resolver in all node scripts', () => {
|
||||
assert.strictEqual((sessionsDoc.match(/const _r = /g) || []).length, 6);
|
||||
assert.strictEqual((sessionsDoc.match(/\['marketplace','ecc'\]/g) || []).length, 6);
|
||||
assert.strictEqual((sessionsDoc.match(/\['marketplace','everything-claude-code'\]/g) || []).length, 6);
|
||||
assert.strictEqual((sessionsDoc.match(/\['marketplaces','ecc'\]/g) || []).length, 6);
|
||||
assert.strictEqual((sessionsDoc.match(/\['marketplaces','everything-claude-code'\]/g) || []).length, 6);
|
||||
assert.strictEqual((sessionsDoc.match(/\['ecc','everything-claude-code'\]/g) || []).length, 6);
|
||||
});
|
||||
|
||||
test('skill-health command uses shared inline resolver in all shell snippets', () => {
|
||||
assert.strictEqual((skillHealthDoc.match(/var r=/g) || []).length, 3);
|
||||
assert.strictEqual((skillHealthDoc.match(/\['marketplace','ecc'\]/g) || []).length, 3);
|
||||
assert.strictEqual((skillHealthDoc.match(/\['marketplace','everything-claude-code'\]/g) || []).length, 3);
|
||||
assert.strictEqual((skillHealthDoc.match(/\['marketplaces','ecc'\]/g) || []).length, 3);
|
||||
assert.strictEqual((skillHealthDoc.match(/\['marketplaces','everything-claude-code'\]/g) || []).length, 3);
|
||||
assert.strictEqual((skillHealthDoc.match(/\['ecc','everything-claude-code'\]/g) || []).length, 3);
|
||||
});
|
||||
|
||||
test('inline resolver covers current and legacy marketplace plugin roots', () => {
|
||||
assert.ok(INLINE_RESOLVE.includes('"marketplace","ecc"'));
|
||||
assert.ok(INLINE_RESOLVE.includes('"marketplace","everything-claude-code"'));
|
||||
assert.ok(INLINE_RESOLVE.includes('"marketplaces","ecc"'));
|
||||
assert.ok(INLINE_RESOLVE.includes('"marketplaces","everything-claude-code"'));
|
||||
});
|
||||
|
||||
console.log(`Passed: ${passed}`);
|
||||
|
||||
@@ -158,10 +158,10 @@ function runTests() {
|
||||
}
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('finds marketplace current plugin install at ~/.claude/plugins/marketplace/ecc', () => {
|
||||
if (test('finds marketplace current plugin install at ~/.claude/plugins/marketplaces/ecc', () => {
|
||||
const homeDir = createTempDir();
|
||||
try {
|
||||
const expected = setupLegacyPluginInstall(homeDir, ['marketplace', 'ecc']);
|
||||
const expected = setupLegacyPluginInstall(homeDir, ['marketplaces', 'ecc']);
|
||||
const result = resolveEccRoot({ envRoot: '', homeDir });
|
||||
assert.strictEqual(result, expected);
|
||||
} finally {
|
||||
@@ -169,10 +169,10 @@ function runTests() {
|
||||
}
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('finds marketplace legacy plugin install at ~/.claude/plugins/marketplace/everything-claude-code', () => {
|
||||
if (test('finds marketplace legacy plugin install at ~/.claude/plugins/marketplaces/everything-claude-code', () => {
|
||||
const homeDir = createTempDir();
|
||||
try {
|
||||
const expected = setupLegacyPluginInstall(homeDir, ['marketplace', 'everything-claude-code']);
|
||||
const expected = setupLegacyPluginInstall(homeDir, ['marketplaces', 'everything-claude-code']);
|
||||
const result = resolveEccRoot({ envRoot: '', homeDir });
|
||||
assert.strictEqual(result, expected);
|
||||
} finally {
|
||||
@@ -183,7 +183,7 @@ function runTests() {
|
||||
if (test('prefers exact legacy plugin install over plugin cache', () => {
|
||||
const homeDir = createTempDir();
|
||||
try {
|
||||
const expected = setupLegacyPluginInstall(homeDir, ['marketplace', 'ecc']);
|
||||
const expected = setupLegacyPluginInstall(homeDir, ['marketplaces', 'ecc']);
|
||||
setupPluginCache(homeDir, 'ecc', 'affaan-m', CURRENT_PACKAGE_VERSION);
|
||||
const result = resolveEccRoot({ envRoot: '', homeDir });
|
||||
assert.strictEqual(result, expected);
|
||||
@@ -298,7 +298,7 @@ function runTests() {
|
||||
if (test('INLINE_RESOLVE discovers exact legacy plugin root when env var is unset', () => {
|
||||
const homeDir = createTempDir();
|
||||
try {
|
||||
const expected = setupLegacyPluginInstall(homeDir, ['marketplace', 'ecc']);
|
||||
const expected = setupLegacyPluginInstall(homeDir, ['marketplaces', 'ecc']);
|
||||
const { execFileSync } = require('child_process');
|
||||
const result = execFileSync('node', [
|
||||
'-e', `console.log(${INLINE_RESOLVE})`,
|
||||
|
||||
Reference in New Issue
Block a user