@donotdev/cli 0.0.8 → 0.0.11
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/dependencies-matrix.json +177 -76
- package/dist/bin/commands/build.js +2 -2
- package/dist/bin/commands/bump.js +578 -94
- package/dist/bin/commands/cacheout.js +2 -2
- package/dist/bin/commands/create-app.js +46 -9
- package/dist/bin/commands/create-project.js +63 -10
- package/dist/bin/commands/deploy.js +114 -25
- package/dist/bin/commands/dev.js +2 -2
- package/dist/bin/commands/emu.js +2 -2
- package/dist/bin/commands/format.js +2 -2
- package/dist/bin/commands/lint.js +2 -2
- package/dist/bin/commands/preview.js +2 -2
- package/dist/bin/commands/sync-secrets.js +2 -2
- package/dist/bin/dndev.js +7 -4
- package/dist/bin/donotdev.js +7 -4
- package/dist/index.js +177 -33
- package/package.json +5 -4
- package/templates/app-next/src/config/app.ts.example +1 -1
- package/templates/app-vite/index.html.example +24 -2
- package/templates/app-vite/src/config/app.ts.example +1 -1
- package/templates/app-vite/src/pages/FormPageExample.tsx.example +8 -5
- package/templates/app-vite/src/pages/ListPageExample.tsx.example +4 -7
- package/templates/root-consumer/.claude/agents/architect.md.example +313 -0
- package/templates/root-consumer/.claude/agents/builder.md.example +329 -0
- package/templates/root-consumer/.claude/agents/coder.md.example +87 -0
- package/templates/root-consumer/.claude/agents/extractor.md.example +235 -0
- package/templates/root-consumer/.claude/agents/polisher.md.example +359 -0
- package/templates/root-consumer/.claude/agents/prompt-engineer.md.example +85 -0
- package/templates/root-consumer/.claude/commands/brainstorm.md.example +133 -0
- package/templates/root-consumer/.claude/commands/build.md.example +109 -0
- package/templates/root-consumer/.claude/commands/design.md.example +136 -0
- package/templates/root-consumer/.claude/commands/polish.md.example +145 -0
- package/templates/root-consumer/.cursor/mcp.json.example +8 -0
- package/templates/root-consumer/.firebaserc.example +5 -0
- package/templates/root-consumer/.mcp.json.example +8 -0
- package/templates/root-consumer/CLAUDE.md.example +146 -0
- package/templates/root-consumer/entities/ExampleEntity.ts.example +2 -1
- package/templates/root-consumer/entities/demo.ts.example +1 -1
- package/templates/root-consumer/firestore.indexes.json.example +4 -0
- package/templates/root-consumer/firestore.rules.example +11 -0
- package/templates/root-consumer/guides/dndev/AGENT_START_HERE.md.example +15 -12
- package/templates/root-consumer/guides/dndev/COMPONENTS_CRUD.md.example +9 -6
- package/templates/root-consumer/guides/dndev/COMPONENT_API.md.example +195 -0
- package/templates/root-consumer/guides/dndev/INDEX.md.example +3 -1
- package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +485 -57
- package/templates/root-consumer/guides/wai-way/entity_patterns.md.example +1 -1
- package/templates/root-consumer/storage.rules.example +8 -0
|
@@ -163,7 +163,7 @@ var require_picocolors = __commonJS({
|
|
|
163
163
|
}
|
|
164
164
|
});
|
|
165
165
|
|
|
166
|
-
// node_modules/.bun/@clack+
|
|
166
|
+
// node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/node_modules/@clack/core/dist/index.mjs
|
|
167
167
|
import { stdin as j, stdout as M } from "node:process";
|
|
168
168
|
import O from "node:readline";
|
|
169
169
|
import { Writable as X } from "node:stream";
|
|
@@ -255,9 +255,9 @@ function m(e2, u2) {
|
|
|
255
255
|
const t = e2;
|
|
256
256
|
t.isTTY && t.setRawMode(u2);
|
|
257
257
|
}
|
|
258
|
-
var import_sisteransi, uD, W, tD, eD, FD, sD, w, N, I, R, r, iD, CD, ED, d, oD, y, V, nD, G, _, z, K, aD, k, hD, lD, xD, B, AD, S, gD, vD, h, x, dD, A;
|
|
258
|
+
var import_sisteransi, uD, W, tD, eD, FD, sD, w, N, I, R, r, iD, CD, ED, d, oD, y, V, nD, G, _, z, K, aD, k, hD, lD, xD, B, AD, S, gD, vD, h, x, dD, A, kD, $D, H, SD;
|
|
259
259
|
var init_dist = __esm({
|
|
260
|
-
"node_modules/.bun/@clack+
|
|
260
|
+
"node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/node_modules/@clack/core/dist/index.mjs"() {
|
|
261
261
|
init_utils();
|
|
262
262
|
import_sisteransi = __toESM(require_src(), 1);
|
|
263
263
|
uD = DD();
|
|
@@ -492,6 +492,41 @@ var init_dist = __esm({
|
|
|
492
492
|
}
|
|
493
493
|
};
|
|
494
494
|
A = /* @__PURE__ */ new WeakMap();
|
|
495
|
+
kD = Object.defineProperty;
|
|
496
|
+
$D = (e2, u2, t) => u2 in e2 ? kD(e2, u2, { enumerable: true, configurable: true, writable: true, value: t }) : e2[u2] = t;
|
|
497
|
+
H = (e2, u2, t) => ($D(e2, typeof u2 != "symbol" ? u2 + "" : u2, t), t);
|
|
498
|
+
SD = class extends x {
|
|
499
|
+
constructor(u2) {
|
|
500
|
+
super(u2, false), H(this, "options"), H(this, "cursor", 0), this.options = u2.options, this.value = [...u2.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: t }) => t === u2.cursorAt), 0), this.on("key", (t) => {
|
|
501
|
+
t === "a" && this.toggleAll();
|
|
502
|
+
}), this.on("cursor", (t) => {
|
|
503
|
+
switch (t) {
|
|
504
|
+
case "left":
|
|
505
|
+
case "up":
|
|
506
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
507
|
+
break;
|
|
508
|
+
case "down":
|
|
509
|
+
case "right":
|
|
510
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
511
|
+
break;
|
|
512
|
+
case "space":
|
|
513
|
+
this.toggleValue();
|
|
514
|
+
break;
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
get _value() {
|
|
519
|
+
return this.options[this.cursor].value;
|
|
520
|
+
}
|
|
521
|
+
toggleAll() {
|
|
522
|
+
const u2 = this.value.length === this.options.length;
|
|
523
|
+
this.value = u2 ? [] : this.options.map((t) => t.value);
|
|
524
|
+
}
|
|
525
|
+
toggleValue() {
|
|
526
|
+
const u2 = this.value.includes(this._value);
|
|
527
|
+
this.value = u2 ? this.value.filter((t) => t !== this._value) : [...this.value, this._value];
|
|
528
|
+
}
|
|
529
|
+
};
|
|
495
530
|
}
|
|
496
531
|
});
|
|
497
532
|
|
|
@@ -501,7 +536,7 @@ import y2 from "node:process";
|
|
|
501
536
|
function ce() {
|
|
502
537
|
return y2.platform !== "win32" ? y2.env.TERM !== "linux" : !!y2.env.CI || !!y2.env.WT_SESSION || !!y2.env.TERMINUS_SUBLIME || y2.env.ConEmuTask === "{cmd::Cmder}" || y2.env.TERM_PROGRAM === "Terminus-Sublime" || y2.env.TERM_PROGRAM === "vscode" || y2.env.TERM === "xterm-256color" || y2.env.TERM === "alacritty" || y2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
503
538
|
}
|
|
504
|
-
var import_picocolors, import_sisteransi2, V2, u, le, L2, W2, C, ue, o, d2, k2, P2, A2, T, F, $e, _2, me, de, pe, q, D, U, K2, b2, ye, xe, Ie, Se, M2, J;
|
|
539
|
+
var import_picocolors, import_sisteransi2, V2, u, le, L2, W2, C, ue, o, d2, k2, P2, A2, T, F, $e, _2, me, de, pe, q, D, U, K2, b2, G2, ye, fe, xe, Ie, Se, M2, J;
|
|
505
540
|
var init_dist2 = __esm({
|
|
506
541
|
"node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/dist/index.mjs"() {
|
|
507
542
|
init_utils();
|
|
@@ -545,6 +580,16 @@ var init_dist2 = __esm({
|
|
|
545
580
|
return import_picocolors.default.green(C);
|
|
546
581
|
}
|
|
547
582
|
};
|
|
583
|
+
G2 = (t) => {
|
|
584
|
+
const { cursor: n, options: r2, style: i } = t, s = t.maxItems ?? Number.POSITIVE_INFINITY, c = Math.max(process.stdout.rows - 4, 0), a = Math.min(c, Math.max(s, 5));
|
|
585
|
+
let l2 = 0;
|
|
586
|
+
n >= l2 + a - 3 ? l2 = Math.max(Math.min(n - a + 3, r2.length - a), 0) : n < l2 + 2 && (l2 = Math.max(n - 2, 0));
|
|
587
|
+
const $2 = a < r2.length && l2 > 0, g = a < r2.length && l2 + a < r2.length;
|
|
588
|
+
return r2.slice(l2, l2 + a).map((p2, v, f) => {
|
|
589
|
+
const j2 = v === 0 && $2, E = v === f.length - 1 && g;
|
|
590
|
+
return j2 || E ? import_picocolors.default.dim("...") : i(p2, v + l2 === n);
|
|
591
|
+
});
|
|
592
|
+
};
|
|
548
593
|
ye = (t) => {
|
|
549
594
|
const n = t.active ?? "Yes", r2 = t.inactive ?? "No";
|
|
550
595
|
return new dD({ active: n, inactive: r2, initialValue: t.initialValue ?? true, render() {
|
|
@@ -560,6 +605,46 @@ ${import_picocolors.default.gray(o)}`;
|
|
|
560
605
|
default:
|
|
561
606
|
return `${i}${import_picocolors.default.cyan(o)} ${this.value ? `${import_picocolors.default.green(k2)} ${n}` : `${import_picocolors.default.dim(P2)} ${import_picocolors.default.dim(n)}`} ${import_picocolors.default.dim("/")} ${this.value ? `${import_picocolors.default.dim(P2)} ${import_picocolors.default.dim(r2)}` : `${import_picocolors.default.green(k2)} ${r2}`}
|
|
562
607
|
${import_picocolors.default.cyan(d2)}
|
|
608
|
+
`;
|
|
609
|
+
}
|
|
610
|
+
} }).prompt();
|
|
611
|
+
};
|
|
612
|
+
fe = (t) => {
|
|
613
|
+
const n = (r2, i) => {
|
|
614
|
+
const s = r2.label ?? String(r2.value);
|
|
615
|
+
return i === "active" ? `${import_picocolors.default.cyan(A2)} ${s} ${r2.hint ? import_picocolors.default.dim(`(${r2.hint})`) : ""}` : i === "selected" ? `${import_picocolors.default.green(T)} ${import_picocolors.default.dim(s)} ${r2.hint ? import_picocolors.default.dim(`(${r2.hint})`) : ""}` : i === "cancelled" ? `${import_picocolors.default.strikethrough(import_picocolors.default.dim(s))}` : i === "active-selected" ? `${import_picocolors.default.green(T)} ${s} ${r2.hint ? import_picocolors.default.dim(`(${r2.hint})`) : ""}` : i === "submitted" ? `${import_picocolors.default.dim(s)}` : `${import_picocolors.default.dim(F)} ${import_picocolors.default.dim(s)}`;
|
|
616
|
+
};
|
|
617
|
+
return new SD({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, validate(r2) {
|
|
618
|
+
if (this.required && r2.length === 0) return `Please select at least one option.
|
|
619
|
+
${import_picocolors.default.reset(import_picocolors.default.dim(`Press ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" space ")))} to select, ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" enter ")))} to submit`))}`;
|
|
620
|
+
}, render() {
|
|
621
|
+
const r2 = `${import_picocolors.default.gray(o)}
|
|
622
|
+
${b2(this.state)} ${t.message}
|
|
623
|
+
`, i = (s, c) => {
|
|
624
|
+
const a = this.value.includes(s.value);
|
|
625
|
+
return c && a ? n(s, "active-selected") : a ? n(s, "selected") : n(s, c ? "active" : "inactive");
|
|
626
|
+
};
|
|
627
|
+
switch (this.state) {
|
|
628
|
+
case "submit":
|
|
629
|
+
return `${r2}${import_picocolors.default.gray(o)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => n(s, "submitted")).join(import_picocolors.default.dim(", ")) || import_picocolors.default.dim("none")}`;
|
|
630
|
+
case "cancel": {
|
|
631
|
+
const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => n(c, "cancelled")).join(import_picocolors.default.dim(", "));
|
|
632
|
+
return `${r2}${import_picocolors.default.gray(o)} ${s.trim() ? `${s}
|
|
633
|
+
${import_picocolors.default.gray(o)}` : ""}`;
|
|
634
|
+
}
|
|
635
|
+
case "error": {
|
|
636
|
+
const s = this.error.split(`
|
|
637
|
+
`).map((c, a) => a === 0 ? `${import_picocolors.default.yellow(d2)} ${import_picocolors.default.yellow(c)}` : ` ${c}`).join(`
|
|
638
|
+
`);
|
|
639
|
+
return `${r2 + import_picocolors.default.yellow(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
640
|
+
${import_picocolors.default.yellow(o)} `)}
|
|
641
|
+
${s}
|
|
642
|
+
`;
|
|
643
|
+
}
|
|
644
|
+
default:
|
|
645
|
+
return `${r2}${import_picocolors.default.cyan(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
646
|
+
${import_picocolors.default.cyan(o)} `)}
|
|
647
|
+
${import_picocolors.default.cyan(d2)}
|
|
563
648
|
`;
|
|
564
649
|
}
|
|
565
650
|
} }).prompt();
|
|
@@ -2651,7 +2736,7 @@ var require_scan = __commonJS({
|
|
|
2651
2736
|
}
|
|
2652
2737
|
let base = str;
|
|
2653
2738
|
let prefix = "";
|
|
2654
|
-
let
|
|
2739
|
+
let glob2 = "";
|
|
2655
2740
|
if (start > 0) {
|
|
2656
2741
|
prefix = str.slice(0, start);
|
|
2657
2742
|
str = str.slice(start);
|
|
@@ -2659,10 +2744,10 @@ var require_scan = __commonJS({
|
|
|
2659
2744
|
}
|
|
2660
2745
|
if (base && isGlob === true && lastIndex > 0) {
|
|
2661
2746
|
base = str.slice(0, lastIndex);
|
|
2662
|
-
|
|
2747
|
+
glob2 = str.slice(lastIndex);
|
|
2663
2748
|
} else if (isGlob === true) {
|
|
2664
2749
|
base = "";
|
|
2665
|
-
|
|
2750
|
+
glob2 = str;
|
|
2666
2751
|
} else {
|
|
2667
2752
|
base = str;
|
|
2668
2753
|
}
|
|
@@ -2672,7 +2757,7 @@ var require_scan = __commonJS({
|
|
|
2672
2757
|
}
|
|
2673
2758
|
}
|
|
2674
2759
|
if (opts.unescape === true) {
|
|
2675
|
-
if (
|
|
2760
|
+
if (glob2) glob2 = utils.removeBackslashes(glob2);
|
|
2676
2761
|
if (base && backslashes === true) {
|
|
2677
2762
|
base = utils.removeBackslashes(base);
|
|
2678
2763
|
}
|
|
@@ -2682,7 +2767,7 @@ var require_scan = __commonJS({
|
|
|
2682
2767
|
input,
|
|
2683
2768
|
start,
|
|
2684
2769
|
base,
|
|
2685
|
-
glob,
|
|
2770
|
+
glob: glob2,
|
|
2686
2771
|
isBrace,
|
|
2687
2772
|
isBracket,
|
|
2688
2773
|
isGlob,
|
|
@@ -3522,9 +3607,9 @@ var require_picomatch = __commonJS({
|
|
|
3522
3607
|
var utils = require_utils2();
|
|
3523
3608
|
var constants2 = require_constants2();
|
|
3524
3609
|
var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
3525
|
-
var picomatch = (
|
|
3526
|
-
if (Array.isArray(
|
|
3527
|
-
const fns =
|
|
3610
|
+
var picomatch = (glob2, options, returnState = false) => {
|
|
3611
|
+
if (Array.isArray(glob2)) {
|
|
3612
|
+
const fns = glob2.map((input) => picomatch(input, options, returnState));
|
|
3528
3613
|
const arrayMatcher = (str) => {
|
|
3529
3614
|
for (const isMatch of fns) {
|
|
3530
3615
|
const state2 = isMatch(str);
|
|
@@ -3534,13 +3619,13 @@ var require_picomatch = __commonJS({
|
|
|
3534
3619
|
};
|
|
3535
3620
|
return arrayMatcher;
|
|
3536
3621
|
}
|
|
3537
|
-
const isState = isObject(
|
|
3538
|
-
if (
|
|
3622
|
+
const isState = isObject(glob2) && glob2.tokens && glob2.input;
|
|
3623
|
+
if (glob2 === "" || typeof glob2 !== "string" && !isState) {
|
|
3539
3624
|
throw new TypeError("Expected pattern to be a non-empty string");
|
|
3540
3625
|
}
|
|
3541
3626
|
const opts = options || {};
|
|
3542
3627
|
const posix = utils.isWindows(options);
|
|
3543
|
-
const regex = isState ? picomatch.compileRe(
|
|
3628
|
+
const regex = isState ? picomatch.compileRe(glob2, options) : picomatch.makeRe(glob2, options, false, true);
|
|
3544
3629
|
const state = regex.state;
|
|
3545
3630
|
delete regex.state;
|
|
3546
3631
|
let isIgnored = () => false;
|
|
@@ -3549,8 +3634,8 @@ var require_picomatch = __commonJS({
|
|
|
3549
3634
|
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
3550
3635
|
}
|
|
3551
3636
|
const matcher = (input, returnObject = false) => {
|
|
3552
|
-
const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
|
|
3553
|
-
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
|
3637
|
+
const { isMatch, match, output } = picomatch.test(input, regex, options, { glob: glob2, posix });
|
|
3638
|
+
const result = { glob: glob2, state, regex, posix, input, output, match, isMatch };
|
|
3554
3639
|
if (typeof opts.onResult === "function") {
|
|
3555
3640
|
opts.onResult(result);
|
|
3556
3641
|
}
|
|
@@ -3575,7 +3660,7 @@ var require_picomatch = __commonJS({
|
|
|
3575
3660
|
}
|
|
3576
3661
|
return matcher;
|
|
3577
3662
|
};
|
|
3578
|
-
picomatch.test = (input, regex, options, { glob, posix } = {}) => {
|
|
3663
|
+
picomatch.test = (input, regex, options, { glob: glob2, posix } = {}) => {
|
|
3579
3664
|
if (typeof input !== "string") {
|
|
3580
3665
|
throw new TypeError("Expected input to be a string");
|
|
3581
3666
|
}
|
|
@@ -3584,11 +3669,11 @@ var require_picomatch = __commonJS({
|
|
|
3584
3669
|
}
|
|
3585
3670
|
const opts = options || {};
|
|
3586
3671
|
const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
|
3587
|
-
let match = input ===
|
|
3672
|
+
let match = input === glob2;
|
|
3588
3673
|
let output = match && format ? format(input) : input;
|
|
3589
3674
|
if (match === false) {
|
|
3590
3675
|
output = format ? format(input) : input;
|
|
3591
|
-
match = output ===
|
|
3676
|
+
match = output === glob2;
|
|
3592
3677
|
}
|
|
3593
3678
|
if (match === false || opts.capture === true) {
|
|
3594
3679
|
if (opts.matchBase === true || opts.basename === true) {
|
|
@@ -3599,8 +3684,8 @@ var require_picomatch = __commonJS({
|
|
|
3599
3684
|
}
|
|
3600
3685
|
return { isMatch: Boolean(match), match, output };
|
|
3601
3686
|
};
|
|
3602
|
-
picomatch.matchBase = (input,
|
|
3603
|
-
const regex =
|
|
3687
|
+
picomatch.matchBase = (input, glob2, options, posix = utils.isWindows(options)) => {
|
|
3688
|
+
const regex = glob2 instanceof RegExp ? glob2 : picomatch.makeRe(glob2, options);
|
|
3604
3689
|
return regex.test(path.basename(input));
|
|
3605
3690
|
};
|
|
3606
3691
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
@@ -3789,9 +3874,9 @@ var require_micromatch = __commonJS({
|
|
|
3789
3874
|
}
|
|
3790
3875
|
return [].concat(patterns).every((p2) => picomatch(p2, options)(str));
|
|
3791
3876
|
};
|
|
3792
|
-
micromatch.capture = (
|
|
3877
|
+
micromatch.capture = (glob2, input, options) => {
|
|
3793
3878
|
let posix = utils.isWindows(options);
|
|
3794
|
-
let regex = picomatch.makeRe(String(
|
|
3879
|
+
let regex = picomatch.makeRe(String(glob2), { ...options, capture: true });
|
|
3795
3880
|
let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
|
|
3796
3881
|
if (match) {
|
|
3797
3882
|
return match.slice(1).map((v) => v === void 0 ? "" : v);
|
|
@@ -4280,7 +4365,7 @@ var require_async = __commonJS({
|
|
|
4280
4365
|
init_utils();
|
|
4281
4366
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4282
4367
|
exports.read = void 0;
|
|
4283
|
-
function
|
|
4368
|
+
function read2(path, settings, callback) {
|
|
4284
4369
|
settings.fs.lstat(path, (lstatError, lstat) => {
|
|
4285
4370
|
if (lstatError !== null) {
|
|
4286
4371
|
callFailureCallback(callback, lstatError);
|
|
@@ -4306,7 +4391,7 @@ var require_async = __commonJS({
|
|
|
4306
4391
|
});
|
|
4307
4392
|
});
|
|
4308
4393
|
}
|
|
4309
|
-
exports.read =
|
|
4394
|
+
exports.read = read2;
|
|
4310
4395
|
function callFailureCallback(callback, error2) {
|
|
4311
4396
|
callback(error2);
|
|
4312
4397
|
}
|
|
@@ -4323,7 +4408,7 @@ var require_sync = __commonJS({
|
|
|
4323
4408
|
init_utils();
|
|
4324
4409
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4325
4410
|
exports.read = void 0;
|
|
4326
|
-
function
|
|
4411
|
+
function read2(path, settings) {
|
|
4327
4412
|
const lstat = settings.fs.lstatSync(path);
|
|
4328
4413
|
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
|
4329
4414
|
return lstat;
|
|
@@ -4341,7 +4426,7 @@ var require_sync = __commonJS({
|
|
|
4341
4426
|
throw error2;
|
|
4342
4427
|
}
|
|
4343
4428
|
}
|
|
4344
|
-
exports.read =
|
|
4429
|
+
exports.read = read2;
|
|
4345
4430
|
}
|
|
4346
4431
|
});
|
|
4347
4432
|
|
|
@@ -4575,14 +4660,14 @@ var require_async2 = __commonJS({
|
|
|
4575
4660
|
var constants_1 = require_constants3();
|
|
4576
4661
|
var utils = require_utils4();
|
|
4577
4662
|
var common = require_common();
|
|
4578
|
-
function
|
|
4663
|
+
function read2(directory, settings, callback) {
|
|
4579
4664
|
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
4580
4665
|
readdirWithFileTypes(directory, settings, callback);
|
|
4581
4666
|
return;
|
|
4582
4667
|
}
|
|
4583
4668
|
readdir(directory, settings, callback);
|
|
4584
4669
|
}
|
|
4585
|
-
exports.read =
|
|
4670
|
+
exports.read = read2;
|
|
4586
4671
|
function readdirWithFileTypes(directory, settings, callback) {
|
|
4587
4672
|
settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
|
|
4588
4673
|
if (readdirError !== null) {
|
|
@@ -4685,13 +4770,13 @@ var require_sync2 = __commonJS({
|
|
|
4685
4770
|
var constants_1 = require_constants3();
|
|
4686
4771
|
var utils = require_utils4();
|
|
4687
4772
|
var common = require_common();
|
|
4688
|
-
function
|
|
4773
|
+
function read2(directory, settings) {
|
|
4689
4774
|
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
4690
4775
|
return readdirWithFileTypes(directory, settings);
|
|
4691
4776
|
}
|
|
4692
4777
|
return readdir(directory, settings);
|
|
4693
4778
|
}
|
|
4694
|
-
exports.read =
|
|
4779
|
+
exports.read = read2;
|
|
4695
4780
|
function readdirWithFileTypes(directory, settings) {
|
|
4696
4781
|
const dirents = settings.fs.readdirSync(directory, { withFileTypes: true });
|
|
4697
4782
|
return dirents.map((dirent) => {
|
|
@@ -7496,6 +7581,119 @@ var init_PathResolver = __esm({
|
|
|
7496
7581
|
}
|
|
7497
7582
|
});
|
|
7498
7583
|
|
|
7584
|
+
// packages/tooling/src/utils/errors.ts
|
|
7585
|
+
var DoNotDevError;
|
|
7586
|
+
var init_errors = __esm({
|
|
7587
|
+
"packages/tooling/src/utils/errors.ts"() {
|
|
7588
|
+
"use strict";
|
|
7589
|
+
init_utils();
|
|
7590
|
+
DoNotDevError = class _DoNotDevError extends Error {
|
|
7591
|
+
/** The error code categorizing this error */
|
|
7592
|
+
code;
|
|
7593
|
+
/** Original error if this is wrapping another error */
|
|
7594
|
+
originalError;
|
|
7595
|
+
/** Additional context for the error */
|
|
7596
|
+
context;
|
|
7597
|
+
/** Whether this error should be displayed to the user */
|
|
7598
|
+
displayable;
|
|
7599
|
+
/**
|
|
7600
|
+
* Creates a new DoNotDev error
|
|
7601
|
+
*
|
|
7602
|
+
* @param {string} message - Error message
|
|
7603
|
+
* @param {DoNotDevErrorCode} code - Error code
|
|
7604
|
+
* @param {object} [options] - Additional error options
|
|
7605
|
+
* @param {Error} [options.originalError] - Original error if wrapping
|
|
7606
|
+
* @param {Record<string, any>} [options.context] - Additional context data
|
|
7607
|
+
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
7608
|
+
*/
|
|
7609
|
+
constructor(message, code = "unknown-error", options) {
|
|
7610
|
+
super(message);
|
|
7611
|
+
this.name = "DoNotDevError";
|
|
7612
|
+
this.code = code;
|
|
7613
|
+
this.originalError = options?.originalError;
|
|
7614
|
+
this.context = options?.context;
|
|
7615
|
+
this.displayable = options?.displayable !== false;
|
|
7616
|
+
Object.setPrototypeOf(this, _DoNotDevError.prototype);
|
|
7617
|
+
if (Error.captureStackTrace) {
|
|
7618
|
+
Error.captureStackTrace(this, _DoNotDevError);
|
|
7619
|
+
}
|
|
7620
|
+
}
|
|
7621
|
+
/**
|
|
7622
|
+
* Formats the error for logging or display
|
|
7623
|
+
*
|
|
7624
|
+
* @returns {string} Formatted error message with code
|
|
7625
|
+
*/
|
|
7626
|
+
format() {
|
|
7627
|
+
return `[${this.code}] ${this.message}`;
|
|
7628
|
+
}
|
|
7629
|
+
/**
|
|
7630
|
+
* Creates a wrapped error from another error
|
|
7631
|
+
*
|
|
7632
|
+
* @param {Error} error - Original error to wrap
|
|
7633
|
+
* @param {string} [context] - Additional context for the error
|
|
7634
|
+
* @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
|
|
7635
|
+
* @param {object} [options] - Additional error options
|
|
7636
|
+
* @param {Record<string, any>} [options.context] - Additional context data
|
|
7637
|
+
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
7638
|
+
* @returns {DoNotDevError} New DoNotDev error wrapping the original
|
|
7639
|
+
*/
|
|
7640
|
+
static from(error2, context, code = "unknown-error", options) {
|
|
7641
|
+
if (!(error2 instanceof Error)) {
|
|
7642
|
+
return new _DoNotDevError(
|
|
7643
|
+
`Unknown error: ${String(error2)}`,
|
|
7644
|
+
code,
|
|
7645
|
+
options
|
|
7646
|
+
);
|
|
7647
|
+
}
|
|
7648
|
+
if (error2 instanceof _DoNotDevError) {
|
|
7649
|
+
if (!context) {
|
|
7650
|
+
return error2;
|
|
7651
|
+
}
|
|
7652
|
+
return new _DoNotDevError(`${context}: ${error2.message}`, error2.code, {
|
|
7653
|
+
originalError: error2.originalError || error2,
|
|
7654
|
+
context: { ...error2.context, ...options?.context || {} },
|
|
7655
|
+
displayable: options?.displayable ?? error2.displayable
|
|
7656
|
+
});
|
|
7657
|
+
}
|
|
7658
|
+
const message = context ? `${context}: ${error2.message}` : error2.message;
|
|
7659
|
+
return new _DoNotDevError(message, code, {
|
|
7660
|
+
originalError: error2,
|
|
7661
|
+
context: options?.context,
|
|
7662
|
+
displayable: options?.displayable
|
|
7663
|
+
});
|
|
7664
|
+
}
|
|
7665
|
+
/**
|
|
7666
|
+
* Maps common error types to DoNotDevErrorCode
|
|
7667
|
+
*
|
|
7668
|
+
* @param {Error} error - Error to analyze
|
|
7669
|
+
* @returns {DoNotDevErrorCode} Mapped error code
|
|
7670
|
+
*/
|
|
7671
|
+
static getErrorCodeFromError(error2) {
|
|
7672
|
+
if (error2 instanceof _DoNotDevError) {
|
|
7673
|
+
return error2.code;
|
|
7674
|
+
}
|
|
7675
|
+
const message = error2.message.toLowerCase();
|
|
7676
|
+
if (error2.name === "ValidationError" || message.includes("validation")) {
|
|
7677
|
+
return "validation-error";
|
|
7678
|
+
}
|
|
7679
|
+
if (message.includes("not found") || message.includes("no such file")) {
|
|
7680
|
+
return "file-not-found";
|
|
7681
|
+
}
|
|
7682
|
+
if (message.includes("permission") || message.includes("access denied")) {
|
|
7683
|
+
return "permission-denied";
|
|
7684
|
+
}
|
|
7685
|
+
if (message.includes("timeout") || message.includes("timed out")) {
|
|
7686
|
+
return "timeout-error";
|
|
7687
|
+
}
|
|
7688
|
+
if (message.includes("dependency") || message.includes("module not found")) {
|
|
7689
|
+
return "dependency-error";
|
|
7690
|
+
}
|
|
7691
|
+
return "unknown-error";
|
|
7692
|
+
}
|
|
7693
|
+
};
|
|
7694
|
+
}
|
|
7695
|
+
});
|
|
7696
|
+
|
|
7499
7697
|
// packages/tooling/src/utils/pathResolver.ts
|
|
7500
7698
|
import { createRequire as createRequire2 } from "node:module";
|
|
7501
7699
|
import {
|
|
@@ -7520,6 +7718,33 @@ function detectExecutionMode() {
|
|
|
7520
7718
|
}
|
|
7521
7719
|
return "published";
|
|
7522
7720
|
}
|
|
7721
|
+
async function glob(pattern, options = {}) {
|
|
7722
|
+
const patterns = Array.isArray(pattern) ? pattern : [pattern];
|
|
7723
|
+
const cwd = options.cwd || pathResolverInstance.getAppRoot() || process.cwd();
|
|
7724
|
+
const normalizeCwd = pathResolverInstance.normalizePath(cwd);
|
|
7725
|
+
const relativePatterns = patterns.map((p2) => {
|
|
7726
|
+
const normalizedPattern = pathResolverInstance.normalizePath(p2);
|
|
7727
|
+
if (normalizedPattern.startsWith(normalizeCwd)) {
|
|
7728
|
+
return normalizedPattern.slice(normalizeCwd.length + 1);
|
|
7729
|
+
}
|
|
7730
|
+
if (normalizedPattern.startsWith("/") || /^[A-Z]:/.test(normalizedPattern)) {
|
|
7731
|
+
return normalizedPattern;
|
|
7732
|
+
}
|
|
7733
|
+
return normalizedPattern;
|
|
7734
|
+
});
|
|
7735
|
+
const shouldReturnAbsolute = options.absolute === true;
|
|
7736
|
+
return await pathResolverInstance._globWithNormalization(relativePatterns, {
|
|
7737
|
+
cwd,
|
|
7738
|
+
absolute: shouldReturnAbsolute,
|
|
7739
|
+
onlyFiles: options.nodir !== false && options.onlyDirectories !== true,
|
|
7740
|
+
onlyDirectories: options.onlyDirectories,
|
|
7741
|
+
ignore: options.ignore,
|
|
7742
|
+
dot: options.dot,
|
|
7743
|
+
braceExpansion: true,
|
|
7744
|
+
extglob: true,
|
|
7745
|
+
globstar: true
|
|
7746
|
+
});
|
|
7747
|
+
}
|
|
7523
7748
|
function globSync(pattern, options = {}) {
|
|
7524
7749
|
const patterns = Array.isArray(pattern) ? pattern : [pattern];
|
|
7525
7750
|
const cwd = options.cwd || pathResolverInstance.getAppRoot() || process.cwd();
|
|
@@ -7551,7 +7776,7 @@ function globSync(pattern, options = {}) {
|
|
|
7551
7776
|
});
|
|
7552
7777
|
return results.map((p2) => pathResolverInstance.normalizePath(p2));
|
|
7553
7778
|
}
|
|
7554
|
-
var pathResolverInstance, getRepoRoot, getAppRoot, normalizePath, pathExists, readSync, writeSync, getRelativePathBetween, joinPath;
|
|
7779
|
+
var pathResolverInstance, getRepoRoot, getAppRoot, normalizePath, pathExists, read, readSync, write, writeSync, ensureDir, getRelativePathBetween, getDirname, joinPath;
|
|
7555
7780
|
var init_pathResolver = __esm({
|
|
7556
7781
|
"packages/tooling/src/utils/pathResolver.ts"() {
|
|
7557
7782
|
"use strict";
|
|
@@ -7564,11 +7789,17 @@ var init_pathResolver = __esm({
|
|
|
7564
7789
|
return pathResolverInstance.normalizePath(join2(...pathSegments));
|
|
7565
7790
|
};
|
|
7566
7791
|
pathExists = (filePath, silent = false) => pathResolverInstance.pathExists(filePath, silent);
|
|
7792
|
+
read = async (filePath, options) => pathResolverInstance.read(filePath, options);
|
|
7567
7793
|
readSync = (filePath, options) => pathResolverInstance.readSync(filePath, options);
|
|
7794
|
+
write = async (filePath, content, options) => pathResolverInstance.write(filePath, content, options);
|
|
7568
7795
|
writeSync = (filePath, content, options) => pathResolverInstance.writeSync(filePath, content, options);
|
|
7796
|
+
ensureDir = async (dirPath) => pathResolverInstance.ensureDir(dirPath);
|
|
7569
7797
|
getRelativePathBetween = (from, to) => {
|
|
7570
7798
|
return normalizePath(relative2(from, to));
|
|
7571
7799
|
};
|
|
7800
|
+
getDirname = (filePath) => {
|
|
7801
|
+
return normalizePath(dirname2(filePath));
|
|
7802
|
+
};
|
|
7572
7803
|
joinPath = (...pathSegments) => {
|
|
7573
7804
|
return normalizePath(...pathSegments);
|
|
7574
7805
|
};
|
|
@@ -7625,6 +7856,24 @@ async function askForConfirmation(message, defaultValue = false) {
|
|
|
7625
7856
|
}
|
|
7626
7857
|
return result;
|
|
7627
7858
|
}
|
|
7859
|
+
async function askForMultiSelection(message, choices, defaultIndices = []) {
|
|
7860
|
+
const options = choices.map((choice) => ({
|
|
7861
|
+
value: choice.value,
|
|
7862
|
+
label: choice.title,
|
|
7863
|
+
hint: choice.hint
|
|
7864
|
+
}));
|
|
7865
|
+
const initialValues = defaultIndices.map((i) => choices[i]?.value).filter(Boolean);
|
|
7866
|
+
const result = await fe({
|
|
7867
|
+
message,
|
|
7868
|
+
options,
|
|
7869
|
+
initialValues: initialValues.length > 0 ? initialValues : void 0
|
|
7870
|
+
});
|
|
7871
|
+
if (pD(result)) {
|
|
7872
|
+
xe("Operation cancelled.");
|
|
7873
|
+
process.exit(0);
|
|
7874
|
+
}
|
|
7875
|
+
return result;
|
|
7876
|
+
}
|
|
7628
7877
|
|
|
7629
7878
|
// packages/tooling/src/utils/matrix.ts
|
|
7630
7879
|
init_utils();
|
|
@@ -7773,6 +8022,208 @@ function compareVersions(current, expected) {
|
|
|
7773
8022
|
init_utils();
|
|
7774
8023
|
init_cli_output();
|
|
7775
8024
|
init_pathResolver();
|
|
8025
|
+
|
|
8026
|
+
// packages/tooling/src/maintenance/sync-docs.ts
|
|
8027
|
+
init_utils();
|
|
8028
|
+
init_cli_output();
|
|
8029
|
+
init_errors();
|
|
8030
|
+
init_pathResolver();
|
|
8031
|
+
var SYNC_PATHS = [
|
|
8032
|
+
// Documentation
|
|
8033
|
+
"guides/**/*.md.example",
|
|
8034
|
+
"guides/**/*.json.example",
|
|
8035
|
+
// Commands
|
|
8036
|
+
".claude/commands/**/*.md.example",
|
|
8037
|
+
// Agents
|
|
8038
|
+
".claude/agents/**/*.md.example",
|
|
8039
|
+
// Config files
|
|
8040
|
+
".claude/mcp.json.example",
|
|
8041
|
+
"CLAUDE.md.example",
|
|
8042
|
+
// MCP config
|
|
8043
|
+
".cursor/mcp.json.example",
|
|
8044
|
+
".mcp.json.example"
|
|
8045
|
+
];
|
|
8046
|
+
var PRESERVE_IF_EXISTS = [
|
|
8047
|
+
"CLAUDE.md"
|
|
8048
|
+
// User may have customized
|
|
8049
|
+
];
|
|
8050
|
+
function getInstalledCliTemplatesPath() {
|
|
8051
|
+
const appRoot = getAppRoot();
|
|
8052
|
+
if (!appRoot) return null;
|
|
8053
|
+
const cliTemplatesPath = joinPath(
|
|
8054
|
+
appRoot,
|
|
8055
|
+
"node_modules",
|
|
8056
|
+
"@donotdev",
|
|
8057
|
+
"cli",
|
|
8058
|
+
"templates",
|
|
8059
|
+
"root-consumer"
|
|
8060
|
+
);
|
|
8061
|
+
if (pathExists(cliTemplatesPath)) {
|
|
8062
|
+
return normalizePath(cliTemplatesPath);
|
|
8063
|
+
}
|
|
8064
|
+
return null;
|
|
8065
|
+
}
|
|
8066
|
+
function getFrameworkTemplatesPath() {
|
|
8067
|
+
const possiblePaths = [
|
|
8068
|
+
joinPath(process.cwd(), "..", "packages", "cli", "templates", "root-consumer"),
|
|
8069
|
+
joinPath(process.cwd(), "packages", "cli", "templates", "root-consumer")
|
|
8070
|
+
];
|
|
8071
|
+
for (const path of possiblePaths) {
|
|
8072
|
+
if (pathExists(path)) {
|
|
8073
|
+
return normalizePath(path);
|
|
8074
|
+
}
|
|
8075
|
+
}
|
|
8076
|
+
return null;
|
|
8077
|
+
}
|
|
8078
|
+
function getSourceTemplatesPath() {
|
|
8079
|
+
const installed = getInstalledCliTemplatesPath();
|
|
8080
|
+
if (installed) return installed;
|
|
8081
|
+
const framework = getFrameworkTemplatesPath();
|
|
8082
|
+
if (framework) return framework;
|
|
8083
|
+
return null;
|
|
8084
|
+
}
|
|
8085
|
+
async function syncFile(sourcePath, destPath, preserveIfExists, appRoot) {
|
|
8086
|
+
const destPathWithoutExample = destPath.endsWith(".example") ? destPath.slice(0, -8) : destPath;
|
|
8087
|
+
if (preserveIfExists && pathExists(destPathWithoutExample)) {
|
|
8088
|
+
const relativePath = getRelativePathBetween(appRoot, destPathWithoutExample);
|
|
8089
|
+
log.info(`Preserving user-customized file: ${relativePath}`);
|
|
8090
|
+
return false;
|
|
8091
|
+
}
|
|
8092
|
+
if (!pathExists(sourcePath)) {
|
|
8093
|
+
log.warn(`Source file not found: ${sourcePath}`);
|
|
8094
|
+
return false;
|
|
8095
|
+
}
|
|
8096
|
+
const content = await read(sourcePath, { format: "text" });
|
|
8097
|
+
if (!content) {
|
|
8098
|
+
log.warn(`Source file is empty: ${sourcePath}`);
|
|
8099
|
+
return false;
|
|
8100
|
+
}
|
|
8101
|
+
if (pathExists(destPathWithoutExample)) {
|
|
8102
|
+
const existingContent = await read(destPathWithoutExample, {
|
|
8103
|
+
format: "text"
|
|
8104
|
+
});
|
|
8105
|
+
if (existingContent === content) {
|
|
8106
|
+
return false;
|
|
8107
|
+
}
|
|
8108
|
+
}
|
|
8109
|
+
await ensureDir(getDirname(destPathWithoutExample));
|
|
8110
|
+
await write(destPathWithoutExample, content, { format: "text" });
|
|
8111
|
+
return true;
|
|
8112
|
+
}
|
|
8113
|
+
async function syncTemplates(sourceRoot, destRoot, dryRun) {
|
|
8114
|
+
let synced = 0;
|
|
8115
|
+
let preserved = 0;
|
|
8116
|
+
let errors = 0;
|
|
8117
|
+
const normalizedSourceRoot = normalizePath(sourceRoot);
|
|
8118
|
+
const normalizedDestRoot = normalizePath(destRoot);
|
|
8119
|
+
for (const pattern of SYNC_PATHS) {
|
|
8120
|
+
try {
|
|
8121
|
+
const sourceFiles = await glob(pattern, {
|
|
8122
|
+
cwd: normalizedSourceRoot,
|
|
8123
|
+
absolute: true,
|
|
8124
|
+
onlyFiles: true
|
|
8125
|
+
});
|
|
8126
|
+
for (const sourceFile of sourceFiles) {
|
|
8127
|
+
const relativePath = normalizePath(sourceFile).replace(
|
|
8128
|
+
normalizedSourceRoot + "/",
|
|
8129
|
+
""
|
|
8130
|
+
);
|
|
8131
|
+
const destFile = joinPath(normalizedDestRoot, relativePath);
|
|
8132
|
+
const destWithoutExample = destFile.endsWith(".example") ? destFile.slice(0, -8) : destFile;
|
|
8133
|
+
const shouldPreserve = PRESERVE_IF_EXISTS.some(
|
|
8134
|
+
(preserve) => relativePath.includes(preserve.replace(".example", ""))
|
|
8135
|
+
);
|
|
8136
|
+
if (dryRun) {
|
|
8137
|
+
if (shouldPreserve && pathExists(destWithoutExample)) {
|
|
8138
|
+
const relativeDest = getRelativePathBetween(
|
|
8139
|
+
normalizedDestRoot,
|
|
8140
|
+
destWithoutExample
|
|
8141
|
+
);
|
|
8142
|
+
log.info(`[DRY RUN] Would preserve: ${relativeDest}`);
|
|
8143
|
+
preserved++;
|
|
8144
|
+
} else {
|
|
8145
|
+
const relativeDest = getRelativePathBetween(
|
|
8146
|
+
normalizedDestRoot,
|
|
8147
|
+
destWithoutExample
|
|
8148
|
+
);
|
|
8149
|
+
log.info(`[DRY RUN] Would sync: ${relativeDest}`);
|
|
8150
|
+
synced++;
|
|
8151
|
+
}
|
|
8152
|
+
} else {
|
|
8153
|
+
const wasSynced = await syncFile(
|
|
8154
|
+
sourceFile,
|
|
8155
|
+
destFile,
|
|
8156
|
+
shouldPreserve,
|
|
8157
|
+
normalizedDestRoot
|
|
8158
|
+
);
|
|
8159
|
+
if (wasSynced) {
|
|
8160
|
+
synced++;
|
|
8161
|
+
const relativeDest = getRelativePathBetween(
|
|
8162
|
+
normalizedDestRoot,
|
|
8163
|
+
destWithoutExample
|
|
8164
|
+
);
|
|
8165
|
+
log.info(`Synced: ${relativeDest}`);
|
|
8166
|
+
} else if (shouldPreserve && pathExists(destWithoutExample)) {
|
|
8167
|
+
preserved++;
|
|
8168
|
+
}
|
|
8169
|
+
}
|
|
8170
|
+
}
|
|
8171
|
+
} catch (error2) {
|
|
8172
|
+
errors++;
|
|
8173
|
+
log.error(
|
|
8174
|
+
`Error syncing pattern ${pattern}:`,
|
|
8175
|
+
DoNotDevError.from(error2, `Failed to sync ${pattern}`, "file-operation-error")
|
|
8176
|
+
);
|
|
8177
|
+
}
|
|
8178
|
+
}
|
|
8179
|
+
return { synced, preserved, errors };
|
|
8180
|
+
}
|
|
8181
|
+
async function syncDocumentation(options = {}) {
|
|
8182
|
+
const { dryRun } = options;
|
|
8183
|
+
if (dryRun) {
|
|
8184
|
+
log.info("\u{1F50D} DRY RUN MODE - No files will be modified");
|
|
8185
|
+
}
|
|
8186
|
+
const appRoot = getAppRoot();
|
|
8187
|
+
if (!appRoot) {
|
|
8188
|
+
log.error("Could not determine project root");
|
|
8189
|
+
return 1;
|
|
8190
|
+
}
|
|
8191
|
+
const sourceRoot = getSourceTemplatesPath();
|
|
8192
|
+
if (!sourceRoot) {
|
|
8193
|
+
log.error(
|
|
8194
|
+
"Could not find framework templates. Make sure @donotdev/cli is installed."
|
|
8195
|
+
);
|
|
8196
|
+
return 1;
|
|
8197
|
+
}
|
|
8198
|
+
log.info(`Source templates: ${sourceRoot}`);
|
|
8199
|
+
log.info(`Destination: ${appRoot}`);
|
|
8200
|
+
const result = await syncTemplates(sourceRoot, appRoot, dryRun || false);
|
|
8201
|
+
if (dryRun) {
|
|
8202
|
+
log.info(`
|
|
8203
|
+
[DRY RUN] Would sync ${result.synced} file(s)`);
|
|
8204
|
+
if (result.preserved > 0) {
|
|
8205
|
+
log.info(`[DRY RUN] Would preserve ${result.preserved} user-customized file(s)`);
|
|
8206
|
+
}
|
|
8207
|
+
log.info("[DRY RUN] No files modified");
|
|
8208
|
+
} else {
|
|
8209
|
+
if (result.synced > 0) {
|
|
8210
|
+
log.success(`
|
|
8211
|
+
\u2705 Synced ${result.synced} file(s) from framework`);
|
|
8212
|
+
} else {
|
|
8213
|
+
log.info("\n\u2705 All documentation up to date");
|
|
8214
|
+
}
|
|
8215
|
+
if (result.preserved > 0) {
|
|
8216
|
+
log.info(`\u2139\uFE0F Preserved ${result.preserved} user-customized file(s)`);
|
|
8217
|
+
}
|
|
8218
|
+
if (result.errors > 0) {
|
|
8219
|
+
log.warn(`\u26A0\uFE0F ${result.errors} error(s) occurred during sync`);
|
|
8220
|
+
return 1;
|
|
8221
|
+
}
|
|
8222
|
+
}
|
|
8223
|
+
return 0;
|
|
8224
|
+
}
|
|
8225
|
+
|
|
8226
|
+
// packages/tooling/src/maintenance/bump.ts
|
|
7776
8227
|
async function queryNpmLatest(packageName) {
|
|
7777
8228
|
try {
|
|
7778
8229
|
const res = await fetch(`https://registry.npmjs.org/${packageName}/latest`);
|
|
@@ -7823,81 +8274,116 @@ function detectProjectDeps(files) {
|
|
|
7823
8274
|
}
|
|
7824
8275
|
async function main(options = {}) {
|
|
7825
8276
|
const { dryRun } = options;
|
|
7826
|
-
Ie("\u{1F504} Bump - Update framework packages");
|
|
8277
|
+
Ie("\u{1F504} Bump - Update framework packages and documentation");
|
|
7827
8278
|
if (dryRun) log.info("DRY RUN MODE");
|
|
7828
8279
|
const appRoot = getAppRoot();
|
|
7829
8280
|
if (!appRoot) {
|
|
7830
8281
|
log.error("Could not determine project root");
|
|
7831
8282
|
return 1;
|
|
7832
8283
|
}
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
const npmVersions = await queryNpmVersions(Array.from(frameworkPkgs));
|
|
7848
|
-
const matrixResult = loadMatrix();
|
|
7849
|
-
const matrixVersions = matrixResult ? flattenGroups(matrixResult.matrix.groups) : {};
|
|
7850
|
-
if (!matrixResult && externalDeps.size > 0) {
|
|
7851
|
-
log.info(
|
|
7852
|
-
"Matrix not found - only updating @donotdev/* packages (external deps skipped)"
|
|
8284
|
+
let updatePackages = false;
|
|
8285
|
+
let updateDocs = false;
|
|
8286
|
+
if (dryRun) {
|
|
8287
|
+
updatePackages = true;
|
|
8288
|
+
updateDocs = true;
|
|
8289
|
+
} else {
|
|
8290
|
+
const selections = await askForMultiSelection(
|
|
8291
|
+
"What would you like to update?",
|
|
8292
|
+
[
|
|
8293
|
+
{ title: "Update packages", value: "packages", hint: "Update @donotdev/* packages and dependencies" },
|
|
8294
|
+
{ title: "Sync documentation", value: "docs", hint: "Sync guides, commands, and agents from framework" }
|
|
8295
|
+
],
|
|
8296
|
+
[0, 1]
|
|
8297
|
+
// Both selected by default
|
|
7853
8298
|
);
|
|
8299
|
+
updatePackages = selections.includes("packages");
|
|
8300
|
+
updateDocs = selections.includes("docs");
|
|
8301
|
+
if (!updatePackages && !updateDocs) {
|
|
8302
|
+
log.info("Nothing selected. Exiting.");
|
|
8303
|
+
return 0;
|
|
8304
|
+
}
|
|
7854
8305
|
}
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
if (
|
|
7862
|
-
|
|
8306
|
+
if (updatePackages) {
|
|
8307
|
+
const files = globSync("**/package.json", {
|
|
8308
|
+
cwd: appRoot,
|
|
8309
|
+
ignore: ["**/node_modules/**", "**/dist/**", "**/.next/**"],
|
|
8310
|
+
absolute: true
|
|
8311
|
+
});
|
|
8312
|
+
if (files.length === 0) {
|
|
8313
|
+
log.warn("No package.json files found");
|
|
7863
8314
|
} else {
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
const
|
|
7870
|
-
const
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
if (
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
8315
|
+
log.info(`Found ${files.length} package.json file(s)`);
|
|
8316
|
+
const { frameworkPkgs, externalDeps, packageOccurrences } = detectProjectDeps(files);
|
|
8317
|
+
log.info(`Found ${frameworkPkgs.size} @donotdev/* package(s)`);
|
|
8318
|
+
log.info(`Found ${externalDeps.size} external dep(s)`);
|
|
8319
|
+
log.info("Querying npm...");
|
|
8320
|
+
const npmVersions = await queryNpmVersions(Array.from(frameworkPkgs));
|
|
8321
|
+
const matrixResult = loadMatrix();
|
|
8322
|
+
const matrixVersions = matrixResult ? flattenGroups(matrixResult.matrix.groups) : {};
|
|
8323
|
+
if (!matrixResult && externalDeps.size > 0) {
|
|
8324
|
+
log.info(
|
|
8325
|
+
"Matrix not found - only updating @donotdev/* packages (external deps skipped)"
|
|
8326
|
+
);
|
|
8327
|
+
}
|
|
8328
|
+
const updates = [];
|
|
8329
|
+
const majorUpdates = [];
|
|
8330
|
+
for (const [key, occurrences] of packageOccurrences) {
|
|
8331
|
+
const [name, field] = key.split(":");
|
|
8332
|
+
if (name === "@donotdev/templates") continue;
|
|
8333
|
+
let latest;
|
|
8334
|
+
if (name.startsWith("@donotdev/")) {
|
|
8335
|
+
latest = npmVersions[name];
|
|
8336
|
+
} else {
|
|
8337
|
+
latest = matrixVersions[name];
|
|
8338
|
+
}
|
|
8339
|
+
if (!latest) continue;
|
|
8340
|
+
for (const occurrence of occurrences) {
|
|
8341
|
+
const normalizedCurrent = normalizeVersion(occurrence.version);
|
|
8342
|
+
const normalizedLatest = normalizeVersion(latest);
|
|
8343
|
+
const cmp = compareVersions(normalizedCurrent, normalizedLatest);
|
|
8344
|
+
if (cmp.equal || cmp.ahead) continue;
|
|
8345
|
+
const update = {
|
|
8346
|
+
pkg: name,
|
|
8347
|
+
field,
|
|
8348
|
+
current: occurrence.version,
|
|
8349
|
+
latest,
|
|
8350
|
+
file: occurrence.file,
|
|
8351
|
+
isMajor: cmp.isMajor
|
|
8352
|
+
};
|
|
8353
|
+
if (cmp.isMajor) {
|
|
8354
|
+
const currentMajor = Number(normalizedCurrent.split(".")[0]);
|
|
8355
|
+
const latestMajor = Number(normalizedLatest.split(".")[0]);
|
|
8356
|
+
if (matrixResult) {
|
|
8357
|
+
const guide = getMigrationGuide(currentMajor, latestMajor);
|
|
8358
|
+
if (guide) {
|
|
8359
|
+
update.migrationPath = guide.path;
|
|
8360
|
+
update.breakingChanges = guide.breakingChanges;
|
|
8361
|
+
}
|
|
8362
|
+
}
|
|
8363
|
+
majorUpdates.push(update);
|
|
8364
|
+
} else {
|
|
8365
|
+
updates.push(update);
|
|
7888
8366
|
}
|
|
7889
8367
|
}
|
|
7890
|
-
|
|
8368
|
+
}
|
|
8369
|
+
if (updates.length === 0 && majorUpdates.length === 0) {
|
|
8370
|
+
log.success("All packages up to date!");
|
|
7891
8371
|
} else {
|
|
7892
|
-
updates
|
|
8372
|
+
await handlePackageUpdates(updates, majorUpdates, appRoot, dryRun || false);
|
|
7893
8373
|
}
|
|
7894
8374
|
}
|
|
7895
8375
|
}
|
|
7896
|
-
if (
|
|
7897
|
-
log.
|
|
7898
|
-
|
|
7899
|
-
|
|
8376
|
+
if (updateDocs) {
|
|
8377
|
+
log.info("\n\u{1F4DA} Syncing framework documentation...");
|
|
8378
|
+
const syncResult = await syncDocumentation({ dryRun });
|
|
8379
|
+
if (syncResult !== 0 && !dryRun) {
|
|
8380
|
+
log.warn("Some documentation files could not be synced");
|
|
8381
|
+
}
|
|
7900
8382
|
}
|
|
8383
|
+
Se("");
|
|
8384
|
+
return 0;
|
|
8385
|
+
}
|
|
8386
|
+
async function handlePackageUpdates(updates, majorUpdates, appRoot, dryRun) {
|
|
7901
8387
|
if (updates.length > 0) {
|
|
7902
8388
|
log.info(`
|
|
7903
8389
|
${updates.length} update(s) available:`);
|
|
@@ -7992,8 +8478,6 @@ Done. Updated ${updatedFiles.size} file(s). Run "bun install" to apply.`
|
|
|
7992
8478
|
}
|
|
7993
8479
|
}
|
|
7994
8480
|
}
|
|
7995
|
-
Se("");
|
|
7996
|
-
return 0;
|
|
7997
8481
|
}
|
|
7998
8482
|
export {
|
|
7999
8483
|
main
|