@for-yeyu/evm-dapp-skills 0.1.0 → 0.2.0

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/README.md CHANGED
@@ -8,9 +8,18 @@ Standard skills package for the EVM DApp layered architecture.
8
8
  npm i @for-yeyu/evm-dapp-skills
9
9
  ```
10
10
 
11
- ## Use In Your Project
11
+ After installation, skills are automatically synced to:
12
12
 
13
- Copy skills into your local agent skills directory:
13
+ - `<your project>/.agents/skills` (preferred, via `INIT_CWD`)
14
+ - fallback: `~/.agents/skills`
15
+
16
+ ## Disable Auto Sync (Optional)
17
+
18
+ ```bash
19
+ SKILLS_AUTO_INSTALL=0 npm i @for-yeyu/evm-dapp-skills
20
+ ```
21
+
22
+ ## Manual Sync (Optional)
14
23
 
15
24
  ```bash
16
25
  rsync -a node_modules/@for-yeyu/evm-dapp-skills/skills/ .agents/skills/
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@for-yeyu/evm-dapp-skills",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Standard AI coding skills for the EVM DApp layered architecture.",
5
5
  "license": "MIT",
6
6
  "private": false,
7
+ "scripts": {
8
+ "postinstall": "node scripts/postinstall.mjs"
9
+ },
7
10
  "files": [
8
- "skills/**"
11
+ "skills/**",
12
+ "scripts/postinstall.mjs"
9
13
  ],
10
14
  "keywords": [
11
15
  "skills",
@@ -0,0 +1,31 @@
1
+ import { cp, mkdir, readdir } from 'node:fs/promises'
2
+ import os from 'node:os'
3
+ import path from 'node:path'
4
+ import process from 'node:process'
5
+
6
+ const disable = (process.env.SKILLS_AUTO_INSTALL ?? '').toLowerCase()
7
+ if (disable === '0' || disable === 'false' || disable === 'off') {
8
+ process.exit(0)
9
+ }
10
+
11
+ const packageRoot = process.cwd()
12
+ const sourceSkillsDir = path.join(packageRoot, 'skills')
13
+
14
+ const installRoot =
15
+ process.env.INIT_CWD && process.env.INIT_CWD !== ''
16
+ ? process.env.INIT_CWD
17
+ : os.homedir()
18
+
19
+ const targetSkillsDir = path.join(installRoot, '.agents', 'skills')
20
+
21
+ await mkdir(targetSkillsDir, { recursive: true })
22
+
23
+ const entries = await readdir(sourceSkillsDir)
24
+ await Promise.all(
25
+ entries.map(entry =>
26
+ cp(path.join(sourceSkillsDir, entry), path.join(targetSkillsDir, entry), {
27
+ recursive: true,
28
+ force: true,
29
+ }),
30
+ ),
31
+ )