specweave 0.34.6 → 0.34.9
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/dist/plugins/specweave-ado/lib/ado-profile-resolver.d.ts +1 -4
- package/dist/plugins/specweave-ado/lib/ado-profile-resolver.d.ts.map +1 -1
- package/dist/plugins/specweave-ado/lib/ado-profile-resolver.js +3 -6
- package/dist/plugins/specweave-ado/lib/ado-profile-resolver.js.map +1 -1
- package/dist/plugins/specweave-github/lib/github-feature-sync-cli.js +3 -3
- package/dist/plugins/specweave-github/lib/github-feature-sync-cli.js.map +1 -1
- package/dist/plugins/specweave-github/lib/github-increment-sync-cli.js +3 -3
- package/dist/plugins/specweave-github/lib/github-increment-sync-cli.js.map +1 -1
- package/dist/plugins/specweave-github/lib/github-spec-sync.js +1 -1
- package/dist/plugins/specweave-github/lib/github-spec-sync.js.map +1 -1
- package/dist/src/cli/commands/import-docs.d.ts +3 -0
- package/dist/src/cli/commands/import-docs.d.ts.map +1 -1
- package/dist/src/cli/commands/import-docs.js +110 -91
- package/dist/src/cli/commands/import-docs.js.map +1 -1
- package/dist/src/cli/commands/init.js +5 -5
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/sync-spec-commits.js +1 -1
- package/dist/src/cli/commands/sync-spec-commits.js.map +1 -1
- package/dist/src/cli/commands/sync-spec-content.js +1 -1
- package/dist/src/cli/commands/sync-spec-content.js.map +1 -1
- package/dist/src/cli/helpers/github/increment-profile-selector.js +1 -1
- package/dist/src/cli/helpers/github/increment-profile-selector.js.map +1 -1
- package/dist/src/cli/helpers/github/profile-manager.d.ts +5 -5
- package/dist/src/cli/helpers/github/profile-manager.d.ts.map +1 -1
- package/dist/src/cli/helpers/github/profile-manager.js +24 -24
- package/dist/src/cli/helpers/github/profile-manager.js.map +1 -1
- package/dist/src/cli/helpers/init/config-detection.js +1 -1
- package/dist/src/cli/helpers/init/config-detection.js.map +1 -1
- package/dist/src/cli/helpers/init/sync-profile-helpers.d.ts.map +1 -1
- package/dist/src/cli/helpers/init/sync-profile-helpers.js +2 -4
- package/dist/src/cli/helpers/init/sync-profile-helpers.js.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/ado-area-selection.d.ts +1 -4
- package/dist/src/cli/helpers/issue-tracker/ado-area-selection.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/ado-area-selection.js +0 -32
- package/dist/src/cli/helpers/issue-tracker/ado-area-selection.js.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/ado.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/ado.js +3 -13
- package/dist/src/cli/helpers/issue-tracker/ado.js.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/index.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/index.js +0 -1
- package/dist/src/cli/helpers/issue-tracker/index.js.map +1 -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 +0 -7
- package/dist/src/cli/helpers/issue-tracker/sync-config-writer.js.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/types.d.ts +1 -5
- package/dist/src/cli/helpers/issue-tracker/types.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/types.js.map +1 -1
- package/dist/src/cli/workers/import-worker.js +5 -111
- package/dist/src/cli/workers/import-worker.js.map +1 -1
- package/dist/src/core/config/types.d.ts +0 -5
- package/dist/src/core/config/types.d.ts.map +1 -1
- package/dist/src/core/config/types.js.map +1 -1
- package/dist/src/core/credentials/credentials-manager.d.ts +2 -4
- package/dist/src/core/credentials/credentials-manager.d.ts.map +1 -1
- package/dist/src/core/credentials/credentials-manager.js +10 -24
- package/dist/src/core/credentials/credentials-manager.js.map +1 -1
- package/dist/src/core/increment/increment-archiver.d.ts.map +1 -1
- package/dist/src/core/increment/increment-archiver.js +0 -6
- package/dist/src/core/increment/increment-archiver.js.map +1 -1
- package/dist/src/core/increment/increment-utils.d.ts +0 -4
- package/dist/src/core/increment/increment-utils.d.ts.map +1 -1
- package/dist/src/core/increment/increment-utils.js +0 -6
- package/dist/src/core/increment/increment-utils.js.map +1 -1
- package/dist/src/core/living-docs/cross-project-sync.d.ts +0 -13
- package/dist/src/core/living-docs/cross-project-sync.d.ts.map +1 -1
- package/dist/src/core/living-docs/cross-project-sync.js +0 -25
- package/dist/src/core/living-docs/cross-project-sync.js.map +1 -1
- package/dist/src/core/living-docs/living-docs-sync.js +1 -1
- package/dist/src/core/living-docs/living-docs-sync.js.map +1 -1
- package/dist/src/core/project/project-manager.d.ts +0 -20
- package/dist/src/core/project/project-manager.d.ts.map +1 -1
- package/dist/src/core/project/project-manager.js +0 -49
- package/dist/src/core/project/project-manager.js.map +1 -1
- package/dist/src/core/repo-structure/prompt-consolidator.d.ts +0 -8
- package/dist/src/core/repo-structure/prompt-consolidator.d.ts.map +1 -1
- package/dist/src/core/repo-structure/prompt-consolidator.js +0 -28
- package/dist/src/core/repo-structure/prompt-consolidator.js.map +1 -1
- package/dist/src/core/sync/profile-manager.d.ts +5 -5
- package/dist/src/core/sync/profile-manager.d.ts.map +1 -1
- package/dist/src/core/sync/profile-manager.js +17 -17
- package/dist/src/core/sync/profile-manager.js.map +1 -1
- package/dist/src/core/types/sync-profile.d.ts +3 -20
- package/dist/src/core/types/sync-profile.d.ts.map +1 -1
- package/dist/src/core/types/sync-profile.js +4 -10
- package/dist/src/core/types/sync-profile.js.map +1 -1
- package/dist/src/integrations/ado/ado-client-factory.d.ts +2 -2
- package/dist/src/integrations/ado/ado-client-factory.js +2 -2
- package/dist/src/utils/project-detection.d.ts +16 -16
- package/dist/src/utils/project-detection.d.ts.map +1 -1
- package/dist/src/utils/project-detection.js +39 -39
- package/dist/src/utils/project-detection.js.map +1 -1
- package/dist/src/utils/validators/ado-validator.d.ts +0 -5
- package/dist/src/utils/validators/ado-validator.d.ts.map +1 -1
- package/dist/src/utils/validators/ado-validator.js +0 -23
- package/dist/src/utils/validators/ado-validator.js.map +1 -1
- package/package.json +1 -1
- package/plugins/specweave/hooks/lib/sync-spec-content.sh +8 -8
- package/plugins/specweave/hooks/post-increment-planning.sh +3 -3
- package/plugins/specweave-ado/lib/ado-profile-resolver.js +2 -3
- package/plugins/specweave-ado/lib/ado-profile-resolver.ts +3 -9
- package/plugins/specweave-github/lib/github-feature-sync-cli.js +2 -2
- package/plugins/specweave-github/lib/github-feature-sync-cli.ts +3 -3
- package/plugins/specweave-github/lib/github-increment-sync-cli.js +2 -2
- package/plugins/specweave-github/lib/github-increment-sync-cli.ts +3 -3
- package/plugins/specweave-github/lib/github-spec-sync.js +1 -1
- package/plugins/specweave-github/lib/github-spec-sync.ts +1 -1
- package/plugins/specweave-jira/lib/jira-profile-resolver.js +2 -3
- package/plugins/specweave-jira/lib/jira-profile-resolver.ts +3 -9
- package/dist/plugins/specweave-github/lib/github-sync-bidirectional.d.ts +0 -45
- package/dist/plugins/specweave-github/lib/github-sync-bidirectional.d.ts.map +0 -1
- package/dist/plugins/specweave-github/lib/github-sync-bidirectional.js +0 -247
- package/dist/plugins/specweave-github/lib/github-sync-bidirectional.js.map +0 -1
- package/dist/src/core/brownfield/analyzer.d.ts +0 -86
- package/dist/src/core/brownfield/analyzer.d.ts.map +0 -1
- package/dist/src/core/brownfield/analyzer.js +0 -365
- package/dist/src/core/brownfield/analyzer.js.map +0 -1
- package/dist/src/core/brownfield/importer.d.ts +0 -76
- package/dist/src/core/brownfield/importer.d.ts.map +0 -1
- package/dist/src/core/brownfield/importer.js +0 -287
- package/dist/src/core/brownfield/importer.js.map +0 -1
- package/dist/src/utils/env-multi-project-parser.d.ts +0 -237
- package/dist/src/utils/env-multi-project-parser.d.ts.map +0 -1
- package/dist/src/utils/env-multi-project-parser.js +0 -426
- package/dist/src/utils/env-multi-project-parser.js.map +0 -1
- package/plugins/specweave-github/lib/github-sync-bidirectional.d.js +0 -0
- package/plugins/specweave-github/lib/github-sync-bidirectional.d.ts +0 -36
- package/plugins/specweave-github/lib/github-sync-bidirectional.d.ts.map +0 -1
- package/plugins/specweave-github/lib/github-sync-bidirectional.js +0 -206
- package/plugins/specweave-github/lib/github-sync-bidirectional.js.map +0 -1
- package/plugins/specweave-github/lib/github-sync-bidirectional.ts +0 -362
|
@@ -25,8 +25,8 @@ async function loadGitHubConfig() {
|
|
|
25
25
|
repo = parts[1];
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
} else if (config.sync?.
|
|
29
|
-
const profile = config.sync.profiles[config.sync.
|
|
28
|
+
} else if (config.sync?.defaultProfile && config.sync?.profiles) {
|
|
29
|
+
const profile = config.sync.profiles[config.sync.defaultProfile];
|
|
30
30
|
if (profile?.config?.owner && profile?.config?.repo) {
|
|
31
31
|
owner = profile.config.owner;
|
|
32
32
|
repo = profile.config.repo;
|
|
@@ -59,9 +59,9 @@ async function loadGitHubConfig(): Promise<GitHubConfig | null> {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
// Method 3: sync.profiles[
|
|
63
|
-
else if (config.sync?.
|
|
64
|
-
const profile = config.sync.profiles[config.sync.
|
|
62
|
+
// Method 3: sync.profiles[defaultProfile]
|
|
63
|
+
else if (config.sync?.defaultProfile && config.sync?.profiles) {
|
|
64
|
+
const profile = config.sync.profiles[config.sync.defaultProfile];
|
|
65
65
|
if (profile?.config?.owner && profile?.config?.repo) {
|
|
66
66
|
owner = profile.config.owner;
|
|
67
67
|
repo = profile.config.repo;
|
|
@@ -31,8 +31,8 @@ async function loadGitHubConfig() {
|
|
|
31
31
|
repo = parts[1];
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
} else if (config.sync?.
|
|
35
|
-
const profile = config.sync.profiles[config.sync.
|
|
34
|
+
} else if (config.sync?.defaultProfile && config.sync?.profiles) {
|
|
35
|
+
const profile = config.sync.profiles[config.sync.defaultProfile];
|
|
36
36
|
if (profile?.config?.owner && profile?.config?.repo) {
|
|
37
37
|
owner = profile.config.owner;
|
|
38
38
|
repo = profile.config.repo;
|
|
@@ -82,9 +82,9 @@ async function loadGitHubConfig(): Promise<GitHubConfig | null> {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
// Method 3: sync.profiles[
|
|
86
|
-
else if (config.sync?.
|
|
87
|
-
const profile = config.sync.profiles[config.sync.
|
|
85
|
+
// Method 3: sync.profiles[defaultProfile]
|
|
86
|
+
else if (config.sync?.defaultProfile && config.sync?.profiles) {
|
|
87
|
+
const profile = config.sync.profiles[config.sync.defaultProfile];
|
|
88
88
|
if (profile?.config?.owner && profile?.config?.repo) {
|
|
89
89
|
owner = profile.config.owner;
|
|
90
90
|
repo = profile.config.repo;
|
|
@@ -143,7 +143,7 @@ export class GitHubSpecSync {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
// Get profile from project's default sync profile
|
|
146
|
-
const profileId = project.defaultSyncProfile || config.
|
|
146
|
+
const profileId = project.defaultSyncProfile || config.defaultProfile;
|
|
147
147
|
if (!profileId) {
|
|
148
148
|
return null;
|
|
149
149
|
}
|
|
@@ -11,8 +11,7 @@ class JiraProfileResolver {
|
|
|
11
11
|
*
|
|
12
12
|
* Priority:
|
|
13
13
|
* 1. Increment's metadata.json -> external_sync.jira.profile
|
|
14
|
-
* 2. Config.json -> sync.defaultProfile
|
|
15
|
-
* 3. Config.json -> sync.activeProfile (legacy fallback)
|
|
14
|
+
* 2. Config.json -> sync.defaultProfile
|
|
16
15
|
*
|
|
17
16
|
* @param incrementId - Increment ID (e.g., "0093-my-feature")
|
|
18
17
|
* @returns Profile resolution result
|
|
@@ -27,7 +26,7 @@ class JiraProfileResolver {
|
|
|
27
26
|
};
|
|
28
27
|
}
|
|
29
28
|
const incrementProfile = await this.getIncrementProfile(incrementId);
|
|
30
|
-
const globalDefaultProfile = config.sync?.defaultProfile
|
|
29
|
+
const globalDefaultProfile = config.sync?.defaultProfile;
|
|
31
30
|
const profileName = incrementProfile || globalDefaultProfile;
|
|
32
31
|
if (!profileName) {
|
|
33
32
|
return {
|
|
@@ -5,12 +5,10 @@
|
|
|
5
5
|
* Priority:
|
|
6
6
|
* 1. Increment's stored profile (metadata.json -> external_sync.jira.profile)
|
|
7
7
|
* 2. Global defaultProfile (config.json -> sync.defaultProfile)
|
|
8
|
-
* 3. Legacy: Global activeProfile (config.json -> sync.activeProfile)
|
|
9
8
|
*
|
|
10
9
|
* This allows each increment to sync to its designated JIRA project
|
|
11
10
|
* without requiring manual profile switching.
|
|
12
11
|
*
|
|
13
|
-
* NOTE (v0.31.0): Renamed from "activeProfile" to "defaultProfile" for clarity.
|
|
14
12
|
* The default profile is a FALLBACK, not a constraint. Bulk operations
|
|
15
13
|
* iterate ALL profiles.
|
|
16
14
|
*
|
|
@@ -116,10 +114,7 @@ interface ConfigProfile {
|
|
|
116
114
|
* Sync config from config.json
|
|
117
115
|
*/
|
|
118
116
|
interface SyncConfig {
|
|
119
|
-
/** @since v0.31.0 - preferred */
|
|
120
117
|
defaultProfile?: string;
|
|
121
|
-
/** @deprecated Use defaultProfile */
|
|
122
|
-
activeProfile?: string;
|
|
123
118
|
profiles?: Record<string, ConfigProfile>;
|
|
124
119
|
}
|
|
125
120
|
|
|
@@ -149,8 +144,7 @@ export class JiraProfileResolver {
|
|
|
149
144
|
*
|
|
150
145
|
* Priority:
|
|
151
146
|
* 1. Increment's metadata.json -> external_sync.jira.profile
|
|
152
|
-
* 2. Config.json -> sync.defaultProfile
|
|
153
|
-
* 3. Config.json -> sync.activeProfile (legacy fallback)
|
|
147
|
+
* 2. Config.json -> sync.defaultProfile
|
|
154
148
|
*
|
|
155
149
|
* @param incrementId - Increment ID (e.g., "0093-my-feature")
|
|
156
150
|
* @returns Profile resolution result
|
|
@@ -169,8 +163,8 @@ export class JiraProfileResolver {
|
|
|
169
163
|
// Try to get increment-specific profile first
|
|
170
164
|
const incrementProfile = await this.getIncrementProfile(incrementId);
|
|
171
165
|
|
|
172
|
-
// Determine which profile to use
|
|
173
|
-
const globalDefaultProfile = config.sync?.defaultProfile
|
|
166
|
+
// Determine which profile to use
|
|
167
|
+
const globalDefaultProfile = config.sync?.defaultProfile;
|
|
174
168
|
const profileName = incrementProfile || globalDefaultProfile;
|
|
175
169
|
|
|
176
170
|
if (!profileName) {
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bidirectional GitHub Sync
|
|
3
|
-
*
|
|
4
|
-
* @deprecated This module is deprecated as of v0.24.0 (Three-Permission Architecture).
|
|
5
|
-
* The "bidirectional" terminology has been replaced with granular permission controls:
|
|
6
|
-
* - canUpsertInternalItems: CREATE + UPDATE internal items
|
|
7
|
-
* - canUpdateExternalItems: UPDATE external items (full content)
|
|
8
|
-
* - canUpdateStatus: UPDATE status (both types)
|
|
9
|
-
*
|
|
10
|
-
* This file is kept for backward compatibility but is no longer actively maintained.
|
|
11
|
-
* See: .specweave/increments/0047-us-task-linkage/reports/THREE-PERMISSION-ARCHITECTURE-CHANGES.md
|
|
12
|
-
*
|
|
13
|
-
* Syncs state from GitHub back to SpecWeave.
|
|
14
|
-
* Handles issue state changes, comments, assignees, labels, milestones.
|
|
15
|
-
*
|
|
16
|
-
* @module github-sync-bidirectional
|
|
17
|
-
*/
|
|
18
|
-
export interface GitHubIssueState {
|
|
19
|
-
number: number;
|
|
20
|
-
title: string;
|
|
21
|
-
body: string;
|
|
22
|
-
state: 'open' | 'closed';
|
|
23
|
-
labels: string[];
|
|
24
|
-
assignees: string[];
|
|
25
|
-
milestone?: string;
|
|
26
|
-
comments: GitHubComment[];
|
|
27
|
-
updated_at: string;
|
|
28
|
-
}
|
|
29
|
-
export interface GitHubComment {
|
|
30
|
-
id: number;
|
|
31
|
-
author: string;
|
|
32
|
-
body: string;
|
|
33
|
-
created_at: string;
|
|
34
|
-
}
|
|
35
|
-
export interface SyncConflict {
|
|
36
|
-
type: 'status' | 'assignee' | 'label';
|
|
37
|
-
githubValue: any;
|
|
38
|
-
specweaveValue: any;
|
|
39
|
-
resolution: 'github-wins' | 'specweave-wins' | 'prompt';
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Sync from GitHub to SpecWeave
|
|
43
|
-
*/
|
|
44
|
-
export declare function syncFromGitHub(incrementId: string): Promise<void>;
|
|
45
|
-
//# sourceMappingURL=github-sync-bidirectional.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"github-sync-bidirectional.d.ts","sourceRoot":"","sources":["../../../../plugins/specweave-github/lib/github-sync-bidirectional.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAsBH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC;IACzB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;IACtC,WAAW,EAAE,GAAG,CAAC;IACjB,cAAc,EAAE,GAAG,CAAC;IACpB,UAAU,EAAE,aAAa,GAAG,gBAAgB,GAAG,QAAQ,CAAC;CACzD;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAmDvE"}
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bidirectional GitHub Sync
|
|
3
|
-
*
|
|
4
|
-
* @deprecated This module is deprecated as of v0.24.0 (Three-Permission Architecture).
|
|
5
|
-
* The "bidirectional" terminology has been replaced with granular permission controls:
|
|
6
|
-
* - canUpsertInternalItems: CREATE + UPDATE internal items
|
|
7
|
-
* - canUpdateExternalItems: UPDATE external items (full content)
|
|
8
|
-
* - canUpdateStatus: UPDATE status (both types)
|
|
9
|
-
*
|
|
10
|
-
* This file is kept for backward compatibility but is no longer actively maintained.
|
|
11
|
-
* See: .specweave/increments/0047-us-task-linkage/reports/THREE-PERMISSION-ARCHITECTURE-CHANGES.md
|
|
12
|
-
*
|
|
13
|
-
* Syncs state from GitHub back to SpecWeave.
|
|
14
|
-
* Handles issue state changes, comments, assignees, labels, milestones.
|
|
15
|
-
*
|
|
16
|
-
* @module github-sync-bidirectional
|
|
17
|
-
*/
|
|
18
|
-
import * as fs from '../../../src/utils/fs-native.js';
|
|
19
|
-
import path from 'path';
|
|
20
|
-
import { execFileNoThrow } from '../../../src/utils/execFileNoThrow.js';
|
|
21
|
-
import { loadIncrementMetadata, detectRepo } from './github-issue-updater.js';
|
|
22
|
-
import { getGitHubAuthFromProject } from '../../../src/utils/auth-helpers.js';
|
|
23
|
-
/**
|
|
24
|
-
* Get environment object with GH_TOKEN for gh CLI commands.
|
|
25
|
-
*/
|
|
26
|
-
function getGhEnv() {
|
|
27
|
-
const { token } = getGitHubAuthFromProject(process.cwd());
|
|
28
|
-
return token
|
|
29
|
-
? { ...process.env, GH_TOKEN: token }
|
|
30
|
-
: process.env;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Sync from GitHub to SpecWeave
|
|
34
|
-
*/
|
|
35
|
-
export async function syncFromGitHub(incrementId) {
|
|
36
|
-
console.log(`\n🔄 Syncing from GitHub for increment: ${incrementId}`);
|
|
37
|
-
try {
|
|
38
|
-
// 1. Load metadata
|
|
39
|
-
const metadata = await loadIncrementMetadata(incrementId);
|
|
40
|
-
if (!metadata?.github?.issue) {
|
|
41
|
-
console.log('ℹ️ No GitHub issue linked, nothing to sync');
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
// 2. Detect repository
|
|
45
|
-
const repoInfo = await detectRepo();
|
|
46
|
-
if (!repoInfo) {
|
|
47
|
-
console.log('⚠️ Could not detect GitHub repository');
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
const { owner, repo } = repoInfo;
|
|
51
|
-
const issueNumber = metadata.github.issue;
|
|
52
|
-
console.log(` Syncing from ${owner}/${repo}#${issueNumber}`);
|
|
53
|
-
// 3. Fetch current GitHub state
|
|
54
|
-
const githubState = await fetchGitHubIssueState(issueNumber, owner, repo);
|
|
55
|
-
// 4. Compare with local state
|
|
56
|
-
const conflicts = detectConflicts(metadata, githubState);
|
|
57
|
-
if (conflicts.length === 0) {
|
|
58
|
-
console.log('✅ No conflicts - GitHub and SpecWeave in sync');
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
console.log(`⚠️ Detected ${conflicts.length} conflict(s)`);
|
|
62
|
-
// 5. Resolve conflicts
|
|
63
|
-
await resolveConflicts(incrementId, metadata, githubState, conflicts);
|
|
64
|
-
// 6. Sync comments
|
|
65
|
-
await syncComments(incrementId, githubState.comments);
|
|
66
|
-
// 7. Update metadata
|
|
67
|
-
await updateMetadata(incrementId, githubState);
|
|
68
|
-
console.log('✅ Three-permission sync complete');
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
console.error('❌ Error syncing from GitHub:', error);
|
|
72
|
-
throw error;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Fetch current GitHub issue state
|
|
77
|
-
*/
|
|
78
|
-
async function fetchGitHubIssueState(issueNumber, owner, repo) {
|
|
79
|
-
// Fetch issue details
|
|
80
|
-
const issueResult = await execFileNoThrow('gh', [
|
|
81
|
-
'issue',
|
|
82
|
-
'view',
|
|
83
|
-
String(issueNumber),
|
|
84
|
-
'--repo',
|
|
85
|
-
`${owner}/${repo}`,
|
|
86
|
-
'--json',
|
|
87
|
-
'number,title,body,state,labels,assignees,milestone,updatedAt'
|
|
88
|
-
], { env: getGhEnv() });
|
|
89
|
-
if (issueResult.exitCode !== 0) {
|
|
90
|
-
throw new Error(`Failed to fetch issue: ${issueResult.stderr}`);
|
|
91
|
-
}
|
|
92
|
-
const issue = JSON.parse(issueResult.stdout);
|
|
93
|
-
// Fetch comments
|
|
94
|
-
const commentsResult = await execFileNoThrow('gh', [
|
|
95
|
-
'api',
|
|
96
|
-
`repos/${owner}/${repo}/issues/${issueNumber}/comments`,
|
|
97
|
-
'--jq',
|
|
98
|
-
'.[] | {id: .id, author: .user.login, body: .body, created_at: .created_at}'
|
|
99
|
-
], { env: getGhEnv() });
|
|
100
|
-
let comments = [];
|
|
101
|
-
if (commentsResult.exitCode === 0 && commentsResult.stdout.trim()) {
|
|
102
|
-
const commentLines = commentsResult.stdout.trim().split('\n');
|
|
103
|
-
comments = commentLines.map(line => JSON.parse(line));
|
|
104
|
-
}
|
|
105
|
-
return {
|
|
106
|
-
number: issue.number,
|
|
107
|
-
title: issue.title,
|
|
108
|
-
body: issue.body,
|
|
109
|
-
state: issue.state,
|
|
110
|
-
labels: issue.labels?.map((l) => l.name) || [],
|
|
111
|
-
assignees: issue.assignees?.map((a) => a.login) || [],
|
|
112
|
-
milestone: issue.milestone?.title,
|
|
113
|
-
comments,
|
|
114
|
-
updated_at: issue.updatedAt
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Detect conflicts between GitHub and SpecWeave
|
|
119
|
-
*/
|
|
120
|
-
function detectConflicts(metadata, githubState) {
|
|
121
|
-
const conflicts = [];
|
|
122
|
-
// Status conflict
|
|
123
|
-
const specweaveStatus = metadata.status; // "active", "completed", "paused", "abandoned"
|
|
124
|
-
const githubStatus = githubState.state; // "open", "closed"
|
|
125
|
-
const expectedGitHubStatus = mapSpecWeaveStatusToGitHub(specweaveStatus);
|
|
126
|
-
if (githubStatus !== expectedGitHubStatus) {
|
|
127
|
-
conflicts.push({
|
|
128
|
-
type: 'status',
|
|
129
|
-
githubValue: githubStatus,
|
|
130
|
-
specweaveValue: specweaveStatus,
|
|
131
|
-
resolution: 'prompt' // Ask user
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
// TODO: Add assignee/label conflicts if needed in future
|
|
135
|
-
return conflicts;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Resolve conflicts
|
|
139
|
-
*/
|
|
140
|
-
async function resolveConflicts(incrementId, metadata, githubState, conflicts) {
|
|
141
|
-
for (const conflict of conflicts) {
|
|
142
|
-
console.log(`\n⚠️ Conflict detected: ${conflict.type}`);
|
|
143
|
-
console.log(` GitHub: ${conflict.githubValue}`);
|
|
144
|
-
console.log(` SpecWeave: ${conflict.specweaveValue}`);
|
|
145
|
-
if (conflict.type === 'status') {
|
|
146
|
-
await resolveStatusConflict(incrementId, metadata, githubState);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Resolve status conflict
|
|
152
|
-
*/
|
|
153
|
-
async function resolveStatusConflict(incrementId, metadata, githubState) {
|
|
154
|
-
const specweaveStatus = metadata.status;
|
|
155
|
-
const githubStatus = githubState.state;
|
|
156
|
-
// GitHub closed but SpecWeave active
|
|
157
|
-
if (githubStatus === 'closed' && specweaveStatus === 'active') {
|
|
158
|
-
console.log(`\n⚠️ **CONFLICT**: GitHub issue closed but SpecWeave increment still active!`);
|
|
159
|
-
console.log(` Recommendation: Run /sw:done ${incrementId} to close increment`);
|
|
160
|
-
console.log(` Or reopen issue on GitHub if work is not complete`);
|
|
161
|
-
}
|
|
162
|
-
// GitHub open but SpecWeave completed
|
|
163
|
-
if (githubStatus === 'open' && specweaveStatus === 'completed') {
|
|
164
|
-
console.log(`\n⚠️ **CONFLICT**: SpecWeave increment completed but GitHub issue still open!`);
|
|
165
|
-
console.log(` Recommendation: Close GitHub issue #${metadata.github.issue}`);
|
|
166
|
-
}
|
|
167
|
-
// GitHub open but SpecWeave paused
|
|
168
|
-
if (githubStatus === 'open' && specweaveStatus === 'paused') {
|
|
169
|
-
console.log(`\nℹ️ GitHub issue open, SpecWeave increment paused (OK)`);
|
|
170
|
-
}
|
|
171
|
-
// GitHub open but SpecWeave abandoned
|
|
172
|
-
if (githubStatus === 'open' && specweaveStatus === 'abandoned') {
|
|
173
|
-
console.log(`\n⚠️ **CONFLICT**: SpecWeave increment abandoned but GitHub issue still open!`);
|
|
174
|
-
console.log(` Recommendation: Close GitHub issue #${metadata.github.issue} with reason`);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Sync comments from GitHub to SpecWeave
|
|
179
|
-
*/
|
|
180
|
-
async function syncComments(incrementId, comments) {
|
|
181
|
-
if (comments.length === 0) {
|
|
182
|
-
console.log('ℹ️ No comments to sync');
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
const commentsPath = path.join(process.cwd(), '.specweave/increments', incrementId, 'logs/github-comments.md');
|
|
186
|
-
await fs.ensureFile(commentsPath);
|
|
187
|
-
// Load existing comments
|
|
188
|
-
let existingContent = '';
|
|
189
|
-
if (await fs.pathExists(commentsPath)) {
|
|
190
|
-
existingContent = await fs.readFile(commentsPath, 'utf-8');
|
|
191
|
-
}
|
|
192
|
-
// Extract existing comment IDs
|
|
193
|
-
const existingIds = new Set();
|
|
194
|
-
const idMatches = existingContent.matchAll(/<!-- comment-id: (\d+) -->/g);
|
|
195
|
-
for (const match of idMatches) {
|
|
196
|
-
existingIds.add(parseInt(match[1], 10));
|
|
197
|
-
}
|
|
198
|
-
// Append new comments
|
|
199
|
-
const newComments = comments.filter(c => !existingIds.has(c.id));
|
|
200
|
-
if (newComments.length === 0) {
|
|
201
|
-
console.log('ℹ️ All comments already synced');
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
console.log(`📝 Syncing ${newComments.length} new comment(s)`);
|
|
205
|
-
const commentsMarkdown = newComments.map(comment => `
|
|
206
|
-
---
|
|
207
|
-
|
|
208
|
-
<!-- comment-id: ${comment.id} -->
|
|
209
|
-
|
|
210
|
-
**Author**: @${comment.author}
|
|
211
|
-
**Date**: ${new Date(comment.created_at).toLocaleString()}
|
|
212
|
-
|
|
213
|
-
${comment.body}
|
|
214
|
-
`.trim()).join('\n\n');
|
|
215
|
-
await fs.appendFile(commentsPath, (existingContent ? '\n\n' : '') + commentsMarkdown);
|
|
216
|
-
console.log(`✅ Comments saved to: logs/github-comments.md`);
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Update metadata with GitHub state
|
|
220
|
-
*/
|
|
221
|
-
async function updateMetadata(incrementId, githubState) {
|
|
222
|
-
const metadataPath = path.join(process.cwd(), '.specweave/increments', incrementId, 'metadata.json');
|
|
223
|
-
const metadata = await fs.readJson(metadataPath);
|
|
224
|
-
// Update GitHub section
|
|
225
|
-
metadata.github = metadata.github || {};
|
|
226
|
-
metadata.github.synced = new Date().toISOString();
|
|
227
|
-
metadata.github.lastUpdated = githubState.updated_at;
|
|
228
|
-
metadata.github.state = githubState.state;
|
|
229
|
-
await fs.writeJson(metadataPath, metadata, { spaces: 2 });
|
|
230
|
-
console.log('✅ Metadata updated');
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Map SpecWeave status to GitHub state
|
|
234
|
-
*/
|
|
235
|
-
function mapSpecWeaveStatusToGitHub(status) {
|
|
236
|
-
switch (status) {
|
|
237
|
-
case 'completed':
|
|
238
|
-
case 'abandoned':
|
|
239
|
-
return 'closed';
|
|
240
|
-
case 'active':
|
|
241
|
-
case 'paused':
|
|
242
|
-
case 'planning':
|
|
243
|
-
default:
|
|
244
|
-
return 'open';
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
//# sourceMappingURL=github-sync-bidirectional.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"github-sync-bidirectional.js","sourceRoot":"","sources":["../../../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AC;QACd,KAAK,UAAU,CAAC;QAChB;YACE,OAAO,MAAM,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Brownfield Analyzer - File Classification
|
|
3
|
-
*
|
|
4
|
-
* Analyzes markdown files from external sources (Notion, Confluence, Wiki)
|
|
5
|
-
* and classifies them as specs, modules, team docs, or legacy
|
|
6
|
-
*/
|
|
7
|
-
export interface FileClassification {
|
|
8
|
-
path: string;
|
|
9
|
-
relativePath: string;
|
|
10
|
-
type: 'spec' | 'module' | 'team' | 'legacy';
|
|
11
|
-
confidence: number;
|
|
12
|
-
keywords: string[];
|
|
13
|
-
reasons: string[];
|
|
14
|
-
}
|
|
15
|
-
export interface BrownfieldAnalysisResult {
|
|
16
|
-
totalFiles: number;
|
|
17
|
-
specs: FileClassification[];
|
|
18
|
-
modules: FileClassification[];
|
|
19
|
-
team: FileClassification[];
|
|
20
|
-
legacy: FileClassification[];
|
|
21
|
-
statistics: {
|
|
22
|
-
specsConfidence: number;
|
|
23
|
-
modulesConfidence: number;
|
|
24
|
-
teamConfidence: number;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
export declare class BrownfieldAnalyzer {
|
|
28
|
-
private readonly SPEC_KEYWORDS;
|
|
29
|
-
private readonly MODULE_KEYWORDS;
|
|
30
|
-
private readonly TEAM_KEYWORDS;
|
|
31
|
-
/**
|
|
32
|
-
* Analyze markdown files in source directory
|
|
33
|
-
*
|
|
34
|
-
* @param sourcePath - Path to source directory
|
|
35
|
-
* @returns BrownfieldAnalysisResult
|
|
36
|
-
*/
|
|
37
|
-
analyze(sourcePath: string): Promise<BrownfieldAnalysisResult>;
|
|
38
|
-
/**
|
|
39
|
-
* Classify single file based on content
|
|
40
|
-
*
|
|
41
|
-
* @param filePath - Full path to file
|
|
42
|
-
* @param basePath - Base path for relative path calculation
|
|
43
|
-
* @returns FileClassification
|
|
44
|
-
*/
|
|
45
|
-
private classifyFile;
|
|
46
|
-
/**
|
|
47
|
-
* Score text based on keyword matches
|
|
48
|
-
* Returns 0-1 confidence score
|
|
49
|
-
*
|
|
50
|
-
* @param text - Lowercase text to analyze
|
|
51
|
-
* @param keywords - Keywords to match
|
|
52
|
-
* @returns Confidence score (0-1)
|
|
53
|
-
*/
|
|
54
|
-
private scoreKeywords;
|
|
55
|
-
/**
|
|
56
|
-
* Find matching keywords in text
|
|
57
|
-
*
|
|
58
|
-
* @param text - Lowercase text to search
|
|
59
|
-
* @param keywords - Keywords to find
|
|
60
|
-
* @returns Matching keywords
|
|
61
|
-
*/
|
|
62
|
-
private findMatchingKeywords;
|
|
63
|
-
/**
|
|
64
|
-
* Generate human-readable reasons for classification
|
|
65
|
-
*
|
|
66
|
-
* @param keywords - Matched keywords
|
|
67
|
-
* @param type - Classification type
|
|
68
|
-
* @returns Reasons
|
|
69
|
-
*/
|
|
70
|
-
private generateReasons;
|
|
71
|
-
/**
|
|
72
|
-
* Find all markdown files recursively
|
|
73
|
-
*
|
|
74
|
-
* @param dirPath - Directory to search
|
|
75
|
-
* @returns Array of file paths
|
|
76
|
-
*/
|
|
77
|
-
private findMarkdownFiles;
|
|
78
|
-
/**
|
|
79
|
-
* Generate analysis summary report
|
|
80
|
-
*
|
|
81
|
-
* @param result - Analysis result
|
|
82
|
-
* @returns Summary string
|
|
83
|
-
*/
|
|
84
|
-
generateSummaryReport(result: BrownfieldAnalysisResult): string;
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=analyzer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../../../../src/core/brownfield/analyzer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;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