@quatrain/code-github 1.1.1 → 1.1.3

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 ADDED
@@ -0,0 +1,21 @@
1
+ # @quatrain/code-github
2
+
3
+ GitHub API integration for Quatrain code management.
4
+
5
+ ## Purpose
6
+
7
+ This package is part of the Quatrain Core monorepo. It implements the `@quatrain/code` interfaces specifically for GitHub, allowing seamless interaction with GitHub repositories, PRs, and issues.
8
+
9
+ ## HOWTO / Usage Examples
10
+
11
+ ```typescript
12
+ import { GithubAdapter } from '@quatrain/code-github'
13
+
14
+ const github = new GithubAdapter({ token: 'ghp_...' })
15
+ ```
16
+
17
+ ## Conventions & Technical Details
18
+
19
+ - Follows the standard Quatrain architecture patterns.
20
+ - Ensure proper configuration before usage.
21
+ - See the root monorepo documentation for more details on building and testing this package.
@@ -1 +1 @@
1
- {"version":3,"file":"GithubAdapter.d.ts","sourceRoot":"","sources":["../src/GithubAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,qBAAa,aAAc,SAAQ,yBAAyB;IACzD,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC3B,SAAS,CAAC,MAAM,EAAE,MAAM,CAAA;IACxB,SAAS,CAAC,KAAK,EAAE,MAAM,CAAA;gBAEX,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAO/C,IAAI,CAAC,MAAM,GAAE,MAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAS5C,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAE,MAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IA8DlF,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,GAAE,MAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CAcpF"}
1
+ {"version":3,"file":"GithubAdapter.d.ts","sourceRoot":"","sources":["../src/GithubAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAKvC,qBAAa,aAAc,SAAQ,yBAAyB;IACzD,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC3B,SAAS,CAAC,MAAM,EAAE,MAAM,CAAA;IACxB,SAAS,CAAC,KAAK,EAAE,MAAM,CAAA;gBAEX,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAY/C,IAAI,CAAC,MAAM,GAAE,MAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB5C,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAE,MAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAoElF,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,GAAE,MAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CAcpF"}
@@ -1 +1 @@
1
- {"version":3,"file":"GithubAdapter.js","sourceRoot":"","sources":["../src/GithubAdapter.ts"],"names":[],"mappings":";;;AAAA,yCAAsE;AACtE,wCAAuC;AAEvC,MAAa,aAAc,SAAQ,gCAAyB;IAC/C,QAAQ,CAAS;IACjB,MAAM,CAAQ;IACd,KAAK,CAAQ;IAEvB,YAAY,IAAY,EAAE,KAAa,EAAE,IAAY;QAClD,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,QAAQ,GAAG,IAAI,cAAO,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;QACrC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;QACnB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;IACpB,CAAC;IAED,KAA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AAC,KAAK;YAChB,OAAO;YACP,IAAI,EAAE,QAAQ,CAAC,GAAG;YAClB,OAAO,EAAE,CAAC,SAAS,CAAC;SACtB,CAAC,CAAA;QAGF,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC;YAC/B,KAAK,EAAE,IAAI,CAAC,MAAM;YAClB,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,GAAG,EAAE,SAAS,MAAM,EAAE;YACtB,GAAG,EAAE,aAAa,CAAC,GAAG;SACxB,CAAC,CAAA;IACL,CAAC;IAQD,KAAK,CAAC,YAAY,CAAC,UAAkB,EAAE,aAAqB,MAAM;QAC/D,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC;YACtD,KAAK,EAAE,IAAI,CAAC,MAAM;YAClB,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,GAAG,EAAE,SAAS,UAAU,EAAE;SAC5B,CAAC,CAAA;QAEF,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC;YAC/B,KAAK,EAAE,IAAI,CAAC,MAAM;YAClB,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,GAAG,EAAE,cAAc,UAAU,EAAE;YAC/B,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG;SACzB,CAAC,CAAA;IACL,CAAC;CACH;AAnHD,sCAmHC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quatrain/code-github",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "license": "AGPL-3.0-only",
5
5
  "description": "GitHub repository adapter",
6
6
  "main": "dist/index.js",
@@ -21,8 +21,8 @@
21
21
  "author": "Quatrain Développement SAS <developers@quatrain.com>",
22
22
  "dependencies": {
23
23
  "@octokit/rest": "^20.0.2",
24
- "@quatrain/code": "^1.1.1",
25
- "@quatrain/core": "^1.1.52"
24
+ "@quatrain/code": "^1.1.3",
25
+ "@quatrain/core": "^1.2.5"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@tsconfig/recommended": "^1.0.1",
@@ -1,6 +1,9 @@
1
1
  import { AbstractRepositoryAdapter, CommitFile } from '@quatrain/code'
2
2
  import { Octokit } from '@octokit/rest'
3
3
 
4
+ /**
5
+ * Repository integration logic specifically adapting GitHub via the official Octokit SDK.
6
+ */
4
7
  export class GithubAdapter extends AbstractRepositoryAdapter {
5
8
  protected _octokit: Octokit
6
9
  protected _owner: string
@@ -13,6 +16,11 @@ export class GithubAdapter extends AbstractRepositoryAdapter {
13
16
  this._repo = repo
14
17
  }
15
18
 
19
+ /**
20
+ * Fetches the latest reference for a specific branch from GitHub.
21
+ *
22
+ * @param branch - The branch name to pull.
23
+ */
16
24
  async pull(branch: string = 'main'): Promise<void> {
17
25
  // In a real implementation, this would fetch latest refs
18
26
  // Since this adapter is primarily to push changes from Studio, pull might be a no-op or fetch ref.
@@ -22,6 +30,13 @@ export class GithubAdapter extends AbstractRepositoryAdapter {
22
30
  })
23
31
  }
24
32
 
33
+ /**
34
+ * Commits and pushes a set of files to a specified GitHub branch.
35
+ *
36
+ * @param files - List of files to commit.
37
+ * @param message - The commit message.
38
+ * @param branch - The target branch name.
39
+ */
25
40
  async push(files: CommitFile[], message: string, branch: string = 'main'): Promise<void> {
26
41
  // 1. Get latest commit SHA for branch
27
42
  const { data: refData } = await this._octokit.git.getRef({
@@ -84,6 +99,12 @@ export class GithubAdapter extends AbstractRepositoryAdapter {
84
99
  })
85
100
  }
86
101
 
102
+ /**
103
+ * Creates a new branch via the GitHub API based on an existing branch's latest commit.
104
+ *
105
+ * @param branchName - The new branch name.
106
+ * @param fromBranch - The source branch name.
107
+ */
87
108
  async createBranch(branchName: string, fromBranch: string = 'main'): Promise<void> {
88
109
  const { data: refData } = await this._octokit.git.getRef({
89
110
  owner: this._owner,