@avesta-hq/prevention 0.6.0-pre.3 → 0.6.0-pre.5

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/bin/lib/init.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
3
  const { COMMANDS_DIR, AGENTS_DIR, AVESTA_DIR, GITHUB_RELEASES_REPO, copyDir, downloadBinary, getVersion } = require('./utils');
4
- const { configureMcpServer, configureSessionStartHook, configureEnforcementHooks, configureStatusLine, ensureClaudeMdSection } = require('./settings');
4
+ const { configureMcpServer, configureSessionStartHook, configureEnforcementHooks, configurePermissions, configureStatusLine, ensureClaudeMdSection } = require('./settings');
5
5
 
6
6
  function getInstalledVersion(targetDir) {
7
7
  try {
@@ -49,6 +49,7 @@ function init() {
49
49
  configureMcpServer(targetDir, binaryPath);
50
50
  configureSessionStartHook(targetDir);
51
51
  configureEnforcementHooks(targetDir);
52
+ configurePermissions(targetDir);
52
53
  configureStatusLine(targetDir);
53
54
  ensureClaudeMdSection(targetDir);
54
55
 
@@ -110,8 +111,9 @@ function update() {
110
111
  process.exit(1);
111
112
  }
112
113
 
113
- // Reconfigure hooks (picks up any new hook patterns)
114
+ // Reconfigure hooks and permissions (picks up any new patterns)
114
115
  configureEnforcementHooks(targetDir);
116
+ configurePermissions(targetDir);
115
117
 
116
118
  writeInstalledVersion(targetDir);
117
119
 
@@ -122,6 +122,19 @@ function configureEnforcementHooks(targetDir) {
122
122
  console.log(' ✓ Configured workflow enforcement hooks (PreToolUse, UserPromptSubmit, SubagentStart)');
123
123
  }
124
124
 
125
+ function configurePermissions(targetDir) {
126
+ const settings = readSettings(targetDir);
127
+ if (!settings.permissions) settings.permissions = {};
128
+ if (!settings.permissions.allow) settings.permissions.allow = [];
129
+
130
+ const rule = 'mcp__prevention__*';
131
+ if (!settings.permissions.allow.includes(rule)) {
132
+ settings.permissions.allow.push(rule);
133
+ }
134
+
135
+ writeSettings(targetDir, settings);
136
+ }
137
+
125
138
  function configureStatusLine(targetDir) {
126
139
  const statusLineSrc = path.join(targetDir, '.avesta', 'statusLine.js');
127
140
  if (!fs.existsSync(statusLineSrc)) return;
@@ -217,6 +230,7 @@ function ensureClaudeMdSection(targetDir) {
217
230
  module.exports = {
218
231
  configureSessionStartHook,
219
232
  configureEnforcementHooks,
233
+ configurePermissions,
220
234
  configureStatusLine,
221
235
  configureMcpServer,
222
236
  ensureClaudeMdSection,
@@ -22,6 +22,7 @@ const {
22
22
  configureMcpServer,
23
23
  configureSessionStartHook,
24
24
  configureEnforcementHooks,
25
+ configurePermissions,
25
26
  configureStatusLine,
26
27
  ensureClaudeMdSection,
27
28
  } = require('./settings');
@@ -75,6 +76,7 @@ function testLocal(targetDir) {
75
76
  console.log(' [4/6] Configuring hooks...');
76
77
  configureSessionStartHook(targetDir);
77
78
  configureEnforcementHooks(targetDir);
79
+ configurePermissions(targetDir);
78
80
  configureStatusLine(targetDir);
79
81
  ensureClaudeMdSection(targetDir);
80
82
 
package/bin/lib/utils.js CHANGED
@@ -70,16 +70,23 @@ function getPlatformBinaryName() {
70
70
  }
71
71
 
72
72
  function getLatestVersion() {
73
- try {
74
- const result = execSync(
75
- `curl -sI "https://github.com/${GITHUB_RELEASES_REPO}/releases/latest" | grep -i ^location:`,
76
- { encoding: 'utf8', timeout: 10000 }
77
- );
78
- const match = result.match(/\/tag\/(v[^\s\r\n]+)/);
79
- return match ? match[1] : null;
80
- } catch {
81
- return null;
73
+ // Use package version to match the corresponding GitHub Release
74
+ const pkgVersion = `v${getVersion()}`;
75
+
76
+ // For stable releases, verify the release exists via GitHub latest redirect
77
+ // (handles partial release failures where npm published but binary upload failed)
78
+ if (!pkgVersion.includes('-pre')) {
79
+ try {
80
+ const result = execSync(
81
+ `curl -sI "https://github.com/${GITHUB_RELEASES_REPO}/releases/latest" | grep -i ^location:`,
82
+ { encoding: 'utf8', timeout: 10000 }
83
+ );
84
+ const match = result.match(/\/tag\/(v[^\s\r\n]+)/);
85
+ if (match) return match[1];
86
+ } catch {}
82
87
  }
88
+
89
+ return pkgVersion;
83
90
  }
84
91
 
85
92
  function downloadBinary(targetDir) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avesta-hq/prevention",
3
- "version": "0.6.0-pre.3",
3
+ "version": "0.6.0-pre.5",
4
4
  "description": "XP/CD development agent commands for Claude Code - achieve Elite DORA metrics through disciplined TDD and Continuous Delivery practices",
5
5
  "keywords": [
6
6
  "claude-code",