principles 0.0.4 → 0.0.6

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.
Files changed (227) hide show
  1. checksums.yaml +4 -4
  2. data/lib/principles/after_commit_hook_options.rb +4 -1
  3. data/lib/principles/cli.rb +3 -1
  4. data/lib/principles/command_line.rb +38 -26
  5. data/lib/principles/command_routes.rb +11 -4
  6. data/lib/principles/controllers/acknowledgement.rb +93 -17
  7. data/lib/principles/controllers/answer.rb +45 -76
  8. data/lib/principles/controllers/answer_phase.rb +54 -0
  9. data/lib/principles/controllers/assessment.rb +46 -11
  10. data/lib/principles/controllers/audit.rb +17 -6
  11. data/lib/principles/controllers/audit_completion.rb +9 -5
  12. data/lib/principles/controllers/command.rb +5 -4
  13. data/lib/principles/controllers/correction.rb +22 -10
  14. data/lib/principles/controllers/full_audit_request.rb +11 -1
  15. data/lib/principles/controllers/guidance_search_paths.rb +31 -0
  16. data/lib/principles/controllers/inventory.rb +15 -29
  17. data/lib/principles/controllers/mapping.rb +9 -1
  18. data/lib/principles/controllers/member_addition.rb +65 -0
  19. data/lib/principles/controllers/member_entries.rb +6 -24
  20. data/lib/principles/controllers/member_problems_report.rb +13 -6
  21. data/lib/principles/controllers/members_a_commit_changed.rb +2 -1
  22. data/lib/principles/controllers/members_to_assess.rb +21 -13
  23. data/lib/principles/controllers/meta_principle_setup.rb +1 -1
  24. data/lib/principles/controllers/repoint.rb +22 -23
  25. data/lib/principles/controllers/survey.rb +60 -0
  26. data/lib/principles/data/audit_files.rb +4 -0
  27. data/lib/principles/data/bounded_file.rb +9 -4
  28. data/lib/principles/data/candidate_files_found.rb +48 -13
  29. data/lib/principles/data/command-steps.json +85 -24
  30. data/lib/principles/data/committed_tree.rb +84 -0
  31. data/lib/principles/data/first_parent_log.rb +48 -0
  32. data/lib/principles/data/first_parent_range.rb +122 -0
  33. data/lib/principles/data/git_command.rb +37 -0
  34. data/lib/principles/data/guidance_search_paths_file.rb +107 -0
  35. data/lib/principles/data/map_files.rb +35 -10
  36. data/lib/principles/data/principles_directory.rb +40 -0
  37. data/lib/principles/data/principles_subfolder.rb +39 -16
  38. data/lib/principles/data/project_files.rb +22 -11
  39. data/lib/principles/data/repository.rb +55 -29
  40. data/lib/principles/data/requested_candidate_files.rb +43 -0
  41. data/lib/principles/data/running_version.rb +3 -5
  42. data/lib/principles/data/schema_check.rb +16 -6
  43. data/lib/principles/data/schemas/acknowledgement-answer.schema.json +18 -5
  44. data/lib/principles/data/schemas/answer-guide.schema.json +255 -68
  45. data/lib/principles/data/schemas/audit-record.schema.json +10 -1
  46. data/lib/principles/data/schemas/command-steps.schema.json +2 -1
  47. data/lib/principles/data/schemas/correction-answer-guide.schema.json +2 -1
  48. data/lib/principles/data/schemas/correction-answer.schema.json +6 -0
  49. data/lib/principles/data/schemas/guidance-search-paths.schema.json +13 -0
  50. data/lib/principles/data/schemas/member-map-history.schema.json +20 -0
  51. data/lib/principles/data/verified_head.rb +162 -0
  52. data/lib/principles/invocation_options.rb +3 -3
  53. data/lib/principles/models/acknowledgement.rb +95 -84
  54. data/lib/principles/models/acknowledgement_left_as_printed.rb +51 -0
  55. data/lib/principles/models/acknowledgement_refusal.rb +90 -0
  56. data/lib/principles/models/answer_place.rb +4 -0
  57. data/lib/principles/models/assessment_answer.rb +0 -45
  58. data/lib/principles/models/assessment_left_as_printed.rb +81 -0
  59. data/lib/principles/models/audit_entry_protecting_map.rb +28 -0
  60. data/lib/principles/models/audit_record.rb +12 -16
  61. data/lib/principles/models/audit_records.rb +52 -23
  62. data/lib/principles/models/candidate_files.rb +44 -10
  63. data/lib/principles/models/candidate_inventory.rb +69 -8
  64. data/lib/principles/models/candidate_outline.rb +195 -0
  65. data/lib/principles/models/captured_head.rb +72 -0
  66. data/lib/principles/models/carried_member.rb +42 -0
  67. data/lib/principles/models/check_since_last_audit.rb +20 -11
  68. data/lib/principles/models/command_steps.rb +17 -1
  69. data/lib/principles/models/declared_map_changes.rb +29 -12
  70. data/lib/principles/models/declared_member_removals.rb +75 -0
  71. data/lib/principles/models/disposition.rb +4 -2
  72. data/lib/principles/models/fix_only_fields.rb +12 -0
  73. data/lib/principles/models/frontmatter_fields.rb +9 -8
  74. data/lib/principles/models/guidance_search_path.rb +26 -0
  75. data/lib/principles/models/guidance_search_paths.rb +57 -0
  76. data/lib/principles/models/instruction_named.rb +35 -0
  77. data/lib/principles/models/left_as_printed.rb +39 -0
  78. data/lib/principles/models/line_span.rb +6 -0
  79. data/lib/principles/models/loaded_files.rb +1 -2
  80. data/lib/principles/models/loading_scope.rb +61 -0
  81. data/lib/principles/models/locator.rb +6 -0
  82. data/lib/principles/models/mapped_principles.rb +39 -37
  83. data/lib/principles/models/member_assessments.rb +9 -31
  84. data/lib/principles/models/member_file.rb +20 -47
  85. data/lib/principles/models/member_hashes_as_written.rb +10 -6
  86. data/lib/principles/models/member_history.rb +7 -5
  87. data/lib/principles/models/member_lines.rb +63 -15
  88. data/lib/principles/models/member_loading_scopes.rb +49 -0
  89. data/lib/principles/models/member_loads.rb +4 -0
  90. data/lib/principles/models/member_mapping_run.rb +30 -0
  91. data/lib/principles/models/member_moves.rb +4 -0
  92. data/lib/principles/models/member_problems.rb +63 -33
  93. data/lib/principles/models/member_region.rb +129 -0
  94. data/lib/principles/models/member_repair_moves.rb +52 -0
  95. data/lib/principles/models/member_snapshots.rb +14 -1
  96. data/lib/principles/models/members_in_consecutive_sections.rb +56 -0
  97. data/lib/principles/models/meta_principle.rb +14 -0
  98. data/lib/principles/models/missing_files.rb +2 -2
  99. data/lib/principles/models/open_findings_elsewhere.rb +4 -0
  100. data/lib/principles/models/other_templates_placeholders.rb +81 -42
  101. data/lib/principles/models/outline_budget.rb +142 -0
  102. data/lib/principles/models/outline_group.rb +31 -0
  103. data/lib/principles/models/outline_section.rb +56 -0
  104. data/lib/principles/models/principle.rb +14 -7
  105. data/lib/principles/models/principle_file_revision.rb +48 -0
  106. data/lib/principles/models/principle_history.rb +46 -19
  107. data/lib/principles/models/principle_lineage.rb +118 -0
  108. data/lib/principles/models/principle_map_revision.rb +39 -0
  109. data/lib/principles/models/principle_mapping_history.rb +132 -0
  110. data/lib/principles/models/principle_members.rb +25 -0
  111. data/lib/principles/models/principle_predecessor.rb +45 -0
  112. data/lib/principles/models/principle_publication.rb +177 -0
  113. data/lib/principles/models/principle_revision.rb +104 -0
  114. data/lib/principles/models/prior_decision_fields.rb +3 -2
  115. data/lib/principles/models/prior_finding_decision.rb +14 -4
  116. data/lib/principles/models/problem_report.rb +17 -5
  117. data/lib/principles/models/project.rb +46 -39
  118. data/lib/principles/models/project_history.rb +45 -25
  119. data/lib/principles/models/quoted_change.rb +137 -0
  120. data/lib/principles/models/record_format.rb +12 -2
  121. data/lib/principles/models/recorded_entry.rb +6 -0
  122. data/lib/principles/models/recorded_hashes.rb +7 -3
  123. data/lib/principles/models/recorded_members.rb +27 -15
  124. data/lib/principles/models/refusal_before_shape.rb +21 -0
  125. data/lib/principles/models/repoint.rb +13 -0
  126. data/lib/principles/models/reported_check.rb +5 -14
  127. data/lib/principles/models/sent_answer.rb +61 -0
  128. data/lib/principles/models/shape_problems_beside.rb +40 -0
  129. data/lib/principles/models/submitted_answer.rb +34 -0
  130. data/lib/principles/models/survey_search_paths.rb +26 -0
  131. data/lib/principles/models/template_placeholders.rb +34 -4
  132. data/lib/principles/models/text_within.rb +55 -0
  133. data/lib/principles/models/unchecked_members.rb +76 -0
  134. data/lib/principles/models/uncommitted_files.rb +50 -0
  135. data/lib/principles/models/unknown_principle.rb +29 -0
  136. data/lib/principles/models/write_up_opening.rb +21 -4
  137. data/lib/principles/positional_arguments.rb +37 -0
  138. data/lib/principles/session_start_options.rb +2 -2
  139. data/lib/principles/start_audit_options.rb +19 -4
  140. data/lib/principles/version.rb +2 -2
  141. data/lib/principles/views/acknowledgement_result.rb +23 -11
  142. data/lib/principles/views/added_member.rb +41 -0
  143. data/lib/principles/views/answered_request.rb +21 -0
  144. data/lib/principles/views/assessed_members.rb +43 -10
  145. data/lib/principles/views/assessment_request.rb +91 -31
  146. data/lib/principles/views/audit_result.rb +40 -28
  147. data/lib/principles/views/candidate_files_result.rb +85 -19
  148. data/lib/principles/views/candidate_outlines_result.rb +25 -0
  149. data/lib/principles/views/check_notes.rb +44 -0
  150. data/lib/principles/views/check_result_template.rb +14 -23
  151. data/lib/principles/views/consecutive_sections_elsewhere.rb +27 -0
  152. data/lib/principles/views/correction_request.rb +32 -1
  153. data/lib/principles/views/guidance_search_paths_result.rb +26 -0
  154. data/lib/principles/views/instruction.rb +74 -0
  155. data/lib/principles/views/json_with_entries_on_lines.rb +59 -0
  156. data/lib/principles/views/loads_to_check_result.rb +2 -2
  157. data/lib/principles/views/map_added_to.rb +56 -2
  158. data/lib/principles/views/map_result.rb +23 -43
  159. data/lib/principles/views/maps_needing_members_or_audit.rb +47 -0
  160. data/lib/principles/views/member_change_since_baseline.rb +23 -5
  161. data/lib/principles/views/member_repairs.rb +22 -52
  162. data/lib/principles/views/members_a_commit_changed.rb +16 -6
  163. data/lib/principles/views/new_loading_scope.rb +31 -0
  164. data/lib/principles/views/one_member_check_result_template.rb +47 -0
  165. data/lib/principles/views/open_findings_elsewhere_result.rb +3 -3
  166. data/lib/principles/views/open_findings_line.rb +77 -23
  167. data/lib/principles/views/principle_read_result.rb +24 -29
  168. data/lib/principles/views/principles_with_no_completed_audit.rb +9 -3
  169. data/lib/principles/views/prior_findings_result.rb +23 -15
  170. data/lib/principles/views/problem_lines.rb +3 -1
  171. data/lib/principles/views/problem_result.rb +8 -3
  172. data/lib/principles/views/prompts/acknowledge-a-change/run-the-check-and-report-it-passing.md +3 -0
  173. data/lib/principles/views/prompts/acknowledge-a-change/say-whether-the-change-keeps-the-meaning.md +6 -12
  174. data/lib/principles/views/prompts/assess-every-member/answer-guide.json +67 -48
  175. data/lib/principles/views/prompts/assess-every-member/assess-each-member-and-the-set.md +0 -4
  176. data/lib/principles/views/prompts/assess-every-member/claim-an-earlier-first-raised-at.md +7 -0
  177. data/lib/principles/views/prompts/assess-every-member/decide-each-prior-finding.md +4 -16
  178. data/lib/principles/views/prompts/assess-every-member/judge-the-set-with-carried-assessments.md +5 -10
  179. data/lib/principles/views/prompts/assess-every-member/keep-or-change-what-a-deferral-waits-on.md +4 -0
  180. data/lib/principles/views/prompts/assess-every-member/read-a-compact-carried-member.md +8 -0
  181. data/lib/principles/views/prompts/assess-every-member/read-a-trimmed-instruction-whole.md +1 -0
  182. data/lib/principles/views/prompts/assess-every-member/review-a-new-or-changed-check-before-running-it.md +9 -0
  183. data/lib/principles/views/prompts/assess-every-member/say-what-observed-means.md +4 -0
  184. data/lib/principles/views/prompts/dispose-of-each-finding/answer-guide.json +1 -0
  185. data/lib/principles/views/prompts/dispose-of-each-finding/fix-or-record-each-finding.md +16 -3
  186. data/lib/principles/views/prompts/dispose-of-each-finding/retain-assessment-and-correction.md +4 -0
  187. data/lib/principles/views/prompts/find-a-principle-to-map/ask-about-other-guidance-search-paths.md +6 -0
  188. data/lib/principles/views/prompts/find-a-principle-to-map/ask-the-owner-after-the-table.md +1 -0
  189. data/lib/principles/views/prompts/find-a-principle-to-map/ask-which-principle-to-map.md +2 -0
  190. data/lib/principles/views/prompts/find-a-principle-to-map/choose-an-existing-or-new-principle.md +2 -0
  191. data/lib/principles/views/prompts/find-a-principle-to-map/choose-one-principle.md +11 -5
  192. data/lib/principles/views/prompts/find-a-principle-to-map/compare-with-mapped-principles.md +11 -0
  193. data/lib/principles/views/prompts/find-a-principle-to-map/leave-test-data-out-of-the-survey.md +1 -0
  194. data/lib/principles/views/prompts/find-a-principle-to-map/read-a-cut-section-back.md +3 -0
  195. data/lib/principles/views/prompts/find-a-principle-to-map/read-left-out-files.md +3 -0
  196. data/lib/principles/views/prompts/find-a-principle-to-map/survey-a-later-range.md +3 -0
  197. data/lib/principles/views/prompts/find-a-principle-to-map/what-each-command-writes.md +4 -4
  198. data/lib/principles/views/prompts/find-a-principle-to-map/where-the-inventory-looks.md +5 -4
  199. data/lib/principles/views/prompts/learn-what-a-command-does/add-guidance-search-path.md +17 -0
  200. data/lib/principles/views/prompts/learn-what-a-command-does/add-member.md +35 -6
  201. data/lib/principles/views/prompts/learn-what-a-command-does/create-principle.md +16 -0
  202. data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +55 -7
  203. data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +9 -8
  204. data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +10 -11
  205. data/lib/principles/views/prompts/learn-what-a-command-does/list-principles.md +1 -2
  206. data/lib/principles/views/prompts/learn-what-a-command-does/move-member.md +5 -0
  207. data/lib/principles/views/prompts/learn-what-a-command-does/remove-guidance-search-path.md +13 -0
  208. data/lib/principles/views/prompts/learn-what-a-command-does/remove-principle.md +25 -0
  209. data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +27 -1
  210. data/lib/principles/views/prompts/learn-what-a-command-does/show-candidate-outlines.md +21 -0
  211. data/lib/principles/views/prompts/learn-what-a-command-does/show-meta-principle-passage.md +5 -5
  212. data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +24 -24
  213. data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +51 -54
  214. data/lib/principles/views/prompts/read-requested-outlines/continue-the-survey.md +7 -0
  215. data/lib/principles/views/prompts/report-after-a-commit/the-principles-skill-is-where-to-start.md +1 -0
  216. data/lib/principles/views/prompts/set-principles-up/keep-them-held-between-audits.md +2 -0
  217. data/lib/principles/views/prompts/set-principles-up/name-the-step-each-member-lacks.md +2 -0
  218. data/lib/principles/views/prompts/set-principles-up/place-the-passage-with-the-user.md +9 -6
  219. data/lib/principles/views/prompts/start-a-session/see-the-earlier-line.md +2 -0
  220. data/lib/principles/views/record_waiting_on_an_upgrade.rb +3 -3
  221. data/lib/principles/views/request_part.rb +16 -8
  222. data/lib/principles/views/request_parts.rb +4 -0
  223. metadata +92 -7
  224. data/lib/principles/models/candidate_listing.rb +0 -32
  225. data/lib/principles/views/prompts/find-a-principle-to-map/ask-the-owner-before-mapping.md +0 -1
  226. data/lib/principles/views/prompts/report-after-a-commit/the-map-and-audit-skill-says-how-to-audit-these-members.md +0 -1
  227. data/lib/principles/views/prompts/set-principles-up/set-up-first.md +0 -2
@@ -7,93 +7,280 @@
7
7
  "required": ["finding", "member_delivery", "recent_decision", "reassessment", "check_result"],
8
8
  "additionalProperties": false,
9
9
  "properties": {
10
- "finding": {
11
- "type": "object",
12
- "required": ["id", "member_ids", "problem", "consequence", "proposed_action", "evidence"],
13
- "additionalProperties": false,
14
- "properties": {
15
- "id": { "type": "string" },
16
- "member_ids": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
17
- "problem": { "type": "string" },
18
- "consequence": { "type": "string" },
19
- "proposed_action": { "type": "string" },
20
- "evidence": {
21
- "type": "array",
22
- "minItems": 1,
23
- "items": {
10
+ "finding": {
11
+ "type": "object",
12
+ "required": [
13
+ "copy_to",
14
+ "copy_from",
15
+ "examples",
16
+ "notes"
17
+ ],
18
+ "additionalProperties": false,
19
+ "properties": {
20
+ "copy_to": {
21
+ "type": "string"
22
+ },
23
+ "copy_from": {
24
+ "type": "string"
25
+ },
26
+ "examples": {
27
+ "type": "object",
28
+ "required": [
29
+ "finding"
30
+ ],
31
+ "additionalProperties": false,
32
+ "properties": {
33
+ "finding": {
34
+ "type": "object",
35
+ "required": [
36
+ "id",
37
+ "member_ids",
38
+ "problem",
39
+ "consequence",
40
+ "proposed_action",
41
+ "evidence"
42
+ ],
43
+ "additionalProperties": false,
44
+ "properties": {
45
+ "id": {
46
+ "type": "string"
47
+ },
48
+ "member_ids": {
49
+ "type": "array",
50
+ "items": {
51
+ "type": "string"
52
+ },
53
+ "minItems": 1
54
+ },
55
+ "problem": {
56
+ "type": "string"
57
+ },
58
+ "consequence": {
59
+ "type": "string"
60
+ },
61
+ "proposed_action": {
62
+ "type": "string"
63
+ },
64
+ "evidence": {
65
+ "type": "array",
66
+ "minItems": 1,
67
+ "items": {
68
+ "type": "object",
69
+ "required": [
70
+ "path"
71
+ ],
72
+ "properties": {
73
+ "path": {
74
+ "type": "string"
75
+ },
76
+ "heading": {
77
+ "type": "string"
78
+ },
79
+ "starting_at": {
80
+ "type": "string"
81
+ },
82
+ "ending_at": {
83
+ "type": "string"
84
+ },
85
+ "query": {
86
+ "type": "string"
87
+ }
88
+ },
89
+ "additionalProperties": false
90
+ }
91
+ }
92
+ }
93
+ }
94
+ }
95
+ },
96
+ "notes": {
97
+ "type": "string"
98
+ }
99
+ }
100
+ },
101
+ "member_delivery": {
102
+ "type": "object",
103
+ "required": [
104
+ "copy_to",
105
+ "copy_from",
106
+ "examples",
107
+ "notes"
108
+ ],
109
+ "additionalProperties": false,
110
+ "properties": {
111
+ "copy_to": {
112
+ "type": "string"
113
+ },
114
+ "copy_from": {
115
+ "type": "string"
116
+ },
117
+ "examples": {
118
+ "type": "object",
119
+ "required": [
120
+ "not_observed",
121
+ "observed"
122
+ ],
123
+ "additionalProperties": false,
124
+ "properties": {
125
+ "not_observed": {
24
126
  "type": "object",
25
- "required": ["path"],
127
+ "required": [
128
+ "delivery"
129
+ ],
26
130
  "properties": {
27
- "path": { "type": "string" },
28
- "heading": { "type": "string" },
29
- "starting_at": { "type": "string" },
30
- "ending_at": { "type": "string" },
31
- "query": { "type": "string" }
131
+ "delivery": {
132
+ "const": "not_observed"
133
+ }
134
+ },
135
+ "additionalProperties": false
136
+ },
137
+ "observed": {
138
+ "type": "object",
139
+ "required": [
140
+ "delivery",
141
+ "observation"
142
+ ],
143
+ "properties": {
144
+ "delivery": {
145
+ "const": "observed"
146
+ },
147
+ "observation": {
148
+ "type": "string"
149
+ },
150
+ "observed_at": {
151
+ "type": [
152
+ "string",
153
+ "null"
154
+ ]
155
+ }
32
156
  },
33
157
  "additionalProperties": false
34
158
  }
35
159
  }
160
+ },
161
+ "notes": {
162
+ "type": "string"
36
163
  }
37
- },
38
- "member_delivery": {
39
- "type": "object",
40
- "required": ["not_observed", "observed"],
41
- "additionalProperties": false,
42
- "properties": {
43
- "not_observed": {
44
- "type": "object",
45
- "required": ["delivery"],
46
- "properties": { "delivery": { "const": "not_observed" } },
47
- "additionalProperties": false
48
- },
49
- "observed": {
50
- "type": "object",
51
- "required": ["delivery", "observation"],
52
- "properties": { "delivery": { "const": "observed" }, "observation": { "type": "string" },
53
- "observed_at": { "type": "string" } },
54
- "additionalProperties": false
164
+ }
165
+ },
166
+ "recent_decision": {
167
+ "type": "object",
168
+ "required": [
169
+ "copy_to",
170
+ "copy_from",
171
+ "examples"
172
+ ],
173
+ "additionalProperties": false,
174
+ "properties": {
175
+ "copy_to": {
176
+ "type": "string"
177
+ },
178
+ "copy_from": {
179
+ "type": "string"
180
+ },
181
+ "examples": {
182
+ "type": "object",
183
+ "required": [
184
+ "assessed",
185
+ "unavailable"
186
+ ],
187
+ "additionalProperties": false,
188
+ "properties": {
189
+ "assessed": {
190
+ "type": "object",
191
+ "required": [
192
+ "assessment",
193
+ "evidence"
194
+ ],
195
+ "additionalProperties": false,
196
+ "properties": {
197
+ "assessment": {
198
+ "type": "string"
199
+ },
200
+ "evidence": {
201
+ "$ref": "#/properties/finding/properties/examples/properties/finding/properties/evidence"
202
+ }
203
+ }
204
+ },
205
+ "unavailable": {
206
+ "type": "object",
207
+ "required": [
208
+ "unavailable_reason"
209
+ ],
210
+ "properties": {
211
+ "unavailable_reason": {
212
+ "type": "string"
213
+ }
214
+ },
215
+ "additionalProperties": false
216
+ }
55
217
  }
56
218
  }
57
- },
58
- "recent_decision": {
219
+ }
220
+ },
221
+ "reassessment": { "type": "string" },
222
+ "check_result": {
59
223
  "type": "object",
60
- "required": ["assessed", "unavailable"],
224
+ "required": [
225
+ "copy_to",
226
+ "copy_from",
227
+ "examples",
228
+ "limits"
229
+ ],
61
230
  "additionalProperties": false,
62
231
  "properties": {
63
- "assessed": {
232
+ "copy_to": {
233
+ "type": "string"
234
+ },
235
+ "copy_from": {
236
+ "type": "string"
237
+ },
238
+ "examples": {
64
239
  "type": "object",
65
- "required": ["assessment", "evidence"],
240
+ "required": [
241
+ "ran",
242
+ "not_run"
243
+ ],
66
244
  "additionalProperties": false,
67
245
  "properties": {
68
- "assessment": { "type": "string" },
69
- "evidence": { "$ref": "#/properties/finding/properties/evidence" }
246
+ "ran": {
247
+ "type": "object",
248
+ "required": [
249
+ "command",
250
+ "exit_status"
251
+ ],
252
+ "additionalProperties": false,
253
+ "properties": {
254
+ "command": {
255
+ "type": "string"
256
+ },
257
+ "exit_status": {
258
+ "type": "integer"
259
+ }
260
+ }
261
+ },
262
+ "not_run": {
263
+ "type": "object",
264
+ "required": [
265
+ "command",
266
+ "not_run_reason"
267
+ ],
268
+ "additionalProperties": false,
269
+ "properties": {
270
+ "command": {
271
+ "type": "string"
272
+ },
273
+ "not_run_reason": {
274
+ "type": "string"
275
+ }
276
+ }
277
+ }
70
278
  }
71
279
  },
72
- "unavailable": {
73
- "type": "object",
74
- "required": ["unavailable_reason"],
75
- "properties": { "unavailable_reason": { "type": "string" } },
76
- "additionalProperties": false
280
+ "limits": {
281
+ "type": "string"
77
282
  }
78
283
  }
79
- },
80
- "reassessment": { "type": "string" },
81
- "check_result": {
82
- "type": "object",
83
- "required": ["ran", "not_run", "limits"],
84
- "additionalProperties": false,
85
- "properties": {
86
- "ran": {
87
- "type": "object", "required": ["command", "exit_status"], "additionalProperties": false,
88
- "properties": { "command": { "type": "string" }, "exit_status": { "type": "integer" },
89
- "review_basis": { "type": "string" } }
90
- },
91
- "not_run": {
92
- "type": "object", "required": ["command", "not_run_reason"], "additionalProperties": false,
93
- "properties": { "command": { "type": "string" }, "not_run_reason": { "type": "string" } }
94
- },
95
- "limits": { "type": "string" }
96
- }
97
284
  }
98
285
  }
99
286
  }
@@ -198,7 +198,16 @@
198
198
  "reason": { "type": "string", "minLength": 1 },
199
199
  "acknowledged_at": { "type": "string", "minLength": 1 },
200
200
  "deferred_findings": { "type": "array", "items": { "type": "string", "minLength": 1 } },
201
- "accepted_findings": { "type": "array", "items": { "type": "string", "minLength": 1 } }
201
+ "accepted_findings": { "type": "array", "items": { "type": "string", "minLength": 1 } },
202
+ "check_result": {
203
+ "description": "The run of the member's check the acknowledgement's answer reported, which passed (#1112).",
204
+ "type": "object",
205
+ "required": ["command", "exit_status"],
206
+ "properties": {
207
+ "command": { "type": "string", "minLength": 1 },
208
+ "exit_status": { "type": "integer" }
209
+ }
210
+ }
202
211
  }
203
212
  }
204
213
  }
@@ -72,7 +72,8 @@
72
72
  "usage": { "$ref": "#/$defs/prose" },
73
73
  "group": { "$ref": "#/$defs/slug" },
74
74
  "options": { "type": "array", "uniqueItems": true,
75
- "items": { "enum": ["description", "path", "section", "starting-at", "ending-at", "query", "role", "check", "file", "short", "session-start", "commits-after", "hook-event", "member", "when-files", "when-invoked", "always", "write-ups", "as"] } },
75
+ "items": { "enum": ["description", "path", "section", "starting-at", "ending-at", "query", "role", "check", "file", "short", "session-start", "commits-after", "hook-event", "member", "when-files", "when-invoked", "always", "write-ups", "as", "instruction", "also", "confirm"] } },
76
+ "requires": { "type": "array", "uniqueItems": true, "items": { "enum": ["file"] } },
76
77
  "summary": { "$ref": "#/$defs/prose" },
77
78
  "help": { "type": "string", "pattern": "^[a-z]+(-[a-z]+)+/[a-z]+(-[a-z]+)+$" },
78
79
  "steps": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/step" } }
@@ -14,12 +14,13 @@
14
14
  "properties": {
15
15
  "fixed": {
16
16
  "type": "object",
17
- "required": ["action", "reason", "changed_members", "evidence", "reassessment", "recorded_at"],
17
+ "required": ["action", "reason", "changed_members", "removed_members", "evidence", "reassessment", "recorded_at"],
18
18
  "additionalProperties": false,
19
19
  "properties": {
20
20
  "action": { "const": "fixed" },
21
21
  "reason": { "type": "string", "minLength": 1 },
22
22
  "changed_members": { "type": "array", "items": { "type": "string" } },
23
+ "removed_members": { "type": "array", "items": { "type": "string" } },
23
24
  "evidence": { "type": "array", "items": { "type": "object" } },
24
25
  "reassessment": { "type": "string", "minLength": 1 },
25
26
  "recorded_at": { "type": ["object", "null"] }
@@ -272,6 +272,12 @@
272
272
  "type": "string"
273
273
  }
274
274
  },
275
+ "removed_members": {
276
+ "type": "array",
277
+ "items": {
278
+ "type": "string"
279
+ }
280
+ },
275
281
  "reassessment": {
276
282
  "type": "string"
277
283
  },
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "guidance-search-paths.schema.json",
4
+ "title": "Recorded guidance search paths",
5
+ "description": "Additional root-relative guidance globs recorded after the principles table, in the project's one .principles/guidance-search-paths.json file.",
6
+ "type": "object",
7
+ "required": ["format", "globs"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "format": { "type": "integer", "enum": [1] },
11
+ "globs": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } }
12
+ }
13
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "member-map-history.schema.json",
4
+ "title": "Linked member map history",
5
+ "description": "The additional shape of a format-3 map's exact immediate predecessor, checked beside the common member-map schema. Earlier formats keep predecessor as unknown metadata.",
6
+ "type": "object",
7
+ "required": ["format", "predecessor"],
8
+ "properties": {
9
+ "format": { "const": 3 },
10
+ "predecessor": {
11
+ "type": "object",
12
+ "required": ["principle_id", "commit"],
13
+ "additionalProperties": false,
14
+ "properties": {
15
+ "principle_id": { "type": "string", "pattern": "\\A[a-z0-9]+(?:-[a-z0-9]+)*\\z" },
16
+ "commit": { "type": "string", "pattern": "\\A[0-9a-f]{40}([0-9a-f]{24})?\\z" }
17
+ }
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,162 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "../error"
5
+ require_relative "git_command"
6
+ require_relative "first_parent_range"
7
+ require_relative "committed_tree"
8
+
9
+ module Principles
10
+ # Every file and process this tool reads or writes. data/CLAUDE.md owns the boundary.
11
+ module Data
12
+ # A permission-specific captured Git head, distinct from best-effort history display. Absence needs positive
13
+ # unborn evidence or inspectable physical ancestry without repository markers; failed access never grants it.
14
+ class VerifiedHead
15
+ OVERRIDES = %w[GIT_DIR GIT_WORK_TREE GIT_COMMON_DIR].freeze #: Array[String]
16
+ SHA = /\A\h{40}(?:\h{24})?\z/ #: Regexp
17
+
18
+ #: (String) -> void
19
+ def initialize(root)
20
+ @root = root
21
+ @git = GitCommand.new(root) #: GitCommand
22
+ @commit = nil #: String?
23
+ @read = false #: bool
24
+ end
25
+
26
+ #: () -> String?
27
+ def commit
28
+ return @commit if @read
29
+
30
+ @commit = capture&.freeze
31
+ @read = true
32
+ @commit
33
+ end
34
+
35
+ # A raw tree entry counts even when it is not readable JSON, a tree or a dangling link. Paths remain relative
36
+ # to the project, not the repository top; literal pathspecs come from GitCommand.
37
+ #: (String) -> bool
38
+ def entry?(path)
39
+ sha = commit or return false
40
+ entry_at?(sha, path)
41
+ end
42
+
43
+ #: (String, String) -> bool
44
+ def entry_at?(revision, path) = CommittedTree.new(@git, revision, unavailable).entry?(path)
45
+
46
+ #: (String, String) -> Hash[String, String]?
47
+ def raw_entry_at(revision, path) = CommittedTree.new(@git, revision, unavailable).raw_entry(path)
48
+
49
+ # This span proves only base to through; its upper's membership in captured HEAD needs a separate proof.
50
+ #: (String?, through: String) -> FirstParentRange
51
+ def first_parent_range(base, through:) = FirstParentRange.new(@git, base, through)
52
+
53
+ #: (String) -> String?
54
+ def first_parent_of(revision)
55
+ raise unavailable unless SHA.match?(revision)
56
+
57
+ output, status = @git.run_with_status(["cat-file", "commit", revision])
58
+ raise unavailable unless status&.zero?
59
+
60
+ parent_names(output, revision.length).first&.freeze
61
+ end
62
+
63
+ #: (String, Array[String]) -> Array[String]
64
+ def commits_touching_since(base, paths)
65
+ head = commit or raise unavailable
66
+ FirstParentRange.new(@git, base, head).touching(paths)
67
+ end
68
+
69
+ private
70
+
71
+ #: (String, Integer) -> Array[String]
72
+ def parent_names(output, name_length)
73
+ header, message = output.b.split("\n\n", 2)
74
+ rows = header.to_s.lines.map(&:chomp)
75
+ tree = rows.first.to_s
76
+ raise unavailable unless message && tree.start_with?("tree ")
77
+
78
+ parents = rows.grep(/\Aparent\b/).map { it.delete_prefix("parent ") }
79
+ confirm_object_names([tree.delete_prefix("tree "), *parents], name_length)
80
+
81
+ parents
82
+ end
83
+
84
+ #: (Array[String], Integer) -> void
85
+ def confirm_object_names(names, name_length)
86
+ raise unavailable unless names.all? { SHA.match?(it) && it.length == name_length }
87
+ end
88
+
89
+ #: () -> String?
90
+ def capture
91
+ output, status = @git.run_with_status(["rev-parse", "--is-inside-work-tree"])
92
+ return inside_commit if status&.zero? && output.strip == "true"
93
+ return nil if status == 128 && physically_outside?
94
+
95
+ raise unavailable
96
+ end
97
+
98
+ #: () -> String?
99
+ def inside_commit
100
+ output, status = @git.run_with_status(["rev-parse", "--verify", "--quiet", "HEAD^{commit}"])
101
+ return output.strip if status&.zero? && SHA.match?(output.strip)
102
+
103
+ raise unavailable unless status == 1
104
+
105
+ unborn_commit
106
+ end
107
+
108
+ # Only a symbolic branch whose ref is positively absent certifies an unborn work tree.
109
+ #: () -> nil
110
+ def unborn_commit
111
+ branch, symbolic = @git.run_with_status(["symbolic-ref", "--quiet", "HEAD"])
112
+ raise unavailable unless symbolic&.zero? && branch.start_with?("refs/heads/")
113
+
114
+ _, exists = @git.run_with_status(["show-ref", "--exists", branch.strip])
115
+ raise unavailable unless exists == 2
116
+
117
+ nil
118
+ end
119
+
120
+ # Git performs positive discovery. This only proves a failed discovery has no physical repository to hide;
121
+ # ambiguous metadata, explicit discovery overrides and filesystem errors are not evidence of absence.
122
+ #: () -> bool
123
+ def physically_outside?
124
+ return false if OVERRIDES.any? { |name| ENV[name] }
125
+
126
+ directory = File.realpath(@root)
127
+ loop do
128
+ return false if repository_marker?(directory)
129
+
130
+ parent = File.dirname(directory)
131
+ return true if parent == directory
132
+
133
+ directory = parent
134
+ end
135
+ rescue SystemCallError
136
+ false
137
+ end
138
+
139
+ #: (String) -> bool
140
+ def repository_marker?(directory)
141
+ return true if entry_exists?(File.join(directory, ".git"))
142
+
143
+ %w[HEAD objects refs].count { |name| entry_exists?(File.join(directory, name)) } >= 2
144
+ end
145
+
146
+ #: (String) -> bool
147
+ def entry_exists?(path)
148
+ File.lstat(path)
149
+ true
150
+ rescue Errno::ENOENT
151
+ false
152
+ end
153
+
154
+ #: () -> Error
155
+ def unavailable
156
+ Error.new("git_history_unavailable", "Git history could not be verified safely",
157
+ "Restore access to a healthy Git work tree and retry. Before the first commit, make an initial " \
158
+ "commit or use Git supporting show-ref --exists. No map was created or removed.")
159
+ end
160
+ end
161
+ end
162
+ end
@@ -9,11 +9,11 @@ module Principles
9
9
  class InvocationOptions
10
10
  # The options that take a value; --help, -h and --version take none.
11
11
  VALUE_OPTIONS = %w[project file description path section starting-at ending-at query role
12
- check member session-start commits-after hook-event as].freeze #: Array[String]
12
+ check member session-start commits-after hook-event as instruction].freeze #: Array[String]
13
13
  # The options that take no value, as list-member-problems --short (#291).
14
- FLAG_OPTIONS = %w[short when-invoked always write-ups].freeze #: Array[String]
14
+ FLAG_OPTIONS = %w[short when-invoked always write-ups confirm].freeze #: Array[String]
15
15
  # The options that may be given more than once, each value kept in order, as change-activation --when-files.
16
- LIST_OPTIONS = %w[when-files].freeze #: Array[String]
16
+ LIST_OPTIONS = %w[when-files also].freeze #: Array[String]
17
17
  # The words that name an option taking the next word as its value.
18
18
  VALUE_WORDS = (VALUE_OPTIONS + LIST_OPTIONS).map { |name| "--#{name}" }.freeze #: Array[String]
19
19
  # Every word the parser reads as an option, which an option taking a value refuses as its value (#750).