4 Commits

Author SHA1 Message Date
Affaan Mustafa
c2e8e9d17e fix: make npm pack test shell-safe on windows 2026-04-12 22:19:16 -07:00
Affaan Mustafa
a36d85e807 fix: prefer repo-relative hook file paths 2026-04-12 22:13:16 -07:00
Affaan Mustafa
f1249d3915 fix: tighten release script version sync 2026-04-12 22:10:06 -07:00
Affaan Mustafa
057cfe3203 fix: stabilize windows ci portability 2026-04-12 22:06:04 -07:00
7 changed files with 150 additions and 53 deletions

View File

@@ -82,7 +82,7 @@ Bu repository yalnızca ham kodu içerir. Rehberler her şeyi açıklıyor.
### v1.10.0 — Surface Sync, Operatör İş Akışları ve ECC 2.0 Alpha (Nis 2026) ### v1.10.0 — Surface Sync, Operatör İş Akışları ve ECC 2.0 Alpha (Nis 2026)
- **Public surface canlı repo ile senkronlandı** — metadata, katalog sayıları, plugin manifest'leri ve kurulum odaklı dokümanlar artık gerçek OSS yüzeyiyle eşleşiyor. - **Public surface canlı repo ile senkronlandı** — metadata, katalog sayıları, plugin manifest'leri ve kurulum odaklı dokümanlar artık gerçek OSS yüzeyiyle eşleşiyor.
- **Operatör ve dışa dönük iş akışları büyüdü** — `brand-voice`, `social-graph-ranker`, `customer-billing-ops`, `google-workspace-ops` ve ilgili operator skill'leri aynı sistem içinde tamamlandı. - **Operatör ve dışa dönük iş akışları büyüdü** — `brand-voice`, `social-graph-ranker`, `customer-billing-ops`, `google-workspace-ops` ve ilgili operatör skill'leri aynı sistem içinde tamamlandı.
- **Medya ve lansman araçları** — `manim-video`, `remotion-video-creation` ve sosyal yayın yüzeyleri teknik anlatım ve duyuru akışlarını aynı repo içine taşıdı. - **Medya ve lansman araçları** — `manim-video`, `remotion-video-creation` ve sosyal yayın yüzeyleri teknik anlatım ve duyuru akışlarını aynı repo içine taşıdı.
- **Framework ve ürün yüzeyi genişledi** — `nestjs-patterns`, daha zengin Codex/OpenCode kurulum yüzeyleri ve çapraz harness paketleme iyileştirmeleri repo'yu Claude Code dışına da taşıdı. - **Framework ve ürün yüzeyi genişledi** — `nestjs-patterns`, daha zengin Codex/OpenCode kurulum yüzeyleri ve çapraz harness paketleme iyileştirmeleri repo'yu Claude Code dışına da taşıdı.
- **ECC 2.0 alpha repoda** — `ecc2/` altındaki Rust kontrol katmanı artık yerelde derleniyor ve `dashboard`, `start`, `sessions`, `status`, `stop`, `resume` ve `daemon` komutlarını sunuyor. - **ECC 2.0 alpha repoda** — `ecc2/` altındaki Rust kontrol katmanı artık yerelde derleniyor ve `dashboard`, `start`, `sessions`, `status`, `stop`, `resume` ve `daemon` komutlarını sunuyor.

View File

@@ -359,44 +359,72 @@ function gitRepoRoot(cwd) {
return runGit(['rev-parse', '--show-toplevel'], cwd); return runGit(['rev-parse', '--show-toplevel'], cwd);
} }
function repoRelativePath(repoRoot, filePath) { const MAX_RELEVANT_PATCH_LINES = 6;
const absolute = path.isAbsolute(filePath)
? path.resolve(filePath) function candidateGitPaths(repoRoot, filePath) {
: path.resolve(process.cwd(), filePath); const resolvedRepoRoot = path.resolve(repoRoot);
const relative = path.relative(repoRoot, absolute); const candidates = [];
if (!relative || relative.startsWith('..') || path.isAbsolute(relative)) { const pushCandidate = value => {
return null; const candidate = String(value || '').trim();
if (!candidate || candidates.includes(candidate)) {
return;
}
candidates.push(candidate);
};
const absoluteCandidates = path.isAbsolute(filePath)
? [path.resolve(filePath)]
: [
path.resolve(resolvedRepoRoot, filePath),
path.resolve(process.cwd(), filePath),
];
for (const absolute of absoluteCandidates) {
const relative = path.relative(resolvedRepoRoot, absolute);
if (!relative || relative.startsWith('..') || path.isAbsolute(relative)) {
continue;
}
pushCandidate(relative);
pushCandidate(relative.split(path.sep).join('/'));
pushCandidate(absolute);
pushCandidate(absolute.split(path.sep).join('/'));
} }
return relative.split(path.sep).join('/');
return candidates;
} }
function patchPreviewFromGitDiff(repoRoot, repoRelative) { function patchPreviewFromGitDiff(repoRoot, pathCandidates) {
const patch = runGit( for (const candidate of pathCandidates) {
['diff', '--no-ext-diff', '--no-color', '--unified=1', '--', repoRelative], const patch = runGit(
repoRoot ['diff', '--no-ext-diff', '--no-color', '--unified=1', '--', candidate],
repoRoot
);
if (!patch) {
continue;
}
const relevant = patch
.split(/\r?\n/)
.filter(line =>
line.startsWith('@@')
|| (line.startsWith('+') && !line.startsWith('+++'))
|| (line.startsWith('-') && !line.startsWith('---'))
)
.slice(0, MAX_RELEVANT_PATCH_LINES);
if (relevant.length > 0) {
return relevant.join('\n');
}
}
return undefined;
}
function trackedInGit(repoRoot, pathCandidates) {
return pathCandidates.some(candidate =>
runGit(['ls-files', '--error-unmatch', '--', candidate], repoRoot) !== null
); );
if (!patch) {
return undefined;
}
const relevant = patch
.split(/\r?\n/)
.filter(line =>
line.startsWith('@@')
|| (line.startsWith('+') && !line.startsWith('+++'))
|| (line.startsWith('-') && !line.startsWith('---'))
)
.slice(0, 6);
if (relevant.length === 0) {
return undefined;
}
return relevant.join('\n');
}
function trackedInGit(repoRoot, repoRelative) {
return runGit(['ls-files', '--error-unmatch', '--', repoRelative], repoRoot) !== null;
} }
function enrichFileEventFromWorkingTree(toolName, event) { function enrichFileEventFromWorkingTree(toolName, event) {
@@ -409,14 +437,14 @@ function enrichFileEventFromWorkingTree(toolName, event) {
return event; return event;
} }
const repoRelative = repoRelativePath(repoRoot, event.path); const pathCandidates = candidateGitPaths(repoRoot, event.path);
if (!repoRelative) { if (pathCandidates.length === 0) {
return event; return event;
} }
const tool = String(toolName || '').trim().toLowerCase(); const tool = String(toolName || '').trim().toLowerCase();
const tracked = trackedInGit(repoRoot, repoRelative); const tracked = trackedInGit(repoRoot, pathCandidates);
const patchPreview = patchPreviewFromGitDiff(repoRoot, repoRelative) || event.patch_preview; const patchPreview = patchPreviewFromGitDiff(repoRoot, pathCandidates) || event.patch_preview;
const diffPreview = buildDiffPreviewFromPatchPreview(patchPreview) || event.diff_preview; const diffPreview = buildDiffPreviewFromPatchPreview(patchPreview) || event.diff_preview;
if (tool.includes('write')) { if (tool.includes('write')) {

View File

@@ -91,9 +91,15 @@ update_package_lock_version() {
process.exit(1); process.exit(1);
} }
lock.version = version; lock.version = version;
if (lock.packages && lock.packages[""] && typeof lock.packages[""] === "object") { if (!lock.packages || typeof lock.packages !== "object" || Array.isArray(lock.packages)) {
lock.packages[""].version = version; console.error(`Error: ${file} is missing lock.packages`);
process.exit(1);
} }
if (!lock.packages[""] || typeof lock.packages[""] !== "object" || Array.isArray(lock.packages[""])) {
console.error(`Error: ${file} is missing lock.packages[\"\"]`);
process.exit(1);
}
lock.packages[""].version = version;
fs.writeFileSync(file, `${JSON.stringify(lock, null, 2)}\n`); fs.writeFileSync(file, `${JSON.stringify(lock, null, 2)}\n`);
' "$1" "$VERSION" ' "$1" "$VERSION"
} }
@@ -101,22 +107,32 @@ update_package_lock_version() {
update_readme_version_row() { update_readme_version_row() {
local file="$1" local file="$1"
local label="$2" local label="$2"
local first_col="$3"
local second_col="$4"
local third_col="$5"
node -e ' node -e '
const fs = require("fs"); const fs = require("fs");
const file = process.argv[1]; const file = process.argv[1];
const version = process.argv[2]; const version = process.argv[2];
const label = process.argv[3]; const label = process.argv[3];
const firstCol = process.argv[4];
const secondCol = process.argv[5];
const thirdCol = process.argv[6];
const escape = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
const current = fs.readFileSync(file, "utf8"); const current = fs.readFileSync(file, "utf8");
const updated = current.replace( const updated = current.replace(
new RegExp(`^\\| \\*\\*${label}\\*\\* \\| Plugin \\| Plugin \\| Reference config \\| [0-9][0-9.]* \\|$`, "m"), new RegExp(
`| **${label}** | Plugin | Plugin | Reference config | ${version} |` `^\\| \\*\\*${escape(label)}\\*\\* \\| ${escape(firstCol)} \\| ${escape(secondCol)} \\| ${escape(thirdCol)} \\| [0-9]+\\.[0-9]+\\.[0-9]+ \\|$`,
"m"
),
`| **${label}** | ${firstCol} | ${secondCol} | ${thirdCol} | ${version} |`
); );
if (updated === current) { if (updated === current) {
console.error(`Error: could not update README version row in ${file}`); console.error(`Error: could not update README version row in ${file}`);
process.exit(1); process.exit(1);
} }
fs.writeFileSync(file, updated); fs.writeFileSync(file, updated);
' "$file" "$VERSION" "$label" ' "$file" "$VERSION" "$label" "$first_col" "$second_col" "$third_col"
} }
update_selective_install_repo_version() { update_selective_install_repo_version() {
@@ -215,8 +231,8 @@ update_codex_marketplace_version
update_version "$CODEX_PLUGIN_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|" update_version "$CODEX_PLUGIN_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|"
update_version "$OPENCODE_PACKAGE_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|" update_version "$OPENCODE_PACKAGE_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|"
update_package_lock_version "$OPENCODE_PACKAGE_LOCK_JSON" update_package_lock_version "$OPENCODE_PACKAGE_LOCK_JSON"
update_readme_version_row "$README_FILE" "Version" update_readme_version_row "$README_FILE" "Version" "Plugin" "Plugin" "Reference config"
update_readme_version_row "$ZH_CN_README_FILE" "版本" update_readme_version_row "$ZH_CN_README_FILE" "版本" "插件" "插件" "参考配置"
update_selective_install_repo_version "$SELECTIVE_INSTALL_ARCHITECTURE_DOC" update_selective_install_repo_version "$SELECTIVE_INSTALL_ARCHITECTURE_DOC"
# Verify the bumped release surface is still internally consistent before # Verify the bumped release surface is still internally consistent before

View File

@@ -309,6 +309,58 @@ function runTests() {
fs.rmSync(repoDir, { recursive: true, force: true }); fs.rmSync(repoDir, { recursive: true, force: true });
}) ? passed++ : failed++); }) ? passed++ : failed++);
(test('resolves repo-relative paths even when the hook runs from a nested cwd', () => {
const tmpHome = makeTempDir();
const repoDir = fs.mkdtempSync(path.join(os.tmpdir(), 'session-activity-tracker-nested-repo-'));
spawnSync('git', ['init'], { cwd: repoDir, encoding: 'utf8' });
spawnSync('git', ['config', 'user.email', 'ecc@example.com'], { cwd: repoDir, encoding: 'utf8' });
spawnSync('git', ['config', 'user.name', 'ECC Tests'], { cwd: repoDir, encoding: 'utf8' });
const srcDir = path.join(repoDir, 'src');
const nestedCwd = path.join(repoDir, 'subdir');
fs.mkdirSync(srcDir, { recursive: true });
fs.mkdirSync(nestedCwd, { recursive: true });
const trackedFile = path.join(srcDir, 'app.ts');
fs.writeFileSync(trackedFile, 'const count = 1;\n', 'utf8');
spawnSync('git', ['add', 'src/app.ts'], { cwd: repoDir, encoding: 'utf8' });
spawnSync('git', ['commit', '-m', 'init'], { cwd: repoDir, encoding: 'utf8' });
fs.writeFileSync(trackedFile, 'const count = 2;\n', 'utf8');
const input = {
tool_name: 'Write',
tool_input: {
file_path: 'src/app.ts',
content: 'const count = 2;\n',
},
tool_output: { output: 'updated src/app.ts' },
};
const result = runScript(input, {
...withTempHome(tmpHome),
CLAUDE_HOOK_EVENT_NAME: 'PostToolUse',
ECC_SESSION_ID: 'ecc-session-nested-cwd',
}, {
cwd: nestedCwd,
});
assert.strictEqual(result.code, 0);
const metricsFile = path.join(tmpHome, '.claude', 'metrics', 'tool-usage.jsonl');
const row = JSON.parse(fs.readFileSync(metricsFile, 'utf8').trim());
assert.deepStrictEqual(row.file_events, [
{
path: 'src/app.ts',
action: 'modify',
diff_preview: 'const count = 1; -> const count = 2;',
patch_preview: '@@ -1 +1 @@\n-const count = 1;\n+const count = 2;',
},
]);
fs.rmSync(tmpHome, { recursive: true, force: true });
fs.rmSync(repoDir, { recursive: true, force: true });
}) ? passed++ : failed++);
(test('prefers ECC_SESSION_ID over CLAUDE_SESSION_ID and redacts bash summaries', () => { (test('prefers ECC_SESSION_ID over CLAUDE_SESSION_ID and redacts bash summaries', () => {
const tmpHome = makeTempDir(); const tmpHome = makeTempDir();
const input = { const input = {

View File

@@ -95,28 +95,28 @@ test('package-lock.json root version matches package.json', () => {
test('AGENTS.md version line matches package.json', () => { test('AGENTS.md version line matches package.json', () => {
const agentsSource = fs.readFileSync(rootAgentsPath, 'utf8'); const agentsSource = fs.readFileSync(rootAgentsPath, 'utf8');
const match = agentsSource.match(/^\*\*Version:\*\* ([0-9][0-9.]*)$/m); const match = agentsSource.match(/^\*\*Version:\*\* ([0-9]+\.[0-9]+\.[0-9]+)$/m);
assert.ok(match, 'Expected AGENTS.md to declare a top-level version line'); assert.ok(match, 'Expected AGENTS.md to declare a top-level version line');
assert.strictEqual(match[1], expectedVersion); assert.strictEqual(match[1], expectedVersion);
}); });
test('docs/tr/AGENTS.md version line matches package.json', () => { test('docs/tr/AGENTS.md version line matches package.json', () => {
const agentsSource = fs.readFileSync(trAgentsPath, 'utf8'); const agentsSource = fs.readFileSync(trAgentsPath, 'utf8');
const match = agentsSource.match(/^\*\*Sürüm:\*\* ([0-9][0-9.]*)$/m); const match = agentsSource.match(/^\*\*Sürüm:\*\* ([0-9]+\.[0-9]+\.[0-9]+)$/m);
assert.ok(match, 'Expected docs/tr/AGENTS.md to declare a top-level version line'); assert.ok(match, 'Expected docs/tr/AGENTS.md to declare a top-level version line');
assert.strictEqual(match[1], expectedVersion); assert.strictEqual(match[1], expectedVersion);
}); });
test('docs/zh-CN/AGENTS.md version line matches package.json', () => { test('docs/zh-CN/AGENTS.md version line matches package.json', () => {
const agentsSource = fs.readFileSync(zhCnAgentsPath, 'utf8'); const agentsSource = fs.readFileSync(zhCnAgentsPath, 'utf8');
const match = agentsSource.match(/^\*\*版本:\*\* ([0-9][0-9.]*)$/m); const match = agentsSource.match(/^\*\*版本:\*\* ([0-9]+\.[0-9]+\.[0-9]+)$/m);
assert.ok(match, 'Expected docs/zh-CN/AGENTS.md to declare a top-level version line'); assert.ok(match, 'Expected docs/zh-CN/AGENTS.md to declare a top-level version line');
assert.strictEqual(match[1], expectedVersion); assert.strictEqual(match[1], expectedVersion);
}); });
test('agent.yaml version matches package.json', () => { test('agent.yaml version matches package.json', () => {
const agentYamlSource = fs.readFileSync(agentYamlPath, 'utf8'); const agentYamlSource = fs.readFileSync(agentYamlPath, 'utf8');
const match = agentYamlSource.match(/^version:\s*([0-9][0-9.]*)$/m); const match = agentYamlSource.match(/^version:\s*([0-9]+\.[0-9]+\.[0-9]+)$/m);
assert.ok(match, 'Expected agent.yaml to declare a top-level version field'); assert.ok(match, 'Expected agent.yaml to declare a top-level version field');
assert.strictEqual(match[1], expectedVersion); assert.strictEqual(match[1], expectedVersion);
}); });
@@ -129,7 +129,7 @@ test('VERSION file matches package.json', () => {
test('docs/SELECTIVE-INSTALL-ARCHITECTURE.md repoVersion example matches package.json', () => { test('docs/SELECTIVE-INSTALL-ARCHITECTURE.md repoVersion example matches package.json', () => {
const source = fs.readFileSync(selectiveInstallArchitecturePath, 'utf8'); const source = fs.readFileSync(selectiveInstallArchitecturePath, 'utf8');
const match = source.match(/"repoVersion":\s*"([0-9][0-9.]*)"/); const match = source.match(/"repoVersion":\s*"([0-9]+\.[0-9]+\.[0-9]+)"/);
assert.ok(match, 'Expected docs/SELECTIVE-INSTALL-ARCHITECTURE.md to declare a repoVersion example'); assert.ok(match, 'Expected docs/SELECTIVE-INSTALL-ARCHITECTURE.md to declare a repoVersion example');
assert.strictEqual(match[1], expectedVersion); assert.strictEqual(match[1], expectedVersion);
}); });

View File

@@ -49,8 +49,9 @@ function main() {
const result = spawnSync("npm", ["pack", "--dry-run", "--json"], { const result = spawnSync("npm", ["pack", "--dry-run", "--json"], {
cwd: repoRoot, cwd: repoRoot,
encoding: "utf8", encoding: "utf8",
shell: process.platform === "win32",
}) })
assert.strictEqual(result.status, 0, result.stderr) assert.strictEqual(result.status, 0, result.error?.message || result.stderr)
const packOutput = JSON.parse(result.stdout) const packOutput = JSON.parse(result.stdout)
const packagedPaths = new Set(packOutput[0]?.files?.map((file) => file.path) ?? []) const packagedPaths = new Set(packOutput[0]?.files?.map((file) => file.path) ?? [])

View File

@@ -35,7 +35,7 @@ function runTests() {
})) passed++; else failed++; })) passed++; else failed++;
if (test('release script reruns release metadata sync validation before commit/tag', () => { if (test('release script reruns release metadata sync validation before commit/tag', () => {
const syncCheckIndex = source.indexOf('node tests/plugin-manifest.test.js'); const syncCheckIndex = source.lastIndexOf('node tests/plugin-manifest.test.js');
const commitIndex = source.indexOf('git commit -m "chore: bump plugin version to $VERSION"'); const commitIndex = source.indexOf('git commit -m "chore: bump plugin version to $VERSION"');
assert.ok(syncCheckIndex >= 0, 'release.sh should run plugin-manifest.test.js'); assert.ok(syncCheckIndex >= 0, 'release.sh should run plugin-manifest.test.js');