@lumenflow/core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/README.md +119 -0
- package/dist/active-wu-detector.d.ts +33 -0
- package/dist/active-wu-detector.js +106 -0
- package/dist/adapters/filesystem-metrics.adapter.d.ts +108 -0
- package/dist/adapters/filesystem-metrics.adapter.js +519 -0
- package/dist/adapters/terminal-renderer.adapter.d.ts +106 -0
- package/dist/adapters/terminal-renderer.adapter.js +337 -0
- package/dist/arg-parser.d.ts +63 -0
- package/dist/arg-parser.js +560 -0
- package/dist/backlog-editor.d.ts +98 -0
- package/dist/backlog-editor.js +179 -0
- package/dist/backlog-generator.d.ts +111 -0
- package/dist/backlog-generator.js +381 -0
- package/dist/backlog-parser.d.ts +45 -0
- package/dist/backlog-parser.js +102 -0
- package/dist/backlog-sync-validator.d.ts +78 -0
- package/dist/backlog-sync-validator.js +294 -0
- package/dist/branch-drift.d.ts +34 -0
- package/dist/branch-drift.js +51 -0
- package/dist/cleanup-install-config.d.ts +33 -0
- package/dist/cleanup-install-config.js +37 -0
- package/dist/cleanup-lock.d.ts +139 -0
- package/dist/cleanup-lock.js +313 -0
- package/dist/code-path-validator.d.ts +146 -0
- package/dist/code-path-validator.js +537 -0
- package/dist/code-paths-overlap.d.ts +55 -0
- package/dist/code-paths-overlap.js +245 -0
- package/dist/commands-logger.d.ts +77 -0
- package/dist/commands-logger.js +254 -0
- package/dist/commit-message-utils.d.ts +25 -0
- package/dist/commit-message-utils.js +41 -0
- package/dist/compliance-parser.d.ts +150 -0
- package/dist/compliance-parser.js +507 -0
- package/dist/constants/backlog-patterns.d.ts +20 -0
- package/dist/constants/backlog-patterns.js +23 -0
- package/dist/constants/dora-constants.d.ts +49 -0
- package/dist/constants/dora-constants.js +53 -0
- package/dist/constants/gate-constants.d.ts +15 -0
- package/dist/constants/gate-constants.js +15 -0
- package/dist/constants/linter-constants.d.ts +16 -0
- package/dist/constants/linter-constants.js +16 -0
- package/dist/constants/tokenizer-constants.d.ts +15 -0
- package/dist/constants/tokenizer-constants.js +15 -0
- package/dist/core/scope-checker.d.ts +97 -0
- package/dist/core/scope-checker.js +163 -0
- package/dist/core/tool-runner.d.ts +161 -0
- package/dist/core/tool-runner.js +393 -0
- package/dist/core/tool.constants.d.ts +105 -0
- package/dist/core/tool.constants.js +101 -0
- package/dist/core/tool.schemas.d.ts +226 -0
- package/dist/core/tool.schemas.js +226 -0
- package/dist/core/worktree-guard.d.ts +130 -0
- package/dist/core/worktree-guard.js +242 -0
- package/dist/coverage-gate.d.ts +108 -0
- package/dist/coverage-gate.js +196 -0
- package/dist/date-utils.d.ts +75 -0
- package/dist/date-utils.js +140 -0
- package/dist/dependency-graph.d.ts +142 -0
- package/dist/dependency-graph.js +550 -0
- package/dist/dependency-guard.d.ts +54 -0
- package/dist/dependency-guard.js +142 -0
- package/dist/dependency-validator.d.ts +105 -0
- package/dist/dependency-validator.js +154 -0
- package/dist/docs-path-validator.d.ts +36 -0
- package/dist/docs-path-validator.js +95 -0
- package/dist/domain/orchestration.constants.d.ts +99 -0
- package/dist/domain/orchestration.constants.js +97 -0
- package/dist/domain/orchestration.schemas.d.ts +280 -0
- package/dist/domain/orchestration.schemas.js +211 -0
- package/dist/domain/orchestration.types.d.ts +133 -0
- package/dist/domain/orchestration.types.js +12 -0
- package/dist/error-handler.d.ts +116 -0
- package/dist/error-handler.js +136 -0
- package/dist/file-classifiers.d.ts +62 -0
- package/dist/file-classifiers.js +108 -0
- package/dist/gates-agent-mode.d.ts +81 -0
- package/dist/gates-agent-mode.js +94 -0
- package/dist/generate-traceability.d.ts +107 -0
- package/dist/generate-traceability.js +411 -0
- package/dist/git-adapter.d.ts +395 -0
- package/dist/git-adapter.js +649 -0
- package/dist/git-staged-validator.d.ts +32 -0
- package/dist/git-staged-validator.js +48 -0
- package/dist/hardcoded-strings.d.ts +61 -0
- package/dist/hardcoded-strings.js +270 -0
- package/dist/incremental-lint.d.ts +78 -0
- package/dist/incremental-lint.js +129 -0
- package/dist/incremental-test.d.ts +39 -0
- package/dist/incremental-test.js +61 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +61 -0
- package/dist/invariants/check-automated-tests.d.ts +50 -0
- package/dist/invariants/check-automated-tests.js +166 -0
- package/dist/invariants-runner.d.ts +103 -0
- package/dist/invariants-runner.js +527 -0
- package/dist/lane-checker.d.ts +50 -0
- package/dist/lane-checker.js +319 -0
- package/dist/lane-inference.d.ts +39 -0
- package/dist/lane-inference.js +195 -0
- package/dist/lane-lock.d.ts +211 -0
- package/dist/lane-lock.js +474 -0
- package/dist/lane-validator.d.ts +48 -0
- package/dist/lane-validator.js +114 -0
- package/dist/logs-lib.d.ts +104 -0
- package/dist/logs-lib.js +207 -0
- package/dist/lumenflow-config-schema.d.ts +272 -0
- package/dist/lumenflow-config-schema.js +207 -0
- package/dist/lumenflow-config.d.ts +95 -0
- package/dist/lumenflow-config.js +236 -0
- package/dist/manual-test-validator.d.ts +80 -0
- package/dist/manual-test-validator.js +200 -0
- package/dist/merge-lock.d.ts +115 -0
- package/dist/merge-lock.js +251 -0
- package/dist/micro-worktree.d.ts +159 -0
- package/dist/micro-worktree.js +427 -0
- package/dist/migration-deployer.d.ts +69 -0
- package/dist/migration-deployer.js +151 -0
- package/dist/orchestration-advisory-loader.d.ts +28 -0
- package/dist/orchestration-advisory-loader.js +87 -0
- package/dist/orchestration-advisory.d.ts +58 -0
- package/dist/orchestration-advisory.js +94 -0
- package/dist/orchestration-di.d.ts +48 -0
- package/dist/orchestration-di.js +57 -0
- package/dist/orchestration-rules.d.ts +57 -0
- package/dist/orchestration-rules.js +201 -0
- package/dist/orphan-detector.d.ts +131 -0
- package/dist/orphan-detector.js +226 -0
- package/dist/path-classifiers.d.ts +57 -0
- package/dist/path-classifiers.js +93 -0
- package/dist/piped-command-detector.d.ts +34 -0
- package/dist/piped-command-detector.js +64 -0
- package/dist/ports/dashboard-renderer.port.d.ts +112 -0
- package/dist/ports/dashboard-renderer.port.js +25 -0
- package/dist/ports/metrics-collector.port.d.ts +132 -0
- package/dist/ports/metrics-collector.port.js +26 -0
- package/dist/process-detector.d.ts +84 -0
- package/dist/process-detector.js +172 -0
- package/dist/prompt-linter.d.ts +72 -0
- package/dist/prompt-linter.js +312 -0
- package/dist/prompt-monitor.d.ts +15 -0
- package/dist/prompt-monitor.js +205 -0
- package/dist/rebase-artifact-cleanup.d.ts +145 -0
- package/dist/rebase-artifact-cleanup.js +433 -0
- package/dist/retry-strategy.d.ts +189 -0
- package/dist/retry-strategy.js +283 -0
- package/dist/risk-detector.d.ts +108 -0
- package/dist/risk-detector.js +252 -0
- package/dist/rollback-utils.d.ts +76 -0
- package/dist/rollback-utils.js +104 -0
- package/dist/section-headings.d.ts +43 -0
- package/dist/section-headings.js +49 -0
- package/dist/spawn-escalation.d.ts +90 -0
- package/dist/spawn-escalation.js +253 -0
- package/dist/spawn-monitor.d.ts +229 -0
- package/dist/spawn-monitor.js +672 -0
- package/dist/spawn-recovery.d.ts +82 -0
- package/dist/spawn-recovery.js +298 -0
- package/dist/spawn-registry-schema.d.ts +98 -0
- package/dist/spawn-registry-schema.js +108 -0
- package/dist/spawn-registry-store.d.ts +146 -0
- package/dist/spawn-registry-store.js +273 -0
- package/dist/spawn-tree.d.ts +121 -0
- package/dist/spawn-tree.js +285 -0
- package/dist/stamp-status-validator.d.ts +84 -0
- package/dist/stamp-status-validator.js +134 -0
- package/dist/stamp-utils.d.ts +100 -0
- package/dist/stamp-utils.js +229 -0
- package/dist/state-machine.d.ts +26 -0
- package/dist/state-machine.js +83 -0
- package/dist/system-map-validator.d.ts +80 -0
- package/dist/system-map-validator.js +272 -0
- package/dist/telemetry.d.ts +80 -0
- package/dist/telemetry.js +213 -0
- package/dist/token-counter.d.ts +51 -0
- package/dist/token-counter.js +145 -0
- package/dist/usecases/get-dashboard-data.usecase.d.ts +52 -0
- package/dist/usecases/get-dashboard-data.usecase.js +61 -0
- package/dist/usecases/get-suggestions.usecase.d.ts +100 -0
- package/dist/usecases/get-suggestions.usecase.js +153 -0
- package/dist/user-normalizer.d.ts +41 -0
- package/dist/user-normalizer.js +141 -0
- package/dist/validators/phi-constants.d.ts +97 -0
- package/dist/validators/phi-constants.js +152 -0
- package/dist/validators/phi-scanner.d.ts +58 -0
- package/dist/validators/phi-scanner.js +215 -0
- package/dist/worktree-ownership.d.ts +50 -0
- package/dist/worktree-ownership.js +74 -0
- package/dist/worktree-scanner.d.ts +103 -0
- package/dist/worktree-scanner.js +168 -0
- package/dist/worktree-symlink.d.ts +99 -0
- package/dist/worktree-symlink.js +359 -0
- package/dist/wu-backlog-updater.d.ts +17 -0
- package/dist/wu-backlog-updater.js +37 -0
- package/dist/wu-checkpoint.d.ts +124 -0
- package/dist/wu-checkpoint.js +233 -0
- package/dist/wu-claim-helpers.d.ts +26 -0
- package/dist/wu-claim-helpers.js +63 -0
- package/dist/wu-claim-resume.d.ts +106 -0
- package/dist/wu-claim-resume.js +276 -0
- package/dist/wu-consistency-checker.d.ts +95 -0
- package/dist/wu-consistency-checker.js +567 -0
- package/dist/wu-constants.d.ts +1275 -0
- package/dist/wu-constants.js +1382 -0
- package/dist/wu-create-validators.d.ts +42 -0
- package/dist/wu-create-validators.js +93 -0
- package/dist/wu-done-branch-only.d.ts +63 -0
- package/dist/wu-done-branch-only.js +191 -0
- package/dist/wu-done-messages.d.ts +119 -0
- package/dist/wu-done-messages.js +185 -0
- package/dist/wu-done-pr.d.ts +72 -0
- package/dist/wu-done-pr.js +174 -0
- package/dist/wu-done-retry-helpers.d.ts +85 -0
- package/dist/wu-done-retry-helpers.js +172 -0
- package/dist/wu-done-ui.d.ts +37 -0
- package/dist/wu-done-ui.js +69 -0
- package/dist/wu-done-validators.d.ts +411 -0
- package/dist/wu-done-validators.js +1229 -0
- package/dist/wu-done-worktree.d.ts +182 -0
- package/dist/wu-done-worktree.js +1097 -0
- package/dist/wu-helpers.d.ts +128 -0
- package/dist/wu-helpers.js +248 -0
- package/dist/wu-lint.d.ts +70 -0
- package/dist/wu-lint.js +234 -0
- package/dist/wu-paths.d.ts +171 -0
- package/dist/wu-paths.js +178 -0
- package/dist/wu-preflight-validators.d.ts +86 -0
- package/dist/wu-preflight-validators.js +251 -0
- package/dist/wu-recovery.d.ts +138 -0
- package/dist/wu-recovery.js +341 -0
- package/dist/wu-repair-core.d.ts +131 -0
- package/dist/wu-repair-core.js +669 -0
- package/dist/wu-schema-normalization.d.ts +17 -0
- package/dist/wu-schema-normalization.js +82 -0
- package/dist/wu-schema.d.ts +793 -0
- package/dist/wu-schema.js +881 -0
- package/dist/wu-spawn-helpers.d.ts +121 -0
- package/dist/wu-spawn-helpers.js +271 -0
- package/dist/wu-spawn.d.ts +158 -0
- package/dist/wu-spawn.js +1306 -0
- package/dist/wu-state-schema.d.ts +213 -0
- package/dist/wu-state-schema.js +156 -0
- package/dist/wu-state-store.d.ts +264 -0
- package/dist/wu-state-store.js +691 -0
- package/dist/wu-status-transition.d.ts +63 -0
- package/dist/wu-status-transition.js +382 -0
- package/dist/wu-status-updater.d.ts +25 -0
- package/dist/wu-status-updater.js +116 -0
- package/dist/wu-transaction-collectors.d.ts +116 -0
- package/dist/wu-transaction-collectors.js +272 -0
- package/dist/wu-transaction.d.ts +170 -0
- package/dist/wu-transaction.js +273 -0
- package/dist/wu-validation-constants.d.ts +60 -0
- package/dist/wu-validation-constants.js +66 -0
- package/dist/wu-validation.d.ts +118 -0
- package/dist/wu-validation.js +243 -0
- package/dist/wu-validator.d.ts +62 -0
- package/dist/wu-validator.js +325 -0
- package/dist/wu-yaml-fixer.d.ts +97 -0
- package/dist/wu-yaml-fixer.js +264 -0
- package/dist/wu-yaml.d.ts +86 -0
- package/dist/wu-yaml.js +222 -0
- package/package.json +114 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file date-utils.mjs
|
|
3
|
+
* @description Date formatting utilities using date-fns library
|
|
4
|
+
* WU-1082: Extract shared utilities (eliminate date formatting duplication)
|
|
5
|
+
*
|
|
6
|
+
* Replaces manual date formatting in:
|
|
7
|
+
* - tools/wu-block.mjs (todayISO)
|
|
8
|
+
* - tools/wu-unblock.mjs (todayISO)
|
|
9
|
+
* - tools/wu-done.mjs (todayISO - already uses date-fns)
|
|
10
|
+
*/
|
|
11
|
+
import { format } from 'date-fns';
|
|
12
|
+
/**
|
|
13
|
+
* Get current date in ISO format (YYYY-MM-DD)
|
|
14
|
+
* @returns {string} Current date in YYYY-MM-DD format
|
|
15
|
+
* @example
|
|
16
|
+
* todayISO(); // "2025-11-12"
|
|
17
|
+
*/
|
|
18
|
+
export function todayISO() {
|
|
19
|
+
return format(new Date(), 'yyyy-MM-dd');
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Format a date with a custom format string
|
|
23
|
+
* @param {Date|string|number} date - Date to format
|
|
24
|
+
* @param {string} formatString - date-fns format string
|
|
25
|
+
* @returns {string} Formatted date string
|
|
26
|
+
* @example
|
|
27
|
+
* formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss');
|
|
28
|
+
* formatDate('2025-11-12', 'MMMM d, yyyy'); // "November 12, 2025"
|
|
29
|
+
*/
|
|
30
|
+
export function formatDate(date, formatString) {
|
|
31
|
+
return format(new Date(date), formatString);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Date format constant for YYYY-MM-DD
|
|
35
|
+
* @constant {string}
|
|
36
|
+
*/
|
|
37
|
+
const DATE_FORMAT_ISO = 'yyyy-MM-dd';
|
|
38
|
+
/**
|
|
39
|
+
* Normalize a Date object or ISO timestamp string to YYYY-MM-DD format
|
|
40
|
+
*
|
|
41
|
+
* WU-1442: Fix date corruption when js-yaml parses YYYY-MM-DD as Date objects
|
|
42
|
+
* Library-First: Uses date-fns for date formatting (no manual parsing)
|
|
43
|
+
*
|
|
44
|
+
* Use case: js-yaml parses `created: 2025-12-04` (unquoted) as a Date object.
|
|
45
|
+
* When yaml.dump() serializes it back, it outputs `2025-12-04T00:00:00.000Z`.
|
|
46
|
+
* This function normalizes Date objects back to YYYY-MM-DD string format.
|
|
47
|
+
*
|
|
48
|
+
* Handles:
|
|
49
|
+
* - Date objects → YYYY-MM-DD string
|
|
50
|
+
* - ISO timestamp strings → YYYY-MM-DD string (date portion)
|
|
51
|
+
* - YYYY-MM-DD strings → preserved as-is
|
|
52
|
+
* - undefined/null → preserved as undefined
|
|
53
|
+
*
|
|
54
|
+
* @param {Date|string|undefined|null} value - Date value to normalize
|
|
55
|
+
* @returns {string|undefined} Date in YYYY-MM-DD format or undefined
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* normalizeToDateString(new Date('2025-12-04')); // '2025-12-04'
|
|
59
|
+
* normalizeToDateString('2025-12-04T00:00:00.000Z'); // '2025-12-04'
|
|
60
|
+
* normalizeToDateString('2025-12-04'); // '2025-12-04'
|
|
61
|
+
* normalizeToDateString(undefined); // undefined
|
|
62
|
+
*/
|
|
63
|
+
export function normalizeToDateString(value) {
|
|
64
|
+
// Preserve undefined/null
|
|
65
|
+
if (value == null) {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
// If already a YYYY-MM-DD string, return as-is
|
|
69
|
+
if (typeof value === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
70
|
+
return value;
|
|
71
|
+
}
|
|
72
|
+
// Convert Date objects or timestamp strings to YYYY-MM-DD
|
|
73
|
+
if (value instanceof Date) {
|
|
74
|
+
return format(value, DATE_FORMAT_ISO);
|
|
75
|
+
}
|
|
76
|
+
// Handle ISO timestamp strings (e.g., '2025-12-04T00:00:00.000Z')
|
|
77
|
+
if (typeof value === 'string' && /^\d{4}-\d{2}-\d{2}T/.test(value)) {
|
|
78
|
+
return format(new Date(value), DATE_FORMAT_ISO);
|
|
79
|
+
}
|
|
80
|
+
// Fallback: try to parse and format
|
|
81
|
+
try {
|
|
82
|
+
const date = new Date(value);
|
|
83
|
+
if (!isNaN(date.getTime())) {
|
|
84
|
+
return format(date, DATE_FORMAT_ISO);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
// Invalid date - return undefined
|
|
89
|
+
}
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Normalize various date formats to ISO 8601 datetime (YYYY-MM-DDTHH:mm:ss.sssZ)
|
|
94
|
+
*
|
|
95
|
+
* WU-1337: Auto-repair date fields in WU YAML to consistent format
|
|
96
|
+
* Library-First: Uses date-fns for date handling (no manual parsing)
|
|
97
|
+
*
|
|
98
|
+
* Handles:
|
|
99
|
+
* - ISO date strings (YYYY-MM-DD) → midnight UTC
|
|
100
|
+
* - ISO datetime strings (already valid) → preserved
|
|
101
|
+
* - Unix timestamps (milliseconds) → converted
|
|
102
|
+
* - undefined/null → preserved as undefined
|
|
103
|
+
*
|
|
104
|
+
* @param {string|number|undefined|null} value - Date value to normalize
|
|
105
|
+
* @returns {string|undefined} ISO datetime string or undefined
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* normalizeISODateTime('2025-11-29'); // '2025-11-29T00:00:00.000Z'
|
|
109
|
+
* normalizeISODateTime('2025-11-29T14:30:00.000Z'); // '2025-11-29T14:30:00.000Z'
|
|
110
|
+
* normalizeISODateTime(1732896000000); // '2024-11-29T16:00:00.000Z'
|
|
111
|
+
* normalizeISODateTime(undefined); // undefined
|
|
112
|
+
*/
|
|
113
|
+
export function normalizeISODateTime(value) {
|
|
114
|
+
// Preserve undefined/null (optional fields)
|
|
115
|
+
if (value == null) {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
// If already a valid ISO datetime format, preserve it
|
|
119
|
+
// Pattern: YYYY-MM-DDTHH:mm:ss.sssZ
|
|
120
|
+
if (typeof value === 'string' && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(value)) {
|
|
121
|
+
return value;
|
|
122
|
+
}
|
|
123
|
+
// Handle Unix timestamps as strings (convert to number first)
|
|
124
|
+
let dateInput = value;
|
|
125
|
+
if (typeof value === 'string' && /^\d+$/.test(value)) {
|
|
126
|
+
// Numeric string - treat as Unix timestamp in milliseconds
|
|
127
|
+
dateInput = Number(value);
|
|
128
|
+
}
|
|
129
|
+
// Parse and convert to ISO datetime
|
|
130
|
+
// date-fns/Date handles: ISO dates, ISO datetimes, Unix timestamps
|
|
131
|
+
const date = new Date(dateInput);
|
|
132
|
+
// Check for invalid date
|
|
133
|
+
if (isNaN(date.getTime())) {
|
|
134
|
+
// Fallback: return undefined for unparseable dates
|
|
135
|
+
// Zod schema will catch invalid dates separately
|
|
136
|
+
return undefined;
|
|
137
|
+
}
|
|
138
|
+
// Convert to ISO 8601 datetime format
|
|
139
|
+
return date.toISOString();
|
|
140
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency Graph Module (WU-1247, WU-1568)
|
|
3
|
+
*
|
|
4
|
+
* Provides graph building, visualization, and analysis for WU dependencies.
|
|
5
|
+
* Supports ASCII tree and Mermaid diagram output formats.
|
|
6
|
+
* Includes graph algorithms for operational insights: topological sort,
|
|
7
|
+
* critical path, impact scoring, and bottleneck detection.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* import { buildDependencyGraph, renderASCII, renderMermaid, topologicalSort, criticalPath, bottlenecks } from './lib/dependency-graph.js';
|
|
11
|
+
*
|
|
12
|
+
* const graph = buildDependencyGraph();
|
|
13
|
+
* console.log(renderASCII(graph, 'WU-1247'));
|
|
14
|
+
* console.log(renderMermaid(graph, { direction: 'TD' }));
|
|
15
|
+
*
|
|
16
|
+
* // Graph analysis (WU-1568)
|
|
17
|
+
* const sorted = topologicalSort(graph);
|
|
18
|
+
* const critical = criticalPath(graph);
|
|
19
|
+
* const topBottlenecks = bottlenecks(graph, 10);
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Build a dependency graph from all WU YAML files.
|
|
23
|
+
*
|
|
24
|
+
* @returns {Map<string, {id: string, title: string, status: string, blocks: string[], blockedBy: string[]}>}
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildDependencyGraph(): Map<any, any>;
|
|
27
|
+
/**
|
|
28
|
+
* Get all dependencies (upstream: blocked_by) for a WU.
|
|
29
|
+
*
|
|
30
|
+
* @param {Map} graph - Dependency graph
|
|
31
|
+
* @param {string} wuId - WU ID to get dependencies for
|
|
32
|
+
* @param {number} [maxDepth=10] - Maximum traversal depth
|
|
33
|
+
* @returns {Array<{id: string, depth: number, path: string[]}>}
|
|
34
|
+
*/
|
|
35
|
+
export declare function getUpstreamDependencies(graph: any, wuId: any, maxDepth?: number): any[];
|
|
36
|
+
/**
|
|
37
|
+
* Get all dependents (downstream: blocks) for a WU.
|
|
38
|
+
*
|
|
39
|
+
* @param {Map} graph - Dependency graph
|
|
40
|
+
* @param {string} wuId - WU ID to get dependents for
|
|
41
|
+
* @param {number} [maxDepth=10] - Maximum traversal depth
|
|
42
|
+
* @returns {Array<{id: string, depth: number, path: string[]}>}
|
|
43
|
+
*/
|
|
44
|
+
export declare function getDownstreamDependents(graph: any, wuId: any, maxDepth?: number): any[];
|
|
45
|
+
/**
|
|
46
|
+
* Options for rendering ASCII tree
|
|
47
|
+
*/
|
|
48
|
+
export interface RenderASCIIOptions {
|
|
49
|
+
/** Direction to traverse: 'up', 'down', or 'both' */
|
|
50
|
+
direction?: 'up' | 'down' | 'both';
|
|
51
|
+
/** Maximum depth to traverse */
|
|
52
|
+
depth?: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Render dependency graph as ASCII tree.
|
|
56
|
+
*
|
|
57
|
+
* @param {Map} graph - Dependency graph
|
|
58
|
+
* @param {string} rootId - Root WU ID
|
|
59
|
+
* @param {RenderASCIIOptions} [options] - Render options
|
|
60
|
+
* @returns {string} ASCII tree representation
|
|
61
|
+
*/
|
|
62
|
+
export declare function renderASCII(graph: any, rootId: any, options?: RenderASCIIOptions): string;
|
|
63
|
+
/**
|
|
64
|
+
* Options for rendering Mermaid diagram
|
|
65
|
+
*/
|
|
66
|
+
export interface RenderMermaidOptions {
|
|
67
|
+
/** Optional root WU ID to focus on */
|
|
68
|
+
rootId?: string;
|
|
69
|
+
/** Diagram direction: 'TD', 'LR', 'BT', 'RL' */
|
|
70
|
+
direction?: 'TD' | 'LR' | 'BT' | 'RL';
|
|
71
|
+
/** Maximum depth from root */
|
|
72
|
+
depth?: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Render dependency graph as Mermaid diagram.
|
|
76
|
+
*
|
|
77
|
+
* @param {Map} graph - Dependency graph
|
|
78
|
+
* @param {RenderMermaidOptions} [options] - Render options
|
|
79
|
+
* @returns {string} Mermaid diagram syntax
|
|
80
|
+
*/
|
|
81
|
+
export declare function renderMermaid(graph: any, options?: RenderMermaidOptions): string;
|
|
82
|
+
/**
|
|
83
|
+
* Validate dependency graph for cycles and orphans.
|
|
84
|
+
*
|
|
85
|
+
* @param {Map} graph - Dependency graph
|
|
86
|
+
* @returns {{hasCycle: boolean, cycles: string[][], orphans: Array<{wuId: string, ref: string}>}}
|
|
87
|
+
*/
|
|
88
|
+
export declare function validateGraph(graph: any): {
|
|
89
|
+
hasCycle: boolean;
|
|
90
|
+
cycles: string[][];
|
|
91
|
+
orphans: any[];
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Perform topological sort on non-done WUs using Kahn's algorithm.
|
|
95
|
+
* Returns valid execution ordering where dependencies come before dependents.
|
|
96
|
+
* Handles cycles gracefully by returning partial ordering with warning.
|
|
97
|
+
*
|
|
98
|
+
* @param {Map} graph - Dependency graph
|
|
99
|
+
* @returns {string[]|{order: string[], warning: string, cycleNodes: string[]}} Sorted WU IDs or warning object
|
|
100
|
+
*/
|
|
101
|
+
export declare function topologicalSort(graph: any): any[] | {
|
|
102
|
+
order: any[];
|
|
103
|
+
warning: string;
|
|
104
|
+
cycleNodes: any[];
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Find the critical path (longest dependency chain) in the graph.
|
|
108
|
+
* Uses dynamic programming on the DAG to find the longest path.
|
|
109
|
+
* Excludes done WUs from the path.
|
|
110
|
+
*
|
|
111
|
+
* @param {Map} graph - Dependency graph
|
|
112
|
+
* @returns {{path: string[], length: number, warning?: string}} Critical path info
|
|
113
|
+
*/
|
|
114
|
+
export declare function criticalPath(graph: any): {
|
|
115
|
+
path: any[];
|
|
116
|
+
length: number;
|
|
117
|
+
warning: string;
|
|
118
|
+
} | {
|
|
119
|
+
path: any[];
|
|
120
|
+
length: number;
|
|
121
|
+
warning?: undefined;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Calculate the impact score for a WU.
|
|
125
|
+
* Impact score is the count of all downstream dependents (recursive).
|
|
126
|
+
* Excludes done WUs from the count.
|
|
127
|
+
*
|
|
128
|
+
* @param {Map} graph - Dependency graph
|
|
129
|
+
* @param {string} wuId - WU ID to score
|
|
130
|
+
* @returns {number} Count of downstream dependents
|
|
131
|
+
*/
|
|
132
|
+
export declare function impactScore(graph: any, wuId: any): number;
|
|
133
|
+
/**
|
|
134
|
+
* Find the top N bottleneck WUs by impact score.
|
|
135
|
+
* A bottleneck is a WU that blocks many other WUs.
|
|
136
|
+
* Excludes done WUs from results.
|
|
137
|
+
*
|
|
138
|
+
* @param {Map} graph - Dependency graph
|
|
139
|
+
* @param {number} limit - Maximum number of bottlenecks to return
|
|
140
|
+
* @returns {Array<{id: string, score: number, title?: string}>} Bottlenecks sorted by score descending
|
|
141
|
+
*/
|
|
142
|
+
export declare function bottlenecks(graph: any, limit: any): any[];
|