@kousaku-maron/diffshape 0.7.0 → 0.8.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/README.md CHANGED
@@ -35,7 +35,7 @@ npx @kousaku-maron/diffshape . main --merge-base
35
35
  | `diffshape abc1234` | そのコミット単体の変更 |
36
36
  | `diffshape staged` / `diffshape working` | ステージ済み / 未ステージの変更のみ |
37
37
 
38
- オプション: `--merge-base`、`--schema <glob>`(スキーマの SQL ファイル。省略時はリポジトリ内のすべての `atlas.hcl` の `src` を読みます。DB が複数あるときは `--schema billing=services/billing/**/*.sql` のように名前を付けます)、`--only <file|dep|db>`、`--port <n>`(デフォルト 4977、使用中なら +1)、`--host`、`--no-open`
38
+ オプション: `--merge-base`、`--schema <glob>`(スキーマの SQL ファイル。省略時はリポジトリ内のすべての `atlas.hcl` の `src` を読みます。DB が複数あるときは `--schema billing=services/billing/**/*.sql` のように名前を付けます)、`--only <file|dep|db>`、`--port <n>`(デフォルト 4977、使用中なら +1)、`--host`、`--no-open`、`--clean`(この比較のレビューコメントと確認済みのマークを消してから開く)
39
39
 
40
40
  サーバーはデフォルトで `127.0.0.1` だけで待ち受け、`localhost` / `127.0.0.1` 宛て以外のリクエストは拒否します。`--host 0.0.0.0` などを指定すると、同じネットワークの他の端末からリポジトリの構成とスキーマが見えるので注意してください。
41
41
 
@@ -2976,10 +2976,12 @@ var App = class {
2976
2976
  this.opts = opts;
2977
2977
  this.analyzers = analyzers;
2978
2978
  this.jobs = new AgentJobs(appOpts.agents ?? true);
2979
+ this.cleanId = appOpts.clean ? `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 7)}` : null;
2979
2980
  }
2980
2981
  sources;
2981
2982
  results = /* @__PURE__ */ new Map();
2982
2983
  jobs;
2984
+ cleanId;
2983
2985
  /** Resolves the comparison (errors like an unknown revision are thrown) and starts every module */
2984
2986
  async refresh() {
2985
2987
  this.sources = await resolveSources(this.cwd, this.opts);
@@ -2996,7 +2998,7 @@ var App = class {
2996
2998
  }
2997
2999
  info() {
2998
3000
  const { root, targetLabel, baseLabel, base } = this.sources;
2999
- return { repoRoot: root, targetLabel, baseLabel, baseRev: base.kind === "rev" ? base.rev : null, modules: this.analyzers.map((a) => a.id) };
3001
+ return { repoRoot: root, targetLabel, baseLabel, baseRev: base.kind === "rev" ? base.rev : null, modules: this.analyzers.map((a) => a.id), clean: this.cleanId };
3000
3002
  }
3001
3003
  result(id) {
3002
3004
  return this.results.get(id) ?? Promise.resolve({ error: `unknown module: ${id}` });
@@ -3060,7 +3062,8 @@ var COMMON = ` --merge-base compare-with \u3068 target \u306E\u5206\u5C90
3060
3062
  --port <n> \u30DD\u30FC\u30C8\u756A\u53F7\uFF08\u30C7\u30D5\u30A9\u30EB\u30C8 4977\u3001\u4F7F\u7528\u4E2D\u306A\u3089 +1\uFF09
3061
3063
  --host <host> \u5F85\u3061\u53D7\u3051\u30DB\u30B9\u30C8\uFF08\u30C7\u30D5\u30A9\u30EB\u30C8 127.0.0.1\u30020.0.0.0 \u306A\u3069\u306B\u3059\u308B\u3068\u540C\u3058\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u304B\u3089
3062
3064
  \u30EA\u30DD\u30B8\u30C8\u30EA\u306E\u69CB\u6210\u304C\u898B\u3048\u308B\u306E\u3067\u6CE8\u610F\uFF09
3063
- --no-open \u30D6\u30E9\u30A6\u30B6\u3092\u81EA\u52D5\u3067\u958B\u304B\u306A\u3044`;
3065
+ --no-open \u30D6\u30E9\u30A6\u30B6\u3092\u81EA\u52D5\u3067\u958B\u304B\u306A\u3044
3066
+ --clean \u3053\u306E\u6BD4\u8F03\u306E\u30EC\u30D3\u30E5\u30FC\u30B3\u30E1\u30F3\u30C8\u3068\u78BA\u8A8D\u6E08\u307F\u306E\u30DE\u30FC\u30AF\u3092\u6D88\u3057\u3066\u304B\u3089\u958B\u304F`;
3064
3067
  var SCHEMA = ` --schema <glob> \u30B9\u30AD\u30FC\u30DE\u306E SQL \u30D5\u30A1\u30A4\u30EB\uFF08\u8907\u6570\u6307\u5B9A\u53EF\uFF09\u3002\u7701\u7565\u6642\u306F\u30EA\u30DD\u30B8\u30C8\u30EA\u5185\u306E\u3059\u3079\u3066\u306E atlas.hcl \u306E src \u3092\u8AAD\u3080
3065
3068
  DB \u304C\u8907\u6570\u3042\u308B\u3068\u304D\u306F --schema billing=services/billing/**/*.sql \u306E\u3088\u3046\u306B\u540D\u524D\u3092\u4ED8\u3051\u308B`;
3066
3069
  var HELP = {
@@ -3131,7 +3134,7 @@ function parseArgs(argv, command) {
3131
3134
  const fail = (msg) => {
3132
3135
  throw new UsageError(msg);
3133
3136
  };
3134
- const args = { port: 4977, host: "127.0.0.1", open: true, json: false, text: false, color: !!process.stdout.isTTY && !process.env.NO_COLOR, schema: [], only: fixed };
3137
+ const args = { port: 4977, host: "127.0.0.1", open: true, clean: false, json: false, text: false, color: !!process.stdout.isTTY && !process.env.NO_COLOR, schema: [], only: fixed };
3135
3138
  const positional = [];
3136
3139
  const allowed = (opt, ok) => ok || fail(`\u4E0D\u660E\u306A\u30AA\u30D7\u30B7\u30E7\u30F3: ${opt}`);
3137
3140
  for (let i = 0; i < argv.length; i++) {
@@ -3154,6 +3157,9 @@ function parseArgs(argv, command) {
3154
3157
  case "--no-open":
3155
3158
  args.open = false;
3156
3159
  break;
3160
+ case "--clean":
3161
+ args.clean = true;
3162
+ break;
3157
3163
  case "--schema":
3158
3164
  allowed(a, !fixed || fixed === "db");
3159
3165
  args.schema.push(argv[++i] ?? fail("--schema \u306B\u306F glob \u304C\u5FC5\u8981\u3067\u3059"));
@@ -3203,7 +3209,7 @@ async function run(command, argv) {
3203
3209
  }
3204
3210
  const all = [fileAnalyzer, depAnalyzer, dbAnalyzer({ schema: args.schema })];
3205
3211
  const analyzers = args.only ? all.filter((a) => a.id === args.only) : all;
3206
- const app = new App(process.cwd(), args, analyzers, { agents: isLoopback(args.host) });
3212
+ const app = new App(process.cwd(), args, analyzers, { agents: isLoopback(args.host), clean: args.clean });
3207
3213
  try {
3208
3214
  await app.refresh();
3209
3215
  if (args.json || args.text) {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  run
4
- } from "./chunk-O2FOVHLS.js";
4
+ } from "./chunk-QXDXARRR.js";
5
5
 
6
6
  // src/bin/dbshape.ts
7
7
  void run("dbshape", process.argv.slice(2));
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  run
4
- } from "./chunk-O2FOVHLS.js";
4
+ } from "./chunk-QXDXARRR.js";
5
5
 
6
6
  // src/bin/depshape.ts
7
7
  void run("depshape", process.argv.slice(2));
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  run
4
- } from "./chunk-O2FOVHLS.js";
4
+ } from "./chunk-QXDXARRR.js";
5
5
 
6
6
  // src/bin/diffshape.ts
7
7
  void run("diffshape", process.argv.slice(2));
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  run
4
- } from "./chunk-O2FOVHLS.js";
4
+ } from "./chunk-QXDXARRR.js";
5
5
 
6
6
  // src/bin/fileshape.ts
7
7
  void run("fileshape", process.argv.slice(2));