@ankhorage/repository 0.4.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/CHANGELOG.md +43 -0
- package/LICENSE +21 -0
- package/README.md +53 -0
- package/dist/cli/commands/connect/definitions/ConnectCommandOptions.d.ts +8 -0
- package/dist/cli/commands/connect/definitions/ConnectCommandOptions.d.ts.map +1 -0
- package/dist/cli/commands/connect/definitions/ConnectCommandOptions.js +2 -0
- package/dist/cli/commands/connect/definitions/ConnectCommandOptions.js.map +1 -0
- package/dist/cli/commands/connect/parseConnectCommandOptions.d.ts +4 -0
- package/dist/cli/commands/connect/parseConnectCommandOptions.d.ts.map +1 -0
- package/dist/cli/commands/connect/parseConnectCommandOptions.js +38 -0
- package/dist/cli/commands/connect/parseConnectCommandOptions.js.map +1 -0
- package/dist/cli/commands/connect/runConnectCommandAsync.d.ts +10 -0
- package/dist/cli/commands/connect/runConnectCommandAsync.d.ts.map +1 -0
- package/dist/cli/commands/connect/runConnectCommandAsync.js +29 -0
- package/dist/cli/commands/connect/runConnectCommandAsync.js.map +1 -0
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +5 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/provider/createRepositoryRuntimeProvider.d.ts +25 -0
- package/dist/cli/provider/createRepositoryRuntimeProvider.d.ts.map +1 -0
- package/dist/cli/provider/createRepositoryRuntimeProvider.js +20 -0
- package/dist/cli/provider/createRepositoryRuntimeProvider.js.map +1 -0
- package/dist/cli/provider/createRepositoryRuntimeProvider.test.d.ts +2 -0
- package/dist/cli/provider/createRepositoryRuntimeProvider.test.d.ts.map +1 -0
- package/dist/cli/provider/createRepositoryRuntimeProvider.test.js +12 -0
- package/dist/cli/provider/createRepositoryRuntimeProvider.test.js.map +1 -0
- package/dist/connection/adapters/createLocalProjectSnapshotReader.d.ts +4 -0
- package/dist/connection/adapters/createLocalProjectSnapshotReader.d.ts.map +1 -0
- package/dist/connection/adapters/createLocalProjectSnapshotReader.js +123 -0
- package/dist/connection/adapters/createLocalProjectSnapshotReader.js.map +1 -0
- package/dist/connection/adapters/createLocalRepositoryManifestStore.d.ts +4 -0
- package/dist/connection/adapters/createLocalRepositoryManifestStore.d.ts.map +1 -0
- package/dist/connection/adapters/createLocalRepositoryManifestStore.js +75 -0
- package/dist/connection/adapters/createLocalRepositoryManifestStore.js.map +1 -0
- package/dist/connection/adapters/createLocalRepositoryManifestStore.test.d.ts +2 -0
- package/dist/connection/adapters/createLocalRepositoryManifestStore.test.d.ts.map +1 -0
- package/dist/connection/adapters/createLocalRepositoryManifestStore.test.js +25 -0
- package/dist/connection/adapters/createLocalRepositoryManifestStore.test.js.map +1 -0
- package/dist/connection/definitions/ProjectSnapshot.d.ts +8 -0
- package/dist/connection/definitions/ProjectSnapshot.d.ts.map +1 -0
- package/dist/connection/definitions/ProjectSnapshot.js +2 -0
- package/dist/connection/definitions/ProjectSnapshot.js.map +1 -0
- package/dist/connection/definitions/ProjectSnapshotEntry.d.ts +10 -0
- package/dist/connection/definitions/ProjectSnapshotEntry.d.ts.map +1 -0
- package/dist/connection/definitions/ProjectSnapshotEntry.js +2 -0
- package/dist/connection/definitions/ProjectSnapshotEntry.js.map +1 -0
- package/dist/connection/definitions/RepositoryConnectionOptions.d.ts +8 -0
- package/dist/connection/definitions/RepositoryConnectionOptions.d.ts.map +1 -0
- package/dist/connection/definitions/RepositoryConnectionOptions.js +2 -0
- package/dist/connection/definitions/RepositoryConnectionOptions.js.map +1 -0
- package/dist/connection/definitions/RepositoryConnectionResult.d.ts +17 -0
- package/dist/connection/definitions/RepositoryConnectionResult.d.ts.map +1 -0
- package/dist/connection/definitions/RepositoryConnectionResult.js +2 -0
- package/dist/connection/definitions/RepositoryConnectionResult.js.map +1 -0
- package/dist/connection/ports/ProjectSnapshotReader.d.ts +6 -0
- package/dist/connection/ports/ProjectSnapshotReader.d.ts.map +1 -0
- package/dist/connection/ports/ProjectSnapshotReader.js +2 -0
- package/dist/connection/ports/ProjectSnapshotReader.js.map +1 -0
- package/dist/connection/ports/RepositoryManifestStore.d.ts +6 -0
- package/dist/connection/ports/RepositoryManifestStore.d.ts.map +1 -0
- package/dist/connection/ports/RepositoryManifestStore.js +2 -0
- package/dist/connection/ports/RepositoryManifestStore.js.map +1 -0
- package/dist/connection/services/connectRepositoryAsync.d.ts +5 -0
- package/dist/connection/services/connectRepositoryAsync.d.ts.map +1 -0
- package/dist/connection/services/connectRepositoryAsync.js +55 -0
- package/dist/connection/services/connectRepositoryAsync.js.map +1 -0
- package/dist/connection/services/connectRepositoryAsync.test.d.ts +2 -0
- package/dist/connection/services/connectRepositoryAsync.test.d.ts.map +1 -0
- package/dist/connection/services/connectRepositoryAsync.test.js +27 -0
- package/dist/connection/services/connectRepositoryAsync.test.js.map +1 -0
- package/dist/connection/utils/getProjectSnapshotPaths.d.ts +5 -0
- package/dist/connection/utils/getProjectSnapshotPaths.d.ts.map +1 -0
- package/dist/connection/utils/getProjectSnapshotPaths.js +5 -0
- package/dist/connection/utils/getProjectSnapshotPaths.js.map +1 -0
- package/dist/github/index.d.ts +5 -0
- package/dist/github/index.d.ts.map +1 -0
- package/dist/github/index.js +2 -0
- package/dist/github/index.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.test.d.ts +2 -0
- package/dist/index.test.d.ts.map +1 -0
- package/dist/index.test.js +35 -0
- package/dist/index.test.js.map +1 -0
- package/dist/metadata/index.d.ts +12 -0
- package/dist/metadata/index.d.ts.map +1 -0
- package/dist/metadata/index.js +12 -0
- package/dist/metadata/index.js.map +1 -0
- package/dist/metadata/repositoryPackageMetadata.d.ts +13 -0
- package/dist/metadata/repositoryPackageMetadata.d.ts.map +1 -0
- package/dist/metadata/repositoryPackageMetadata.js +14 -0
- package/dist/metadata/repositoryPackageMetadata.js.map +1 -0
- package/dist/providers/github/adapters/createGhCliRepositoryGateway.d.ts +13 -0
- package/dist/providers/github/adapters/createGhCliRepositoryGateway.d.ts.map +1 -0
- package/dist/providers/github/adapters/createGhCliRepositoryGateway.js +228 -0
- package/dist/providers/github/adapters/createGhCliRepositoryGateway.js.map +1 -0
- package/dist/providers/github/adapters/ghCliJson.d.ts +22 -0
- package/dist/providers/github/adapters/ghCliJson.d.ts.map +1 -0
- package/dist/providers/github/adapters/ghCliJson.js +44 -0
- package/dist/providers/github/adapters/ghCliJson.js.map +1 -0
- package/dist/providers/github/definitions/GitHubRepositoryConnectionOptions.d.ts +16 -0
- package/dist/providers/github/definitions/GitHubRepositoryConnectionOptions.d.ts.map +1 -0
- package/dist/providers/github/definitions/GitHubRepositoryConnectionOptions.js +2 -0
- package/dist/providers/github/definitions/GitHubRepositoryConnectionOptions.js.map +1 -0
- package/dist/providers/github/definitions/GitHubRepositoryConnectionResult.d.ts +23 -0
- package/dist/providers/github/definitions/GitHubRepositoryConnectionResult.d.ts.map +1 -0
- package/dist/providers/github/definitions/GitHubRepositoryConnectionResult.js +2 -0
- package/dist/providers/github/definitions/GitHubRepositoryConnectionResult.js.map +1 -0
- package/dist/providers/github/definitions/GitHubRepositoryVisibility.d.ts +2 -0
- package/dist/providers/github/definitions/GitHubRepositoryVisibility.d.ts.map +1 -0
- package/dist/providers/github/definitions/GitHubRepositoryVisibility.js +2 -0
- package/dist/providers/github/definitions/GitHubRepositoryVisibility.js.map +1 -0
- package/dist/providers/github/definitions/index.d.ts +3 -0
- package/dist/providers/github/definitions/index.d.ts.map +1 -0
- package/dist/providers/github/definitions/index.js +2 -0
- package/dist/providers/github/definitions/index.js.map +1 -0
- package/dist/providers/github/ports/GitHubRepositoryGateway.d.ts +42 -0
- package/dist/providers/github/ports/GitHubRepositoryGateway.d.ts.map +1 -0
- package/dist/providers/github/ports/GitHubRepositoryGateway.js +2 -0
- package/dist/providers/github/ports/GitHubRepositoryGateway.js.map +1 -0
- package/dist/providers/github/services/connectGitHubRepositoryAsync.d.ts +5 -0
- package/dist/providers/github/services/connectGitHubRepositoryAsync.d.ts.map +1 -0
- package/dist/providers/github/services/connectGitHubRepositoryAsync.js +70 -0
- package/dist/providers/github/services/connectGitHubRepositoryAsync.js.map +1 -0
- package/dist/providers/github/services/inspectGitHubRepositoryPreflightAsync.d.ts +21 -0
- package/dist/providers/github/services/inspectGitHubRepositoryPreflightAsync.d.ts.map +1 -0
- package/dist/providers/github/services/inspectGitHubRepositoryPreflightAsync.js +72 -0
- package/dist/providers/github/services/inspectGitHubRepositoryPreflightAsync.js.map +1 -0
- package/dist/providers/github/services/publishGitHubProjectSnapshotAsync.d.ts +8 -0
- package/dist/providers/github/services/publishGitHubProjectSnapshotAsync.d.ts.map +1 -0
- package/dist/providers/github/services/publishGitHubProjectSnapshotAsync.js +12 -0
- package/dist/providers/github/services/publishGitHubProjectSnapshotAsync.js.map +1 -0
- package/dist/readme-usage.d.ts +2 -0
- package/dist/readme-usage.d.ts.map +1 -0
- package/dist/readme-usage.js +32 -0
- package/dist/readme-usage.js.map +1 -0
- package/package.json +89 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @ankhorage/repository
|
|
2
|
+
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b156251: Rename the standalone capability from `@ankhorage/gh` to `@ankhorage/repository`, consume the focused `RepositoryManifest` slice, persist it at `.ankhorage/repository.json`, expose a provider-neutral connection API and `repository.connect` capability with package-derived version metadata, and isolate GitHub-specific implementation under `providers/github` and the `./github` provider subpath.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- a9bf4e7: Update documentation
|
|
12
|
+
|
|
13
|
+
## 0.3.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- f548067: Correct the generated usage documentation to import the public package entrypoint.
|
|
18
|
+
|
|
19
|
+
## 0.3.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- 554bdf3: Make GitHub connection configuration standalone by using the shared `RepositoryConfig` contract in `.ankhorage/gh.json` instead of requiring a complete `ankh.config.json`.
|
|
24
|
+
|
|
25
|
+
## 0.2.1
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- f246d47: Add a root usage example and Paradox-generated usage documentation.
|
|
30
|
+
|
|
31
|
+
## 0.2.0
|
|
32
|
+
|
|
33
|
+
### Minor Changes
|
|
34
|
+
|
|
35
|
+
- e4df77f: Add the gh-only GitHub repository connection API and `ankh gh connect` provider.
|
|
36
|
+
|
|
37
|
+
## 0.1.0
|
|
38
|
+
|
|
39
|
+
### Minor Changes
|
|
40
|
+
|
|
41
|
+
- 3b2e65c: Establish the standalone GitHub integration package boundary and canonical Ankhorage tooling.
|
|
42
|
+
|
|
43
|
+
All notable changes to this package will be documented in this file by Changesets.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ankhorage
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<!-- markdownlint-disable MD013 MD033 -->
|
|
2
|
+
<!-- This file is generated by Paradox. Do not edit manually. -->
|
|
3
|
+
|
|
4
|
+
# @ankhorage/repository
|
|
5
|
+
|
|
6
|
+
        
|
|
7
|
+
|
|
8
|
+
Standalone repository capability for connecting and managing an app project's source repository.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
### Connect a project folder to its source repository
|
|
13
|
+
|
|
14
|
+
`@ankhorage/repository` consumes only the project's `RepositoryManifest` slice and delegates
|
|
15
|
+
GitHub operations to the local authenticated `gh` adapter. It creates a missing repository,
|
|
16
|
+
publishes the project snapshot to `main`, stores only the repository slice in
|
|
17
|
+
`.ankhorage/repository.json`, and refuses unrelated existing repositories.
|
|
18
|
+
|
|
19
|
+
See [`examples/basic-usage.ts`](../examples/basic-usage.ts) for a complete programmatic example.
|
|
20
|
+
|
|
21
|
+
Source: `src/readme-usage.ts`
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { connectRepositoryAsync } from '@ankhorage/repository';
|
|
25
|
+
|
|
26
|
+
const result = await connectRepositoryAsync({
|
|
27
|
+
projectPath: './my-project',
|
|
28
|
+
repository: {
|
|
29
|
+
provider: 'github',
|
|
30
|
+
owner: 'ankhorage',
|
|
31
|
+
name: 'my-project',
|
|
32
|
+
url: 'https://github.com/ankhorage/my-project',
|
|
33
|
+
defaultBranch: 'main',
|
|
34
|
+
},
|
|
35
|
+
visibility: 'private',
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
if (result.status === 'conflict' || result.status === 'recoverable-failure') {
|
|
39
|
+
console.error(`${result.status}: ${result.message}`);
|
|
40
|
+
process.exitCode = 1;
|
|
41
|
+
} else {
|
|
42
|
+
console.log(JSON.stringify(result));
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Generated documentation
|
|
47
|
+
|
|
48
|
+
- [Interactive documentation app](./paradox/index.html)
|
|
49
|
+
- [Public API reference](./paradox/exports.md)
|
|
50
|
+
- [Component registry](./paradox/components.md)
|
|
51
|
+
- [Architecture overview](./paradox/diagrams/architecture-overview.mmd)
|
|
52
|
+
- [Module relationships](./paradox/diagrams/module-relationships.mmd)
|
|
53
|
+
- [Export graph](./paradox/diagrams/export-graph.mmd)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { GitHubRepositoryVisibility } from '../../../../providers/github/definitions/GitHubRepositoryVisibility.js';
|
|
2
|
+
export interface ConnectCommandOptions {
|
|
3
|
+
readonly projectPath?: string;
|
|
4
|
+
readonly owner?: string;
|
|
5
|
+
readonly name?: string;
|
|
6
|
+
readonly visibility: GitHubRepositoryVisibility;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=ConnectCommandOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectCommandOptions.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/connect/definitions/ConnectCommandOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wEAAwE,CAAC;AAEzH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,0BAA0B,CAAC;CACjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectCommandOptions.js","sourceRoot":"","sources":["../../../../../src/cli/commands/connect/definitions/ConnectCommandOptions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ConnectCommandOptions } from './definitions/ConnectCommandOptions.js';
|
|
2
|
+
/*** Parse the deterministic `ankh repository connect` positional argument and flags. */
|
|
3
|
+
export declare function parseConnectCommandOptions(argv: readonly string[]): ConnectCommandOptions;
|
|
4
|
+
//# sourceMappingURL=parseConnectCommandOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseConnectCommandOptions.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/connect/parseConnectCommandOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAEpF,wFAAwF;AACxF,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,qBAAqB,CA4BzF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*** Parse the deterministic `ankh repository connect` positional argument and flags. */
|
|
2
|
+
export function parseConnectCommandOptions(argv) {
|
|
3
|
+
let projectPath;
|
|
4
|
+
let owner;
|
|
5
|
+
let name;
|
|
6
|
+
let visibility = 'private';
|
|
7
|
+
let visibilityFlag = false;
|
|
8
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
9
|
+
const [argument] = argv.slice(index);
|
|
10
|
+
if (argument === undefined)
|
|
11
|
+
continue;
|
|
12
|
+
if (argument === '--public' || argument === '--private') {
|
|
13
|
+
if (visibilityFlag)
|
|
14
|
+
throw new Error('--public and --private are mutually exclusive.');
|
|
15
|
+
visibilityFlag = true;
|
|
16
|
+
visibility = argument.slice(2);
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
if (argument === '--owner' || argument === '--name') {
|
|
20
|
+
const [value] = argv.slice(index + 1);
|
|
21
|
+
if (!value || value.startsWith('--'))
|
|
22
|
+
throw new Error(`${argument} requires a value.`);
|
|
23
|
+
index += 1;
|
|
24
|
+
if (argument === '--owner')
|
|
25
|
+
owner = value;
|
|
26
|
+
else
|
|
27
|
+
name = value;
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (argument.startsWith('--'))
|
|
31
|
+
throw new Error(`Unknown option: ${argument}`);
|
|
32
|
+
if (projectPath)
|
|
33
|
+
throw new Error('Only one project path may be provided.');
|
|
34
|
+
projectPath = argument;
|
|
35
|
+
}
|
|
36
|
+
return { projectPath, owner, name, visibility };
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=parseConnectCommandOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseConnectCommandOptions.js","sourceRoot":"","sources":["../../../../src/cli/commands/connect/parseConnectCommandOptions.ts"],"names":[],"mappings":"AAEA,wFAAwF;AACxF,MAAM,UAAU,0BAA0B,CAAC,IAAuB;IAChE,IAAI,WAA+B,CAAC;IACpC,IAAI,KAAyB,CAAC;IAC9B,IAAI,IAAwB,CAAC;IAC7B,IAAI,UAAU,GAAwC,SAAS,CAAC;IAChE,IAAI,cAAc,GAAG,KAAK,CAAC;IAC3B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACpD,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,QAAQ,KAAK,SAAS;YAAE,SAAS;QACrC,IAAI,QAAQ,KAAK,UAAU,IAAI,QAAQ,KAAK,WAAW,EAAE,CAAC;YACxD,IAAI,cAAc;gBAAE,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;YACtF,cAAc,GAAG,IAAI,CAAC;YACtB,UAAU,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAwC,CAAC;YACtE,SAAS;QACX,CAAC;QACD,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACpD,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YACtC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,oBAAoB,CAAC,CAAC;YACvF,KAAK,IAAI,CAAC,CAAC;YACX,IAAI,QAAQ,KAAK,SAAS;gBAAE,KAAK,GAAG,KAAK,CAAC;;gBACrC,IAAI,GAAG,KAAK,CAAC;YAClB,SAAS;QACX,CAAC;QACD,IAAI,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAC;QAC9E,IAAI,WAAW;YAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC3E,WAAW,GAAG,QAAQ,CAAC;IACzB,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ConnectCommandRequest {
|
|
2
|
+
readonly argv?: readonly string[];
|
|
3
|
+
readonly stdout?: (line: string) => void;
|
|
4
|
+
readonly stderr?: (line: string) => void;
|
|
5
|
+
}
|
|
6
|
+
/** Run the connect command and map structured results to deterministic CLI exit codes. */
|
|
7
|
+
export declare function runConnectCommandAsync(request?: ConnectCommandRequest): Promise<{
|
|
8
|
+
readonly exitCode: number;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=runConnectCommandAsync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runConnectCommandAsync.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/connect/runConnectCommandAsync.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C;AAED,0FAA0F;AAC1F,wBAAsB,sBAAsB,CAC1C,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAexC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { connectGitHubRepositoryAsync } from '../../../providers/github/services/connectGitHubRepositoryAsync.js';
|
|
2
|
+
import { parseConnectCommandOptions } from './parseConnectCommandOptions.js';
|
|
3
|
+
/** Run the connect command and map structured results to deterministic CLI exit codes. */
|
|
4
|
+
export async function runConnectCommandAsync(request = {}) {
|
|
5
|
+
const stdout = request.stdout ?? console.log;
|
|
6
|
+
const stderr = request.stderr ?? console.error;
|
|
7
|
+
let options;
|
|
8
|
+
try {
|
|
9
|
+
options = parseConnectCommandOptions(request.argv ?? []);
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
stderr(error instanceof Error ? error.message : 'Invalid connect options.');
|
|
13
|
+
return { exitCode: 2 };
|
|
14
|
+
}
|
|
15
|
+
const result = await connectGitHubRepositoryAsync(options);
|
|
16
|
+
writeResult(result, stdout, stderr);
|
|
17
|
+
return {
|
|
18
|
+
exitCode: result.status === 'connected' || result.status === 'already-connected' ? 0 : 1,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/** Write a safe result without raw process output or credentials. */
|
|
22
|
+
function writeResult(result, stdout, stderr) {
|
|
23
|
+
const line = JSON.stringify(result);
|
|
24
|
+
if (result.status === 'connected' || result.status === 'already-connected')
|
|
25
|
+
stdout(line);
|
|
26
|
+
else
|
|
27
|
+
stderr(line);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=runConnectCommandAsync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runConnectCommandAsync.js","sourceRoot":"","sources":["../../../../src/cli/commands/connect/runConnectCommandAsync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oEAAoE,CAAC;AAClH,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAQ7E,0FAA0F;AAC1F,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,UAAiC,EAAE;IAEnC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC;IAC7C,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC;IAC/C,IAAI,OAAO,CAAC;IACZ,IAAI,CAAC;QACH,OAAO,GAAG,0BAA0B,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC;QAC5E,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IACzB,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,4BAA4B,CAAC,OAAO,CAAC,CAAC;IAC3D,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,OAAO;QACL,QAAQ,EAAE,MAAM,CAAC,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,MAAM,KAAK,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KACzF,CAAC;AACJ,CAAC;AAED,qEAAqE;AACrE,SAAS,WAAW,CAClB,MAAwC,EACxC,MAA8B,EAC9B,MAA8B;IAE9B,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,MAAM,KAAK,mBAAmB;QAAE,MAAM,CAAC,IAAI,CAAC,CAAC;;QACpF,MAAM,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createRepositoryRuntimeProvider } from './provider/createRepositoryRuntimeProvider.js';
|
|
2
|
+
declare const provider: import("./provider/createRepositoryRuntimeProvider.js").RepositoryRuntimeProvider;
|
|
3
|
+
export { createRepositoryRuntimeProvider };
|
|
4
|
+
export default provider;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,+CAA+C,CAAC;AAEhG,QAAA,MAAM,QAAQ,mFAAoC,CAAC;AAEnD,OAAO,EAAE,+BAA+B,EAAE,CAAC;AAC3C,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,+CAA+C,CAAC;AAEhG,MAAM,QAAQ,GAAG,+BAA+B,EAAE,CAAC;AAEnD,OAAO,EAAE,+BAA+B,EAAE,CAAC;AAC3C,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ConnectCommandRequest } from '../commands/connect/runConnectCommandAsync.js';
|
|
2
|
+
export interface RepositoryRuntimeProvider {
|
|
3
|
+
readonly id: 'repository';
|
|
4
|
+
readonly category: 'repository';
|
|
5
|
+
readonly version: string;
|
|
6
|
+
readonly capabilities: readonly ['repository.connect'];
|
|
7
|
+
readonly commands: readonly [
|
|
8
|
+
{
|
|
9
|
+
readonly path: readonly ['connect'];
|
|
10
|
+
readonly capability: 'repository.connect';
|
|
11
|
+
readonly summary: string;
|
|
12
|
+
}
|
|
13
|
+
];
|
|
14
|
+
readonly handlers: readonly [
|
|
15
|
+
{
|
|
16
|
+
readonly path: readonly ['connect'];
|
|
17
|
+
readonly handler: (request: ConnectCommandRequest) => Promise<{
|
|
18
|
+
readonly exitCode: number;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
/** Create the package-level Ankh provider for `ankh repository connect`. */
|
|
24
|
+
export declare function createRepositoryRuntimeProvider(): RepositoryRuntimeProvider;
|
|
25
|
+
//# sourceMappingURL=createRepositoryRuntimeProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRepositoryRuntimeProvider.d.ts","sourceRoot":"","sources":["../../../src/cli/provider/createRepositoryRuntimeProvider.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,qBAAqB,EAE3B,MAAM,+CAA+C,CAAC;AAEvD,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC,oBAAoB,CAAC,CAAC;IACvD,QAAQ,CAAC,QAAQ,EAAE,SAAS;QAC1B;YACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;YACpC,QAAQ,CAAC,UAAU,EAAE,oBAAoB,CAAC;YAC1C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;SAC1B;KACF,CAAC;IACF,QAAQ,CAAC,QAAQ,EAAE,SAAS;QAC1B;YACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;YACpC,QAAQ,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,OAAO,CAAC;gBAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;aAAE,CAAC,CAAC;SAC9F;KACF,CAAC;CACH;AAED,4EAA4E;AAC5E,wBAAgB,+BAA+B,IAAI,yBAAyB,CAe3E"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { repositoryPackageMetadata } from '../../metadata/repositoryPackageMetadata.js';
|
|
2
|
+
import { runConnectCommandAsync, } from '../commands/connect/runConnectCommandAsync.js';
|
|
3
|
+
/** Create the package-level Ankh provider for `ankh repository connect`. */
|
|
4
|
+
export function createRepositoryRuntimeProvider() {
|
|
5
|
+
return {
|
|
6
|
+
id: repositoryPackageMetadata.provider,
|
|
7
|
+
category: repositoryPackageMetadata.category,
|
|
8
|
+
version: repositoryPackageMetadata.version,
|
|
9
|
+
capabilities: ['repository.connect'],
|
|
10
|
+
commands: [
|
|
11
|
+
{
|
|
12
|
+
path: ['connect'],
|
|
13
|
+
capability: 'repository.connect',
|
|
14
|
+
summary: repositoryPackageMetadata.command.summary,
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
handlers: [{ path: ['connect'], handler: runConnectCommandAsync }],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=createRepositoryRuntimeProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRepositoryRuntimeProvider.js","sourceRoot":"","sources":["../../../src/cli/provider/createRepositoryRuntimeProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EAEL,sBAAsB,GACvB,MAAM,+CAA+C,CAAC;AAsBvD,4EAA4E;AAC5E,MAAM,UAAU,+BAA+B;IAC7C,OAAO;QACL,EAAE,EAAE,yBAAyB,CAAC,QAAQ;QACtC,QAAQ,EAAE,yBAAyB,CAAC,QAAQ;QAC5C,OAAO,EAAE,yBAAyB,CAAC,OAAO;QAC1C,YAAY,EAAE,CAAC,oBAAoB,CAAC;QACpC,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,CAAC,SAAS,CAAC;gBACjB,UAAU,EAAE,oBAAoB;gBAChC,OAAO,EAAE,yBAAyB,CAAC,OAAO,CAAC,OAAO;aACnD;SACF;QACD,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,sBAAsB,EAAE,CAAC;KACnE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRepositoryRuntimeProvider.test.d.ts","sourceRoot":"","sources":["../../../src/cli/provider/createRepositoryRuntimeProvider.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { expect, test } from 'bun:test';
|
|
2
|
+
import packageJson from '../../../package.json';
|
|
3
|
+
import { createRepositoryRuntimeProvider } from './createRepositoryRuntimeProvider.js';
|
|
4
|
+
test('reports the installed package version and canonical repository capability', () => {
|
|
5
|
+
expect(createRepositoryRuntimeProvider()).toMatchObject({
|
|
6
|
+
id: 'repository',
|
|
7
|
+
category: 'repository',
|
|
8
|
+
version: packageJson.version,
|
|
9
|
+
capabilities: ['repository.connect'],
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=createRepositoryRuntimeProvider.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRepositoryRuntimeProvider.test.js","sourceRoot":"","sources":["../../../src/cli/provider/createRepositoryRuntimeProvider.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAEvF,IAAI,CAAC,2EAA2E,EAAE,GAAG,EAAE;IACrF,MAAM,CAAC,+BAA+B,EAAE,CAAC,CAAC,aAAa,CAAC;QACtD,EAAE,EAAE,YAAY;QAChB,QAAQ,EAAE,YAAY;QACtB,OAAO,EAAE,WAAW,CAAC,OAAO;QAC5B,YAAY,EAAE,CAAC,oBAAoB,CAAC;KACrC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ProjectSnapshotReader } from '../ports/ProjectSnapshotReader.js';
|
|
2
|
+
/** Create a deterministic, ignore-aware reader for standalone project snapshots. */
|
|
3
|
+
export declare function createLocalProjectSnapshotReader(): ProjectSnapshotReader;
|
|
4
|
+
//# sourceMappingURL=createLocalProjectSnapshotReader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createLocalProjectSnapshotReader.d.ts","sourceRoot":"","sources":["../../../src/connection/adapters/createLocalProjectSnapshotReader.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAmB/E,oFAAoF;AACpF,wBAAgB,gCAAgC,IAAI,qBAAqB,CAExE"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { lstat, readdir, readFile } from 'node:fs/promises';
|
|
2
|
+
import { join, relative, resolve, sep } from 'node:path';
|
|
3
|
+
import ignore, {} from 'ignore';
|
|
4
|
+
const REPOSITORY_MANIFEST_PATH = '.ankhorage/repository.json';
|
|
5
|
+
const HARD_EXCLUDED_DIRECTORIES = new Set([
|
|
6
|
+
'.git',
|
|
7
|
+
'node_modules',
|
|
8
|
+
'.expo',
|
|
9
|
+
'dist',
|
|
10
|
+
'build',
|
|
11
|
+
'coverage',
|
|
12
|
+
'.cache',
|
|
13
|
+
'.turbo',
|
|
14
|
+
]);
|
|
15
|
+
const SECRET_FILE_PATTERNS = [
|
|
16
|
+
/^\.env(?:\..+)?$/u,
|
|
17
|
+
/(?:^|\.)(?:pem|key|p12|pfx|keystore|mobileprovision)$/iu,
|
|
18
|
+
/(?:credentials?|secrets?|service-account)/iu,
|
|
19
|
+
];
|
|
20
|
+
/** Create a deterministic, ignore-aware reader for standalone project snapshots. */
|
|
21
|
+
export function createLocalProjectSnapshotReader() {
|
|
22
|
+
return { readAsync };
|
|
23
|
+
}
|
|
24
|
+
/** Read a complete safe project snapshot rooted only at the supplied project directory. */
|
|
25
|
+
async function readAsync(projectPath, repository) {
|
|
26
|
+
const root = resolve(projectPath);
|
|
27
|
+
const rootStat = await lstat(root);
|
|
28
|
+
if (!rootStat.isDirectory()) {
|
|
29
|
+
throw new Error('Project path must be a directory.');
|
|
30
|
+
}
|
|
31
|
+
const matcher = await readIgnoreMatcher(root);
|
|
32
|
+
const entries = [];
|
|
33
|
+
await visitDirectory(root, root, matcher, entries);
|
|
34
|
+
const existingManifest = entries.find((entry) => entry.path === REPOSITORY_MANIFEST_PATH);
|
|
35
|
+
const serializedManifest = `${JSON.stringify(repository, null, 2)}\n`;
|
|
36
|
+
const manifestEntry = {
|
|
37
|
+
path: REPOSITORY_MANIFEST_PATH,
|
|
38
|
+
mode: existingManifest?.mode ?? '100644',
|
|
39
|
+
content: serializedManifest,
|
|
40
|
+
encoding: 'utf-8',
|
|
41
|
+
};
|
|
42
|
+
const withoutManifest = entries.filter((entry) => entry.path !== REPOSITORY_MANIFEST_PATH);
|
|
43
|
+
const allEntries = [...withoutManifest, manifestEntry].sort((left, right) => left.path.localeCompare(right.path));
|
|
44
|
+
return Object.freeze({
|
|
45
|
+
projectPath: root,
|
|
46
|
+
repository,
|
|
47
|
+
entries: Object.freeze(allEntries),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/** Read root ignore rules without consulting any parent repository. */
|
|
51
|
+
async function readIgnoreMatcher(root) {
|
|
52
|
+
const matcher = ignore();
|
|
53
|
+
try {
|
|
54
|
+
const rules = await readFile(join(root, '.gitignore'), 'utf8');
|
|
55
|
+
matcher.add(rules);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
if (!isMissingFile(error)) {
|
|
59
|
+
throw new Error(`Unable to read .gitignore: ${getErrorMessage(error)}`, { cause: error });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return matcher;
|
|
63
|
+
}
|
|
64
|
+
/** Recursively visit safe regular files while rejecting links and special entries. */
|
|
65
|
+
async function visitDirectory(root, directory, matcher, entries) {
|
|
66
|
+
const children = (await readdir(directory, { withFileTypes: true })).sort((left, right) => left.name.localeCompare(right.name));
|
|
67
|
+
for (const child of children) {
|
|
68
|
+
const absolutePath = join(directory, child.name);
|
|
69
|
+
const path = relative(root, absolutePath).split(sep).join('/');
|
|
70
|
+
const stats = await lstat(absolutePath);
|
|
71
|
+
if (stats.isSymbolicLink()) {
|
|
72
|
+
throw new Error(`Symlinks are not allowed in project snapshots: ${path}`);
|
|
73
|
+
}
|
|
74
|
+
if (!stats.isDirectory() && !stats.isFile()) {
|
|
75
|
+
throw new Error(`Unsupported filesystem entry in project snapshot: ${path}`);
|
|
76
|
+
}
|
|
77
|
+
if (stats.isFile() && isSecretPath(path) && path !== '.env.example') {
|
|
78
|
+
throw new Error(`Secret-like file is not allowed in project snapshots: ${path}`);
|
|
79
|
+
}
|
|
80
|
+
if (isHardExcluded(path, child.isDirectory()))
|
|
81
|
+
continue;
|
|
82
|
+
if (matcher.ignores(path) || matcher.ignores(`${path}/`))
|
|
83
|
+
continue;
|
|
84
|
+
if (stats.isDirectory()) {
|
|
85
|
+
await visitDirectory(root, absolutePath, matcher, entries);
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
if (isSecretPath(path)) {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const bytes = await readFile(absolutePath);
|
|
92
|
+
entries.push(createEntry(path, bytes, stats.mode));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/** Apply invariant exclusions before ignore rules can accidentally include generated files. */
|
|
96
|
+
function isHardExcluded(path, directory) {
|
|
97
|
+
const firstSegment = path.split('/')[0] ?? '';
|
|
98
|
+
return directory && HARD_EXCLUDED_DIRECTORIES.has(firstSegment);
|
|
99
|
+
}
|
|
100
|
+
/** Identify credentials and private signing material by filename. */
|
|
101
|
+
function isSecretPath(path) {
|
|
102
|
+
const name = path.split('/').at(-1) ?? path;
|
|
103
|
+
return SECRET_FILE_PATTERNS.some((pattern) => pattern.test(name));
|
|
104
|
+
}
|
|
105
|
+
/** Encode text and binary files in the representation required by Git blobs. */
|
|
106
|
+
function createEntry(path, bytes, mode) {
|
|
107
|
+
const isBinary = bytes.includes(0);
|
|
108
|
+
return {
|
|
109
|
+
path,
|
|
110
|
+
mode: (mode & 0o111) === 0 ? '100644' : '100755',
|
|
111
|
+
content: isBinary ? Buffer.from(bytes).toString('base64') : Buffer.from(bytes).toString('utf8'),
|
|
112
|
+
encoding: isBinary ? 'base64' : 'utf-8',
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/** Distinguish an absent optional ignore file from other filesystem errors. */
|
|
116
|
+
function isMissingFile(error) {
|
|
117
|
+
return typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT';
|
|
118
|
+
}
|
|
119
|
+
/** Convert unknown filesystem failures to safe messages. */
|
|
120
|
+
function getErrorMessage(error) {
|
|
121
|
+
return error instanceof Error ? error.message : 'unknown filesystem error';
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=createLocalProjectSnapshotReader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createLocalProjectSnapshotReader.js","sourceRoot":"","sources":["../../../src/connection/adapters/createLocalProjectSnapshotReader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO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,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;QAC/F,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO;KACxC,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;AACnG,CAAC;AAED,4DAA4D;AAC5D,SAAS,eAAe,CAAC,KAAc;IACrC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,0BAA0B,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RepositoryManifestStore } from '../ports/RepositoryManifestStore.js';
|
|
2
|
+
/*** Create the atomic local store for the project repository manifest slice. */
|
|
3
|
+
export declare function createLocalRepositoryManifestStore(): RepositoryManifestStore;
|
|
4
|
+
//# sourceMappingURL=createLocalRepositoryManifestStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createLocalRepositoryManifestStore.d.ts","sourceRoot":"","sources":["../../../src/connection/adapters/createLocalRepositoryManifestStore.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAKnF,gFAAgF;AAChF,wBAAgB,kCAAkC,IAAI,uBAAuB,CAE5E"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { mkdir, readFile, rename, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
const MANIFEST_DIRECTORY = '.ankhorage';
|
|
4
|
+
const MANIFEST_FILE_NAME = 'repository.json';
|
|
5
|
+
/*** Create the atomic local store for the project repository manifest slice. */
|
|
6
|
+
export function createLocalRepositoryManifestStore() {
|
|
7
|
+
return { readConfigAsync, updateRepositoryAsync };
|
|
8
|
+
}
|
|
9
|
+
/*** Read the repository manifest, treating an absent file as an unconfigured project. */
|
|
10
|
+
async function readConfigAsync(projectPath) {
|
|
11
|
+
const manifestPath = getManifestPath(projectPath);
|
|
12
|
+
try {
|
|
13
|
+
const parsed = JSON.parse(await readFile(manifestPath, 'utf8'));
|
|
14
|
+
if (!isRepositoryManifest(parsed))
|
|
15
|
+
throw new Error(`Invalid ${getRelativeManifestPath()}.`);
|
|
16
|
+
return parsed;
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
if (isMissingFile(error))
|
|
20
|
+
return undefined;
|
|
21
|
+
if (error instanceof SyntaxError) {
|
|
22
|
+
throw new Error(`Invalid ${getRelativeManifestPath()}: invalid JSON.`, { cause: error });
|
|
23
|
+
}
|
|
24
|
+
throw new Error(`Unable to read ${getRelativeManifestPath()}: ${getErrorMessage(error)}`, {
|
|
25
|
+
cause: error,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/*** Atomically persist only the repository manifest slice. */
|
|
30
|
+
async function updateRepositoryAsync(projectPath, repository) {
|
|
31
|
+
const directory = join(projectPath, MANIFEST_DIRECTORY);
|
|
32
|
+
const manifestPath = getManifestPath(projectPath);
|
|
33
|
+
const tempPath = `${manifestPath}.tmp`;
|
|
34
|
+
await mkdir(directory, { recursive: true, mode: 0o700 });
|
|
35
|
+
await writeFile(tempPath, `${JSON.stringify(repository, null, 2)}\n`, {
|
|
36
|
+
encoding: 'utf8',
|
|
37
|
+
mode: 0o600,
|
|
38
|
+
});
|
|
39
|
+
try {
|
|
40
|
+
await rename(tempPath, manifestPath);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
throw new Error(`Unable to update ${getRelativeManifestPath()}: ${getErrorMessage(error)}`, {
|
|
44
|
+
cause: error,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/*** Build the canonical project-local repository manifest path. */
|
|
49
|
+
function getManifestPath(projectPath) {
|
|
50
|
+
return join(projectPath, MANIFEST_DIRECTORY, MANIFEST_FILE_NAME);
|
|
51
|
+
}
|
|
52
|
+
/*** Return the manifest path used in user-facing errors. */
|
|
53
|
+
function getRelativeManifestPath() {
|
|
54
|
+
return `${MANIFEST_DIRECTORY}/${MANIFEST_FILE_NAME}`;
|
|
55
|
+
}
|
|
56
|
+
/*** Validate the intentionally small repository manifest shape. */
|
|
57
|
+
function isRepositoryManifest(value) {
|
|
58
|
+
if (typeof value !== 'object' || value === null)
|
|
59
|
+
return false;
|
|
60
|
+
const candidate = value;
|
|
61
|
+
return (candidate.provider === 'github' &&
|
|
62
|
+
typeof candidate.owner === 'string' &&
|
|
63
|
+
typeof candidate.name === 'string' &&
|
|
64
|
+
typeof candidate.url === 'string' &&
|
|
65
|
+
candidate.defaultBranch === 'main');
|
|
66
|
+
}
|
|
67
|
+
/** Identify an absent configuration file without hiding other filesystem failures. */
|
|
68
|
+
function isMissingFile(error) {
|
|
69
|
+
return typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT';
|
|
70
|
+
}
|
|
71
|
+
/** Convert unknown filesystem failures to safe messages. */
|
|
72
|
+
function getErrorMessage(error) {
|
|
73
|
+
return error instanceof Error ? error.message : 'unknown filesystem error';
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=createLocalRepositoryManifestStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createLocalRepositoryManifestStore.js","sourceRoot":"","sources":["../../../src/connection/adapters/createLocalRepositoryManifestStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAMj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KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;AACnG,CAAC;AAED,4DAA4D;AAC5D,SAAS,eAAe,CAAC,KAAc;IACrC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,0BAA0B,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createLocalRepositoryManifestStore.test.d.ts","sourceRoot":"","sources":["../../../src/connection/adapters/createLocalRepositoryManifestStore.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { mkdtemp, readFile, rm } from 'node:fs/promises';
|
|
2
|
+
import { tmpdir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { expect, test } from 'bun:test';
|
|
5
|
+
import { createLocalRepositoryManifestStore } from './createLocalRepositoryManifestStore.js';
|
|
6
|
+
test('persists the complete slice at the canonical repository manifest path', async () => {
|
|
7
|
+
const projectPath = await mkdtemp(join(tmpdir(), 'repository-manifest-store-'));
|
|
8
|
+
const repository = {
|
|
9
|
+
provider: 'github',
|
|
10
|
+
owner: 'ankhorage',
|
|
11
|
+
name: 'demo',
|
|
12
|
+
url: 'https://github.com/ankhorage/demo',
|
|
13
|
+
defaultBranch: 'main',
|
|
14
|
+
};
|
|
15
|
+
try {
|
|
16
|
+
const store = createLocalRepositoryManifestStore();
|
|
17
|
+
await store.updateRepositoryAsync(projectPath, repository);
|
|
18
|
+
expect(await store.readConfigAsync(projectPath)).toEqual(repository);
|
|
19
|
+
expect(JSON.parse(await readFile(join(projectPath, '.ankhorage', 'repository.json'), 'utf8'))).toEqual(repository);
|
|
20
|
+
}
|
|
21
|
+
finally {
|
|
22
|
+
await rm(projectPath, { recursive: true, force: true });
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=createLocalRepositoryManifestStore.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createLocalRepositoryManifestStore.test.js","sourceRoot":"","sources":["../../../src/connection/adapters/createLocalRepositoryManifestStore.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAE,kCAAkC,EAAE,MAAM,yCAAyC,CAAC;AAE7F,IAAI,CAAC,uEAAuE,EAAE,KAAK,IAAI,EAAE;IACvF,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,4BAA4B,CAAC,CAAC,CAAC;IAChF,MAAM,UAAU,GAAuB;QACrC,QAAQ,EAAE,QAAQ;QAClB,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,mCAAmC;QACxC,aAAa,EAAE,MAAM;KACtB,CAAC;IAEF,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,kCAAkC,EAAE,CAAC;QACnD,MAAM,KAAK,CAAC,qBAAqB,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QAE3D,MAAM,CAAC,MAAM,KAAK,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACrE,MAAM,CACJ,IAAI,CAAC,KAAK,CACR,MAAM,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,EAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC,CAChE,CACb,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACxB,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,C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