@tama-create/sf-tools 1.4.0-dev.1 → 1.4.0-dev.10

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.
Files changed (83) hide show
  1. package/config/changeset-types.txt +350 -0
  2. package/config/install/gitmessage +6 -0
  3. package/config/install/release/README.md +26 -0
  4. package/config/install/release/deploy-target.txt +368 -0
  5. package/config/install/release/remove-target.txt +279 -0
  6. package/config/metadata-capability.txt +118 -0
  7. package/config/metadata-dirs.txt +79 -0
  8. package/config/metasync-detect.txt +52 -0
  9. package/config/metasync-extra.txt +30 -0
  10. package/config/metasync-fingerprint.txt +90 -0
  11. package/dist/commands/index.js +7 -6
  12. package/dist/commands/launcher.js +21 -4
  13. package/dist/commands/pr.js +1 -1
  14. package/dist/commands/project.js +15 -6
  15. package/dist/commands/push.js +1 -1
  16. package/dist/commands/start.js +50 -2
  17. package/dist/commands/switch-org.js +1 -1
  18. package/dist/core/ci-sequence-steps.js +2 -2
  19. package/dist/core/ci-validate-steps.js +1 -1
  20. package/dist/core/cli-update-notice.js +47 -0
  21. package/dist/core/create-setup.js +47 -3
  22. package/dist/core/diag.js +9 -9
  23. package/dist/core/launcher-status.js +33 -2
  24. package/dist/core/log-auto.js +1 -1
  25. package/dist/core/log-box.js +32 -8
  26. package/dist/core/log-pull.js +2 -2
  27. package/dist/core/log-select.js +1 -1
  28. package/dist/core/log-start.js +2 -2
  29. package/dist/core/log-status.js +2 -2
  30. package/dist/core/metasync.js +2 -2
  31. package/dist/core/new-version.js +93 -0
  32. package/dist/core/pr.js +24 -6
  33. package/dist/core/project-status.js +20 -9
  34. package/dist/core/project-tier.js +1 -1
  35. package/dist/core/project-upgrade.js +138 -0
  36. package/dist/core/promote-check.js +46 -13
  37. package/dist/core/push.js +16 -5
  38. package/dist/core/release.js +1 -1
  39. package/dist/core/start.js +2 -2
  40. package/dist/core/update-cli.js +1 -1
  41. package/dist/io/create-deps.js +1 -0
  42. package/dist/io/job-deps.js +21 -13
  43. package/dist/io/keys.js +15 -4
  44. package/dist/io/log-deps.js +2 -1
  45. package/dist/io/metasync-deps.js +3 -2
  46. package/dist/io/promote-deps.js +4 -3
  47. package/dist/io/temp-dir.js +15 -1
  48. package/dist/io/toolbox.js +1 -1
  49. package/dist/ui/launcher.js +43 -12
  50. package/lib/apexlog.js +819 -0
  51. package/lib/metasync.js +1364 -0
  52. package/lib/package.json +4 -0
  53. package/lib/typecheck.js +547 -0
  54. package/package.json +9 -2
  55. package/templates/.forceignore +12 -0
  56. package/templates/.gitattributes +58 -0
  57. package/templates/.github/workflows/wf-metasync.yml +177 -0
  58. package/templates/.github/workflows/wf-release.yml +454 -0
  59. package/templates/.github/workflows/wf-sequence.yml +292 -0
  60. package/templates/.github/workflows/wf-validate.yml +389 -0
  61. package/templates/.prettierignore +11 -0
  62. package/templates/.prettierrc +17 -0
  63. package/templates/.vscode/extensions.json +9 -0
  64. package/templates/.vscode/launch.json +16 -0
  65. package/templates/.vscode/settings.json +39 -0
  66. package/templates/AGENTS.md +3 -0
  67. package/templates/CLAUDE.md +4 -0
  68. package/templates/README.md +11 -0
  69. package/templates/config/project-scratch-def.json +13 -0
  70. package/templates/eslint.config.js +55 -0
  71. package/templates/force-app/main/default/.gitkeep +0 -0
  72. package/templates/gitignore.template +62 -0
  73. package/templates/jest.config.js +6 -0
  74. package/templates/package.json +29 -0
  75. package/templates/scripts/apex/hello.apex +10 -0
  76. package/templates/scripts/soql/account.soql +6 -0
  77. package/templates/sf-tools/config/branches.txt +24 -0
  78. package/templates/sf-tools/config/metadata.txt +576 -0
  79. package/templates/sfdx-project.json +12 -0
  80. package/templates-ts/.github/workflows/wf-metasync.yml +109 -0
  81. package/templates-ts/.github/workflows/wf-release.yml +263 -0
  82. package/templates-ts/.github/workflows/wf-sequence.yml +153 -0
  83. package/templates-ts/.github/workflows/wf-validate.yml +185 -0
@@ -63,6 +63,6 @@ export function realToolbox() {
63
63
  out: (line) => console.log(line),
64
64
  err: (line) => console.error(line),
65
65
  },
66
- input: terminalInput(),
66
+ input: terminalInput(process.stdin, process.stderr, { stdinSecret: process.env.SFT_SECRET_STDIN === "1" }),
67
67
  };
68
68
  }
@@ -1,12 +1,15 @@
1
1
  // ランチャー(sft を引数なしで、force-* の中で打ったときのメニュー)。phases/start/launcher.sh の移し先(doc/rebuild-design.md 6.1)。
2
2
  // 項目は、サブコマンドの表(menu を持つもの)から作る。番号のキーを押すとすぐ動き(Enter は要らない)、終わるとメニューに戻る。
3
3
  // q と入力の終わりで終了(0)。範囲外の数字・ほかのキーは聞き直す。Ctrl+C は、メニューの中では無効(誤って閉じない: 6.3)。
4
+ // 何も打たずに Enter: メニューを描き直し、裏の判定をやり直す(PR のマージは先端のコミットを変えないため、保存した結果では次の段階に変わらない)。
5
+ // 判定が動いているあいだの Enter は、描き直すだけ(2 つ同時には動かさない)。
4
6
  // 見出し(core/launcher-status.ts)は、メニューを描くたびに作る。入力を 5 秒ずつ待ち、デバッグログの状態(準備中・取得中)が
5
7
  // 変わった・裏の判定(sft pr --status)が終わったら、コマンドを動かさずに描き直す(待っている入力は、そのまま続ける)。
6
8
  // 結果は 1 行: 0 →「✓ <名前>: 終わりました(成功)」/ それ以外 →「✗ <名前>: 失敗、または中断しました(終了コード N)」。
7
9
  // なくしたもの: 自分のファイルの書き換わりを見て読み込み直す動き(版を固定するため: 設計 2.4.2)。
8
- // 組織への接続・doctor・デバッグログの取得は、開く前に src/core/start.ts が行う。未了: Start の項目(sft 自身のため、今は出さない)
9
- import { apexlogState, makePaint, parseGitStatus, statusLines, targetOrg } from "../core/launcher-status.js";
10
+ // 組織への接続・doctor・デバッグログの取得は、開く前に src/core/start.ts が行う。項目 Start は、組織の接続・VS Code・doctor をやり直す(src/commands/start.ts。ランチャーは開き直さない)
11
+ import { apexlogState, makePaint, parseGitStatus, statusLines, targetOrg, uncommittedTargets } from "../core/launcher-status.js";
12
+ import { countTargets } from "../core/promote-check.js";
10
13
  const LINE = "──────────────────────────────────────────────────";
11
14
  const readOrNull = (box, path) => {
12
15
  try {
@@ -29,11 +32,23 @@ export async function runLauncher(args, box, deps) {
29
32
  }
30
33
  const { items } = deps;
31
34
  const prNumber = items.findIndex((i) => i.name === "pr") + 1;
32
- const prompt = ` 番号を入力 (1-${items.length} / q で終了): `;
33
- let checkedHead = "";
35
+ const prompt = ` 番号を入力 (1-${items.length} / Enter で再表示 / q で終了): `;
36
+ /** 裏の判定を最後に頼んだときの、先端のコミットと対象のファイルの空・空でない */
37
+ let checkedKey = "";
34
38
  let checking = false;
35
39
  let checkDone = false;
36
- const wantCheckFor = (head) => head !== "" && head !== checkedHead;
40
+ /** Enter で頼まれた判定のやり直し(次に描くとき、保存した結果を使わずに判定する) */
41
+ let recheck = false;
42
+ const wantCheckFor = (head, key) => head !== "" && key !== checkedKey;
43
+ const targetsEmpty = (branch) => {
44
+ try {
45
+ const counts = ["deploy-target.txt", "remove-target.txt"].map((f) => countTargets(box, `sf-tools/release/${branch}/${f}`));
46
+ return counts.every((n) => n === null) ? null : counts.every((n) => !n);
47
+ }
48
+ catch {
49
+ return null;
50
+ }
51
+ };
37
52
  const envBranches = () => {
38
53
  const text = readOrNull(box, "sf-tools/config/branches.txt") ?? "";
39
54
  return text
@@ -43,19 +58,29 @@ export async function runLauncher(args, box, deps) {
43
58
  };
44
59
  const draw = async () => {
45
60
  const st = await box.run("git", ["status", "--porcelain=v2", "--branch"]).catch(() => null);
46
- const git = parseGitStatus(st !== null && st.code === 0 ? st.stdout : "");
61
+ const statusText = st !== null && st.code === 0 ? st.stdout : "";
62
+ const git = parseGitStatus(statusText);
63
+ const empty = targetsEmpty(git.branch);
64
+ const key = `${git.head} ${empty}`;
65
+ const fresh = recheck && !checking && deps.startPrStatus !== null;
66
+ if (fresh)
67
+ checkedKey = "";
68
+ recheck = false;
47
69
  const { lines, wantCheck } = statusLines({
48
70
  git,
49
71
  org: targetOrg(readOrNull(box, ".sf/config.json")),
50
72
  apexlog: readOrNull(box, "logs/apex/.status"),
51
- nextStatus: readOrNull(box, "sf-tools/logs/next-status.txt"),
73
+ nextStatus: readOrNull(box, "sf-tools/logs/next-status.txt"), // 判定し直すあいだも、前回の結果を出す(「更新中」を添える)
74
+ targetsEmpty: empty,
75
+ uncommitted: uncommittedTargets(statusText, git.branch),
52
76
  envBranches: envBranches(),
53
- checking: checking || (wantCheckFor(git.head) && deps.startPrStatus !== null), // これから始める分も「確かめています」
77
+ checking: checking || (wantCheckFor(git.head, key) && deps.startPrStatus !== null), // これから始める分も「確かめています」
78
+ refresh: fresh,
54
79
  prNumber,
55
80
  }, paint);
56
- // 使える結果がない → 裏で判定する(先端のコミットごとに 1 回。失敗しても繰り返さない)
57
- if (wantCheck && wantCheckFor(git.head) && deps.startPrStatus !== null) {
58
- checkedHead = git.head;
81
+ // 使える結果がない → 裏で判定する(先端のコミットと対象の空・空でないの組ごとに 1 回。失敗しても繰り返さない)
82
+ if (wantCheck && wantCheckFor(git.head, key) && deps.startPrStatus !== null) {
83
+ checkedKey = key;
59
84
  checking = true;
60
85
  deps
61
86
  .startPrStatus()
@@ -82,7 +107,7 @@ export async function runLauncher(args, box, deps) {
82
107
  let shown = apexlogState(readOrNull(box, "logs/apex/.status"));
83
108
  let pending = box.input.readKey(prompt);
84
109
  let chosen = null;
85
- while (chosen === null) {
110
+ while (chosen === null && !recheck) {
86
111
  const got = await Promise.race([pending.then((key) => ({ key })), deps.tick().then(() => null)]);
87
112
  if (got === null) {
88
113
  // 待ち切れ: 準備中・取得中の状態が変わった・裏の判定が終わったら、描き直す(本数・期限の更新では描き直さない)
@@ -106,6 +131,10 @@ export async function runLauncher(args, box, deps) {
106
131
  err("");
107
132
  return 0;
108
133
  }
134
+ if (key === "" || key === "\r" || key === "\n") {
135
+ recheck = true;
136
+ continue;
137
+ }
109
138
  const n = /^[1-9]$/.test(key) ? Number(key) : 0;
110
139
  const item = n >= 1 && n <= items.length ? items[n - 1] : undefined;
111
140
  if (item)
@@ -113,6 +142,8 @@ export async function runLauncher(args, box, deps) {
113
142
  else
114
143
  pending = box.input.readKey(prompt); // 範囲外・ほかのキー・Ctrl+C は聞き直す
115
144
  }
145
+ if (chosen === null)
146
+ continue; // Enter: 描き直す
116
147
  err("");
117
148
  err(paint.green(` ▶ sft ${chosen.name}`));
118
149
  err("");