specweave 0.30.1 → 0.30.3
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/bin/specweave.js +1 -0
- package/dist/plugins/specweave-ado/lib/ado-permission-gate.d.ts +113 -0
- package/dist/plugins/specweave-ado/lib/ado-permission-gate.d.ts.map +1 -0
- package/dist/plugins/specweave-ado/lib/ado-permission-gate.js +169 -0
- package/dist/plugins/specweave-ado/lib/ado-permission-gate.js.map +1 -0
- package/dist/plugins/specweave-ado/lib/ado-profile-resolver.d.ts +137 -0
- package/dist/plugins/specweave-ado/lib/ado-profile-resolver.d.ts.map +1 -0
- package/dist/plugins/specweave-ado/lib/ado-profile-resolver.js +200 -0
- package/dist/plugins/specweave-ado/lib/ado-profile-resolver.js.map +1 -0
- package/dist/src/cli/commands/init.d.ts.map +1 -1
- package/dist/src/cli/commands/init.js +7 -4
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/sync-scheduled.d.ts.map +1 -1
- package/dist/src/cli/commands/sync-scheduled.js +1 -0
- package/dist/src/cli/commands/sync-scheduled.js.map +1 -1
- package/dist/src/cli/helpers/init/living-docs-preflight.d.ts +7 -0
- package/dist/src/cli/helpers/init/living-docs-preflight.d.ts.map +1 -1
- package/dist/src/cli/helpers/init/living-docs-preflight.js +116 -17
- package/dist/src/cli/helpers/init/living-docs-preflight.js.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/sync-config-writer.d.ts +3 -1
- package/dist/src/cli/helpers/issue-tracker/sync-config-writer.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/sync-config-writer.js +9 -7
- package/dist/src/cli/helpers/issue-tracker/sync-config-writer.js.map +1 -1
- package/dist/src/core/background/job-launcher.d.ts +5 -0
- package/dist/src/core/background/job-launcher.d.ts.map +1 -1
- package/dist/src/core/background/job-launcher.js +14 -3
- package/dist/src/core/background/job-launcher.js.map +1 -1
- package/dist/src/core/errors/index.d.ts +174 -0
- package/dist/src/core/errors/index.d.ts.map +1 -0
- package/dist/src/core/errors/index.js +238 -0
- package/dist/src/core/errors/index.js.map +1 -0
- package/dist/src/core/living-docs/hierarchy-mapper.d.ts +39 -16
- package/dist/src/core/living-docs/hierarchy-mapper.d.ts.map +1 -1
- package/dist/src/core/living-docs/hierarchy-mapper.js +82 -39
- package/dist/src/core/living-docs/hierarchy-mapper.js.map +1 -1
- package/dist/src/core/scheduler/session-sync-executor.d.ts +3 -0
- package/dist/src/core/scheduler/session-sync-executor.d.ts.map +1 -1
- package/dist/src/core/scheduler/session-sync-executor.js +27 -2
- package/dist/src/core/scheduler/session-sync-executor.js.map +1 -1
- package/dist/src/core/specs/spec-metadata-manager.d.ts +5 -1
- package/dist/src/core/specs/spec-metadata-manager.d.ts.map +1 -1
- package/dist/src/core/specs/spec-metadata-manager.js +4 -2
- package/dist/src/core/specs/spec-metadata-manager.js.map +1 -1
- package/dist/src/importers/item-converter.d.ts +10 -1
- package/dist/src/importers/item-converter.d.ts.map +1 -1
- package/dist/src/importers/item-converter.js +92 -65
- package/dist/src/importers/item-converter.js.map +1 -1
- package/dist/src/importers/markdown-generator.d.ts +13 -0
- package/dist/src/importers/markdown-generator.d.ts.map +1 -1
- package/dist/src/importers/markdown-generator.js +16 -4
- package/dist/src/importers/markdown-generator.js.map +1 -1
- package/dist/src/integrations/ado/ado-client-factory.d.ts +102 -0
- package/dist/src/integrations/ado/ado-client-factory.d.ts.map +1 -0
- package/dist/src/integrations/ado/ado-client-factory.js +115 -0
- package/dist/src/integrations/ado/ado-client-factory.js.map +1 -0
- package/dist/src/integrations/ado/ado-client.d.ts +24 -1
- package/dist/src/integrations/ado/ado-client.d.ts.map +1 -1
- package/dist/src/integrations/ado/ado-client.js +48 -17
- package/dist/src/integrations/ado/ado-client.js.map +1 -1
- package/dist/src/integrations/ado/ado-pat-provider.d.ts +45 -0
- package/dist/src/integrations/ado/ado-pat-provider.d.ts.map +1 -0
- package/dist/src/integrations/ado/ado-pat-provider.js +70 -0
- package/dist/src/integrations/ado/ado-pat-provider.js.map +1 -0
- package/dist/src/integrations/jira/jira-client.d.ts +5 -0
- package/dist/src/integrations/jira/jira-client.d.ts.map +1 -1
- package/dist/src/integrations/jira/jira-client.js +24 -13
- package/dist/src/integrations/jira/jira-client.js.map +1 -1
- package/dist/src/integrations/jira/jira-incremental-mapper.d.ts +5 -0
- package/dist/src/integrations/jira/jira-incremental-mapper.d.ts.map +1 -1
- package/dist/src/integrations/jira/jira-incremental-mapper.js +13 -2
- package/dist/src/integrations/jira/jira-incremental-mapper.js.map +1 -1
- package/dist/src/integrations/jira/jira-mapper.d.ts +5 -0
- package/dist/src/integrations/jira/jira-mapper.d.ts.map +1 -1
- package/dist/src/integrations/jira/jira-mapper.js +14 -3
- package/dist/src/integrations/jira/jira-mapper.js.map +1 -1
- package/dist/src/living-docs/epic-id-allocator.d.ts +31 -9
- package/dist/src/living-docs/epic-id-allocator.d.ts.map +1 -1
- package/dist/src/living-docs/epic-id-allocator.js +38 -12
- package/dist/src/living-docs/epic-id-allocator.js.map +1 -1
- package/dist/src/sync/sync-coordinator.d.ts +11 -0
- package/dist/src/sync/sync-coordinator.d.ts.map +1 -1
- package/dist/src/sync/sync-coordinator.js +80 -3
- package/dist/src/sync/sync-coordinator.js.map +1 -1
- package/dist/src/testing/test-generator.d.ts +5 -0
- package/dist/src/testing/test-generator.d.ts.map +1 -1
- package/dist/src/testing/test-generator.js +17 -6
- package/dist/src/testing/test-generator.js.map +1 -1
- package/dist/src/utils/fs-native.d.ts +5 -2
- package/dist/src/utils/fs-native.d.ts.map +1 -1
- package/dist/src/utils/fs-native.js +6 -2
- package/dist/src/utils/fs-native.js.map +1 -1
- package/dist/src/utils/logger.d.ts +5 -1
- package/dist/src/utils/logger.d.ts.map +1 -1
- package/dist/src/utils/logger.js +6 -3
- package/dist/src/utils/logger.js.map +1 -1
- package/package.json +1 -1
- package/plugins/specweave/lib/vendor/utils/fs-native.d.ts +5 -2
- package/plugins/specweave/lib/vendor/utils/fs-native.js +6 -2
- package/plugins/specweave/lib/vendor/utils/fs-native.js.map +1 -1
- package/plugins/specweave/lib/vendor/utils/logger.d.ts +5 -1
- package/plugins/specweave/lib/vendor/utils/logger.js +6 -3
- package/plugins/specweave/lib/vendor/utils/logger.js.map +1 -1
- package/plugins/specweave-ado/agents/ado-manager/AGENT.md +62 -4
- package/plugins/specweave-ado/commands/specweave-ado-close-workitem.md +197 -12
- package/plugins/specweave-ado/commands/specweave-ado-create-workitem.md +148 -24
- package/plugins/specweave-ado/commands/specweave-ado-sync.md +170 -77
- package/plugins/specweave-ado/lib/ado-permission-gate.js +127 -0
- package/plugins/specweave-ado/lib/ado-permission-gate.ts +231 -0
- package/plugins/specweave-ado/lib/ado-profile-resolver.js +153 -0
- package/plugins/specweave-ado/lib/ado-profile-resolver.ts +323 -0
- package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +84 -0
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +126 -0
package/bin/specweave.js
CHANGED
|
@@ -38,6 +38,7 @@ program
|
|
|
38
38
|
.option('-l, --language <lang>', 'Language for generated content (en, ru, es, zh, de, fr, ja, ko, pt)')
|
|
39
39
|
.option('-f, --force', 'Force fresh start (non-interactive, removes existing .specweave)', false)
|
|
40
40
|
.option('--force-refresh', 'Force marketplace refresh (skip cache, always pull latest)', false)
|
|
41
|
+
.option('--no-living-docs', 'Skip living docs builder setup')
|
|
41
42
|
.action(async (projectName, options) => {
|
|
42
43
|
const { initCommand } = await import('../dist/src/cli/commands/init.js');
|
|
43
44
|
await initCommand(projectName, options);
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADO Permission Gate
|
|
3
|
+
*
|
|
4
|
+
* Validates that sync permissions are enabled before allowing ADO write operations.
|
|
5
|
+
* This ensures manual ADO commands respect the same permission settings as the
|
|
6
|
+
* sync-coordinator.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const gate = await createAdoPermissionGate();
|
|
11
|
+
* const result = gate.checkWritePermission();
|
|
12
|
+
* if (!result.allowed) {
|
|
13
|
+
* console.log(result.reason);
|
|
14
|
+
* return;
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @module ado-permission-gate
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Permission check result
|
|
22
|
+
*/
|
|
23
|
+
export interface PermissionCheckResult {
|
|
24
|
+
/**
|
|
25
|
+
* Whether the operation is allowed
|
|
26
|
+
*/
|
|
27
|
+
allowed: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Human-readable reason for the decision
|
|
30
|
+
*/
|
|
31
|
+
reason: string;
|
|
32
|
+
/**
|
|
33
|
+
* Suggested action if permission denied
|
|
34
|
+
*/
|
|
35
|
+
suggestedAction?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Which setting controls this permission
|
|
38
|
+
*/
|
|
39
|
+
settingPath?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Sync settings from config.json
|
|
43
|
+
*/
|
|
44
|
+
export interface SyncSettings {
|
|
45
|
+
canUpsertInternalItems: boolean;
|
|
46
|
+
canUpdateExternalItems: boolean;
|
|
47
|
+
canUpdateStatus: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Default settings (all disabled for safety)
|
|
51
|
+
*/
|
|
52
|
+
export declare const DEFAULT_SYNC_SETTINGS: SyncSettings;
|
|
53
|
+
/**
|
|
54
|
+
* ADO Permission Gate
|
|
55
|
+
*
|
|
56
|
+
* Checks permission settings before allowing ADO write operations.
|
|
57
|
+
*/
|
|
58
|
+
export declare class AdoPermissionGate {
|
|
59
|
+
private settings;
|
|
60
|
+
private configPath;
|
|
61
|
+
constructor(settings: SyncSettings, configPath: string);
|
|
62
|
+
/**
|
|
63
|
+
* Check if write operations (create/update work items) are allowed
|
|
64
|
+
*
|
|
65
|
+
* Requires: canUpdateExternalItems = true
|
|
66
|
+
*/
|
|
67
|
+
checkWritePermission(): PermissionCheckResult;
|
|
68
|
+
/**
|
|
69
|
+
* Check if status updates are allowed
|
|
70
|
+
*
|
|
71
|
+
* Requires: canUpdateStatus = true
|
|
72
|
+
*/
|
|
73
|
+
checkStatusPermission(): PermissionCheckResult;
|
|
74
|
+
/**
|
|
75
|
+
* Check if internal item creation is allowed
|
|
76
|
+
*
|
|
77
|
+
* Requires: canUpsertInternalItems = true
|
|
78
|
+
*/
|
|
79
|
+
checkCreateInternalPermission(): PermissionCheckResult;
|
|
80
|
+
/**
|
|
81
|
+
* Get current settings
|
|
82
|
+
*/
|
|
83
|
+
getSettings(): SyncSettings;
|
|
84
|
+
/**
|
|
85
|
+
* Get human-readable permission summary
|
|
86
|
+
*/
|
|
87
|
+
getPermissionSummary(): string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Create an AdoPermissionGate from config.json
|
|
91
|
+
*
|
|
92
|
+
* @param projectRoot - Project root directory (defaults to cwd)
|
|
93
|
+
* @returns AdoPermissionGate instance
|
|
94
|
+
*/
|
|
95
|
+
export declare function createAdoPermissionGate(projectRoot?: string): Promise<AdoPermissionGate>;
|
|
96
|
+
/**
|
|
97
|
+
* Quick check: Are ADO write operations allowed?
|
|
98
|
+
*
|
|
99
|
+
* Convenience function for simple permission checks.
|
|
100
|
+
*
|
|
101
|
+
* @param projectRoot - Project root directory
|
|
102
|
+
* @returns Permission check result
|
|
103
|
+
*/
|
|
104
|
+
export declare function canWriteToAdo(projectRoot?: string): Promise<PermissionCheckResult>;
|
|
105
|
+
/**
|
|
106
|
+
* Quick check: Are ADO status updates allowed?
|
|
107
|
+
*
|
|
108
|
+
* @param projectRoot - Project root directory
|
|
109
|
+
* @returns Permission check result
|
|
110
|
+
*/
|
|
111
|
+
export declare function canUpdateAdoStatus(projectRoot?: string): Promise<PermissionCheckResult>;
|
|
112
|
+
export default AdoPermissionGate;
|
|
113
|
+
//# sourceMappingURL=ado-permission-gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ado-permission-gate.d.ts","sourceRoot":"","sources":["../../../../plugins/specweave-ado/lib/ado-permission-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,sBAAsB,EAAE,OAAO,CAAC;IAChC,sBAAsB,EAAE,OAAO,CAAC;IAChC,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,YAInC,CAAC;AAEF;;;;GAIG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,UAAU,CAAS;gBAEf,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM;IAKtD;;;;OAIG;IACH,oBAAoB,IAAI,qBAAqB;IAgB7C;;;;OAIG;IACH,qBAAqB,IAAI,qBAAqB;IAgB9C;;;;OAIG;IACH,6BAA6B,IAAI,qBAAqB;IAgBtD;;OAEG;IACH,WAAW,IAAI,YAAY;IAI3B;;OAEG;IACH,oBAAoB,IAAI,MAAM;CAmB/B;AAED;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAC3C,WAAW,GAAE,MAAsB,GAClC,OAAO,CAAC,iBAAiB,CAAC,CAkB5B;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,WAAW,GAAE,MAAsB,GAClC,OAAO,CAAC,qBAAqB,CAAC,CAGhC;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,WAAW,GAAE,MAAsB,GAClC,OAAO,CAAC,qBAAqB,CAAC,CAGhC;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADO Permission Gate
|
|
3
|
+
*
|
|
4
|
+
* Validates that sync permissions are enabled before allowing ADO write operations.
|
|
5
|
+
* This ensures manual ADO commands respect the same permission settings as the
|
|
6
|
+
* sync-coordinator.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const gate = await createAdoPermissionGate();
|
|
11
|
+
* const result = gate.checkWritePermission();
|
|
12
|
+
* if (!result.allowed) {
|
|
13
|
+
* console.log(result.reason);
|
|
14
|
+
* return;
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @module ado-permission-gate
|
|
19
|
+
*/
|
|
20
|
+
import { promises as fs } from 'node:fs';
|
|
21
|
+
import * as path from 'node:path';
|
|
22
|
+
/**
|
|
23
|
+
* Default settings (all disabled for safety)
|
|
24
|
+
*/
|
|
25
|
+
export const DEFAULT_SYNC_SETTINGS = {
|
|
26
|
+
canUpsertInternalItems: false,
|
|
27
|
+
canUpdateExternalItems: false,
|
|
28
|
+
canUpdateStatus: false,
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* ADO Permission Gate
|
|
32
|
+
*
|
|
33
|
+
* Checks permission settings before allowing ADO write operations.
|
|
34
|
+
*/
|
|
35
|
+
export class AdoPermissionGate {
|
|
36
|
+
constructor(settings, configPath) {
|
|
37
|
+
this.settings = settings;
|
|
38
|
+
this.configPath = configPath;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Check if write operations (create/update work items) are allowed
|
|
42
|
+
*
|
|
43
|
+
* Requires: canUpdateExternalItems = true
|
|
44
|
+
*/
|
|
45
|
+
checkWritePermission() {
|
|
46
|
+
if (this.settings.canUpdateExternalItems) {
|
|
47
|
+
return {
|
|
48
|
+
allowed: true,
|
|
49
|
+
reason: 'Write operations permitted (canUpdateExternalItems=true)',
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
allowed: false,
|
|
54
|
+
reason: 'Permission denied: External tool updates are disabled.',
|
|
55
|
+
suggestedAction: `Enable sync.settings.canUpdateExternalItems in ${this.configPath}`,
|
|
56
|
+
settingPath: 'sync.settings.canUpdateExternalItems',
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Check if status updates are allowed
|
|
61
|
+
*
|
|
62
|
+
* Requires: canUpdateStatus = true
|
|
63
|
+
*/
|
|
64
|
+
checkStatusPermission() {
|
|
65
|
+
if (this.settings.canUpdateStatus) {
|
|
66
|
+
return {
|
|
67
|
+
allowed: true,
|
|
68
|
+
reason: 'Status updates permitted (canUpdateStatus=true)',
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
allowed: false,
|
|
73
|
+
reason: 'Permission denied: Status updates are disabled.',
|
|
74
|
+
suggestedAction: `Enable sync.settings.canUpdateStatus in ${this.configPath}`,
|
|
75
|
+
settingPath: 'sync.settings.canUpdateStatus',
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Check if internal item creation is allowed
|
|
80
|
+
*
|
|
81
|
+
* Requires: canUpsertInternalItems = true
|
|
82
|
+
*/
|
|
83
|
+
checkCreateInternalPermission() {
|
|
84
|
+
if (this.settings.canUpsertInternalItems) {
|
|
85
|
+
return {
|
|
86
|
+
allowed: true,
|
|
87
|
+
reason: 'Internal item creation permitted (canUpsertInternalItems=true)',
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
allowed: false,
|
|
92
|
+
reason: 'Permission denied: Creating internal items is disabled.',
|
|
93
|
+
suggestedAction: `Enable sync.settings.canUpsertInternalItems in ${this.configPath}`,
|
|
94
|
+
settingPath: 'sync.settings.canUpsertInternalItems',
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Get current settings
|
|
99
|
+
*/
|
|
100
|
+
getSettings() {
|
|
101
|
+
return { ...this.settings };
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get human-readable permission summary
|
|
105
|
+
*/
|
|
106
|
+
getPermissionSummary() {
|
|
107
|
+
const parts = [];
|
|
108
|
+
if (this.settings.canUpdateExternalItems) {
|
|
109
|
+
parts.push('create/update ADO items');
|
|
110
|
+
}
|
|
111
|
+
if (this.settings.canUpdateStatus) {
|
|
112
|
+
parts.push('update status');
|
|
113
|
+
}
|
|
114
|
+
if (this.settings.canUpsertInternalItems) {
|
|
115
|
+
parts.push('create internal items');
|
|
116
|
+
}
|
|
117
|
+
if (parts.length === 0) {
|
|
118
|
+
return 'All ADO write operations disabled (read-only mode)';
|
|
119
|
+
}
|
|
120
|
+
return `Allowed: ${parts.join(', ')}`;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Create an AdoPermissionGate from config.json
|
|
125
|
+
*
|
|
126
|
+
* @param projectRoot - Project root directory (defaults to cwd)
|
|
127
|
+
* @returns AdoPermissionGate instance
|
|
128
|
+
*/
|
|
129
|
+
export async function createAdoPermissionGate(projectRoot = process.cwd()) {
|
|
130
|
+
const configPath = path.join(projectRoot, '.specweave', 'config.json');
|
|
131
|
+
try {
|
|
132
|
+
const content = await fs.readFile(configPath, 'utf-8');
|
|
133
|
+
const config = JSON.parse(content);
|
|
134
|
+
const settings = {
|
|
135
|
+
canUpsertInternalItems: config?.sync?.settings?.canUpsertInternalItems ?? false,
|
|
136
|
+
canUpdateExternalItems: config?.sync?.settings?.canUpdateExternalItems ?? false,
|
|
137
|
+
canUpdateStatus: config?.sync?.settings?.canUpdateStatus ?? false,
|
|
138
|
+
};
|
|
139
|
+
return new AdoPermissionGate(settings, configPath);
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
// Return gate with default (disabled) settings if config not found
|
|
143
|
+
return new AdoPermissionGate(DEFAULT_SYNC_SETTINGS, configPath);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Quick check: Are ADO write operations allowed?
|
|
148
|
+
*
|
|
149
|
+
* Convenience function for simple permission checks.
|
|
150
|
+
*
|
|
151
|
+
* @param projectRoot - Project root directory
|
|
152
|
+
* @returns Permission check result
|
|
153
|
+
*/
|
|
154
|
+
export async function canWriteToAdo(projectRoot = process.cwd()) {
|
|
155
|
+
const gate = await createAdoPermissionGate(projectRoot);
|
|
156
|
+
return gate.checkWritePermission();
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Quick check: Are ADO status updates allowed?
|
|
160
|
+
*
|
|
161
|
+
* @param projectRoot - Project root directory
|
|
162
|
+
* @returns Permission check result
|
|
163
|
+
*/
|
|
164
|
+
export async function canUpdateAdoStatus(projectRoot = process.cwd()) {
|
|
165
|
+
const gate = await createAdoPermissionGate(projectRoot);
|
|
166
|
+
return gate.checkStatusPermission();
|
|
167
|
+
}
|
|
168
|
+
export default AdoPermissionGate;
|
|
169
|
+
//# sourceMappingURL=ado-permission-gate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ado-permission-gate.js","sourceRoot":"","sources":["../../../../plugins/specweave-ado/lib/ado-permission-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAoClC;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAiB;IACjD,sBAAsB,EAAE,KAAK;IAC7B,sBAAsB,EAAE,KAAK;IAC7B,eAAe,EAAE,KAAK;CACvB,CAAC;AAEF;;;;GAIG;AACH,MAAM,OAAO,iBAAiB;IAI5B,YAAY,QAAsB,EAAE,UAAkB;QACpD,IAAI,CA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AC;IAAC,MAAM,CAAC;QACP,mEAAmE;QACnE,OAAO,IAAI,iBAAiB,CAAC,qBAAqB,EAAE,UAAU,CAAC,CAAC;IAClE,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,cAAsB,OAAO,CAAC,GAAG,EAAE;IAEnC,MAAM,IAAI,GAAG,MAAM,uBAAuB,CAAC,WAAW,CAAC,CAAC;IACxD,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC;AACrC,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,cAAsB,OAAO,CAAC,GAAG,EAAE;IAEnC,MAAM,IAAI,GAAG,MAAM,uBAAuB,CAAC,WAAW,CAAC,CAAC;IACxD,OAAO,IAAI,CAAC,qBAAqB,EAAE,CAAC;AACtC,CAAC;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADO Profile Resolver
|
|
3
|
+
*
|
|
4
|
+
* Resolves the correct ADO profile to use for sync operations.
|
|
5
|
+
* Priority:
|
|
6
|
+
* 1. Increment's stored profile (metadata.json -> external_sync.ado.profile)
|
|
7
|
+
* 2. Global activeProfile (config.json -> sync.activeProfile)
|
|
8
|
+
*
|
|
9
|
+
* This allows each increment to sync to its designated ADO project
|
|
10
|
+
* without requiring manual activeProfile switching.
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const resolver = await createAdoProfileResolver();
|
|
15
|
+
* const profile = await resolver.resolveProfile('0093-my-increment');
|
|
16
|
+
* // profile contains organization, project, PAT, etc.
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @module ado-profile-resolver
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* ADO profile configuration
|
|
23
|
+
*/
|
|
24
|
+
export interface AdoProfileConfig {
|
|
25
|
+
/**
|
|
26
|
+
* Profile name (for display/logging)
|
|
27
|
+
*/
|
|
28
|
+
profileName: string;
|
|
29
|
+
/**
|
|
30
|
+
* ADO organization name
|
|
31
|
+
*/
|
|
32
|
+
organization: string;
|
|
33
|
+
/**
|
|
34
|
+
* ADO project name
|
|
35
|
+
*/
|
|
36
|
+
project: string;
|
|
37
|
+
/**
|
|
38
|
+
* Display name (optional)
|
|
39
|
+
*/
|
|
40
|
+
displayName?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Area path (optional)
|
|
43
|
+
*/
|
|
44
|
+
areaPath?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Iteration path (optional)
|
|
47
|
+
*/
|
|
48
|
+
iterationPath?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Profile resolution result
|
|
52
|
+
*/
|
|
53
|
+
export interface ProfileResolutionResult {
|
|
54
|
+
/**
|
|
55
|
+
* Whether resolution succeeded
|
|
56
|
+
*/
|
|
57
|
+
success: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Resolved profile config (if success)
|
|
60
|
+
*/
|
|
61
|
+
profile?: AdoProfileConfig;
|
|
62
|
+
/**
|
|
63
|
+
* Source of the profile
|
|
64
|
+
*/
|
|
65
|
+
source?: 'increment' | 'global';
|
|
66
|
+
/**
|
|
67
|
+
* Error message (if failed)
|
|
68
|
+
*/
|
|
69
|
+
error?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Increment ID that was checked
|
|
72
|
+
*/
|
|
73
|
+
incrementId?: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* ADO Profile Resolver
|
|
77
|
+
*/
|
|
78
|
+
export declare class AdoProfileResolver {
|
|
79
|
+
private projectRoot;
|
|
80
|
+
private configPath;
|
|
81
|
+
private incrementsPath;
|
|
82
|
+
constructor(projectRoot?: string);
|
|
83
|
+
/**
|
|
84
|
+
* Resolve the ADO profile for an increment
|
|
85
|
+
*
|
|
86
|
+
* Priority:
|
|
87
|
+
* 1. Increment's metadata.json -> external_sync.ado.profile
|
|
88
|
+
* 2. Config.json -> sync.activeProfile
|
|
89
|
+
*
|
|
90
|
+
* @param incrementId - Increment ID (e.g., "0093-my-feature")
|
|
91
|
+
* @returns Profile resolution result
|
|
92
|
+
*/
|
|
93
|
+
resolveProfile(incrementId: string): Promise<ProfileResolutionResult>;
|
|
94
|
+
/**
|
|
95
|
+
* Get increment's stored ADO profile name
|
|
96
|
+
*
|
|
97
|
+
* @param incrementId - Increment ID
|
|
98
|
+
* @returns Profile name or null if not set
|
|
99
|
+
*/
|
|
100
|
+
getIncrementProfile(incrementId: string): Promise<string | null>;
|
|
101
|
+
/**
|
|
102
|
+
* Set increment's ADO profile
|
|
103
|
+
*
|
|
104
|
+
* Stores the profile name in the increment's metadata.json
|
|
105
|
+
*
|
|
106
|
+
* @param incrementId - Increment ID
|
|
107
|
+
* @param profileName - Profile name to set
|
|
108
|
+
*/
|
|
109
|
+
setIncrementProfile(incrementId: string, profileName: string): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* List available ADO profiles
|
|
112
|
+
*
|
|
113
|
+
* @returns Array of profile names
|
|
114
|
+
*/
|
|
115
|
+
listAdoProfiles(): Promise<string[]>;
|
|
116
|
+
/**
|
|
117
|
+
* Load config.json
|
|
118
|
+
*/
|
|
119
|
+
private loadConfig;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Create an AdoProfileResolver instance
|
|
123
|
+
*
|
|
124
|
+
* @param projectRoot - Project root directory (defaults to cwd)
|
|
125
|
+
* @returns AdoProfileResolver instance
|
|
126
|
+
*/
|
|
127
|
+
export declare function createAdoProfileResolver(projectRoot?: string): Promise<AdoProfileResolver>;
|
|
128
|
+
/**
|
|
129
|
+
* Quick resolve: Get ADO profile for an increment
|
|
130
|
+
*
|
|
131
|
+
* @param incrementId - Increment ID
|
|
132
|
+
* @param projectRoot - Project root directory
|
|
133
|
+
* @returns Profile resolution result
|
|
134
|
+
*/
|
|
135
|
+
export declare function resolveAdoProfile(incrementId: string, projectRoot?: string): Promise<ProfileResolutionResult>;
|
|
136
|
+
export default AdoProfileResolver;
|
|
137
|
+
//# sourceMappingURL=ado-profile-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ado-profile-resolver.d.ts","sourceRoot":"","sources":["../../../../plugins/specweave-ado/lib/ado-profile-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAE3B;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAC;IAEhC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA+BD;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,cAAc,CAAS;gBAEnB,WAAW,GAAE,MAAsB;IAM/C;;;;;;;;;OASG;IACG,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAqE3E;;;;;OAKG;IACG,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAetE;;;;;;;OAOG;IACG,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAyBlF;;;;OAIG;IACG,eAAe,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAY1C;;OAEG;YACW,UAAU;CAQzB;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC5C,WAAW,GAAE,MAAsB,GAClC,OAAO,CAAC,kBAAkB,CAAC,CAE7B;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,MAAM,EACnB,WAAW,GAAE,MAAsB,GAClC,OAAO,CAAC,uBAAuB,CAAC,CAGlC;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADO Profile Resolver
|
|
3
|
+
*
|
|
4
|
+
* Resolves the correct ADO profile to use for sync operations.
|
|
5
|
+
* Priority:
|
|
6
|
+
* 1. Increment's stored profile (metadata.json -> external_sync.ado.profile)
|
|
7
|
+
* 2. Global activeProfile (config.json -> sync.activeProfile)
|
|
8
|
+
*
|
|
9
|
+
* This allows each increment to sync to its designated ADO project
|
|
10
|
+
* without requiring manual activeProfile switching.
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const resolver = await createAdoProfileResolver();
|
|
15
|
+
* const profile = await resolver.resolveProfile('0093-my-increment');
|
|
16
|
+
* // profile contains organization, project, PAT, etc.
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @module ado-profile-resolver
|
|
20
|
+
*/
|
|
21
|
+
import { promises as fs } from 'node:fs';
|
|
22
|
+
import * as path from 'node:path';
|
|
23
|
+
/**
|
|
24
|
+
* ADO Profile Resolver
|
|
25
|
+
*/
|
|
26
|
+
export class AdoProfileResolver {
|
|
27
|
+
constructor(projectRoot = process.cwd()) {
|
|
28
|
+
this.projectRoot = projectRoot;
|
|
29
|
+
this.configPath = path.join(projectRoot, '.specweave', 'config.json');
|
|
30
|
+
this.incrementsPath = path.join(projectRoot, '.specweave', 'increments');
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Resolve the ADO profile for an increment
|
|
34
|
+
*
|
|
35
|
+
* Priority:
|
|
36
|
+
* 1. Increment's metadata.json -> external_sync.ado.profile
|
|
37
|
+
* 2. Config.json -> sync.activeProfile
|
|
38
|
+
*
|
|
39
|
+
* @param incrementId - Increment ID (e.g., "0093-my-feature")
|
|
40
|
+
* @returns Profile resolution result
|
|
41
|
+
*/
|
|
42
|
+
async resolveProfile(incrementId) {
|
|
43
|
+
// Load global config
|
|
44
|
+
const config = await this.loadConfig();
|
|
45
|
+
if (!config) {
|
|
46
|
+
return {
|
|
47
|
+
success: false,
|
|
48
|
+
error: 'Failed to load .specweave/config.json',
|
|
49
|
+
incrementId,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
// Try to get increment-specific profile first
|
|
53
|
+
const incrementProfile = await this.getIncrementProfile(incrementId);
|
|
54
|
+
// Determine which profile to use
|
|
55
|
+
const profileName = incrementProfile || config.sync?.activeProfile;
|
|
56
|
+
if (!profileName) {
|
|
57
|
+
return {
|
|
58
|
+
success: false,
|
|
59
|
+
error: 'No ADO profile configured. Set sync.activeProfile in config.json or external_sync.ado.profile in increment metadata.',
|
|
60
|
+
incrementId,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
// Check if profile is for ADO provider
|
|
64
|
+
const profiles = config.sync?.profiles || {};
|
|
65
|
+
const profileConfig = profiles[profileName];
|
|
66
|
+
if (!profileConfig) {
|
|
67
|
+
return {
|
|
68
|
+
success: false,
|
|
69
|
+
error: `Profile "${profileName}" not found in config.sync.profiles`,
|
|
70
|
+
incrementId,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
if (profileConfig.provider !== 'ado') {
|
|
74
|
+
return {
|
|
75
|
+
success: false,
|
|
76
|
+
error: `Profile "${profileName}" is not an ADO profile (provider: ${profileConfig.provider})`,
|
|
77
|
+
incrementId,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
// Validate required fields
|
|
81
|
+
if (!profileConfig.config?.organization || !profileConfig.config?.project) {
|
|
82
|
+
return {
|
|
83
|
+
success: false,
|
|
84
|
+
error: `Profile "${profileName}" missing required fields (organization, project)`,
|
|
85
|
+
incrementId,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
success: true,
|
|
90
|
+
profile: {
|
|
91
|
+
profileName,
|
|
92
|
+
organization: profileConfig.config.organization,
|
|
93
|
+
project: profileConfig.config.project,
|
|
94
|
+
displayName: profileConfig.displayName,
|
|
95
|
+
areaPath: profileConfig.config.areaPath,
|
|
96
|
+
iterationPath: profileConfig.config.iterationPath,
|
|
97
|
+
},
|
|
98
|
+
source: incrementProfile ? 'increment' : 'global',
|
|
99
|
+
incrementId,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get increment's stored ADO profile name
|
|
104
|
+
*
|
|
105
|
+
* @param incrementId - Increment ID
|
|
106
|
+
* @returns Profile name or null if not set
|
|
107
|
+
*/
|
|
108
|
+
async getIncrementProfile(incrementId) {
|
|
109
|
+
const metadataPath = path.join(this.incrementsPath, incrementId, 'metadata.json');
|
|
110
|
+
try {
|
|
111
|
+
const content = await fs.readFile(metadataPath, 'utf-8');
|
|
112
|
+
const metadata = JSON.parse(content);
|
|
113
|
+
// Check for profile in external_sync.ado.profile
|
|
114
|
+
return metadata?.external_sync?.ado?.profile || null;
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
// Metadata not found or invalid - return null
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Set increment's ADO profile
|
|
123
|
+
*
|
|
124
|
+
* Stores the profile name in the increment's metadata.json
|
|
125
|
+
*
|
|
126
|
+
* @param incrementId - Increment ID
|
|
127
|
+
* @param profileName - Profile name to set
|
|
128
|
+
*/
|
|
129
|
+
async setIncrementProfile(incrementId, profileName) {
|
|
130
|
+
const metadataPath = path.join(this.incrementsPath, incrementId, 'metadata.json');
|
|
131
|
+
// Load existing metadata
|
|
132
|
+
let metadata = {};
|
|
133
|
+
try {
|
|
134
|
+
const content = await fs.readFile(metadataPath, 'utf-8');
|
|
135
|
+
metadata = JSON.parse(content);
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
// Start with empty metadata if not found
|
|
139
|
+
}
|
|
140
|
+
// Set external_sync.ado.profile
|
|
141
|
+
if (!metadata.external_sync) {
|
|
142
|
+
metadata.external_sync = {};
|
|
143
|
+
}
|
|
144
|
+
if (!metadata.external_sync.ado) {
|
|
145
|
+
metadata.external_sync.ado = {};
|
|
146
|
+
}
|
|
147
|
+
metadata.external_sync.ado.profile = profileName;
|
|
148
|
+
// Write back
|
|
149
|
+
await fs.writeFile(metadataPath, JSON.stringify(metadata, null, 2) + '\n', 'utf-8');
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* List available ADO profiles
|
|
153
|
+
*
|
|
154
|
+
* @returns Array of profile names
|
|
155
|
+
*/
|
|
156
|
+
async listAdoProfiles() {
|
|
157
|
+
const config = await this.loadConfig();
|
|
158
|
+
if (!config?.sync?.profiles) {
|
|
159
|
+
return [];
|
|
160
|
+
}
|
|
161
|
+
const profiles = config.sync.profiles;
|
|
162
|
+
return Object.entries(profiles)
|
|
163
|
+
.filter(([_, p]) => p.provider === 'ado')
|
|
164
|
+
.map(([name]) => name);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Load config.json
|
|
168
|
+
*/
|
|
169
|
+
async loadConfig() {
|
|
170
|
+
try {
|
|
171
|
+
const content = await fs.readFile(this.configPath, 'utf-8');
|
|
172
|
+
return JSON.parse(content);
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Create an AdoProfileResolver instance
|
|
181
|
+
*
|
|
182
|
+
* @param projectRoot - Project root directory (defaults to cwd)
|
|
183
|
+
* @returns AdoProfileResolver instance
|
|
184
|
+
*/
|
|
185
|
+
export async function createAdoProfileResolver(projectRoot = process.cwd()) {
|
|
186
|
+
return new AdoProfileResolver(projectRoot);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Quick resolve: Get ADO profile for an increment
|
|
190
|
+
*
|
|
191
|
+
* @param incrementId - Increment ID
|
|
192
|
+
* @param projectRoot - Project root directory
|
|
193
|
+
* @returns Profile resolution result
|
|
194
|
+
*/
|
|
195
|
+
export async function resolveAdoProfile(incrementId, projectRoot = process.cwd()) {
|
|
196
|
+
const resolver = new AdoProfileResolver(projectRoot);
|
|
197
|
+
return resolver.resolveProfile(incrementId);
|
|
198
|
+
}
|
|
199
|
+
export default AdoProfileResolver;
|
|
200
|
+
//# sourceMappingURL=ado-profile-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ado-profile-resolver.js","sourceRoot":"","sources":["../../../../plugins/specweave-ado/lib/ado-profile-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAgGlC;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAK7B,YAAY,cAAsB,OAAO,CAAC,GAAG,EAAE;QAC7C,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;QACtE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,EAAE,YA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AC;IAED;;OAEG;IACK,KAAK,CAAC,UAAU;QACtB,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;YAC5D,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAoB,CAAC;QAChD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,cAAsB,OAAO,CAAC,GAAG,EAAE;IAEnC,OAAO,IAAI,kBAAkB,CAAC,WAAW,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,WAAmB,EACnB,cAAsB,OAAO,CAAC,GAAG,EAAE;IAEnC,MAAM,QAAQ,GAAG,IAAI,kBAAkB,CAAC,WAAW,CAAC,CAAC;IACrD,OAAO,QAAQ,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;AAC9C,CAAC;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAoBH,OAAO,EACL,KAAK,WAAW,EAuBjB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAoBH,OAAO,EACL,KAAK,WAAW,EAuBjB,MAAM,0BAA0B,CAAC;AAWlC,YAAY,EAAE,WAAW,EAAE,CAAC;AAgJ5B;;GAEG;AACH,wBAAsB,WAAW,CAC/B,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,IAAI,CAAC,CAsZf"}
|