@framers/agentos-ext-github 0.4.2 → 0.6.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 +15 -8
- package/dist/__tests__/app.test.js +202 -9
- package/dist/__tests__/app.test.js.map +1 -1
- package/dist/__tests__/documents.test.d.ts +3 -2
- package/dist/__tests__/documents.test.d.ts.map +1 -1
- package/dist/__tests__/documents.test.js +202 -17
- package/dist/__tests__/documents.test.js.map +1 -1
- package/dist/__tests__/events.test.js +17 -0
- package/dist/__tests__/events.test.js.map +1 -1
- package/dist/app/credential.d.ts +26 -2
- package/dist/app/credential.d.ts.map +1 -1
- package/dist/app/credential.js +35 -3
- package/dist/app/credential.js.map +1 -1
- package/dist/app/events.d.ts +14 -10
- package/dist/app/events.d.ts.map +1 -1
- package/dist/app/events.js +17 -11
- package/dist/app/events.js.map +1 -1
- package/dist/app/http.d.ts +10 -0
- package/dist/app/http.d.ts.map +1 -1
- package/dist/app/http.js +16 -0
- package/dist/app/http.js.map +1 -1
- package/dist/app/installations.d.ts +22 -5
- package/dist/app/installations.d.ts.map +1 -1
- package/dist/app/installations.js +39 -13
- package/dist/app/installations.js.map +1 -1
- package/dist/app/reconcile.d.ts +28 -6
- package/dist/app/reconcile.d.ts.map +1 -1
- package/dist/app/reconcile.js +33 -14
- package/dist/app/reconcile.js.map +1 -1
- package/dist/app/webhook.d.ts +7 -0
- package/dist/app/webhook.d.ts.map +1 -1
- package/dist/app/webhook.js +11 -2
- package/dist/app/webhook.js.map +1 -1
- package/dist/documents/GitHubDocumentsConnector.d.ts +14 -3
- package/dist/documents/GitHubDocumentsConnector.d.ts.map +1 -1
- package/dist/documents/GitHubDocumentsConnector.js +20 -8
- package/dist/documents/GitHubDocumentsConnector.js.map +1 -1
- package/dist/documents/index.d.ts +4 -4
- package/dist/documents/index.d.ts.map +1 -1
- package/dist/documents/index.js +4 -4
- package/dist/documents/index.js.map +1 -1
- package/dist/documents/tree.d.ts +53 -9
- package/dist/documents/tree.d.ts.map +1 -1
- package/dist/documents/tree.js +77 -17
- package/dist/documents/tree.js.map +1 -1
- package/manifest.json +1 -1
- package/package.json +4 -4
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview A repository's documentation as account sources, read through a GitHub App's installation: each
|
|
3
|
-
* repository
|
|
4
|
-
* raw bytes under a cap, and a push compared by the tree at its `after` commit. A selection, an item
|
|
5
|
-
* cannot answer whole is refused before any request.
|
|
3
|
+
* repository read by its id, its tree read once a commit within a request budget, the documentation kept by a filter,
|
|
4
|
+
* each file read as raw bytes under a cap, and a push compared by the tree at its `after` commit. A selection, an item
|
|
5
|
+
* or a call it cannot answer whole is refused before any request.
|
|
6
6
|
* @module agentos-ext-github/documents/GitHubDocumentsConnector
|
|
7
7
|
*/
|
|
8
8
|
import { ReadCapExceeded, } from '@framers/agentos-ext-account-sources';
|
|
9
|
-
import { GITHUB_API_BASE, GitHubApiError, githubFetch, GitHubNoAnswer, githubSend, objectOf, stringIn } from '../app/http.js';
|
|
9
|
+
import { GITHUB_API_BASE, GitHubApiError, githubFetch, GitHubNoAnswer, githubSend, objectOf, repositoryPath, stringIn } from '../app/http.js';
|
|
10
10
|
import { DEFAULT_MAX_FILE_BYTES, extensionOf, pathFilter, readTree, SKIPPED_FOLDERS } from './tree.js';
|
|
11
11
|
/** The files answered as bytes with their media type; every other kept file is answered as text. */
|
|
12
12
|
const MEDIA_TYPES = {
|
|
@@ -81,6 +81,13 @@ function notCancelled(signal) {
|
|
|
81
81
|
* request: a `TypeError` for an id that is not a repository id, a repository named twice, an item id that names no
|
|
82
82
|
* file or a change set of other than one repository, and an `Error` for a repository outside the link. An
|
|
83
83
|
* installation is removed by the app's own call (`uninstallInstallation`), never by a link's connector.
|
|
84
|
+
*
|
|
85
|
+
* Every read addresses a linked repository by its id (`/repositories/<id>/...`, where GitHub's own redirects for a
|
|
86
|
+
* renamed or moved repository lead), never by its name. A name can come to mean another repository (a renamed
|
|
87
|
+
* repository's old name taken again, or an account's old login claimed by another account, which ends GitHub's
|
|
88
|
+
* redirects), and GitHub answers a public repository's branch, tree and files to any token, the installation token
|
|
89
|
+
* narrowed to the linked repository included, so a read by name could take in another account's repository. The full
|
|
90
|
+
* name builds the attribution link alone.
|
|
84
91
|
*/
|
|
85
92
|
export class GitHubDocumentsConnector {
|
|
86
93
|
credential;
|
|
@@ -117,11 +124,15 @@ export class GitHubDocumentsConnector {
|
|
|
117
124
|
token(id, signal) {
|
|
118
125
|
return this.credential.installationToken(this.installationId, [id], { signal });
|
|
119
126
|
}
|
|
127
|
+
/** A linked repository's address under the API, by its id. */
|
|
128
|
+
address(repository) {
|
|
129
|
+
return `${this.apiBase}/${repositoryPath(repository.id)}`;
|
|
130
|
+
}
|
|
120
131
|
/** The head commit of a repository's default branch. */
|
|
121
132
|
async head(repositoryId, signal) {
|
|
122
133
|
notCancelled(signal);
|
|
123
134
|
const repository = this.repository(repositoryId);
|
|
124
|
-
const url = `${this.
|
|
135
|
+
const url = `${this.address(repository)}/branches/${encodeURIComponent(repository.defaultBranch)}`;
|
|
125
136
|
const branch = objectOf(await githubFetch(this.fetchImpl, url, { token: await this.token(repositoryId, signal), signal }), 'a branch');
|
|
126
137
|
return stringIn(objectOf(branch.commit, "a branch's commit"), 'sha', "a branch's commit");
|
|
127
138
|
}
|
|
@@ -133,7 +144,7 @@ export class GitHubDocumentsConnector {
|
|
|
133
144
|
async listing(repositoryId, commit, signal) {
|
|
134
145
|
notCancelled(signal);
|
|
135
146
|
const repository = this.repository(repositoryId);
|
|
136
|
-
const tree = await readTree(this.fetchImpl, await this.token(repositoryId, signal), repository.
|
|
147
|
+
const tree = await readTree(this.fetchImpl, await this.token(repositoryId, signal), repository.id, commit, this.apiBase, {
|
|
137
148
|
maxRequests: this.filter.maxTreeRequests,
|
|
138
149
|
skipFolders: this.filter.skipFolders ?? SKIPPED_FOLDERS,
|
|
139
150
|
signal,
|
|
@@ -178,7 +189,7 @@ export class GitHubDocumentsConnector {
|
|
|
178
189
|
const repository = this.repository(repositoryId);
|
|
179
190
|
// A version that names no commit (none, no `@`, or nothing after it) reads the default branch.
|
|
180
191
|
const commit = (item.version ?? '').split('@')[1] || repository.defaultBranch;
|
|
181
|
-
const url = `${this.
|
|
192
|
+
const url = `${this.address(repository)}/contents/${encodedPath(path)}?ref=${encodeURIComponent(commit)}`;
|
|
182
193
|
// Minted outside the try below: a 404 there is the file's, and the token's own refusal must reach the caller.
|
|
183
194
|
const token = await this.token(repository.id, signal);
|
|
184
195
|
let answer;
|
|
@@ -203,7 +214,8 @@ export class GitHubDocumentsConnector {
|
|
|
203
214
|
kind: 'github',
|
|
204
215
|
title: path,
|
|
205
216
|
path,
|
|
206
|
-
|
|
217
|
+
// The ref's segments encoded as the path's are: Git allows a "#" in a branch name, which would end the address.
|
|
218
|
+
url: `https://github.com/${repository.fullName}/blob/${encodedPath(commit)}/${encodedPath(path)}`,
|
|
207
219
|
version: commit,
|
|
208
220
|
readAt: new Date().toISOString(),
|
|
209
221
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitHubDocumentsConnector.js","sourceRoot":"","sources":["../../src/documents/GitHubDocumentsConnector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,eAAe,GAQhB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAqB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"GitHubDocumentsConnector.js","sourceRoot":"","sources":["../../src/documents/GitHubDocumentsConnector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,eAAe,GAQhB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,cA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AC,GAAG,CAAC,CAAC,EAAE,CAAC;IAC5E,CAAC;IAED,uGAAuG;IACvG,KAAK,CAAC,MAAM;QACV,8FAA8F;IAChG,CAAC;CACF"}
|
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
/** The documentation connector and the shape of a push it compares. */
|
|
9
9
|
export { GitHubDocumentsConnector, type GitHubChangesSelection, type LinkedRepository } from './GitHubDocumentsConnector.js';
|
|
10
|
-
/** A repository's tree within a request budget, and the filter that keeps its documentation. */
|
|
11
|
-
export { readTree, pathFilter, extensionOf, TreeTooLarge, DOCUMENT_EXTENSIONS, SKIPPED_FOLDERS, DEFAULT_MAX_FILES, DEFAULT_MAX_FILE_BYTES, DEFAULT_MAX_TREE_REQUESTS, type ReadTreeOptions, type TreeBlob, type TreeFilter, } from './tree.js';
|
|
10
|
+
/** A repository's tree within a request budget, and the filter that keeps its documentation, and its code when asked. */
|
|
11
|
+
export { readTree, pathFilter, extensionOf, isGeneratedCode, TreeTooLarge, type TreeTooLargeReason, DOCUMENT_EXTENSIONS, CODE_EXTENSIONS, GENERATED_CODE_ENDINGS, SKIPPED_FOLDERS, DEFAULT_MAX_FILES, DEFAULT_MAX_FILE_BYTES, DEFAULT_MAX_TREE_REQUESTS, type ReadTreeOptions, type TreeBlob, type TreeFilter, } from './tree.js';
|
|
12
12
|
/** The app's JWT and installation tokens. */
|
|
13
13
|
export { appJwt, GitHubAppCredential, type GitHubAppIdentity, type InstallationTokenOptions } from '../app/credential.js';
|
|
14
14
|
/** The user's web flow on the auth module's redirect flow. */
|
|
15
15
|
export { GitHubAppUserFlow, GITHUB_OAUTH_ENDPOINTS, type GitHubAppClient, type GitHubAppUserFlowOptions, type GitHubOAuthEndpoints, } from '../app/userFlow.js';
|
|
16
|
-
/** What a user token reaches,
|
|
17
|
-
export { userOfToken, installationsOfUser, repositoriesOfUser, listInstallations, uninstallInstallation, type GitHubAccount, type GitHubInstallation, type GitHubUser, type UserRepository, } from '../app/installations.js';
|
|
16
|
+
/** What a user token reaches, the app's own installations, and the repositories an installation reaches. */
|
|
17
|
+
export { userOfToken, installationsOfUser, repositoriesOfUser, repositoriesOfInstallation, listInstallations, uninstallInstallation, type GitHubAccount, type GitHubInstallation, type GitHubUser, type InstallationRepository, type UserRepository, } from '../app/installations.js';
|
|
18
18
|
/** A webhook delivery's signature. */
|
|
19
19
|
export { verifyWebhookSignature } from '../app/webhook.js';
|
|
20
20
|
/** A webhook delivery read as a typed event once its signature holds. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/documents/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,uEAAuE;AACvE,OAAO,EAAE,wBAAwB,EAAE,KAAK,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAC7H,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/documents/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,uEAAuE;AACvE,OAAO,EAAE,wBAAwB,EAAE,KAAK,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAC7H,yHAAyH;AACzH,OAAO,EACL,QAAQ,EACR,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EACZ,KAAK,kBAAkB,EACvB,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,EACzB,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,UAAU,GAChB,MAAM,WAAW,CAAC;AACnB,6CAA6C;AAC7C,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAC1H,8DAA8D;AAC9D,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,4GAA4G;AAC5G,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,0BAA0B,EAC1B,iBAAiB,EACjB,qBAAqB,EACrB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,KAAK,sBAAsB,EAC3B,KAAK,cAAc,GACpB,MAAM,yBAAyB,CAAC;AACjC,sCAAsC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,yEAAyE;AACzE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,mCAAmC,EACxC,KAAK,6BAA6B,EAClC,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,2BAA2B;AAC3B,OAAO,EACL,sBAAsB,EACtB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B;;;GAGG;AACH,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC"}
|
package/dist/documents/index.js
CHANGED
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
/** The documentation connector and the shape of a push it compares. */
|
|
9
9
|
export { GitHubDocumentsConnector } from './GitHubDocumentsConnector.js';
|
|
10
|
-
/** A repository's tree within a request budget, and the filter that keeps its documentation. */
|
|
11
|
-
export { readTree, pathFilter, extensionOf, TreeTooLarge, DOCUMENT_EXTENSIONS, SKIPPED_FOLDERS, DEFAULT_MAX_FILES, DEFAULT_MAX_FILE_BYTES, DEFAULT_MAX_TREE_REQUESTS, } from './tree.js';
|
|
10
|
+
/** A repository's tree within a request budget, and the filter that keeps its documentation, and its code when asked. */
|
|
11
|
+
export { readTree, pathFilter, extensionOf, isGeneratedCode, TreeTooLarge, DOCUMENT_EXTENSIONS, CODE_EXTENSIONS, GENERATED_CODE_ENDINGS, SKIPPED_FOLDERS, DEFAULT_MAX_FILES, DEFAULT_MAX_FILE_BYTES, DEFAULT_MAX_TREE_REQUESTS, } from './tree.js';
|
|
12
12
|
/** The app's JWT and installation tokens. */
|
|
13
13
|
export { appJwt, GitHubAppCredential } from '../app/credential.js';
|
|
14
14
|
/** The user's web flow on the auth module's redirect flow. */
|
|
15
15
|
export { GitHubAppUserFlow, GITHUB_OAUTH_ENDPOINTS, } from '../app/userFlow.js';
|
|
16
|
-
/** What a user token reaches,
|
|
17
|
-
export { userOfToken, installationsOfUser, repositoriesOfUser, listInstallations, uninstallInstallation, } from '../app/installations.js';
|
|
16
|
+
/** What a user token reaches, the app's own installations, and the repositories an installation reaches. */
|
|
17
|
+
export { userOfToken, installationsOfUser, repositoriesOfUser, repositoriesOfInstallation, listInstallations, uninstallInstallation, } from '../app/installations.js';
|
|
18
18
|
/** A webhook delivery's signature. */
|
|
19
19
|
export { verifyWebhookSignature } from '../app/webhook.js';
|
|
20
20
|
/** A webhook delivery read as a typed event once its signature holds. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/documents/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,uEAAuE;AACvE,OAAO,EAAE,wBAAwB,EAAsD,MAAM,+BAA+B,CAAC;AAC7H,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/documents/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,uEAAuE;AACvE,OAAO,EAAE,wBAAwB,EAAsD,MAAM,+BAA+B,CAAC;AAC7H,yHAAyH;AACzH,OAAO,EACL,QAAQ,EACR,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EAEZ,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,GAI1B,MAAM,WAAW,CAAC;AACnB,6CAA6C;AAC7C,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAyD,MAAM,sBAAsB,CAAC;AAC1H,8DAA8D;AAC9D,OAAO,EACL,iBAAiB,EACjB,sBAAsB,GAIvB,MAAM,oBAAoB,CAAC;AAC5B,4GAA4G;AAC5G,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,0BAA0B,EAC1B,iBAAiB,EACjB,qBAAqB,GAMtB,MAAM,yBAAyB,CAAC;AACjC,sCAAsC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,yEAAyE;AACzE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,GAc3B,MAAM,kBAAkB,CAAC;AAC1B,2BAA2B;AAC3B,OAAO,EACL,sBAAsB,GASvB,MAAM,qBAAqB,CAAC;AAC7B;;;GAGG;AACH,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,cAAc,GAIf,MAAM,gBAAgB,CAAC"}
|
package/dist/documents/tree.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview A repository's tree at a commit, read within a request budget, and the filter that keeps its
|
|
3
3
|
* documentation. GitHub cuts a recursive tree past 100,000 entries or 7 MB and marks it `truncated`; such a tree is
|
|
4
|
-
* read again one subtree at a time.
|
|
4
|
+
* read again one subtree at a time, and a level GitHub cuts short even when asked for alone is refused whole.
|
|
5
5
|
* @module agentos-ext-github/documents/tree
|
|
6
6
|
*/
|
|
7
7
|
/** One file of a tree: its path from the repository's root, its blob and its size in bytes. */
|
|
@@ -14,6 +14,12 @@ export interface TreeBlob {
|
|
|
14
14
|
export interface TreeFilter {
|
|
15
15
|
/** The file extensions kept, with their dot ({@link DOCUMENT_EXTENSIONS} when absent). */
|
|
16
16
|
extensions?: readonly string[];
|
|
17
|
+
/**
|
|
18
|
+
* Code files kept too: the source files of {@link CODE_EXTENSIONS} beside `extensions`, under the same bounds, a
|
|
19
|
+
* generated one left out ({@link isGeneratedCode}). Off when absent, so a repository's code is read only when its
|
|
20
|
+
* reader asks for it.
|
|
21
|
+
*/
|
|
22
|
+
includeCode?: boolean;
|
|
17
23
|
/** The folders skipped at any depth, by name ({@link SKIPPED_FOLDERS} when absent). */
|
|
18
24
|
skipFolders?: readonly string[];
|
|
19
25
|
/** At most this many files, in path order ({@link DEFAULT_MAX_FILES} when absent). */
|
|
@@ -27,17 +33,44 @@ export interface TreeFilter {
|
|
|
27
33
|
export declare const DOCUMENT_EXTENSIONS: readonly string[];
|
|
28
34
|
/** The folders skipped by default: dependencies, build output and vendored code. */
|
|
29
35
|
export declare const SKIPPED_FOLDERS: readonly string[];
|
|
36
|
+
/**
|
|
37
|
+
* The source files a filter that includes code keeps beside its documentation (`includeCode`): program source in the
|
|
38
|
+
* common languages, shell scripts, SQL, GraphQL and Protocol Buffers schemas, Terraform and style sheets, each read as
|
|
39
|
+
* UTF-8 text. Data and configuration (JSON, YAML, XML, CSV) and binary files are not code here, and stay out.
|
|
40
|
+
*/
|
|
41
|
+
export declare const CODE_EXTENSIONS: readonly string[];
|
|
42
|
+
/**
|
|
43
|
+
* The endings of code files a tool writes rather than a person, left out of a filter that includes code: minified and
|
|
44
|
+
* bundled scripts and style sheets, and the files the Protocol Buffers, Dart and similar generators write. The folders
|
|
45
|
+
* of build output and dependencies are skipped already ({@link SKIPPED_FOLDERS}), and lock files carry no code
|
|
46
|
+
* extension.
|
|
47
|
+
*/
|
|
48
|
+
export declare const GENERATED_CODE_ENDINGS: readonly string[];
|
|
49
|
+
/** True for a code file a tool wrote, by its name's ending ({@link GENERATED_CODE_ENDINGS}), in any case. */
|
|
50
|
+
export declare function isGeneratedCode(path: string): boolean;
|
|
30
51
|
/** The files kept by default. */
|
|
31
52
|
export declare const DEFAULT_MAX_FILES = 2000;
|
|
32
53
|
/** The largest file kept by default: 10 MiB. */
|
|
33
54
|
export declare const DEFAULT_MAX_FILE_BYTES = 10485760;
|
|
34
55
|
/** The tree requests one listing makes by default. */
|
|
35
56
|
export declare const DEFAULT_MAX_TREE_REQUESTS = 50;
|
|
36
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* Why a tree cannot be read whole: `budget` when it needs more requests than its budget, `truncated` when GitHub cut
|
|
59
|
+
* short a level asked for without recursion, which no budget reads whole.
|
|
60
|
+
*/
|
|
61
|
+
export type TreeTooLargeReason = 'budget' | 'truncated';
|
|
62
|
+
/**
|
|
63
|
+
* A tree that cannot be read whole: past its request budget, or holding a folder GitHub cuts short even when asked for
|
|
64
|
+
* alone. Neither answers a part of the tree, since a file left out would read as removed.
|
|
65
|
+
*/
|
|
37
66
|
export declare class TreeTooLarge extends Error {
|
|
38
67
|
readonly maxRequests: number;
|
|
39
|
-
|
|
40
|
-
|
|
68
|
+
readonly reason: TreeTooLargeReason;
|
|
69
|
+
/**
|
|
70
|
+
* @param maxRequests The request budget of the read.
|
|
71
|
+
* @param reason Why the tree cannot be read whole; `budget` when absent.
|
|
72
|
+
*/
|
|
73
|
+
constructor(maxRequests: number, reason?: TreeTooLargeReason);
|
|
41
74
|
}
|
|
42
75
|
/** The budget of a tree read, the folders it never walks into, and its abort signal. */
|
|
43
76
|
export interface ReadTreeOptions {
|
|
@@ -53,19 +86,30 @@ export declare function extensionOf(path: string): string;
|
|
|
53
86
|
* Every file of a repository's tree at a commit (symbolic links aside). The tree is asked for recursively; when GitHub
|
|
54
87
|
* answers it truncated, its top level is read and each subtree is asked for the same way, so only the parts too large
|
|
55
88
|
* for one answer cost a request per folder. Each request counts against `maxRequests`, and the read throws
|
|
56
|
-
* {@link TreeTooLarge} rather than make one more.
|
|
89
|
+
* {@link TreeTooLarge} (`budget`) rather than make one more. A level GitHub answers truncated without recursion as well
|
|
90
|
+
* throws {@link TreeTooLarge} (`truncated`) at that answer, before any folder under it is asked for: the tree answer's
|
|
91
|
+
* `truncated` field can be set on any answer, and a part of the tree would leave out files that then read as removed.
|
|
92
|
+
*
|
|
93
|
+
* Name the repository by its id. A full name reads whatever repository holds that name when the tree is asked for: a
|
|
94
|
+
* renamed repository's old name can be taken again, and an account's old login claimed by another account, which ends
|
|
95
|
+
* GitHub's redirects to the repository; and GitHub answers a public repository's tree to any token, an installation
|
|
96
|
+
* token narrowed to other repositories included.
|
|
57
97
|
*
|
|
58
98
|
* @param fetchImpl The fetch the tree is read with.
|
|
59
99
|
* @param token An installation token that reads the repository.
|
|
60
|
-
* @param
|
|
100
|
+
* @param repository The repository's id, read at `/repositories/<id>`, or its full name, `owner/name`.
|
|
61
101
|
* @param commit The commit whose tree is read.
|
|
62
102
|
* @param apiBase GitHub's REST API, or a stand-in's address in tests.
|
|
63
103
|
* @param options The request budget, the folders skipped and an abort signal.
|
|
104
|
+
* @throws TypeError before any request when `repository` is a number that is not a positive integer.
|
|
64
105
|
*/
|
|
65
|
-
export declare function readTree(fetchImpl: typeof fetch, token: string,
|
|
106
|
+
export declare function readTree(fetchImpl: typeof fetch, token: string, repository: number | string, commit: string, apiBase?: string, options?: ReadTreeOptions): Promise<TreeBlob[]>;
|
|
66
107
|
/**
|
|
67
|
-
* The filter that keeps a tree's documentation: the extensions kept,
|
|
68
|
-
* size cap, in path order
|
|
108
|
+
* The filter that keeps a tree's documentation: the extensions kept, and with `includeCode` the code extensions beside
|
|
109
|
+
* them; nothing under a skipped folder, nothing past the size cap, at most `maxFiles`, in path order. With code asked
|
|
110
|
+
* for, a code file a tool wrote is left out, whatever `extensions` names, and the documentation keeps its places under
|
|
111
|
+
* the cap first: the documentation paths first in path order, then the code paths in path order in the room left, so
|
|
112
|
+
* turning code on never drops a document a listing held.
|
|
69
113
|
*/
|
|
70
114
|
export declare function pathFilter(filter?: TreeFilter): (blobs: readonly TreeBlob[]) => TreeBlob[];
|
|
71
115
|
//# sourceMappingURL=tree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/documents/tree.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,+FAA+F;AAC/F,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,+GAA+G;AAC/G,MAAM,WAAW,UAAU;IACzB,0FAA0F;IAC1F,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,uFAAuF;IACvF,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,sFAAsF;IACtF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0IAA0I;IAC1I,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0GAA0G;IAC1G,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,qGAAqG;AACrG,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAA2E,CAAC;AAE7H,oFAAoF;AACpF,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAAuE,CAAC;AAErH,iCAAiC;AACjC,eAAO,MAAM,iBAAiB,OAAQ,CAAC;AAEvC,gDAAgD;AAChD,eAAO,MAAM,sBAAsB,WAAa,CAAC;AAEjD,sDAAsD;AACtD,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAK5C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AAa,YAAa,SAAQ,KAAK;IAMnC,QAAQ,CAAC,WAAW,EAAE,MAAM;IAC5B,QAAQ,CAAC,MAAM,EAAE,kBAAkB;IANrC;;;OAGG;gBAEQ,WAAW,EAAE,MAAM,EACnB,MAAM,GAAE,kBAA6B;CAKjD;AAED,wFAAwF;AACxF,MAAM,WAAW,eAAe;IAC9B,kFAAkF;IAClF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6FAA6F;IAC7F,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAsBD,sFAAsF;AACtF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIhD;AAMD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,QAAQ,CAC5B,SAAS,EAAE,OAAO,KAAK,EACvB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,GAAG,MAAM,EAC3B,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,MAAwB,EACjC,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,QAAQ,EAAE,CAAC,CAyCrB;AAOD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,GAAE,UAAe,GAAG,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,KAAK,QAAQ,EAAE,CAe9F"}
|
package/dist/documents/tree.js
CHANGED
|
@@ -1,14 +1,41 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview A repository's tree at a commit, read within a request budget, and the filter that keeps its
|
|
3
3
|
* documentation. GitHub cuts a recursive tree past 100,000 entries or 7 MB and marks it `truncated`; such a tree is
|
|
4
|
-
* read again one subtree at a time.
|
|
4
|
+
* read again one subtree at a time, and a level GitHub cuts short even when asked for alone is refused whole.
|
|
5
5
|
* @module agentos-ext-github/documents/tree
|
|
6
6
|
*/
|
|
7
|
-
import { arrayOf, GITHUB_API_BASE, githubFetch, objectOf, stringIn } from '../app/http.js';
|
|
7
|
+
import { arrayOf, GITHUB_API_BASE, githubFetch, objectOf, repositoryPath, stringIn } from '../app/http.js';
|
|
8
8
|
/** The documentation kept by default: Markdown, text, reStructuredText, HTML, PDF and Word files. */
|
|
9
9
|
export const DOCUMENT_EXTENSIONS = ['.md', '.markdown', '.txt', '.rst', '.html', '.htm', '.pdf', '.docx'];
|
|
10
10
|
/** The folders skipped by default: dependencies, build output and vendored code. */
|
|
11
11
|
export const SKIPPED_FOLDERS = ['node_modules', 'vendor', 'dist', 'build', '.git', 'third_party'];
|
|
12
|
+
/**
|
|
13
|
+
* The source files a filter that includes code keeps beside its documentation (`includeCode`): program source in the
|
|
14
|
+
* common languages, shell scripts, SQL, GraphQL and Protocol Buffers schemas, Terraform and style sheets, each read as
|
|
15
|
+
* UTF-8 text. Data and configuration (JSON, YAML, XML, CSV) and binary files are not code here, and stay out.
|
|
16
|
+
*/
|
|
17
|
+
export const CODE_EXTENSIONS = [
|
|
18
|
+
'.ts', '.tsx', '.mts', '.cts', '.js', '.jsx', '.mjs', '.cjs', '.py', '.rb', '.go', '.rs', '.java', '.kt', '.kts',
|
|
19
|
+
'.scala', '.swift', '.m', '.mm', '.c', '.h', '.cc', '.cpp', '.cxx', '.hpp', '.hh', '.cs', '.fs', '.php', '.pl',
|
|
20
|
+
'.pm', '.lua', '.r', '.jl', '.dart', '.ex', '.exs', '.erl', '.hrl', '.clj', '.cljs', '.hs', '.ml', '.mli', '.elm',
|
|
21
|
+
'.vue', '.svelte', '.sh', '.bash', '.zsh', '.ps1', '.sql', '.graphql', '.gql', '.proto', '.tf', '.css', '.scss',
|
|
22
|
+
'.sass', '.less',
|
|
23
|
+
];
|
|
24
|
+
/**
|
|
25
|
+
* The endings of code files a tool writes rather than a person, left out of a filter that includes code: minified and
|
|
26
|
+
* bundled scripts and style sheets, and the files the Protocol Buffers, Dart and similar generators write. The folders
|
|
27
|
+
* of build output and dependencies are skipped already ({@link SKIPPED_FOLDERS}), and lock files carry no code
|
|
28
|
+
* extension.
|
|
29
|
+
*/
|
|
30
|
+
export const GENERATED_CODE_ENDINGS = [
|
|
31
|
+
'.min.js', '.min.mjs', '.min.cjs', '.min.css', '.bundle.js', '.bundle.mjs', '.bundle.css', '.chunk.js', '.chunk.mjs',
|
|
32
|
+
'.chunk.css', '.pb.go', '.pb.cc', '.pb.h', '_pb2.py', '_pb2_grpc.py', '.g.dart', '.freezed.dart', '.generated.ts',
|
|
33
|
+
];
|
|
34
|
+
/** True for a code file a tool wrote, by its name's ending ({@link GENERATED_CODE_ENDINGS}), in any case. */
|
|
35
|
+
export function isGeneratedCode(path) {
|
|
36
|
+
const name = path.slice(path.lastIndexOf('/') + 1).toLowerCase();
|
|
37
|
+
return GENERATED_CODE_ENDINGS.some((ending) => name.endsWith(ending));
|
|
38
|
+
}
|
|
12
39
|
/** The files kept by default. */
|
|
13
40
|
export const DEFAULT_MAX_FILES = 2_000;
|
|
14
41
|
/** The largest file kept by default: 10 MiB. */
|
|
@@ -17,13 +44,21 @@ export const DEFAULT_MAX_FILE_BYTES = 10_485_760;
|
|
|
17
44
|
export const DEFAULT_MAX_TREE_REQUESTS = 50;
|
|
18
45
|
/** A symbolic link's mode in a tree; its blob holds the link's target, not a document. */
|
|
19
46
|
const SYMLINK_MODE = '120000';
|
|
20
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* A tree that cannot be read whole: past its request budget, or holding a folder GitHub cuts short even when asked for
|
|
49
|
+
* alone. Neither answers a part of the tree, since a file left out would read as removed.
|
|
50
|
+
*/
|
|
21
51
|
export class TreeTooLarge extends Error {
|
|
22
52
|
maxRequests;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
53
|
+
reason;
|
|
54
|
+
/**
|
|
55
|
+
* @param maxRequests The request budget of the read.
|
|
56
|
+
* @param reason Why the tree cannot be read whole; `budget` when absent.
|
|
57
|
+
*/
|
|
58
|
+
constructor(maxRequests, reason = 'budget') {
|
|
59
|
+
super(reason === 'budget' ? `the tree needs more than ${maxRequests} requests to read` : 'GitHub cut a folder of the tree short even when asked for alone');
|
|
26
60
|
this.maxRequests = maxRequests;
|
|
61
|
+
this.reason = reason;
|
|
27
62
|
this.name = 'TreeTooLarge';
|
|
28
63
|
}
|
|
29
64
|
}
|
|
@@ -50,16 +85,25 @@ function inSkippedFolder(path, skip) {
|
|
|
50
85
|
* Every file of a repository's tree at a commit (symbolic links aside). The tree is asked for recursively; when GitHub
|
|
51
86
|
* answers it truncated, its top level is read and each subtree is asked for the same way, so only the parts too large
|
|
52
87
|
* for one answer cost a request per folder. Each request counts against `maxRequests`, and the read throws
|
|
53
|
-
* {@link TreeTooLarge} rather than make one more.
|
|
88
|
+
* {@link TreeTooLarge} (`budget`) rather than make one more. A level GitHub answers truncated without recursion as well
|
|
89
|
+
* throws {@link TreeTooLarge} (`truncated`) at that answer, before any folder under it is asked for: the tree answer's
|
|
90
|
+
* `truncated` field can be set on any answer, and a part of the tree would leave out files that then read as removed.
|
|
91
|
+
*
|
|
92
|
+
* Name the repository by its id. A full name reads whatever repository holds that name when the tree is asked for: a
|
|
93
|
+
* renamed repository's old name can be taken again, and an account's old login claimed by another account, which ends
|
|
94
|
+
* GitHub's redirects to the repository; and GitHub answers a public repository's tree to any token, an installation
|
|
95
|
+
* token narrowed to other repositories included.
|
|
54
96
|
*
|
|
55
97
|
* @param fetchImpl The fetch the tree is read with.
|
|
56
98
|
* @param token An installation token that reads the repository.
|
|
57
|
-
* @param
|
|
99
|
+
* @param repository The repository's id, read at `/repositories/<id>`, or its full name, `owner/name`.
|
|
58
100
|
* @param commit The commit whose tree is read.
|
|
59
101
|
* @param apiBase GitHub's REST API, or a stand-in's address in tests.
|
|
60
102
|
* @param options The request budget, the folders skipped and an abort signal.
|
|
103
|
+
* @throws TypeError before any request when `repository` is a number that is not a positive integer.
|
|
61
104
|
*/
|
|
62
|
-
export async function readTree(fetchImpl, token,
|
|
105
|
+
export async function readTree(fetchImpl, token, repository, commit, apiBase = GITHUB_API_BASE, options = {}) {
|
|
106
|
+
const address = `${apiBase}/${repositoryPath(repository)}`;
|
|
63
107
|
const maxRequests = options.maxRequests ?? DEFAULT_MAX_TREE_REQUESTS;
|
|
64
108
|
const skip = new Set(options.skipFolders ?? []);
|
|
65
109
|
const blobs = [];
|
|
@@ -68,7 +112,7 @@ export async function readTree(fetchImpl, token, repo, commit, apiBase = GITHUB_
|
|
|
68
112
|
if (requests >= maxRequests)
|
|
69
113
|
throw new TreeTooLarge(maxRequests);
|
|
70
114
|
requests += 1;
|
|
71
|
-
const url = `${
|
|
115
|
+
const url = `${address}/git/trees/${encodeURIComponent(sha)}${recursive ? '?recursive=1' : ''}`;
|
|
72
116
|
const answer = objectOf(await githubFetch(fetchImpl, url, { token, signal: options.signal }), 'a tree');
|
|
73
117
|
return { truncated: answer.truncated === true, entries: arrayOf(answer.tree, 'a tree').map(entryOf) };
|
|
74
118
|
};
|
|
@@ -85,6 +129,9 @@ export async function readTree(fetchImpl, token, repo, commit, apiBase = GITHUB_
|
|
|
85
129
|
return;
|
|
86
130
|
}
|
|
87
131
|
const top = await read(sha, false);
|
|
132
|
+
// A level cut short read on would leave out the files past the cut, which would then read as removed.
|
|
133
|
+
if (top.truncated)
|
|
134
|
+
throw new TreeTooLarge(maxRequests, 'truncated');
|
|
88
135
|
for (const entry of top.entries) {
|
|
89
136
|
if (entry.type === 'tree') {
|
|
90
137
|
if (!skip.has(entry.path))
|
|
@@ -98,18 +145,31 @@ export async function readTree(fetchImpl, token, repo, commit, apiBase = GITHUB_
|
|
|
98
145
|
await walk(commit, '');
|
|
99
146
|
return blobs;
|
|
100
147
|
}
|
|
148
|
+
/** Blobs in path order. */
|
|
149
|
+
function byPath(a, b) {
|
|
150
|
+
return a.path < b.path ? -1 : a.path > b.path ? 1 : 0;
|
|
151
|
+
}
|
|
101
152
|
/**
|
|
102
|
-
* The filter that keeps a tree's documentation: the extensions kept,
|
|
103
|
-
* size cap, in path order
|
|
153
|
+
* The filter that keeps a tree's documentation: the extensions kept, and with `includeCode` the code extensions beside
|
|
154
|
+
* them; nothing under a skipped folder, nothing past the size cap, at most `maxFiles`, in path order. With code asked
|
|
155
|
+
* for, a code file a tool wrote is left out, whatever `extensions` names, and the documentation keeps its places under
|
|
156
|
+
* the cap first: the documentation paths first in path order, then the code paths in path order in the room left, so
|
|
157
|
+
* turning code on never drops a document a listing held.
|
|
104
158
|
*/
|
|
105
159
|
export function pathFilter(filter = {}) {
|
|
106
|
-
const
|
|
160
|
+
const documents = new Set((filter.extensions ?? DOCUMENT_EXTENSIONS).map((extension) => extension.toLowerCase()));
|
|
161
|
+
const code = new Set(filter.includeCode === true ? CODE_EXTENSIONS : []);
|
|
107
162
|
const skip = new Set(filter.skipFolders ?? SKIPPED_FOLDERS);
|
|
108
163
|
const maxFiles = filter.maxFiles ?? DEFAULT_MAX_FILES;
|
|
109
164
|
const maxFileBytes = filter.maxFileBytes ?? DEFAULT_MAX_FILE_BYTES;
|
|
110
|
-
return (blobs) =>
|
|
111
|
-
.filter((blob) =>
|
|
112
|
-
|
|
113
|
-
.
|
|
165
|
+
return (blobs) => {
|
|
166
|
+
const readable = blobs.filter((blob) => blob.size <= maxFileBytes && !inSkippedFolder(blob.path, skip));
|
|
167
|
+
// Code a tool wrote is left out once code is asked for, under any extension; the documentation's own come first.
|
|
168
|
+
const written = readable.filter((blob) => !(code.has(extensionOf(blob.path)) && isGeneratedCode(blob.path)));
|
|
169
|
+
const documentation = written.filter((blob) => documents.has(extensionOf(blob.path))).sort(byPath).slice(0, maxFiles);
|
|
170
|
+
const room = maxFiles - documentation.length;
|
|
171
|
+
const sources = written.filter((blob) => !documents.has(extensionOf(blob.path)) && code.has(extensionOf(blob.path))).sort(byPath);
|
|
172
|
+
return [...documentation, ...sources.slice(0, Math.max(room, 0))].sort(byPath);
|
|
173
|
+
};
|
|
114
174
|
}
|
|
115
175
|
//# sourceMappingURL=tree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.js","sourceRoot":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
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.6.0",
|
|
6
6
|
"description": "GitHub API tools: 26 tools for repos, issues, PRs, branches, commits, releases, Actions, files, gists, and codebase indexing. Its ./documents entry adds a GitHub App's installation mode (the app's JWT, installation tokens, the user's web flow, webhook deliveries checked and read as typed events, a daily reconcile, every call under a deadline with rate limit timing) and a connector that reads a repository's documentation as account sources.",
|
|
7
7
|
"categories": ["tool", "developer"],
|
|
8
8
|
"extensions": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@framers/agentos-ext-github",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "GitHub API tools for AgentOS — search repos/code, manage issues/PRs, read files, create gists",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@framers/agentos": ">=0.13.144",
|
|
41
|
-
"@framers/agentos-ext-account-sources": ">=0.
|
|
41
|
+
"@framers/agentos-ext-account-sources": ">=0.9.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^20.0.0",
|
|
45
45
|
"typescript": "^5.0.0",
|
|
46
46
|
"vitest": "^3.2.7",
|
|
47
|
-
"@framers/agentos": "^0.
|
|
48
|
-
"@framers/agentos-ext-account-sources": "^0.
|
|
47
|
+
"@framers/agentos": "^0.14.25",
|
|
48
|
+
"@framers/agentos-ext-account-sources": "^0.9.6"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
51
|
"node": ">=22"
|