lumitrace 0.4.0 → 0.4.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4be2a97656c1b025f8ae4c8eacf1f1d00969f0759de4b838fdb0681610689e76
4
- data.tar.gz: a2142bb03fec41ed02668ae63c27437dfe885f874bbb758cb1b5649fde2df635
3
+ metadata.gz: 6f9613f9bc59b3d2a7c6db68d99848cd710558e4ca439f4fb53203664cfeeb6f
4
+ data.tar.gz: e0f9883071d78aa4f58464a00a41548d16acc7b54ad7370734b069e50ad3e1b8
5
5
  SHA512:
6
- metadata.gz: 42b5a8463939fe9820d9cce36bc56f2b3bb5eb2759096f975f517460d371969353a0fe322181fb7ab153eb94f388888f4118b8c9e5eebcd1b744046c778874e3
7
- data.tar.gz: f076ae99fdfd6f0f28d77f29957c504e254609b1812a265b3353c368173007bbd21570c683064b9704bf8e81c49132bef2e03f573987047c27e09229e272082b
6
+ metadata.gz: 43205f665f9ba2a569fb4557f8c404498c314fe9e8bf6af542903a2522e101d786b6088437337131d10b2a7185b26ca528da3bab051f7006ce295ef3accbf920
7
+ data.tar.gz: '08241616a2b0c65463290e4f523ff0050d473eb8516d1c3aae5bd2a5602933d27e137786a99abe5c7b4405208127300daf61122d0dcdbc9547c65da4ec0b48dc'
data/README.md CHANGED
@@ -67,6 +67,9 @@ lumitrace help --format json
67
67
  lumitrace schema --format json
68
68
  ```
69
69
 
70
+ AI-oriented usage guide (Japanese):
71
+ - `docs/tutorial.ja.md` section "AI と使う"
72
+
70
73
  ### Library
71
74
 
72
75
  Enable instrumentation and HTML output at exit:
data/docs/ai-help.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Lumitrace Help
4
4
 
5
- - Version: 0.4.0
5
+ - Version: 0.4.1
6
6
  - Help version: 1
7
7
  - Primary JSON entrypoint: `lumitrace help --format json`
8
8
  - Schema JSON entrypoint: `lumitrace schema --format json`
@@ -13,6 +13,12 @@
13
13
  - Run lumitrace with `--collect-mode` and optional `--max-samples`.
14
14
  - Inspect JSON/HTML/text outputs depending on your task.
15
15
 
16
+ ## AI Usage Tips
17
+ - First run with `--collect-mode types` to get a compact shape of runtime behavior.
18
+ - Then switch to `--collect-mode last` for final value inspection on suspicious lines.
19
+ - Use `--collect-mode history --max-samples N` only when value transitions matter.
20
+ - Combine `--range` or `--git-diff` to keep outputs small and focused.
21
+
16
22
  ## Commands
17
23
  - `lumitrace [options] script.rb [ruby_opt]`
18
24
  - Run a Ruby script with Lumitrace enabled.
data/docs/ai-schema.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Lumitrace JSON Schema
4
4
 
5
- - Version: 0.4.0
5
+ - Version: 0.4.1
6
6
  - Schema version: 1
7
7
  - Top level: array of event
8
8
 
data/docs/tutorial.ja.md CHANGED
@@ -294,6 +294,37 @@ GitHub Actions への追加手順(`LUMITRACE_GIT_DIFF` や Pages へのアッ
294
294
 
295
295
  fork/exec の結果はデフォルトでマージされます。親プロセスが最終出力を行い、子プロセスは `LUMITRACE_RESULTS_DIR` に断片 JSON を保存します。
296
296
 
297
+ ### AI と使う
298
+
299
+ AI に読ませる前提なら、次の順番にすると効率が良いです。
300
+
301
+ 1. まず型分布だけ取る(安く全体像を見る)
302
+
303
+ ```bash
304
+ lumitrace --collect-mode types -j path/to/entry.rb
305
+ ```
306
+
307
+ 2. 次に最終値を見る(値の当たりを付ける)
308
+
309
+ ```bash
310
+ lumitrace --collect-mode last -j path/to/entry.rb
311
+ ```
312
+
313
+ 3. 変化が必要な箇所だけ履歴を見る
314
+
315
+ ```bash
316
+ lumitrace --collect-mode history --max-samples 5 -j path/to/entry.rb
317
+ ```
318
+
319
+ 4. 対象を絞る(トークン節約)
320
+
321
+ ```bash
322
+ lumitrace --collect-mode last -j --range path/to/entry.rb:120-180 path/to/entry.rb
323
+ lumitrace --collect-mode last -j -g path/to/entry.rb
324
+ ```
325
+
326
+ 補助情報は `lumitrace help --format json` と `lumitrace schema --format json` で機械可読に取得できます。
327
+
297
328
  ## 2. ライブラリとして使う
298
329
 
299
330
  CLI を使わずアプリに組み込みたい場合はここから始めます。
@@ -27,6 +27,11 @@ module Lumitrace
27
27
  lines << ""
28
28
  lines << "## Recommended Flow"
29
29
  data[:recommended_flow].each { |step| lines << "- #{step}" }
30
+ if data[:ai_usage_tips] && !data[:ai_usage_tips].empty?
31
+ lines << ""
32
+ lines << "## AI Usage Tips"
33
+ data[:ai_usage_tips].each { |tip| lines << "- #{tip}" }
34
+ end
30
35
  lines << ""
31
36
  lines << "## Commands"
32
37
  data[:commands].each do |cmd|
@@ -19,6 +19,12 @@ module Lumitrace
19
19
  "Run lumitrace with `--collect-mode` and optional `--max-samples`.",
20
20
  "Inspect JSON/HTML/text outputs depending on your task."
21
21
  ],
22
+ ai_usage_tips: [
23
+ "First run with `--collect-mode types` to get a compact shape of runtime behavior.",
24
+ "Then switch to `--collect-mode last` for final value inspection on suspicious lines.",
25
+ "Use `--collect-mode history --max-samples N` only when value transitions matter.",
26
+ "Combine `--range` or `--git-diff` to keep outputs small and focused."
27
+ ],
22
28
  commands: [
23
29
  {
24
30
  command: "lumitrace [options] script.rb [ruby_opt]",
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lumitrace
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
data/runv/index.html CHANGED
@@ -4,9 +4,9 @@
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <title>LumiTrace Playground</title>
7
- <meta name="description" content="Run Ruby in the browser and see traced values inline with lumitrace 0.4.0.">
7
+ <meta name="description" content="Run Ruby in the browser and see traced values inline with lumitrace 0.4.1.">
8
8
  <meta property="og:title" content="LumiTrace Playground">
9
- <meta property="og:description" content="Run Ruby in the browser and see traced values inline with lumitrace 0.4.0.">
9
+ <meta property="og:description" content="Run Ruby in the browser and see traced values inline with lumitrace 0.4.1.">
10
10
  <meta property="og:type" content="website">
11
11
  <meta property="og:url" content="https://github.com/ko1/lumitrace/tree/master/runv">
12
12
  <meta property="og:see_also" content="https://github.com/ko1/lumitrace/tree/master/runv">
@@ -290,7 +290,7 @@
290
290
  <header>
291
291
  <div>
292
292
  <h1>LumiTrace Playground</h1>
293
- <p class="sub">Run Ruby in the browser and see traced values inline with lumitrace 0.4.0.</p>
293
+ <p class="sub">Run Ruby in the browser and see traced values inline with lumitrace 0.4.1.</p>
294
294
  </div>
295
295
  </header>
296
296
 
data/runv/sync_inline.rb CHANGED
@@ -3,8 +3,14 @@
3
3
  index_path = File.expand_path("index.html", __dir__)
4
4
  record_path = File.expand_path("../lib/lumitrace/record_instrument.rb", __dir__)
5
5
  html_path = File.expand_path("../lib/lumitrace/generate_resulted_html.rb", __dir__)
6
+ version_path = File.expand_path("../lib/lumitrace/version.rb", __dir__)
6
7
 
7
8
  index = File.read(index_path)
9
+ version_src = File.read(version_path)
10
+ version_match = version_src.match(/VERSION\s*=\s*"([^"]+)"/)
11
+ abort "VERSION not found in #{version_path}" unless version_match
12
+ version = version_match[1]
13
+
8
14
  record_code = File.read(record_path).rstrip
9
15
  html_code = File.read(html_path).lines.reject { |line|
10
16
  line.match?(/^\s*require_relative\s+["']record_instrument["']\s*$/)
@@ -25,5 +31,6 @@ unless index.match?(pattern)
25
31
  end
26
32
 
27
33
  index.sub!(pattern, generated)
34
+ index.gsub!(/lumitrace \d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?\./, "lumitrace #{version}.")
28
35
  File.write(index_path, index)
29
36
  puts "updated #{index_path}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lumitrace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koichi Sasada