create-agentic-dev-env 0.2.7 → 1.0.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/bin/create.js +2 -0
- package/lib/runner.js +16 -15
- package/package.json +1 -1
- package/template/package.json +1 -1
package/bin/create.js
CHANGED
|
@@ -36,6 +36,8 @@ if (selfRepo && selfRepo.includes('FILL_ME')) selfRepo = null
|
|
|
36
36
|
const destPkgPath = path.join(dest, 'package.json')
|
|
37
37
|
const destPkg = JSON.parse(fs.readFileSync(destPkgPath, 'utf8'))
|
|
38
38
|
destPkg.ade.upstream = selfRepo ? selfRepo.replace(/^git\+/, '') : null
|
|
39
|
+
// 鎖精確版本:ADE repo 建立後即與上游迭代解耦,升級是 ADE repo 內顯式改版號的決定
|
|
40
|
+
destPkg.dependencies['create-agentic-dev-env'] = require('../package.json').version
|
|
39
41
|
fs.writeFileSync(destPkgPath, JSON.stringify(destPkg, null, 2) + '\n')
|
|
40
42
|
|
|
41
43
|
execSync('git init', { cwd: dest, stdio: 'inherit' })
|
package/lib/runner.js
CHANGED
|
@@ -60,7 +60,21 @@ function removeManaged(cwd) {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
function install(cwd, srcDir, wsOverride) {
|
|
63
|
-
//
|
|
63
|
+
// 先驗證再動手:解析不到 source 就整個不裝——目錄保持乾淨,init 可重跑
|
|
64
|
+
const prevPath = path.join(cwd, '.ade.json')
|
|
65
|
+
const prev = fs.existsSync(prevPath) ? JSON.parse(fs.readFileSync(prevPath, 'utf8')) : {}
|
|
66
|
+
let source = null
|
|
67
|
+
try {
|
|
68
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(srcDir, 'package.json'), 'utf8'))
|
|
69
|
+
source = typeof pkg.repository === 'string' ? pkg.repository : (pkg.repository || {}).url || null
|
|
70
|
+
if (source) source = source.replace(/^git\+/, '')
|
|
71
|
+
if (source && source.includes('FILL_ME')) source = null
|
|
72
|
+
} catch {}
|
|
73
|
+
if (!source && !prev.source) {
|
|
74
|
+
throw new Error('repository.url is not set in the ADE repo package.json; update would not work — fill it in and retry')
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// update 只清理 ade- 前綴,非前綴 skill 裝了就清不掉
|
|
64
78
|
const srcSkills = path.join(srcDir, 'skills')
|
|
65
79
|
const skillDirs = fs.existsSync(srcSkills)
|
|
66
80
|
? fs.readdirSync(srcSkills).filter((d) => fs.statSync(path.join(srcSkills, d)).isDirectory())
|
|
@@ -92,9 +106,6 @@ function install(cwd, srcDir, wsOverride) {
|
|
|
92
106
|
}
|
|
93
107
|
fs.writeFileSync(claudePath, md)
|
|
94
108
|
|
|
95
|
-
const prevPath = path.join(cwd, '.ade.json')
|
|
96
|
-
const prev = fs.existsSync(prevPath) ? JSON.parse(fs.readFileSync(prevPath, 'utf8')) : {}
|
|
97
|
-
|
|
98
109
|
// 作業區固定叫 workspaces/;指定既有 repo 存放資料夾時(--workspaces 或 .ade.json 的
|
|
99
110
|
// workspaces),workspaces 建成指向它的 symlink,cd workspaces 即達、已下載的 repo 直接沿用
|
|
100
111
|
const ws = wsOverride || prev.workspaces || null
|
|
@@ -115,13 +126,6 @@ function install(cwd, srcDir, wsOverride) {
|
|
|
115
126
|
if (!gi.split('\n').some((l) => l.trim() === 'workspaces')) {
|
|
116
127
|
fs.writeFileSync(giPath, (gi ? gi.trimEnd() + '\n' : '') + 'workspaces\n')
|
|
117
128
|
}
|
|
118
|
-
let source = null
|
|
119
|
-
try {
|
|
120
|
-
const pkg = JSON.parse(fs.readFileSync(path.join(srcDir, 'package.json'), 'utf8'))
|
|
121
|
-
source = typeof pkg.repository === 'string' ? pkg.repository : (pkg.repository || {}).url || null
|
|
122
|
-
if (source) source = source.replace(/^git\+/, '')
|
|
123
|
-
if (source && source.includes('FILL_ME')) source = null
|
|
124
|
-
} catch {}
|
|
125
129
|
let commit = null
|
|
126
130
|
try {
|
|
127
131
|
commit = execSync('git rev-parse HEAD', { cwd: srcDir, stdio: ['ignore', 'pipe', 'ignore'] })
|
|
@@ -130,11 +134,8 @@ function install(cwd, srcDir, wsOverride) {
|
|
|
130
134
|
} catch {}
|
|
131
135
|
fs.writeFileSync(
|
|
132
136
|
prevPath,
|
|
133
|
-
JSON.stringify({ source: source || prev.source
|
|
137
|
+
JSON.stringify({ source: source || prev.source, commit, workspaces: ws }, null, 2) + '\n'
|
|
134
138
|
)
|
|
135
|
-
if (!source && !prev.source) {
|
|
136
|
-
console.warn('Warning: repository.url is not set in the ADE repo package.json; update will not work — set source in .ade.json manually')
|
|
137
|
-
}
|
|
138
139
|
}
|
|
139
140
|
|
|
140
141
|
module.exports = { run, init, update }
|
package/package.json
CHANGED