@lumerahq/cli 0.19.22 → 0.19.23
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/index.js
CHANGED
|
@@ -248,7 +248,7 @@ async function main() {
|
|
|
248
248
|
break;
|
|
249
249
|
// Project
|
|
250
250
|
case "init":
|
|
251
|
-
await import("./init-
|
|
251
|
+
await import("./init-FTDMPFR3.js").then((m) => m.init(args.slice(1)));
|
|
252
252
|
break;
|
|
253
253
|
case "register":
|
|
254
254
|
await import("./register-BQCVUPWS.js").then((m) => m.register(args.slice(1)));
|
|
@@ -27,7 +27,7 @@ import pc from "picocolors";
|
|
|
27
27
|
import prompts from "prompts";
|
|
28
28
|
import { execSync } from "child_process";
|
|
29
29
|
import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync, rmSync, readlinkSync, symlinkSync } from "fs";
|
|
30
|
-
import { join, resolve } from "path";
|
|
30
|
+
import { dirname, join, resolve } from "path";
|
|
31
31
|
function toTitleCase(str) {
|
|
32
32
|
return str.split(/[-_]/).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
33
33
|
}
|
|
@@ -43,6 +43,84 @@ function processTemplate(content, replacements) {
|
|
|
43
43
|
var TEMPLATE_EXCLUDE = /* @__PURE__ */ new Set(["template.json"]);
|
|
44
44
|
var TEMPLATE_RENAMES = /* @__PURE__ */ new Map([["_gitignore", ".gitignore"]]);
|
|
45
45
|
var TEMPLATE_RAW_COPY = /* @__PURE__ */ new Set(["pnpm-lock.yaml"]);
|
|
46
|
+
var STUDIO_PROBLEM_FIRST_FLAG = "studio_problem_first";
|
|
47
|
+
var MEMORY_AGENTS_SECTION = `## Project Memory
|
|
48
|
+
|
|
49
|
+
This project may use repo-backed memory in \`memory/\`.
|
|
50
|
+
|
|
51
|
+
Before substantial work, read \`memory/README.md\` if it exists, then any
|
|
52
|
+
relevant memory files.
|
|
53
|
+
|
|
54
|
+
Update memory when the user confirms a durable project decision, workflow
|
|
55
|
+
rule, data contract, naming convention, recurring assumption, or correction
|
|
56
|
+
that should survive future sessions.
|
|
57
|
+
|
|
58
|
+
Do not store secrets, credentials, tokens, private keys, or raw sensitive
|
|
59
|
+
source files in memory.
|
|
60
|
+
|
|
61
|
+
If a memory item affects app behavior, do not rely only on repo memory.
|
|
62
|
+
Persist it to the app's runtime source of truth, such as collections or config,
|
|
63
|
+
and expose it in the app UI or a clear review/edit path.
|
|
64
|
+
|
|
65
|
+
Summarize memory updates in your final response.
|
|
66
|
+
`;
|
|
67
|
+
var MEMORY_FILES = /* @__PURE__ */ new Map([
|
|
68
|
+
["README.md", `# Project Memory
|
|
69
|
+
|
|
70
|
+
Repo-backed memory keeps durable project context available across agent
|
|
71
|
+
sessions. Keep it concise and reviewable.
|
|
72
|
+
|
|
73
|
+
Use this folder for:
|
|
74
|
+
- confirmed project decisions
|
|
75
|
+
- durable workflow rules and mappings
|
|
76
|
+
- data contracts and source-file assumptions
|
|
77
|
+
- runbooks for recurring work
|
|
78
|
+
- open questions that should carry forward
|
|
79
|
+
|
|
80
|
+
Do not store secrets, credentials, tokens, private keys, or raw sensitive source
|
|
81
|
+
files here.
|
|
82
|
+
|
|
83
|
+
If a memory item affects app behavior, also persist it to the app's runtime
|
|
84
|
+
source of truth, such as collections or config, and expose it in the app UI or a
|
|
85
|
+
clear review/edit path.
|
|
86
|
+
`],
|
|
87
|
+
["project-context.md", `# Project Context
|
|
88
|
+
|
|
89
|
+
Summarize what this app does, who uses it, and the recurring workflow it
|
|
90
|
+
supports.
|
|
91
|
+
`],
|
|
92
|
+
["decisions.md", `# Decisions
|
|
93
|
+
|
|
94
|
+
Record durable decisions that future sessions should preserve.
|
|
95
|
+
|
|
96
|
+
| Date | Decision | Reason |
|
|
97
|
+
| --- | --- | --- |
|
|
98
|
+
`],
|
|
99
|
+
["open-questions.md", `# Open Questions
|
|
100
|
+
|
|
101
|
+
Track unresolved questions that should be answered before durable workflow
|
|
102
|
+
behavior is finalized.
|
|
103
|
+
`],
|
|
104
|
+
["rules/README.md", `# Rules
|
|
105
|
+
|
|
106
|
+
Document durable business rules, validation rules, thresholds, and exception
|
|
107
|
+
handling expectations.
|
|
108
|
+
`],
|
|
109
|
+
["mappings/README.md", `# Mappings
|
|
110
|
+
|
|
111
|
+
Document source-to-target mappings, normalization rules, and user-approved
|
|
112
|
+
corrections.
|
|
113
|
+
`],
|
|
114
|
+
["data-contracts/README.md", `# Data Contracts
|
|
115
|
+
|
|
116
|
+
Document expected source files, required columns, data types, and known source
|
|
117
|
+
system assumptions.
|
|
118
|
+
`],
|
|
119
|
+
["runbooks/README.md", `# Runbooks
|
|
120
|
+
|
|
121
|
+
Document repeatable operating steps for recurring workflows.
|
|
122
|
+
`]
|
|
123
|
+
]);
|
|
46
124
|
function copyDir(src, dest, replacements, isRoot = true) {
|
|
47
125
|
if (!existsSync(dest)) {
|
|
48
126
|
mkdirSync(dest, { recursive: true });
|
|
@@ -82,6 +160,35 @@ function ensureClaudeInstructionsLink(projectRoot) {
|
|
|
82
160
|
writeFileSync(claudeMdPath, readFileSync(agentsMdPath, "utf-8"));
|
|
83
161
|
}
|
|
84
162
|
}
|
|
163
|
+
async function isStudioProblemFirstScaffoldEnabled(targetDir) {
|
|
164
|
+
try {
|
|
165
|
+
const token = getToken(targetDir);
|
|
166
|
+
const api = createApiClient(token);
|
|
167
|
+
const me = await api.getMe();
|
|
168
|
+
return me.user?.feature_flags?.[STUDIO_PROBLEM_FIRST_FLAG] === true;
|
|
169
|
+
} catch {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function writeFileIfMissing(path, content) {
|
|
174
|
+
if (existsSync(path)) return;
|
|
175
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
176
|
+
writeFileSync(path, content);
|
|
177
|
+
}
|
|
178
|
+
function applyProblemFirstMemoryScaffold(projectRoot) {
|
|
179
|
+
const agentsMdPath = join(projectRoot, "AGENTS.md");
|
|
180
|
+
if (existsSync(agentsMdPath)) {
|
|
181
|
+
const agentsMd = readFileSync(agentsMdPath, "utf-8");
|
|
182
|
+
if (!agentsMd.includes("## Project Memory")) {
|
|
183
|
+
writeFileSync(agentsMdPath, `${agentsMd.trimEnd()}
|
|
184
|
+
|
|
185
|
+
${MEMORY_AGENTS_SECTION}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
for (const [relativePath, content] of MEMORY_FILES) {
|
|
189
|
+
writeFileIfMissing(join(projectRoot, "memory", relativePath), content);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
85
192
|
function isGitInstalled() {
|
|
86
193
|
try {
|
|
87
194
|
execSync("git --version", { stdio: "ignore" });
|
|
@@ -374,7 +481,11 @@ async function init(args) {
|
|
|
374
481
|
[sourceName, finalProjectName],
|
|
375
482
|
[sourceTitle, projectTitle]
|
|
376
483
|
];
|
|
484
|
+
const problemFirstScaffold = await isStudioProblemFirstScaffoldEnabled(targetDir);
|
|
377
485
|
copyDir(templateDir, targetDir, replacements);
|
|
486
|
+
if (problemFirstScaffold) {
|
|
487
|
+
applyProblemFirstMemoryScaffold(targetDir);
|
|
488
|
+
}
|
|
378
489
|
ensureClaudeInstructionsLink(targetDir);
|
|
379
490
|
const installCommand = existsSync(join(targetDir, "pnpm-lock.yaml")) ? "pnpm install --frozen-lockfile" : "pnpm install";
|
|
380
491
|
function listFiles(dir, prefix = "") {
|