@sentry/junior-github 0.102.3 → 0.104.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @sentry/junior-github
2
2
 
3
- `@sentry/junior-github` adds GitHub issue, pull request, and repository workflows to Junior using a GitHub App.
3
+ `@sentry/junior-github` adds GitHub issue, pull request, repository, and user-attachment workflows to Junior using a GitHub App.
4
4
 
5
5
  Install it alongside `@sentry/junior`:
6
6
 
package/SETUP.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # GitHub plugin setup
2
2
 
3
- This plugin exposes two skills — `github-code` (clone, source-code investigation, pull requests) and `github-issues` (issue workflows). Junior uses GitHub App installation tokens for reads, workflow dispatches, allowlisted issue and pull request writes, and Git branch pushes. Human OAuth is reserved for explicitly personal operations such as pull request reviews.
3
+ This plugin exposes three skills — `github-code` (clone, source-code investigation, pull requests), `github-issues` (issue workflows), and `attach-github-assets` (local image/video uploads for GitHub markdown). Junior uses GitHub App installation tokens for reads, workflow dispatches, allowlisted issue and pull request writes, and Git branch pushes. Human OAuth is reserved for explicitly personal operations such as pull request reviews and user-attachment uploads.
4
4
 
5
5
  ## 1) Create/install GitHub App
6
6
 
@@ -98,12 +98,12 @@ Use `additionalUserScopes` only when a human-identity integration flow requires
98
98
  ## 3) Runtime behavior
99
99
 
100
100
  - When either GitHub skill is active, authenticated `gh` and `git` commands cause the runtime to inject GitHub credentials automatically for the current turn.
101
- - The plugin classifies GitHub traffic from the forwarded HTTP request. Reads use `installation-read`, while `GET /user` uses `user-read`. Allowlisted App-owned mutations and Git smart-HTTP pushes share the repository-scoped `installation-write` grant. Unknown REST writes and GraphQL mutations are denied.
101
+ - The plugin classifies GitHub traffic from the forwarded HTTP request. Reads use `installation-read`, while `GET /user` uses `user-read`. Allowlisted App-owned mutations and Git smart-HTTP pushes share the repository-scoped `installation-write` grant. User-attachment uploads to `uploads.github.com/user-attachments/assets` use `user-write`. Unknown REST writes and GraphQL mutations are denied.
102
102
  - `user-read` and the remaining explicitly human `user-write` operations require the actor, or an explicitly delegated user subject, to authorize the GitHub App through the private OAuth flow. Junior-owned issue, pull request, and branch operations do not fall back to user OAuth.
103
103
  - Headless resource-event turns use the `resource-event` system actor and may receive the same repository-scoped installation grants. This lets Junior respond to subscribed pull request events by committing and pushing fixes without inheriting a subscriber's OAuth credential.
104
104
  - Git commits use Junior as author and committer. Resolvable human run actors are credited once with `Co-Authored-By` trailers.
105
105
  - Issued credentials are reused only within the current turn, credential leases are cached by plugin grant and repository lease scope, and upstream 403 permission denials clear the cached lease before the next retry.
106
- - Sandbox does not receive raw tokens via env; host applies Authorization header transforms for GitHub API calls.
106
+ - Sandbox does not receive raw tokens via env; host applies Authorization header transforms for GitHub API and upload calls.
107
107
 
108
108
  ## 4) CLI usage
109
109
 
package/dist/index.js CHANGED
@@ -119,22 +119,24 @@ function sentryConversationUrl(conversationId) {
119
119
  const port = parsed.port ? `:${parsed.port}` : "";
120
120
  return `${parsed.protocol}//${parsed.hostname}${port}/organizations/${orgSlug}/${path}`;
121
121
  }
122
- function githubConversationFooter(conversationId) {
122
+ function githubConversationFooter(conversationId, dashboardUrl) {
123
123
  const id = nonEmptyString(conversationId, "conversationId");
124
- const sessionUrl = sentryConversationUrl(id);
124
+ const normalizedDashboardUrl = dashboardUrl?.trim();
125
+ const sessionUrl = normalizedDashboardUrl || sentryConversationUrl(id);
125
126
  if (!sessionUrl) {
126
127
  return void 0;
127
128
  }
129
+ const label = normalizedDashboardUrl ? "View Junior Session" : "View Junior Session in Sentry";
128
130
  return `${GITHUB_SESSION_FOOTER_START}
129
131
 
130
132
  --
131
133
 
132
- [View Junior Session in Sentry](${sessionUrl})
134
+ [${label}](${sessionUrl})
133
135
 
134
136
  ${GITHUB_SESSION_FOOTER_END}`;
135
137
  }
136
- function appendGitHubFooter(body, conversationId) {
137
- const footer = githubConversationFooter(conversationId);
138
+ function appendGitHubFooter(body, conversationId, dashboardUrl) {
139
+ const footer = githubConversationFooter(conversationId, dashboardUrl);
138
140
  const normalizedBody = body.trimEnd();
139
141
  const existingFooter = new RegExp(
140
142
  `${escapeRegExp(GITHUB_SESSION_FOOTER_START)}[\\s\\S]*?${escapeRegExp(GITHUB_SESSION_FOOTER_END)}`
@@ -645,7 +647,7 @@ function isDefinitiveGitHubPullRequestCreateRejection(error) {
645
647
  }
646
648
  return [400, 401, 404, 410, 422].includes(error.status);
647
649
  }
648
- function createGitHubPullRequestRequest(conversationId, input, actor) {
650
+ function createGitHubPullRequestRequest(conversationId, input, actor, dashboardUrl) {
649
651
  const repo = parseRepo2(input.repo);
650
652
  const payload = {
651
653
  title: nonEmptyString3(input.title, "title"),
@@ -653,7 +655,8 @@ function createGitHubPullRequestRequest(conversationId, input, actor) {
653
655
  base: nonEmptyString3(input.base, "base"),
654
656
  body: appendGitHubFooter(
655
657
  appendGitHubRequesterAttribution(input.body ?? "", actor),
656
- conversationId
658
+ conversationId,
659
+ dashboardUrl
657
660
  ),
658
661
  ...input.draft !== void 0 ? { draft: input.draft } : {}
659
662
  };
@@ -788,7 +791,8 @@ function createGitHubPullRequestTool(ctx) {
788
791
  const request = createGitHubPullRequestRequest(
789
792
  conversationId,
790
793
  parsedInput,
791
- ctx.actor
794
+ ctx.actor,
795
+ ctx.slack?.conversationLink?.url
792
796
  );
793
797
  const pendingState = {
794
798
  status: "pending",
@@ -852,6 +856,11 @@ var CREATE_TOOL_ROUTING_GUIDANCE = "This is a Junior tool-routing denial, not a
852
856
  var USER_WRITE_REQUIREMENTS = [
853
857
  "requesting GitHub user permission to perform this operation"
854
858
  ];
859
+ var GITHUB_CREDENTIAL_DOMAINS = ["api.github.com", "github.com"];
860
+ var GITHUB_USER_CREDENTIAL_DOMAINS = [
861
+ ...GITHUB_CREDENTIAL_DOMAINS,
862
+ "uploads.github.com"
863
+ ];
855
864
  var GitHubUserRefreshRejectedError = class extends Error {
856
865
  constructor(message) {
857
866
  super(message);
@@ -1309,7 +1318,7 @@ function createCredentialLease(input) {
1309
1318
  ...input.account ? { account: input.account } : {},
1310
1319
  ...input.authorization ? { authorization: input.authorization } : {},
1311
1320
  expiresAt: new Date(input.expiresAtMs).toISOString(),
1312
- headerTransforms: ["api.github.com", "github.com"].map((domain) => ({
1321
+ headerTransforms: (input.authorization ? GITHUB_USER_CREDENTIAL_DOMAINS : GITHUB_CREDENTIAL_DOMAINS).map((domain) => ({
1313
1322
  domain,
1314
1323
  headers: {
1315
1324
  Authorization: authorizationFor(domain, input.token)
@@ -1640,6 +1649,9 @@ function isGitHubGraphqlUrl(upstreamUrl) {
1640
1649
  function isGitHubApiUrl(upstreamUrl) {
1641
1650
  return upstreamUrl.hostname.toLowerCase() === "api.github.com";
1642
1651
  }
1652
+ function isGitHubAssetUploadRequest(method, upstreamUrl) {
1653
+ return method === "POST" && upstreamUrl.hostname.toLowerCase() === "uploads.github.com" && upstreamUrl.pathname === "/user-attachments/assets";
1654
+ }
1643
1655
  function githubUserReadReason(method, upstreamUrl) {
1644
1656
  if (method !== "GET" || !isGitHubApiUrl(upstreamUrl)) {
1645
1657
  return void 0;
@@ -1884,7 +1896,7 @@ function grantForAccess(access, reason, name, leaseScope) {
1884
1896
  access,
1885
1897
  ...leaseScope ? { leaseScope } : {},
1886
1898
  reason,
1887
- ...reason === "github.user-write" ? { requirements: USER_WRITE_REQUIREMENTS } : {}
1899
+ ...name === "user-write" ? { requirements: USER_WRITE_REQUIREMENTS } : {}
1888
1900
  };
1889
1901
  }
1890
1902
  function repositoryLeaseScope(upstreamUrl) {
@@ -1905,6 +1917,9 @@ async function githubGrantForEgress(ctx) {
1905
1917
  ...ctx.request.operation ? { operation: ctx.request.operation } : {},
1906
1918
  upstreamUrl
1907
1919
  });
1920
+ if (isGitHubAssetUploadRequest(method, upstreamUrl)) {
1921
+ return grantForAccess("write", "github.asset-upload", "user-write");
1922
+ }
1908
1923
  const smartHttpAccess = githubSmartHttpAccess(upstreamUrl);
1909
1924
  if (smartHttpAccess) {
1910
1925
  if (smartHttpAccess === "write") {
@@ -1981,7 +1996,7 @@ function githubPlugin(options = {}) {
1981
1996
  description: "GitHub issue, pull request, and repository workflows via GitHub App",
1982
1997
  ...appCapabilities ? { capabilities: appCapabilities } : {},
1983
1998
  configKeys: ["org", "repo"],
1984
- domains: ["api.github.com", "github.com"],
1999
+ domains: ["api.github.com", "github.com", "uploads.github.com"],
1985
2000
  envVars: {
1986
2001
  [appIdEnv]: {},
1987
2002
  [privateKeyEnv]: {},
@@ -2012,9 +2027,17 @@ function githubPlugin(options = {}) {
2012
2027
  commandFlags: ["--repo", "-R"]
2013
2028
  },
2014
2029
  runtimeDependencies: [
2030
+ {
2031
+ type: "system",
2032
+ package: "curl"
2033
+ },
2015
2034
  {
2016
2035
  type: "system",
2017
2036
  package: "gh"
2037
+ },
2038
+ {
2039
+ type: "system",
2040
+ package: "jq"
2018
2041
  }
2019
2042
  ]
2020
2043
  },
@@ -1,13 +1,10 @@
1
1
  export declare const GITHUB_SESSION_FOOTER_START = "<!-- junior-session-footer:start -->";
2
2
  export declare const GITHUB_SESSION_FOOTER_END = "<!-- junior-session-footer:end -->";
3
3
  export declare function sentryConversationUrl(conversationId: string): string | undefined;
4
- /**
5
- * Build the Junior session footer block for GitHub issues and pull requests.
6
- * Returns undefined when Sentry DSN/org are not configured.
7
- */
8
- export declare function githubConversationFooter(conversationId: string): string | undefined;
4
+ /** Build the Junior session footer, preferring a host-provided dashboard link. */
5
+ export declare function githubConversationFooter(conversationId: string, dashboardUrl?: string): string | undefined;
9
6
  /**
10
7
  * Append (or replace an existing) Junior session footer to a GitHub body string.
11
- * When Sentry is not configured, returns the body unchanged (existing footer stripped).
8
+ * Without a dashboard or Sentry link, returns the body unchanged (existing footer stripped).
12
9
  */
13
- export declare function appendGitHubFooter(body: string, conversationId: string): string;
10
+ export declare function appendGitHubFooter(body: string, conversationId: string, dashboardUrl?: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-github",
3
- "version": "0.102.3",
3
+ "version": "0.104.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@sinclair/typebox": "^0.34.49",
27
27
  "zod": "^4.4.3",
28
- "@sentry/junior-plugin-api": "0.102.3"
28
+ "@sentry/junior-plugin-api": "0.104.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/node": "^25.9.1",
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Intercom
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: attach-github-assets
3
+ description: Upload concrete local images or videos to GitHub user attachments and return markdown-ready links. Use when a user asks to attach a local screenshot, recording, image, or video to a GitHub pull request, issue, body, or comment. Do not use for remote URLs or when no local file path is available.
4
+ ---
5
+
6
+ # Attach GitHub Assets
7
+
8
+ Upload each user-provided local file with `scripts/upload.sh`. Do not replace the upload with a description of what the user could do manually.
9
+
10
+ ## Preconditions
11
+
12
+ Proceed only when both are true:
13
+
14
+ - The request identifies a concrete local path for a supported image or video.
15
+ - The destination is a GitHub pull request, issue, body, or comment.
16
+
17
+ Supported extensions: `png`, `jpg`, `jpeg`, `gif`, `webp`, `svg`, `mov`, `mp4`, `webm`.
18
+
19
+ Do not upload remote URLs, invent paths, or invoke this skill speculatively. If the request contains no local path, return `no-op: no local file path`.
20
+
21
+ ## Upload
22
+
23
+ Run from this skill's working directory, once per file:
24
+
25
+ ```bash
26
+ bash scripts/upload.sh "<file-path>" [owner/repo]
27
+ ```
28
+
29
+ - Pass the explicit `owner/repo` when the user supplied one.
30
+ - Otherwise the script resolves the repository from `github.repo` config, then the current checkout's `origin` remote.
31
+ - The script is non-interactive, prints one asset URL on stdout, and prints an actionable error on stderr when it fails.
32
+ - Do not batch files into one invocation. If one upload fails, report that file's exact error and do not claim it uploaded.
33
+
34
+ ## Return markdown
35
+
36
+ For each successful upload:
37
+
38
+ - Images: `![filename](asset-url)`
39
+ - Videos: put the asset URL on its own line so GitHub renders it.
40
+
41
+ Return only the markdown-ready results plus any per-file failures the user needs to act on.
@@ -0,0 +1,30 @@
1
+ # Sources
2
+
3
+ ## Inventory
4
+
5
+ - `intercom/2x-skills@59213af`, `plugins/pr-tools/skills/attach-github-assets/SKILL.md` — upstream runtime intent and supported use cases; primary source; high confidence; MIT.
6
+ - `intercom/2x-skills@59213af`, `plugins/pr-tools/skills/attach-github-assets/scripts/upload.sh` — upstream endpoint, MIME mapping, and response contract; primary implementation source; high confidence; MIT.
7
+ - `intercom/2x-skills@59213af`, `plugins/pr-tools/LICENSE` — upstream copyright and license notice; authoritative legal source; high confidence.
8
+ - `packages/junior-github/src/index.ts` — local GitHub credential and egress boundary; authoritative local source; high confidence.
9
+ - `packages/junior-github/skills/github-code/SKILL.md` — local repository targeting and credential guidance; authoritative local convention; high confidence.
10
+ - GitHub REST API documentation — no documented user-attachment upload operation found; official source; medium confidence for absence.
11
+
12
+ ## Decisions
13
+
14
+ - **Adopted:** preserve the upstream one-file-per-upload behavior, supported formats, markdown output, and upload endpoint.
15
+ - **Adopted:** preserve the upstream MIT license in the skill directory as explicitly required.
16
+ - **Replaced:** direct `gh auth token` access with Junior's host-managed user credential injection so credentials never enter script output or files.
17
+ - **Replaced:** numeric repository-id override with explicit `owner/repo`; the script resolves the id through authenticated `gh api`.
18
+ - **Narrowed:** automatic activation requires a concrete local path and GitHub destination.
19
+ - **Deferred:** live upload verification because it would create an external GitHub asset; deterministic mocked validation is sufficient for implementation checks.
20
+
21
+ ## Coverage
22
+
23
+ - Happy path: local image/video, repository resolution, successful URL extraction.
24
+ - Failures: missing path, missing file, unsupported type, unresolved repository, non-201 response, missing URL.
25
+ - Safety: no guessed paths, no remote URLs, no token retrieval, one upload per invocation.
26
+ - Portability: the skill is intentionally Junior GitHub-plugin-specific; relative script paths use the skill working directory supplied by `loadSkill`.
27
+
28
+ ## Stopping Rationale
29
+
30
+ Further retrieval was low-yield: the upstream implementation, local plugin credential boundary, local skill conventions, tests, and package registration behavior cover the runtime contract. The upload endpoint remains undocumented by GitHub, so the implementation records that limitation rather than inventing a public API guarantee.
@@ -0,0 +1,48 @@
1
+ # Attach GitHub Assets Specification
2
+
3
+ ## Intent
4
+
5
+ Upload local image and video files to GitHub's user-attachment service and return markdown-ready links for pull requests and issues.
6
+
7
+ ## Scope
8
+
9
+ In scope:
10
+
11
+ - Concrete local image and video paths.
12
+ - GitHub pull request and issue bodies or comments.
13
+ - Repository resolution from an explicit target, Junior config, or the current checkout.
14
+
15
+ Out of scope:
16
+
17
+ - Remote URLs, arbitrary file types, or speculative screenshot requests.
18
+ - Editing a pull request or issue after upload; the calling workflow owns placement.
19
+ - Persisting or printing GitHub credentials.
20
+
21
+ ## Runtime Contract
22
+
23
+ - Run `scripts/upload.sh` once per local file.
24
+ - Return image markdown or a bare video URL.
25
+ - Surface per-file failures exactly enough for the user to act.
26
+ - Use the GitHub plugin's host-managed credential injection; do not retrieve tokens in the script.
27
+
28
+ ## Reference Architecture
29
+
30
+ - `SKILL.md` contains trigger, execution, and output rules.
31
+ - `scripts/upload.sh` performs deterministic validation, repository resolution, and upload.
32
+ - `LICENSE` preserves the upstream MIT license and copyright notice.
33
+
34
+ ## Validation
35
+
36
+ - `pnpm skills:check` validates skill structure.
37
+ - Shell syntax and mocked upload smoke checks cover deterministic script behavior.
38
+ - GitHub plugin tests cover credential routing to `uploads.github.com`.
39
+
40
+ ## Known Limitations
41
+
42
+ - GitHub's user-attachment endpoint is not part of the documented public REST API.
43
+ - A real upload requires GitHub to accept the active user credential for the target repository.
44
+
45
+ ## Maintenance Notes
46
+
47
+ - Keep supported extensions synchronized between `SKILL.md` and `scripts/upload.sh`.
48
+ - Preserve `LICENSE` when adapting or moving the skill.
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ file_path="${1:-}"
5
+ repository="${2:-}"
6
+
7
+ if [[ -z "$file_path" ]]; then
8
+ echo "Usage: upload.sh <file-path> [owner/repo]" >&2
9
+ exit 1
10
+ fi
11
+
12
+ if [[ ! -f "$file_path" ]]; then
13
+ echo "Error: File not found: $file_path" >&2
14
+ exit 1
15
+ fi
16
+
17
+ filename=$(basename "$file_path")
18
+ extension="${filename##*.}"
19
+ extension=$(printf '%s' "$extension" | tr '[:upper:]' '[:lower:]')
20
+
21
+ case "$extension" in
22
+ png) mime_type="image/png" ;;
23
+ jpg|jpeg) mime_type="image/jpeg" ;;
24
+ gif) mime_type="image/gif" ;;
25
+ webp) mime_type="image/webp" ;;
26
+ svg) mime_type="image/svg+xml" ;;
27
+ mov) mime_type="video/quicktime" ;;
28
+ mp4) mime_type="video/mp4" ;;
29
+ webm) mime_type="video/webm" ;;
30
+ *)
31
+ echo "Error: Unsupported file type '.$extension'. Supported: png, jpg, jpeg, gif, webp, svg, mov, mp4, webm" >&2
32
+ exit 1
33
+ ;;
34
+ esac
35
+
36
+ if [[ -z "$repository" ]] && command -v jr-rpc >/dev/null 2>&1; then
37
+ repository=$(jr-rpc config get github.repo 2>/dev/null || true)
38
+ fi
39
+
40
+ if [[ -z "$repository" ]]; then
41
+ remote_url=$(git remote get-url origin 2>/dev/null || true)
42
+ case "$remote_url" in
43
+ git@github.com:*) repository="${remote_url#git@github.com:}" ;;
44
+ https://github.com/*) repository="${remote_url#https://github.com/}" ;;
45
+ esac
46
+ repository="${repository%.git}"
47
+ fi
48
+
49
+ if [[ ! "$repository" =~ ^[^/[:space:]]+/[^/[:space:]]+$ ]]; then
50
+ echo "Error: Could not resolve a GitHub repository. Pass owner/repo as the second argument or configure github.repo." >&2
51
+ exit 1
52
+ fi
53
+
54
+ repository_id=$(gh api "repos/$repository" --jq '.id')
55
+ encoded_name=$(printf '%s' "$filename" | jq -sRr @uri)
56
+ encoded_mime=$(printf '%s' "$mime_type" | jq -sRr @uri)
57
+ response_file=$(mktemp)
58
+ trap 'rm -f "$response_file"' EXIT
59
+
60
+ http_code=$(curl --silent --show-error \
61
+ --output "$response_file" \
62
+ --write-out '%{http_code}' \
63
+ --request POST \
64
+ --header 'Content-Type: application/octet-stream' \
65
+ --header 'Accept: application/json' \
66
+ --header 'X-GitHub-Api-Version: 2022-11-28' \
67
+ --data-binary "@$file_path" \
68
+ "https://uploads.github.com/user-attachments/assets?name=$encoded_name&content_type=$encoded_mime&repository_id=$repository_id")
69
+
70
+ if [[ "$http_code" != "201" ]]; then
71
+ echo "Error: Upload failed with HTTP $http_code" >&2
72
+ cat "$response_file" >&2
73
+ exit 1
74
+ fi
75
+
76
+ asset_url=$(jq -r '.url // empty' "$response_file")
77
+ if [[ -z "$asset_url" ]]; then
78
+ echo "Error: GitHub upload response did not include an asset URL." >&2
79
+ cat "$response_file" >&2
80
+ exit 1
81
+ fi
82
+
83
+ printf '%s\n' "$asset_url"
package/LICENSE DELETED
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.