mcptask-rails-runner 0.3.18 → 0.3.20

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: be43b323d689bbb685fb366d755aa837dacb5a2184450ecb4192c051317d2ab1
4
- data.tar.gz: 4101e1dd5bcd1704c9d198760b0bde3a9663d02650c3a00af5ac0e35da125596
3
+ metadata.gz: 49c22bb6614a5230f35bffc56475baae278dfe014d123608339d9d64605e23e3
4
+ data.tar.gz: c57fb535d1e21a9ef10009f52231540912784fa1fe5c8011a44ae4d058649618
5
5
  SHA512:
6
- metadata.gz: 94032b0cb455e7d39f2f319b5e1983c391690c68def8788e22e16a60ee23092058ccfc4220ccac54cff6c2344d186c940b70426b99cbe7c23a352e520dc4e209
7
- data.tar.gz: 4d04d2ecc72e2593e5dc33acf12a35991b2e3199ae2ae984b6287e37f771091eb6509f63ecc7393d7c1a2fcb34a5f13d97d4630e63281a3d86ae1b753c37a3ae
6
+ metadata.gz: e17a375731c475d4acf9b38c3892d92fba6caaa7e225f89be19421537aa78d0d33b03a356fe2f6d80dd1ba549323c39092090626d5b2d2d10ddbeb5db4a0903a
7
+ data.tar.gz: 5ac712a382f98e78dc0ba1b2befb3c2751158b35fdc471faefe422126f3cd745ecc7062c4cb7617530559c179545d83cf0f19564b68f202edb6c2b04e898eb6e
data/CHANGELOG.md CHANGED
@@ -5,6 +5,125 @@ entries below describe wrapper changes only. Binary changes are listed in the
5
5
  [mcptask-releases](https://github.com/jchsoft/mcptask-releases/releases)
6
6
  release notes for the same tag.
7
7
 
8
+ ## Unreleased
9
+
10
+ ## 0.3.20
11
+
12
+ No wrapper changes. Full notes in
13
+ [mcptask-releases v0.3.20](https://github.com/jchsoft/mcptask-releases/releases/tag/v0.3.20).
14
+
15
+ **Upgrading:** run `mcptask_runner update --self` on each host, and do it for
16
+ this one rather than at leisure — the fix below can only reach a runner that is
17
+ running the new binary, and the situation it fixes keeps happening until then. A
18
+ daily process picks the new copy up at its night swap, but only once that copy
19
+ is on disk. The project bump alone still changes nothing about what the 08:00
20
+ job runs.
21
+
22
+ Binary changes carried by this version:
23
+
24
+ - A piece assigned to somebody else while this runner is working it now stops
25
+ the child, instead of being worked to the end by a runner it no longer belongs
26
+ to. The dashboard socket has always carried both halves of an assignment —
27
+ "given to you" cut an idle wait short, and "given to somebody else" reached
28
+ nothing — so a task moved between two agents was picked up by its new owner
29
+ while its old one carried on: two agents on one piece, the same branch name
30
+ pushed twice, two sets of efforts logged. The runner now abandons the piece,
31
+ says so, and goes back to the queue for one that is still its own. It is not a
32
+ reason to stop the day, and the piece is deliberately not set aside: the queue
33
+ has already stopped offering it, and it stays workable if it is handed back.
34
+ - The run log is coloured as it is read, and the file itself stays plain. The
35
+ two lines that matter in a wall of uniform text — the ones `Warn` and `Error`
36
+ already mark with a glyph — are painted red and yellow, a child's stderr is
37
+ yellow, and the `[Component]` tags, cost lines and phase separators are dimmed
38
+ so the shape of a run is visible in a scroll. Only what the runner itself
39
+ marked is coloured; guessing a severity from the wording would be wrong on the
40
+ day it mattered. Nothing is written to the file, which is what bug reports
41
+ attach and what people grep. `runner-log --paint` is the same filter over
42
+ stdin, so `tail -f any.log | runner-log --paint` works for a log read some
43
+ other way.
44
+
45
+ ## 0.3.19
46
+
47
+ **Upgrading:** `bundle update mcptask-rails-runner` in each project for the
48
+ wrapper change, and `mcptask_runner update --self` on each host for the binary
49
+ ones — the installed copy is per machine, so the project bump alone does not
50
+ change what the 08:00 job runs. Both binary changes below are prompt text sent
51
+ to the child, so they take effect on the next run the updated binary starts;
52
+ there is nothing to migrate.
53
+
54
+ - The line `Binary.install!` prints just before it hands over with `exec` is
55
+ coloured like everything the binary prints after it: green for a first
56
+ install and for the same version laid down again, yellow for replacing an
57
+ older copy, for keeping a newer one, and for `MCPTASK_RUNNER_BIN` diverting
58
+ the install. Until now it was the last grey line on the screen, sitting in
59
+ front of a coloured wall and looking like the least important thing there
60
+ while being the only line that reports a binary was replaced.
61
+
62
+ The palette is a deliberate copy of the binary's own rather than a second
63
+ opinion — `MCPTASK_RUNNER_COLOR` first and winning both ways, then
64
+ `NO_COLOR`, then `TERM=dumb`, then whether the stream is a terminal, and on
65
+ Windows the terminal has to advertise ANSI. Both halves of
66
+ `rake mcptask_runner:update` now answer that question the same way, and a
67
+ redirect or a pipe still gets exactly the bytes it got before.
68
+
69
+ Binary changes carried by this version:
70
+
71
+ - Every numbered workflow step that does real work now carries its own "LOG
72
+ PROGRESS NOW" line, and each one names the `TaskUpdate` that closes the same
73
+ step's todo item. A run on 2026-08-25 opened its pull request having logged
74
+ nothing at all, while its plan moved on the dashboard the whole time: three
75
+ anchors sat on the auto-squash spine, the seven steps between them said
76
+ nothing about logging, and the three manual workflows had no anchor anywhere
77
+ — only the block that sits past the last numbered step, which is the
78
+ arrangement already known not to get read. Hanging the log on the call the
79
+ child does make reliably is what ties the effort trail to the plan.
80
+ - The child is told to search inside the project directory and never to run
81
+ `find /` or `find ~`. That walk enters macOS's protected folders, and the
82
+ permission dialog it raises names mcptask_runner and blocks the call until it
83
+ times out — at 08:02 there is nobody there to answer it. The instruction
84
+ names where to look instead: `bundle show` / `gem which` for Ruby, `go env
85
+ GOMODCACHE` for Go.
86
+
87
+ ## 0.3.18
88
+
89
+ No wrapper changes. Full notes in
90
+ [mcptask-releases v0.3.18](https://github.com/jchsoft/mcptask-releases/releases/tag/v0.3.18).
91
+
92
+ **Upgrading:** run `mcptask_runner update --self` on each host. Both changes
93
+ below are binary behaviour, and the first of them is visible in the output of
94
+ the very command that installs it — so the run that replaces the binary is
95
+ still grey, and every run after it is not.
96
+
97
+ Binary changes carried by this version:
98
+
99
+ - The install and update output is coloured, so the one row that needs a look
100
+ no longer reads exactly like the thirty that do not: green for up-to-date
101
+ and added, yellow for updated and force-updated, red for conflict-skipped,
102
+ dimmed section tags, and warnings in red on stderr. It is decided per stream
103
+ and only when the stream is really a terminal, so a pipe, a redirect and a
104
+ launchd log get the bytes they always got; `MCPTASK_RUNNER_COLOR` and
105
+ `NO_COLOR` override.
106
+ - A child's process group is remembered when the child starts, so anything it
107
+ leaves behind is still reachable after it exits. A process group outlives
108
+ its leader, but the kernel can no longer name that group once the leader has
109
+ been reaped — and the kill path used to ask at kill time, get nothing, and
110
+ signal a bare pid that no longer resolved. Anything a child started and then
111
+ exited on went on running: a dev server, a backgrounded command, a watcher.
112
+ Nothing raised, so nothing ever reported it. This had shipped in every
113
+ version of the runner there has ever been.
114
+
115
+ ## 0.3.17
116
+
117
+ No wrapper changes, and no entry was written here at the time. Full notes in
118
+ [mcptask-releases v0.3.17](https://github.com/jchsoft/mcptask-releases/releases/tag/v0.3.17).
119
+
120
+ Nothing an operator can observe changed in the binary either. The release
121
+ carried one refactor — the event stream's assignment callback moved to a
122
+ setter so that a caller supplying its own stream gets it too — which leaves
123
+ production behaviour identical and exists so the path cannot break silently
124
+ under test. Everything else in it was the chaos stress harness, which does not
125
+ ship in the binary.
126
+
8
127
  ## 0.3.16
9
128
 
10
129
  No wrapper changes. Full notes in
data/README.md CHANGED
@@ -91,6 +91,15 @@ Go binary as-is. The only legacy task without a counterpart is
91
91
  `verbose=true` and `ignore_quota=true` environment variables are honored by
92
92
  the binary itself, exactly as before.
93
93
 
94
+ `install` and `update` print one line before handing the process over, and it
95
+ is coloured the way the binary colours everything after it: green when the
96
+ install left the machine where it already was, yellow when a binary the host
97
+ was running has just been replaced or when the version on disk was kept
98
+ instead. Only at a terminal — a pipe, a redirect and CI get the plain text
99
+ they always got. `NO_COLOR` turns it off, and `MCPTASK_RUNNER_COLOR` (`1` /
100
+ `0`) answers it either way, ahead of `NO_COLOR`. The binary reads the same two
101
+ variables.
102
+
94
103
  ## Supported platforms
95
104
 
96
105
  Platform gems exist for `arm64-darwin`, `x86_64-darwin`, `aarch64-linux`,
@@ -86,10 +86,12 @@ module McptaskRailsRunner
86
86
  # versions and one installed binary, so a project pinning an older gem must
87
87
  # not quietly drag the machine's runner backwards.
88
88
  def install!(install_dir: INSTALL_DIR, gem_root: GEM_ROOT, out: $stdout)
89
+ paint = Palette.for(out)
90
+
89
91
  override = ENV["MCPTASK_RUNNER_BIN"]
90
92
  unless override.nil? || override.empty?
91
- out.puts "[mcptask_runner] MCPTASK_RUNNER_BIN is set — running #{override} " \
92
- "and leaving #{installed_path(install_dir: install_dir)} alone."
93
+ out.puts paint.changed("[mcptask_runner] MCPTASK_RUNNER_BIN is set — running #{override} " \
94
+ "and leaving #{installed_path(install_dir: install_dir)} alone.")
93
95
  return override
94
96
  end
95
97
 
@@ -98,14 +100,20 @@ module McptaskRailsRunner
98
100
 
99
101
  existing = installed_version(target)
100
102
  if existing && existing > Gem::Version.new(VERSION)
101
- out.puts "[mcptask_runner] #{target} already holds #{existing}, which is newer than this " \
102
- "gem's #{VERSION} — keeping it. Delete that file to install this gem's binary instead."
103
+ out.puts paint.changed("[mcptask_runner] #{target} already holds #{existing}, which is newer than " \
104
+ "this gem's #{VERSION} — keeping it. Delete that file to install this " \
105
+ "gem's binary instead.")
103
106
  return target
104
107
  end
105
108
 
106
109
  copy(source, target)
107
- out.puts "[mcptask_runner] installed mcptask_runner #{VERSION} into #{target}" \
108
- "#{existing ? " (replacing #{existing})" : ''}."
110
+ # Green when this leaves the machine where it already was — a first
111
+ # install, or the same version laid down again. Yellow when a binary the
112
+ # host was running has just been replaced, which is the one line of this
113
+ # command worth stopping on.
114
+ line = "[mcptask_runner] installed mcptask_runner #{VERSION} into #{target}" \
115
+ "#{existing ? " (replacing #{existing})" : ''}."
116
+ out.puts(existing && existing < Gem::Version.new(VERSION) ? paint.changed(line) : paint.ok(line))
109
117
  target
110
118
  end
111
119
 
@@ -0,0 +1,80 @@
1
+ # frozen_string_literal: true
2
+
3
+ module McptaskRailsRunner
4
+ # Colour for the lines this gem prints before it hands the process over.
5
+ #
6
+ # `rake mcptask_runner:update` opens with Binary.install!'s line, and
7
+ # everything after it comes from the Go binary, which since 0.3.18 colours its
8
+ # own output by meaning: green when there was nothing to do, yellow when
9
+ # something moved, red when something is waiting on a decision. A grey first
10
+ # line in front of that wall reads as the least important thing on the screen,
11
+ # when it is in fact the only one that replaced a binary.
12
+ #
13
+ # The rules here are copied from internal/install/color.go in the Go repo
14
+ # rather than invented — same colours, same two environment levers, same "a
15
+ # terminal and nowhere else". Two halves of one command that disagreed about
16
+ # what NO_COLOR means would be a puzzle, not a feature.
17
+ class Palette
18
+ RESET = "\e[0m"
19
+ GREEN = "\e[32m"
20
+ YELLOW = "\e[33m"
21
+
22
+ # Values of MCPTASK_RUNNER_COLOR that settle the question, either way.
23
+ FORCE_ON = %w[1 true always force].freeze
24
+ FORCE_OFF = %w[0 false never].freeze
25
+
26
+ # Terminals that turn escape codes on for themselves and say so. A Windows
27
+ # console renders them only once virtual-terminal processing is switched on
28
+ # for its handle, and this gem is not going to call into Win32 for a
29
+ # convenience — so anything not on this list gets plain text, and
30
+ # MCPTASK_RUNNER_COLOR=1 is the way in for a console the list has not heard
31
+ # of.
32
+ WINDOWS_ANSI_HINTS = %w[WT_SESSION ANSICON ConEmuANSI TERM].freeze
33
+
34
+ # for decides how one stream should be written to.
35
+ def self.for(out, env: ENV)
36
+ new(enabled: enabled?(out, env))
37
+ end
38
+
39
+ # MCPTASK_RUNNER_COLOR is asked first and wins both ways, because it is the
40
+ # specific answer: whoever set it knows where this output is going. NO_COLOR
41
+ # is the general convention (no-color.org) — present and non-empty means no
42
+ # colour, from anything.
43
+ def self.enabled?(out, env)
44
+ specific = env["MCPTASK_RUNNER_COLOR"].to_s.downcase
45
+ return true if FORCE_ON.include?(specific)
46
+ return false if FORCE_OFF.include?(specific)
47
+ return false unless env["NO_COLOR"].to_s.empty?
48
+ return false if env["TERM"] == "dumb"
49
+ return false unless out.respond_to?(:tty?) && out.tty?
50
+
51
+ Gem.win_platform? ? WINDOWS_ANSI_HINTS.any? { |name| !env[name].to_s.empty? } : true
52
+ end
53
+
54
+ def initialize(enabled:)
55
+ @enabled = enabled
56
+ end
57
+
58
+ def enabled?
59
+ @enabled
60
+ end
61
+
62
+ # ok — this is the state you wanted; nothing to read closely.
63
+ def ok(text)
64
+ wrap(GREEN, text)
65
+ end
66
+
67
+ # changed — something moved, or what you assumed would happen did not.
68
+ def changed(text)
69
+ wrap(YELLOW, text)
70
+ end
71
+
72
+ private
73
+
74
+ def wrap(code, text)
75
+ return text unless @enabled && !text.empty?
76
+
77
+ "#{code}#{text}#{RESET}"
78
+ end
79
+ end
80
+ end
@@ -10,5 +10,5 @@ module McptaskRailsRunner
10
10
  # Binary::INSTALL_DIR. So the pin is per project and per foreground rake
11
11
  # invocation; the installed copy is per machine, and the newest binary any of
12
12
  # those projects offers is the one that stays.
13
- VERSION = "0.3.18"
13
+ VERSION = "0.3.20"
14
14
  end
@@ -14,6 +14,7 @@ module McptaskRailsRunner
14
14
  end
15
15
  end
16
16
 
17
+ require_relative "mcptask_rails_runner/palette"
17
18
  require_relative "mcptask_rails_runner/binary"
18
19
 
19
20
  # Only inside a booted Rails app — rails/railtie needs active_support loaded,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcptask-rails-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.18
4
+ version: 0.3.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josef Chmel
@@ -38,6 +38,7 @@ files:
38
38
  - lib/mcptask/rails/runner.rb
39
39
  - lib/mcptask_rails_runner.rb
40
40
  - lib/mcptask_rails_runner/binary.rb
41
+ - lib/mcptask_rails_runner/palette.rb
41
42
  - lib/mcptask_rails_runner/railtie.rb
42
43
  - lib/mcptask_rails_runner/version.rb
43
44
  - lib/tasks/mcptask_runner.rake