specweave 0.20.0 → 0.20.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.
Files changed (55) hide show
  1. package/package.json +1 -1
  2. package/dist/locales/de/.gitkeep +0 -0
  3. package/dist/locales/de/cli.json +0 -108
  4. package/dist/locales/en/cli.json +0 -287
  5. package/dist/locales/en/errors.json +0 -7
  6. package/dist/locales/en/templates.json +0 -6
  7. package/dist/locales/es/.gitkeep +0 -0
  8. package/dist/locales/es/cli.json +0 -41
  9. package/dist/locales/fr/.gitkeep +0 -0
  10. package/dist/locales/fr/cli.json +0 -108
  11. package/dist/locales/ja/.gitkeep +0 -0
  12. package/dist/locales/ja/cli.json +0 -108
  13. package/dist/locales/ko/.gitkeep +0 -0
  14. package/dist/locales/ko/cli.json +0 -108
  15. package/dist/locales/pt/.gitkeep +0 -0
  16. package/dist/locales/pt/cli.json +0 -108
  17. package/dist/locales/ru/.gitkeep +0 -0
  18. package/dist/locales/ru/cli.json +0 -269
  19. package/dist/locales/zh/.gitkeep +0 -0
  20. package/dist/locales/zh/cli.json +0 -108
  21. package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.d.ts +0 -25
  22. package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.d.ts.map +0 -1
  23. package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.js +0 -191
  24. package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.js.map +0 -1
  25. package/dist/plugins/specweave-kafka/lib/cli/kcat-wrapper.d.ts +0 -57
  26. package/dist/plugins/specweave-kafka/lib/cli/kcat-wrapper.d.ts.map +0 -1
  27. package/dist/plugins/specweave-kafka/lib/cli/kcat-wrapper.js +0 -248
  28. package/dist/plugins/specweave-kafka/lib/cli/kcat-wrapper.js.map +0 -1
  29. package/dist/plugins/specweave-kafka/lib/cli/types.d.ts +0 -82
  30. package/dist/plugins/specweave-kafka/lib/cli/types.d.ts.map +0 -1
  31. package/dist/plugins/specweave-kafka/lib/cli/types.js +0 -13
  32. package/dist/plugins/specweave-kafka/lib/cli/types.js.map +0 -1
  33. package/dist/plugins/specweave-kafka/lib/mcp/detector.d.ts +0 -49
  34. package/dist/plugins/specweave-kafka/lib/mcp/detector.d.ts.map +0 -1
  35. package/dist/plugins/specweave-kafka/lib/mcp/detector.js +0 -316
  36. package/dist/plugins/specweave-kafka/lib/mcp/detector.js.map +0 -1
  37. package/dist/plugins/specweave-kafka/lib/mcp/types.d.ts +0 -70
  38. package/dist/plugins/specweave-kafka/lib/mcp/types.d.ts.map +0 -1
  39. package/dist/plugins/specweave-kafka/lib/mcp/types.js +0 -23
  40. package/dist/plugins/specweave-kafka/lib/mcp/types.js.map +0 -1
  41. package/dist/plugins/specweave-kafka/lib/utils/partitioning.d.ts +0 -85
  42. package/dist/plugins/specweave-kafka/lib/utils/partitioning.d.ts.map +0 -1
  43. package/dist/plugins/specweave-kafka/lib/utils/partitioning.js +0 -281
  44. package/dist/plugins/specweave-kafka/lib/utils/partitioning.js.map +0 -1
  45. package/dist/plugins/specweave-kafka/lib/utils/sizing.d.ts +0 -75
  46. package/dist/plugins/specweave-kafka/lib/utils/sizing.d.ts.map +0 -1
  47. package/dist/plugins/specweave-kafka/lib/utils/sizing.js +0 -238
  48. package/dist/plugins/specweave-kafka/lib/utils/sizing.js.map +0 -1
  49. package/dist/spec-parser.js +0 -629
  50. package/dist/src/core/sync/spec-content-sync.d.ts +0 -88
  51. package/dist/src/core/sync/spec-content-sync.d.ts.map +0 -1
  52. package/dist/src/core/sync/spec-content-sync.js +0 -5
  53. package/dist/src/core/sync/spec-content-sync.js.map +0 -1
  54. package/dist/tsconfig.tsbuildinfo +0 -1
  55. package/plugins/specweave-ado/lib/enhanced-ado-sync.js +0 -170
@@ -1,88 +0,0 @@
1
- /**
2
- * Type definitions for spec content synchronization with external tools
3
- */
4
- export interface SpecIdentifier {
5
- /** Compact format: SPEC-0031 */
6
- compact: string;
7
- /** Full format: spec-0031-external-tool-status-sync */
8
- full: string;
9
- }
10
- export interface AcceptanceCriterion {
11
- /** AC identifier: AC-US1-01 */
12
- id: string;
13
- /** Description of the acceptance criterion */
14
- description: string;
15
- /** Priority: P1, P2, P3 */
16
- priority?: string;
17
- /** Whether this criterion is testable */
18
- testable?: boolean;
19
- }
20
- export interface UserStory {
21
- /** User story ID: 001, 002, etc. */
22
- id: string;
23
- /** Title of the user story */
24
- title: string;
25
- /** As a... (role) */
26
- asA: string;
27
- /** I want... (action) */
28
- iWant: string;
29
- /** So that... (benefit) */
30
- soThat: string;
31
- /** Acceptance criteria for this user story */
32
- acceptanceCriteria: AcceptanceCriterion[];
33
- }
34
- export interface Task {
35
- /** Task ID: T-001, T-002, etc. */
36
- id: string;
37
- /** Title of the task */
38
- title: string;
39
- /** User stories this task implements */
40
- userStories: string[];
41
- /** GitHub issue number (if synced) */
42
- githubIssue?: number;
43
- }
44
- export interface TaskMapping {
45
- /** Increment ID this mapping belongs to */
46
- incrementId: string;
47
- /** Tasks from the increment */
48
- tasks: Task[];
49
- /** URL to tasks.md file */
50
- tasksUrl: string;
51
- }
52
- export interface ArchitectureDoc {
53
- /** Type of architecture document */
54
- type: 'adr' | 'hld' | 'diagram';
55
- /** Path to the document */
56
- path: string;
57
- /** Title/description of the document */
58
- title: string;
59
- }
60
- export interface SourceLinks {
61
- /** Link to spec.md */
62
- spec?: string;
63
- /** Link to plan.md */
64
- plan?: string;
65
- /** Link to tasks.md */
66
- tasks?: string;
67
- }
68
- export interface SpecContent {
69
- /** Spec identifier */
70
- identifier: SpecIdentifier;
71
- /** Title of the spec */
72
- title: string;
73
- /** Project this spec belongs to */
74
- project: string;
75
- /** Executive summary */
76
- summary: string;
77
- /** User stories */
78
- userStories: UserStory[];
79
- /** Metadata (priority, etc.) */
80
- metadata: Record<string, any>;
81
- /** Task mapping (optional) */
82
- taskMapping?: TaskMapping;
83
- /** Architecture documents (optional) */
84
- architectureDocs?: ArchitectureDoc[];
85
- /** Source links (optional) */
86
- sourceLinks?: SourceLinks;
87
- }
88
- //# sourceMappingURL=spec-content-sync.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spec-content-sync.d.ts","sourceRoot":"","sources":["../../../../src/core/sync/spec-content-sync.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,oCAAoC;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,kBAAkB,EAAE,mBAAmB,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,IAAI;IACnB,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,oCAAoC;IACpC,IAAI,EAAE,KAAK,GAAG,KAAK,GAAG,SAAS,CAAC;IAChC,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,sBAAsB;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sBAAsB;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,sBAAsB;IACtB,UAAU,EAAE,cAAc,CAAC;IAC3B,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,wBAAwB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB;IACnB,WAAW,EAAE,SAAS,EAAE,CAAC;IACzB,gCAAgC;IAChC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,8BAA8B;IAC9B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,wCAAwC;IACxC,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IACrC,8BAA8B;IAC9B,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B"}
@@ -1,5 +0,0 @@
1
- /**
2
- * Type definitions for spec content synchronization with external tools
3
- */
4
- export {};
5
- //# sourceMappingURL=spec-content-sync.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spec-content-sync.js","sourceRoot":"","sources":["../../../../src/core/sync/spec-content-sync.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -1 +0,0 @@
1
- {"root":["../src/adapters/adapter-base.ts","../src/adapters/adapter-interface.ts","../src/adapters/adapter-loader.ts","../src/adapters/agents-md-generator.ts","../src/adapters/claude-md-generator.ts","../src/adapters/doc-generator.ts","../src/adapters/claude/adapter.ts","../src/adapters/codex/adapter.ts","../src/adapters/cursor/adapter.ts","../src/adapters/gemini/adapter.ts","../src/adapters/generic/adapter.ts","../src/cli/commands/abandon.ts","../src/cli/commands/check-discipline.ts","../src/cli/commands/cicd-monitor.ts","../src/cli/commands/detect-project.ts","../src/cli/commands/detect-specs.ts","../src/cli/commands/import-docs.ts","../src/cli/commands/init-multiproject.ts","../src/cli/commands/init.ts","../src/cli/commands/install.ts","../src/cli/commands/list.ts","../src/cli/commands/migrate-to-multiproject.ts","../src/cli/commands/migrate-to-profiles.ts","../src/cli/commands/pause.ts","../src/cli/commands/qa.ts","../src/cli/commands/resume.ts","../src/cli/commands/revert-wip-limit.ts","../src/cli/commands/status-line.ts","../src/cli/commands/status.ts","../src/cli/commands/switch-project.ts","../src/cli/commands/sync-spec-commits.ts","../src/cli/commands/sync-spec-content.ts","../src/cli/commands/validate-jira.ts","../src/cli/commands/validate-parent-repo.ts","../src/cli/commands/validate-plugins.ts","../src/cli/helpers/github/increment-profile-selector.ts","../src/cli/helpers/github/profile-manager.ts","../src/cli/helpers/issue-tracker/ado.ts","../src/cli/helpers/issue-tracker/github-multi-repo.ts","../src/cli/helpers/issue-tracker/github.ts","../src/cli/helpers/issue-tracker/index.ts","../src/cli/helpers/issue-tracker/jira.ts","../src/cli/helpers/issue-tracker/types.ts","../src/cli/helpers/issue-tracker/utils.ts","../src/core/comment-builder.ts","../src/core/config-manager.ts","../src/core/cost-tracker.ts","../src/core/credentials-manager.ts","../src/core/increment-status.ts","../src/core/plugin-loader.ts","../src/core/project-manager.ts","../src/core/project-structure-detector.ts","../src/core/rfc-generator-v2.ts","../src/core/spec-content-sync.ts","../src/core/spec-detector.ts","../src/core/spec-identifier-detector.ts","../src/core/spec-task-mapper.ts","../src/core/brownfield/analyzer.ts","../src/core/brownfield/importer.ts","../src/core/cicd/config-loader.ts","../src/core/cicd/index.ts","../src/core/cicd/monitor-service.ts","../src/core/cicd/notifier.ts","../src/core/cicd/parent-repo-validator.ts","../src/core/cicd/state-manager.ts","../src/core/cicd/types.ts","../src/core/cicd/workflow-monitor.ts","../src/core/i18n/language-detector.ts","../src/core/i18n/language-manager.ts","../src/core/i18n/language-registry.ts","../src/core/i18n/locale-manager.ts","../src/core/i18n/system-prompt-injector.ts","../src/core/i18n/types.ts","../src/core/increment/active-increment-manager.ts","../src/core/increment/discipline-checker.ts","../src/core/increment/limits.ts","../src/core/increment/metadata-manager.ts","../src/core/increment/metadata-validator.ts","../src/core/increment/status-commands.ts","../src/core/increment/types.ts","../src/core/living-docs/content-classifier.ts","../src/core/living-docs/content-distributor.ts","../src/core/living-docs/content-parser.ts","../src/core/living-docs/cross-linker.ts","../src/core/living-docs/index.ts","../src/core/living-docs/project-detector.ts","../src/core/living-docs/spec-distributor.ts","../src/core/living-docs/types.ts","../src/core/qa/qa-runner.ts","../src/core/qa/quality-gate-decider.ts","../src/core/qa/risk-calculator.ts","../src/core/qa/types.ts","../src/core/repo-structure/folder-detector.ts","../src/core/repo-structure/github-validator.ts","../src/core/repo-structure/prompt-consolidator.ts","../src/core/repo-structure/repo-id-generator.ts","../src/core/repo-structure/repo-structure-manager.ts","../src/core/repo-structure/setup-state-manager.ts","../src/core/repo-structure/setup-summary.ts","../src/core/specs/spec-metadata-manager.ts","../src/core/specs/spec-parser.ts","../src/core/status-line/status-line-manager.ts","../src/core/status-line/types.ts","../src/core/sync/bidirectional-engine.ts","../src/core/sync/conflict-resolver.ts","../src/core/sync/enhanced-content-builder.ts","../src/core/sync/folder-mapper.ts","../src/core/sync/profile-manager.ts","../src/core/sync/profile-selector.ts","../src/core/sync/profile-validator.ts","../src/core/sync/project-context.ts","../src/core/sync/rate-limiter.ts","../src/core/sync/retry-logic.ts","../src/core/sync/spec-increment-mapper.ts","../src/core/sync/status-cache.ts","../src/core/sync/status-mapper.ts","../src/core/sync/status-sync-engine.ts","../src/core/sync/sync-event-logger.ts","../src/core/sync/time-range-selector.ts","../src/core/sync/workflow-detector.ts","../src/core/types/config.ts","../src/core/types/increment-metadata.ts","../src/core/types/plugin.ts","../src/core/types/spec-identifier.ts","../src/core/types/spec-metadata.ts","../src/core/types/sync-profile.ts","../src/integrations/ado/ado-client.ts","../src/integrations/jira/jira-client.ts","../src/integrations/jira/jira-incremental-mapper.ts","../src/integrations/jira/jira-mapper.ts","../src/metrics/dora-calculator.ts","../src/metrics/github-client.ts","../src/metrics/report-generator.ts","../src/metrics/types.ts","../src/metrics/calculators/change-failure-rate.ts","../src/metrics/calculators/deployment-frequency.ts","../src/metrics/calculators/lead-time.ts","../src/metrics/calculators/mttr.ts","../src/metrics/utils/percentile.ts","../src/metrics/utils/tier-classifier.ts","../src/testing/test-generator.ts","../src/types/cost-tracking.ts","../src/types/model-selection.ts","../src/utils/agents-md-compiler.ts","../src/utils/auth-helpers.ts","../src/utils/auto-install.ts","../src/utils/claude-cli-detector.ts","../src/utils/cost-reporter.ts","../src/utils/env-file-generator.ts","../src/utils/env-file.ts","../src/utils/env-multi-project-parser.ts","../src/utils/esm-helpers.ts","../src/utils/execfilenothrow.ts","../src/utils/external-resource-validator.ts","../src/utils/generate-skills-index.ts","../src/utils/git-detector.ts","../src/utils/git-utils.ts","../src/utils/model-selection.ts","../src/utils/plugin-validator.ts","../src/utils/pricing-constants.ts","../src/utils/project-detection.ts","../src/utils/project-mapper.ts","../src/utils/project-validator.ts","../src/utils/spec-parser.ts","../src/utils/spec-splitter.ts","../src/utils/string-utils.ts","../src/utils/translation.ts","../src/utils/docs-preview/config-generator.ts","../src/utils/docs-preview/docusaurus-setup.ts","../src/utils/docs-preview/index.ts","../src/utils/docs-preview/package-installer.ts","../src/utils/docs-preview/server-manager.ts","../src/utils/docs-preview/sidebar-builder.ts","../src/utils/docs-preview/types.ts","../plugins/specweave/lib/hooks/git-diff-analyzer.ts","../plugins/specweave/lib/hooks/invoke-translator-skill.ts","../plugins/specweave/lib/hooks/prepare-reflection-context.ts","../plugins/specweave/lib/hooks/reflection-config-loader.ts","../plugins/specweave/lib/hooks/reflection-parser.ts","../plugins/specweave/lib/hooks/reflection-prompt-builder.ts","../plugins/specweave/lib/hooks/reflection-storage.ts","../plugins/specweave/lib/hooks/run-self-reflection.ts","../plugins/specweave/lib/hooks/sync-living-docs.ts","../plugins/specweave/lib/hooks/translate-file.ts","../plugins/specweave/lib/hooks/translate-living-docs.ts","../plugins/specweave/lib/hooks/update-tasks-md.ts","../plugins/specweave/lib/hooks/types/reflection-types.ts","../plugins/specweave-ado/lib/ado-board-resolver.d.ts","../plugins/specweave-ado/lib/ado-client-v2.ts","../plugins/specweave-ado/lib/ado-client.ts","../plugins/specweave-ado/lib/ado-hierarchical-sync.d.ts","../plugins/specweave-ado/lib/ado-spec-commit-sync.ts","../plugins/specweave-ado/lib/ado-spec-content-sync.ts","../plugins/specweave-ado/lib/ado-spec-sync.ts","../plugins/specweave-ado/lib/ado-status-sync.ts","../plugins/specweave-ado/lib/enhanced-ado-sync.ts","../plugins/specweave-ado/lib/project-selector.d.ts","../plugins/specweave-github/lib/cli-sync-increment-changes.ts","../plugins/specweave-github/lib/enhanced-github-sync.ts","../plugins/specweave-github/lib/github-board-resolver.d.ts","../plugins/specweave-github/lib/github-client-v2.ts","../plugins/specweave-github/lib/github-client.ts","../plugins/specweave-github/lib/github-epic-sync.ts","../plugins/specweave-github/lib/github-hierarchical-sync.d.ts","../plugins/specweave-github/lib/github-issue-updater.ts","../plugins/specweave-github/lib/github-spec-commit-sync.ts","../plugins/specweave-github/lib/github-spec-content-sync.ts","../plugins/specweave-github/lib/github-spec-sync.ts","../plugins/specweave-github/lib/github-status-sync.ts","../plugins/specweave-github/lib/github-sync-bidirectional.ts","../plugins/specweave-github/lib/github-sync-increment-changes.ts","../plugins/specweave-github/lib/index.ts","../plugins/specweave-github/lib/repo-selector.d.ts","../plugins/specweave-github/lib/subtask-sync.ts","../plugins/specweave-github/lib/task-parser.ts","../plugins/specweave-github/lib/task-sync.ts","../plugins/specweave-github/lib/types.ts","../plugins/specweave-jira/lib/enhanced-jira-sync.ts","../plugins/specweave-jira/lib/jira-board-resolver.d.ts","../plugins/specweave-jira/lib/jira-epic-sync.ts","../plugins/specweave-jira/lib/jira-hierarchical-sync.d.ts","../plugins/specweave-jira/lib/jira-spec-commit-sync.ts","../plugins/specweave-jira/lib/jira-spec-content-sync.ts","../plugins/specweave-jira/lib/jira-spec-sync.ts","../plugins/specweave-jira/lib/jira-status-sync.ts","../plugins/specweave-jira/lib/project-selector.d.ts","../plugins/specweave-jira/lib/reorganization-detector.ts","../plugins/specweave-jira/lib/setup-wizard.ts","../plugins/specweave-release/lib/dashboard-generator.ts","../plugins/specweave-release/lib/dora-tracker.ts"],"errors":true,"version":"5.9.3"}
@@ -1,170 +0,0 @@
1
- import { AdoClientV2 } from "./ado-client-v2.js";
2
- import { EnhancedContentBuilder } from "../../../src/core/sync/enhanced-content-builder.js";
3
- import { SpecIncrementMapper } from "../../../src/core/sync/spec-increment-mapper.js";
4
- import { parseSpecContent } from "../../../src/core/spec-content-sync.js";
5
- import path from "path";
6
- import fs from "fs/promises";
7
- async function syncSpecToAdoWithEnhancedContent(options) {
8
- const { specPath, organization, project, dryRun = false, verbose = false } = options;
9
- try {
10
- const baseSpec = await parseSpecContent(specPath);
11
- if (!baseSpec) {
12
- return {
13
- success: false,
14
- action: "error",
15
- error: "Failed to parse spec content"
16
- };
17
- }
18
- if (verbose) {
19
- console.log(`\u{1F4C4} Parsed spec: ${baseSpec.identifier.compact}`);
20
- }
21
- const specId = baseSpec.identifier.full || baseSpec.identifier.compact;
22
- const rootDir = await findSpecWeaveRoot(specPath);
23
- const mapper = new SpecIncrementMapper(rootDir);
24
- const mapping = await mapper.mapSpecToIncrements(specId);
25
- if (verbose) {
26
- console.log(`\u{1F517} Found ${mapping.increments.length} related increments`);
27
- }
28
- const taskMapping = buildTaskMapping(mapping.increments, organization, project);
29
- const architectureDocs = await findArchitectureDocs(rootDir, specId);
30
- const enhancedSpec = {
31
- ...baseSpec,
32
- summary: baseSpec.description,
33
- taskMapping,
34
- architectureDocs
35
- };
36
- const builder = new EnhancedContentBuilder();
37
- const description = builder.buildExternalDescription(enhancedSpec);
38
- if (verbose) {
39
- console.log(`\u{1F4DD} Generated description: ${description.length} characters`);
40
- }
41
- if (dryRun) {
42
- console.log("\u{1F50D} DRY RUN - Would create/update feature with:");
43
- console.log(` Title: ${baseSpec.title}`);
44
- console.log(` Description length: ${description.length}`);
45
- return {
46
- success: true,
47
- action: "no-change",
48
- tasksLinked: taskMapping?.tasks.length || 0
49
- };
50
- }
51
- if (!organization || !project) {
52
- return {
53
- success: false,
54
- action: "error",
55
- error: "Azure DevOps organization/project not specified"
56
- };
57
- }
58
- const profile = {
59
- provider: "ado",
60
- displayName: `${organization}/${project}`,
61
- config: {
62
- organization,
63
- project
64
- },
65
- timeRange: { default: "1M", max: "6M" }
66
- };
67
- const pat = process.env.AZURE_DEVOPS_PAT || "";
68
- const client = new AdoClientV2(profile, pat);
69
- const existingFeature = await findExistingFeature(client, baseSpec.identifier.compact);
70
- let result;
71
- if (existingFeature) {
72
- await client.updateWorkItem(existingFeature.id, {
73
- title: `[${baseSpec.identifier.compact}] ${baseSpec.title}`,
74
- description
75
- });
76
- result = {
77
- success: true,
78
- action: "updated",
79
- featureId: existingFeature.id,
80
- featureUrl: `https://dev.azure.com/${organization}/${project}/_workitems/edit/${existingFeature.id}`,
81
- tasksLinked: taskMapping?.tasks.length || 0
82
- };
83
- } else {
84
- const feature = await client.createEpic({
85
- title: `[${baseSpec.identifier.compact}] ${baseSpec.title}`,
86
- description,
87
- tags: ["spec", "external-tool-sync"]
88
- });
89
- result = {
90
- success: true,
91
- action: "created",
92
- featureId: feature.id,
93
- featureUrl: `https://dev.azure.com/${organization}/${project}/_workitems/edit/${feature.id}`,
94
- tasksLinked: taskMapping?.tasks.length || 0
95
- };
96
- }
97
- if (verbose) {
98
- console.log(`\u2705 ${result.action === "created" ? "Created" : "Updated"} feature #${result.featureId}`);
99
- }
100
- return result;
101
- } catch (error) {
102
- return {
103
- success: false,
104
- action: "error",
105
- error: error.message
106
- };
107
- }
108
- }
109
- async function findSpecWeaveRoot(specPath) {
110
- let currentDir = path.dirname(specPath);
111
- while (true) {
112
- const specweaveDir = path.join(currentDir, ".specweave");
113
- try {
114
- await fs.access(specweaveDir);
115
- return currentDir;
116
- } catch {
117
- const parentDir = path.dirname(currentDir);
118
- if (parentDir === currentDir) {
119
- throw new Error(".specweave directory not found");
120
- }
121
- currentDir = parentDir;
122
- }
123
- }
124
- }
125
- function buildTaskMapping(increments, organization, project) {
126
- if (increments.length === 0) return void 0;
127
- const firstIncrement = increments[0];
128
- const tasks = firstIncrement.tasks.map((task) => ({
129
- id: task.id,
130
- title: task.title,
131
- userStories: task.userStories
132
- }));
133
- return {
134
- incrementId: firstIncrement.id,
135
- tasks,
136
- tasksUrl: `https://dev.azure.com/${organization}/${project}/_git/repo?path=/.specweave/increments/${firstIncrement.id}/tasks.md`
137
- };
138
- }
139
- async function findArchitectureDocs(rootDir, specId) {
140
- const docs = [];
141
- const archDir = path.join(rootDir, ".specweave/docs/internal/architecture");
142
- try {
143
- const adrDir = path.join(archDir, "adr");
144
- try {
145
- const adrs = await fs.readdir(adrDir);
146
- const relatedAdrs = adrs.filter((file) => file.includes(specId.replace("spec-", "")));
147
- for (const adr of relatedAdrs) {
148
- docs.push({
149
- type: "adr",
150
- path: path.join(adrDir, adr),
151
- title: adr.replace(".md", "").replace(/-/g, " ")
152
- });
153
- }
154
- } catch {
155
- }
156
- } catch {
157
- }
158
- return docs;
159
- }
160
- async function findExistingFeature(client, specId) {
161
- try {
162
- const features = await client.queryWorkItems(`[System.Title] Contains '[${specId}]' AND [System.WorkItemType] = 'Feature'`);
163
- return features[0] || null;
164
- } catch {
165
- return null;
166
- }
167
- }
168
- export {
169
- syncSpecToAdoWithEnhancedContent
170
- };