syntropic 0.8.0 → 0.8.1
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/commands/init.js +34 -1
- package/package.json +1 -1
package/commands/init.js
CHANGED
|
@@ -86,6 +86,33 @@ function replaceInFile(filePath, replacements) {
|
|
|
86
86
|
fs.writeFileSync(filePath, content, 'utf8');
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
function installPostCommitHook(targetDir) {
|
|
90
|
+
const hooksDir = path.join(targetDir, '.git', 'hooks');
|
|
91
|
+
if (!fs.existsSync(hooksDir)) return false; // Not a git repo
|
|
92
|
+
|
|
93
|
+
const hookPath = path.join(hooksDir, 'post-commit');
|
|
94
|
+
if (fs.existsSync(hookPath)) {
|
|
95
|
+
// Don't overwrite existing hook — check if it already has syntropic
|
|
96
|
+
const existing = fs.readFileSync(hookPath, 'utf8');
|
|
97
|
+
if (existing.includes('syntropic report')) return 'exists';
|
|
98
|
+
// Append to existing hook
|
|
99
|
+
fs.appendFileSync(hookPath, '\n# Syntropic PRISM — anonymous cycle reporting\ncommand -v syntropic >/dev/null 2>&1 && syntropic report >/dev/null 2>&1 &\n');
|
|
100
|
+
console.log(` append .git/hooks/post-commit (added PRISM reporting)`);
|
|
101
|
+
return 'appended';
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Create new hook
|
|
105
|
+
const hookContent = `#!/bin/sh
|
|
106
|
+
# Syntropic PRISM — anonymous cycle reporting
|
|
107
|
+
# Fire-and-forget: never blocks commits, respects telemetry opt-out
|
|
108
|
+
# Disable: syntropic telemetry disable (or delete this hook)
|
|
109
|
+
command -v syntropic >/dev/null 2>&1 && syntropic report >/dev/null 2>&1 &
|
|
110
|
+
`;
|
|
111
|
+
fs.writeFileSync(hookPath, hookContent, { mode: 0o755 });
|
|
112
|
+
console.log(` create .git/hooks/post-commit (PRISM cycle reporting)`);
|
|
113
|
+
return 'created';
|
|
114
|
+
}
|
|
115
|
+
|
|
89
116
|
function hasSyntropicMarker(filePath) {
|
|
90
117
|
if (!fs.existsSync(filePath)) return false;
|
|
91
118
|
return fs.readFileSync(filePath, 'utf8').includes('<!-- syntropic -->');
|
|
@@ -250,13 +277,19 @@ async function run(args) {
|
|
|
250
277
|
// Ensure ~/.syntropic/config.json exists (device_id, hmac_key, telemetry)
|
|
251
278
|
ensureConfig();
|
|
252
279
|
|
|
280
|
+
// Install post-commit hook for PRISM cycle reporting
|
|
281
|
+
const hookResult = installPostCommitHook(targetDir);
|
|
282
|
+
const hookLine = hookResult === 'created' || hookResult === 'appended'
|
|
283
|
+
? '\n .git/hooks/post-commit PRISM cycle reporting (anonymous)'
|
|
284
|
+
: '';
|
|
285
|
+
|
|
253
286
|
console.log(`
|
|
254
287
|
Done! Your project is set up with the Syntropic pipeline.
|
|
255
288
|
|
|
256
289
|
What was created:
|
|
257
290
|
${toolFiles}
|
|
258
291
|
.github/workflows/ Daily health check with auto-remediation
|
|
259
|
-
scripts/health-check.js Local health check script
|
|
292
|
+
scripts/health-check.js Local health check script${hookLine}
|
|
260
293
|
|
|
261
294
|
Tools configured: ${selectedTools.map(t => TOOLS[t].label).join(', ')}
|
|
262
295
|
|
package/package.json
CHANGED