@nahisaho/katashiro 2.0.4 → 2.0.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.
Files changed (2) hide show
  1. package/package.json +15 -15
  2. package/scripts/postinstall.js +37 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nahisaho/katashiro",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "KATASHIRO - VS Code Agent Mode向け情報収集・分析・生成システム(オールインワンパッケージ)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -108,20 +108,20 @@
108
108
  "url": "https://github.com/nahisaho/katashiro/issues"
109
109
  },
110
110
  "dependencies": {
111
- "@nahisaho/katashiro-analyzer": "^2.0.3",
112
- "@nahisaho/katashiro-collector": "^2.0.3",
113
- "@nahisaho/katashiro-core": "^2.0.3",
114
- "@nahisaho/katashiro-evaluation": "^2.0.3",
115
- "@nahisaho/katashiro-feedback": "^2.0.3",
116
- "@nahisaho/katashiro-generator": "^2.0.3",
117
- "@nahisaho/katashiro-knowledge": "^2.0.3",
118
- "@nahisaho/katashiro-llm": "^2.0.3",
119
- "@nahisaho/katashiro-observability": "^2.0.3",
120
- "@nahisaho/katashiro-orchestrator": "^2.0.3",
121
- "@nahisaho/katashiro-rag": "^2.0.3",
122
- "@nahisaho/katashiro-sandbox": "^2.0.3",
123
- "@nahisaho/katashiro-security": "^2.0.3",
124
- "@nahisaho/katashiro-workspace": "^2.0.3",
111
+ "@nahisaho/katashiro-analyzer": "^2.0.4",
112
+ "@nahisaho/katashiro-collector": "^2.0.4",
113
+ "@nahisaho/katashiro-core": "^2.0.4",
114
+ "@nahisaho/katashiro-evaluation": "^2.0.4",
115
+ "@nahisaho/katashiro-feedback": "^2.0.4",
116
+ "@nahisaho/katashiro-generator": "^2.0.4",
117
+ "@nahisaho/katashiro-knowledge": "^2.0.4",
118
+ "@nahisaho/katashiro-llm": "^2.0.4",
119
+ "@nahisaho/katashiro-observability": "^2.0.4",
120
+ "@nahisaho/katashiro-orchestrator": "^2.0.4",
121
+ "@nahisaho/katashiro-rag": "^2.0.4",
122
+ "@nahisaho/katashiro-sandbox": "^2.0.4",
123
+ "@nahisaho/katashiro-security": "^2.0.4",
124
+ "@nahisaho/katashiro-workspace": "^2.0.4",
125
125
  "commander": "^12.1.0"
126
126
  },
127
127
  "engines": {
@@ -14,8 +14,25 @@ const __dirname = dirname(__filename);
14
14
  // パッケージのルートディレクトリ
15
15
  const packageRoot = resolve(__dirname, '..');
16
16
 
17
- // インストール先のプロジェクトルート(node_modulesの2つ上)
18
- const projectRoot = resolve(packageRoot, '..', '..', '..');
17
+ /**
18
+ * プロジェクトルートを検出
19
+ * - node_modules/@nahisaho/katashiro から3階層上がプロジェクトルート
20
+ * - node_modules/katashiro から2階層上がプロジェクトルート(CLIの場合)
21
+ */
22
+ function findProjectRoot() {
23
+ // node_modules内にインストールされているか確認
24
+ if (packageRoot.includes('node_modules/@nahisaho/katashiro')) {
25
+ // @nahisaho/katashiro の場合: node_modules/@nahisaho/katashiro -> 3階層上
26
+ return resolve(packageRoot, '..', '..', '..');
27
+ } else if (packageRoot.includes('node_modules')) {
28
+ // その他のnode_modules内の場合: 2階層上
29
+ return resolve(packageRoot, '..', '..');
30
+ }
31
+ // 開発環境(node_modules外)
32
+ return null;
33
+ }
34
+
35
+ const projectRoot = findProjectRoot();
19
36
 
20
37
  // コピーするファイル/ディレクトリ
21
38
  const filesToCopy = [
@@ -26,6 +43,14 @@ const filesToCopy = [
26
43
 
27
44
  async function copyFile(src, dest) {
28
45
  try {
46
+ // ソースファイルが存在するか確認
47
+ try {
48
+ await fs.access(src);
49
+ } catch {
50
+ console.error(` [error] Source not found: ${src}`);
51
+ return;
52
+ }
53
+
29
54
  // ディレクトリが存在しない場合は作成
30
55
  const destDir = dirname(dest);
31
56
  await fs.mkdir(destDir, { recursive: true });
@@ -44,18 +69,19 @@ async function copyFile(src, dest) {
44
69
  }
45
70
 
46
71
  async function main() {
47
- // npm install が実行されているか確認(CI環境やパッケージ開発時はスキップ)
48
- const isNpmInstall = process.env.npm_lifecycle_event === 'postinstall';
72
+ // CI環境ではスキップ
49
73
  const isCi = process.env.CI === 'true';
74
+ if (isCi) {
75
+ return;
76
+ }
50
77
 
51
- // パッケージ自体の開発時はスキップ
52
- const isPackageDev = projectRoot.includes('packages/katashiro');
53
-
54
- if (!isNpmInstall || isCi || isPackageDev) {
78
+ // プロジェクトルートが検出できない場合(開発環境)はスキップ
79
+ if (!projectRoot) {
80
+ console.log('📦 KATASHIRO: Skipping postinstall (development mode)');
55
81
  return;
56
82
  }
57
83
 
58
- console.log('\n📦 KATASHIRO: Setting up agent configuration files...\n');
84
+ console.log('📦 KATASHIRO: Setting up agent configuration files...');
59
85
 
60
86
  for (const file of filesToCopy) {
61
87
  const src = join(packageRoot, file);
@@ -63,10 +89,10 @@ async function main() {
63
89
  await copyFile(src, dest);
64
90
  }
65
91
 
66
- console.log('\n✅ KATASHIRO setup complete!\n');
92
+ console.log('✅ KATASHIRO setup complete!');
67
93
  console.log(' - AGENTS.md: AI agent instructions');
68
94
  console.log(' - CLAUDE.md: Claude-specific guide');
69
- console.log(' - .github/copilot-skills.json: VS Code Copilot skills\n');
95
+ console.log(' - .github/copilot-skills.json: VS Code Copilot skills');
70
96
  }
71
97
 
72
98
  main().catch(console.error);