@codyswann/lisa 4.4.17 → 4.4.19

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 (69) hide show
  1. package/all/copy-overwrite/scripts/lisa-hooks/block-direct-issue-create.sh +53 -13
  2. package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
  3. package/dist/core/lisa-owned-hash-ledger.js +2 -0
  4. package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
  5. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  6. package/dist/core/upstream-evidence-manifest.js +12 -7
  7. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  8. package/expo/create-only/.github/required-checks.json +4 -2
  9. package/nestjs/create-only/.github/required-checks.json +4 -2
  10. package/package.json +2 -1
  11. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  12. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  13. package/plugins/lisa/hooks/block-direct-issue-create.sh +53 -13
  14. package/plugins/lisa-agy/hooks/block-direct-issue-create.sh +53 -13
  15. package/plugins/lisa-agy/plugin.json +1 -1
  16. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  17. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  18. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  19. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  20. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  21. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  22. package/plugins/lisa-copilot/hooks/block-direct-issue-create.sh +53 -13
  23. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  24. package/plugins/lisa-cursor/hooks/block-direct-issue-create.sh +53 -13
  25. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  26. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  27. package/plugins/lisa-expo-agy/plugin.json +1 -1
  28. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  29. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  30. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  31. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  32. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  33. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  34. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  35. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  36. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  37. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  38. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  39. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  40. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  41. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  42. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  43. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  44. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  45. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  46. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  47. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  48. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  49. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  50. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  51. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  52. package/plugins/lisa-rails-agy/plugin.json +1 -1
  53. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  54. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  55. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  56. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  57. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  58. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  59. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  60. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  61. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  62. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  63. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  64. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  65. package/plugins/src/base/hooks/block-direct-issue-create.sh +53 -13
  66. package/typescript/copy-overwrite/scripts/check-skipped-required-checks.mjs +593 -24
  67. package/typescript/create-only/.github/required-checks.json +4 -2
  68. package/typescript/create-only/.github/workflows/review-evidence.yml +122 -0
  69. package/typescript/package-lisa/package.lisa.json +1 -1
@@ -10,9 +10,11 @@
10
10
  "`_example_required_contexts` below is a STARTING POINT FOR TYPING, never read by the guard. Verify every line against your own ruleset before promoting any of it.",
11
11
  "THE FAMILY: required-and-red is loud; required-and-vacuous is not; advisory-and-stale is invisible. All three are one gate reporting satisfied without proving anything. `required_contexts` + `skip_job_declarations` above cover the SKIPPED variant; `evidence_bearing_checks` below covers the VACUOUS one.",
12
12
  "VACUOUS, measured (CodySwannGT/lisa#2497): a required `CodeRabbit` context posted `success` with the description `Review rate limited`, having reviewed nothing, on two security-relevant PRs that then merged and shipped. `gh pr checks` prints `pass` for that exactly as it does for a real review — only the DESCRIPTION tells them apart.",
13
- "Run it per PR: `npm run check:vacuous-required-checks -- --pr=1234` (or `node scripts/check-skipped-required-checks.mjs --pr=1234`). It reads `gh pr checks --json name,state,bucket,description`, which is the only route that carries the description for a legacy commit status like CodeRabbit's.",
13
+ "NOTHING HAS TO REMEMBER A FLAG. `.github/workflows/review-evidence.yml` runs this arm on every pull request, and `npm run check:vacuous-required-checks` resolves the pull request itself: `--pr`, else the `pull_request` payload at GITHUB_EVENT_PATH, else `refs/pull/N/merge` in GITHUB_REF, else the checked-out branch. For one specific pull request by hand: `npm run check:vacuous-required-checks -- --pr=1234`.",
14
+ "It reads `gh pr checks --json name,state,bucket,description`, the only route that carries the description for a legacy commit status like CodeRabbit's, and falls back to the commit-status API when the token lacks `actions: read` (`gh pr checks` resolves the rollup through `checkSuite.workflowRun`, and without that scope it exits non-zero with EMPTY STDOUT — a failure shaped like a content problem that never says the word \"permission\").",
15
+ "IT REFUSES RATHER THAN REPORTING AN EMPTY INSPECTION. An unresolvable pull request, a `gh` it could not read, a roster with no checks in it, or an empty `evidence_bearing_checks` all print the same \"nothing vacuous here\" that a genuinely clean run prints — so the guard fails instead and names which of the four it hit (`vacuity_pr_unresolved`, `vacuity_checks_unreadable`, `vacuity_no_checks_reported`, `vacuity_none_declared`). A refusal is NOT a finding: NOBODY LOOKED and THE REVIEW WAS FAKE are opposite facts, and a single red job would otherwise report them identically.",
14
16
  "`evidence_bearing_checks` names the checks whose GREEN is supposed to mean something reviewed the code. Use `{}` to accept the shipped description vocabulary, or add `proof` / `no_work` arrays to extend it — extensions ADD to the defaults, they do not replace them. Undeclared checks are never examined, because most CI jobs ship an empty description and flagging them all would bury the one finding that matters.",
15
- "This arm REPORTS AND NEVER BLOCKS, in every enforcement mode. A review bot can go hollow because an org-wide SPENDING CAP was hit, and a gate that reddens every PR on a billing state is worse than the one it criticises. What it changes is what you may CLAIM: a PR carrying a `vacuous_required_check` finding has not been shown to be reviewed, so do not record it as reviewed."
17
+ "This arm REPORTS AND NEVER BLOCKS, in every enforcement mode. A review bot can go hollow because an org-wide SPENDING CAP was hit, and a gate that reddens every PR on a billing state is worse than the one it criticises. What it changes is what you may CLAIM: a PR carrying a `vacuous_required_check` finding has not been shown to be reviewed, so do not record it as reviewed. Once you have made the governance call, `--fail-on-vacuous` is the supported way to ask for an exit code — add it to the command in `review-evidence.yml`, instead of writing a wrapper that reads `--json`."
16
18
  ],
17
19
  "enforcement": "warn",
18
20
  "ruleset": {
@@ -10,9 +10,11 @@
10
10
  "`_example_required_contexts` below is a STARTING POINT FOR TYPING, never read by the guard. Verify every line against your own ruleset before promoting any of it.",
11
11
  "THE FAMILY: required-and-red is loud; required-and-vacuous is not; advisory-and-stale is invisible. All three are one gate reporting satisfied without proving anything. `required_contexts` + `skip_job_declarations` above cover the SKIPPED variant; `evidence_bearing_checks` below covers the VACUOUS one.",
12
12
  "VACUOUS, measured (CodySwannGT/lisa#2497): a required `CodeRabbit` context posted `success` with the description `Review rate limited`, having reviewed nothing, on two security-relevant PRs that then merged and shipped. `gh pr checks` prints `pass` for that exactly as it does for a real review — only the DESCRIPTION tells them apart.",
13
- "Run it per PR: `npm run check:vacuous-required-checks -- --pr=1234` (or `node scripts/check-skipped-required-checks.mjs --pr=1234`). It reads `gh pr checks --json name,state,bucket,description`, which is the only route that carries the description for a legacy commit status like CodeRabbit's.",
13
+ "NOTHING HAS TO REMEMBER A FLAG. `.github/workflows/review-evidence.yml` runs this arm on every pull request, and `npm run check:vacuous-required-checks` resolves the pull request itself: `--pr`, else the `pull_request` payload at GITHUB_EVENT_PATH, else `refs/pull/N/merge` in GITHUB_REF, else the checked-out branch. For one specific pull request by hand: `npm run check:vacuous-required-checks -- --pr=1234`.",
14
+ "It reads `gh pr checks --json name,state,bucket,description`, the only route that carries the description for a legacy commit status like CodeRabbit's, and falls back to the commit-status API when the token lacks `actions: read` (`gh pr checks` resolves the rollup through `checkSuite.workflowRun`, and without that scope it exits non-zero with EMPTY STDOUT — a failure shaped like a content problem that never says the word \"permission\").",
15
+ "IT REFUSES RATHER THAN REPORTING AN EMPTY INSPECTION. An unresolvable pull request, a `gh` it could not read, a roster with no checks in it, or an empty `evidence_bearing_checks` all print the same \"nothing vacuous here\" that a genuinely clean run prints — so the guard fails instead and names which of the four it hit (`vacuity_pr_unresolved`, `vacuity_checks_unreadable`, `vacuity_no_checks_reported`, `vacuity_none_declared`). A refusal is NOT a finding: NOBODY LOOKED and THE REVIEW WAS FAKE are opposite facts, and a single red job would otherwise report them identically.",
14
16
  "`evidence_bearing_checks` names the checks whose GREEN is supposed to mean something reviewed the code. Use `{}` to accept the shipped description vocabulary, or add `proof` / `no_work` arrays to extend it — extensions ADD to the defaults, they do not replace them. Undeclared checks are never examined, because most CI jobs ship an empty description and flagging them all would bury the one finding that matters.",
15
- "This arm REPORTS AND NEVER BLOCKS, in every enforcement mode. A review bot can go hollow because an org-wide SPENDING CAP was hit, and a gate that reddens every PR on a billing state is worse than the one it criticises. What it changes is what you may CLAIM: a PR carrying a `vacuous_required_check` finding has not been shown to be reviewed, so do not record it as reviewed."
17
+ "This arm REPORTS AND NEVER BLOCKS, in every enforcement mode. A review bot can go hollow because an org-wide SPENDING CAP was hit, and a gate that reddens every PR on a billing state is worse than the one it criticises. What it changes is what you may CLAIM: a PR carrying a `vacuous_required_check` finding has not been shown to be reviewed, so do not record it as reviewed. Once you have made the governance call, `--fail-on-vacuous` is the supported way to ask for an exit code — add it to the command in `review-evidence.yml`, instead of writing a wrapper that reads `--json`."
16
18
  ],
17
19
  "enforcement": "warn",
18
20
  "ruleset": {
package/package.json CHANGED
@@ -49,6 +49,7 @@
49
49
  "check:pipeline-status-reads": "node scripts/check-pipeline-status-reads.mjs",
50
50
  "check:workflow-inputs": "node scripts/detect-stale-workflow-inputs.mjs --project . --project typescript/create-only --project rails/create-only --json",
51
51
  "check:conflict-markers": "node all/copy-overwrite/scripts/check-conflict-markers.mjs",
52
+ "check:vacuous-required-checks": "node typescript/copy-overwrite/scripts/check-skipped-required-checks.mjs --vacuity",
52
53
  "check:orphan-processes": "node scripts/check-orphan-test-processes.mjs",
53
54
  "check:template-workflow-refs": "node scripts/check-template-workflow-refs.mjs",
54
55
  "check:workflow-package-paths": "node scripts/check-workflow-package-paths.mjs",
@@ -146,7 +147,7 @@
146
147
  "zod-validation-error": "^4.0.0"
147
148
  },
148
149
  "name": "@codyswann/lisa",
149
- "version": "4.4.17",
150
+ "version": "4.4.19",
150
151
  "description": "Claude Code governance framework that applies guardrails, guidance, and automated enforcement to projects",
151
152
  "main": "dist/index.js",
152
153
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "4.4.17",
3
+ "version": "4.4.19",
4
4
  "description": "Universal governance — agents, skills, commands, hooks, and rules for all projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "4.4.17",
3
+ "version": "4.4.19",
4
4
  "description": "Universal governance: agents, skills, commands, hooks, and rules for all projects.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -389,13 +389,21 @@ POST_PAYLOAD_FLAGS = {
389
389
  # read as an endpoint: it is data being sent, not the address being posted to.
390
390
  PAYLOAD_VALUE_FLAGS = {"-f", "-F", "--raw-field", "--field"}
391
391
 
392
- GITHUB_ISSUES_PATH = re.compile(r"repos/[^/\s]+/[^/\s]+/issues/?$")
392
+ # Matched against a token's PATH COMPONENT, never the raw argument — see
393
+ # `endpoint_path`. The `$` anchor is load-bearing and stays: without it
394
+ # `repos/o/r/issues/123/comments` reads as a creation, which is a different
395
+ # operation this guard must not refuse. The segment classes exclude `?` and
396
+ # `#` so the anchor cannot be reached past a decoration even if some future
397
+ # caller forgets to parse first.
398
+ GITHUB_ISSUES_PATH = re.compile(r"repos/[^/\s?#]+/[^/\s?#]+/issues/?$")
393
399
  GITHUB_ISSUES_URL = re.compile(r"api\.github\.com/repos/[^/\s]+/[^/\s]+/issues")
394
400
  # The repository a creation is ADDRESSED at, which decides whose ready role
395
401
  # answers for it. `gh` accepts the flag before or after the subcommand and in
396
402
  # either spelling, and the REST paths carry the same pair positionally.
397
403
  REPO_FLAGS = {"--repo", "-R"}
398
- GITHUB_ISSUES_PATH_REPO = re.compile(r"repos/([^/\s]+)/([^/\s]+)/issues/?$")
404
+ GITHUB_ISSUES_PATH_REPO = re.compile(
405
+ r"repos/([^/\s?#]+)/([^/\s?#]+)/issues/?$"
406
+ )
399
407
  GITHUB_ISSUES_URL_REPO = re.compile(
400
408
  r"api\.github\.com/repos/([^/\s]+)/([^/\s]+)/issues"
401
409
  )
@@ -663,8 +671,33 @@ def is_write_request(args):
663
671
  return False
664
672
 
665
673
 
666
- def endpoint_tokens(args, pattern):
667
- """Tokens naming an API endpoint, excluding payload values.
674
+ def endpoint_path(token):
675
+ """The path component of an endpoint-shaped argument.
676
+
677
+ An endpoint is a URL, and a URL is not its path: `?query` and `#fragment`
678
+ are separate components that address the SAME resource. Comparing the raw
679
+ argument against a path pattern therefore recognised a URL SHAPE rather
680
+ than an endpoint, and `repos/o/r/issues?foo=1` — the identical request —
681
+ was classified as a non-creation and allowed (#2939).
682
+
683
+ Trailing whitespace is stripped for the same reason: `"repos/o/r/issues "`
684
+ survives shlex as one token and addresses the same endpoint, but defeats an
685
+ end-anchored comparison just as a query string does.
686
+
687
+ Args:
688
+ token: One argument, possibly a decorated endpoint.
689
+
690
+ Returns:
691
+ The token with any fragment, query, and surrounding whitespace removed.
692
+ """
693
+ # Fragment first: it is the LAST component of a URL, so `path?q#f` yields
694
+ # `path?q` here and `path` after the query split, while a malformed
695
+ # `path#a?b` still collapses to `path` rather than keeping `a?b`.
696
+ return token.split("#", 1)[0].split("?", 1)[0].strip()
697
+
698
+
699
+ def endpoint_paths(args, pattern):
700
+ """Endpoint path components matching a pattern, excluding payload values.
668
701
 
669
702
  Scans every token rather than a filtered positional list, because a BOOLEAN
670
703
  flag has no value to skip and filtering swallowed the endpoint behind one:
@@ -672,21 +705,28 @@ def endpoint_tokens(args, pattern):
672
705
  behind `--silent`. Payload values are excluded the other way, so
673
706
  `-f path=repos/o/r/issues` is not mistaken for the address being posted to.
674
707
 
708
+ That payload exclusion is tested on the PATH, not the raw token, and the
709
+ order matters: a query string carries `=`, so testing the raw token skipped
710
+ `repos/o/r/issues?foo=1` before the pattern ever ran. Two independent
711
+ mechanisms — this filter and the pattern's end anchor — hid the same
712
+ creation, which is why fixing only the anchor would not have closed it.
713
+
675
714
  Args:
676
715
  args: A command's arguments.
677
- pattern: The endpoint regex.
716
+ pattern: The endpoint regex, written against a path component.
678
717
 
679
718
  Returns:
680
- Matching endpoint tokens.
719
+ The matching path components, decoration removed.
681
720
  """
682
721
  found = []
683
722
  for index, token in enumerate(args):
684
- if "=" in token:
723
+ path = endpoint_path(token)
724
+ if "=" in path:
685
725
  continue
686
726
  if index > 0 and args[index - 1] in PAYLOAD_VALUE_FLAGS:
687
727
  continue
688
- if pattern.search(token):
689
- found.append(token)
728
+ if pattern.search(path):
729
+ found.append(path)
690
730
  return found
691
731
 
692
732
 
@@ -712,7 +752,7 @@ def creation_signature(name, args):
712
752
  if "api" in args:
713
753
  if GRAPHQL_CREATE.search(joined):
714
754
  return "gh api graphql issue creation"
715
- if endpoint_tokens(args, GITHUB_ISSUES_PATH) and is_write_request(args):
755
+ if endpoint_paths(args, GITHUB_ISSUES_PATH) and is_write_request(args):
716
756
  return "gh api POST .../issues"
717
757
  return None
718
758
 
@@ -820,7 +860,7 @@ def target_repository(args):
820
860
  Read only from positions that actually reach the created item: a flag
821
861
  before the end-of-options marker, or the endpoint the write is posted to.
822
862
  A `-f repo=o/r` payload field is data being SENT, not the address being
823
- posted to, and `endpoint_tokens` already excludes it.
863
+ posted to, and `endpoint_paths` already excludes it.
824
864
 
825
865
  Args:
826
866
  args: A creating command's arguments.
@@ -837,8 +877,8 @@ def target_repository(args):
837
877
  head, value = token.split("=", 1)
838
878
  if head in REPO_FLAGS:
839
879
  return normalise_repo(value)
840
- for token in endpoint_tokens(scoped, GITHUB_ISSUES_PATH):
841
- match = GITHUB_ISSUES_PATH_REPO.search(token)
880
+ for path in endpoint_paths(scoped, GITHUB_ISSUES_PATH):
881
+ match = GITHUB_ISSUES_PATH_REPO.search(path)
842
882
  if match:
843
883
  return normalise_repo("%s/%s" % (match.group(1), match.group(2)))
844
884
  for token in scoped:
@@ -389,13 +389,21 @@ POST_PAYLOAD_FLAGS = {
389
389
  # read as an endpoint: it is data being sent, not the address being posted to.
390
390
  PAYLOAD_VALUE_FLAGS = {"-f", "-F", "--raw-field", "--field"}
391
391
 
392
- GITHUB_ISSUES_PATH = re.compile(r"repos/[^/\s]+/[^/\s]+/issues/?$")
392
+ # Matched against a token's PATH COMPONENT, never the raw argument — see
393
+ # `endpoint_path`. The `$` anchor is load-bearing and stays: without it
394
+ # `repos/o/r/issues/123/comments` reads as a creation, which is a different
395
+ # operation this guard must not refuse. The segment classes exclude `?` and
396
+ # `#` so the anchor cannot be reached past a decoration even if some future
397
+ # caller forgets to parse first.
398
+ GITHUB_ISSUES_PATH = re.compile(r"repos/[^/\s?#]+/[^/\s?#]+/issues/?$")
393
399
  GITHUB_ISSUES_URL = re.compile(r"api\.github\.com/repos/[^/\s]+/[^/\s]+/issues")
394
400
  # The repository a creation is ADDRESSED at, which decides whose ready role
395
401
  # answers for it. `gh` accepts the flag before or after the subcommand and in
396
402
  # either spelling, and the REST paths carry the same pair positionally.
397
403
  REPO_FLAGS = {"--repo", "-R"}
398
- GITHUB_ISSUES_PATH_REPO = re.compile(r"repos/([^/\s]+)/([^/\s]+)/issues/?$")
404
+ GITHUB_ISSUES_PATH_REPO = re.compile(
405
+ r"repos/([^/\s?#]+)/([^/\s?#]+)/issues/?$"
406
+ )
399
407
  GITHUB_ISSUES_URL_REPO = re.compile(
400
408
  r"api\.github\.com/repos/([^/\s]+)/([^/\s]+)/issues"
401
409
  )
@@ -663,8 +671,33 @@ def is_write_request(args):
663
671
  return False
664
672
 
665
673
 
666
- def endpoint_tokens(args, pattern):
667
- """Tokens naming an API endpoint, excluding payload values.
674
+ def endpoint_path(token):
675
+ """The path component of an endpoint-shaped argument.
676
+
677
+ An endpoint is a URL, and a URL is not its path: `?query` and `#fragment`
678
+ are separate components that address the SAME resource. Comparing the raw
679
+ argument against a path pattern therefore recognised a URL SHAPE rather
680
+ than an endpoint, and `repos/o/r/issues?foo=1` — the identical request —
681
+ was classified as a non-creation and allowed (#2939).
682
+
683
+ Trailing whitespace is stripped for the same reason: `"repos/o/r/issues "`
684
+ survives shlex as one token and addresses the same endpoint, but defeats an
685
+ end-anchored comparison just as a query string does.
686
+
687
+ Args:
688
+ token: One argument, possibly a decorated endpoint.
689
+
690
+ Returns:
691
+ The token with any fragment, query, and surrounding whitespace removed.
692
+ """
693
+ # Fragment first: it is the LAST component of a URL, so `path?q#f` yields
694
+ # `path?q` here and `path` after the query split, while a malformed
695
+ # `path#a?b` still collapses to `path` rather than keeping `a?b`.
696
+ return token.split("#", 1)[0].split("?", 1)[0].strip()
697
+
698
+
699
+ def endpoint_paths(args, pattern):
700
+ """Endpoint path components matching a pattern, excluding payload values.
668
701
 
669
702
  Scans every token rather than a filtered positional list, because a BOOLEAN
670
703
  flag has no value to skip and filtering swallowed the endpoint behind one:
@@ -672,21 +705,28 @@ def endpoint_tokens(args, pattern):
672
705
  behind `--silent`. Payload values are excluded the other way, so
673
706
  `-f path=repos/o/r/issues` is not mistaken for the address being posted to.
674
707
 
708
+ That payload exclusion is tested on the PATH, not the raw token, and the
709
+ order matters: a query string carries `=`, so testing the raw token skipped
710
+ `repos/o/r/issues?foo=1` before the pattern ever ran. Two independent
711
+ mechanisms — this filter and the pattern's end anchor — hid the same
712
+ creation, which is why fixing only the anchor would not have closed it.
713
+
675
714
  Args:
676
715
  args: A command's arguments.
677
- pattern: The endpoint regex.
716
+ pattern: The endpoint regex, written against a path component.
678
717
 
679
718
  Returns:
680
- Matching endpoint tokens.
719
+ The matching path components, decoration removed.
681
720
  """
682
721
  found = []
683
722
  for index, token in enumerate(args):
684
- if "=" in token:
723
+ path = endpoint_path(token)
724
+ if "=" in path:
685
725
  continue
686
726
  if index > 0 and args[index - 1] in PAYLOAD_VALUE_FLAGS:
687
727
  continue
688
- if pattern.search(token):
689
- found.append(token)
728
+ if pattern.search(path):
729
+ found.append(path)
690
730
  return found
691
731
 
692
732
 
@@ -712,7 +752,7 @@ def creation_signature(name, args):
712
752
  if "api" in args:
713
753
  if GRAPHQL_CREATE.search(joined):
714
754
  return "gh api graphql issue creation"
715
- if endpoint_tokens(args, GITHUB_ISSUES_PATH) and is_write_request(args):
755
+ if endpoint_paths(args, GITHUB_ISSUES_PATH) and is_write_request(args):
716
756
  return "gh api POST .../issues"
717
757
  return None
718
758
 
@@ -820,7 +860,7 @@ def target_repository(args):
820
860
  Read only from positions that actually reach the created item: a flag
821
861
  before the end-of-options marker, or the endpoint the write is posted to.
822
862
  A `-f repo=o/r` payload field is data being SENT, not the address being
823
- posted to, and `endpoint_tokens` already excludes it.
863
+ posted to, and `endpoint_paths` already excludes it.
824
864
 
825
865
  Args:
826
866
  args: A creating command's arguments.
@@ -837,8 +877,8 @@ def target_repository(args):
837
877
  head, value = token.split("=", 1)
838
878
  if head in REPO_FLAGS:
839
879
  return normalise_repo(value)
840
- for token in endpoint_tokens(scoped, GITHUB_ISSUES_PATH):
841
- match = GITHUB_ISSUES_PATH_REPO.search(token)
880
+ for path in endpoint_paths(scoped, GITHUB_ISSUES_PATH):
881
+ match = GITHUB_ISSUES_PATH_REPO.search(path)
842
882
  if match:
843
883
  return normalise_repo("%s/%s" % (match.group(1), match.group(2)))
844
884
  for token in scoped:
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "4.4.17",
3
+ "version": "4.4.19",
4
4
  "description": "Universal governance — agents, skills, commands, hooks, and rules for all projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "4.4.17",
3
+ "version": "4.4.19",
4
4
  "description": "AWS CDK-specific plugin",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "4.4.17",
3
+ "version": "4.4.19",
4
4
  "description": "AWS CDK-specific Lisa plugin.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "4.4.17",
3
+ "version": "4.4.19",
4
4
  "description": "AWS CDK-specific plugin",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "4.4.17",
3
+ "version": "4.4.19",
4
4
  "description": "AWS CDK-specific plugin",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "4.4.17",
3
+ "version": "4.4.19",
4
4
  "description": "AWS CDK-specific plugin",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "4.4.17",
3
+ "version": "4.4.19",
4
4
  "description": "Universal governance — agents, skills, commands, hooks, and rules for all projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -389,13 +389,21 @@ POST_PAYLOAD_FLAGS = {
389
389
  # read as an endpoint: it is data being sent, not the address being posted to.
390
390
  PAYLOAD_VALUE_FLAGS = {"-f", "-F", "--raw-field", "--field"}
391
391
 
392
- GITHUB_ISSUES_PATH = re.compile(r"repos/[^/\s]+/[^/\s]+/issues/?$")
392
+ # Matched against a token's PATH COMPONENT, never the raw argument — see
393
+ # `endpoint_path`. The `$` anchor is load-bearing and stays: without it
394
+ # `repos/o/r/issues/123/comments` reads as a creation, which is a different
395
+ # operation this guard must not refuse. The segment classes exclude `?` and
396
+ # `#` so the anchor cannot be reached past a decoration even if some future
397
+ # caller forgets to parse first.
398
+ GITHUB_ISSUES_PATH = re.compile(r"repos/[^/\s?#]+/[^/\s?#]+/issues/?$")
393
399
  GITHUB_ISSUES_URL = re.compile(r"api\.github\.com/repos/[^/\s]+/[^/\s]+/issues")
394
400
  # The repository a creation is ADDRESSED at, which decides whose ready role
395
401
  # answers for it. `gh` accepts the flag before or after the subcommand and in
396
402
  # either spelling, and the REST paths carry the same pair positionally.
397
403
  REPO_FLAGS = {"--repo", "-R"}
398
- GITHUB_ISSUES_PATH_REPO = re.compile(r"repos/([^/\s]+)/([^/\s]+)/issues/?$")
404
+ GITHUB_ISSUES_PATH_REPO = re.compile(
405
+ r"repos/([^/\s?#]+)/([^/\s?#]+)/issues/?$"
406
+ )
399
407
  GITHUB_ISSUES_URL_REPO = re.compile(
400
408
  r"api\.github\.com/repos/([^/\s]+)/([^/\s]+)/issues"
401
409
  )
@@ -663,8 +671,33 @@ def is_write_request(args):
663
671
  return False
664
672
 
665
673
 
666
- def endpoint_tokens(args, pattern):
667
- """Tokens naming an API endpoint, excluding payload values.
674
+ def endpoint_path(token):
675
+ """The path component of an endpoint-shaped argument.
676
+
677
+ An endpoint is a URL, and a URL is not its path: `?query` and `#fragment`
678
+ are separate components that address the SAME resource. Comparing the raw
679
+ argument against a path pattern therefore recognised a URL SHAPE rather
680
+ than an endpoint, and `repos/o/r/issues?foo=1` — the identical request —
681
+ was classified as a non-creation and allowed (#2939).
682
+
683
+ Trailing whitespace is stripped for the same reason: `"repos/o/r/issues "`
684
+ survives shlex as one token and addresses the same endpoint, but defeats an
685
+ end-anchored comparison just as a query string does.
686
+
687
+ Args:
688
+ token: One argument, possibly a decorated endpoint.
689
+
690
+ Returns:
691
+ The token with any fragment, query, and surrounding whitespace removed.
692
+ """
693
+ # Fragment first: it is the LAST component of a URL, so `path?q#f` yields
694
+ # `path?q` here and `path` after the query split, while a malformed
695
+ # `path#a?b` still collapses to `path` rather than keeping `a?b`.
696
+ return token.split("#", 1)[0].split("?", 1)[0].strip()
697
+
698
+
699
+ def endpoint_paths(args, pattern):
700
+ """Endpoint path components matching a pattern, excluding payload values.
668
701
 
669
702
  Scans every token rather than a filtered positional list, because a BOOLEAN
670
703
  flag has no value to skip and filtering swallowed the endpoint behind one:
@@ -672,21 +705,28 @@ def endpoint_tokens(args, pattern):
672
705
  behind `--silent`. Payload values are excluded the other way, so
673
706
  `-f path=repos/o/r/issues` is not mistaken for the address being posted to.
674
707
 
708
+ That payload exclusion is tested on the PATH, not the raw token, and the
709
+ order matters: a query string carries `=`, so testing the raw token skipped
710
+ `repos/o/r/issues?foo=1` before the pattern ever ran. Two independent
711
+ mechanisms — this filter and the pattern's end anchor — hid the same
712
+ creation, which is why fixing only the anchor would not have closed it.
713
+
675
714
  Args:
676
715
  args: A command's arguments.
677
- pattern: The endpoint regex.
716
+ pattern: The endpoint regex, written against a path component.
678
717
 
679
718
  Returns:
680
- Matching endpoint tokens.
719
+ The matching path components, decoration removed.
681
720
  """
682
721
  found = []
683
722
  for index, token in enumerate(args):
684
- if "=" in token:
723
+ path = endpoint_path(token)
724
+ if "=" in path:
685
725
  continue
686
726
  if index > 0 and args[index - 1] in PAYLOAD_VALUE_FLAGS:
687
727
  continue
688
- if pattern.search(token):
689
- found.append(token)
728
+ if pattern.search(path):
729
+ found.append(path)
690
730
  return found
691
731
 
692
732
 
@@ -712,7 +752,7 @@ def creation_signature(name, args):
712
752
  if "api" in args:
713
753
  if GRAPHQL_CREATE.search(joined):
714
754
  return "gh api graphql issue creation"
715
- if endpoint_tokens(args, GITHUB_ISSUES_PATH) and is_write_request(args):
755
+ if endpoint_paths(args, GITHUB_ISSUES_PATH) and is_write_request(args):
716
756
  return "gh api POST .../issues"
717
757
  return None
718
758
 
@@ -820,7 +860,7 @@ def target_repository(args):
820
860
  Read only from positions that actually reach the created item: a flag
821
861
  before the end-of-options marker, or the endpoint the write is posted to.
822
862
  A `-f repo=o/r` payload field is data being SENT, not the address being
823
- posted to, and `endpoint_tokens` already excludes it.
863
+ posted to, and `endpoint_paths` already excludes it.
824
864
 
825
865
  Args:
826
866
  args: A creating command's arguments.
@@ -837,8 +877,8 @@ def target_repository(args):
837
877
  head, value = token.split("=", 1)
838
878
  if head in REPO_FLAGS:
839
879
  return normalise_repo(value)
840
- for token in endpoint_tokens(scoped, GITHUB_ISSUES_PATH):
841
- match = GITHUB_ISSUES_PATH_REPO.search(token)
880
+ for path in endpoint_paths(scoped, GITHUB_ISSUES_PATH):
881
+ match = GITHUB_ISSUES_PATH_REPO.search(path)
842
882
  if match:
843
883
  return normalise_repo("%s/%s" % (match.group(1), match.group(2)))
844
884
  for token in scoped:
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "4.4.17",
3
+ "version": "4.4.19",
4
4
  "description": "Universal governance — agents, skills, commands, hooks, and rules for all projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -389,13 +389,21 @@ POST_PAYLOAD_FLAGS = {
389
389
  # read as an endpoint: it is data being sent, not the address being posted to.
390
390
  PAYLOAD_VALUE_FLAGS = {"-f", "-F", "--raw-field", "--field"}
391
391
 
392
- GITHUB_ISSUES_PATH = re.compile(r"repos/[^/\s]+/[^/\s]+/issues/?$")
392
+ # Matched against a token's PATH COMPONENT, never the raw argument — see
393
+ # `endpoint_path`. The `$` anchor is load-bearing and stays: without it
394
+ # `repos/o/r/issues/123/comments` reads as a creation, which is a different
395
+ # operation this guard must not refuse. The segment classes exclude `?` and
396
+ # `#` so the anchor cannot be reached past a decoration even if some future
397
+ # caller forgets to parse first.
398
+ GITHUB_ISSUES_PATH = re.compile(r"repos/[^/\s?#]+/[^/\s?#]+/issues/?$")
393
399
  GITHUB_ISSUES_URL = re.compile(r"api\.github\.com/repos/[^/\s]+/[^/\s]+/issues")
394
400
  # The repository a creation is ADDRESSED at, which decides whose ready role
395
401
  # answers for it. `gh` accepts the flag before or after the subcommand and in
396
402
  # either spelling, and the REST paths carry the same pair positionally.
397
403
  REPO_FLAGS = {"--repo", "-R"}
398
- GITHUB_ISSUES_PATH_REPO = re.compile(r"repos/([^/\s]+)/([^/\s]+)/issues/?$")
404
+ GITHUB_ISSUES_PATH_REPO = re.compile(
405
+ r"repos/([^/\s?#]+)/([^/\s?#]+)/issues/?$"
406
+ )
399
407
  GITHUB_ISSUES_URL_REPO = re.compile(
400
408
  r"api\.github\.com/repos/([^/\s]+)/([^/\s]+)/issues"
401
409
  )
@@ -663,8 +671,33 @@ def is_write_request(args):
663
671
  return False
664
672
 
665
673
 
666
- def endpoint_tokens(args, pattern):
667
- """Tokens naming an API endpoint, excluding payload values.
674
+ def endpoint_path(token):
675
+ """The path component of an endpoint-shaped argument.
676
+
677
+ An endpoint is a URL, and a URL is not its path: `?query` and `#fragment`
678
+ are separate components that address the SAME resource. Comparing the raw
679
+ argument against a path pattern therefore recognised a URL SHAPE rather
680
+ than an endpoint, and `repos/o/r/issues?foo=1` — the identical request —
681
+ was classified as a non-creation and allowed (#2939).
682
+
683
+ Trailing whitespace is stripped for the same reason: `"repos/o/r/issues "`
684
+ survives shlex as one token and addresses the same endpoint, but defeats an
685
+ end-anchored comparison just as a query string does.
686
+
687
+ Args:
688
+ token: One argument, possibly a decorated endpoint.
689
+
690
+ Returns:
691
+ The token with any fragment, query, and surrounding whitespace removed.
692
+ """
693
+ # Fragment first: it is the LAST component of a URL, so `path?q#f` yields
694
+ # `path?q` here and `path` after the query split, while a malformed
695
+ # `path#a?b` still collapses to `path` rather than keeping `a?b`.
696
+ return token.split("#", 1)[0].split("?", 1)[0].strip()
697
+
698
+
699
+ def endpoint_paths(args, pattern):
700
+ """Endpoint path components matching a pattern, excluding payload values.
668
701
 
669
702
  Scans every token rather than a filtered positional list, because a BOOLEAN
670
703
  flag has no value to skip and filtering swallowed the endpoint behind one:
@@ -672,21 +705,28 @@ def endpoint_tokens(args, pattern):
672
705
  behind `--silent`. Payload values are excluded the other way, so
673
706
  `-f path=repos/o/r/issues` is not mistaken for the address being posted to.
674
707
 
708
+ That payload exclusion is tested on the PATH, not the raw token, and the
709
+ order matters: a query string carries `=`, so testing the raw token skipped
710
+ `repos/o/r/issues?foo=1` before the pattern ever ran. Two independent
711
+ mechanisms — this filter and the pattern's end anchor — hid the same
712
+ creation, which is why fixing only the anchor would not have closed it.
713
+
675
714
  Args:
676
715
  args: A command's arguments.
677
- pattern: The endpoint regex.
716
+ pattern: The endpoint regex, written against a path component.
678
717
 
679
718
  Returns:
680
- Matching endpoint tokens.
719
+ The matching path components, decoration removed.
681
720
  """
682
721
  found = []
683
722
  for index, token in enumerate(args):
684
- if "=" in token:
723
+ path = endpoint_path(token)
724
+ if "=" in path:
685
725
  continue
686
726
  if index > 0 and args[index - 1] in PAYLOAD_VALUE_FLAGS:
687
727
  continue
688
- if pattern.search(token):
689
- found.append(token)
728
+ if pattern.search(path):
729
+ found.append(path)
690
730
  return found
691
731
 
692
732
 
@@ -712,7 +752,7 @@ def creation_signature(name, args):
712
752
  if "api" in args:
713
753
  if GRAPHQL_CREATE.search(joined):
714
754
  return "gh api graphql issue creation"
715
- if endpoint_tokens(args, GITHUB_ISSUES_PATH) and is_write_request(args):
755
+ if endpoint_paths(args, GITHUB_ISSUES_PATH) and is_write_request(args):
716
756
  return "gh api POST .../issues"
717
757
  return None
718
758
 
@@ -820,7 +860,7 @@ def target_repository(args):
820
860
  Read only from positions that actually reach the created item: a flag
821
861
  before the end-of-options marker, or the endpoint the write is posted to.
822
862
  A `-f repo=o/r` payload field is data being SENT, not the address being
823
- posted to, and `endpoint_tokens` already excludes it.
863
+ posted to, and `endpoint_paths` already excludes it.
824
864
 
825
865
  Args:
826
866
  args: A creating command's arguments.
@@ -837,8 +877,8 @@ def target_repository(args):
837
877
  head, value = token.split("=", 1)
838
878
  if head in REPO_FLAGS:
839
879
  return normalise_repo(value)
840
- for token in endpoint_tokens(scoped, GITHUB_ISSUES_PATH):
841
- match = GITHUB_ISSUES_PATH_REPO.search(token)
880
+ for path in endpoint_paths(scoped, GITHUB_ISSUES_PATH):
881
+ match = GITHUB_ISSUES_PATH_REPO.search(path)
842
882
  if match:
843
883
  return normalise_repo("%s/%s" % (match.group(1), match.group(2)))
844
884
  for token in scoped: