@cubocicloide/stack-frappe 2.0.5 → 2.2.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/dist/index.js +96 -165
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/templates/base/.claude/agents/issue-fixer.md +245 -0
- package/templates/base/.claude/settings.json +11 -0
- package/templates/base/.claude/skills/clean-branches/SKILL.md +100 -0
- package/templates/base/.claude/skills/create/SKILL.md +88 -0
- package/templates/base/.claude/skills/create-api-method/SKILL.md +229 -0
- package/templates/base/.claude/skills/create-doctype/SKILL.md +11 -0
- package/templates/base/.claude/skills/create-hook/SKILL.md +254 -0
- package/templates/base/.claude/skills/fix-issues/SKILL.md +238 -0
- package/templates/base/.dude/lint/checks/PRJ/001.md +34 -0
- package/templates/base/.dude/lint/checks/README.md +20 -3
- package/templates/base/AGENTS.md +42 -0
- package/templates/base/CLAUDE.md.hbs +25 -0
- package/templates/base/docs/docs/cheatsheet.md +28 -0
- package/templates/base/docs/docs/dude.md.hbs +20 -2
- package/templates/base/docs/docs/extending.md +2 -2
- package/templates/base/docs/mkdocs.yml.hbs +1 -0
package/dist/index.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import path8 from "pathe";
|
|
3
|
+
import {
|
|
4
|
+
defineStack,
|
|
5
|
+
renderTemplateTree,
|
|
6
|
+
defineCheatsheetCommand,
|
|
7
|
+
defineDocsCommand,
|
|
8
|
+
defineExplainCommand
|
|
9
|
+
} from "@cubocicloide/dude";
|
|
4
10
|
|
|
5
11
|
// src/commands/_docker.ts
|
|
6
12
|
import { spawnSync } from "child_process";
|
|
@@ -76,103 +82,6 @@ var benchCommand = {
|
|
|
76
82
|
}
|
|
77
83
|
};
|
|
78
84
|
|
|
79
|
-
// src/commands/docs/index.ts
|
|
80
|
-
import { spawn, spawnSync as spawnSync2 } from "child_process";
|
|
81
|
-
import { existsSync, writeFileSync } from "fs";
|
|
82
|
-
import path from "pathe";
|
|
83
|
-
async function regenerateApiDoc(projectRoot, docsDir) {
|
|
84
|
-
try {
|
|
85
|
-
const dude = await import("@cubocicloide/dude");
|
|
86
|
-
if (typeof dude.generateApiDoc !== "function") return;
|
|
87
|
-
const md = await dude.generateApiDoc(projectRoot, "md");
|
|
88
|
-
writeFileSync(path.join(docsDir, "docs", "api.md"), md);
|
|
89
|
-
process.stdout.write("[docs] Regenerated docs/api.md from the live command catalog.\n");
|
|
90
|
-
} catch (e) {
|
|
91
|
-
process.stderr.write(
|
|
92
|
-
`[docs] Could not regenerate api.md (${e.message}); using the existing file.
|
|
93
|
-
`
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
function isDockerRunning2() {
|
|
98
|
-
const r = spawnSync2("docker", ["info"], { stdio: "ignore" });
|
|
99
|
-
return r.error == null && r.status === 0;
|
|
100
|
-
}
|
|
101
|
-
function openBrowser(url) {
|
|
102
|
-
if (process.platform === "win32") {
|
|
103
|
-
spawnSync2("cmd", ["/c", "start", "", url], { stdio: "ignore" });
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
const opener = process.platform === "darwin" ? "open" : "xdg-open";
|
|
107
|
-
spawnSync2(opener, [url], { stdio: "ignore" });
|
|
108
|
-
}
|
|
109
|
-
var docsCommand = {
|
|
110
|
-
description: "Serve the project documentation in dev mode (live-reload) at http://localhost:8001.",
|
|
111
|
-
args: {
|
|
112
|
-
port: {
|
|
113
|
-
type: "string",
|
|
114
|
-
description: "Host port to expose the docs site on (default: 8001).",
|
|
115
|
-
default: "8001"
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
async run({ projectRoot, args }) {
|
|
119
|
-
const docsDir = path.join(projectRoot, "docs");
|
|
120
|
-
const port = String(args.port ?? "8001");
|
|
121
|
-
const url = `http://localhost:${port}`;
|
|
122
|
-
if (!existsSync(docsDir)) {
|
|
123
|
-
process.stderr.write(
|
|
124
|
-
"[docs] No docs/ folder found in the project root. Make sure you ran `dude init`.\n"
|
|
125
|
-
);
|
|
126
|
-
process.exit(1);
|
|
127
|
-
}
|
|
128
|
-
await regenerateApiDoc(projectRoot, docsDir);
|
|
129
|
-
if (!isDockerRunning2()) {
|
|
130
|
-
process.stderr.write("[docs] Docker is not running. Start Docker Desktop and retry.\n");
|
|
131
|
-
process.exit(1);
|
|
132
|
-
}
|
|
133
|
-
process.stdout.write(`[docs] Starting MkDocs at ${url} (Ctrl+C to stop)
|
|
134
|
-
`);
|
|
135
|
-
const child = spawn(
|
|
136
|
-
"docker",
|
|
137
|
-
[
|
|
138
|
-
"run",
|
|
139
|
-
"--rm",
|
|
140
|
-
"-i",
|
|
141
|
-
"-p",
|
|
142
|
-
`${port}:8000`,
|
|
143
|
-
"-v",
|
|
144
|
-
`${docsDir}:/docs`,
|
|
145
|
-
"squidfunk/mkdocs-material",
|
|
146
|
-
"serve",
|
|
147
|
-
"--dev-addr=0.0.0.0:8000"
|
|
148
|
-
],
|
|
149
|
-
{ stdio: ["inherit", "pipe", "pipe"] }
|
|
150
|
-
);
|
|
151
|
-
if (child.pid == null) {
|
|
152
|
-
process.stderr.write("[docs] Failed to start Docker container.\n");
|
|
153
|
-
process.exit(1);
|
|
154
|
-
}
|
|
155
|
-
let browserOpened = false;
|
|
156
|
-
function watchChunk(chunk) {
|
|
157
|
-
if (!browserOpened && chunk.toString().includes("Serving on")) {
|
|
158
|
-
browserOpened = true;
|
|
159
|
-
process.stdout.write(`[docs] Opening ${url}
|
|
160
|
-
`);
|
|
161
|
-
openBrowser(url);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
child.stdout?.on("data", (chunk) => {
|
|
165
|
-
process.stdout.write(chunk);
|
|
166
|
-
watchChunk(chunk);
|
|
167
|
-
});
|
|
168
|
-
child.stderr?.on("data", (chunk) => {
|
|
169
|
-
process.stderr.write(chunk);
|
|
170
|
-
watchChunk(chunk);
|
|
171
|
-
});
|
|
172
|
-
await new Promise((resolve) => child.on("close", resolve));
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
|
|
176
85
|
// src/commands/down/index.ts
|
|
177
86
|
var downCommand = {
|
|
178
87
|
description: "Stop and remove all service containers (docker compose down).",
|
|
@@ -189,11 +98,11 @@ var downCommand = {
|
|
|
189
98
|
};
|
|
190
99
|
|
|
191
100
|
// src/commands/format/index.ts
|
|
192
|
-
import { spawnSync as
|
|
193
|
-
import
|
|
101
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
102
|
+
import path from "pathe";
|
|
194
103
|
function ruff(projectRoot, ruffArgs) {
|
|
195
|
-
const appsDir =
|
|
196
|
-
const r =
|
|
104
|
+
const appsDir = path.join(projectRoot, "apps");
|
|
105
|
+
const r = spawnSync2(
|
|
197
106
|
"docker",
|
|
198
107
|
["run", "--rm", "-v", `${appsDir}:/apps`, "-w", "/apps", "ghcr.io/astral-sh/ruff:latest", ...ruffArgs],
|
|
199
108
|
{ stdio: "inherit" }
|
|
@@ -215,13 +124,13 @@ var formatCommand = {
|
|
|
215
124
|
};
|
|
216
125
|
|
|
217
126
|
// src/commands/iac/providers/aws-ecs/lib/terraform.ts
|
|
218
|
-
import { existsSync as
|
|
219
|
-
import
|
|
127
|
+
import { existsSync as existsSync2, readdirSync, readFileSync as readFileSync3 } from "fs";
|
|
128
|
+
import path4 from "pathe";
|
|
220
129
|
|
|
221
130
|
// src/commands/iac/shared.ts
|
|
222
|
-
import { spawnSync as
|
|
131
|
+
import { spawnSync as spawnSync3 } from "child_process";
|
|
223
132
|
import { readFileSync } from "fs";
|
|
224
|
-
import
|
|
133
|
+
import path2 from "pathe";
|
|
225
134
|
function shouldUseShell() {
|
|
226
135
|
return process.platform === "win32";
|
|
227
136
|
}
|
|
@@ -229,7 +138,7 @@ function childEnv(profile) {
|
|
|
229
138
|
return profile ? { ...process.env, AWS_PROFILE: profile } : process.env;
|
|
230
139
|
}
|
|
231
140
|
function run(cmd, args, cwd, profile) {
|
|
232
|
-
const r =
|
|
141
|
+
const r = spawnSync3(cmd, args, {
|
|
233
142
|
cwd,
|
|
234
143
|
stdio: "inherit",
|
|
235
144
|
env: childEnv(profile),
|
|
@@ -253,7 +162,7 @@ function run(cmd, args, cwd, profile) {
|
|
|
253
162
|
return r.status ?? 1;
|
|
254
163
|
}
|
|
255
164
|
function capture(cmd, args, cwd, profile) {
|
|
256
|
-
const r =
|
|
165
|
+
const r = spawnSync3(cmd, args, {
|
|
257
166
|
cwd,
|
|
258
167
|
encoding: "utf8",
|
|
259
168
|
env: childEnv(profile),
|
|
@@ -263,7 +172,7 @@ function capture(cmd, args, cwd, profile) {
|
|
|
263
172
|
}
|
|
264
173
|
function readAnswers(projectRoot) {
|
|
265
174
|
try {
|
|
266
|
-
const j = JSON.parse(readFileSync(
|
|
175
|
+
const j = JSON.parse(readFileSync(path2.join(projectRoot, "dude.json"), "utf8"));
|
|
267
176
|
return j.answers ?? {};
|
|
268
177
|
} catch {
|
|
269
178
|
return {};
|
|
@@ -282,22 +191,22 @@ function sleepMs(ms) {
|
|
|
282
191
|
}
|
|
283
192
|
|
|
284
193
|
// src/commands/iac/providers/aws-ecs/lib/exec.ts
|
|
285
|
-
import { spawnSync as
|
|
194
|
+
import { spawnSync as spawnSync5 } from "child_process";
|
|
286
195
|
|
|
287
196
|
// src/commands/iac/providers/aws-ecs/lib/runner.ts
|
|
288
|
-
import { spawnSync as
|
|
197
|
+
import { spawnSync as spawnSync4 } from "child_process";
|
|
289
198
|
import { createHash } from "crypto";
|
|
290
|
-
import { existsSync
|
|
199
|
+
import { existsSync, readFileSync as readFileSync2 } from "fs";
|
|
291
200
|
import os from "os";
|
|
292
|
-
import
|
|
293
|
-
var RUNNER_DOCKERFILE =
|
|
201
|
+
import path3 from "pathe";
|
|
202
|
+
var RUNNER_DOCKERFILE = path3.join("iac", "runner", "Dockerfile");
|
|
294
203
|
var CONTAINERIZED = /* @__PURE__ */ new Set(["terraform"]);
|
|
295
204
|
function findDockerfile(cwd) {
|
|
296
|
-
let dir =
|
|
205
|
+
let dir = path3.resolve(cwd);
|
|
297
206
|
for (; ; ) {
|
|
298
|
-
const candidate =
|
|
299
|
-
if (
|
|
300
|
-
const parent =
|
|
207
|
+
const candidate = path3.join(dir, RUNNER_DOCKERFILE);
|
|
208
|
+
if (existsSync(candidate)) return candidate;
|
|
209
|
+
const parent = path3.dirname(dir);
|
|
301
210
|
if (parent === dir) return "";
|
|
302
211
|
dir = parent;
|
|
303
212
|
}
|
|
@@ -310,7 +219,7 @@ var dockerChecked;
|
|
|
310
219
|
var ensured = /* @__PURE__ */ new Set();
|
|
311
220
|
function dockerAvailable() {
|
|
312
221
|
if (dockerChecked !== void 0) return dockerChecked;
|
|
313
|
-
const r =
|
|
222
|
+
const r = spawnSync4("docker", ["version", "--format", "{{.Server.Version}}"], {
|
|
314
223
|
encoding: "utf8"
|
|
315
224
|
});
|
|
316
225
|
dockerChecked = r.status === 0 && !!r.stdout.trim();
|
|
@@ -322,7 +231,7 @@ function useRunner(cwd) {
|
|
|
322
231
|
}
|
|
323
232
|
function ensureImage(dockerfile, tag) {
|
|
324
233
|
if (ensured.has(tag)) return;
|
|
325
|
-
const exists =
|
|
234
|
+
const exists = spawnSync4("docker", ["image", "inspect", tag], { stdio: "ignore" }).status === 0;
|
|
326
235
|
if (!exists) {
|
|
327
236
|
process.stderr.write(
|
|
328
237
|
`
|
|
@@ -330,9 +239,9 @@ function ensureImage(dockerfile, tag) {
|
|
|
330
239
|
|
|
331
240
|
`
|
|
332
241
|
);
|
|
333
|
-
const build =
|
|
242
|
+
const build = spawnSync4(
|
|
334
243
|
"docker",
|
|
335
|
-
["build", "-t", tag, "-f", dockerfile,
|
|
244
|
+
["build", "-t", tag, "-f", dockerfile, path3.dirname(dockerfile)],
|
|
336
245
|
{ stdio: "inherit" }
|
|
337
246
|
);
|
|
338
247
|
if (build.status !== 0) {
|
|
@@ -346,7 +255,7 @@ function baseDockerArgs(cwd, profile, tty) {
|
|
|
346
255
|
const args = ["run", "--rm", tty ? "-it" : "-i"];
|
|
347
256
|
args.push("-v", `${cwd}:/work`, "-w", "/work");
|
|
348
257
|
const home = os.homedir();
|
|
349
|
-
args.push("-v", `${
|
|
258
|
+
args.push("-v", `${path3.join(home, ".aws")}:/root/.aws:ro`);
|
|
350
259
|
if (profile) args.push("-e", `AWS_PROFILE=${profile}`);
|
|
351
260
|
return args;
|
|
352
261
|
}
|
|
@@ -375,7 +284,7 @@ function routed(cmd, cwd) {
|
|
|
375
284
|
function run2(cmd, args, cwd, profile) {
|
|
376
285
|
if (!routed(cmd, cwd)) return run(cmd, args, cwd, profile);
|
|
377
286
|
const dargs = dockerRunArgs(cmd, args, cwd, profile, { tty: !!process.stdin.isTTY });
|
|
378
|
-
const r =
|
|
287
|
+
const r = spawnSync5("docker", dargs, { stdio: "inherit" });
|
|
379
288
|
if (r.error) {
|
|
380
289
|
process.stderr.write(`
|
|
381
290
|
\u2717 failed to run docker: ${r.error.message}
|
|
@@ -388,16 +297,16 @@ function run2(cmd, args, cwd, profile) {
|
|
|
388
297
|
function capture2(cmd, args, cwd, profile) {
|
|
389
298
|
if (!routed(cmd, cwd)) return capture(cmd, args, cwd, profile);
|
|
390
299
|
const dargs = dockerRunArgs(cmd, args, cwd, profile, { tty: false });
|
|
391
|
-
const r =
|
|
300
|
+
const r = spawnSync5("docker", dargs, { encoding: "utf8" });
|
|
392
301
|
return { status: r.status ?? 1, stdout: r.stdout ?? "" };
|
|
393
302
|
}
|
|
394
303
|
|
|
395
304
|
// src/commands/iac/providers/aws-ecs/lib/terraform.ts
|
|
396
|
-
var TF_DIR =
|
|
397
|
-
var TF_BOOTSTRAP_DIR =
|
|
398
|
-
var TF_ENVIRONMENTS_DIR =
|
|
305
|
+
var TF_DIR = path4.join("iac", "terraform");
|
|
306
|
+
var TF_BOOTSTRAP_DIR = path4.join(TF_DIR, "bootstrap");
|
|
307
|
+
var TF_ENVIRONMENTS_DIR = path4.join(TF_DIR, "environments");
|
|
399
308
|
function hasIac(projectRoot) {
|
|
400
|
-
return
|
|
309
|
+
return existsSync2(path4.join(projectRoot, "iac", "terraform"));
|
|
401
310
|
}
|
|
402
311
|
function requireIac(projectRoot) {
|
|
403
312
|
if (!hasIac(projectRoot)) {
|
|
@@ -423,10 +332,10 @@ function varFile(env) {
|
|
|
423
332
|
return `-var-file=environments/${env}/terraform.tfvars`;
|
|
424
333
|
}
|
|
425
334
|
function tfBoot(projectRoot, args, profile) {
|
|
426
|
-
return run2("terraform", args,
|
|
335
|
+
return run2("terraform", args, path4.join(projectRoot, TF_BOOTSTRAP_DIR), profile);
|
|
427
336
|
}
|
|
428
337
|
function captureBootstrap(projectRoot, args, profile) {
|
|
429
|
-
return capture2("terraform", args,
|
|
338
|
+
return capture2("terraform", args, path4.join(projectRoot, TF_BOOTSTRAP_DIR), profile);
|
|
430
339
|
}
|
|
431
340
|
function resolveProfile(projectRoot, args, env) {
|
|
432
341
|
if (args.profile) return String(args.profile);
|
|
@@ -436,7 +345,7 @@ function resolveProfile(projectRoot, args, env) {
|
|
|
436
345
|
function tfvarsValue(projectRoot, env, key) {
|
|
437
346
|
try {
|
|
438
347
|
return hclScalar(
|
|
439
|
-
readFileSync3(
|
|
348
|
+
readFileSync3(path4.join(projectRoot, TF_DIR, "environments", env, "terraform.tfvars"), "utf8"),
|
|
440
349
|
key
|
|
441
350
|
);
|
|
442
351
|
} catch {
|
|
@@ -446,7 +355,7 @@ function tfvarsValue(projectRoot, env, key) {
|
|
|
446
355
|
function readBackend(projectRoot, env) {
|
|
447
356
|
try {
|
|
448
357
|
const txt = readFileSync3(
|
|
449
|
-
|
|
358
|
+
path4.join(projectRoot, TF_DIR, "environments", env, "backend.hcl"),
|
|
450
359
|
"utf8"
|
|
451
360
|
);
|
|
452
361
|
return {
|
|
@@ -470,10 +379,10 @@ var envArg = {
|
|
|
470
379
|
}
|
|
471
380
|
};
|
|
472
381
|
function listEnvironments(projectRoot) {
|
|
473
|
-
const base =
|
|
382
|
+
const base = path4.join(projectRoot, TF_ENVIRONMENTS_DIR);
|
|
474
383
|
try {
|
|
475
384
|
return readdirSync(base, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name).filter(
|
|
476
|
-
(name) =>
|
|
385
|
+
(name) => existsSync2(path4.join(base, name, "backend.hcl")) && existsSync2(path4.join(base, name, "terraform.tfvars"))
|
|
477
386
|
).sort();
|
|
478
387
|
} catch {
|
|
479
388
|
return [];
|
|
@@ -534,8 +443,8 @@ var iacApplyCommand = {
|
|
|
534
443
|
};
|
|
535
444
|
|
|
536
445
|
// src/commands/iac/providers/aws-ecs/commands/bootstrap/index.ts
|
|
537
|
-
import { readFileSync as readFileSync4, writeFileSync
|
|
538
|
-
import
|
|
446
|
+
import { readFileSync as readFileSync4, writeFileSync } from "fs";
|
|
447
|
+
import path5 from "pathe";
|
|
539
448
|
var iacBootstrapCommand = {
|
|
540
449
|
available: hasIac,
|
|
541
450
|
description: "One-time: create the S3 state bucket + DynamoDB lock table + shared ECR repository, then write the values into backend.hcl.",
|
|
@@ -618,12 +527,12 @@ var iacBootstrapCommand = {
|
|
|
618
527
|
process.stderr.write("\n \u2717 Bootstrap outputs `state_bucket` / `lock_table` not found.\n\n");
|
|
619
528
|
process.exit(1);
|
|
620
529
|
}
|
|
621
|
-
const backendHclPath =
|
|
530
|
+
const backendHclPath = path5.join(projectRoot, TF_DIR, "environments", env, "backend.hcl");
|
|
622
531
|
try {
|
|
623
532
|
let hcl = readFileSync4(backendHclPath, "utf8");
|
|
624
533
|
hcl = hcl.replace(/^bucket\s*=\s*".*"$/m, `bucket = "${stateBucket}"`);
|
|
625
534
|
hcl = hcl.replace(/^dynamodb_table\s*=\s*".*"$/m, `dynamodb_table = "${lockTable}"`);
|
|
626
|
-
|
|
535
|
+
writeFileSync(backendHclPath, hcl);
|
|
627
536
|
} catch {
|
|
628
537
|
process.stderr.write(`
|
|
629
538
|
\u2717 Could not update ${backendHclPath}.
|
|
@@ -646,9 +555,9 @@ var iacBootstrapCommand = {
|
|
|
646
555
|
};
|
|
647
556
|
|
|
648
557
|
// src/commands/iac/providers/aws-ecs/lib/images.ts
|
|
649
|
-
import { spawnSync as
|
|
650
|
-
import { readFileSync as readFileSync5, writeFileSync as
|
|
651
|
-
import
|
|
558
|
+
import { spawnSync as spawnSync6 } from "child_process";
|
|
559
|
+
import { readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "fs";
|
|
560
|
+
import path6 from "pathe";
|
|
652
561
|
var tagArg = {
|
|
653
562
|
tag: {
|
|
654
563
|
type: "string",
|
|
@@ -734,7 +643,7 @@ function dockerLogin(host, region, projectRoot, profile) {
|
|
|
734
643
|
process.stderr.write("\n \u2717 Could not obtain an ECR login password (check your AWS auth).\n\n");
|
|
735
644
|
return 1;
|
|
736
645
|
}
|
|
737
|
-
const r =
|
|
646
|
+
const r = spawnSync6("docker", ["login", "--username", "AWS", "--password-stdin", host], {
|
|
738
647
|
cwd: projectRoot,
|
|
739
648
|
input: pw.stdout.trim(),
|
|
740
649
|
stdio: ["pipe", "inherit", "inherit"],
|
|
@@ -782,7 +691,7 @@ function doPush(projectRoot, profile, tag, target) {
|
|
|
782
691
|
return run2("docker", ["push", `${target.image.repository}:${tag}`], projectRoot, profile);
|
|
783
692
|
}
|
|
784
693
|
function doDeploy(projectRoot, profile, env, tag, target) {
|
|
785
|
-
const tfvarsPath =
|
|
694
|
+
const tfvarsPath = path6.join(projectRoot, TF_DIR, "environments", env, "terraform.tfvars");
|
|
786
695
|
try {
|
|
787
696
|
let tfvars = readFileSync5(tfvarsPath, "utf8");
|
|
788
697
|
if (/^\s*image_tag\s*=/m.test(tfvars)) {
|
|
@@ -792,7 +701,7 @@ function doDeploy(projectRoot, profile, env, tag, target) {
|
|
|
792
701
|
image_tag = "${tag}"
|
|
793
702
|
`;
|
|
794
703
|
}
|
|
795
|
-
|
|
704
|
+
writeFileSync2(tfvarsPath, tfvars);
|
|
796
705
|
} catch {
|
|
797
706
|
process.stderr.write(`
|
|
798
707
|
\u2717 Could not update ${tfvarsPath}.
|
|
@@ -1286,10 +1195,10 @@ var iacLoginCommand = {
|
|
|
1286
1195
|
};
|
|
1287
1196
|
|
|
1288
1197
|
// src/commands/iac/providers/aws-ecs/commands/logs/index.ts
|
|
1289
|
-
import { spawnSync as
|
|
1198
|
+
import { spawnSync as spawnSync7 } from "child_process";
|
|
1290
1199
|
var SERVICES = ["backend", "frontend", "websocket", "worker", "scheduler"];
|
|
1291
1200
|
function awsCliMajorVersion() {
|
|
1292
|
-
const r =
|
|
1201
|
+
const r = spawnSync7("aws", ["--version"], { encoding: "utf8" });
|
|
1293
1202
|
const m = /aws-cli\/(\d+)\./.exec(`${r.stdout ?? ""}${r.stderr ?? ""}`);
|
|
1294
1203
|
return m ? Number(m[1]) : void 0;
|
|
1295
1204
|
}
|
|
@@ -1378,8 +1287,8 @@ var iacMigrateCommand = {
|
|
|
1378
1287
|
};
|
|
1379
1288
|
|
|
1380
1289
|
// src/commands/iac/providers/aws-ecs/commands/new-env/index.ts
|
|
1381
|
-
import { cpSync, readFileSync as readFileSync6, writeFileSync as
|
|
1382
|
-
import
|
|
1290
|
+
import { cpSync, readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "fs";
|
|
1291
|
+
import path7 from "pathe";
|
|
1383
1292
|
var iacNewEnvCommand = {
|
|
1384
1293
|
available: hasIac,
|
|
1385
1294
|
description: "Scaffold a new environment (iac/terraform/environments/<name>) by copying an existing one.",
|
|
@@ -1430,16 +1339,16 @@ var iacNewEnvCommand = {
|
|
|
1430
1339
|
`);
|
|
1431
1340
|
process.exit(1);
|
|
1432
1341
|
}
|
|
1433
|
-
const base =
|
|
1434
|
-
const dst =
|
|
1435
|
-
cpSync(
|
|
1436
|
-
const tfvarsPath =
|
|
1437
|
-
|
|
1342
|
+
const base = path7.join(projectRoot, TF_ENVIRONMENTS_DIR);
|
|
1343
|
+
const dst = path7.join(base, name);
|
|
1344
|
+
cpSync(path7.join(base, from), dst, { recursive: true });
|
|
1345
|
+
const tfvarsPath = path7.join(dst, "terraform.tfvars");
|
|
1346
|
+
writeFileSync3(
|
|
1438
1347
|
tfvarsPath,
|
|
1439
1348
|
readFileSync6(tfvarsPath, "utf8").replace(/^(\s*environment\s*=\s*).*$/m, `$1"${name}"`)
|
|
1440
1349
|
);
|
|
1441
|
-
const backendPath =
|
|
1442
|
-
|
|
1350
|
+
const backendPath = path7.join(dst, "backend.hcl");
|
|
1351
|
+
writeFileSync3(
|
|
1443
1352
|
backendPath,
|
|
1444
1353
|
readFileSync6(backendPath, "utf8").replace(
|
|
1445
1354
|
/^(\s*key\s*=\s*).*$/m,
|
|
@@ -1510,7 +1419,7 @@ var iacPushCommand = {
|
|
|
1510
1419
|
};
|
|
1511
1420
|
|
|
1512
1421
|
// src/commands/iac/providers/aws-ecs/commands/shell/index.ts
|
|
1513
|
-
import { spawnSync as
|
|
1422
|
+
import { spawnSync as spawnSync8 } from "child_process";
|
|
1514
1423
|
var iacShellCommand = {
|
|
1515
1424
|
available: hasIac,
|
|
1516
1425
|
description: "Open an interactive shell in the IaC runner container (terraform, aws) scoped to an environment.",
|
|
@@ -1542,7 +1451,7 @@ var iacShellCommand = {
|
|
|
1542
1451
|
|
|
1543
1452
|
`
|
|
1544
1453
|
);
|
|
1545
|
-
const r =
|
|
1454
|
+
const r = spawnSync8("docker", dockerShellArgs(projectRoot, profile), {
|
|
1546
1455
|
stdio: "inherit",
|
|
1547
1456
|
cwd: projectRoot
|
|
1548
1457
|
});
|
|
@@ -1769,7 +1678,7 @@ var reviewCommand = {
|
|
|
1769
1678
|
};
|
|
1770
1679
|
|
|
1771
1680
|
// src/commands/shell/index.ts
|
|
1772
|
-
import { spawnSync as
|
|
1681
|
+
import { spawnSync as spawnSync9 } from "child_process";
|
|
1773
1682
|
var shellCommand = {
|
|
1774
1683
|
description: "Open an interactive shell in a service container (default: bench, inside the frappe-bench directory).",
|
|
1775
1684
|
args: {
|
|
@@ -1785,7 +1694,7 @@ var shellCommand = {
|
|
|
1785
1694
|
dc(["exec", "-w", "/home/frappe/frappe-bench", "bench", "/bin/bash"]);
|
|
1786
1695
|
return;
|
|
1787
1696
|
}
|
|
1788
|
-
const bash =
|
|
1697
|
+
const bash = spawnSync9("docker", ["compose", "exec", svc, "/bin/bash"], { stdio: "inherit" });
|
|
1789
1698
|
if (bash.status !== 0) {
|
|
1790
1699
|
dc(["exec", svc, "/bin/sh"]);
|
|
1791
1700
|
} else {
|
|
@@ -1901,6 +1810,26 @@ var src_default = defineStack({
|
|
|
1901
1810
|
default: "none"
|
|
1902
1811
|
}
|
|
1903
1812
|
],
|
|
1813
|
+
docs: {
|
|
1814
|
+
tagline: "A Frappe Framework ticketing system (Frappe Helpdesk) with a worked custom-app example and optional AWS ECS Fargate IaC.",
|
|
1815
|
+
useCases: [
|
|
1816
|
+
"A ticketing/helpdesk system running Frappe Helpdesk out of the box",
|
|
1817
|
+
"A team learning Frappe's core building blocks via a worked custom-app example",
|
|
1818
|
+
"A DocType/workflow-driven backend with a straightforward path to AWS ECS Fargate"
|
|
1819
|
+
],
|
|
1820
|
+
technologies: ["Frappe Framework", "Frappe Helpdesk", "MariaDB"],
|
|
1821
|
+
iac: { provider: "aws-ecs", flag: "--iac aws-ecs" },
|
|
1822
|
+
pages: [
|
|
1823
|
+
{ file: "index.md", title: "Home" },
|
|
1824
|
+
{ file: "frappe.md", title: "Frappe core concepts" },
|
|
1825
|
+
{ file: "extending.md", title: "Extending the app" },
|
|
1826
|
+
{ file: "dude.md", title: "Working with dude" },
|
|
1827
|
+
{ file: "api.md", title: "Command reference" },
|
|
1828
|
+
{ file: "cheatsheet.md", title: "Cheatsheet" },
|
|
1829
|
+
{ file: "mkdocs.md", title: "Writing docs" },
|
|
1830
|
+
{ file: "deploy.md", title: "Deploy (AWS ECS)", when: "withIac" }
|
|
1831
|
+
]
|
|
1832
|
+
},
|
|
1904
1833
|
async scaffold(ctx) {
|
|
1905
1834
|
const { answers, dest, stackRoot, dudeVersion, stackVersion } = ctx;
|
|
1906
1835
|
const withHelpdesk = answers.helpdesk !== false;
|
|
@@ -1912,10 +1841,10 @@ var src_default = defineStack({
|
|
|
1912
1841
|
dudeVersion,
|
|
1913
1842
|
stackVersion
|
|
1914
1843
|
};
|
|
1915
|
-
const templates =
|
|
1916
|
-
await renderTemplateTree({ src:
|
|
1844
|
+
const templates = path8.join(stackRoot, "templates");
|
|
1845
|
+
await renderTemplateTree({ src: path8.join(templates, "base"), dest, data });
|
|
1917
1846
|
if (withIac) {
|
|
1918
|
-
await renderTemplateTree({ src:
|
|
1847
|
+
await renderTemplateTree({ src: path8.join(templates, "aws-ecs"), dest, data });
|
|
1919
1848
|
}
|
|
1920
1849
|
},
|
|
1921
1850
|
hooks: {
|
|
@@ -1957,6 +1886,8 @@ var src_default = defineStack({
|
|
|
1957
1886
|
},
|
|
1958
1887
|
rules: [],
|
|
1959
1888
|
commands: {
|
|
1889
|
+
cheatsheet: defineCheatsheetCommand(),
|
|
1890
|
+
explain: defineExplainCommand(),
|
|
1960
1891
|
up: upCommand,
|
|
1961
1892
|
down: downCommand,
|
|
1962
1893
|
logs: logsCommand,
|
|
@@ -1966,7 +1897,7 @@ var src_default = defineStack({
|
|
|
1966
1897
|
format: formatCommand,
|
|
1967
1898
|
review: reviewCommand,
|
|
1968
1899
|
test: testCommand,
|
|
1969
|
-
docs:
|
|
1900
|
+
docs: defineDocsCommand(),
|
|
1970
1901
|
site: {
|
|
1971
1902
|
migrate: migrateCommand,
|
|
1972
1903
|
console: consoleCommand,
|