gmc-openspec 1.0.0 → 1.4.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/README.md +2 -2
- package/bin/openspec.js +3 -1
- package/dist/cli/index.d.ts +4 -1
- package/dist/cli/index.js +36 -2
- package/dist/commands/config.js +4 -4
- package/dist/commands/context-store.d.ts +3 -0
- package/dist/commands/context-store.js +475 -0
- package/dist/commands/initiative.d.ts +13 -0
- package/dist/commands/initiative.js +318 -0
- package/dist/commands/workflow/index.d.ts +2 -0
- package/dist/commands/workflow/index.js +1 -0
- package/dist/commands/workflow/initiative-link.d.ts +24 -0
- package/dist/commands/workflow/initiative-link.js +47 -0
- package/dist/commands/workflow/instructions.js +10 -2
- package/dist/commands/workflow/new-change.d.ts +4 -0
- package/dist/commands/workflow/new-change.js +72 -23
- package/dist/commands/workflow/set-change.d.ts +13 -0
- package/dist/commands/workflow/set-change.js +87 -0
- package/dist/commands/workflow/shared.d.ts +2 -0
- package/dist/commands/workflow/status.js +3 -0
- package/dist/commands/workspace/context-status.d.ts +4 -0
- package/dist/commands/workspace/context-status.js +59 -0
- package/dist/commands/workspace/open-target-selection.d.ts +13 -0
- package/dist/commands/workspace/open-target-selection.js +146 -0
- package/dist/commands/workspace/open-view.d.ts +62 -0
- package/dist/commands/workspace/open-view.js +249 -0
- package/dist/commands/workspace/open.d.ts +16 -8
- package/dist/commands/workspace/open.js +40 -14
- package/dist/commands/workspace/opener-selection.d.ts +11 -0
- package/dist/commands/workspace/opener-selection.js +98 -0
- package/dist/commands/workspace/operations.d.ts +14 -8
- package/dist/commands/workspace/operations.js +228 -160
- package/dist/commands/workspace/prompt-theme.d.ts +29 -0
- package/dist/commands/workspace/prompt-theme.js +24 -0
- package/dist/commands/workspace/registration.d.ts +13 -0
- package/dist/commands/workspace/registration.js +84 -0
- package/dist/commands/workspace/selection.d.ts +3 -0
- package/dist/commands/workspace/selection.js +42 -40
- package/dist/commands/workspace/setup-prompts.d.ts +13 -0
- package/dist/commands/workspace/setup-prompts.js +121 -0
- package/dist/commands/workspace/types.d.ts +15 -0
- package/dist/commands/workspace.js +59 -340
- package/dist/core/artifact-graph/index.d.ts +2 -1
- package/dist/core/artifact-graph/instruction-loader.d.ts +10 -23
- package/dist/core/artifact-graph/instruction-loader.js +28 -89
- package/dist/core/artifact-graph/types.d.ts +0 -7
- package/dist/core/artifact-graph/types.js +0 -19
- package/dist/core/change-metadata/index.d.ts +2 -0
- package/dist/core/change-metadata/index.js +2 -0
- package/dist/core/change-metadata/schema.d.ts +18 -0
- package/dist/core/change-metadata/schema.js +28 -0
- package/dist/core/change-status-policy.d.ts +50 -0
- package/dist/core/change-status-policy.js +70 -0
- package/dist/core/collections/index.d.ts +3 -0
- package/dist/core/collections/index.js +3 -0
- package/dist/core/collections/initiatives/collection.d.ts +4 -0
- package/dist/core/collections/initiatives/collection.js +17 -0
- package/dist/core/collections/initiatives/index.d.ts +6 -0
- package/dist/core/collections/initiatives/index.js +6 -0
- package/dist/core/collections/initiatives/operations.d.ts +49 -0
- package/dist/core/collections/initiatives/operations.js +175 -0
- package/dist/core/collections/initiatives/resolution.d.ts +87 -0
- package/dist/core/collections/initiatives/resolution.js +374 -0
- package/dist/core/collections/initiatives/schema.d.ts +41 -0
- package/dist/core/collections/initiatives/schema.js +134 -0
- package/dist/core/collections/initiatives/templates.d.ts +12 -0
- package/dist/core/collections/initiatives/templates.js +90 -0
- package/dist/core/collections/runtime.d.ts +46 -0
- package/dist/core/collections/runtime.js +194 -0
- package/dist/core/completions/command-registry.d.ts +1 -5
- package/dist/core/completions/command-registry.js +475 -70
- package/dist/core/completions/shared-flags.d.ts +12 -0
- package/dist/core/completions/shared-flags.js +28 -0
- package/dist/core/config.js +2 -1
- package/dist/core/context-store/binding.d.ts +53 -0
- package/dist/core/context-store/binding.js +197 -0
- package/dist/core/context-store/errors.d.ts +20 -0
- package/dist/core/context-store/errors.js +22 -0
- package/dist/core/context-store/foundation.d.ts +55 -0
- package/dist/core/context-store/foundation.js +321 -0
- package/dist/core/context-store/index.d.ts +6 -0
- package/dist/core/context-store/index.js +6 -0
- package/dist/core/context-store/operations.d.ts +85 -0
- package/dist/core/context-store/operations.js +528 -0
- package/dist/core/context-store/registry.d.ts +45 -0
- package/dist/core/context-store/registry.js +229 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +2 -0
- package/dist/core/planning-home.js +5 -21
- package/dist/core/validation/validator.d.ts +11 -0
- package/dist/core/validation/validator.js +19 -2
- package/dist/core/workspace/foundation.d.ts +28 -48
- package/dist/core/workspace/foundation.js +130 -214
- package/dist/core/workspace/index.d.ts +2 -0
- package/dist/core/workspace/index.js +2 -0
- package/dist/core/workspace/legacy-state.d.ts +28 -0
- package/dist/core/workspace/legacy-state.js +200 -0
- package/dist/core/workspace/open-surface.d.ts +29 -8
- package/dist/core/workspace/open-surface.js +122 -44
- package/dist/core/workspace/openers.js +11 -6
- package/dist/core/workspace/registry.d.ts +24 -0
- package/dist/core/workspace/registry.js +146 -0
- package/dist/core/workspace/skills.d.ts +4 -2
- package/dist/core/workspace/skills.js +2 -2
- package/dist/core/workspace/state-io.d.ts +10 -0
- package/dist/core/workspace/state-io.js +119 -0
- package/dist/utils/change-metadata.d.ts +5 -2
- package/dist/utils/change-metadata.js +6 -12
- package/dist/utils/change-utils.d.ts +2 -2
- package/package.json +17 -19
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FlagDefinition } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Common flags used across multiple commands.
|
|
4
|
+
*/
|
|
5
|
+
export declare const COMMON_FLAGS: {
|
|
6
|
+
readonly json: FlagDefinition;
|
|
7
|
+
readonly jsonValidation: FlagDefinition;
|
|
8
|
+
readonly strict: FlagDefinition;
|
|
9
|
+
readonly noInteractive: FlagDefinition;
|
|
10
|
+
readonly type: FlagDefinition;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=shared-flags.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common flags used across multiple commands.
|
|
3
|
+
*/
|
|
4
|
+
export const COMMON_FLAGS = {
|
|
5
|
+
json: {
|
|
6
|
+
name: 'json',
|
|
7
|
+
description: 'Output as JSON',
|
|
8
|
+
},
|
|
9
|
+
jsonValidation: {
|
|
10
|
+
name: 'json',
|
|
11
|
+
description: 'Output validation results as JSON',
|
|
12
|
+
},
|
|
13
|
+
strict: {
|
|
14
|
+
name: 'strict',
|
|
15
|
+
description: 'Enable strict validation mode',
|
|
16
|
+
},
|
|
17
|
+
noInteractive: {
|
|
18
|
+
name: 'no-interactive',
|
|
19
|
+
description: 'Disable interactive prompts',
|
|
20
|
+
},
|
|
21
|
+
type: {
|
|
22
|
+
name: 'type',
|
|
23
|
+
description: 'Specify item type when ambiguous',
|
|
24
|
+
takesValue: true,
|
|
25
|
+
values: ['change', 'spec'],
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=shared-flags.js.map
|
package/dist/core/config.js
CHANGED
|
@@ -25,10 +25,11 @@ export const AI_TOOLS = [
|
|
|
25
25
|
{ name: 'Kilo Code', value: 'kilocode', available: true, successLabel: 'Kilo Code', skillsDir: '.kilocode' },
|
|
26
26
|
{ name: 'Kimi CLI', value: 'kimi', available: true, successLabel: 'Kimi CLI', skillsDir: '.kimi' },
|
|
27
27
|
{ name: 'Kiro', value: 'kiro', available: true, successLabel: 'Kiro', skillsDir: '.kiro' },
|
|
28
|
+
{ name: 'Lingma', value: 'lingma', available: true, successLabel: 'Lingma', skillsDir: '.lingma' },
|
|
29
|
+
{ name: 'Mistral Vibe', value: 'vibe', available: true, successLabel: 'Mistral Vibe', skillsDir: '.vibe' },
|
|
28
30
|
{ name: 'OpenCode', value: 'opencode', available: true, successLabel: 'OpenCode', skillsDir: '.opencode' },
|
|
29
31
|
{ name: 'Pi', value: 'pi', available: true, successLabel: 'Pi', skillsDir: '.pi' },
|
|
30
32
|
{ name: 'Qoder', value: 'qoder', available: true, successLabel: 'Qoder', skillsDir: '.qoder' },
|
|
31
|
-
{ name: 'Lingma', value: 'lingma', available: true, successLabel: 'Lingma', skillsDir: '.lingma' },
|
|
32
33
|
{ name: 'Qwen Code', value: 'qwen', available: true, successLabel: 'Qwen Code', skillsDir: '.qwen' },
|
|
33
34
|
{ name: 'RooCode', value: 'roocode', available: true, successLabel: 'RooCode', skillsDir: '.roo' },
|
|
34
35
|
{ name: 'Trae', value: 'trae', available: true, successLabel: 'Trae', skillsDir: '.trae' },
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type ContextStorePathOptions } from './foundation.js';
|
|
2
|
+
import { type ResolvedContextStore } from './registry.js';
|
|
3
|
+
export type ContextStoreSelector = {
|
|
4
|
+
kind: 'registry';
|
|
5
|
+
id: string;
|
|
6
|
+
} | {
|
|
7
|
+
kind: 'path';
|
|
8
|
+
path: string;
|
|
9
|
+
observed_id?: string;
|
|
10
|
+
};
|
|
11
|
+
export type ContextStoreSelectorSource = 'registry' | 'path';
|
|
12
|
+
export interface ContextStoreSelectorOptions {
|
|
13
|
+
store?: string;
|
|
14
|
+
storePath?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface SelectedContextStore {
|
|
17
|
+
id: string;
|
|
18
|
+
root: string;
|
|
19
|
+
source: ContextStoreSelectorSource;
|
|
20
|
+
}
|
|
21
|
+
export interface ContextStoreBinding {
|
|
22
|
+
id: string;
|
|
23
|
+
selector: ContextStoreSelector;
|
|
24
|
+
}
|
|
25
|
+
export interface ContextStoreBindingWarning {
|
|
26
|
+
code: string;
|
|
27
|
+
message: string;
|
|
28
|
+
target?: string;
|
|
29
|
+
fix?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface ResolvedContextStoreBinding {
|
|
32
|
+
binding: ContextStoreBinding;
|
|
33
|
+
id: string;
|
|
34
|
+
root: string;
|
|
35
|
+
source: 'registry' | 'path';
|
|
36
|
+
registered?: ResolvedContextStore;
|
|
37
|
+
warnings: ContextStoreBindingWarning[];
|
|
38
|
+
}
|
|
39
|
+
export declare function createRegisteredContextStoreBinding(id: string): ContextStoreBinding;
|
|
40
|
+
export declare function createPathContextStoreBinding(input: {
|
|
41
|
+
id: string;
|
|
42
|
+
path: string;
|
|
43
|
+
}): ContextStoreBinding;
|
|
44
|
+
export declare function normalizeContextStoreBinding(binding: ContextStoreBinding): ContextStoreBinding;
|
|
45
|
+
export declare function sameContextStoreBinding(left: ContextStoreBinding, right: ContextStoreBinding): boolean;
|
|
46
|
+
export declare function formatContextStoreBinding(binding: ContextStoreBinding): string;
|
|
47
|
+
export declare function formatContextStoreBindingSelector(binding: ContextStoreBinding): string;
|
|
48
|
+
export declare function formatContextStoreSelector(selected: SelectedContextStore): string;
|
|
49
|
+
export declare function createContextStoreBindingFromSelected(selected: SelectedContextStore): ContextStoreBinding;
|
|
50
|
+
export declare function requireContextStoreSelector(options: ContextStoreSelectorOptions, commandName: string): void;
|
|
51
|
+
export declare function resolveSelectedContextStore(options: ContextStoreSelectorOptions, commandName: string, pathOptions?: ContextStorePathOptions): Promise<SelectedContextStore>;
|
|
52
|
+
export declare function resolveContextStoreBinding(binding: ContextStoreBinding, options?: ContextStorePathOptions): Promise<ResolvedContextStoreBinding>;
|
|
53
|
+
//# sourceMappingURL=binding.d.ts.map
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { getContextStoreMetadataPath, readOptionalContextStoreMetadataState, resolveGitContextStoreBackendConfig, validateContextStoreId, } from './foundation.js';
|
|
2
|
+
import { ContextStoreError } from './errors.js';
|
|
3
|
+
import { resolveRegisteredContextStore, } from './registry.js';
|
|
4
|
+
export function createRegisteredContextStoreBinding(id) {
|
|
5
|
+
const validatedId = validateContextStoreId(id);
|
|
6
|
+
return {
|
|
7
|
+
id: validatedId,
|
|
8
|
+
selector: {
|
|
9
|
+
kind: 'registry',
|
|
10
|
+
id: validatedId,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export function createPathContextStoreBinding(input) {
|
|
15
|
+
const id = validateContextStoreId(input.id);
|
|
16
|
+
if (input.path.length === 0) {
|
|
17
|
+
throw new Error('Context store binding path must not be empty.');
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
id,
|
|
21
|
+
selector: {
|
|
22
|
+
kind: 'path',
|
|
23
|
+
path: input.path,
|
|
24
|
+
observed_id: id,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export function normalizeContextStoreBinding(binding) {
|
|
29
|
+
const id = validateContextStoreId(binding.id);
|
|
30
|
+
if (binding.selector.kind === 'registry') {
|
|
31
|
+
return createRegisteredContextStoreBinding(binding.selector.id);
|
|
32
|
+
}
|
|
33
|
+
if (binding.selector.path.length === 0) {
|
|
34
|
+
throw new Error('Context store binding path must not be empty.');
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
id,
|
|
38
|
+
selector: {
|
|
39
|
+
kind: 'path',
|
|
40
|
+
path: binding.selector.path,
|
|
41
|
+
...(binding.selector.observed_id
|
|
42
|
+
? { observed_id: validateContextStoreId(binding.selector.observed_id) }
|
|
43
|
+
: {}),
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function sameContextStoreBinding(left, right) {
|
|
48
|
+
const normalizedLeft = normalizeContextStoreBinding(left);
|
|
49
|
+
const normalizedRight = normalizeContextStoreBinding(right);
|
|
50
|
+
if (normalizedLeft.selector.kind !== normalizedRight.selector.kind) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
if (normalizedLeft.selector.kind === 'registry' &&
|
|
54
|
+
normalizedRight.selector.kind === 'registry') {
|
|
55
|
+
return normalizedLeft.selector.id === normalizedRight.selector.id;
|
|
56
|
+
}
|
|
57
|
+
if (normalizedLeft.selector.kind === 'path' &&
|
|
58
|
+
normalizedRight.selector.kind === 'path') {
|
|
59
|
+
return normalizedLeft.selector.path === normalizedRight.selector.path;
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
export function formatContextStoreBinding(binding) {
|
|
64
|
+
const normalized = normalizeContextStoreBinding(binding);
|
|
65
|
+
if (normalized.selector.kind === 'registry') {
|
|
66
|
+
return normalized.selector.id;
|
|
67
|
+
}
|
|
68
|
+
return `${normalized.id} via ${normalized.selector.path}`;
|
|
69
|
+
}
|
|
70
|
+
export function formatContextStoreBindingSelector(binding) {
|
|
71
|
+
const normalized = normalizeContextStoreBinding(binding);
|
|
72
|
+
return normalized.selector.kind === 'registry'
|
|
73
|
+
? `--store ${normalized.selector.id}`
|
|
74
|
+
: `--store-path ${normalized.selector.path}`;
|
|
75
|
+
}
|
|
76
|
+
export function formatContextStoreSelector(selected) {
|
|
77
|
+
return selected.source === 'registry'
|
|
78
|
+
? `--store ${selected.id}`
|
|
79
|
+
: `--store-path ${selected.root}`;
|
|
80
|
+
}
|
|
81
|
+
export function createContextStoreBindingFromSelected(selected) {
|
|
82
|
+
return selected.source === 'registry'
|
|
83
|
+
? createRegisteredContextStoreBinding(selected.id)
|
|
84
|
+
: createPathContextStoreBinding({
|
|
85
|
+
id: selected.id,
|
|
86
|
+
path: selected.root,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function validateSelectorConflict(options, commandName) {
|
|
90
|
+
if (options.store !== undefined && options.storePath !== undefined) {
|
|
91
|
+
throw new ContextStoreError('Pass either --store <id> or --store-path <path>, not both.', 'context_store_selector_conflict', {
|
|
92
|
+
target: 'context_store',
|
|
93
|
+
fix: `openspec ${commandName} --store <id>`,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
export function requireContextStoreSelector(options, commandName) {
|
|
98
|
+
validateSelectorConflict(options, commandName);
|
|
99
|
+
if (options.store === undefined && options.storePath === undefined) {
|
|
100
|
+
throw new ContextStoreError('Pass --store <id> or --store-path <path>.', 'context_store_required', {
|
|
101
|
+
target: 'context_store',
|
|
102
|
+
fix: `openspec ${commandName} --store <id>`,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export async function resolveSelectedContextStore(options, commandName, pathOptions = {}) {
|
|
107
|
+
requireContextStoreSelector(options, commandName);
|
|
108
|
+
if (options.store !== undefined) {
|
|
109
|
+
const resolved = await resolveRegisteredContextStore({
|
|
110
|
+
id: options.store,
|
|
111
|
+
globalDataDir: pathOptions.globalDataDir,
|
|
112
|
+
});
|
|
113
|
+
return {
|
|
114
|
+
id: resolved.id,
|
|
115
|
+
root: resolved.storeRoot,
|
|
116
|
+
source: 'registry',
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
const storePath = options.storePath ?? '';
|
|
120
|
+
let root;
|
|
121
|
+
try {
|
|
122
|
+
const backend = await resolveGitContextStoreBackendConfig({
|
|
123
|
+
localPath: storePath,
|
|
124
|
+
});
|
|
125
|
+
root = backend.local_path;
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
throw new ContextStoreError(error instanceof Error ? error.message : String(error), 'invalid_context_store_path', {
|
|
129
|
+
target: 'context_store.path',
|
|
130
|
+
fix: 'Pass an existing context store root.',
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
let metadata;
|
|
134
|
+
try {
|
|
135
|
+
metadata = await readOptionalContextStoreMetadataState(root);
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
throw new ContextStoreError(error instanceof Error ? error.message : String(error), 'invalid_context_store_metadata', {
|
|
139
|
+
target: 'context_store.metadata',
|
|
140
|
+
fix: `Fix ${getContextStoreMetadataPath(root)} before using this store.`,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
if (!metadata) {
|
|
144
|
+
throw new ContextStoreError(`Context store metadata not found at ${getContextStoreMetadataPath(root)}`, 'context_store_metadata_not_found', {
|
|
145
|
+
target: 'context_store.metadata',
|
|
146
|
+
fix: 'Pass a context store root that contains .openspec-store/store.yaml.',
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
id: metadata.id,
|
|
151
|
+
root,
|
|
152
|
+
source: 'path',
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
export async function resolveContextStoreBinding(binding, options = {}) {
|
|
156
|
+
const normalized = normalizeContextStoreBinding(binding);
|
|
157
|
+
if (normalized.selector.kind === 'registry') {
|
|
158
|
+
const registered = await resolveRegisteredContextStore({
|
|
159
|
+
id: normalized.selector.id,
|
|
160
|
+
globalDataDir: options.globalDataDir,
|
|
161
|
+
});
|
|
162
|
+
return {
|
|
163
|
+
binding: normalized,
|
|
164
|
+
id: registered.id,
|
|
165
|
+
root: registered.storeRoot,
|
|
166
|
+
source: 'registry',
|
|
167
|
+
registered,
|
|
168
|
+
warnings: [],
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
const backend = await resolveGitContextStoreBackendConfig({
|
|
172
|
+
localPath: normalized.selector.path,
|
|
173
|
+
});
|
|
174
|
+
const root = backend.local_path;
|
|
175
|
+
const metadata = await readOptionalContextStoreMetadataState(root);
|
|
176
|
+
if (!metadata) {
|
|
177
|
+
throw new Error(`Context store metadata not found at ${getContextStoreMetadataPath(root)}`);
|
|
178
|
+
}
|
|
179
|
+
const warnings = [];
|
|
180
|
+
const observedId = normalized.selector.observed_id ?? normalized.id;
|
|
181
|
+
if (metadata.id !== observedId) {
|
|
182
|
+
warnings.push({
|
|
183
|
+
code: 'context_store_binding_id_changed',
|
|
184
|
+
message: `Context store at ${root} now reports id '${metadata.id}' instead of '${observedId}'.`,
|
|
185
|
+
target: 'metadata.id',
|
|
186
|
+
fix: `Review ${getContextStoreMetadataPath(root)} or re-open the workspace with the intended context store.`,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
return {
|
|
190
|
+
binding: normalized,
|
|
191
|
+
id: metadata.id,
|
|
192
|
+
root,
|
|
193
|
+
source: 'path',
|
|
194
|
+
warnings,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=binding.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type ContextStoreDiagnosticSeverity = 'error' | 'warning';
|
|
2
|
+
export interface ContextStoreDiagnostic {
|
|
3
|
+
severity: ContextStoreDiagnosticSeverity;
|
|
4
|
+
code: string;
|
|
5
|
+
message: string;
|
|
6
|
+
target?: string;
|
|
7
|
+
fix?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class ContextStoreError extends Error {
|
|
10
|
+
readonly diagnostic: ContextStoreDiagnostic;
|
|
11
|
+
constructor(message: string, code: string, options?: {
|
|
12
|
+
target?: string;
|
|
13
|
+
fix?: string;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export declare function makeContextStoreDiagnostic(severity: ContextStoreDiagnosticSeverity, code: string, message: string, options?: {
|
|
17
|
+
target?: string;
|
|
18
|
+
fix?: string;
|
|
19
|
+
}): ContextStoreDiagnostic;
|
|
20
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export class ContextStoreError extends Error {
|
|
2
|
+
diagnostic;
|
|
3
|
+
constructor(message, code, options = {}) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = 'ContextStoreError';
|
|
6
|
+
this.diagnostic = {
|
|
7
|
+
severity: 'error',
|
|
8
|
+
code,
|
|
9
|
+
message,
|
|
10
|
+
...options,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function makeContextStoreDiagnostic(severity, code, message, options = {}) {
|
|
15
|
+
return {
|
|
16
|
+
severity,
|
|
17
|
+
code,
|
|
18
|
+
message,
|
|
19
|
+
...options,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export declare const CONTEXT_STORE_METADATA_DIR_NAME = ".openspec-store";
|
|
2
|
+
export declare const CONTEXT_STORE_METADATA_FILE_NAME = "store.yaml";
|
|
3
|
+
export declare const CONTEXT_STORES_DIR_NAME = "context-stores";
|
|
4
|
+
export declare const CONTEXT_STORE_REGISTRY_FILE_NAME = "registry.yaml";
|
|
5
|
+
export interface ContextStorePathOptions {
|
|
6
|
+
globalDataDir?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ContextStoreGitBackendConfig {
|
|
9
|
+
type: 'git';
|
|
10
|
+
local_path: string;
|
|
11
|
+
remote?: string;
|
|
12
|
+
branch?: string;
|
|
13
|
+
}
|
|
14
|
+
export type ContextStoreBackendConfig = ContextStoreGitBackendConfig;
|
|
15
|
+
export interface ContextStoreRegistryEntryState {
|
|
16
|
+
backend: ContextStoreBackendConfig;
|
|
17
|
+
}
|
|
18
|
+
export interface ContextStoreRegistryState {
|
|
19
|
+
version: 1;
|
|
20
|
+
stores: Record<string, ContextStoreRegistryEntryState>;
|
|
21
|
+
}
|
|
22
|
+
export interface ContextStoreRegistryEntry {
|
|
23
|
+
id: string;
|
|
24
|
+
backend: ContextStoreBackendConfig;
|
|
25
|
+
}
|
|
26
|
+
export interface ContextStoreMetadataState {
|
|
27
|
+
version: 1;
|
|
28
|
+
id: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ResolveGitContextStoreBackendInput {
|
|
31
|
+
localPath: string;
|
|
32
|
+
remote?: string;
|
|
33
|
+
branch?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare function getContextStoresDir(options?: ContextStorePathOptions): string;
|
|
36
|
+
export declare function getContextStoreRegistryPath(options?: ContextStorePathOptions): string;
|
|
37
|
+
export declare function getDefaultContextStoreRoot(id: string, options?: ContextStorePathOptions): string;
|
|
38
|
+
export declare function getContextStoreMetadataDir(storeRoot: string): string;
|
|
39
|
+
export declare function getContextStoreMetadataPath(storeRoot: string): string;
|
|
40
|
+
export declare function validateContextStoreId(id: string): string;
|
|
41
|
+
export declare function isValidContextStoreId(id: string): boolean;
|
|
42
|
+
export declare function parseContextStoreRegistryState(content: string): ContextStoreRegistryState;
|
|
43
|
+
export declare function parseContextStoreMetadataState(content: string): ContextStoreMetadataState;
|
|
44
|
+
export declare function serializeContextStoreRegistryState(state: ContextStoreRegistryState): string;
|
|
45
|
+
export declare function serializeContextStoreMetadataState(state: ContextStoreMetadataState): string;
|
|
46
|
+
export declare function listContextStoreRegistryEntries(registry: ContextStoreRegistryState): ContextStoreRegistryEntry[];
|
|
47
|
+
export declare function isContextStoreRoot(candidateRoot: string): Promise<boolean>;
|
|
48
|
+
export declare function readContextStoreRegistryState(options?: ContextStorePathOptions): Promise<ContextStoreRegistryState | null>;
|
|
49
|
+
export declare function writeContextStoreRegistryState(state: ContextStoreRegistryState, options?: ContextStorePathOptions): Promise<void>;
|
|
50
|
+
export declare function updateContextStoreRegistryState(updater: (state: ContextStoreRegistryState | null) => ContextStoreRegistryState | Promise<ContextStoreRegistryState>, options?: ContextStorePathOptions): Promise<ContextStoreRegistryState>;
|
|
51
|
+
export declare function readContextStoreMetadataState(storeRoot: string): Promise<ContextStoreMetadataState>;
|
|
52
|
+
export declare function readOptionalContextStoreMetadataState(storeRoot: string): Promise<ContextStoreMetadataState | null>;
|
|
53
|
+
export declare function writeContextStoreMetadataState(storeRoot: string, state: ContextStoreMetadataState): Promise<void>;
|
|
54
|
+
export declare function resolveGitContextStoreBackendConfig(input: ResolveGitContextStoreBackendInput, cwd?: string): Promise<ContextStoreGitBackendConfig>;
|
|
55
|
+
//# sourceMappingURL=foundation.d.ts.map
|