@kb-labs/commit-contracts 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/LICENSE +4 -0
- package/README.md +90 -0
- package/dist/contract.d.ts +135 -0
- package/dist/contract.js +140 -0
- package/dist/contract.js.map +1 -0
- package/dist/index.d.ts +2410 -0
- package/dist/index.js +745 -0
- package/dist/index.js.map +1 -0
- package/dist/schema.d.ts +1352 -0
- package/dist/schema.js +158 -0
- package/dist/schema.js.map +1 -0
- package/package.json +57 -0
package/LICENSE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# @kb-labs/plugin-template-contracts
|
|
2
|
+
|
|
3
|
+
Lightweight public contracts package for the plugin: it describes guaranteed artifacts, commands, workflows, API payloads, and the version of these promises.
|
|
4
|
+
|
|
5
|
+
## Why this package exists
|
|
6
|
+
|
|
7
|
+
Every KB Labs plugin is expected to publish a clear, lightweight “promise” to the rest of the ecosystem. This package is that promise: it contains only types, manifests, and validation helpers, so other teams (CLI, Workflow Engine, Studio, REST, marketplace tooling) can rely on a single source of truth without dragging in plugin runtime code.
|
|
8
|
+
|
|
9
|
+
## Quick start checklist
|
|
10
|
+
|
|
11
|
+
1. Clone this package as part of your plugin workspace (`packages/contracts`).
|
|
12
|
+
2. Update `pluginContractsManifest` with your plugin ID and initial artifacts/commands.
|
|
13
|
+
3. Adjust Zod schemas in `src/schema.ts` (or add new ones) to match your payloads.
|
|
14
|
+
4. Bump `contractsVersion` whenever the public promise changes (SemVer rules below).
|
|
15
|
+
5. Run `pnpm test` and `pnpm type-check` to ensure the manifest validates.
|
|
16
|
+
6. Import the manifest in your CLI/REST/workflow code to avoid hard-coded IDs.
|
|
17
|
+
|
|
18
|
+
### Renaming this package
|
|
19
|
+
|
|
20
|
+
When you turn the template into your own plugin:
|
|
21
|
+
- Change the npm name in `package.json` (e.g. `@kb-labs/my-plugin-contracts`).
|
|
22
|
+
- Update `pluginContractsManifest.pluginId` in `src/contract.ts`.
|
|
23
|
+
- Adjust aliases in `tsconfig.paths.json` and imports across the workspace (`@kb-labs/plugin-template-contracts` → your new name).
|
|
24
|
+
- Replace sample artifact IDs (`template.hello.*`) with your own naming scheme.
|
|
25
|
+
|
|
26
|
+
## What's inside
|
|
27
|
+
|
|
28
|
+
- `pluginContractsManifest` — the single source of truth for the plugin's public capabilities
|
|
29
|
+
- TypeScript types (`src/types`) and Zod schemas (`src/schema`) for artifacts, commands, workflows, and API payloads
|
|
30
|
+
- `parsePluginContracts` utility for runtime validation of the manifest and third-party contracts
|
|
31
|
+
|
|
32
|
+
## Versioning rules
|
|
33
|
+
|
|
34
|
+
- `contractsVersion` follows SemVer and is **independent** from the plugin's npm version.
|
|
35
|
+
- **MAJOR** — breaking changes (removing/renaming artifacts, changing payload formats).
|
|
36
|
+
- **MINOR** — backwards-compatible extensions (new artifacts, commands, fields).
|
|
37
|
+
- **PATCH** — documentation/metadata updates without altering payload formats.
|
|
38
|
+
|
|
39
|
+
## Minimal manifest example
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import type { PluginContracts } from '@kb-labs/plugin-template-contracts';
|
|
43
|
+
|
|
44
|
+
export const pluginContractsManifest: PluginContracts = {
|
|
45
|
+
schema: 'kb.plugin.contracts/1',
|
|
46
|
+
pluginId: '@kb-labs/my-plugin',
|
|
47
|
+
contractsVersion: '1.0.0',
|
|
48
|
+
artifacts: {
|
|
49
|
+
'my-plugin.result': {
|
|
50
|
+
id: 'my-plugin.result',
|
|
51
|
+
kind: 'json',
|
|
52
|
+
description: 'Primary output of the CLI command.'
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// commands/workflows/api can be added later when needed
|
|
56
|
+
};
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Optional sections
|
|
60
|
+
|
|
61
|
+
All additional sections are **optional** — include only what your plugin actually supports:
|
|
62
|
+
|
|
63
|
+
- `commands` — define CLI or workflow commands that produce/consume artifacts.
|
|
64
|
+
- `workflows` — describe composed workflows and their steps.
|
|
65
|
+
- `api` — document REST (or future surfaces) when the plugin exposes them.
|
|
66
|
+
|
|
67
|
+
If your plugin only ships a CLI command, keep `commands` + `artifacts` and omit `workflows`/`api`. The Zod schema accepts missing sections.
|
|
68
|
+
|
|
69
|
+
## Usage in plugin code
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
import { pluginContractsManifest } from '@kb-labs/plugin-template-contracts';
|
|
73
|
+
|
|
74
|
+
const helloArtifactId = pluginContractsManifest.artifacts['template.hello.greeting'].id;
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Use the manifest to avoid magic strings, assert that required artifacts exist, or log which promises were fulfilled.
|
|
78
|
+
|
|
79
|
+
## Who relies on the contract
|
|
80
|
+
|
|
81
|
+
- **Workflow Engine** — verifies allowed steps, required artifacts, and matches produced results with the contract.
|
|
82
|
+
- **Studio** — builds UI and hints based on declared artifacts and commands.
|
|
83
|
+
- **CLI / REST / other plugins** — reuse types and schemas as the source of truth, validate inputs/outputs.
|
|
84
|
+
- **Marketplace & QA tooling** — checks plugin compatibility and correctness before publishing.
|
|
85
|
+
|
|
86
|
+
## Looking ahead
|
|
87
|
+
|
|
88
|
+
- Generate JSON Schema / OpenAPI from the `api` contract surface.
|
|
89
|
+
- Add automatic inspectors in Studio and validators for the marketplace.
|
|
90
|
+
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KB Labs Commit Plugin - Contracts Manifest
|
|
3
|
+
*
|
|
4
|
+
* Level 2: Type-safe contracts with as const for type extraction.
|
|
5
|
+
* Defines artifacts, commands, and their relationships.
|
|
6
|
+
*/
|
|
7
|
+
declare const pluginContractsManifest: {
|
|
8
|
+
readonly schema: "kb.plugin.contracts/1";
|
|
9
|
+
readonly pluginId: "@kb-labs/commit";
|
|
10
|
+
readonly contractsVersion: "1.0.0";
|
|
11
|
+
readonly artifacts: {
|
|
12
|
+
readonly "commit.plan.json": {
|
|
13
|
+
readonly id: "commit.plan.json";
|
|
14
|
+
readonly kind: "json";
|
|
15
|
+
readonly description: "Current commit plan generated by LLM analysis of git changes.";
|
|
16
|
+
readonly pathPattern: ".kb/commit/current/plan.json";
|
|
17
|
+
readonly mediaType: "application/json";
|
|
18
|
+
readonly schemaRef: "@kb-labs/commit-contracts/schema#CommitPlan";
|
|
19
|
+
readonly example: {
|
|
20
|
+
readonly summary: "Example commit plan with two commits";
|
|
21
|
+
readonly payload: {
|
|
22
|
+
readonly schemaVersion: "1.0";
|
|
23
|
+
readonly commits: readonly [{
|
|
24
|
+
readonly id: "c1";
|
|
25
|
+
readonly type: "feat";
|
|
26
|
+
readonly scope: "ui";
|
|
27
|
+
readonly message: "add button component";
|
|
28
|
+
readonly files: readonly ["src/components/Button.tsx"];
|
|
29
|
+
readonly releaseHint: "minor";
|
|
30
|
+
}];
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
readonly "commit.status.json": {
|
|
35
|
+
readonly id: "commit.status.json";
|
|
36
|
+
readonly kind: "json";
|
|
37
|
+
readonly description: "Git status snapshot at plan generation time.";
|
|
38
|
+
readonly pathPattern: ".kb/commit/current/status.json";
|
|
39
|
+
readonly mediaType: "application/json";
|
|
40
|
+
readonly schemaRef: "@kb-labs/commit-contracts/schema#GitStatusSnapshot";
|
|
41
|
+
};
|
|
42
|
+
readonly "commit.history": {
|
|
43
|
+
readonly id: "commit.history";
|
|
44
|
+
readonly kind: "dir";
|
|
45
|
+
readonly description: "History of applied commit plans with results.";
|
|
46
|
+
readonly pathPattern: ".kb/commit/history/";
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
readonly commands: {
|
|
50
|
+
readonly commit: {
|
|
51
|
+
readonly id: "commit";
|
|
52
|
+
readonly description: "Generate and apply commits (default flow).";
|
|
53
|
+
readonly input: {
|
|
54
|
+
readonly ref: "@kb-labs/commit-contracts/schema#CommitRunInput";
|
|
55
|
+
readonly format: "zod";
|
|
56
|
+
};
|
|
57
|
+
readonly output: {
|
|
58
|
+
readonly ref: "@kb-labs/commit-contracts/schema#CommitRunOutput";
|
|
59
|
+
readonly format: "zod";
|
|
60
|
+
};
|
|
61
|
+
readonly produces: ["commit.plan.json", "commit.status.json"];
|
|
62
|
+
readonly examples: ["kb commit", "kb commit --dry-run", "kb commit --with-push"];
|
|
63
|
+
};
|
|
64
|
+
readonly "commit:generate": {
|
|
65
|
+
readonly id: "commit:generate";
|
|
66
|
+
readonly description: "Generate commit plan from git changes using LLM.";
|
|
67
|
+
readonly input: {
|
|
68
|
+
readonly ref: "@kb-labs/commit-contracts/schema#GenerateInput";
|
|
69
|
+
readonly format: "zod";
|
|
70
|
+
};
|
|
71
|
+
readonly output: {
|
|
72
|
+
readonly ref: "@kb-labs/commit-contracts/schema#GenerateOutput";
|
|
73
|
+
readonly format: "zod";
|
|
74
|
+
};
|
|
75
|
+
readonly produces: ["commit.plan.json", "commit.status.json"];
|
|
76
|
+
readonly examples: ["kb commit generate", "kb commit generate --json", "kb commit generate --scope src/**"];
|
|
77
|
+
};
|
|
78
|
+
readonly "commit:apply": {
|
|
79
|
+
readonly id: "commit:apply";
|
|
80
|
+
readonly description: "Apply current commit plan (create local git commits).";
|
|
81
|
+
readonly input: {
|
|
82
|
+
readonly ref: "@kb-labs/commit-contracts/schema#ApplyInput";
|
|
83
|
+
readonly format: "zod";
|
|
84
|
+
};
|
|
85
|
+
readonly output: {
|
|
86
|
+
readonly ref: "@kb-labs/commit-contracts/schema#ApplyOutput";
|
|
87
|
+
readonly format: "zod";
|
|
88
|
+
};
|
|
89
|
+
readonly produces: [];
|
|
90
|
+
readonly examples: ["kb commit apply", "kb commit apply --force"];
|
|
91
|
+
};
|
|
92
|
+
readonly "commit:push": {
|
|
93
|
+
readonly id: "commit:push";
|
|
94
|
+
readonly description: "Push commits to remote repository.";
|
|
95
|
+
readonly input: {
|
|
96
|
+
readonly ref: "@kb-labs/commit-contracts/schema#PushInput";
|
|
97
|
+
readonly format: "zod";
|
|
98
|
+
};
|
|
99
|
+
readonly output: {
|
|
100
|
+
readonly ref: "@kb-labs/commit-contracts/schema#PushOutput";
|
|
101
|
+
readonly format: "zod";
|
|
102
|
+
};
|
|
103
|
+
readonly produces: [];
|
|
104
|
+
readonly examples: ["kb commit push", "kb commit push --force"];
|
|
105
|
+
};
|
|
106
|
+
readonly "commit:open": {
|
|
107
|
+
readonly id: "commit:open";
|
|
108
|
+
readonly description: "Show current commit plan.";
|
|
109
|
+
readonly input: {
|
|
110
|
+
readonly ref: "@kb-labs/commit-contracts/schema#OpenInput";
|
|
111
|
+
readonly format: "zod";
|
|
112
|
+
};
|
|
113
|
+
readonly output: {
|
|
114
|
+
readonly ref: "@kb-labs/commit-contracts/schema#OpenOutput";
|
|
115
|
+
readonly format: "zod";
|
|
116
|
+
};
|
|
117
|
+
readonly produces: [];
|
|
118
|
+
readonly examples: ["kb commit open", "kb commit open --json"];
|
|
119
|
+
};
|
|
120
|
+
readonly "commit:reset": {
|
|
121
|
+
readonly id: "commit:reset";
|
|
122
|
+
readonly description: "Clear current commit plan.";
|
|
123
|
+
readonly output: {
|
|
124
|
+
readonly ref: "@kb-labs/commit-contracts/schema#ResetOutput";
|
|
125
|
+
readonly format: "zod";
|
|
126
|
+
};
|
|
127
|
+
readonly produces: [];
|
|
128
|
+
readonly examples: ["kb commit reset"];
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
type PluginArtifactIds = keyof typeof pluginContractsManifest.artifacts;
|
|
133
|
+
type PluginCommandIds = keyof typeof pluginContractsManifest.commands;
|
|
134
|
+
|
|
135
|
+
export { type PluginArtifactIds, type PluginCommandIds, pluginContractsManifest };
|
package/dist/contract.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// src/version.ts
|
|
2
|
+
var contractsSchemaId = "kb.plugin.contracts/1";
|
|
3
|
+
var contractsVersion = "1.0.0";
|
|
4
|
+
|
|
5
|
+
// src/contract.ts
|
|
6
|
+
var pluginContractsManifest = {
|
|
7
|
+
schema: contractsSchemaId,
|
|
8
|
+
pluginId: "@kb-labs/commit",
|
|
9
|
+
contractsVersion,
|
|
10
|
+
artifacts: {
|
|
11
|
+
"commit.plan.json": {
|
|
12
|
+
id: "commit.plan.json",
|
|
13
|
+
kind: "json",
|
|
14
|
+
description: "Current commit plan generated by LLM analysis of git changes.",
|
|
15
|
+
pathPattern: ".kb/commit/current/plan.json",
|
|
16
|
+
mediaType: "application/json",
|
|
17
|
+
schemaRef: "@kb-labs/commit-contracts/schema#CommitPlan",
|
|
18
|
+
example: {
|
|
19
|
+
summary: "Example commit plan with two commits",
|
|
20
|
+
payload: {
|
|
21
|
+
schemaVersion: "1.0",
|
|
22
|
+
commits: [
|
|
23
|
+
{
|
|
24
|
+
id: "c1",
|
|
25
|
+
type: "feat",
|
|
26
|
+
scope: "ui",
|
|
27
|
+
message: "add button component",
|
|
28
|
+
files: ["src/components/Button.tsx"],
|
|
29
|
+
releaseHint: "minor"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"commit.status.json": {
|
|
36
|
+
id: "commit.status.json",
|
|
37
|
+
kind: "json",
|
|
38
|
+
description: "Git status snapshot at plan generation time.",
|
|
39
|
+
pathPattern: ".kb/commit/current/status.json",
|
|
40
|
+
mediaType: "application/json",
|
|
41
|
+
schemaRef: "@kb-labs/commit-contracts/schema#GitStatusSnapshot"
|
|
42
|
+
},
|
|
43
|
+
"commit.history": {
|
|
44
|
+
id: "commit.history",
|
|
45
|
+
kind: "dir",
|
|
46
|
+
description: "History of applied commit plans with results.",
|
|
47
|
+
pathPattern: ".kb/commit/history/"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
commands: {
|
|
51
|
+
commit: {
|
|
52
|
+
id: "commit",
|
|
53
|
+
description: "Generate and apply commits (default flow).",
|
|
54
|
+
input: {
|
|
55
|
+
ref: "@kb-labs/commit-contracts/schema#CommitRunInput",
|
|
56
|
+
format: "zod"
|
|
57
|
+
},
|
|
58
|
+
output: {
|
|
59
|
+
ref: "@kb-labs/commit-contracts/schema#CommitRunOutput",
|
|
60
|
+
format: "zod"
|
|
61
|
+
},
|
|
62
|
+
produces: ["commit.plan.json", "commit.status.json"],
|
|
63
|
+
examples: ["kb commit", "kb commit --dry-run", "kb commit --with-push"]
|
|
64
|
+
},
|
|
65
|
+
"commit:generate": {
|
|
66
|
+
id: "commit:generate",
|
|
67
|
+
description: "Generate commit plan from git changes using LLM.",
|
|
68
|
+
input: {
|
|
69
|
+
ref: "@kb-labs/commit-contracts/schema#GenerateInput",
|
|
70
|
+
format: "zod"
|
|
71
|
+
},
|
|
72
|
+
output: {
|
|
73
|
+
ref: "@kb-labs/commit-contracts/schema#GenerateOutput",
|
|
74
|
+
format: "zod"
|
|
75
|
+
},
|
|
76
|
+
produces: ["commit.plan.json", "commit.status.json"],
|
|
77
|
+
examples: [
|
|
78
|
+
"kb commit generate",
|
|
79
|
+
"kb commit generate --json",
|
|
80
|
+
"kb commit generate --scope src/**"
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
"commit:apply": {
|
|
84
|
+
id: "commit:apply",
|
|
85
|
+
description: "Apply current commit plan (create local git commits).",
|
|
86
|
+
input: {
|
|
87
|
+
ref: "@kb-labs/commit-contracts/schema#ApplyInput",
|
|
88
|
+
format: "zod"
|
|
89
|
+
},
|
|
90
|
+
output: {
|
|
91
|
+
ref: "@kb-labs/commit-contracts/schema#ApplyOutput",
|
|
92
|
+
format: "zod"
|
|
93
|
+
},
|
|
94
|
+
produces: [],
|
|
95
|
+
examples: ["kb commit apply", "kb commit apply --force"]
|
|
96
|
+
},
|
|
97
|
+
"commit:push": {
|
|
98
|
+
id: "commit:push",
|
|
99
|
+
description: "Push commits to remote repository.",
|
|
100
|
+
input: {
|
|
101
|
+
ref: "@kb-labs/commit-contracts/schema#PushInput",
|
|
102
|
+
format: "zod"
|
|
103
|
+
},
|
|
104
|
+
output: {
|
|
105
|
+
ref: "@kb-labs/commit-contracts/schema#PushOutput",
|
|
106
|
+
format: "zod"
|
|
107
|
+
},
|
|
108
|
+
produces: [],
|
|
109
|
+
examples: ["kb commit push", "kb commit push --force"]
|
|
110
|
+
},
|
|
111
|
+
"commit:open": {
|
|
112
|
+
id: "commit:open",
|
|
113
|
+
description: "Show current commit plan.",
|
|
114
|
+
input: {
|
|
115
|
+
ref: "@kb-labs/commit-contracts/schema#OpenInput",
|
|
116
|
+
format: "zod"
|
|
117
|
+
},
|
|
118
|
+
output: {
|
|
119
|
+
ref: "@kb-labs/commit-contracts/schema#OpenOutput",
|
|
120
|
+
format: "zod"
|
|
121
|
+
},
|
|
122
|
+
produces: [],
|
|
123
|
+
examples: ["kb commit open", "kb commit open --json"]
|
|
124
|
+
},
|
|
125
|
+
"commit:reset": {
|
|
126
|
+
id: "commit:reset",
|
|
127
|
+
description: "Clear current commit plan.",
|
|
128
|
+
output: {
|
|
129
|
+
ref: "@kb-labs/commit-contracts/schema#ResetOutput",
|
|
130
|
+
format: "zod"
|
|
131
|
+
},
|
|
132
|
+
produces: [],
|
|
133
|
+
examples: ["kb commit reset"]
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export { pluginContractsManifest };
|
|
139
|
+
//# sourceMappingURL=contract.js.map
|
|
140
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/version.ts","../src/contract.ts"],"names":[],"mappings":";AAAO,IAAM,iBAAA,GAAoB,uBAAA;AAI1B,IAAM,gBAAA,GAAmB,OAAA;;;ACKzB,IAAM,uBAAA,GAA0B;AAAA,EACrC,MAAA,EAAQ,iBAAA;AAAA,EACR,QAAA,EAAU,iBAAA;AAAA,EACV,gBAAA;AAAA,EACA,SAAA,EAAW;AAAA,IACT,kBAAA,EAAoB;AAAA,MAClB,EAAA,EAAI,kBAAA;AAAA,MACJ,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AA,MACb,KAAA,EAAO;AAAA,QACL,GAAA,EAAK,4CAAA;AAAA,QACL,MAAA,EAAQ;AAAA,OACV;AAAA,MACA,MAAA,EAAQ;AAAA,QACN,GAAA,EAAK,6CAAA;AAAA,QACL,MAAA,EAAQ;AAAA,OACV;AAAA,MACA,UAAU,EAAC;AAAA,MACX,QAAA,EAAU,CAAC,gBAAA,EAAkB,uBAAuB;AAAA,KACtD;AAAA,IACA,cAAA,EAAgB;AAAA,MACd,EAAA,EAAI,cAAA;AAAA,MACJ,WAAA,EAAa,4BAAA;AAAA,MACb,MAAA,EAAQ;AAAA,QACN,GAAA,EAAK,8CAAA;AAAA,QACL,MAAA,EAAQ;AAAA,OACV;AAAA,MACA,UAAU,EAAC;AAAA,MACX,QAAA,EAAU,CAAC,iBAAiB;AAAA;AAC9B;AAEJ","file":"contract.js","sourcesContent":["export const contractsSchemaId = \"kb.plugin.contracts/1\" as const;\n\nexport type ContractsSchemaId = typeof contractsSchemaId;\n\nexport const contractsVersion = \"1.0.0\" as const;\n","import type { PluginContracts } from \"./types\";\nimport { contractsSchemaId, contractsVersion } from \"./version\";\n\n/**\n * KB Labs Commit Plugin - Contracts Manifest\n *\n * Level 2: Type-safe contracts with as const for type extraction.\n * Defines artifacts, commands, and their relationships.\n */\nexport const pluginContractsManifest = {\n schema: contractsSchemaId,\n pluginId: \"@kb-labs/commit\",\n contractsVersion,\n artifacts: {\n \"commit.plan.json\": {\n id: \"commit.plan.json\",\n kind: \"json\",\n description:\n \"Current commit plan generated by LLM analysis of git changes.\",\n pathPattern: \".kb/commit/current/plan.json\",\n mediaType: \"application/json\",\n schemaRef: \"@kb-labs/commit-contracts/schema#CommitPlan\",\n example: {\n summary: \"Example commit plan with two commits\",\n payload: {\n schemaVersion: \"1.0\",\n commits: [\n {\n id: \"c1\",\n type: \"feat\",\n scope: \"ui\",\n message: \"add button component\",\n files: [\"src/components/Button.tsx\"],\n releaseHint: \"minor\",\n },\n ],\n },\n },\n },\n \"commit.status.json\": {\n id: \"commit.status.json\",\n kind: \"json\",\n description: \"Git status snapshot at plan generation time.\",\n pathPattern: \".kb/commit/current/status.json\",\n mediaType: \"application/json\",\n schemaRef: \"@kb-labs/commit-contracts/schema#GitStatusSnapshot\",\n },\n \"commit.history\": {\n id: \"commit.history\",\n kind: \"dir\",\n description: \"History of applied commit plans with results.\",\n pathPattern: \".kb/commit/history/\",\n },\n },\n commands: {\n commit: {\n id: \"commit\",\n description: \"Generate and apply commits (default flow).\",\n input: {\n ref: \"@kb-labs/commit-contracts/schema#CommitRunInput\",\n format: \"zod\",\n },\n output: {\n ref: \"@kb-labs/commit-contracts/schema#CommitRunOutput\",\n format: \"zod\",\n },\n produces: [\"commit.plan.json\", \"commit.status.json\"],\n examples: [\"kb commit\", \"kb commit --dry-run\", \"kb commit --with-push\"],\n },\n \"commit:generate\": {\n id: \"commit:generate\",\n description: \"Generate commit plan from git changes using LLM.\",\n input: {\n ref: \"@kb-labs/commit-contracts/schema#GenerateInput\",\n format: \"zod\",\n },\n output: {\n ref: \"@kb-labs/commit-contracts/schema#GenerateOutput\",\n format: \"zod\",\n },\n produces: [\"commit.plan.json\", \"commit.status.json\"],\n examples: [\n \"kb commit generate\",\n \"kb commit generate --json\",\n \"kb commit generate --scope src/**\",\n ],\n },\n \"commit:apply\": {\n id: \"commit:apply\",\n description: \"Apply current commit plan (create local git commits).\",\n input: {\n ref: \"@kb-labs/commit-contracts/schema#ApplyInput\",\n format: \"zod\",\n },\n output: {\n ref: \"@kb-labs/commit-contracts/schema#ApplyOutput\",\n format: \"zod\",\n },\n produces: [],\n examples: [\"kb commit apply\", \"kb commit apply --force\"],\n },\n \"commit:push\": {\n id: \"commit:push\",\n description: \"Push commits to remote repository.\",\n input: {\n ref: \"@kb-labs/commit-contracts/schema#PushInput\",\n format: \"zod\",\n },\n output: {\n ref: \"@kb-labs/commit-contracts/schema#PushOutput\",\n format: \"zod\",\n },\n produces: [],\n examples: [\"kb commit push\", \"kb commit push --force\"],\n },\n \"commit:open\": {\n id: \"commit:open\",\n description: \"Show current commit plan.\",\n input: {\n ref: \"@kb-labs/commit-contracts/schema#OpenInput\",\n format: \"zod\",\n },\n output: {\n ref: \"@kb-labs/commit-contracts/schema#OpenOutput\",\n format: \"zod\",\n },\n produces: [],\n examples: [\"kb commit open\", \"kb commit open --json\"],\n },\n \"commit:reset\": {\n id: \"commit:reset\",\n description: \"Clear current commit plan.\",\n output: {\n ref: \"@kb-labs/commit-contracts/schema#ResetOutput\",\n format: \"zod\",\n },\n produces: [],\n examples: [\"kb commit reset\"],\n },\n },\n} as const satisfies PluginContracts;\n\n// Extract types for use in manifest and commands\nexport type PluginArtifactIds = keyof typeof pluginContractsManifest.artifacts;\nexport type PluginCommandIds = keyof typeof pluginContractsManifest.commands;\n"]}
|