principles 0.1.0 → 0.1.2
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 +4 -4
- data/CHANGELOG.md +25 -0
- data/lib/principles/command_line.rb +6 -3
- data/lib/principles/controllers/inventory.rb +9 -1
- data/lib/principles/data/command-steps.json +2 -2
- data/lib/principles/data/committed_texts.rb +58 -0
- data/lib/principles/data/first_parent_log.rb +50 -10
- data/lib/principles/data/repository.rb +29 -37
- data/lib/principles/data/running_version.rb +1 -1
- data/lib/principles/data/schemas/assessment-answer.schema.json +3 -6
- data/lib/principles/data/schemas/audit-record.schema.json +2 -1
- data/lib/principles/data/schemas/correction-answer.schema.json +11 -6
- data/lib/principles/data/schemas/deciding-answer.schema.json +5 -1
- data/lib/principles/data/working_tree_changes.rb +62 -0
- data/lib/principles/list_principles_options.rb +28 -0
- data/lib/principles/models/answer_fields.rb +21 -2
- data/lib/principles/models/disposition.rb +5 -4
- data/lib/principles/models/finding_decision.rb +2 -1
- data/lib/principles/models/finding_write_ups.rb +9 -3
- data/lib/principles/models/open_findings_decision.rb +3 -2
- data/lib/principles/models/problem_report.rb +13 -2
- data/lib/principles/models/project_history.rb +8 -0
- data/lib/principles/models/record_format.rb +5 -3
- data/lib/principles/models/recorded_finding.rb +2 -2
- data/lib/principles/models/still_holds_restatement.rb +1 -1
- data/lib/principles/models/write_up_pointer.rb +12 -4
- data/lib/principles/version.rb +2 -2
- data/lib/principles/views/assessment_request.rb +7 -3
- data/lib/principles/views/candidate_files_result.rb +15 -9
- data/lib/principles/views/correction_request.rb +1 -1
- data/lib/principles/views/first_audit_brief.rb +1 -0
- data/lib/principles/views/principle_read_result.rb +5 -0
- data/lib/principles/views/prompts/assess-every-member/ask-whether-each-rule-is-enforced.md +2 -0
- data/lib/principles/views/prompts/assess-every-member/decide-each-prior-finding.md +1 -1
- data/lib/principles/views/prompts/dispose-of-each-finding/confirm-each-deferral-written-up-nowhere.md +1 -1
- data/lib/principles/views/prompts/dispose-of-each-finding/fix-or-record-each-finding.md +5 -4
- data/lib/principles/views/prompts/find-a-principle-to-map/ask-about-other-guidance-search-paths.md +1 -1
- data/lib/principles/views/prompts/find-a-principle-to-map/ask-in-this-order-after-the-table.md +1 -0
- data/lib/principles/views/prompts/find-a-principle-to-map/ask-the-owner.md +1 -0
- data/lib/principles/views/prompts/find-a-principle-to-map/ask-which-principle-to-map.md +2 -2
- data/lib/principles/views/prompts/find-a-principle-to-map/choose-an-existing-or-new-principle.md +3 -2
- data/lib/principles/views/prompts/find-a-principle-to-map/choose-one-principle.md +2 -2
- data/lib/principles/views/prompts/find-a-principle-to-map/compare-with-mapped-principles.md +2 -2
- data/lib/principles/views/prompts/find-a-principle-to-map/group-rules-into-principles.md +3 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +8 -8
- data/lib/principles/views/prompts/learn-what-a-command-does/list-principles.md +2 -0
- data/lib/principles/views/prompts/run-a-first-audit-in-the-background/follow-the-brief.md +1 -1
- metadata +9 -3
- data/lib/principles/views/prompts/find-a-principle-to-map/ask-the-owner-after-the-table.md +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 77b4ab64d6dcd922dde0d13b50a4ee3c0ad0d8bb843e127ff0108afdb1f91360
|
|
4
|
+
data.tar.gz: fc5b3d6a60b22ebcc1909f464c343cf57c7b3e807a490d301989741b804611f4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2dc4f9e61ef5d6e5f5bcbfcd3ac999b76671ee6f949428ecbfe8855e966efe248510926c703b96dc7deb6eedb776e9990f981479629b52b0380bc0ced5fec2e5
|
|
7
|
+
data.tar.gz: b57331bd5e94ceb6ea22787c41b3a611efc12e8c9c97a76b3d6ca9c40abc9573194e9bf6888813f4b9ad3fdd1972cd6f92e525b1ee0a47b9447423c1102c24ac
|
data/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,31 @@ The agent's mechanics are the means, never the lead: do not open with "An agent
|
|
|
13
13
|
|
|
14
14
|
## Unreleased
|
|
15
15
|
|
|
16
|
+
## [0.1.2] - 2026-11-24
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- **A full audit now asks whether each rule its principle states is enforced, and whether each enforced rule is written down.** `principles start-audit ID` asks the agent to judge from the members' roles and text whether a check, hook or CI step enforces each rule, and to raise either gap as a finding, where a map holding only statements often went unremarked. It adds about 180 bytes to each full audit's request, and members judged at the last audit still carry their assessments forward.
|
|
21
|
+
|
|
22
|
+
- **Looping over the mapped principles takes no script.** `principles list-principles --lines` prints each principle's id alone, one per line, ready for a shell loop, where an agent pulled the ids out of the JSON listing with a script of its own.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- **A release needs its publisher only to type the RubyGems one-time code.** `bundle exec rake release:prepare` does everything slow: the gate, the tag, the public copy, and the gem built and checked. Then `bundle exec rake release:publish OTP=<code>` uploads the gem the moment the code arrives. After that it pushes, publishes the plugin through a merged pull request and commits the next patch, where nine closing commands were once run by hand. A stopped step resumes on a rerun, and a refused or expired code uploads nothing. **Breaking:** `RELEASE=1 bundle exec rake release` no longer publishes; `bundle exec rake release` is the dry run.
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- **A finding written up in an issue is pointed at by its link, with no stub file in the project.** A deferral's `recorded_at` in `principles submit-answer`, from a correction, a full audit's kept finding or `start-audit ID --open-findings`, now takes `{"url": "https://..."}`, where a link was refused. A link that is not a whole https one is refused with how to give one. `principles list-open-findings` reads nothing at the link, and never reports it lost. A record holding a link can be read only by this release or later: an older copy refuses it as newer, so leave it as it is.
|
|
31
|
+
- **A deferred, accepted or disagreed finding is no longer refused for a reassessment its template invited.** The correction's answer, as `principles show-open-correction` prints it, now leaves each `reassessment` null, which only a fix replaces, where it printed a sentence that any other action had to send back word for word.
|
|
32
|
+
- **A first audit run in the background knows where its answer file may not go, even in a worktree inside the repository's own folders.** The brief that `principles show-first-audit-brief ID` prints now names the project's root as the place no answer file may go, where it said only "never in the project".
|
|
33
|
+
|
|
34
|
+
## [0.1.1] - 2026-11-24
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
|
|
38
|
+
- **A session starts about four times faster in a project with a long history.** `principles report-at-session-start`, which the session-start hook runs, and `principles list-member-problems` now read the files at each commit through one git process and every map's history in one walk, where they started a git process for each. On a project of 5,235 commits and 14 principles, each took about 3.4 s and now takes under 0.9 s, with the same output.
|
|
39
|
+
- **A first survey proposes principles, not one map per rule, and its follow-up questions come one at a time.** `principles list-candidate-files` now asks the agent to group rules under the intent they serve, split a hub file such as a CI workflow by passage, pair a rule with what enforces it, and map a lone rule as a member rather than a principle. What it asks after the table is a numbered list, the first offering to map every principle at once. The `/principles` skill defines a principle, member, rule, map, audit and finding in the same words.
|
|
40
|
+
|
|
16
41
|
## [0.1.0] - 2026-11-23
|
|
17
42
|
|
|
18
43
|
### Added
|
|
@@ -6,6 +6,7 @@ require_relative "invocation_options"
|
|
|
6
6
|
require_relative "after_commit_hook_options"
|
|
7
7
|
require_relative "session_start_options"
|
|
8
8
|
require_relative "list_open_findings_options"
|
|
9
|
+
require_relative "list_principles_options"
|
|
9
10
|
require_relative "start_audit_options"
|
|
10
11
|
require_relative "models/command_steps"
|
|
11
12
|
require_relative "prose_list"
|
|
@@ -160,13 +161,15 @@ module Principles
|
|
|
160
161
|
end
|
|
161
162
|
|
|
162
163
|
# Options checked together, each set owning what is wrong with it as given: --session-start, the
|
|
163
|
-
# after-commit hook's pair on the command it runs, the audit start-audit begins and the
|
|
164
|
-
# list-open-findings
|
|
164
|
+
# after-commit hook's pair on the command it runs, the audit start-audit begins and the forms
|
|
165
|
+
# list-open-findings and list-principles print; the first fault is refused.
|
|
165
166
|
#: (String) -> void
|
|
166
167
|
def check_combined_options(name)
|
|
167
168
|
hook = (AfterCommitHookOptions.new(@options) if name == AfterCommitHookOptions::COMMAND)
|
|
169
|
+
principles = (ListPrinciplesOptions.new(@options) if name == ListPrinciplesOptions::COMMAND)
|
|
168
170
|
start_audit = StartAuditOptions.new(@options, several_ids: several_ids?(name))
|
|
169
|
-
sets = [SessionStartOptions.new(@options), hook, start_audit, ListOpenFindingsOptions.new(@options)
|
|
171
|
+
sets = [SessionStartOptions.new(@options), hook, start_audit, ListOpenFindingsOptions.new(@options),
|
|
172
|
+
principles].compact
|
|
170
173
|
fault = sets.filter_map(&:fault).first or return
|
|
171
174
|
raise UsageRefusal.new(fault, help_repair(name))
|
|
172
175
|
end
|
|
@@ -17,7 +17,7 @@ module Principles
|
|
|
17
17
|
def call(command, id, options)
|
|
18
18
|
naming_the_executable do
|
|
19
19
|
case command
|
|
20
|
-
when "list-principles" then
|
|
20
|
+
when "list-principles" then listed(options)
|
|
21
21
|
when "show-principle" then members(required_id(id)).merge("wrote" => [])
|
|
22
22
|
else unknown(command)
|
|
23
23
|
end
|
|
@@ -98,6 +98,14 @@ module Principles
|
|
|
98
98
|
Views::PrincipleReadResult.new(invocation)
|
|
99
99
|
end
|
|
100
100
|
|
|
101
|
+
# list-principles as options ask: each id on a line with --lines, else the rows as JSON.
|
|
102
|
+
#: (Hash[String, untyped]) -> untyped
|
|
103
|
+
def listed(options)
|
|
104
|
+
return read_result.ids(@principles.ids) if options["lines"]
|
|
105
|
+
|
|
106
|
+
listing(open_findings: options["open_findings"]).merge("wrote" => [])
|
|
107
|
+
end
|
|
108
|
+
|
|
101
109
|
# Its next_action offers an audit while one principle's audits do not wait on an upgrade; a map listed with its
|
|
102
110
|
# refusal counts, since repairing it leaves it to audit. With open_findings, each row lists its open findings.
|
|
103
111
|
#: (open_findings: bool?) -> untyped
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
]
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
|
-
"name": "list-principles", "usage": "list-principles [--open-findings]", "group": "read", "options": ["open-findings"],
|
|
63
|
+
"name": "list-principles", "usage": "list-principles [--open-findings | --lines]", "group": "read", "options": ["open-findings", "lines"],
|
|
64
64
|
"summary": "Every mapped principle and whether its members are current.",
|
|
65
65
|
"help": "learn-what-a-command-does/list-principles",
|
|
66
66
|
"steps": [
|
|
67
67
|
{ "id": "count-members-by-freshness", "actor": "cli",
|
|
68
|
-
"does": "Reads every map and the audit record of each, and counts its members as current, changed, unassessed, locator_lost or unavailable. With --open-findings, adds each principle's open findings, one line each, saying whom it waits on, or that it is accepted, and how many days it has been open.",
|
|
68
|
+
"does": "Reads every map and the audit record of each, and counts its members as current, changed, unassessed, locator_lost or unavailable. With --open-findings, adds each principle's open findings, one line each, saying whom it waits on, or that it is accepted, and how many days it has been open. With --lines, prints each principle's id alone, one per line, and reads no map.",
|
|
69
69
|
"refuses_like": ["read-map", "read-audit"] }
|
|
70
70
|
]
|
|
71
71
|
},
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Principles
|
|
5
|
+
# Every file and process this tool reads or writes. data/CLAUDE.md owns the boundary.
|
|
6
|
+
module Data
|
|
7
|
+
# Each file's text at a full commit sha, read once and kept frozen, since text at a full sha never changes.
|
|
8
|
+
# Every read goes through one `git cat-file --batch` started on the first, not a git process per file:
|
|
9
|
+
# list-member-problems reads hundreds, and starting each costs more than reading it. git ends it when
|
|
10
|
+
# this tool's end of the pipe closes, on exit or once nothing holds these texts. A name git's line-based batch
|
|
11
|
+
# cannot take, one holding a line break, or one naming anything but a file, such as a folder, is read by itself
|
|
12
|
+
# through `git show`, the reader given.
|
|
13
|
+
class CommittedTexts
|
|
14
|
+
# What git prints before an object it found: its id, type and size. A name it found none for, or more than one,
|
|
15
|
+
# gets a line ending "missing" or "ambiguous" instead, and no object.
|
|
16
|
+
HEADER = /\A\h+ (?<type>[a-z]+) (?<size>\d+)\n\z/ #: Regexp
|
|
17
|
+
|
|
18
|
+
#: (String, ^(String) -> String?) -> void
|
|
19
|
+
def initialize(directory, show)
|
|
20
|
+
@directory = directory
|
|
21
|
+
@show = show
|
|
22
|
+
@texts = {} #: Hash[String, String?]
|
|
23
|
+
@batch = nil #: IO?
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# The text of name, a full sha, a colon and a path from the project ("<sha>:./<path>"), or nil when that commit
|
|
27
|
+
# does not hold a file there or git cannot be asked.
|
|
28
|
+
#: (String) -> String?
|
|
29
|
+
def text(name)
|
|
30
|
+
return @texts[name] if @texts.key?(name)
|
|
31
|
+
|
|
32
|
+
@texts[name] = name.match?(/[\r\n]/) ? @show.call(name) : read(name)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
private
|
|
36
|
+
|
|
37
|
+
#: (String) -> String?
|
|
38
|
+
def read(name)
|
|
39
|
+
batch = @batch ||= start
|
|
40
|
+
batch.write("#{name}\n")
|
|
41
|
+
found = HEADER.match(batch.gets.to_s) or return nil
|
|
42
|
+
text = batch.read(found[:size].to_i).to_s
|
|
43
|
+
batch.read(1)
|
|
44
|
+
found[:type] == "blob" ? text.force_encoding("UTF-8").freeze : @show.call(name)
|
|
45
|
+
rescue SystemCallError, IOError
|
|
46
|
+
nil
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
#: () -> IO
|
|
50
|
+
def start
|
|
51
|
+
IO.popen(["git", "-C", @directory, "cat-file", "--batch"], "r+", err: File::NULL).tap do |batch|
|
|
52
|
+
batch.sync = true
|
|
53
|
+
Process.detach(batch.pid)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -10,6 +10,15 @@ module Principles
|
|
|
10
10
|
# its full and short sha, subject line, author date and whether it is a root commit ("true" or "false"). The list
|
|
11
11
|
# and each commit are frozen, and a list asked to be kept is read from git once, a refusal included.
|
|
12
12
|
class FirstParentLog
|
|
13
|
+
# Each commit's full and short sha, subject line, author date and parents, as git log prints them.
|
|
14
|
+
FORMAT = "%H%x00%h%x00%s%x00%aI%x00%P" #: String
|
|
15
|
+
|
|
16
|
+
# What read_ahead's log starts each commit's full sha with: a byte no sha holds.
|
|
17
|
+
START = "\x01" #: String
|
|
18
|
+
|
|
19
|
+
# A token of read_ahead's log that starts a commit.
|
|
20
|
+
STARTS_A_COMMIT = /\A\x01\h{40}(?:\h{24})?\z/ #: Regexp
|
|
21
|
+
|
|
13
22
|
#: (GitCommand) -> void
|
|
14
23
|
def initialize(git)
|
|
15
24
|
@git = git
|
|
@@ -25,24 +34,55 @@ module Principles
|
|
|
25
34
|
@kept[[range, paths.dup.freeze]] ||= read(range, paths)
|
|
26
35
|
end
|
|
27
36
|
|
|
37
|
+
# Reads the commits in range, one that always names the same commits, touching each of path_sets in one git log,
|
|
38
|
+
# and keeps each set's as touching keeps it: each log walks the whole history, whatever it lists. A merge counts
|
|
39
|
+
# by its changes from its first parent, as git log --first-parent counts it. When git cannot list them so, none
|
|
40
|
+
# is kept, and touching asks git for each set.
|
|
41
|
+
#: (String, Array[Array[String]]) -> void
|
|
42
|
+
def read_ahead(range, path_sets)
|
|
43
|
+
output, ok = @git.run(["log", "--first-parent", "--diff-merges=first-parent", "--no-renames", "--relative",
|
|
44
|
+
"--name-only", "-z", "--format=#{START}#{FORMAT}", "--end-of-options", range, "--",
|
|
45
|
+
*path_sets.flatten.uniq])
|
|
46
|
+
return unless ok
|
|
47
|
+
|
|
48
|
+
changed = changes(output)
|
|
49
|
+
path_sets.each do |paths|
|
|
50
|
+
@kept[[range, paths.dup.freeze]] ||=
|
|
51
|
+
changed.filter_map { |commit, names| commit if names.any? { |name| within?(name, paths) } }.freeze
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
28
55
|
private
|
|
29
56
|
|
|
30
57
|
#: (String, Array[String]) -> Array[Hash[String, String]]
|
|
31
58
|
def read(range, paths)
|
|
32
|
-
output, ok = @git.run(["log", "--first-parent", "--format
|
|
33
|
-
|
|
34
|
-
(ok ? commits(output).each(&:freeze) : []).freeze
|
|
59
|
+
output, ok = @git.run(["log", "--first-parent", "--format=#{FORMAT}", "--end-of-options", range, "--", *paths])
|
|
60
|
+
(ok ? output.force_encoding("UTF-8").lines.map { |line| commit(line.chomp) } : []).freeze
|
|
35
61
|
end
|
|
36
62
|
|
|
37
|
-
# Each commit in output, the log
|
|
38
|
-
#: (String) -> Array[Hash[String, String]]
|
|
39
|
-
def
|
|
40
|
-
output.force_encoding("UTF-8").
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
63
|
+
# Each commit in output, the log read_ahead asks git for, with the names it changed.
|
|
64
|
+
#: (String) -> Array[[Hash[String, String], Array[String]]]
|
|
65
|
+
def changes(output)
|
|
66
|
+
tokens = output.force_encoding("UTF-8").split("\0")
|
|
67
|
+
tokens.slice_before { |token| STARTS_A_COMMIT.match?(token) }.map do |fields|
|
|
68
|
+
names = fields.drop(5).map { |name| name.delete_prefix("\n") }.reject(&:empty?)
|
|
69
|
+
[commit(fields.first(5).join("\0").delete_prefix(START)), names]
|
|
44
70
|
end
|
|
45
71
|
end
|
|
72
|
+
|
|
73
|
+
# Whether name is one of paths, or lies in one of them, as git reads a literal pathspec.
|
|
74
|
+
#: (String, Array[String]) -> bool
|
|
75
|
+
def within?(name, paths)
|
|
76
|
+
paths.any? { |path| name == path || name.start_with?("#{path.delete_suffix("/")}/") }
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# One commit as FORMAT prints it, frozen.
|
|
80
|
+
#: (String) -> Hash[String, String]
|
|
81
|
+
def commit(line)
|
|
82
|
+
sha, short, subject, authored_at, parents = line.split("\0", 5)
|
|
83
|
+
{ "sha" => sha.to_s, "commit" => short.to_s, "subject" => subject.to_s, "authored_at" => authored_at.to_s,
|
|
84
|
+
"root" => parents.to_s.empty?.to_s }.freeze
|
|
85
|
+
end
|
|
46
86
|
end
|
|
47
87
|
end
|
|
48
88
|
end
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
require_relative "git_command"
|
|
5
5
|
require_relative "verified_head"
|
|
6
6
|
require_relative "first_parent_log"
|
|
7
|
+
require_relative "working_tree_changes"
|
|
8
|
+
require_relative "committed_texts"
|
|
7
9
|
|
|
8
10
|
module Principles
|
|
9
11
|
# Every file and process this tool reads or writes. data/CLAUDE.md owns the boundary.
|
|
@@ -24,8 +26,9 @@ module Principles
|
|
|
24
26
|
def initialize(root)
|
|
25
27
|
@root = root
|
|
26
28
|
@git = GitCommand.new(root) #: GitCommand
|
|
27
|
-
@texts = {} #:
|
|
29
|
+
@texts = CommittedTexts.new(root, ->(name) { show(name) }) #: CommittedTexts
|
|
28
30
|
@log = FirstParentLog.new(@git) #: FirstParentLog
|
|
31
|
+
@changes = WorkingTreeChanges.new(@git) #: WorkingTreeChanges
|
|
29
32
|
end
|
|
30
33
|
|
|
31
34
|
# A strict permission snapshot; legacy best-effort readers keep their existing behavior.
|
|
@@ -100,34 +103,15 @@ module Principles
|
|
|
100
103
|
# Which of paths, relative to the project, are untracked or ignored, or differ from HEAD in the index
|
|
101
104
|
# or the working tree. Before the first commit, every path does.
|
|
102
105
|
#: (Array[String]) -> Array[String]
|
|
103
|
-
def uncommitted(paths)
|
|
104
|
-
return [] if paths.empty?
|
|
105
|
-
return paths.uniq.sort unless head
|
|
106
|
+
def uncommitted(paths) = @changes.uncommitted(paths, committed: !head.nil?)
|
|
106
107
|
|
|
107
|
-
|
|
108
|
-
untracked, = git(["ls-files", "--others", "-z", "--", *paths])
|
|
109
|
-
(changed.split("\0") + untracked.split("\0")).uniq.sort
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
# Which of paths, relative to the project, git does not track and does not ignore. Before the first
|
|
113
|
-
# commit, every path not staged is one.
|
|
108
|
+
# Which of paths, relative to the project, git does not track and does not ignore.
|
|
114
109
|
#: (Array[String]) -> Array[String]
|
|
115
|
-
def untracked_excluding_ignored(paths)
|
|
116
|
-
return [] if paths.empty?
|
|
117
|
-
|
|
118
|
-
output, = git(["ls-files", "--others", "--exclude-standard", "-z", "--", *paths])
|
|
119
|
-
output.split("\0").sort
|
|
120
|
-
end
|
|
110
|
+
def untracked_excluding_ignored(paths) = @changes.untracked_excluding_ignored(paths)
|
|
121
111
|
|
|
122
|
-
# Which of paths, relative to the project, git does not track, ignored or not.
|
|
123
|
-
# untracked_excluding_ignored, it names an ignored file too, since git holds it no more than an untracked one.
|
|
112
|
+
# Which of paths, relative to the project, git does not track, ignored or not.
|
|
124
113
|
#: (Array[String]) -> Array[String]
|
|
125
|
-
def untracked_including_ignored(paths)
|
|
126
|
-
return [] if paths.empty?
|
|
127
|
-
|
|
128
|
-
output, = git(["ls-files", "--others", "-z", "--", *paths])
|
|
129
|
-
output.split("\0").sort
|
|
130
|
-
end
|
|
114
|
+
def untracked_including_ignored(paths) = @changes.untracked_including_ignored(paths)
|
|
131
115
|
|
|
132
116
|
# Every path in the project git tracks, as git spells it, sorted, so a path a disk that folds case opens under
|
|
133
117
|
# another spelling can be told apart; none outside git.
|
|
@@ -137,16 +121,10 @@ module Principles
|
|
|
137
121
|
ok ? output.force_encoding("UTF-8").split("\0").sort : []
|
|
138
122
|
end
|
|
139
123
|
|
|
140
|
-
# Every file in the project that differs from HEAD, is gone since it, or is untracked,
|
|
141
|
-
#
|
|
142
|
-
# one the owner chose to keep out of git, while uncommitted is asked about named members, which an audit
|
|
143
|
-
# needs committed. Before the first commit, every file not ignored is one.
|
|
124
|
+
# Every file in the project that differs from HEAD, is gone since it, or is untracked, ignored ones aside,
|
|
125
|
+
# sorted.
|
|
144
126
|
#: () -> Array[String]
|
|
145
|
-
def changed_files
|
|
146
|
-
changed, = head ? git(["diff", "--name-only", "--relative", "-z", "HEAD"]) : [""]
|
|
147
|
-
untracked, = git(["ls-files", "--others", "--exclude-standard", "-z"])
|
|
148
|
-
(changed.split("\0") + untracked.split("\0")).uniq.sort
|
|
149
|
-
end
|
|
127
|
+
def changed_files = @changes.changed_files(committed: !head.nil?)
|
|
150
128
|
|
|
151
129
|
# path's text at commit, frozen, or nil when the commit does not hold it. Text at a full sha never changes, so
|
|
152
130
|
# git is asked for it once; HEAD moves with each commit, so it is asked every time.
|
|
@@ -154,7 +132,7 @@ module Principles
|
|
|
154
132
|
def text_at(commit, path)
|
|
155
133
|
return read_text_at(commit, path) unless FULL_SHA.match?(commit)
|
|
156
134
|
|
|
157
|
-
@texts
|
|
135
|
+
@texts.text(name_at(commit, path))
|
|
158
136
|
end
|
|
159
137
|
|
|
160
138
|
# The commits after commit, up to HEAD, that changed any of paths, newest first, each as its short sha and
|
|
@@ -181,11 +159,25 @@ module Principles
|
|
|
181
159
|
@log.touching(range, paths, kept: [since || up_to, up_to].all? { FULL_SHA.match?(it) })
|
|
182
160
|
end
|
|
183
161
|
|
|
162
|
+
# Reads the commits on up_to's first-parent line, up_to a full sha, touching each of path_sets in one git log,
|
|
163
|
+
# so commits_touching asks git no more for any of them up to it. Any other up_to is not kept, so nothing is read.
|
|
164
|
+
#: (Array[Array[String]], up_to: String) -> void
|
|
165
|
+
def read_ahead(path_sets, up_to:)
|
|
166
|
+
@log.read_ahead(revision(up_to), path_sets) if FULL_SHA.match?(up_to) && !path_sets.empty?
|
|
167
|
+
end
|
|
168
|
+
|
|
184
169
|
private
|
|
185
170
|
|
|
186
171
|
#: (String, String) -> String?
|
|
187
|
-
def read_text_at(commit, path)
|
|
188
|
-
|
|
172
|
+
def read_text_at(commit, path) = show(name_at(commit, path))
|
|
173
|
+
|
|
174
|
+
# How git names path, relative to the project, at commit.
|
|
175
|
+
#: (String, String) -> String
|
|
176
|
+
def name_at(commit, path) = "#{revision(commit)}:./#{path}"
|
|
177
|
+
|
|
178
|
+
#: (String) -> String?
|
|
179
|
+
def show(name)
|
|
180
|
+
text, ok = git(["show", "--end-of-options", name])
|
|
189
181
|
ok ? text.force_encoding("UTF-8").freeze : nil
|
|
190
182
|
end
|
|
191
183
|
|
|
@@ -12,7 +12,7 @@ module Principles
|
|
|
12
12
|
class RunningVersion
|
|
13
13
|
# git archive writes the short sha of the commit it archives here, since .gitattributes marks this file
|
|
14
14
|
# export-subst; a checkout keeps the placeholder as written.
|
|
15
|
-
ARCHIVED_COMMIT = "
|
|
15
|
+
ARCHIVED_COMMIT = "f91461e6" #: String
|
|
16
16
|
|
|
17
17
|
#: (?String, release: String, ?built: String?, ?archived_commit: String) -> void
|
|
18
18
|
def initialize(checkout = File.expand_path("../../..", __dir__), release:, built: nil,
|
|
@@ -253,18 +253,15 @@
|
|
|
253
253
|
},
|
|
254
254
|
"recorded_at": {
|
|
255
255
|
"x-type-refusal-advice": {
|
|
256
|
-
"keys": [
|
|
257
|
-
|
|
258
|
-
"starting_at"
|
|
259
|
-
],
|
|
260
|
-
"says": "plus starting_at (or heading) when the file holds more than this finding"
|
|
256
|
+
"keys": ["path", "url", "heading", "starting_at", "ending_at", "query"],
|
|
257
|
+
"says": "with path, plus starting_at (or heading) when the file holds more than this finding, or with url alone, a whole https link, for a write-up outside the project such as an issue"
|
|
261
258
|
},
|
|
262
259
|
"type": ["object", "null", "string"],
|
|
263
260
|
"description": "On a still_holds decision, a new pointer to the write-up, or null for none. A string is the template's placeholder, left as printed.",
|
|
264
|
-
"required": ["path"],
|
|
265
261
|
"additionalProperties": false,
|
|
266
262
|
"properties": {
|
|
267
263
|
"path": { "type": "string" },
|
|
264
|
+
"url": { "type": "string" },
|
|
268
265
|
"heading": { "type": "string" },
|
|
269
266
|
"starting_at": { "type": "string" },
|
|
270
267
|
"ending_at": { "type": "string" },
|
|
@@ -268,9 +268,10 @@
|
|
|
268
268
|
"waits_on_since": { "type": "string", "minLength": 1, "description": "When an earlier audit asked waits_on, carried since. Absent means this record's audited_at; only principles writes it." },
|
|
269
269
|
"recorded_at": {
|
|
270
270
|
"type": "object",
|
|
271
|
-
"
|
|
271
|
+
"description": "A file in the project, by path and optionally a place inside it, or a write-up outside the project by url alone.",
|
|
272
272
|
"properties": {
|
|
273
273
|
"path": { "type": "string", "minLength": 1 },
|
|
274
|
+
"url": { "type": "string", "minLength": 1 },
|
|
274
275
|
"heading": { "type": "string" },
|
|
275
276
|
"starting_at": { "type": "string" },
|
|
276
277
|
"ending_at": { "type": "string" },
|
|
@@ -181,23 +181,27 @@
|
|
|
181
181
|
"recorded_at": {
|
|
182
182
|
"x-type-refusal-advice": {
|
|
183
183
|
"keys": [
|
|
184
|
+
"path",
|
|
185
|
+
"url",
|
|
184
186
|
"heading",
|
|
185
|
-
"starting_at"
|
|
187
|
+
"starting_at",
|
|
188
|
+
"ending_at",
|
|
189
|
+
"query"
|
|
186
190
|
],
|
|
187
|
-
"says": "plus starting_at (or heading) when the file holds more than this finding"
|
|
191
|
+
"says": "with path, plus starting_at (or heading) when the file holds more than this finding, or with url alone, a whole https link, for a write-up outside the project such as an issue"
|
|
188
192
|
},
|
|
189
193
|
"type": [
|
|
190
194
|
"object",
|
|
191
195
|
"null"
|
|
192
196
|
],
|
|
193
|
-
"required": [
|
|
194
|
-
"path"
|
|
195
|
-
],
|
|
196
197
|
"additionalProperties": false,
|
|
197
198
|
"properties": {
|
|
198
199
|
"path": {
|
|
199
200
|
"type": "string"
|
|
200
201
|
},
|
|
202
|
+
"url": {
|
|
203
|
+
"type": "string"
|
|
204
|
+
},
|
|
201
205
|
"heading": {
|
|
202
206
|
"type": "string"
|
|
203
207
|
},
|
|
@@ -231,7 +235,8 @@
|
|
|
231
235
|
}
|
|
232
236
|
},
|
|
233
237
|
"reassessment": {
|
|
234
|
-
"type": "string"
|
|
238
|
+
"type": ["string", "null"],
|
|
239
|
+
"description": "How a fix's changed members now carry the principle: the template prints null, which any other action keeps or omits, and Models::Disposition refuses on a fix."
|
|
235
240
|
},
|
|
236
241
|
"waits_on": {
|
|
237
242
|
"type": ["string", "null"],
|
|
@@ -31,11 +31,15 @@
|
|
|
31
31
|
"action": { "type": "string" },
|
|
32
32
|
"waits_on": { "type": ["string", "null"] },
|
|
33
33
|
"recorded_at": {
|
|
34
|
+
"x-type-refusal-advice": {
|
|
35
|
+
"keys": ["path", "url", "heading", "starting_at", "ending_at", "query"],
|
|
36
|
+
"says": "with path, plus starting_at (or heading) when the file holds more than this finding, or with url alone, a whole https link, for a write-up outside the project such as an issue"
|
|
37
|
+
},
|
|
34
38
|
"type": ["object", "null"],
|
|
35
|
-
"required": ["path"],
|
|
36
39
|
"additionalProperties": false,
|
|
37
40
|
"properties": {
|
|
38
41
|
"path": { "type": "string" },
|
|
42
|
+
"url": { "type": "string" },
|
|
39
43
|
"heading": { "type": "string" },
|
|
40
44
|
"starting_at": { "type": "string" },
|
|
41
45
|
"ending_at": { "type": "string" },
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "git_command"
|
|
5
|
+
|
|
6
|
+
module Principles
|
|
7
|
+
# Every file and process this tool reads or writes. data/CLAUDE.md owns the boundary.
|
|
8
|
+
module Data
|
|
9
|
+
# Which files in the project's working tree differ from HEAD, or git does not track, as git reports them, with
|
|
10
|
+
# paths relative to the project. Each is asked whether HEAD has a commit at all, since before the first commit
|
|
11
|
+
# nothing is committed and git has no HEAD to diff against.
|
|
12
|
+
class WorkingTreeChanges
|
|
13
|
+
#: (GitCommand) -> void
|
|
14
|
+
def initialize(git)
|
|
15
|
+
@git = git
|
|
16
|
+
freeze
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Which of paths are untracked or ignored, or differ from HEAD in the index or the working tree. Before the
|
|
20
|
+
# first commit, every path does.
|
|
21
|
+
#: (Array[String], committed: bool) -> Array[String]
|
|
22
|
+
def uncommitted(paths, committed:)
|
|
23
|
+
return [] if paths.empty?
|
|
24
|
+
return paths.uniq.sort unless committed
|
|
25
|
+
|
|
26
|
+
changed, = @git.run(["diff", "--name-only", "--relative", "-z", "HEAD", "--", *paths])
|
|
27
|
+
untracked, = @git.run(["ls-files", "--others", "-z", "--", *paths])
|
|
28
|
+
(changed.split("\0") + untracked.split("\0")).uniq.sort
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Which of paths git does not track and does not ignore. Before the first commit, every path not staged is one.
|
|
32
|
+
#: (Array[String]) -> Array[String]
|
|
33
|
+
def untracked_excluding_ignored(paths)
|
|
34
|
+
return [] if paths.empty?
|
|
35
|
+
|
|
36
|
+
output, = @git.run(["ls-files", "--others", "--exclude-standard", "-z", "--", *paths])
|
|
37
|
+
output.split("\0").sort
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Which of paths git does not track, ignored or not. Unlike untracked_excluding_ignored, it names an ignored
|
|
41
|
+
# file too, since git holds it no more than an untracked one.
|
|
42
|
+
#: (Array[String]) -> Array[String]
|
|
43
|
+
def untracked_including_ignored(paths)
|
|
44
|
+
return [] if paths.empty?
|
|
45
|
+
|
|
46
|
+
output, = @git.run(["ls-files", "--others", "-z", "--", *paths])
|
|
47
|
+
output.split("\0").sort
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Every file in the project that differs from HEAD, is gone since it, or is untracked, sorted. Unlike
|
|
51
|
+
# uncommitted, it leaves ignored files out: it is asked about the whole project, where an ignored file is
|
|
52
|
+
# one the owner chose to keep out of git, while uncommitted is asked about named members, which an audit
|
|
53
|
+
# needs committed. Before the first commit, every file not ignored is one.
|
|
54
|
+
#: (committed: bool) -> Array[String]
|
|
55
|
+
def changed_files(committed:)
|
|
56
|
+
changed, = committed ? @git.run(["diff", "--name-only", "--relative", "-z", "HEAD"]) : [""]
|
|
57
|
+
untracked, = @git.run(["ls-files", "--others", "--exclude-standard", "-z"])
|
|
58
|
+
(changed.split("\0") + untracked.split("\0")).uniq.sort
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "invocation_options"
|
|
5
|
+
|
|
6
|
+
module Principles
|
|
7
|
+
# The options choosing what list-principles prints, --lines or --open-findings, and what is wrong with them as
|
|
8
|
+
# given, which CommandLine refuses as a usage error.
|
|
9
|
+
class ListPrinciplesOptions
|
|
10
|
+
COMMAND = "list-principles"
|
|
11
|
+
|
|
12
|
+
#: (InvocationOptions) -> void
|
|
13
|
+
def initialize(options)
|
|
14
|
+
@lines = !options.value("lines").nil? #: bool
|
|
15
|
+
@open_findings = !options.value("open_findings").nil? #: bool
|
|
16
|
+
freeze
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# What is wrong with the options as given, or nil when they fit: --lines prints ids alone, so it would drop the
|
|
20
|
+
# open findings asked for without a word.
|
|
21
|
+
#: () -> String?
|
|
22
|
+
def fault
|
|
23
|
+
return unless @lines && @open_findings
|
|
24
|
+
|
|
25
|
+
"--lines prints only each principle's id, so it shows no open findings; give one of --lines and --open-findings"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -13,6 +13,12 @@ module Principles
|
|
|
13
13
|
# The checks every answer's fields share: a field is a nonempty string or an array, and each piece of
|
|
14
14
|
# evidence names a path that the caller's block locates in the project.
|
|
15
15
|
class AnswerFields
|
|
16
|
+
# A whole https link: a host, then anything but whitespace.
|
|
17
|
+
LINK = %r{\Ahttps://[^\s/?#]+\S*\z}
|
|
18
|
+
LINK_REPAIR = "Give recorded_at as {\"url\": \"https://...\"}, the whole link to where it is written up, " \
|
|
19
|
+
"such as an issue, with no other field; or as {\"path\": ..., \"heading\": ...} for a file in " \
|
|
20
|
+
"the project."
|
|
21
|
+
|
|
16
22
|
#: (^(Locator) -> void) -> void
|
|
17
23
|
def initialize(locate)
|
|
18
24
|
@locate = locate
|
|
@@ -56,12 +62,25 @@ module Principles
|
|
|
56
62
|
end
|
|
57
63
|
end
|
|
58
64
|
|
|
59
|
-
# Where a finding is written up, located at its place in the answer, as the value its record keeps
|
|
65
|
+
# Where a finding is written up, located at its place in the answer, as the value its record keeps: a place in a
|
|
66
|
+
# project file, or a link outside the project, which is checked as a link and read nowhere.
|
|
60
67
|
#: (untyped, AnswerPlace) -> WriteUpPointer
|
|
61
68
|
def write_up_pointer(reference, place)
|
|
62
|
-
pointer(reference, place)
|
|
69
|
+
reference.key?("url") ? link(reference, place.child("url")) : pointer(reference, place)
|
|
63
70
|
WriteUpPointer.new(reference)
|
|
64
71
|
end
|
|
72
|
+
|
|
73
|
+
private
|
|
74
|
+
|
|
75
|
+
# A write-up's url: a whole https link with a host and no space, given alone.
|
|
76
|
+
#: (Hash[String, untyped], AnswerPlace) -> void
|
|
77
|
+
def link(reference, place)
|
|
78
|
+
url = reference["url"]
|
|
79
|
+
return if reference.size == 1 && url.is_a?(String) && url.match?(LINK)
|
|
80
|
+
|
|
81
|
+
raise place.refusal(Error.new("invalid_answer", "recorded_at's url must be a whole https link, given alone",
|
|
82
|
+
LINK_REPAIR))
|
|
83
|
+
end
|
|
65
84
|
end
|
|
66
85
|
end
|
|
67
86
|
end
|
|
@@ -51,9 +51,9 @@ module Principles
|
|
|
51
51
|
#: () -> Array[String]
|
|
52
52
|
def changed_members = @disposition.fetch("changed_members", [])
|
|
53
53
|
|
|
54
|
-
# The file where the finding is written up, if anywhere.
|
|
54
|
+
# The project file where the finding is written up, if anywhere; none for a write-up at a url.
|
|
55
55
|
#: () -> String?
|
|
56
|
-
def recorded_path = recorded_at&.
|
|
56
|
+
def recorded_path = recorded_at&.file
|
|
57
57
|
|
|
58
58
|
# What the audit record keeps of this disposition beside its finding: the action, and why a finding left
|
|
59
59
|
# unfixed was left so, which a fix's reassessment answers instead; where the finding is written up and
|
|
@@ -154,12 +154,13 @@ module Principles
|
|
|
154
154
|
left_reassessment: DispositionPlaceholders::TEXT_FIELDS.fetch("reassessment").placeholder)
|
|
155
155
|
end
|
|
156
156
|
|
|
157
|
-
# Each piece of evidence, and where the finding is written up,
|
|
157
|
+
# Each piece of evidence located in the project, and where the finding is written up, there or at a link.
|
|
158
158
|
#: () -> void
|
|
159
159
|
def locate_pointers
|
|
160
160
|
fix_fields.check_removal_evidence if fixed?
|
|
161
161
|
@fields.evidence(fix_fields.list("evidence"), @place.child("evidence"))
|
|
162
|
-
|
|
162
|
+
recorded_at = @disposition["recorded_at"]
|
|
163
|
+
@fields.write_up_pointer(recorded_at, @place.child("recorded_at")) if recorded_at
|
|
163
164
|
end
|
|
164
165
|
|
|
165
166
|
# A deferral must say where it is written up, or null, so an answer reused from before recorded_at existed
|
|
@@ -25,7 +25,8 @@ module Principles
|
|
|
25
25
|
"waits_on" => "One line, on a deferred finding only: whom it now waits on and to decide what. Or null, " \
|
|
26
26
|
"even on a deferred finding, to drop it.",
|
|
27
27
|
"action" => "deferred or accepted, as when the owner rules; its reason becomes the finding's own.",
|
|
28
|
-
"recorded_at" => "Where its write-up is now, in a committed file: {\"path\": ..., \"heading\": ...}
|
|
28
|
+
"recorded_at" => "Where its write-up is now, in a committed file: {\"path\": ..., \"heading\": ...}; outside " \
|
|
29
|
+
"the project, such as an issue: {\"url\": \"https://...\"}; or null.",
|
|
29
30
|
"reason" => "One line saying why, required with any change. A field left out keeps its value; " \
|
|
30
31
|
"decision_fields may be kept or deleted."
|
|
31
32
|
}.freeze #: Hash[String, String]
|
|
@@ -62,8 +62,14 @@ module Principles
|
|
|
62
62
|
|
|
63
63
|
# pointer's write_up_opening, or null with the reason: not_recorded, empty_region, or unavailable with the
|
|
64
64
|
# refusal, so one pointer that no longer resolves never refuses the whole list.
|
|
65
|
+
# A url's is null as outside_project, since this tool reads nothing outside the project.
|
|
65
66
|
#: (WriteUpPointer?) -> Hash[String, untyped]
|
|
66
|
-
def opening_fields(pointer)
|
|
67
|
+
def opening_fields(pointer)
|
|
68
|
+
return none("not_recorded") unless pointer
|
|
69
|
+
return none("outside_project") if pointer.url
|
|
70
|
+
|
|
71
|
+
opening_found(pointer)
|
|
72
|
+
end
|
|
67
73
|
|
|
68
74
|
# The write_up_opening pointer leads to, or null with why: empty_region, or unavailable with the refusal.
|
|
69
75
|
#: (WriteUpPointer) -> Hash[String, untyped]
|
|
@@ -74,10 +80,10 @@ module Principles
|
|
|
74
80
|
none("unavailable").merge("write_up_opening_error" => unavailable(e.payload, pointer))
|
|
75
81
|
end
|
|
76
82
|
|
|
77
|
-
# Whether a recorded pointer no longer resolves in the project's file now.
|
|
83
|
+
# Whether a recorded pointer no longer resolves in the project's file now; a url names no file here to lose.
|
|
78
84
|
#: (WriteUpPointer?) -> bool
|
|
79
85
|
def unresolved?(pointer)
|
|
80
|
-
return false
|
|
86
|
+
return false if pointer.nil? || pointer.url
|
|
81
87
|
|
|
82
88
|
pointer.opening_in(@project)
|
|
83
89
|
false
|
|
@@ -110,13 +110,14 @@ module Principles
|
|
|
110
110
|
"Give each finding one decision.")
|
|
111
111
|
end
|
|
112
112
|
|
|
113
|
-
# The decision at index, its new recorded_at, when it gives one, located and committed.
|
|
113
|
+
# The decision at index, its new recorded_at, when it gives one, located and committed, or checked as a link.
|
|
114
114
|
#: (Hash[String, untyped], Integer, AnswerFields) -> FindingDecision
|
|
115
115
|
def decision_at(decision, index, fields)
|
|
116
116
|
place = AnswerPlace.new("/decisions/#{index}", "Finding #{decision["finding_id"]}")
|
|
117
117
|
reference = decision["recorded_at"]
|
|
118
118
|
pointer = fields.write_up_pointer(reference, place.child("recorded_at")) if reference
|
|
119
|
-
|
|
119
|
+
file = pointer&.file
|
|
120
|
+
@history.refuse_uncommitted_write_up(file) if file
|
|
120
121
|
FindingDecision.new(decision, place, principle_id: @principle_id, recorded_at: pointer)
|
|
121
122
|
end
|
|
122
123
|
end
|
|
@@ -13,15 +13,26 @@ module Principles
|
|
|
13
13
|
# each state.
|
|
14
14
|
class ProblemReport
|
|
15
15
|
# What list-member-problems reports for map id, or every map, listing a map it cannot read among them, with the
|
|
16
|
-
# project's history, which lets each missing file carry the rename git detects for it.
|
|
16
|
+
# project's history, which lets each missing file carry the rename git detects for it. Every map's history is
|
|
17
|
+
# read in one walk of git's, not one each.
|
|
17
18
|
#: (Project, String?) -> ProblemReport
|
|
18
19
|
def self.for(project, id)
|
|
19
20
|
maps = if id then [MemberProblems.for(project, id)]
|
|
20
|
-
else
|
|
21
|
+
else every_map(project)
|
|
21
22
|
end
|
|
22
23
|
new(maps, history: project.history)
|
|
23
24
|
end
|
|
24
25
|
|
|
26
|
+
# Each map's problems, its history read ahead at the files PrincipleHistory walks for a map, under the folder's
|
|
27
|
+
# name now and its earlier one.
|
|
28
|
+
#: (Project) -> Array[MemberProblems]
|
|
29
|
+
def self.every_map(project)
|
|
30
|
+
ids = project.principles.ids
|
|
31
|
+
project.history.read_ahead(ids.map { [project.principles.file(it), project.principles.earlier_file(it)] })
|
|
32
|
+
ids.map { MemberProblems.for(project, it, listing_all: true) }
|
|
33
|
+
end
|
|
34
|
+
private_class_method :every_map
|
|
35
|
+
|
|
25
36
|
# history, when given, lets each missing file carry the rename git detects for it.
|
|
26
37
|
#: (Array[MemberProblems], ?history: ProjectHistory?) -> void
|
|
27
38
|
def initialize(maps, history: nil)
|
|
@@ -151,6 +151,14 @@ module Principles
|
|
|
151
151
|
@repository.commits_touching(through_links(paths), since: since, up_to: head || "HEAD")
|
|
152
152
|
end
|
|
153
153
|
|
|
154
|
+
# Reads the commits on head's first-parent line touching each of path_sets, and the links and files they lead
|
|
155
|
+
# through, in one git log, so commits_touching asks git no more for any of them. Nothing outside git.
|
|
156
|
+
#: (Array[Array[String]]) -> void
|
|
157
|
+
def read_ahead(path_sets)
|
|
158
|
+
up_to = head or return
|
|
159
|
+
@repository.read_ahead(path_sets.map { through_links(it) }, up_to: up_to)
|
|
160
|
+
end
|
|
161
|
+
|
|
154
162
|
# The commits after commit, up to HEAD, that one move of HEAD brought in, whatever they changed.
|
|
155
163
|
#: (String) -> CommitsBroughtIn
|
|
156
164
|
def commits_brought_in(commit)
|
|
@@ -20,10 +20,12 @@ module Principles
|
|
|
20
20
|
# rewrite, add the next format here, set by hand to the release that commit ships in, and name the field in
|
|
21
21
|
# FIELD_FORMATS, so only a record carrying it moves up.
|
|
22
22
|
# Add its row to prompts/docs/AUDIT_RECORD_FORMAT_HISTORY.md too.
|
|
23
|
-
FIRST_RELEASES = { 1 => "0.0.4", 2 => "0.0.8", 3 => "0.1.0" }.freeze #: Hash[Integer, String]
|
|
23
|
+
FIRST_RELEASES = { 1 => "0.0.4", 2 => "0.0.8", 3 => "0.1.0", 4 => "0.1.2" }.freeze #: Hash[Integer, String]
|
|
24
24
|
# The format each later field needs, by its path of property names: the open record's correction, which
|
|
25
|
-
# show-open-correction prints again,
|
|
26
|
-
|
|
25
|
+
# show-open-correction prints again, a finding's changes since its audit, which the next full audit shows, and a
|
|
26
|
+
# write-up at a URL, which an older copy's schema refuses as broken for its missing path.
|
|
27
|
+
FIELD_FORMATS = { "correction" => 2, "findings.changed_since_audit" => 3,
|
|
28
|
+
"findings.recorded_at.url" => 4 }.freeze #: Hash[String, Integer]
|
|
27
29
|
# The newest format this copy writes and rewrites without losing a field; formats count up from 1.
|
|
28
30
|
NEWEST = FIRST_RELEASES.size #: Integer
|
|
29
31
|
FIELDS = %w[format format_first_release].freeze
|
|
@@ -58,9 +58,9 @@ module Principles
|
|
|
58
58
|
#: () -> bool
|
|
59
59
|
def evidence_kept? = !evidence.nil?
|
|
60
60
|
|
|
61
|
-
# The path of each file it points at: its evidence and its write-up.
|
|
61
|
+
# The path of each file it points at: its evidence and its write-up, unless that is at a url.
|
|
62
62
|
#: () -> Array[String]
|
|
63
|
-
def cited_paths = [*evidence&.map { it.fetch("path") }, recorded_at&.
|
|
63
|
+
def cited_paths = [*evidence&.map { it.fetch("path") }, recorded_at&.file].compact.uniq
|
|
64
64
|
|
|
65
65
|
# The commit whose record an audit cited for an earlier first_raised_at, when one did.
|
|
66
66
|
#: () -> String?
|
|
@@ -41,7 +41,7 @@ module Principles
|
|
|
41
41
|
problem if @decision.key?("problem")
|
|
42
42
|
return unless @decision["recorded_at"]
|
|
43
43
|
|
|
44
|
-
AnswerFields.new(locate).
|
|
44
|
+
AnswerFields.new(locate).write_up_pointer(@decision["recorded_at"], @place.child("recorded_at"))
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
private
|
|
@@ -7,9 +7,9 @@ module Principles
|
|
|
7
7
|
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
8
8
|
module Models
|
|
9
9
|
# Where a finding is written up, as its record's recorded_at keeps it: a path, with a heading or a starting_at
|
|
10
|
-
# inside it. It holds that place as the Locator the hash it was
|
|
11
|
-
# and order, since the record's bytes and each digest over them
|
|
12
|
-
# those hashes hold the same keys and values, in any order.
|
|
10
|
+
# inside it, or a url outside the project, such as an issue's. It holds that place as the Locator the hash it was
|
|
11
|
+
# read from gives, which keeps its keys, nulls and order, since the record's bytes and each digest over them
|
|
12
|
+
# depend on it; two pointers are the same when those hashes hold the same keys and values, in any order.
|
|
13
13
|
class WriteUpPointer
|
|
14
14
|
#: (Hash[String, untyped]) -> void
|
|
15
15
|
def initialize(fields)
|
|
@@ -17,7 +17,15 @@ module Principles
|
|
|
17
17
|
freeze
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
# The
|
|
20
|
+
# The link to a write-up outside the project, which this tool never reads, or nil for one in a file here.
|
|
21
|
+
#: () -> String?
|
|
22
|
+
def url = @locator.to_h["url"]
|
|
23
|
+
|
|
24
|
+
# The project file it points into, which an audit commits and its record cites, or nil at a url.
|
|
25
|
+
#: () -> String?
|
|
26
|
+
def file = url ? nil : path
|
|
27
|
+
|
|
28
|
+
# The file the write-up is in, for a pointer with no url.
|
|
21
29
|
#: () -> String
|
|
22
30
|
def path = @locator.path
|
|
23
31
|
|
data/lib/principles/version.rb
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
module Principles
|
|
5
5
|
# The next production release, as major.minor.patch. A production build is versioned with this alone.
|
|
6
|
-
RELEASE = "0.1.
|
|
6
|
+
RELEASE = "0.1.2"
|
|
7
7
|
# The version a built gem prints. `rake build[production]` stamps RELEASE here, in the copy of lib/ it
|
|
8
8
|
# packages, and `rake build[development]` stamps RELEASE.g<short sha>. A checkout leaves it nil, and
|
|
9
9
|
# Data::RunningVersion reads the commit this tool runs from instead.
|
|
10
|
-
BUILT_VERSION = "0.1.
|
|
10
|
+
BUILT_VERSION = "0.1.2" #: String?
|
|
11
11
|
end
|
|
@@ -25,7 +25,8 @@ module Principles
|
|
|
25
25
|
OPEN_FINDINGS_ELSEWHERE = "Where an entry names `open_finding_ids`" #: String
|
|
26
26
|
|
|
27
27
|
# The question every member's assessment answers, which a completed record digests with the description:
|
|
28
|
-
# the whole question, what observed means too, however much of it a request prints
|
|
28
|
+
# the whole question, what observed means too, however much of it a request prints, but not whether each rule
|
|
29
|
+
# is enforced, which only the set's assessment answers.
|
|
29
30
|
#: () -> String
|
|
30
31
|
def self.question = question_paragraphs.join(" ")
|
|
31
32
|
|
|
@@ -146,11 +147,14 @@ module Principles
|
|
|
146
147
|
carried_forward_instruction, mapped_elsewhere_instruction, AssessmentAnswerGuide.new(@members).instruction]
|
|
147
148
|
end
|
|
148
149
|
|
|
149
|
-
# The question, defining observed only when a member is judged afresh, whose delivery it guides
|
|
150
|
+
# The question, defining observed only when a member is judged afresh, whose delivery it guides, then whether
|
|
151
|
+
# each rule is enforced, which the set's assessment answers afresh at every audit. A record digests the question
|
|
152
|
+
# without it, so asking it still carries forward each member's last assessment, which never answered it.
|
|
150
153
|
#: () -> Instruction
|
|
151
154
|
def question
|
|
152
155
|
assess, observed = AssessmentRequest.question_paragraphs
|
|
153
|
-
|
|
156
|
+
enforced = Prompts.text("assess-every-member/ask-whether-each-rule-is-enforced")
|
|
157
|
+
Instruction.new("question", [[assess, true], [observed, @members.judged_afresh?], [enforced, true]])
|
|
154
158
|
end
|
|
155
159
|
|
|
156
160
|
# Why each member with judge_because is judged afresh, explaining only the values the members carry, so the
|
|
@@ -111,18 +111,24 @@ module Principles
|
|
|
111
111
|
"To add a member to an existing principle: #{add}\nTo map a distinct principle: #{create}"
|
|
112
112
|
end
|
|
113
113
|
|
|
114
|
-
# The survey, leaving out files possibly test data, and when outlines were cut
|
|
115
|
-
#
|
|
114
|
+
# The survey and how rules group into principles, leaving out files possibly test data, and when outlines were cut
|
|
115
|
+
# or left out how to read them, then what to ask after the table, in order: the choice, where else guidance is
|
|
116
|
+
# kept, and the owner about each list that names a file.
|
|
116
117
|
#: (Found, survey: String, choice: String) -> String
|
|
117
118
|
def principle_question(found, survey:, choice:)
|
|
118
119
|
owner_asks = found.owner_asks
|
|
119
|
-
|
|
120
|
-
[
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
owner = Prompts.text("find-a-principle-to-map/ask-the-owner")
|
|
121
|
+
asks = [choice, Prompts.text("find-a-principle-to-map/ask-about-other-guidance-search-paths"),
|
|
122
|
+
*owner_asks.map { |key, paths| "#{owner} #{owner_ask(key, named: inline(paths))}" }]
|
|
123
|
+
[survey, Prompts.text("find-a-principle-to-map/group-rules-into-principles"),
|
|
124
|
+
*left_out_of_the_survey(owner_asks), *budget_notes(found), in_order(asks)].join("\n\n")
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# asks as one numbered list, after the line saying to ask them in that order once the table is shown.
|
|
128
|
+
#: (Array[String]) -> String
|
|
129
|
+
def in_order(asks)
|
|
130
|
+
[Prompts.text("find-a-principle-to-map/ask-in-this-order-after-the-table"),
|
|
131
|
+
*asks.each_with_index.map { |ask, index| "#{index + 1}. #{ask}" }].join("\n")
|
|
126
132
|
end
|
|
127
133
|
|
|
128
134
|
# How to read what the budget cut: a cut section back by its lines, and a file whose outline was left out.
|
|
@@ -55,7 +55,7 @@ module Principles
|
|
|
55
55
|
{ "finding_id" => finding["id"], "action" => named.fetch("action"),
|
|
56
56
|
"reason" => named.fetch("reason"), "changed_members" => [], "removed_members" => [],
|
|
57
57
|
"evidence" => [],
|
|
58
|
-
"reassessment" =>
|
|
58
|
+
"reassessment" => nil, "recorded_at" => nil, "waits_on" => nil }
|
|
59
59
|
end)
|
|
60
60
|
end
|
|
61
61
|
|
|
@@ -27,6 +27,7 @@ module Principles
|
|
|
27
27
|
{ "principle" => id,
|
|
28
28
|
"brief" => Prompts.text("run-a-first-audit-in-the-background/follow-the-brief",
|
|
29
29
|
id: id, answer_file: ShellWord.new(@invocation.answer_file(id)).to_s,
|
|
30
|
+
project_root: @invocation.project,
|
|
30
31
|
index: @invocation.in_project("start-audit", id, options: ["--part", "index"]),
|
|
31
32
|
template: @invocation.in_project("start-audit", id, options: ["--as", "template"])),
|
|
32
33
|
"wrote" => [] }
|
|
@@ -44,6 +44,11 @@ module Principles
|
|
|
44
44
|
{ "principles" => entries, "next_action" => listed_next_action(entries, waiting, one_to_audit).join("\n") }
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
+
# list-principles --lines: each mapped principle's id on a line of its own, for a shell loop; nothing when none
|
|
48
|
+
# is mapped.
|
|
49
|
+
#: (Array[String]) -> Lines
|
|
50
|
+
def ids(ids) = Lines.new(stdout: ids.map { "#{it}\n" }.join, stderr: "", status: 0)
|
|
51
|
+
|
|
47
52
|
# Each of list-principles' entries with its principle's open findings, a line each, for --open-findings. open
|
|
48
53
|
# maps each principle id to its findings' plain fields, as list-open-findings --lines takes them.
|
|
49
54
|
#: (Array[Hash[String, untyped]], Hash[String, Array[Hash[String, untyped]]]) -> Array[Hash[String, untyped]]
|
|
@@ -4,7 +4,7 @@ carries its `problem` as that audit stated it, its members under their ids now,
|
|
|
4
4
|
member is `current`, `changed` or `removed` since that audit. Read its write-up where `recorded_at` points when
|
|
5
5
|
there is one. A finding marked `text_not_kept` has no statement; judge it from its members.
|
|
6
6
|
|
|
7
|
-
Decide `still_holds` to keep it. Give `recorded_at` to point at a new write-up, and `problem`, one line, when the
|
|
7
|
+
Decide `still_holds` to keep it. Give `recorded_at` to point at a new write-up, as `{"url": "https://..."}` when it is outside the project, and `problem`, one line, when the
|
|
8
8
|
finding is marked `text_not_kept` or to restate its problem when a term in it was renamed or a fact it names moved,
|
|
9
9
|
since a different problem is a new finding; the record keeps its `first_raised_at`, so leave that field out unless an
|
|
10
10
|
earlier record held the same finding; to claim that, read this field whole.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
Deferred with recorded_at null: %{finding_ids}. That is allowed when there is nowhere to point; the record then
|
|
2
2
|
keeps no pointer, so list-open-findings prints no write-up. If one is written up in a project file, point its
|
|
3
|
-
recorded_at there and check again; if it is written up outside the project, such as in an issue,
|
|
3
|
+
recorded_at there and check again; if it is written up outside the project, such as in an issue, set its recorded_at to {"url": ...} with the link.
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
Address each finding with an authorised edit, or record it as deferred, accepted or disagreed. The
|
|
2
2
|
template leaves each `action` as a placeholder: set it to fixed, deferred, accepted or disagreed for each finding. A
|
|
3
|
-
fixed finding needs an actual change to its members, evidence and a reassessment. Replace
|
|
4
|
-
template gives
|
|
5
|
-
sample into the field it illustrates, `waits_on` included; either one sent
|
|
3
|
+
fixed finding needs an actual change to its members, evidence and a reassessment. Replace the placeholder the
|
|
4
|
+
template gives each `reason` with your own words, write a `reassessment` only on a fix, where it prints null,
|
|
5
|
+
and do not copy an `answer_guide` sample into the field it illustrates, `waits_on` included; either one sent
|
|
6
|
+
back unchanged is refused. Keep the project's
|
|
6
7
|
owner-approval process; this tool edits nothing. The audit record keeps each finding's members, its
|
|
7
8
|
`problem` as you stated it, its disposition and your reason, and `list-open-findings` prints the reason. So when you write a finding up somewhere the project keeps, such as a ticket
|
|
8
9
|
or a notes file, set its `recorded_at` to that place, as `{"path": ..., "heading": ...}` or with
|
|
9
|
-
`starting_at`, and the record keeps the pointer. When the write-up is outside the project, such as an issue or a tracker comment,
|
|
10
|
+
`starting_at`, and the record keeps the pointer. When the write-up is outside the project, such as an issue or a tracker comment, set `recorded_at` to `{"url": "https://..."}`, its whole link alone; this tool never reads it, so `list-open-findings` prints no opening for it. Leave it null when there is nowhere to point. `list-open-findings` prints the first non-blank line where `recorded_at` points, so open a write-up with one line saying what the finding is. Point with `starting_at` at the line that states the problem, rather than at a heading alone, since a heading is often followed by a status line or is shared by several findings.
|
|
10
11
|
When a deferral waits on someone, set its `waits_on` to one line saying whom it waits on and to decide what, such as
|
|
11
12
|
"<person>, to approve a CI change", and keep the reason in the write-up. Leave it null when it waits on no one in
|
|
12
13
|
particular. Only a deferral may give one, and this tool records when it was asked.
|
data/lib/principles/views/prompts/find-a-principle-to-map/ask-about-other-guidance-search-paths.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
Ask where else this repository keeps guidance agents follow, including other harness folders,
|
|
2
2
|
linked documents, templates and executable checks. You judge which files carry principles; this inventory does not
|
|
3
3
|
establish that a host loads them. To include a location in a read-only survey now, repeat --also with a quoted
|
|
4
4
|
root-relative glob. This option does not record the location for later surveys.
|
data/lib/principles/views/prompts/find-a-principle-to-map/ask-in-this-order-after-the-table.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
After the table, in this order:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Ask the project's owner
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
sentence of your own.
|
|
1
|
+
Ask the user which principle to map first, or whether to map them all. Give each a lower-kebab-case id, and describe
|
|
2
|
+
it in one sentence of your own.
|
data/lib/principles/views/prompts/find-a-principle-to-map/choose-an-existing-or-new-principle.md
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
Ask which existing principle to extend with add-member, or which distinct principle to map with create-principle, or
|
|
2
|
+
whether to map them all. For a new map, choose a lower-kebab-case id and describe what the principle is and why it
|
|
3
|
+
matters.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
Survey this project's principles: the
|
|
1
|
+
Survey this project's principles: the intents that several pieces of its agent guidance carry together. Read
|
|
2
2
|
each listed Markdown file's outline, description and opening line printed here, not the files themselves.
|
|
3
3
|
For a selected non-Markdown file listed by path and size, inspect that file only if needed to judge the rule it
|
|
4
4
|
enforces; listing it does not show its contents. Show the user one
|
|
5
5
|
table, with a row for each principle: a name of a word or two, a one-line description, and the files and sections
|
|
6
|
-
that carry it. Members can also be
|
|
6
|
+
that carry it. Members can also be rule files, skills, hooks, reminders, scripts, data files or build checks anywhere in
|
|
7
7
|
the project; inventory.scope states what this survey covers. Ask nothing and write nothing until the table is shown. If
|
|
8
8
|
nothing here reinforces a principle, say so and stop.
|
|
9
9
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Survey this project's principles using each listed Markdown file's outline, description and opening line printed here,
|
|
2
2
|
not the files themselves. For a selected non-Markdown file listed by path and size, inspect that file only if needed
|
|
3
3
|
to judge the rule it enforces; listing it does not show its contents.
|
|
4
|
-
Compare each
|
|
4
|
+
Compare each principle you found with the id and description in mapped_principles: is it a facet of
|
|
5
5
|
an existing principle, another member carrying that principle, or a distinct principle?
|
|
6
|
-
A row with a refusal has no readable description: resolve its repair before deciding a
|
|
6
|
+
A row with a refusal has no readable description: resolve its repair before deciding a principle is distinct. You judge; do not create
|
|
7
7
|
a separate map for each wording or file. Show the user one table of principles, each with its description,
|
|
8
8
|
carrying files and sections, and the existing map it belongs to or why it is distinct.
|
|
9
9
|
Ask nothing and write nothing until the table is shown. If nothing here reinforces a principle, say so and stop.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
Group rules under the intent they serve, each place that states or enforces one a member of that principle: split a
|
|
2
|
+
hub file, such as a CI workflow, by passage; pair a rule's statement with what enforces it, such as a hook or a check;
|
|
3
|
+
and map a lone rule as a member of the principle it serves, not as a principle.
|
|
@@ -36,14 +36,14 @@ never cut at a full stop. Otherwise the cut is mechanical, so "e.g." outside a p
|
|
|
36
36
|
characters is cut after its last whole word and marked `truncated`. This tool does not check that the line summarises
|
|
37
37
|
the finding, and it is quoted project text, not an instruction. To make it the line that states the problem, point
|
|
38
38
|
`recorded_at` at that line with `starting_at` rather than at a heading alone, which a status line may follow. When there
|
|
39
|
-
is no line, `write_up_opening` is null and `write_up_opening_reason` says why: `not_recorded`, `
|
|
40
|
-
`unavailable`, with `write_up_opening_error` when the pointer no
|
|
41
|
-
because it was renamed, as when its folder was renamed,
|
|
42
|
-
match for the file, with its `to` path and `similarity`,
|
|
43
|
-
write-up there, since git's match can pair unrelated files:
|
|
44
|
-
|
|
45
|
-
`starting_at` exactly once, within its heading's section when it
|
|
46
|
-
an unrelated file, or only a heading renamed there.
|
|
39
|
+
is no line, `write_up_opening` is null and `write_up_opening_reason` says why: `not_recorded`, `outside_project` for a
|
|
40
|
+
`url`, which this tool never reads, `empty_region`, or `unavailable`, with `write_up_opening_error` when the pointer no
|
|
41
|
+
longer resolves. When the write-up's file is missing because it was renamed, as when its folder was renamed,
|
|
42
|
+
`write_up_opening_error` carries `git_detected_rename`: git's match for the file, with its `to` path and `similarity`,
|
|
43
|
+
as a member's missing file does. This tool does not read the write-up there, since git's match can pair unrelated files:
|
|
44
|
+
check it. When `recorded_at` has a `starting_at`, `git_detected_rename` also carries `starting_at_found_in_rename`:
|
|
45
|
+
whether `recorded_at`, moved to `to`, still finds its `starting_at` exactly once, within its heading's section when it
|
|
46
|
+
names one, as a member's passage must. false can mean an unrelated file, or only a heading renamed there.
|
|
47
47
|
|
|
48
48
|
To change what an open finding waits on, its action or its write-up without a full audit, run `start-audit ID
|
|
49
49
|
--open-findings`, which lists the principle's open findings as this command does; its `decisions` template names each by
|
|
@@ -3,6 +3,8 @@ Run it to decide which principle to look at or audit.
|
|
|
3
3
|
To say what principles are in place and what each still waits on, give `--open-findings`, rather than joining
|
|
4
4
|
this list with `list-open-findings`: each row adds `open_findings`, one line per finding its last completed audit
|
|
5
5
|
deferred or accepted, with its id, whom it waits on, or that it is accepted, and how many days it has been open.
|
|
6
|
+
To loop over the principles in a shell, give `--lines` rather than pulling ids out of this JSON: it prints each
|
|
7
|
+
mapped principle's id alone, one per line, a map it cannot read included, and nothing when none is mapped.
|
|
6
8
|
With nothing mapped, `next_action` names `list-candidate-files`, which surveys the project's principles for the user.
|
|
7
9
|
When the `sticking-to-your-principles` map has no members, its row adds `no_members`: setup no longer writes
|
|
8
10
|
that map before its first member, so an earlier setup, or removing its last member, left it. It names the map's
|
|
@@ -6,7 +6,7 @@ at a pause, since principles would ask.
|
|
|
6
6
|
2. Read the request in parts, which costs about the bytes of the whole request and its member files. Type
|
|
7
7
|
part_command and then the part as printed, never in a shell variable. Its parts: %{index}
|
|
8
8
|
|
|
9
|
-
3. Keep every answer file at %{answer_file}, never
|
|
9
|
+
3. Keep every answer file at %{answer_file}, never under %{project_root}. Redirect the template
|
|
10
10
|
below there and edit it, running each member check the request names and no script over this output.
|
|
11
11
|
Check it with show-answer-check, then submit-answer, each with --file and that path; answer a
|
|
12
12
|
correction the same way. On a stale_request refusal, start once more. Its template: %{template}
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: principles
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sidu Ponnappa
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-11-
|
|
10
|
+
date: 2026-11-24 00:00:00.000000000 Z
|
|
11
11
|
dependencies: []
|
|
12
12
|
description: |
|
|
13
13
|
A harness configuration framework that keeps every part of your Claude Code agent's harness in alignment.
|
|
@@ -70,6 +70,7 @@ files:
|
|
|
70
70
|
- lib/principles/data/candidate_files_found.rb
|
|
71
71
|
- lib/principles/data/command-steps.json
|
|
72
72
|
- lib/principles/data/command_steps_file.rb
|
|
73
|
+
- lib/principles/data/committed_texts.rb
|
|
73
74
|
- lib/principles/data/committed_tree.rb
|
|
74
75
|
- lib/principles/data/expected_type.rb
|
|
75
76
|
- lib/principles/data/first_parent_log.rb
|
|
@@ -107,11 +108,13 @@ files:
|
|
|
107
108
|
- lib/principles/data/schemas/member-map-history.schema.json
|
|
108
109
|
- lib/principles/data/schemas/member-map.schema.json
|
|
109
110
|
- lib/principles/data/verified_head.rb
|
|
111
|
+
- lib/principles/data/working_tree_changes.rb
|
|
110
112
|
- lib/principles/error.rb
|
|
111
113
|
- lib/principles/failure_refusal.rb
|
|
112
114
|
- lib/principles/invocation_options.rb
|
|
113
115
|
- lib/principles/launch.rb
|
|
114
116
|
- lib/principles/list_open_findings_options.rb
|
|
117
|
+
- lib/principles/list_principles_options.rb
|
|
115
118
|
- lib/principles/models/accepted_loading.rb
|
|
116
119
|
- lib/principles/models/acknowledged_check.rb
|
|
117
120
|
- lib/principles/models/acknowledgement.rb
|
|
@@ -380,6 +383,7 @@ files:
|
|
|
380
383
|
- lib/principles/views/prompts/answer-any-judgement-request/fill-the-answer-in-a-file.md
|
|
381
384
|
- lib/principles/views/prompts/answer-any-judgement-request/what-a-self-audit-cannot-show.md
|
|
382
385
|
- lib/principles/views/prompts/assess-every-member/answer-guide.json
|
|
386
|
+
- lib/principles/views/prompts/assess-every-member/ask-whether-each-rule-is-enforced.md
|
|
383
387
|
- lib/principles/views/prompts/assess-every-member/assess-each-member-and-the-set.md
|
|
384
388
|
- lib/principles/views/prompts/assess-every-member/check-roles-other-principles-give-these-lines.md
|
|
385
389
|
- lib/principles/views/prompts/assess-every-member/claim-an-earlier-first-raised-at.md
|
|
@@ -419,11 +423,13 @@ files:
|
|
|
419
423
|
- lib/principles/views/prompts/dispose-of-each-finding/fix-or-record-each-finding.md
|
|
420
424
|
- lib/principles/views/prompts/dispose-of-each-finding/retain-assessment-and-correction.md
|
|
421
425
|
- lib/principles/views/prompts/find-a-principle-to-map/ask-about-other-guidance-search-paths.md
|
|
422
|
-
- lib/principles/views/prompts/find-a-principle-to-map/ask-
|
|
426
|
+
- lib/principles/views/prompts/find-a-principle-to-map/ask-in-this-order-after-the-table.md
|
|
427
|
+
- lib/principles/views/prompts/find-a-principle-to-map/ask-the-owner.md
|
|
423
428
|
- lib/principles/views/prompts/find-a-principle-to-map/ask-which-principle-to-map.md
|
|
424
429
|
- lib/principles/views/prompts/find-a-principle-to-map/choose-an-existing-or-new-principle.md
|
|
425
430
|
- lib/principles/views/prompts/find-a-principle-to-map/choose-one-principle.md
|
|
426
431
|
- lib/principles/views/prompts/find-a-principle-to-map/compare-with-mapped-principles.md
|
|
432
|
+
- lib/principles/views/prompts/find-a-principle-to-map/group-rules-into-principles.md
|
|
427
433
|
- lib/principles/views/prompts/find-a-principle-to-map/leave-test-data-out-of-the-survey.md
|
|
428
434
|
- lib/principles/views/prompts/find-a-principle-to-map/owner-ask-ignored-folders.md
|
|
429
435
|
- lib/principles/views/prompts/find-a-principle-to-map/owner-ask-ignored.md
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
After the table, ask the project's owner:
|