dev-booster 1.1.0 → 1.1.1
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 +1 -1
- package/src/index.js +15 -22
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -11,6 +11,12 @@ const TEMPLATE_DIR = path.resolve(__dirname, '..', 'template')
|
|
|
11
11
|
// Destination: the user's current working directory (where they ran npx)
|
|
12
12
|
const TARGET_DIR = process.cwd()
|
|
13
13
|
const args = process.argv.slice(2)
|
|
14
|
+
const GITIGNORE_BLOCK = [
|
|
15
|
+
'# DEV-BOOSTER',
|
|
16
|
+
'.devbooster/',
|
|
17
|
+
'DEVBOOSTER_INIT.md',
|
|
18
|
+
]
|
|
19
|
+
const GITIGNORE_MARKER = '# DEV-BOOSTER'
|
|
14
20
|
const IDE_BRIDGE_BLOCK = [
|
|
15
21
|
'# 🤖 DEV BOOSTER — AGENTIC KIT BOOTSTRAP',
|
|
16
22
|
'',
|
|
@@ -70,16 +76,16 @@ function ensureTrailingNewline(content) {
|
|
|
70
76
|
return content.endsWith('\n') ? content : `${content}\n`
|
|
71
77
|
}
|
|
72
78
|
|
|
73
|
-
function
|
|
79
|
+
function appendUniqueBlock(filePath, blockLines, marker) {
|
|
74
80
|
const existing = fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : ''
|
|
75
|
-
|
|
76
|
-
const missingLines = lines.filter((line) => !existing.includes(line))
|
|
77
|
-
|
|
78
|
-
if (missingLines.length === 0) {
|
|
81
|
+
if (existing.includes(marker)) {
|
|
79
82
|
return false
|
|
80
83
|
}
|
|
81
84
|
|
|
82
|
-
const
|
|
85
|
+
const trimmedEnd = existing.replace(/\s*$/, '')
|
|
86
|
+
const prefix = trimmedEnd.length > 0 ? `${trimmedEnd}\n\n` : ''
|
|
87
|
+
const nextContent = `${prefix}${blockLines.join('\n')}\n`
|
|
88
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true })
|
|
83
89
|
fs.writeFileSync(filePath, nextContent)
|
|
84
90
|
return true
|
|
85
91
|
}
|
|
@@ -117,29 +123,16 @@ async function maybeAddDevBoosterToGitignore() {
|
|
|
117
123
|
}
|
|
118
124
|
|
|
119
125
|
const gitignorePath = path.join(TARGET_DIR, '.gitignore')
|
|
120
|
-
const changed =
|
|
126
|
+
const changed = appendUniqueBlock(gitignorePath, GITIGNORE_BLOCK, GITIGNORE_MARKER)
|
|
121
127
|
|
|
122
128
|
console.log('▸ .gitignore')
|
|
123
129
|
if (changed) {
|
|
124
130
|
console.log(' status: updated')
|
|
125
|
-
console.log(' entries: .devbooster/, DEVBOOSTER_INIT.md\n')
|
|
131
|
+
console.log(' entries: # DEV-BOOSTER, .devbooster/, DEVBOOSTER_INIT.md\n')
|
|
126
132
|
} else {
|
|
127
133
|
console.log(' status: already configured')
|
|
128
|
-
console.log(' entries: .devbooster/, DEVBOOSTER_INIT.md\n')
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function appendUniqueBlock(filePath, blockLines, marker) {
|
|
133
|
-
const existing = fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : ''
|
|
134
|
-
if (existing.includes(marker)) {
|
|
135
|
-
return false
|
|
134
|
+
console.log(' entries: # DEV-BOOSTER, .devbooster/, DEVBOOSTER_INIT.md\n')
|
|
136
135
|
}
|
|
137
|
-
|
|
138
|
-
const normalized = ensureTrailingNewline(existing)
|
|
139
|
-
const nextContent = `${normalized}${blockLines.join('\n')}\n`
|
|
140
|
-
fs.mkdirSync(path.dirname(filePath), { recursive: true })
|
|
141
|
-
fs.writeFileSync(filePath, nextContent)
|
|
142
|
-
return true
|
|
143
136
|
}
|
|
144
137
|
|
|
145
138
|
function writeIdeBridgeFallbackFlag() {
|