@baseline-studio/cli 2.6.0 → 2.6.2
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/dist/commands/init.js +45 -21
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -102,30 +102,40 @@ async function init() {
|
|
|
102
102
|
}
|
|
103
103
|
// 5. Collect unique context file paths from manifests
|
|
104
104
|
const contextFiles = collectContextPaths(tmpDir);
|
|
105
|
-
// 6. Load
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
// 6. Load prompts
|
|
106
|
+
// init-prompts.yaml has the slim essential questions for onboarding
|
|
107
|
+
// context-prompts.yaml has the full question set (used for template titles + fallback)
|
|
108
|
+
const initPromptsPath = (0, path_1.join)(tmpDir, "init-prompts.yaml");
|
|
109
|
+
const fullPromptsPath = (0, path_1.join)(tmpDir, "context-prompts.yaml");
|
|
110
|
+
let initPrompts = {};
|
|
111
|
+
let fullPrompts = {};
|
|
112
|
+
if ((0, fs_1.existsSync)(fullPromptsPath)) {
|
|
113
|
+
fullPrompts = (0, js_yaml_1.load)((0, fs_1.readFileSync)(fullPromptsPath, "utf-8"));
|
|
110
114
|
}
|
|
111
|
-
|
|
115
|
+
if ((0, fs_1.existsSync)(initPromptsPath)) {
|
|
116
|
+
initPrompts = (0, js_yaml_1.load)((0, fs_1.readFileSync)(initPromptsPath, "utf-8"));
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
// Fallback: if init-prompts.yaml doesn't exist (older tag), use core
|
|
120
|
+
// sections from the full prompts so init never skips questions entirely
|
|
121
|
+
for (const [key, val] of Object.entries(fullPrompts)) {
|
|
122
|
+
if (key.startsWith("core/")) {
|
|
123
|
+
initPrompts[key] = val;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// 7. Ask essential questions (slim init)
|
|
112
128
|
console.log();
|
|
113
|
-
ui.info("Let's set up your context
|
|
129
|
+
ui.info("Let's set up your core context — the essential info that powers every skill.");
|
|
114
130
|
ui.skipHint();
|
|
115
|
-
|
|
116
|
-
const promptSections = contextFiles.filter((f) => prompts[f]);
|
|
131
|
+
const initSections = Object.keys(initPrompts);
|
|
117
132
|
let sectionIndex = 0;
|
|
118
|
-
for (const ctxFile of
|
|
119
|
-
const prompt =
|
|
120
|
-
if (!prompt)
|
|
121
|
-
// Create empty template for files without prompts
|
|
122
|
-
const fullPath = (0, path_1.join)(destDir, "context", ctxFile);
|
|
123
|
-
(0, fs_1.mkdirSync)((0, path_1.dirname)(fullPath), { recursive: true });
|
|
124
|
-
(0, fs_1.writeFileSync)(fullPath, `# ${ctxFile}\n\n<!-- Add your content here -->\n`);
|
|
133
|
+
for (const ctxFile of initSections) {
|
|
134
|
+
const prompt = initPrompts[ctxFile];
|
|
135
|
+
if (!prompt)
|
|
125
136
|
continue;
|
|
126
|
-
}
|
|
127
137
|
sectionIndex++;
|
|
128
|
-
ui.sectionHeader(prompt.title, sectionIndex,
|
|
138
|
+
ui.sectionHeader(prompt.title, sectionIndex, initSections.length);
|
|
129
139
|
const answers = [];
|
|
130
140
|
let answeredCount = 0;
|
|
131
141
|
// Pre-fill company name into identity file
|
|
@@ -151,7 +161,18 @@ async function init() {
|
|
|
151
161
|
}
|
|
152
162
|
ui.sectionComplete(prompt.title, answeredCount, prompt.questions.length);
|
|
153
163
|
}
|
|
154
|
-
// 8. Create context
|
|
164
|
+
// 8. Create empty templates for all remaining context files
|
|
165
|
+
for (const ctxFile of contextFiles) {
|
|
166
|
+
if (initPrompts[ctxFile])
|
|
167
|
+
continue; // Already handled above
|
|
168
|
+
const fullPath = (0, path_1.join)(destDir, "context", ctxFile);
|
|
169
|
+
if ((0, fs_1.existsSync)(fullPath))
|
|
170
|
+
continue; // Don't overwrite
|
|
171
|
+
(0, fs_1.mkdirSync)((0, path_1.dirname)(fullPath), { recursive: true });
|
|
172
|
+
const title = fullPrompts[ctxFile]?.title || ctxFile;
|
|
173
|
+
(0, fs_1.writeFileSync)(fullPath, `# ${title}\n\n<!-- Add your content here -->\n`);
|
|
174
|
+
}
|
|
175
|
+
// 9. Create context.yaml
|
|
155
176
|
const contextYaml = buildContextYaml(tmpDir, contextFiles);
|
|
156
177
|
(0, fs_1.writeFileSync)((0, path_1.join)(destDir, "context", "context.yaml"), contextYaml);
|
|
157
178
|
// 9. Create baseline.config.json
|
|
@@ -219,9 +240,12 @@ async function init() {
|
|
|
219
240
|
["Scripts:", `${scriptCount}`],
|
|
220
241
|
]);
|
|
221
242
|
ui.nextSteps([
|
|
222
|
-
`
|
|
223
|
-
`
|
|
243
|
+
`Open ${ui.accent("context/core/")} and review your identity & voice files`,
|
|
244
|
+
`Fill in extended context files — start with ${ui.accent("product")}, ${ui.accent("users")}, ${ui.accent("icp")}`,
|
|
245
|
+
`Run ${ui.accent("npx baseline context")} to update context with guided prompts`,
|
|
246
|
+
`Open this folder in your AI tool and start using skills`,
|
|
224
247
|
]);
|
|
248
|
+
console.log();
|
|
225
249
|
}
|
|
226
250
|
/** Scan all skill manifests and return unique context file paths (relative to context/) */
|
|
227
251
|
function collectContextPaths(coreDir) {
|