@zalom/plastic 2.0.0-alpha.2 → 2.0.0-alpha.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.
- package/agents/plastic-enforcer.md +3 -1
- package/agents/plastic-executor.md +9 -3
- package/hooks/hooks.json +12 -0
- package/hooks/message-display +134 -0
- package/hooks/statusline +4 -27
- package/package.json +2 -2
- package/scripts/agent-report +8 -2
- package/scripts/dashboard.rb +297 -18
- package/scripts/doctor.rb +652 -5
- package/scripts/end-intent +219 -0
- package/scripts/hook-capture +25 -113
- package/scripts/hook-message-display +81 -0
- package/scripts/hook-record +12 -4
- package/scripts/hook-session-start +23 -1
- package/scripts/index-projection +74 -0
- package/scripts/intent-screen +77 -0
- package/scripts/lib/action_graph_shim.rb +277 -0
- package/scripts/lib/arm.rb +26 -1
- package/scripts/lib/atomic_write.rb +31 -0
- package/scripts/lib/core_integrity.rb +71 -0
- package/scripts/lib/dashboard_screen.rb +40 -0
- package/scripts/lib/day_summary.rb +7 -2
- package/scripts/lib/doctor_core.rb +101 -5
- package/scripts/lib/doctor_session_ledger.rb +52 -0
- package/scripts/lib/graph_edges.rb +121 -0
- package/scripts/lib/graph_file.rb +246 -0
- package/scripts/lib/graph_tree.rb +98 -0
- package/scripts/lib/guarded_append.rb +155 -0
- package/scripts/lib/hook_registry.rb +14 -0
- package/scripts/lib/hook_replay.rb +211 -0
- package/scripts/lib/index_projection.rb +201 -0
- package/scripts/lib/installer_core.rb +131 -4
- package/scripts/lib/intent_screen.rb +309 -0
- package/scripts/lib/intent_screen_ansi.rb +262 -0
- package/scripts/lib/message_display.rb +586 -0
- package/scripts/lib/node_file.rb +214 -0
- package/scripts/lib/node_ids.rb +99 -0
- package/scripts/lib/node_ledger.rb +377 -0
- package/scripts/lib/node_packet.rb +886 -0
- package/scripts/lib/node_return.rb +199 -0
- package/scripts/lib/node_worktree.rb +337 -0
- package/scripts/lib/outcome_report.rb +440 -0
- package/scripts/lib/packet_wrapper.rb +132 -0
- package/scripts/lib/ready_set.rb +462 -0
- package/scripts/lib/release_guard.rb +16 -0
- package/scripts/lib/report_screen.rb +1967 -0
- package/scripts/lib/roadmap_graph.rb +210 -0
- package/scripts/lib/roadmap_migration.rb +95 -0
- package/scripts/lib/roadmap_queue.rb +155 -5
- package/scripts/lib/roadmap_render.rb +150 -0
- package/scripts/lib/roadmap_savepoint.rb +62 -12
- package/scripts/lib/runner_absorb.rb +620 -0
- package/scripts/lib/runner_answer.rb +206 -0
- package/scripts/lib/runner_core.rb +194 -0
- package/scripts/lib/runner_dispatch.rb +482 -0
- package/scripts/lib/runner_policy.rb +142 -0
- package/scripts/lib/runner_proposals.rb +254 -0
- package/scripts/lib/runner_rewind.rb +201 -0
- package/scripts/lib/runner_sweep.rb +231 -0
- package/scripts/lib/savepoint.rb +149 -12
- package/scripts/lib/screen_paint.rb +555 -0
- package/scripts/lib/screens/dashboard.rb +20 -0
- package/scripts/lib/screens/plan.rb +18 -0
- package/scripts/lib/screens/roadmap.rb +15 -0
- package/scripts/lib/session_git.rb +49 -18
- package/scripts/lib/session_ledger.rb +128 -0
- package/scripts/lib/verify_intent.rb +33 -0
- package/scripts/lib/work_graph_validator.rb +201 -0
- package/scripts/node-packet +92 -0
- package/scripts/node-transition +291 -0
- package/scripts/outcome-report +74 -0
- package/scripts/plastic-lock +8 -1
- package/scripts/ready-set +126 -0
- package/scripts/release-check +118 -0
- package/scripts/report-screen +281 -0
- package/scripts/roadmap-graph +119 -0
- package/scripts/roadmap-savepoint +7 -0
- package/scripts/runner +392 -0
- package/scripts/savepoint-note +69 -0
- package/scripts/spawn-preamble +9 -2
- package/scripts/validate-work-graph +39 -0
- package/scripts/verify-intent +2 -1
- package/skills/auto/SKILL.md +24 -17
- package/skills/auto/references/human-report-contract.md +136 -54
- package/skills/conventions/references/locks-and-worktrees.md +12 -0
- package/skills/dashboard/SKILL.md +13 -2
- package/skills/dashboard/templates/dashboard-global.md +1 -1
- package/skills/dashboard/templates/dashboard-project.md +2 -2
- package/skills/doctor/SKILL.md +10 -4
- package/skills/intent-continuing/SKILL.md +51 -41
- package/skills/intent-continuing/references/board-fill.md +9 -0
- package/skills/intent-continuing/references/boarding-matrix.md +6 -5
- package/skills/intent-continuing/references/context-management.md +1 -1
- package/skills/intent-ending/SKILL.md +36 -16
- package/skills/intent-executing/SKILL.md +17 -5
- package/skills/intent-executing/implementer-prompt.md +6 -1
- package/skills/intent-speccing/SKILL.md +7 -4
- package/skills/releasing/SKILL.md +39 -0
- package/skills/releasing/references/promotion-and-tagging.md +10 -6
- package/skills/releasing/references/release-lines.md +1 -1
- package/skills/roadmap/SKILL.md +26 -0
- package/skills/roadmap/references/file-format.md +10 -0
- package/templates/dashboard-screen.md +22 -0
- package/templates/display-fixture.md +21 -0
- package/templates/graph.md +16 -0
- package/templates/intent-screen.md +17 -0
- package/templates/node-decision.md +11 -0
- package/templates/node-research.md +11 -0
- package/templates/node-verify.md +13 -0
- package/templates/node-work.md +22 -0
- package/templates/outcome.md +19 -1
- package/templates/report-plan.md +15 -0
- package/templates/report-roadmap-delivered.md +10 -0
- package/templates/report-roadmap-plan.md +9 -0
- package/templates/report-roadmap-state.md +9 -0
- package/templates/report-state.md +11 -0
- package/templates/roadmap.md +13 -0
package/scripts/lib/savepoint.rb
CHANGED
|
@@ -23,6 +23,36 @@ module Savepoint
|
|
|
23
23
|
# (<id>--<slug>.md) is never sentineled; it is born complete.
|
|
24
24
|
PLACEHOLDER_SENTINEL = "<!-- plastic:placeholder -->"
|
|
25
25
|
|
|
26
|
+
# --- Node-graph transition subject vocabulary (intent 335, spec D17) -------
|
|
27
|
+
#
|
|
28
|
+
# Owned HERE, not on NodeLedger, because test/savepoint_split_test.rb:57 pins
|
|
29
|
+
# savepoint.rb to loading no other project file: NodeLedger requires this
|
|
30
|
+
# file and reuses these three names rather than duplicating them, so the
|
|
31
|
+
# dependency runs one way only. Intent 334 (G1) mints node ids and must
|
|
32
|
+
# agree with NODE_SUBJECT_RE: it is the single seam for the node id shape.
|
|
33
|
+
|
|
34
|
+
# The literal subject token for an intent-scope transition line ("Intent
|
|
35
|
+
# needs_decision question=..."), as opposed to a node-scope line.
|
|
36
|
+
INTENT_SUBJECT = "Intent"
|
|
37
|
+
|
|
38
|
+
# A node id: one or two lowercase letters (the node's kind prefix, e.g. "n"
|
|
39
|
+
# for work, "v" for verify) followed by digits.
|
|
40
|
+
NODE_SUBJECT_RE = /\A[a-z]{1,2}\d+\z/.freeze
|
|
41
|
+
|
|
42
|
+
# True iff a raw savepoint ledger line's subject (field 2, split on
|
|
43
|
+
# /\s{2,}/) is a transition candidate: the literal Intent token or a node
|
|
44
|
+
# id. A stage line ("How checklist.md created") or a Lock takeover audit
|
|
45
|
+
# line never matches, by construction (spec Acceptance Criteria: "no stage
|
|
46
|
+
# token this tree writes collides with Intent or with the node id
|
|
47
|
+
# pattern").
|
|
48
|
+
def self.transition_candidate?(line)
|
|
49
|
+
parts = line.to_s.split(/\s{2,}/)
|
|
50
|
+
return false unless parts.length >= 2
|
|
51
|
+
|
|
52
|
+
subject = parts[1]
|
|
53
|
+
subject == INTENT_SUBJECT || subject.match?(NODE_SUBJECT_RE)
|
|
54
|
+
end
|
|
55
|
+
|
|
26
56
|
def self.intent_file(intent_dir)
|
|
27
57
|
dir_name = File.basename(intent_dir)
|
|
28
58
|
"#{intent_dir}/#{dir_name}.md"
|
|
@@ -57,22 +87,47 @@ module Savepoint
|
|
|
57
87
|
File.exist?(path)
|
|
58
88
|
end
|
|
59
89
|
|
|
60
|
-
# True iff actions/ holds AT LEAST ONE real
|
|
61
|
-
# first line
|
|
62
|
-
#
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
# reports it needs a real action file); it never raises.
|
|
66
|
-
def self.has_real_action?(intent_dir)
|
|
67
|
-
Dir.glob("#{intent_dir}/actions/*.md").any? do |f|
|
|
90
|
+
# True iff DIR_NAME (actions/ or nodes/) holds AT LEAST ONE real *.md file: non-empty,
|
|
91
|
+
# first line not the placeholder sentinel. A `.gitkeep` (no .md extension) never counts.
|
|
92
|
+
# Pure and side-effect-free; fail-open (a missing dir globs to nothing, never raises).
|
|
93
|
+
def self.has_real_files_in?(dir_name, intent_dir)
|
|
94
|
+
Dir.glob("#{intent_dir}/#{dir_name}/*.md").any? do |f|
|
|
68
95
|
File.file?(f) && File.size(f) > 0 && stage_file_present?(f)
|
|
69
96
|
end
|
|
70
97
|
rescue StandardError
|
|
71
98
|
false
|
|
72
99
|
end
|
|
73
100
|
|
|
101
|
+
# True iff the intent has at least one real action file, whether delivered as
|
|
102
|
+
# legacy actions/*.md or as a node graph's nodes/*.md (intent 334, G1, D10r):
|
|
103
|
+
# an intent delivered as nodes is exactly as real as one delivered as
|
|
104
|
+
# actions, so doctor and the exec-stage gate never report a backfill gap on
|
|
105
|
+
# a fully delivered node-graph intent. Checks actions/ first (the common
|
|
106
|
+
# path today), falling through to nodes/ only when actions/ has nothing.
|
|
107
|
+
def self.has_real_action?(intent_dir)
|
|
108
|
+
has_real_files_in?("actions", intent_dir) || has_real_files_in?("nodes", intent_dir)
|
|
109
|
+
rescue StandardError
|
|
110
|
+
false
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Intent 336 (G3, D13): a real graph.md is 327 D41's replacement for
|
|
114
|
+
# plan.md/checklist.md on the common path, so a node-shaped intent is
|
|
115
|
+
# judged on graph.md and nodes/ alone, whether or not spec.md is real - the
|
|
116
|
+
# graph IS the spec under D41. Checked using only this file's own
|
|
117
|
+
# primitives (stage_file_present?, has_real_files_in?), because
|
|
118
|
+
# test/savepoint_split_test.rb pins this file to loading no other project
|
|
119
|
+
# file and no YAML: GraphFile/NodeFile/ReadySet are never required here. An
|
|
120
|
+
# intent with no real graph.md (or a sentinel-placeholder one,
|
|
121
|
+
# stage_file_present? already reads that as absent) derives exactly what it
|
|
122
|
+
# derived before this intent.
|
|
74
123
|
def self.derive_stage(intent_dir)
|
|
75
124
|
return "done" if stage_file_present?("#{intent_dir}/outcome.md")
|
|
125
|
+
|
|
126
|
+
if stage_file_present?("#{intent_dir}/graph.md")
|
|
127
|
+
return "exec" if has_real_files_in?("nodes", intent_dir)
|
|
128
|
+
return "how"
|
|
129
|
+
end
|
|
130
|
+
|
|
76
131
|
if stage_file_present?("#{intent_dir}/plan.md") &&
|
|
77
132
|
has_real_action?(intent_dir) &&
|
|
78
133
|
stage_file_present?("#{intent_dir}/checklist.md")
|
|
@@ -87,19 +142,49 @@ module Savepoint
|
|
|
87
142
|
files = []
|
|
88
143
|
ifile = File.basename(intent_file(intent_dir))
|
|
89
144
|
files << ifile if File.exist?("#{intent_dir}/#{ifile}")
|
|
90
|
-
["spec.md", "plan.md", "checklist.md", "outcome.md"].each do |f|
|
|
145
|
+
["spec.md", "graph.md", "plan.md", "checklist.md", "outcome.md"].each do |f|
|
|
91
146
|
files << f if stage_file_present?("#{intent_dir}/#{f}")
|
|
92
147
|
end
|
|
93
|
-
|
|
148
|
+
# Name the directory that actually exists (fold B3): a nodes-only intent
|
|
149
|
+
# must never claim the literal "actions/" artifact it does not have.
|
|
150
|
+
# Checks actions/ first, matching D15r's read order.
|
|
151
|
+
if has_real_files_in?("actions", intent_dir)
|
|
152
|
+
files << "actions/"
|
|
153
|
+
elsif has_real_files_in?("nodes", intent_dir)
|
|
154
|
+
files << "nodes/"
|
|
155
|
+
end
|
|
94
156
|
files
|
|
95
157
|
end
|
|
96
158
|
|
|
97
159
|
def self.missing_for_stage(stage, intent_dir = nil)
|
|
98
160
|
ifile = intent_dir ? File.basename(intent_file(intent_dir)) : "intent.md"
|
|
161
|
+
# A How-stage intent that already started a nodes/ directory is named
|
|
162
|
+
# accordingly, so the next-step hint never tells a node-graph intent to
|
|
163
|
+
# go make an actions/ directory it will never use (fold B3). Mirrors
|
|
164
|
+
# has_real_files_in?'s actions-first order and its real-file requirement
|
|
165
|
+
# (post-execution review, non-blocking 4): an intent carrying real files
|
|
166
|
+
# in both directories, or a real actions/ file beside an empty or
|
|
167
|
+
# .gitkeep-only nodes/, is named actions/, never nodes/.
|
|
168
|
+
action_label = if intent_dir && has_real_files_in?("actions", intent_dir)
|
|
169
|
+
"actions/"
|
|
170
|
+
elsif intent_dir && has_real_files_in?("nodes", intent_dir)
|
|
171
|
+
"nodes/"
|
|
172
|
+
else
|
|
173
|
+
"actions/"
|
|
174
|
+
end
|
|
99
175
|
case stage
|
|
100
176
|
when "what" then [ifile]
|
|
101
177
|
when "why" then ["spec.md"]
|
|
102
|
-
when "how"
|
|
178
|
+
when "how"
|
|
179
|
+
# A node-shaped How intent (a real graph.md already) is named after its
|
|
180
|
+
# own two artifacts, never the three D41 removed from its path (fold
|
|
181
|
+
# B3, extended by 336 D13): checked via stage_file_present? alone, the
|
|
182
|
+
# same primitive derive_stage itself uses.
|
|
183
|
+
if intent_dir && stage_file_present?("#{intent_dir}/graph.md")
|
|
184
|
+
["graph.md", "nodes/"]
|
|
185
|
+
else
|
|
186
|
+
["plan.md", action_label, "checklist.md"]
|
|
187
|
+
end
|
|
103
188
|
when "exec" then ["outcome.md"]
|
|
104
189
|
else []
|
|
105
190
|
end
|
|
@@ -213,6 +298,32 @@ module Savepoint
|
|
|
213
298
|
append_savepoint_line(intent_dir, "Exec", "started", now)
|
|
214
299
|
end
|
|
215
300
|
|
|
301
|
+
# Append a `Review` line: one per plan-review or post-execution-review verdict
|
|
302
|
+
# (intent 317, D5/D17). Same shape as every other line, through the shared
|
|
303
|
+
# append_savepoint_line primitive, so dedup and the timestamp format never
|
|
304
|
+
# drift from the one line-writer every other kind already uses.
|
|
305
|
+
def self.append_review_savepoint(intent_dir, text, now: Time.now)
|
|
306
|
+
append_savepoint_line(intent_dir, "Review", text, now)
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
# Append a `Commit` line: one per commit landing during Exec (intent 317,
|
|
310
|
+
# D5/D17). Same primitive as append_review_savepoint above.
|
|
311
|
+
def self.append_commit_savepoint(intent_dir, text, now: Time.now)
|
|
312
|
+
append_savepoint_line(intent_dir, "Commit", text, now)
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
# The day the Report kind (below) shipped. `doctor`'s intent_reports_printed_check reads
|
|
316
|
+
# this so it never re-litigates a ledger recorded before the kind existed (intent 331f, R6).
|
|
317
|
+
REPORT_KIND_SINCE = "2026-09-05"
|
|
318
|
+
|
|
319
|
+
# Append a `Report` line: one per report screen printed (intent 331f, D2/D3). Same primitive
|
|
320
|
+
# as append_review_savepoint/append_commit_savepoint above, so the line shape, dedup, and
|
|
321
|
+
# timestamp format never drift. `savepoint_milestone` maps FILENAMES only, so a Report line
|
|
322
|
+
# is never mistaken for a file-landing lifecycle line by construction.
|
|
323
|
+
def self.append_report_savepoint(intent_dir, text, now: Time.now)
|
|
324
|
+
append_savepoint_line(intent_dir, "Report", text, now)
|
|
325
|
+
end
|
|
326
|
+
|
|
216
327
|
TERMINAL_DISPOSITIONS = %w[delivered abandoned].freeze
|
|
217
328
|
|
|
218
329
|
# Append the terminal bookend `Done delivered|abandoned`, written by the
|
|
@@ -232,6 +343,17 @@ module Savepoint
|
|
|
232
343
|
# A Plastic 1.x ledger may carry a `Tier <value>` line after the spec.md
|
|
233
344
|
# milestone (removed in 2.0, intent 304); a rebuild drops it, and the phantom
|
|
234
345
|
# detector ignores it, so a 1.x store reads clean.
|
|
346
|
+
#
|
|
347
|
+
# Every transition line (intent 335, spec D13) is preserved VERBATIM, in its
|
|
348
|
+
# original relative order, after the reconstructed stage skeleton. It is
|
|
349
|
+
# never dropped and never refused: a transition line's evidence fields
|
|
350
|
+
# (`holder=`, `expires=`, `gates=`, ...) have no file-mtime analog to
|
|
351
|
+
# reconstruct from, so refusing instead of preserving would make this method
|
|
352
|
+
# destroy the graph's only status on every intent that carries one. Relative
|
|
353
|
+
# order BETWEEN a stage line and a transition line is not preserved (safe:
|
|
354
|
+
# status is computed per subject, and the two families share no subject);
|
|
355
|
+
# relative order WITHIN the transition lines is preserved, which is what
|
|
356
|
+
# "last line per subject in file order" depends on.
|
|
235
357
|
def self.rebuild_savepoint(intent_dir)
|
|
236
358
|
ordered = [
|
|
237
359
|
File.basename(intent_file(intent_dir)),
|
|
@@ -245,7 +367,18 @@ module Savepoint
|
|
|
245
367
|
stamp = File.mtime(path).utc.iso8601
|
|
246
368
|
["#{stamp} #{stage} #{milestone}\n"]
|
|
247
369
|
end
|
|
248
|
-
|
|
370
|
+
|
|
371
|
+
savepoint_path = File.join(intent_dir, SAVEPOINT_FILE)
|
|
372
|
+
if File.exist?(savepoint_path)
|
|
373
|
+
# #scrub before scanning (post-execution review row 7.8), the same way
|
|
374
|
+
# NodeLedger.entries does (matrix 2.44): a stray non-UTF-8 byte anywhere
|
|
375
|
+
# in the ledger must not raise out of the one repair tool three doctor
|
|
376
|
+
# fix hints and maintenance-run --tool rebuild-savepoint point at.
|
|
377
|
+
transition_lines = File.read(savepoint_path).scrub.each_line.select { |raw| transition_candidate?(raw) }
|
|
378
|
+
lines += transition_lines.map { |raw| raw.end_with?("\n") ? raw : "#{raw}\n" }
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
File.write(savepoint_path, lines.join)
|
|
249
382
|
lines.length
|
|
250
383
|
end
|
|
251
384
|
|
|
@@ -294,6 +427,10 @@ module Savepoint
|
|
|
294
427
|
File.read(path).each_line do |raw|
|
|
295
428
|
line = raw.strip
|
|
296
429
|
next if line.empty?
|
|
430
|
+
# A transition line (intent 335) is never a stage phantom candidate: its
|
|
431
|
+
# own repeated-line semantics (dedup-free by design, spec D11) are
|
|
432
|
+
# NodeLedger's concern, not this detector's.
|
|
433
|
+
next if transition_candidate?(line)
|
|
297
434
|
parts = line.split(/\s{2,}/)
|
|
298
435
|
next if parts.length < 3
|
|
299
436
|
pair = [parts[1], parts[2]]
|