@ghl-ai/aw 0.1.42-beta.16 → 0.1.42-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ecc.mjs +1 -1
- package/hooks.mjs +43 -3
- package/package.json +1 -1
package/ecc.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { applyStoredStartupPreferences } from "./startup.mjs";
|
|
|
10
10
|
|
|
11
11
|
const AW_ECC_REPO_SSH = "git@github.com:shreyansh-ghl/aw-ecc.git";
|
|
12
12
|
const AW_ECC_REPO_HTTPS = "https://github.com/shreyansh-ghl/aw-ecc.git";
|
|
13
|
-
export const AW_ECC_TAG = "v1.4.38-beta.
|
|
13
|
+
export const AW_ECC_TAG = "v1.4.38-beta.17";
|
|
14
14
|
|
|
15
15
|
const MARKETPLACE_NAME = "aw-marketplace";
|
|
16
16
|
const PLUGIN_KEY = `aw@${MARKETPLACE_NAME}`;
|
package/hooks.mjs
CHANGED
|
@@ -95,6 +95,16 @@ if [ -f ".aw/.git" ] && command -v aw >/dev/null 2>&1; then
|
|
|
95
95
|
AW_TRIGGER=hook:post-commit aw link >/dev/null 2>&1 &
|
|
96
96
|
fi
|
|
97
97
|
|
|
98
|
+
# Fire commit_created telemetry if commit has AW co-author trailer
|
|
99
|
+
if git log -1 --format='%b' HEAD 2>/dev/null | grep -qF "Co-Authored-By: AW"; then
|
|
100
|
+
TELEMETRY_HOOK="$HOME/.aw-ecc/scripts/hooks/aw-usage-commit-created.js"
|
|
101
|
+
if command -v node >/dev/null 2>&1 && [ -f "$TELEMETRY_HOOK" ]; then
|
|
102
|
+
COMMIT_HASH="$(git rev-parse --short HEAD 2>/dev/null || echo unknown)"
|
|
103
|
+
BRANCH="$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo unknown)"
|
|
104
|
+
node "$TELEMETRY_HOOK" "$COMMIT_HASH" "$BRANCH" >/dev/null 2>&1
|
|
105
|
+
fi
|
|
106
|
+
fi
|
|
107
|
+
|
|
98
108
|
# Chain to previous hooksPath
|
|
99
109
|
PREV_PATH_FILE="$HOME/.aw/hooks/.previous-hooks-path"
|
|
100
110
|
if [ -f "$PREV_PATH_FILE" ]; then
|
|
@@ -258,10 +268,31 @@ fi
|
|
|
258
268
|
exit 0
|
|
259
269
|
`;
|
|
260
270
|
|
|
271
|
+
// Standalone post-commit for local .git/hooks/ installation.
|
|
272
|
+
// Fires commit_created telemetry when the commit has AW co-author trailer.
|
|
273
|
+
const LOCAL_POST_COMMIT = `#!/bin/sh
|
|
274
|
+
# aw: local post-commit hook (installed by aw init)
|
|
275
|
+
|
|
276
|
+
# Skip aw temp dirs
|
|
277
|
+
case "$(pwd)" in /tmp/aw-*|/var/folders/*/aw-*|*/.aw|*/.aw/*) exit 0 ;; esac
|
|
278
|
+
|
|
279
|
+
# Fire commit_created telemetry if commit has AW co-author trailer
|
|
280
|
+
if git log -1 --format='%b' HEAD 2>/dev/null | grep -qF "Co-Authored-By: AW"; then
|
|
281
|
+
TELEMETRY_HOOK="$HOME/.aw-ecc/scripts/hooks/aw-usage-commit-created.js"
|
|
282
|
+
if command -v node >/dev/null 2>&1 && [ -f "$TELEMETRY_HOOK" ]; then
|
|
283
|
+
COMMIT_HASH="$(git rev-parse --short HEAD 2>/dev/null || echo unknown)"
|
|
284
|
+
BRANCH="$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo unknown)"
|
|
285
|
+
node "$TELEMETRY_HOOK" "$COMMIT_HASH" "$BRANCH" >/dev/null 2>&1
|
|
286
|
+
fi
|
|
287
|
+
fi
|
|
288
|
+
|
|
289
|
+
exit 0
|
|
290
|
+
`;
|
|
291
|
+
|
|
261
292
|
/**
|
|
262
|
-
* Install prepare-commit-msg
|
|
263
|
-
* This covers repos where another tool (e.g. Claude Code) sets
|
|
264
|
-
* core.hooksPath that overrides the global one.
|
|
293
|
+
* Install prepare-commit-msg and post-commit hooks into a project's local
|
|
294
|
+
* .git/hooks/. This covers repos where another tool (e.g. Claude Code) sets
|
|
295
|
+
* a local core.hooksPath that overrides the global one.
|
|
265
296
|
*
|
|
266
297
|
* @param {string} projectDir — root of the project (must contain .git/)
|
|
267
298
|
*/
|
|
@@ -297,6 +328,15 @@ export function installLocalCommitHook(projectDir) {
|
|
|
297
328
|
|
|
298
329
|
writeFileSync(hookPath, LOCAL_PREPARE_COMMIT_MSG);
|
|
299
330
|
chmodSync(hookPath, '755');
|
|
331
|
+
|
|
332
|
+
// Also install post-commit for commit_created telemetry
|
|
333
|
+
const postCommitPath = join(hooksDir, 'post-commit');
|
|
334
|
+
const shouldWritePostCommit = !existsSync(postCommitPath)
|
|
335
|
+
|| readFileSync(postCommitPath, 'utf8').includes('aw:');
|
|
336
|
+
if (shouldWritePostCommit) {
|
|
337
|
+
writeFileSync(postCommitPath, LOCAL_POST_COMMIT);
|
|
338
|
+
chmodSync(postCommitPath, '755');
|
|
339
|
+
}
|
|
300
340
|
} catch { /* best effort */ }
|
|
301
341
|
}
|
|
302
342
|
|