create-agentic-dev-env 0.2.3 → 0.2.4
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/create.js +9 -7
- package/lib/runner.js +9 -9
- package/package.json +1 -1
package/bin/create.js
CHANGED
|
@@ -3,14 +3,16 @@ const fs = require('fs')
|
|
|
3
3
|
const path = require('path')
|
|
4
4
|
const { execSync } = require('child_process')
|
|
5
5
|
|
|
6
|
+
console.log(`create-agentic-dev-env v${require('../package.json').version}`)
|
|
7
|
+
|
|
6
8
|
const name = process.argv[2]
|
|
7
9
|
if (!name || !/^[a-z0-9][a-z0-9._-]*$/i.test(name)) {
|
|
8
|
-
console.error('
|
|
10
|
+
console.error('Usage: create-agentic-dev-env <repo-name>')
|
|
9
11
|
process.exit(1)
|
|
10
12
|
}
|
|
11
13
|
const dest = path.resolve(name)
|
|
12
14
|
if (fs.existsSync(dest)) {
|
|
13
|
-
console.error(`${name}
|
|
15
|
+
console.error(`${name} already exists`)
|
|
14
16
|
process.exit(1)
|
|
15
17
|
}
|
|
16
18
|
|
|
@@ -37,10 +39,10 @@ fs.writeFileSync(destPkgPath, JSON.stringify(destPkg, null, 2) + '\n')
|
|
|
37
39
|
execSync('git init', { cwd: dest, stdio: 'inherit' })
|
|
38
40
|
|
|
39
41
|
console.log(`
|
|
40
|
-
|
|
42
|
+
Created ADE repo: ${name}/
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
1.
|
|
44
|
-
2.
|
|
45
|
-
3.
|
|
44
|
+
Next steps:
|
|
45
|
+
1. Set repository.url in ${name}/package.json
|
|
46
|
+
2. Start filling knowledge/ (service format: knowledge/services/_template.yaml)
|
|
47
|
+
3. After pushing, team members run: pnpm dlx "git+ssh://git@github.com/ORG/${name}.git" init
|
|
46
48
|
`)
|
package/lib/runner.js
CHANGED
|
@@ -11,7 +11,7 @@ function run(cmd, pkgDir) {
|
|
|
11
11
|
if (cmd === 'init') init(process.cwd(), pkgDir)
|
|
12
12
|
else if (cmd === 'update') update(process.cwd())
|
|
13
13
|
else {
|
|
14
|
-
console.error('
|
|
14
|
+
console.error('Usage: init | update')
|
|
15
15
|
process.exit(1)
|
|
16
16
|
}
|
|
17
17
|
} catch (e) {
|
|
@@ -22,17 +22,17 @@ function run(cmd, pkgDir) {
|
|
|
22
22
|
|
|
23
23
|
function init(cwd, srcDir) {
|
|
24
24
|
if (fs.existsSync(path.join(cwd, '.ade.json'))) {
|
|
25
|
-
throw new Error('
|
|
25
|
+
throw new Error('Already initialized here; run update instead')
|
|
26
26
|
}
|
|
27
27
|
install(cwd, srcDir)
|
|
28
|
-
console.log('ADE init
|
|
28
|
+
console.log('ADE init done')
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
function update(cwd) {
|
|
32
32
|
const cfgPath = path.join(cwd, '.ade.json')
|
|
33
|
-
if (!fs.existsSync(cfgPath)) throw new Error('
|
|
33
|
+
if (!fs.existsSync(cfgPath)) throw new Error('Not initialized here; run init first')
|
|
34
34
|
const cfg = JSON.parse(fs.readFileSync(cfgPath, 'utf8'))
|
|
35
|
-
if (!cfg.source) throw new Error('.ade.json
|
|
35
|
+
if (!cfg.source) throw new Error('.ade.json is missing source (the ADE repo git url); add it and retry')
|
|
36
36
|
|
|
37
37
|
// pnpm dlx 有快取(預設 ~24h),cli.js 所在的套件目錄可能是舊版內容;
|
|
38
38
|
// update 的任務是拿最新知識,因此一律無視 pkgDir、自行 clone source
|
|
@@ -44,7 +44,7 @@ function update(cwd) {
|
|
|
44
44
|
} finally {
|
|
45
45
|
fs.rmSync(tmp, { recursive: true, force: true })
|
|
46
46
|
}
|
|
47
|
-
console.log('ADE update
|
|
47
|
+
console.log('ADE update done')
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
function removeManaged(cwd) {
|
|
@@ -65,7 +65,7 @@ function install(cwd, srcDir) {
|
|
|
65
65
|
: []
|
|
66
66
|
for (const d of skillDirs) {
|
|
67
67
|
if (!d.startsWith('ade-')) {
|
|
68
|
-
throw new Error(`skills/${d}: ADE repo
|
|
68
|
+
throw new Error(`skills/${d}: skill directories in an ADE repo must be prefixed with ade- (update only manages this prefix)`)
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -82,7 +82,7 @@ function install(cwd, srcDir) {
|
|
|
82
82
|
const e = md.indexOf(END)
|
|
83
83
|
if (b !== -1 || e !== -1) {
|
|
84
84
|
if (b === -1 || e === -1 || e < b) {
|
|
85
|
-
throw new Error('CLAUDE.md
|
|
85
|
+
throw new Error('ADE markers in CLAUDE.md are corrupted (unpaired or reversed BEGIN/END); fix them manually and retry')
|
|
86
86
|
}
|
|
87
87
|
md = md.slice(0, b) + block + md.slice(e + END.length)
|
|
88
88
|
} else {
|
|
@@ -117,7 +117,7 @@ function install(cwd, srcDir) {
|
|
|
117
117
|
JSON.stringify({ source: source || prev.source || null, commit }, null, 2) + '\n'
|
|
118
118
|
)
|
|
119
119
|
if (!source && !prev.source) {
|
|
120
|
-
console.warn('
|
|
120
|
+
console.warn('Warning: repository.url is not set in the ADE repo package.json; update will not work — set source in .ade.json manually')
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
|