@ankhorage/contracts 1.19.0 → 1.19.1
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 +6 -0
- package/README.md +43 -2
- package/package.json +8 -1
- package/src/contracts.test.ts +10 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -106,6 +106,19 @@ Metadata-only packages use `null` for `provider`:
|
|
|
106
106
|
}
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
+
`@ankhorage/contracts` now publishes this metadata shape directly from its own
|
|
110
|
+
`package.json`:
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"ankh": {
|
|
115
|
+
"category": "contracts",
|
|
116
|
+
"provider": null,
|
|
117
|
+
"capabilities": ["contracts.cli"]
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
109
122
|
Command descriptor paths are relative to the provider category:
|
|
110
123
|
|
|
111
124
|
- `category: "infra"` with `path: ["up"]` maps to `ankh infra up`
|
|
@@ -113,8 +126,36 @@ Command descriptor paths are relative to the provider category:
|
|
|
113
126
|
|
|
114
127
|
This subpath contains contracts only. It must not depend on `commander`,
|
|
115
128
|
`@ankhorage/ankh`, provider implementations, or runtime CLI execution logic.
|
|
116
|
-
|
|
117
|
-
|
|
129
|
+
|
|
130
|
+
Capability names are dot-separated package metadata identifiers.
|
|
131
|
+
|
|
132
|
+
Preferred forms:
|
|
133
|
+
|
|
134
|
+
- `<category>.<action>` for simple capabilities
|
|
135
|
+
- `<category>.<resource>.<action>` for nested or domain-specific capabilities
|
|
136
|
+
|
|
137
|
+
Valid examples:
|
|
138
|
+
|
|
139
|
+
- `infra.up`
|
|
140
|
+
- `templates.create`
|
|
141
|
+
- `contracts.cli`
|
|
142
|
+
- `board.web.import`
|
|
143
|
+
- `doctor.repo.validate`
|
|
144
|
+
- `dev.android.rebuild`
|
|
145
|
+
- `expoRuntime.plan`
|
|
146
|
+
|
|
147
|
+
Invalid examples:
|
|
148
|
+
|
|
149
|
+
- `infra`
|
|
150
|
+
- `infra-up`
|
|
151
|
+
- `.status`
|
|
152
|
+
- `infra.`
|
|
153
|
+
- `infra..up`
|
|
154
|
+
|
|
155
|
+
`AnkhCapabilityId` remains intentionally broad at the TypeScript level so
|
|
156
|
+
packages can publish stable serializable metadata without embedding policy
|
|
157
|
+
validation logic here. Stricter validation belongs later in
|
|
158
|
+
`@ankhorage/doctor`.
|
|
118
159
|
|
|
119
160
|
## Profile contract
|
|
120
161
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/contracts",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
|
+
"ankh": {
|
|
6
|
+
"category": "contracts",
|
|
7
|
+
"provider": null,
|
|
8
|
+
"capabilities": [
|
|
9
|
+
"contracts.cli"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
5
12
|
"dependencies": {
|
|
6
13
|
"@ankhorage/color-theory": "^0.0.7"
|
|
7
14
|
},
|
package/src/contracts.test.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { COLOR_HARMONIES } from '@ankhorage/color-theory';
|
|
|
5
5
|
import { describe, expect, it } from 'bun:test';
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
+
type AnkhPackageMetadata,
|
|
8
9
|
APP_CATEGORIES,
|
|
9
10
|
type AppCategory,
|
|
10
11
|
type AppManifest,
|
|
@@ -57,7 +58,14 @@ async function collectTypeScriptFiles(directory: string): Promise<string[]> {
|
|
|
57
58
|
|
|
58
59
|
describe('contracts', () => {
|
|
59
60
|
it('exports the cli subpath for Ankh discovery contracts', async () => {
|
|
61
|
+
const expectedAnkhMetadata = {
|
|
62
|
+
category: 'contracts',
|
|
63
|
+
provider: null,
|
|
64
|
+
capabilities: ['contracts.cli'],
|
|
65
|
+
} as const satisfies AnkhPackageMetadata;
|
|
66
|
+
|
|
60
67
|
const packageJson = JSON.parse(await readFile(join(process.cwd(), 'package.json'), 'utf8')) as {
|
|
68
|
+
ankh?: unknown;
|
|
61
69
|
exports?: Record<string, { default?: string; types?: string }>;
|
|
62
70
|
};
|
|
63
71
|
|
|
@@ -65,6 +73,8 @@ describe('contracts', () => {
|
|
|
65
73
|
types: './dist/cli.d.ts',
|
|
66
74
|
default: './dist/cli.js',
|
|
67
75
|
});
|
|
76
|
+
expect(packageJson.ankh).toEqual(expectedAnkhMetadata);
|
|
77
|
+
expect(JSON.parse(JSON.stringify(expectedAnkhMetadata))).toEqual(expectedAnkhMetadata);
|
|
68
78
|
});
|
|
69
79
|
|
|
70
80
|
it('exports stable platform constants', () => {
|