@ankhorage/repository 0.4.18 → 0.5.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +143 -0
  2. package/README.md +16 -27
  3. package/dist/cli/commands/materialize/definitions/MaterializeCommandOptions.d.ts +6 -0
  4. package/dist/cli/commands/materialize/definitions/MaterializeCommandOptions.d.ts.map +1 -0
  5. package/dist/cli/commands/materialize/definitions/MaterializeCommandOptions.js +2 -0
  6. package/dist/cli/commands/materialize/definitions/MaterializeCommandOptions.js.map +1 -0
  7. package/dist/cli/commands/materialize/parseMaterializeCommandOptions.d.ts +4 -0
  8. package/dist/cli/commands/materialize/parseMaterializeCommandOptions.d.ts.map +1 -0
  9. package/dist/cli/commands/materialize/parseMaterializeCommandOptions.js +33 -0
  10. package/dist/cli/commands/materialize/parseMaterializeCommandOptions.js.map +1 -0
  11. package/dist/cli/commands/materialize/parseMaterializeCommandOptions.test.d.ts +2 -0
  12. package/dist/cli/commands/materialize/parseMaterializeCommandOptions.test.d.ts.map +1 -0
  13. package/dist/cli/commands/materialize/parseMaterializeCommandOptions.test.js +23 -0
  14. package/dist/cli/commands/materialize/parseMaterializeCommandOptions.test.js.map +1 -0
  15. package/dist/cli/commands/materialize/runMaterializeCommandAsync.d.ts +10 -0
  16. package/dist/cli/commands/materialize/runMaterializeCommandAsync.d.ts.map +1 -0
  17. package/dist/cli/commands/materialize/runMaterializeCommandAsync.js +28 -0
  18. package/dist/cli/commands/materialize/runMaterializeCommandAsync.js.map +1 -0
  19. package/dist/cli/provider/createRepositoryRuntimeProvider.d.ts +14 -2
  20. package/dist/cli/provider/createRepositoryRuntimeProvider.d.ts.map +1 -1
  21. package/dist/cli/provider/createRepositoryRuntimeProvider.js +7 -9
  22. package/dist/cli/provider/createRepositoryRuntimeProvider.js.map +1 -1
  23. package/dist/cli/provider/createRepositoryRuntimeProvider.test.js +6 -2
  24. package/dist/cli/provider/createRepositoryRuntimeProvider.test.js.map +1 -1
  25. package/dist/github/index.d.ts +3 -0
  26. package/dist/github/index.d.ts.map +1 -1
  27. package/dist/github/index.js +1 -0
  28. package/dist/github/index.js.map +1 -1
  29. package/dist/metadata/index.d.ts +1 -1
  30. package/dist/metadata/index.js +1 -1
  31. package/dist/metadata/index.js.map +1 -1
  32. package/dist/metadata/repositoryPackageMetadata.d.ts +6 -1
  33. package/dist/metadata/repositoryPackageMetadata.d.ts.map +1 -1
  34. package/dist/metadata/repositoryPackageMetadata.js +6 -1
  35. package/dist/metadata/repositoryPackageMetadata.js.map +1 -1
  36. package/dist/providers/github/adapters/createGitHubHttpRepositoryReadGateway.d.ts +4 -0
  37. package/dist/providers/github/adapters/createGitHubHttpRepositoryReadGateway.d.ts.map +1 -0
  38. package/dist/providers/github/adapters/createGitHubHttpRepositoryReadGateway.js +115 -0
  39. package/dist/providers/github/adapters/createGitHubHttpRepositoryReadGateway.js.map +1 -0
  40. package/dist/providers/github/adapters/createGitHubHttpRepositoryReadGateway.test.d.ts +2 -0
  41. package/dist/providers/github/adapters/createGitHubHttpRepositoryReadGateway.test.d.ts.map +1 -0
  42. package/dist/providers/github/adapters/createGitHubHttpRepositoryReadGateway.test.js +80 -0
  43. package/dist/providers/github/adapters/createGitHubHttpRepositoryReadGateway.test.js.map +1 -0
  44. package/dist/providers/github/definitions/GitHubRepositoryConnectionOptions.d.ts +0 -8
  45. package/dist/providers/github/definitions/GitHubRepositoryConnectionOptions.d.ts.map +1 -1
  46. package/dist/providers/github/definitions/GitHubRepositoryMaterializationOptions.d.ts +6 -0
  47. package/dist/providers/github/definitions/GitHubRepositoryMaterializationOptions.d.ts.map +1 -0
  48. package/dist/providers/github/definitions/GitHubRepositoryMaterializationOptions.js +2 -0
  49. package/dist/providers/github/definitions/GitHubRepositoryMaterializationOptions.js.map +1 -0
  50. package/dist/providers/github/definitions/GitHubRepositoryMaterializationResult.d.ts +12 -0
  51. package/dist/providers/github/definitions/GitHubRepositoryMaterializationResult.d.ts.map +1 -0
  52. package/dist/providers/github/definitions/GitHubRepositoryMaterializationResult.js +2 -0
  53. package/dist/providers/github/definitions/GitHubRepositoryMaterializationResult.js.map +1 -0
  54. package/dist/providers/github/ports/GitHubRepositoryReadGateway.d.ts +31 -0
  55. package/dist/providers/github/ports/GitHubRepositoryReadGateway.d.ts.map +1 -0
  56. package/dist/providers/github/ports/GitHubRepositoryReadGateway.js +2 -0
  57. package/dist/providers/github/ports/GitHubRepositoryReadGateway.js.map +1 -0
  58. package/dist/providers/github/services/connectGitHubRepositoryAsync.d.ts +10 -1
  59. package/dist/providers/github/services/connectGitHubRepositoryAsync.d.ts.map +1 -1
  60. package/dist/providers/github/services/connectGitHubRepositoryAsync.js.map +1 -1
  61. package/dist/providers/github/services/connectGitHubRepositoryAsync.test.js.map +1 -1
  62. package/dist/providers/github/services/materializeGitHubRepositoryAsync.d.ts +5 -0
  63. package/dist/providers/github/services/materializeGitHubRepositoryAsync.d.ts.map +1 -0
  64. package/dist/providers/github/services/materializeGitHubRepositoryAsync.js +7 -0
  65. package/dist/providers/github/services/materializeGitHubRepositoryAsync.js.map +1 -0
  66. package/dist/providers/github/services/materializeGitHubRepositoryWithGatewayAsync.d.ts +6 -0
  67. package/dist/providers/github/services/materializeGitHubRepositoryWithGatewayAsync.d.ts.map +1 -0
  68. package/dist/providers/github/services/materializeGitHubRepositoryWithGatewayAsync.js +156 -0
  69. package/dist/providers/github/services/materializeGitHubRepositoryWithGatewayAsync.js.map +1 -0
  70. package/dist/providers/github/services/materializeGitHubRepositoryWithGatewayAsync.test.d.ts +2 -0
  71. package/dist/providers/github/services/materializeGitHubRepositoryWithGatewayAsync.test.d.ts.map +1 -0
  72. package/dist/providers/github/services/materializeGitHubRepositoryWithGatewayAsync.test.js +116 -0
  73. package/dist/providers/github/services/materializeGitHubRepositoryWithGatewayAsync.test.js.map +1 -0
  74. package/package.json +9 -8
  75. package/dist/readme-usage.d.ts +0 -2
  76. package/dist/readme-usage.d.ts.map +0 -1
  77. package/dist/readme-usage.js +0 -32
  78. package/dist/readme-usage.js.map +0 -1
@@ -0,0 +1,116 @@
1
+ import { access, readFile } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import { expect, test } from 'bun:test';
4
+ import { materializeGitHubRepositoryWithGatewayAsync } from './materializeGitHubRepositoryWithGatewayAsync.js';
5
+ test('materializes an exact GitHub revision and cleans up the isolated root', async () => {
6
+ const requestedRefs = [];
7
+ const gateway = createGateway({
8
+ requestedRefs,
9
+ files: {
10
+ 'package.json': '{"name":"demo"}\n',
11
+ 'src/index.ts': 'export const demo = true;\n',
12
+ },
13
+ });
14
+ const result = await materializeGitHubRepositoryWithGatewayAsync({ url: 'https://github.com/ankhorage/demo', ref: 'feature/read' }, gateway);
15
+ expect(requestedRefs).toEqual(['feature/read']);
16
+ expect(result.revision).toBe('commit-sha');
17
+ expect(result.repository).toEqual({
18
+ owner: 'ankhorage',
19
+ name: 'demo',
20
+ url: 'https://github.com/ankhorage/demo',
21
+ defaultBranch: 'main',
22
+ });
23
+ expect(await readFile(join(result.rootPath, 'src/index.ts'), 'utf8')).toBe('export const demo = true;\n');
24
+ await result.cleanupAsync();
25
+ await expectMissingPathAsync(result.rootPath);
26
+ });
27
+ test('uses the remote default branch when no ref is supplied', async () => {
28
+ const requestedRefs = [];
29
+ const result = await materializeGitHubRepositoryWithGatewayAsync({ url: 'https://github.com/ankhorage/demo.git' }, createGateway({ requestedRefs, defaultBranch: 'develop', files: {} }));
30
+ expect(requestedRefs).toEqual(['develop']);
31
+ await result.cleanupAsync();
32
+ });
33
+ test('rejects traversal before downloading an unsafe repository file', async () => {
34
+ let reads = 0;
35
+ const gateway = createGateway({
36
+ files: { '../escape.ts': 'escape' },
37
+ onRead: () => {
38
+ reads += 1;
39
+ },
40
+ });
41
+ await expectFailureAsync(() => materializeGitHubRepositoryWithGatewayAsync({ url: 'https://github.com/ankhorage/demo' }, gateway), 'Unsafe GitHub repository path');
42
+ expect(reads).toBe(0);
43
+ });
44
+ test('rejects truncated GitHub trees before materialization', async () => {
45
+ const gateway = createGateway({ files: {}, truncated: true });
46
+ await expectFailureAsync(() => materializeGitHubRepositoryWithGatewayAsync({ url: 'https://github.com/ankhorage/demo' }, gateway), 'repository tree is truncated');
47
+ });
48
+ test('rejects unsafe symbolic links rather than following provider paths', async () => {
49
+ const gateway = {
50
+ ...createGateway({ files: {} }),
51
+ readTreeAsync: () => Promise.resolve({
52
+ truncated: false,
53
+ entries: [
54
+ {
55
+ mode: '120000',
56
+ path: 'outside',
57
+ sha: 'link-sha',
58
+ size: 10,
59
+ type: 'blob',
60
+ },
61
+ ],
62
+ }),
63
+ };
64
+ await expectFailureAsync(() => materializeGitHubRepositoryWithGatewayAsync({ url: 'https://github.com/ankhorage/demo' }, gateway), 'symbolic links are not supported');
65
+ });
66
+ function createGateway(options) {
67
+ const files = new Map(Object.entries(options.files));
68
+ const entries = [...files].map(([path, fileContent], index) => ({
69
+ mode: '100644',
70
+ path,
71
+ sha: `blob-${index}`,
72
+ size: Buffer.byteLength(fileContent),
73
+ type: 'blob',
74
+ }));
75
+ return {
76
+ inspectRepositoryAsync: (target) => Promise.resolve({
77
+ defaultBranch: options.defaultBranch ?? 'main',
78
+ url: target.url,
79
+ }),
80
+ resolveRevisionAsync: (_target, ref) => {
81
+ options.requestedRefs?.push(ref);
82
+ return Promise.resolve({ commitSha: 'commit-sha', treeSha: 'tree-sha' });
83
+ },
84
+ readTreeAsync: () => Promise.resolve({
85
+ entries,
86
+ truncated: options.truncated ?? false,
87
+ }),
88
+ readFileAsync: (_target, _revision, path) => {
89
+ options.onRead?.();
90
+ const fileContent = files.get(path);
91
+ if (fileContent === undefined)
92
+ throw new Error(`Missing fixture: ${path}`);
93
+ return Promise.resolve(Buffer.from(fileContent));
94
+ },
95
+ };
96
+ }
97
+ async function expectFailureAsync(operation, message) {
98
+ try {
99
+ await operation();
100
+ throw new Error('Expected operation to fail.');
101
+ }
102
+ catch (error) {
103
+ expect(error).toBeInstanceOf(Error);
104
+ expect(error.message).toContain(message);
105
+ }
106
+ }
107
+ async function expectMissingPathAsync(path) {
108
+ try {
109
+ await access(path);
110
+ throw new Error('Expected path to be missing.');
111
+ }
112
+ catch (error) {
113
+ expect(error).toBeInstanceOf(Error);
114
+ }
115
+ }
116
+ //# sourceMappingURL=materializeGitHubRepositoryWithGatewayAsync.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"materializeGitHubRepositoryWithGatewayAsync.test.js","sourceRoot":"","sources":["../../../../src/providers/github/services/materializeGitHubRepositoryWithGatewayAsync.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGxC,OAAO,EAAE,2CAA2C,EAAE,MAAM,kDAAkD,CAAC;AAE/G,IAAI,CAAC,uEAAuE,EAAE,KAAK,IAAI,EAAE;IACvF,MAAM,aAAa,GAAa,EAAE,CAAC;IACnC,MAAM,OAAO,GAAG,aAAa,CAAC;QAC5B,aAAa;QACb,KAAK,EAAE;YACL,cAAc,EAAE,mBAAmB;YACnC,cAAc,EAAE,6BAA6B;SAC9C;KACF,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,2CAA2C,CAC9D,EAAE,GAAG,EAAE,mCAAmC,EAAE,GAAG,EAAE,cAAc,EAAE,EACjE,OAAO,CACR,CAAC;IAEF,MAAM,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC;IAChD,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC3C,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;QAChC,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,MAAM;QACZ,GA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AC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QACpC,MAAM,CAAE,KAAe,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;AACH,CAAC;AAED,KAAK,UAAU,sBAAsB,CAAC,IAAY;IAChD,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankhorage/repository",
3
- "version": "0.4.18",
3
+ "version": "0.5.0",
4
4
  "description": "Standalone repository capability for connecting and managing an app project's source repository.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -54,7 +54,8 @@
54
54
  "category": "repository",
55
55
  "provider": "./dist/cli/index.js",
56
56
  "capabilities": [
57
- "repository.connect"
57
+ "repository.connect",
58
+ "repository.materialize"
58
59
  ]
59
60
  },
60
61
  "publishConfig": {
@@ -75,15 +76,15 @@
75
76
  "knip:check": "ankhorage-knip"
76
77
  },
77
78
  "devDependencies": {
78
- "@ankhorage/devtools": "^1.18.5",
79
- "@ankhorage/paradox": "^0.1.26",
80
- "@types/bun": "^1.4.1",
81
- "@types/node": "^24.13.3",
79
+ "@ankhorage/devtools": "^2.1.6",
80
+ "@ankhorage/paradox": "^0.2.27",
81
+ "@types/bun": "^1.4.2",
82
+ "@types/node": "^26.6.4",
82
83
  "typescript": "~6.0.3"
83
84
  },
84
85
  "packageManager": "bun@1.4.2",
85
86
  "dependencies": {
86
- "@ankhorage/contracts": "^22.8.1",
87
- "ignore": "^7.0.8"
87
+ "@ankhorage/contracts": "^22.8.99",
88
+ "ignore": "^7.0.12"
88
89
  }
89
90
  }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=readme-usage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"readme-usage.d.ts","sourceRoot":"","sources":["../src/readme-usage.ts"],"names":[],"mappings":""}
@@ -1,32 +0,0 @@
1
- /***
2
- * Connect a project folder to its source repository
3
- *
4
- * `@ankhorage/repository` consumes only the project's `RepositoryManifest` slice and delegates
5
- * GitHub operations to the local authenticated `gh` adapter. It creates a missing repository,
6
- * publishes the project snapshot to `main`, stores only the repository slice in
7
- * `.ankhorage/repository.json`, and refuses unrelated existing repositories.
8
- *
9
- * See [`examples/basic-usage.ts`](../examples/basic-usage.ts) for a complete programmatic example.
10
- *
11
- * @usage
12
- */
13
- import { connectRepositoryAsync } from '@ankhorage/repository';
14
- const result = await connectRepositoryAsync({
15
- projectPath: './my-project',
16
- repository: {
17
- provider: 'github',
18
- owner: 'ankhorage',
19
- name: 'my-project',
20
- url: 'https://github.com/ankhorage/my-project',
21
- defaultBranch: 'main',
22
- },
23
- visibility: 'private',
24
- });
25
- if (result.status === 'conflict' || result.status === 'recoverable-failure') {
26
- console.error(`${result.status}: ${result.message}`);
27
- process.exitCode = 1;
28
- }
29
- else {
30
- console.log(JSON.stringify(result));
31
- }
32
- //# sourceMappingURL=readme-usage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"readme-usage.js","sourceRoot":"","sources":["../src/readme-usage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,MAAM,GAAG,MAAM,sBAAsB,CAAC;IAC1C,WAAW,EAAE,cAAc;IAC3B,UAAU,EAAE;QACV,QAAQ,EAAE,QAAQ;QAClB,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,YAAY;QAClB,GAAG,EAAE,yCAAyC;QAC9C,aAAa,EAAE,MAAM;KACtB;IACD,UAAU,EAAE,SAAS;CACtB,CAAC,CAAC;AAEH,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU,IAAI,MAAM,CAAC,MAAM,KAAK,qBAAqB,EAAE,CAAC;IAC5E,OAAO,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IACrD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC;KAAM,CAAC;IACN,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;AACtC,CAAC"}