@nahisaho/katashiro 0.1.2 → 0.1.3
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/package.json +4 -2
- package/scripts/postinstall.js +72 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nahisaho/katashiro",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "KATASHIRO - VS Code Agent Mode向け情報収集・分析・生成システム(オールインワンパッケージ)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"files": [
|
|
9
9
|
"dist",
|
|
10
10
|
"src",
|
|
11
|
+
"scripts",
|
|
11
12
|
".github",
|
|
12
13
|
"AGENTS.md",
|
|
13
14
|
"CLAUDE.md"
|
|
@@ -44,7 +45,8 @@
|
|
|
44
45
|
},
|
|
45
46
|
"scripts": {
|
|
46
47
|
"build": "tsc",
|
|
47
|
-
"test": "echo \"No tests for meta package\""
|
|
48
|
+
"test": "echo \"No tests for meta package\"",
|
|
49
|
+
"postinstall": "node scripts/postinstall.js"
|
|
48
50
|
},
|
|
49
51
|
"keywords": [
|
|
50
52
|
"katashiro",
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* postinstall script - AGENTS.md, CLAUDE.md, .github をプロジェクトルートにコピー
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { promises as fs } from 'fs';
|
|
8
|
+
import { dirname, join, resolve } from 'path';
|
|
9
|
+
import { fileURLToPath } from 'url';
|
|
10
|
+
|
|
11
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
+
const __dirname = dirname(__filename);
|
|
13
|
+
|
|
14
|
+
// パッケージのルートディレクトリ
|
|
15
|
+
const packageRoot = resolve(__dirname, '..');
|
|
16
|
+
|
|
17
|
+
// インストール先のプロジェクトルート(node_modulesの2つ上)
|
|
18
|
+
const projectRoot = resolve(packageRoot, '..', '..', '..');
|
|
19
|
+
|
|
20
|
+
// コピーするファイル/ディレクトリ
|
|
21
|
+
const filesToCopy = [
|
|
22
|
+
'AGENTS.md',
|
|
23
|
+
'CLAUDE.md',
|
|
24
|
+
'.github/copilot-skills.json',
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
async function copyFile(src, dest) {
|
|
28
|
+
try {
|
|
29
|
+
// ディレクトリが存在しない場合は作成
|
|
30
|
+
const destDir = dirname(dest);
|
|
31
|
+
await fs.mkdir(destDir, { recursive: true });
|
|
32
|
+
|
|
33
|
+
// ファイルが存在しない場合のみコピー(既存ファイルは上書きしない)
|
|
34
|
+
try {
|
|
35
|
+
await fs.access(dest);
|
|
36
|
+
console.log(` [skip] ${dest} already exists`);
|
|
37
|
+
} catch {
|
|
38
|
+
await fs.copyFile(src, dest);
|
|
39
|
+
console.log(` [copy] ${dest}`);
|
|
40
|
+
}
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.error(` [error] Failed to copy ${src}: ${error.message}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function main() {
|
|
47
|
+
// npm install が実行されているか確認(CI環境やパッケージ開発時はスキップ)
|
|
48
|
+
const isNpmInstall = process.env.npm_lifecycle_event === 'postinstall';
|
|
49
|
+
const isCi = process.env.CI === 'true';
|
|
50
|
+
|
|
51
|
+
// パッケージ自体の開発時はスキップ
|
|
52
|
+
const isPackageDev = projectRoot.includes('packages/katashiro');
|
|
53
|
+
|
|
54
|
+
if (!isNpmInstall || isCi || isPackageDev) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
console.log('\n📦 KATASHIRO: Setting up agent configuration files...\n');
|
|
59
|
+
|
|
60
|
+
for (const file of filesToCopy) {
|
|
61
|
+
const src = join(packageRoot, file);
|
|
62
|
+
const dest = join(projectRoot, file);
|
|
63
|
+
await copyFile(src, dest);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
console.log('\n✅ KATASHIRO setup complete!\n');
|
|
67
|
+
console.log(' - AGENTS.md: AI agent instructions');
|
|
68
|
+
console.log(' - CLAUDE.md: Claude-specific guide');
|
|
69
|
+
console.log(' - .github/copilot-skills.json: VS Code Copilot skills\n');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
main().catch(console.error);
|