@amitdeshmukh/ax-crew 8.7.0 → 8.7.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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [8.7.1] - 2026-03-17
4
+
5
+ ### Fixed
6
+ - Skill postinstall now installs to the **project directory** (`.claude/skills/ax-crew/`, `.agents/skills/ax-crew/`) instead of the home directory. Skills are scoped to projects that use ax-crew.
7
+
3
8
  ## [8.7.0] - 2026-03-17
4
9
 
5
10
  ### Added
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@amitdeshmukh/ax-crew",
4
- "version": "8.7.0",
4
+ "version": "8.7.1",
5
5
  "description": "Build and launch a crew of AI agents with shared state. Built with axllm.dev",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -4,27 +4,50 @@
4
4
  * Postinstall script: installs ax-crew skill files for Claude Code and Codex.
5
5
  * Runs automatically on `npm install @amitdeshmukh/ax-crew`.
6
6
  *
7
- * Claude Code: copies individual .md files to ~/.claude/skills/ax-crew/
8
- * Codex: creates a single SKILL.md in ~/.agents/skills/ax-crew/
9
- * (Codex requires one SKILL.md per skill directory)
7
+ * Skills are installed to the PROJECT directory (not home dir):
8
+ * Claude Code: .claude/skills/ax-crew/ (individual .md files)
9
+ * Codex: .agents/skills/ax-crew/ (combined SKILL.md)
10
+ *
11
+ * The project root is determined by walking up from node_modules
12
+ * to find the consuming project's root directory.
10
13
  */
11
14
 
12
15
  import { existsSync, mkdirSync, readdirSync, copyFileSync, readFileSync, writeFileSync } from 'fs';
13
- import { join, dirname } from 'path';
16
+ import { join, dirname, resolve } from 'path';
14
17
  import { fileURLToPath } from 'url';
15
- import { homedir } from 'os';
16
18
 
17
19
  const __dirname = dirname(fileURLToPath(import.meta.url));
18
20
  const skillsSource = join(__dirname, '..', 'src', 'skills');
19
21
 
22
+ // Find the project root by walking up from the package's location
23
+ // When installed via npm, we're at <project>/node_modules/@amitdeshmukh/ax-crew/scripts/
24
+ // So project root is 4 levels up. When running locally (dev), use INIT_CWD or cwd.
25
+ function findProjectRoot() {
26
+ // npm sets INIT_CWD to the directory where `npm install` was run
27
+ if (process.env.INIT_CWD) {
28
+ return process.env.INIT_CWD;
29
+ }
30
+ // Fallback: walk up from our location past node_modules
31
+ let dir = resolve(__dirname, '..');
32
+ while (dir !== dirname(dir)) {
33
+ if (existsSync(join(dir, 'node_modules'))) {
34
+ return dir;
35
+ }
36
+ dir = dirname(dir);
37
+ }
38
+ return process.cwd();
39
+ }
40
+
20
41
  function installSkills() {
21
42
  if (!existsSync(skillsSource)) return;
22
43
 
23
44
  const skillFiles = readdirSync(skillsSource).filter(f => f.endsWith('.md')).sort();
24
45
  if (skillFiles.length === 0) return;
25
46
 
26
- // Claude Code: individual skill files
27
- const claudeDir = join(homedir(), '.claude', 'skills', 'ax-crew');
47
+ const projectRoot = findProjectRoot();
48
+
49
+ // Claude Code: individual skill files in project dir
50
+ const claudeDir = join(projectRoot, '.claude', 'skills', 'ax-crew');
28
51
  try {
29
52
  mkdirSync(claudeDir, { recursive: true });
30
53
  for (const file of skillFiles) {
@@ -35,8 +58,8 @@ function installSkills() {
35
58
  // Silently skip
36
59
  }
37
60
 
38
- // Codex: single SKILL.md combining all skills
39
- const codexDir = join(homedir(), '.agents', 'skills', 'ax-crew');
61
+ // Codex: single SKILL.md combining all skills in project dir
62
+ const codexDir = join(projectRoot, '.agents', 'skills', 'ax-crew');
40
63
  try {
41
64
  mkdirSync(codexDir, { recursive: true });
42
65
 
@@ -44,7 +67,6 @@ function installSkills() {
44
67
 
45
68
  for (const file of skillFiles) {
46
69
  const content = readFileSync(join(skillsSource, file), 'utf-8');
47
- // Strip individual frontmatter, keep the body
48
70
  const body = content.replace(/^---\n[\s\S]*?\n---\n/, '');
49
71
  combined += body.trim() + '\n\n---\n\n';
50
72
  }
@@ -1,16 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * Preuninstall script: removes ax-crew skill files from Claude Code and Codex directories.
4
+ * Preuninstall script: removes ax-crew skill files from the project directory.
5
5
  */
6
6
 
7
7
  import { existsSync, rmSync } from 'fs';
8
8
  import { join } from 'path';
9
- import { homedir } from 'os';
9
+
10
+ const projectRoot = process.env.INIT_CWD || process.cwd();
10
11
 
11
12
  const targets = [
12
- join(homedir(), '.claude', 'skills', 'ax-crew'),
13
- join(homedir(), '.agents', 'skills', 'ax-crew'),
13
+ join(projectRoot, '.claude', 'skills', 'ax-crew'),
14
+ join(projectRoot, '.agents', 'skills', 'ax-crew'),
14
15
  ];
15
16
 
16
17
  for (const dir of targets) {