{
  "schema": "kin.diff.v1",
  "authority": "repository-v6",
  "repository_id": "6edc6914-4d2e-48b7-8de9-d0eaef70bbe2",
  "authority_generation": 3,
  "roots": {
    "version": 1,
    "generation": 3,
    "history": {
      "version": 1,
      "hash": [
        171,
        169,
        37,
        11,
        70,
        98,
        255,
        136,
        27,
        252,
        56,
        176,
        75,
        101,
        139,
        155,
        245,
        152,
        199,
        104,
        251,
        78,
        160,
        253,
        246,
        179,
        169,
        121,
        33,
        110,
        49,
        73
      ]
    },
    "ref_state": {
      "version": 1,
      "hash": [
        38,
        2,
        34,
        6,
        221,
        251,
        79,
        178,
        59,
        131,
        159,
        55,
        17,
        93,
        118,
        253,
        107,
        164,
        153,
        50,
        187,
        140,
        66,
        10,
        38,
        124,
        43,
        81,
        120,
        65,
        113,
        164
      ]
    },
    "ref_log": {
      "version": 1,
      "hash": [
        205,
        27,
        138,
        172,
        251,
        183,
        81,
        171,
        18,
        39,
        25,
        225,
        132,
        185,
        134,
        197,
        210,
        175,
        52,
        35,
        177,
        38,
        242,
        94,
        32,
        122,
        163,
        87,
        51,
        99,
        107,
        234
      ]
    },
    "collaboration": {
      "version": 1,
      "hash": [
        78,
        249,
        59,
        104,
        178,
        81,
        181,
        113,
        19,
        137,
        162,
        26,
        214,
        142,
        149,
        195,
        3,
        241,
        89,
        199,
        92,
        251,
        176,
        23,
        254,
        65,
        156,
        119,
        37,
        137,
        105,
        116
      ]
    },
    "replication": {
      "version": 1,
      "hash": [
        223,
        29,
        102,
        196,
        173,
        154,
        237,
        85,
        52,
        120,
        68,
        74,
        70,
        31,
        252,
        122,
        21,
        54,
        213,
        3,
        119,
        188,
        200,
        18,
        89,
        137,
        142,
        147,
        53,
        55,
        81,
        20
      ]
    },
    "local_state": {
      "version": 1,
      "hash": [
        33,
        179,
        39,
        79,
        23,
        226,
        149,
        12,
        232,
        196,
        24,
        180,
        46,
        130,
        32,
        77,
        205,
        161,
        242,
        57,
        223,
        213,
        119,
        202,
        159,
        143,
        98,
        141,
        93,
        69,
        130,
        5
      ]
    }
  },
  "workspace_id": "39ac5441-ce6b-4e6e-848b-a22cdbd7d181",
  "base": {
    "source": "change",
    "requested": "7c16ade6f77261b64816adc4d0df2c735b43d7e733bedb8973e3e5a3da0825c0",
    "target": {
      "type": "change",
      "change_id": [
        124,
        22,
        173,
        230,
        247,
        114,
        97,
        182,
        72,
        22,
        173,
        196,
        208,
        223,
        44,
        115,
        91,
        67,
        215,
        231,
        51,
        190,
        219,
        137,
        115,
        227,
        229,
        163,
        218,
        8,
        37,
        192
      ]
    },
    "change_id": [
      124,
      22,
      173,
      230,
      247,
      114,
      97,
      182,
      72,
      22,
      173,
      196,
      208,
      223,
      44,
      115,
      91,
      67,
      215,
      231,
      51,
      190,
      219,
      137,
      115,
      227,
      229,
      163,
      218,
      8,
      37,
      192
    ],
    "tree_hash": [
      172,
      236,
      15,
      94,
      230,
      117,
      33,
      116,
      133,
      177,
      17,
      187,
      191,
      118,
      17,
      96,
      240,
      148,
      18,
      131,
      87,
      9,
      107,
      133,
      171,
      0,
      130,
      35,
      139,
      46,
      136,
      140
    ],
    "artifact_count": 921,
    "entity_count": 6082,
    "relation_count": 39107
  },
  "head": {
    "source": "change",
    "requested": "db6e4fb4cedc3590f8d8c1e02ec2464eb8676ef416be86030300c30cdccda257",
    "target": {
      "type": "change",
      "change_id": [
        219,
        110,
        79,
        180,
        206,
        220,
        53,
        144,
        248,
        216,
        193,
        224,
        46,
        194,
        70,
        78,
        184,
        103,
        110,
        244,
        22,
        190,
        134,
        3,
        3,
        0,
        195,
        12,
        220,
        205,
        162,
        87
      ]
    },
    "change_id": [
      219,
      110,
      79,
      180,
      206,
      220,
      53,
      144,
      248,
      216,
      193,
      224,
      46,
      194,
      70,
      78,
      184,
      103,
      110,
      244,
      22,
      190,
      134,
      3,
      3,
      0,
      195,
      12,
      220,
      205,
      162,
      87
    ],
    "tree_hash": [
      222,
      135,
      46,
      31,
      6,
      180,
      184,
      254,
      63,
      111,
      71,
      183,
      156,
      40,
      219,
      103,
      109,
      127,
      189,
      89,
      217,
      107,
      221,
      24,
      234,
      15,
      234,
      33,
      230,
      183,
      28,
      4
    ],
    "artifact_count": 921,
    "entity_count": 6082,
    "relation_count": 39107
  },
  "summary": {
    "artifacts_added": 0,
    "artifacts_updated": 1,
    "artifacts_removed": 0,
    "entities_added": 0,
    "entities_modified": 1,
    "entities_removed": 0,
    "entities_unchanged": 5,
    "relations_added": 0,
    "relations_modified": 0,
    "relations_removed": 0
  },
  "artifact_deltas": [
    {
      "operation": "updated",
      "artifact_id": "165225e3-75d2-5e52-86b5-51113d2aa52f",
      "old": {
        "path": {
          "bytes_hex": "706b672f636d642f69737375652f6c6973742f6c6973742e676f"
        },
        "entry": {
          "type": "blob",
          "hash": [
            142,
            28,
            175,
            60,
            192,
            212,
            92,
            67,
            32,
            199,
            246,
            76,
            140,
            247,
            92,
            45,
            12,
            168,
            31,
            119,
            121,
            175,
            85,
            123,
            218,
            253,
            62,
            43,
            60,
            30,
            126,
            1
          ],
          "executable": false
        }
      },
      "new": {
        "path": {
          "bytes_hex": "706b672f636d642f69737375652f6c6973742f6c6973742e676f"
        },
        "entry": {
          "type": "blob",
          "hash": [
            232,
            209,
            230,
            47,
            13,
            161,
            18,
            85,
            230,
            141,
            64,
            225,
            51,
            237,
            81,
            180,
            167,
            178,
            92,
            98,
            142,
            126,
            123,
            163,
            118,
            140,
            229,
            80,
            113,
            4,
            173,
            144
          ],
          "executable": false
        }
      }
    }
  ],
  "entity_deltas": [
    {
      "operation": "modified",
      "old": {
        "id": "63cb41e0-4e45-41cb-8e93-22c1fda19349",
        "kind": "function",
        "name": "listRun",
        "language": "Go",
        "fingerprint": {
          "algorithm": "V1TreeSitter",
          "ast_hash": [
            19,
            42,
            231,
            0,
            135,
            235,
            221,
            134,
            126,
            92,
            207,
            176,
            8,
            51,
            224,
            157,
            85,
            25,
            68,
            108,
            14,
            9,
            169,
            210,
            75,
            180,
            21,
            28,
            232,
            214,
            125,
            6
          ],
          "signature_hash": [
            8,
            186,
            111,
            189,
            220,
            144,
            229,
            152,
            31,
            71,
            139,
            170,
            79,
            143,
            176,
            51,
            35,
            254,
            81,
            248,
            193,
            189,
            54,
            199,
            17,
            45,
            245,
            145,
            97,
            147,
            226,
            106
          ],
          "behavior_hash": [
            113,
            224,
            199,
            18,
            212,
            11,
            74,
            217,
            227,
            28,
            149,
            47,
            70,
            41,
            115,
            1,
            91,
            132,
            35,
            126,
            59,
            212,
            28,
            21,
            93,
            156,
            37,
            78,
            6,
            167,
            73,
            232
          ],
          "equivalence_hash": [
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0
          ],
          "stability_score": 0.8
        },
        "file_origin": "pkg/cmd/issue/list/list.go",
        "span": {
          "file": "pkg/cmd/issue/list/list.go",
          "start_byte": 3574,
          "end_byte": 5961,
          "start_line": 122,
          "start_col": 0,
          "end_line": 211,
          "end_col": 1
        },
        "signature": "func listRun(opts *ListOptions) error",
        "visibility": "Private",
        "role": "source",
        "doc_summary": null,
        "metadata": {
          "blob_hash": "8e1caf3cc0d45c4320c7f64c8cf75c2d0ca81f7779af557bdafd3e2b3c1e7e01",
          "embedding_body_preview": "func listRun(opts *ListOptions) error { httpClient, err := opts.HttpClient() if err != nil { return err } baseRepo, err := opts.BaseRepo() if err != nil { return err } issueState := strings.ToLower(opts.State) if issueState == \"open\" && prShared.QueryHasStateClause(opts.Search) { issueState = \"\" } if opts.Detector == nil { cachedClient := api.NewCachedHTTPClient(httpClient, time.Hour*24) opts.Detector = fd.NewDetector(cachedClient, baseRepo.RepoHost()) } features, err := opts.Detector.IssueFeatures() if err != nil { return err } fields := defaultFields if features.StateReason { fields = append(defaultFields, \"stateReason\") } filterOptions := prShared.FilterOptions{ Entity: \"issue\", State: issueState, Assignee: opts.Assignee, Labels: opts.Labels, Author: opts.Author, Mention: opts.Mention, Milestone: opts.Milestone, Search: opts.Search, Fields: fields, } isTerminal := opts.IO.IsStdoutTTY() if opts.WebMode { issueListURL := ghrepo.GenerateRepoURL(baseRepo, \"issues\") openURL, err := prShared.ListURLWithQuery(issueListURL, filterOptions) if err != nil { return err } if isTerminal { fmt.Fprintf(opts.IO.ErrOut, \"Opening %s in your browser.\\n\", text.DisplayURL(openURL)) } return opts.Browser.Browse(openURL) } if opts.Exporter != nil { filterOptions.Fields = opts.Exporter.Fields() } listResult, err := issueList(httpClient, baseRepo, filterOptions, opts.LimitResults) if err != nil { return err } if len(listResult.Issues) == 0 && opts.Exporter == nil { return prShared.ListNoResults(ghrepo.FullName(baseRepo), \"issue\", !filterOptions.IsDefault()) } if err := opts.IO.StartPager(); err == nil { defer opts.IO.StopPager() } else { fmt.Fprintf(opts.IO.ErrOut, \"failed to start pager: %v\\n\", err) } if opts.Exporter != nil { return opts.Exporter.Write(opts.IO, listResult.Issues) } if listResult.SearchCapped { fmt.Fprintln(opts.IO.ErrOut, \"warning: this query uses the Search API which is capped at 1000 results maximum\") } if isTerminal { title := prShared.ListHeader(ghrepo.FullName(baseRepo), \"issue\", len(listResult.Issues), listResult.TotalCount, !filterOptions.IsDefault()) fmt.Fprintf(opts.IO.Out, \"\\n%s\\n\\n\", title) } issueShared.PrintIssues(opts.IO, opts.Now(), \"\", len(listResult.Issues), listResult.Issues) return nil }",
          "file_surface_context": "surface list surface issue",
          "file_parsed_call_sites": 88,
          "file_parsed_import_statements": 18,
          "file_import_context": "module fmt names fmt module net/http module net http names http module strconv names strconv module strings names strings module time names time module github.com/MakeNowJust/heredoc module github com Make Now Just heredoc names heredoc module github.com/cli/cli/v2/api module github com cli cli v2 api names api module github.com/cli/cli/v2/internal/browser module github com cli cli v2 internal browser names browser module github.com/cli/cli/v2/internal/featuredetection module github com cli cli v2 internal featuredetection names fd featuredetection module github.com/cli/cli/v2/internal/gh module github com cli cli v2 internal gh names gh module github.com/cli/cli/v2/internal/ghrepo module github com cli cli v2 internal ghrepo names ghrepo module github.com/cli/cli/v2/internal/text module github com cli cli v2 internal text names text"
        },
        "lineage_parent": null,
        "created_in": null,
        "superseded_by": null
      },
      "new": {
        "id": "63cb41e0-4e45-41cb-8e93-22c1fda19349",
        "kind": "function",
        "name": "listRun",
        "language": "Go",
        "fingerprint": {
          "algorithm": "V1TreeSitter",
          "ast_hash": [
            19,
            42,
            231,
            0,
            135,
            235,
            221,
            134,
            126,
            92,
            207,
            176,
            8,
            51,
            224,
            157,
            85,
            25,
            68,
            108,
            14,
            9,
            169,
            210,
            75,
            180,
            21,
            28,
            232,
            214,
            125,
            6
          ],
          "signature_hash": [
            8,
            186,
            111,
            189,
            220,
            144,
            229,
            152,
            31,
            71,
            139,
            170,
            79,
            143,
            176,
            51,
            35,
            254,
            81,
            248,
            193,
            189,
            54,
            199,
            17,
            45,
            245,
            145,
            97,
            147,
            226,
            106
          ],
          "behavior_hash": [
            121,
            99,
            58,
            124,
            165,
            4,
            194,
            134,
            5,
            206,
            34,
            47,
            189,
            7,
            166,
            126,
            202,
            233,
            137,
            223,
            59,
            155,
            215,
            233,
            125,
            151,
            99,
            250,
            11,
            79,
            57,
            66
          ],
          "equivalence_hash": [
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0
          ],
          "stability_score": 0.8
        },
        "file_origin": "pkg/cmd/issue/list/list.go",
        "span": {
          "file": "pkg/cmd/issue/list/list.go",
          "start_byte": 3574,
          "end_byte": 5961,
          "start_line": 122,
          "start_col": 0,
          "end_line": 211,
          "end_col": 1
        },
        "signature": "func listRun(opts *ListOptions) error",
        "visibility": "Private",
        "role": "source",
        "doc_summary": null,
        "metadata": {
          "file_parsed_import_statements": 18,
          "blob_hash": "e8d1e62f0da11255e68d40e133ed51b4a7b25c628e7e7ba3768ce5507104ad90",
          "file_import_context": "module fmt names fmt module net/http module net http names http module strconv names strconv module strings names strings module time names time module github.com/MakeNowJust/heredoc module github com Make Now Just heredoc names heredoc module github.com/cli/cli/v2/api module github com cli cli v2 api names api module github.com/cli/cli/v2/internal/browser module github com cli cli v2 internal browser names browser module github.com/cli/cli/v2/internal/featuredetection module github com cli cli v2 internal featuredetection names fd featuredetection module github.com/cli/cli/v2/internal/gh module github com cli cli v2 internal gh names gh module github.com/cli/cli/v2/internal/ghrepo module github com cli cli v2 internal ghrepo names ghrepo module github.com/cli/cli/v2/internal/text module github com cli cli v2 internal text names text",
          "embedding_body_preview": "func listRun(opts *ListOptions) error { httpClient, err := opts.HttpClient() if err != nil { return err } baseRepo, err := opts.BaseRepo() if err != nil { return err } issueState := strings.ToLower(opts.State) if issueState == \"open\" && prShared.QueryHasStateClause(opts.Search) { issueState = \"\" } if opts.Detector == nil { cachedClient := api.NewCachedHTTPClient(httpClient, time.Hour*12) opts.Detector = fd.NewDetector(cachedClient, baseRepo.RepoHost()) } features, err := opts.Detector.IssueFeatures() if err != nil { return err } fields := defaultFields if features.StateReason { fields = append(defaultFields, \"stateReason\") } filterOptions := prShared.FilterOptions{ Entity: \"issue\", State: issueState, Assignee: opts.Assignee, Labels: opts.Labels, Author: opts.Author, Mention: opts.Mention, Milestone: opts.Milestone, Search: opts.Search, Fields: fields, } isTerminal := opts.IO.IsStdoutTTY() if opts.WebMode { issueListURL := ghrepo.GenerateRepoURL(baseRepo, \"issues\") openURL, err := prShared.ListURLWithQuery(issueListURL, filterOptions) if err != nil { return err } if isTerminal { fmt.Fprintf(opts.IO.ErrOut, \"Opening %s in your browser.\\n\", text.DisplayURL(openURL)) } return opts.Browser.Browse(openURL) } if opts.Exporter != nil { filterOptions.Fields = opts.Exporter.Fields() } listResult, err := issueList(httpClient, baseRepo, filterOptions, opts.LimitResults) if err != nil { return err } if len(listResult.Issues) == 0 && opts.Exporter == nil { return prShared.ListNoResults(ghrepo.FullName(baseRepo), \"issue\", !filterOptions.IsDefault()) } if err := opts.IO.StartPager(); err == nil { defer opts.IO.StopPager() } else { fmt.Fprintf(opts.IO.ErrOut, \"failed to start pager: %v\\n\", err) } if opts.Exporter != nil { return opts.Exporter.Write(opts.IO, listResult.Issues) } if listResult.SearchCapped { fmt.Fprintln(opts.IO.ErrOut, \"warning: this query uses the Search API which is capped at 1000 results maximum\") } if isTerminal { title := prShared.ListHeader(ghrepo.FullName(baseRepo), \"issue\", len(listResult.Issues), listResult.TotalCount, !filterOptions.IsDefault()) fmt.Fprintf(opts.IO.Out, \"\\n%s\\n\\n\", title) } issueShared.PrintIssues(opts.IO, opts.Now(), \"\", len(listResult.Issues), listResult.Issues) return nil }",
          "file_parsed_call_sites": 88,
          "file_surface_context": "surface list surface issue"
        },
        "lineage_parent": null,
        "created_in": null,
        "superseded_by": null
      }
    }
  ],
  "relation_deltas": [],
  "artifact_content": [
    {
      "artifact_id": "165225e3-75d2-5e52-86b5-51113d2aa52f",
      "path": "pkg/cmd/issue/list/list.go",
      "old_hash": [
        142,
        28,
        175,
        60,
        192,
        212,
        92,
        67,
        32,
        199,
        246,
        76,
        140,
        247,
        92,
        45,
        12,
        168,
        31,
        119,
        121,
        175,
        85,
        123,
        218,
        253,
        62,
        43,
        60,
        30,
        126,
        1
      ],
      "new_hash": [
        232,
        209,
        230,
        47,
        13,
        161,
        18,
        85,
        230,
        141,
        64,
        225,
        51,
        237,
        81,
        180,
        167,
        178,
        92,
        98,
        142,
        126,
        123,
        163,
        118,
        140,
        229,
        80,
        113,
        4,
        173,
        144
      ],
      "hunks": [
        "@@ -137,7 +137,7 @@\n \t}\n \n \tif opts.Detector == nil {\n-\t\tcachedClient := api.NewCachedHTTPClient(httpClient, time.Hour*24)\n+\t\tcachedClient := api.NewCachedHTTPClient(httpClient, time.Hour*12)\n \t\topts.Detector = fd.NewDetector(cachedClient, baseRepo.RepoHost())\n \t}\n \tfeatures, err := opts.Detector.IssueFeatures()\n"
      ],
      "old_text": "package list\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/MakeNowJust/heredoc\"\n\t\"github.com/cli/cli/v2/api\"\n\t\"github.com/cli/cli/v2/internal/browser\"\n\tfd \"github.com/cli/cli/v2/internal/featuredetection\"\n\t\"github.com/cli/cli/v2/internal/gh\"\n\t\"github.com/cli/cli/v2/internal/ghrepo\"\n\t\"github.com/cli/cli/v2/internal/text\"\n\tissueShared \"github.com/cli/cli/v2/pkg/cmd/issue/shared\"\n\tprShared \"github.com/cli/cli/v2/pkg/cmd/pr/shared\"\n\t\"github.com/cli/cli/v2/pkg/cmdutil\"\n\t\"github.com/cli/cli/v2/pkg/iostreams\"\n\t\"github.com/shurcooL/githubv4\"\n\t\"github.com/spf13/cobra\"\n)\n\ntype ListOptions struct {\n\tHttpClient func() (*http.Client, error)\n\tConfig     func() (gh.Config, error)\n\tIO         *iostreams.IOStreams\n\tBaseRepo   func() (ghrepo.Interface, error)\n\tBrowser    browser.Browser\n\n\tAssignee     string\n\tLabels       []string\n\tState        string\n\tLimitResults int\n\tAuthor       string\n\tMention      string\n\tMilestone    string\n\tSearch       string\n\tWebMode      bool\n\tExporter     cmdutil.Exporter\n\n\tDetector fd.Detector\n\tNow      func() time.Time\n}\n\nfunc NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Command {\n\topts := &ListOptions{\n\t\tIO:         f.IOStreams,\n\t\tHttpClient: f.HttpClient,\n\t\tConfig:     f.Config,\n\t\tBrowser:    f.Browser,\n\t\tNow:        time.Now,\n\t}\n\n\tvar appAuthor string\n\n\tcmd := &cobra.Command{\n\t\tUse:   \"list\",\n\t\tShort: \"List issues in a repository\",\n\t\tLong: heredoc.Doc(`\n\t\t\tList issues in a GitHub repository.\n\n\t\t\tThe search query syntax is documented here:\n\t\t\t<https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests>\n\t\t`),\n\t\tExample: heredoc.Doc(`\n\t\t\t$ gh issue list --label \"bug\" --label \"help wanted\"\n\t\t\t$ gh issue list --author monalisa\n\t\t\t$ gh issue list --assignee \"@me\"\n\t\t\t$ gh issue list --milestone \"The big 1.0\"\n\t\t\t$ gh issue list --search \"error no:assignee sort:created-asc\"\n\t\t`),\n\t\tAliases: []string{\"ls\"},\n\t\tArgs:    cmdutil.NoArgsQuoteReminder,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\t// support `-R, --repo` override\n\t\t\topts.BaseRepo = f.BaseRepo\n\n\t\t\tif opts.LimitResults < 1 {\n\t\t\t\treturn cmdutil.FlagErrorf(\"invalid limit: %v\", opts.LimitResults)\n\t\t\t}\n\n\t\t\tif cmd.Flags().Changed(\"author\") && cmd.Flags().Changed(\"app\") {\n\t\t\t\treturn cmdutil.FlagErrorf(\"specify only `--author` or `--app`\")\n\t\t\t}\n\n\t\t\tif cmd.Flags().Changed(\"app\") {\n\t\t\t\topts.Author = fmt.Sprintf(\"app/%s\", appAuthor)\n\t\t\t}\n\n\t\t\tif runF != nil {\n\t\t\t\treturn runF(opts)\n\t\t\t}\n\t\t\treturn listRun(opts)\n\t\t},\n\t}\n\n\tcmd.Flags().BoolVarP(&opts.WebMode, \"web\", \"w\", false, \"List issues in the web browser\")\n\tcmd.Flags().StringVarP(&opts.Assignee, \"assignee\", \"a\", \"\", \"Filter by assignee\")\n\tcmd.Flags().StringSliceVarP(&opts.Labels, \"label\", \"l\", nil, \"Filter by label\")\n\tcmdutil.StringEnumFlag(cmd, &opts.State, \"state\", \"s\", \"open\", []string{\"open\", \"closed\", \"all\"}, \"Filter by state\")\n\tcmd.Flags().IntVarP(&opts.LimitResults, \"limit\", \"L\", 30, \"Maximum number of issues to fetch\")\n\tcmd.Flags().StringVarP(&opts.Author, \"author\", \"A\", \"\", \"Filter by author\")\n\tcmd.Flags().StringVar(&appAuthor, \"app\", \"\", \"Filter by GitHub App author\")\n\tcmd.Flags().StringVar(&opts.Mention, \"mention\", \"\", \"Filter by mention\")\n\tcmd.Flags().StringVarP(&opts.Milestone, \"milestone\", \"m\", \"\", \"Filter by milestone number or title\")\n\tcmd.Flags().StringVarP(&opts.Search, \"search\", \"S\", \"\", \"Search issues with `query`\")\n\tcmdutil.AddJSONFlags(cmd, &opts.Exporter, api.IssueFields)\n\n\treturn cmd\n}\n\nvar defaultFields = []string{\n\t\"number\",\n\t\"title\",\n\t\"url\",\n\t\"state\",\n\t\"updatedAt\",\n\t\"labels\",\n}\n\nfunc listRun(opts *ListOptions) error {\n\thttpClient, err := opts.HttpClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbaseRepo, err := opts.BaseRepo()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tissueState := strings.ToLower(opts.State)\n\tif issueState == \"open\" && prShared.QueryHasStateClause(opts.Search) {\n\t\tissueState = \"\"\n\t}\n\n\tif opts.Detector == nil {\n\t\tcachedClient := api.NewCachedHTTPClient(httpClient, time.Hour*24)\n\t\topts.Detector = fd.NewDetector(cachedClient, baseRepo.RepoHost())\n\t}\n\tfeatures, err := opts.Detector.IssueFeatures()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfields := defaultFields\n\tif features.StateReason {\n\t\tfields = append(defaultFields, \"stateReason\")\n\t}\n\n\tfilterOptions := prShared.FilterOptions{\n\t\tEntity:    \"issue\",\n\t\tState:     issueState,\n\t\tAssignee:  opts.Assignee,\n\t\tLabels:    opts.Labels,\n\t\tAuthor:    opts.Author,\n\t\tMention:   opts.Mention,\n\t\tMilestone: opts.Milestone,\n\t\tSearch:    opts.Search,\n\t\tFields:    fields,\n\t}\n\n\tisTerminal := opts.IO.IsStdoutTTY()\n\n\tif opts.WebMode {\n\t\tissueListURL := ghrepo.GenerateRepoURL(baseRepo, \"issues\")\n\t\topenURL, err := prShared.ListURLWithQuery(issueListURL, filterOptions)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif isTerminal {\n\t\t\tfmt.Fprintf(opts.IO.ErrOut, \"Opening %s in your browser.\\n\", text.DisplayURL(openURL))\n\t\t}\n\t\treturn opts.Browser.Browse(openURL)\n\t}\n\n\tif opts.Exporter != nil {\n\t\tfilterOptions.Fields = opts.Exporter.Fields()\n\t}\n\n\tlistResult, err := issueList(httpClient, baseRepo, filterOptions, opts.LimitResults)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(listResult.Issues) == 0 && opts.Exporter == nil {\n\t\treturn prShared.ListNoResults(ghrepo.FullName(baseRepo), \"issue\", !filterOptions.IsDefault())\n\t}\n\n\tif err := opts.IO.StartPager(); err == nil {\n\t\tdefer opts.IO.StopPager()\n\t} else {\n\t\tfmt.Fprintf(opts.IO.ErrOut, \"failed to start pager: %v\\n\", err)\n\t}\n\n\tif opts.Exporter != nil {\n\t\treturn opts.Exporter.Write(opts.IO, listResult.Issues)\n\t}\n\n\tif listResult.SearchCapped {\n\t\tfmt.Fprintln(opts.IO.ErrOut, \"warning: this query uses the Search API which is capped at 1000 results maximum\")\n\t}\n\tif isTerminal {\n\t\ttitle := prShared.ListHeader(ghrepo.FullName(baseRepo), \"issue\", len(listResult.Issues), listResult.TotalCount, !filterOptions.IsDefault())\n\t\tfmt.Fprintf(opts.IO.Out, \"\\n%s\\n\\n\", title)\n\t}\n\n\tissueShared.PrintIssues(opts.IO, opts.Now(), \"\", len(listResult.Issues), listResult.Issues)\n\n\treturn nil\n}\n\nfunc issueList(client *http.Client, repo ghrepo.Interface, filters prShared.FilterOptions, limit int) (*api.IssuesAndTotalCount, error) {\n\tapiClient := api.NewClientFromHTTP(client)\n\n\tif filters.Search != \"\" || len(filters.Labels) > 0 || filters.Milestone != \"\" {\n\t\tif milestoneNumber, err := strconv.ParseInt(filters.Milestone, 10, 32); err == nil {\n\t\t\tmilestone, err := milestoneByNumber(client, repo, int32(milestoneNumber))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tfilters.Milestone = milestone.Title\n\t\t}\n\n\t\treturn searchIssues(apiClient, repo, filters, limit)\n\t}\n\n\tvar err error\n\tmeReplacer := prShared.NewMeReplacer(apiClient, repo.RepoHost())\n\tfilters.Assignee, err = meReplacer.Replace(filters.Assignee)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfilters.Author, err = meReplacer.Replace(filters.Author)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfilters.Mention, err = meReplacer.Replace(filters.Mention)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn listIssues(apiClient, repo, filters, limit)\n}\n\nfunc milestoneByNumber(client *http.Client, repo ghrepo.Interface, number int32) (*api.RepoMilestone, error) {\n\tvar query struct {\n\t\tRepository struct {\n\t\t\tMilestone *api.RepoMilestone `graphql:\"milestone(number: $number)\"`\n\t\t} `graphql:\"repository(owner: $owner, name: $name)\"`\n\t}\n\n\tvariables := map[string]interface{}{\n\t\t\"owner\":  githubv4.String(repo.RepoOwner()),\n\t\t\"name\":   githubv4.String(repo.RepoName()),\n\t\t\"number\": githubv4.Int(number),\n\t}\n\n\tgql := api.NewClientFromHTTP(client)\n\tif err := gql.Query(repo.RepoHost(), \"RepositoryMilestoneByNumber\", &query, variables); err != nil {\n\t\treturn nil, err\n\t}\n\tif query.Repository.Milestone == nil {\n\t\treturn nil, fmt.Errorf(\"no milestone found with number '%d'\", number)\n\t}\n\n\treturn query.Repository.Milestone, nil\n}\n",
      "new_text": "package list\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/MakeNowJust/heredoc\"\n\t\"github.com/cli/cli/v2/api\"\n\t\"github.com/cli/cli/v2/internal/browser\"\n\tfd \"github.com/cli/cli/v2/internal/featuredetection\"\n\t\"github.com/cli/cli/v2/internal/gh\"\n\t\"github.com/cli/cli/v2/internal/ghrepo\"\n\t\"github.com/cli/cli/v2/internal/text\"\n\tissueShared \"github.com/cli/cli/v2/pkg/cmd/issue/shared\"\n\tprShared \"github.com/cli/cli/v2/pkg/cmd/pr/shared\"\n\t\"github.com/cli/cli/v2/pkg/cmdutil\"\n\t\"github.com/cli/cli/v2/pkg/iostreams\"\n\t\"github.com/shurcooL/githubv4\"\n\t\"github.com/spf13/cobra\"\n)\n\ntype ListOptions struct {\n\tHttpClient func() (*http.Client, error)\n\tConfig     func() (gh.Config, error)\n\tIO         *iostreams.IOStreams\n\tBaseRepo   func() (ghrepo.Interface, error)\n\tBrowser    browser.Browser\n\n\tAssignee     string\n\tLabels       []string\n\tState        string\n\tLimitResults int\n\tAuthor       string\n\tMention      string\n\tMilestone    string\n\tSearch       string\n\tWebMode      bool\n\tExporter     cmdutil.Exporter\n\n\tDetector fd.Detector\n\tNow      func() time.Time\n}\n\nfunc NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Command {\n\topts := &ListOptions{\n\t\tIO:         f.IOStreams,\n\t\tHttpClient: f.HttpClient,\n\t\tConfig:     f.Config,\n\t\tBrowser:    f.Browser,\n\t\tNow:        time.Now,\n\t}\n\n\tvar appAuthor string\n\n\tcmd := &cobra.Command{\n\t\tUse:   \"list\",\n\t\tShort: \"List issues in a repository\",\n\t\tLong: heredoc.Doc(`\n\t\t\tList issues in a GitHub repository.\n\n\t\t\tThe search query syntax is documented here:\n\t\t\t<https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests>\n\t\t`),\n\t\tExample: heredoc.Doc(`\n\t\t\t$ gh issue list --label \"bug\" --label \"help wanted\"\n\t\t\t$ gh issue list --author monalisa\n\t\t\t$ gh issue list --assignee \"@me\"\n\t\t\t$ gh issue list --milestone \"The big 1.0\"\n\t\t\t$ gh issue list --search \"error no:assignee sort:created-asc\"\n\t\t`),\n\t\tAliases: []string{\"ls\"},\n\t\tArgs:    cmdutil.NoArgsQuoteReminder,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\t// support `-R, --repo` override\n\t\t\topts.BaseRepo = f.BaseRepo\n\n\t\t\tif opts.LimitResults < 1 {\n\t\t\t\treturn cmdutil.FlagErrorf(\"invalid limit: %v\", opts.LimitResults)\n\t\t\t}\n\n\t\t\tif cmd.Flags().Changed(\"author\") && cmd.Flags().Changed(\"app\") {\n\t\t\t\treturn cmdutil.FlagErrorf(\"specify only `--author` or `--app`\")\n\t\t\t}\n\n\t\t\tif cmd.Flags().Changed(\"app\") {\n\t\t\t\topts.Author = fmt.Sprintf(\"app/%s\", appAuthor)\n\t\t\t}\n\n\t\t\tif runF != nil {\n\t\t\t\treturn runF(opts)\n\t\t\t}\n\t\t\treturn listRun(opts)\n\t\t},\n\t}\n\n\tcmd.Flags().BoolVarP(&opts.WebMode, \"web\", \"w\", false, \"List issues in the web browser\")\n\tcmd.Flags().StringVarP(&opts.Assignee, \"assignee\", \"a\", \"\", \"Filter by assignee\")\n\tcmd.Flags().StringSliceVarP(&opts.Labels, \"label\", \"l\", nil, \"Filter by label\")\n\tcmdutil.StringEnumFlag(cmd, &opts.State, \"state\", \"s\", \"open\", []string{\"open\", \"closed\", \"all\"}, \"Filter by state\")\n\tcmd.Flags().IntVarP(&opts.LimitResults, \"limit\", \"L\", 30, \"Maximum number of issues to fetch\")\n\tcmd.Flags().StringVarP(&opts.Author, \"author\", \"A\", \"\", \"Filter by author\")\n\tcmd.Flags().StringVar(&appAuthor, \"app\", \"\", \"Filter by GitHub App author\")\n\tcmd.Flags().StringVar(&opts.Mention, \"mention\", \"\", \"Filter by mention\")\n\tcmd.Flags().StringVarP(&opts.Milestone, \"milestone\", \"m\", \"\", \"Filter by milestone number or title\")\n\tcmd.Flags().StringVarP(&opts.Search, \"search\", \"S\", \"\", \"Search issues with `query`\")\n\tcmdutil.AddJSONFlags(cmd, &opts.Exporter, api.IssueFields)\n\n\treturn cmd\n}\n\nvar defaultFields = []string{\n\t\"number\",\n\t\"title\",\n\t\"url\",\n\t\"state\",\n\t\"updatedAt\",\n\t\"labels\",\n}\n\nfunc listRun(opts *ListOptions) error {\n\thttpClient, err := opts.HttpClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbaseRepo, err := opts.BaseRepo()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tissueState := strings.ToLower(opts.State)\n\tif issueState == \"open\" && prShared.QueryHasStateClause(opts.Search) {\n\t\tissueState = \"\"\n\t}\n\n\tif opts.Detector == nil {\n\t\tcachedClient := api.NewCachedHTTPClient(httpClient, time.Hour*12)\n\t\topts.Detector = fd.NewDetector(cachedClient, baseRepo.RepoHost())\n\t}\n\tfeatures, err := opts.Detector.IssueFeatures()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfields := defaultFields\n\tif features.StateReason {\n\t\tfields = append(defaultFields, \"stateReason\")\n\t}\n\n\tfilterOptions := prShared.FilterOptions{\n\t\tEntity:    \"issue\",\n\t\tState:     issueState,\n\t\tAssignee:  opts.Assignee,\n\t\tLabels:    opts.Labels,\n\t\tAuthor:    opts.Author,\n\t\tMention:   opts.Mention,\n\t\tMilestone: opts.Milestone,\n\t\tSearch:    opts.Search,\n\t\tFields:    fields,\n\t}\n\n\tisTerminal := opts.IO.IsStdoutTTY()\n\n\tif opts.WebMode {\n\t\tissueListURL := ghrepo.GenerateRepoURL(baseRepo, \"issues\")\n\t\topenURL, err := prShared.ListURLWithQuery(issueListURL, filterOptions)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif isTerminal {\n\t\t\tfmt.Fprintf(opts.IO.ErrOut, \"Opening %s in your browser.\\n\", text.DisplayURL(openURL))\n\t\t}\n\t\treturn opts.Browser.Browse(openURL)\n\t}\n\n\tif opts.Exporter != nil {\n\t\tfilterOptions.Fields = opts.Exporter.Fields()\n\t}\n\n\tlistResult, err := issueList(httpClient, baseRepo, filterOptions, opts.LimitResults)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(listResult.Issues) == 0 && opts.Exporter == nil {\n\t\treturn prShared.ListNoResults(ghrepo.FullName(baseRepo), \"issue\", !filterOptions.IsDefault())\n\t}\n\n\tif err := opts.IO.StartPager(); err == nil {\n\t\tdefer opts.IO.StopPager()\n\t} else {\n\t\tfmt.Fprintf(opts.IO.ErrOut, \"failed to start pager: %v\\n\", err)\n\t}\n\n\tif opts.Exporter != nil {\n\t\treturn opts.Exporter.Write(opts.IO, listResult.Issues)\n\t}\n\n\tif listResult.SearchCapped {\n\t\tfmt.Fprintln(opts.IO.ErrOut, \"warning: this query uses the Search API which is capped at 1000 results maximum\")\n\t}\n\tif isTerminal {\n\t\ttitle := prShared.ListHeader(ghrepo.FullName(baseRepo), \"issue\", len(listResult.Issues), listResult.TotalCount, !filterOptions.IsDefault())\n\t\tfmt.Fprintf(opts.IO.Out, \"\\n%s\\n\\n\", title)\n\t}\n\n\tissueShared.PrintIssues(opts.IO, opts.Now(), \"\", len(listResult.Issues), listResult.Issues)\n\n\treturn nil\n}\n\nfunc issueList(client *http.Client, repo ghrepo.Interface, filters prShared.FilterOptions, limit int) (*api.IssuesAndTotalCount, error) {\n\tapiClient := api.NewClientFromHTTP(client)\n\n\tif filters.Search != \"\" || len(filters.Labels) > 0 || filters.Milestone != \"\" {\n\t\tif milestoneNumber, err := strconv.ParseInt(filters.Milestone, 10, 32); err == nil {\n\t\t\tmilestone, err := milestoneByNumber(client, repo, int32(milestoneNumber))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tfilters.Milestone = milestone.Title\n\t\t}\n\n\t\treturn searchIssues(apiClient, repo, filters, limit)\n\t}\n\n\tvar err error\n\tmeReplacer := prShared.NewMeReplacer(apiClient, repo.RepoHost())\n\tfilters.Assignee, err = meReplacer.Replace(filters.Assignee)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfilters.Author, err = meReplacer.Replace(filters.Author)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfilters.Mention, err = meReplacer.Replace(filters.Mention)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn listIssues(apiClient, repo, filters, limit)\n}\n\nfunc milestoneByNumber(client *http.Client, repo ghrepo.Interface, number int32) (*api.RepoMilestone, error) {\n\tvar query struct {\n\t\tRepository struct {\n\t\t\tMilestone *api.RepoMilestone `graphql:\"milestone(number: $number)\"`\n\t\t} `graphql:\"repository(owner: $owner, name: $name)\"`\n\t}\n\n\tvariables := map[string]interface{}{\n\t\t\"owner\":  githubv4.String(repo.RepoOwner()),\n\t\t\"name\":   githubv4.String(repo.RepoName()),\n\t\t\"number\": githubv4.Int(number),\n\t}\n\n\tgql := api.NewClientFromHTTP(client)\n\tif err := gql.Query(repo.RepoHost(), \"RepositoryMilestoneByNumber\", &query, variables); err != nil {\n\t\treturn nil, err\n\t}\n\tif query.Repository.Milestone == nil {\n\t\treturn nil, fmt.Errorf(\"no milestone found with number '%d'\", number)\n\t}\n\n\treturn query.Repository.Milestone, nil\n}\n"
    }
  ]
}
