git_diff_live 0.3.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.
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: explain-changes
3
+ description: Write a one or two sentence comment beside every code change in the working tree saying why it was made. The changes page (git_diff_live) draws each as a bubble next to its code, and they are committed with it. Use when you have finished changing code in a session, before your closing summary, and again after any follow-up change.
4
+ ---
5
+
6
+ # Explain Changes
7
+
8
+ The changes page (the `git_diff_live` gem) draws a comment bubble beside a change when one has been written for it. The reader is the person reviewing your work: the diff shows them what changed, the comment tells them why. You write the comments, from what you know of this session, with the gem's command line. They are kept in `.git_diff_live/comments.jsonl` and committed with the code, so the same comments show whenever that commit is compared later.
9
+
10
+ Write them when the work is finished and the diff has stopped moving. A comment is anchored to its line's text: when that code changes again the comment is dropped, and step 1 lists the change as uncommented again.
11
+
12
+ Run the commands the way this app runs Bundler.
13
+
14
+ ## 1. List the changes that have no comment
15
+
16
+ ```sh
17
+ bundle exec git_diff_live changes
18
+ ```
19
+
20
+ Each change is a run of changed lines, and each line carries its reference: `+12` is line 12 of the file as it is now, `-30` is line 30 of the file as it was. A file with no lines to show (moved unchanged, binary) is listed with the reference `file`. A long change is cut short; `--full` prints it whole, and a path narrows the list to a file or folder.
21
+
22
+ If this session made commits, compare with the commit before the first of them, here and in step 2: `--base <revision>`.
23
+
24
+ Done when you have the list.
25
+
26
+ ## 2. Write one comment for each change
27
+
28
+ ```sh
29
+ bundle exec git_diff_live comment <<'EOF'
30
+ app/models/order.rb:+41 Totals were computed before discounts applied, so a discounted order was invoiced at full price.
31
+ app/models/order.rb:-58 Nothing has called `legacy_total` since the invoice rewrite.
32
+ app/views/orders/_row.html.slim:+7 The status column was unreadable in dark mode: `text-fg-muted` instead of a fixed gray.
33
+ app/models/legacy_invoice.rb:file Deleted: invoices are built by `Invoice` since the rewrite and nothing referenced this class.
34
+ EOF
35
+ ```
36
+
37
+ One comment a line: the file's path, a colon, the reference, a space, the comment.
38
+
39
+ - **Say why, not what.** The diff already shows what changed. Give the reason: the request, bug, constraint or decision behind it, or what would go wrong without it.
40
+ - **One or two sentences**, plain text. Backticks set a name as code.
41
+ - **Anchor on the first line of the change.** The added line (`+`) when the change has one; a removal with nothing added takes its first removed line (`-`).
42
+ - **A change that is the whole file takes a comment on the file**: `path:file`, with no line. Use it for a deleted file, a moved or renamed one, a binary one, and for why a new file exists. It is drawn under the file's heading, and it does not stand in for comments on the lines of a file that was edited.
43
+ - **A long addition gets a comment for each part with its own reason**: each method of a new class, each section of a new view. `+N` is the line's number in the file as it is now, so read it off the file.
44
+ - **A change repeated across files** (a rename, a moved helper) gets the same few words each time.
45
+ - **Only what you know.** A change you did not make and cannot explain stays without a comment. A guess reads exactly like a reason.
46
+
47
+ A reference that is not a changed line is refused and the nearest changed lines are named; the rest of the batch is still written. A second comment on the same line, or on the same file, replaces the first.
48
+
49
+ ## 3. Check
50
+
51
+ Run step 1 again. Done when it prints `Every change has a comment.`, or lists only changes you chose to leave.
52
+
53
+ Do not edit `.git_diff_live/comments.jsonl` by hand, and include it in the commit that carries the code.
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: show-changes
3
+ description: Open the live side-by-side page of everything changed in the working tree, for reading a session's work before committing it.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Show Changes
8
+
9
+ The changes page (the `git_diff_live` gem, development only) draws every file that differs between the working tree and a **base** commit: old on the left, new on the right, removed in red, added in green. Staged, unstaged and untracked work all show, and the page keeps itself up to date as files change. This skill puts that page in front of the user. The page is the deliverable; the reading is theirs.
10
+
11
+ Set `PAGE` below to where this app mounts the engine.
12
+
13
+ PAGE=https://localhost:3000/changes
14
+
15
+ ## 1. Pick the base
16
+
17
+ - An argument was given (`/show-changes main`, `/show-changes HEAD~3`): that is the base.
18
+ - This session made commits: the base is the parent of the first of them (`git rev-parse <first-session-commit>^`), so committed and uncommitted work show together.
19
+ - Otherwise the base is `HEAD`: the uncommitted work.
20
+
21
+ Done when you hold one revision.
22
+
23
+ ## 2. Make sure the page answers
24
+
25
+ ```sh
26
+ curl -sk -o /dev/null -w "%{http_code}" "$PAGE?base=<base>"
27
+ ```
28
+
29
+ Leave `?base=` off for `HEAD`.
30
+
31
+ - `200`: done.
32
+ - `404` with a one-line body: it says what is wrong with the base. Correct the base and repeat.
33
+ - No answer: the server is down. Start it in the background the way this app is started, then repeat until `200`.
34
+
35
+ ## 3. Hand over the link
36
+
37
+ Reply with the URL as a link, the branch and base it compares, and, when step 2 started the server, that it is now running in the background.
metadata ADDED
@@ -0,0 +1,171 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: git_diff_live
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Tayden Miller
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: railties
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '7.1'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '7.1'
26
+ - !ruby/object:Gem::Dependency
27
+ name: actionpack
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '7.1'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '7.1'
40
+ - !ruby/object:Gem::Dependency
41
+ name: fontawesome_subsetter
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 0.1.9
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 0.1.9
54
+ - !ruby/object:Gem::Dependency
55
+ name: importmap-rails
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '2.0'
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '2.0'
68
+ - !ruby/object:Gem::Dependency
69
+ name: slim
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '5.0'
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '5.0'
82
+ - !ruby/object:Gem::Dependency
83
+ name: stimulus-rails
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '1.3'
89
+ type: :runtime
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '1.3'
96
+ - !ruby/object:Gem::Dependency
97
+ name: turbo-rails
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '2.0'
103
+ type: :runtime
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '2.0'
110
+ description: A mountable Rails engine that draws every file changed in the working
111
+ tree against a commit, old on the left and new on the right, and redraws itself
112
+ as you edit. Made for reading a session's work before committing it.
113
+ executables:
114
+ - git_diff_live
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - CHANGELOG.md
119
+ - LICENSE.txt
120
+ - README.md
121
+ - app/assets/builds/git_diff_live.css
122
+ - app/controllers/git_diff_live/application_controller.rb
123
+ - app/controllers/git_diff_live/changes_controller.rb
124
+ - app/helpers/git_diff_live/changes_helper.rb
125
+ - app/javascript/git_diff_live/application.js
126
+ - app/javascript/git_diff_live/controllers/changes_controller.js
127
+ - app/views/git_diff_live/changes/_empty.html.slim
128
+ - app/views/git_diff_live/changes/_file.html.slim
129
+ - app/views/git_diff_live/changes/_nav.html.slim
130
+ - app/views/git_diff_live/changes/_summary.html.slim
131
+ - app/views/git_diff_live/changes/file.turbo_stream.slim
132
+ - app/views/git_diff_live/changes/index.html.slim
133
+ - app/views/git_diff_live/changes/refresh.turbo_stream.slim
134
+ - app/views/layouts/git_diff_live/application.html.slim
135
+ - config/importmap.rb
136
+ - config/routes.rb
137
+ - exe/git_diff_live
138
+ - lib/git_diff_live.rb
139
+ - lib/git_diff_live/cli.rb
140
+ - lib/git_diff_live/comments.rb
141
+ - lib/git_diff_live/diff.rb
142
+ - lib/git_diff_live/engine.rb
143
+ - lib/git_diff_live/version.rb
144
+ - skills/explain-changes/SKILL.md
145
+ - skills/show-changes/SKILL.md
146
+ homepage: https://github.com/InfiniteLoopEnjoyer/git-diff-live
147
+ licenses:
148
+ - MIT
149
+ metadata:
150
+ homepage_uri: https://github.com/InfiniteLoopEnjoyer/git-diff-live
151
+ source_code_uri: https://github.com/InfiniteLoopEnjoyer/git-diff-live
152
+ changelog_uri: https://github.com/InfiniteLoopEnjoyer/git-diff-live/blob/main/CHANGELOG.md
153
+ rdoc_options: []
154
+ require_paths:
155
+ - lib
156
+ required_ruby_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '3.4'
161
+ required_rubygems_version: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ requirements: []
167
+ rubygems_version: 4.0.20
168
+ specification_version: 4
169
+ summary: A live, side-by-side page of your working tree's git changes, for Rails apps
170
+ in development.
171
+ test_files: []