@lumenflow/core 1.3.0 → 1.3.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.
Files changed (44) hide show
  1. package/dist/arg-parser.d.ts +6 -0
  2. package/dist/arg-parser.js +16 -0
  3. package/dist/core/tool.schemas.d.ts +1 -1
  4. package/dist/coverage-gate.d.ts +3 -0
  5. package/dist/coverage-gate.js +7 -4
  6. package/dist/force-bypass-audit.d.ts +63 -0
  7. package/dist/force-bypass-audit.js +140 -0
  8. package/dist/gates-config.d.ts +132 -0
  9. package/dist/gates-config.js +229 -0
  10. package/dist/git-adapter.d.ts +7 -0
  11. package/dist/git-adapter.js +15 -1
  12. package/dist/index.d.ts +3 -0
  13. package/dist/index.js +6 -0
  14. package/dist/lumenflow-config-schema.d.ts +97 -0
  15. package/dist/lumenflow-config-schema.js +9 -0
  16. package/dist/lumenflow-home.d.ts +130 -0
  17. package/dist/lumenflow-home.js +211 -0
  18. package/dist/manual-test-validator.d.ts +3 -0
  19. package/dist/manual-test-validator.js +7 -4
  20. package/dist/orphan-detector.d.ts +16 -0
  21. package/dist/orphan-detector.js +24 -0
  22. package/dist/prompt-linter.js +2 -1
  23. package/dist/prompt-monitor.js +3 -1
  24. package/dist/spec-branch-helpers.d.ts +118 -0
  25. package/dist/spec-branch-helpers.js +199 -0
  26. package/dist/user-normalizer.d.ts +5 -1
  27. package/dist/user-normalizer.js +6 -1
  28. package/dist/validators/phi-scanner.js +6 -0
  29. package/dist/worktree-symlink.d.ts +4 -0
  30. package/dist/worktree-symlink.js +14 -20
  31. package/dist/wu-consistency-checker.d.ts +2 -0
  32. package/dist/wu-consistency-checker.js +35 -1
  33. package/dist/wu-constants.d.ts +193 -0
  34. package/dist/wu-constants.js +200 -4
  35. package/dist/wu-create-validators.d.ts +57 -2
  36. package/dist/wu-create-validators.js +111 -2
  37. package/dist/wu-done-branch-only.js +9 -0
  38. package/dist/wu-done-docs-generate.d.ts +73 -0
  39. package/dist/wu-done-docs-generate.js +108 -0
  40. package/dist/wu-done-worktree.js +12 -0
  41. package/dist/wu-schema.js +3 -1
  42. package/dist/wu-spawn.js +15 -2
  43. package/dist/wu-yaml-fixer.js +6 -3
  44. package/package.json +12 -11
@@ -40,6 +40,10 @@ export declare const GIT_REFS: {
40
40
  ORIGIN_MAIN: string;
41
41
  /** Current HEAD ref */
42
42
  HEAD: string;
43
+ /** Upstream ref */
44
+ UPSTREAM: string;
45
+ /** Range of upstream..HEAD */
46
+ UPSTREAM_RANGE: string;
43
47
  /** Fetch head ref */
44
48
  FETCH_HEAD: string;
45
49
  };
@@ -258,6 +262,22 @@ export declare const CONSISTENCY_TYPES: {
258
262
  ORPHAN_WORKTREE_DONE: string;
259
263
  /** Stamp file exists but WU YAML status is not 'done' (partial wu:done failure) */
260
264
  STAMP_EXISTS_YAML_NOT_DONE: string;
265
+ /** WU is claimed but its worktree directory is missing */
266
+ MISSING_WORKTREE_CLAIMED: string;
267
+ };
268
+ /**
269
+ * Consistency check messages
270
+ */
271
+ export declare const CONSISTENCY_MESSAGES: {
272
+ MISSING_WORKTREE_CLAIMED: (id: any, status: any, worktreePath: any) => string;
273
+ MISSING_WORKTREE_CLAIMED_REPAIR: string;
274
+ };
275
+ /**
276
+ * Worktree warning messages
277
+ */
278
+ export declare const WORKTREE_WARNINGS: {
279
+ MISSING_TRACKED_HEADER: string;
280
+ MISSING_TRACKED_LINE: (worktreePath: any) => string;
261
281
  };
262
282
  /**
263
283
  * File system constants
@@ -364,6 +384,55 @@ export declare const DEFAULTS: {
364
384
  MAX_COMMIT_SUBJECT: number;
365
385
  /** Parent directory traversal depth from tools/lib to project root */
366
386
  PROJECT_ROOT_DEPTH: number;
387
+ /**
388
+ * Default email domain for username -> email conversion
389
+ * WU-1068: Made configurable, no longer hardcoded to patientpath.co.uk
390
+ * @see user-normalizer.ts - Infers from git config first
391
+ */
392
+ EMAIL_DOMAIN: string;
393
+ };
394
+ /**
395
+ * Process argv indices (WU-1068)
396
+ *
397
+ * Centralized indices for process.argv access to eliminate magic numbers.
398
+ * In Node.js: argv[0] = node, argv[1] = script, argv[2+] = args
399
+ */
400
+ export declare const ARGV_INDICES: {
401
+ /** Node executable path */
402
+ NODE: number;
403
+ /** Script path */
404
+ SCRIPT: number;
405
+ /** First user argument */
406
+ FIRST_ARG: number;
407
+ /** Second user argument */
408
+ SECOND_ARG: number;
409
+ };
410
+ /**
411
+ * Display limits for CLI output (WU-1068)
412
+ *
413
+ * Centralized limits for truncating display strings to avoid magic numbers.
414
+ */
415
+ export declare const DISPLAY_LIMITS: {
416
+ /** Maximum items to show in lists before truncating */
417
+ LIST_ITEMS: number;
418
+ /** Maximum items to show in short lists */
419
+ SHORT_LIST: number;
420
+ /** Maximum characters for content preview */
421
+ CONTENT_PREVIEW: number;
422
+ /** Maximum characters for short preview */
423
+ SHORT_PREVIEW: number;
424
+ /** Maximum characters for title display */
425
+ TITLE: number;
426
+ /** Maximum characters for truncated title */
427
+ TRUNCATED_TITLE: number;
428
+ /** Maximum characters for command preview */
429
+ CMD_PREVIEW: number;
430
+ /** Maximum lines to preview from files */
431
+ FILE_LINES: number;
432
+ /** Maximum commits to show in lists */
433
+ COMMITS: number;
434
+ /** Maximum overlaps to display */
435
+ OVERLAPS: number;
367
436
  };
368
437
  /**
369
438
  * YAML serialization options
@@ -404,6 +473,59 @@ export declare const BOX: {
404
473
  /** Side border for content lines */
405
474
  SIDE: string;
406
475
  };
476
+ /**
477
+ * Cleanup guard constants
478
+ */
479
+ export declare const CLEANUP_GUARD: {
480
+ REASONS: {
481
+ UNCOMMITTED_CHANGES: string;
482
+ UNPUSHED_COMMITS: string;
483
+ STATUS_NOT_DONE: string;
484
+ MISSING_STAMP: string;
485
+ PR_NOT_MERGED: string;
486
+ };
487
+ TITLES: {
488
+ BLOCKED: string;
489
+ NEXT_STEPS: string;
490
+ };
491
+ MESSAGES: {
492
+ UNCOMMITTED_CHANGES: string;
493
+ UNPUSHED_COMMITS: string;
494
+ STATUS_NOT_DONE: string;
495
+ MISSING_STAMP: string;
496
+ PR_NOT_MERGED: string;
497
+ };
498
+ NEXT_STEPS: {
499
+ DEFAULT: {
500
+ text: string;
501
+ appendId: boolean;
502
+ }[];
503
+ UNCOMMITTED_CHANGES: {
504
+ text: string;
505
+ appendId: boolean;
506
+ }[];
507
+ UNPUSHED_COMMITS: {
508
+ text: string;
509
+ appendId: boolean;
510
+ }[];
511
+ STATUS_NOT_DONE: {
512
+ text: string;
513
+ appendId: boolean;
514
+ }[];
515
+ MISSING_STAMP: {
516
+ text: string;
517
+ appendId: boolean;
518
+ }[];
519
+ PR_NOT_MERGED: {
520
+ text: string;
521
+ appendId: boolean;
522
+ }[];
523
+ };
524
+ PR_CHECK: {
525
+ START: string;
526
+ RESULT: string;
527
+ };
528
+ };
407
529
  /**
408
530
  * Git display constants
409
531
  *
@@ -459,6 +581,8 @@ export declare const GIT_FLAGS: {
459
581
  DELETE: string;
460
582
  /** Delete branch (force - even if not merged) */
461
583
  DELETE_FORCE: string;
584
+ /** Delete remote branch flag (for git push --delete) */
585
+ DELETE_REMOTE: string;
462
586
  /** Hard reset flag */
463
587
  HARD: string;
464
588
  /** Soft reset flag */
@@ -471,6 +595,12 @@ export declare const GIT_FLAGS: {
471
595
  NO_VERIFY: string;
472
596
  /** No GPG sign flag (skip commit signing) */
473
597
  NO_GPG_SIGN: string;
598
+ /** One-line log format */
599
+ ONELINE: string;
600
+ /** List heads only (for ls-remote) */
601
+ HEADS: string;
602
+ /** Path separator (separates git options from file paths) */
603
+ PATH_SEPARATOR: string;
474
604
  };
475
605
  /**
476
606
  * Git commands
@@ -485,8 +615,14 @@ export declare const GIT_COMMANDS: {
485
615
  RESET: string;
486
616
  /** List tree objects (check file existence on branch) */
487
617
  LS_TREE: string;
618
+ /** List remote references */
619
+ LS_REMOTE: string;
620
+ /** Push command */
621
+ PUSH: string;
488
622
  /** Git diff command */
489
623
  DIFF: string;
624
+ /** Git log command */
625
+ LOG: string;
490
626
  /** Git merge-base command */
491
627
  MERGE_BASE: string;
492
628
  /** Git rev-parse command */
@@ -654,6 +790,9 @@ export declare const WU_DEFAULTS: {
654
790
  *
655
791
  * Validation is advisory only - never blocks wu:claim or wu:done.
656
792
  *
793
+ * WU-1068: Removed hardcoded @patientpath references. These patterns
794
+ * should be configured in .lumenflow.config.yaml per-project.
795
+ *
657
796
  * @see {@link tools/lib/lane-validator.mjs} - Validation logic
658
797
  */
659
798
  export declare const LANE_PATH_PATTERNS: {
@@ -856,6 +995,8 @@ export declare const PKG_COMMANDS: {
856
995
  * Package names (monorepo workspaces)
857
996
  *
858
997
  * Centralized package names for --filter usage.
998
+ * WU-1068: Changed from @patientpath to @lumenflow for framework reusability.
999
+ * Project-specific packages should be configured in .lumenflow.config.yaml.
859
1000
  */
860
1001
  export declare const PACKAGES: {
861
1002
  WEB: string;
@@ -1133,6 +1274,32 @@ export declare const STRING_LITERALS: {
1133
1274
  /** Forward slash */
1134
1275
  SLASH: string;
1135
1276
  };
1277
+ /**
1278
+ * Path-related constants
1279
+ *
1280
+ * WU-1062: Centralized path literals for lumenflow-home and spec-branch operations.
1281
+ */
1282
+ export declare const PATH_LITERALS: {
1283
+ /** Tilde prefix for home directory expansion (e.g., ~/path) */
1284
+ TILDE_PREFIX: string;
1285
+ /** Tilde character for home directory */
1286
+ TILDE: string;
1287
+ /** Plan file suffix for WU plans */
1288
+ PLAN_FILE_SUFFIX: string;
1289
+ /** Trailing slash regex pattern */
1290
+ TRAILING_SLASH_REGEX: RegExp;
1291
+ };
1292
+ /**
1293
+ * Slice lengths for path operations
1294
+ *
1295
+ * WU-1062: Magic numbers extracted for path manipulation.
1296
+ */
1297
+ export declare const PATH_SLICE_LENGTHS: {
1298
+ /** Length of '~/' prefix for tilde expansion */
1299
+ TILDE_PREFIX_LENGTH: number;
1300
+ /** Length of '/' for leading slash removal */
1301
+ LEADING_SLASH_LENGTH: number;
1302
+ };
1136
1303
  /**
1137
1304
  * Convert lane name to kebab-case using change-case library
1138
1305
  *
@@ -1199,6 +1366,9 @@ export declare const FILE_TOOLS: {
1199
1366
  *
1200
1367
  * Error codes for PHI detection in file tools.
1201
1368
  * Used by file:write and file:edit to block PHI leakage.
1369
+ *
1370
+ * WU-1068: PHI scanning is healthcare-specific functionality.
1371
+ * Enable via PHI_CONFIG.ENABLED flag or .lumenflow.config.yaml phi.enabled: true
1202
1372
  */
1203
1373
  export declare const PHI_ERRORS: {
1204
1374
  /** PHI detected in content - write blocked */
@@ -1206,6 +1376,29 @@ export declare const PHI_ERRORS: {
1206
1376
  /** PHI override requested - audit logged */
1207
1377
  PHI_OVERRIDE_ALLOWED: string;
1208
1378
  };
1379
+ /**
1380
+ * PHI scanning configuration (WU-1068)
1381
+ *
1382
+ * Controls whether PHI (Protected Health Information) scanning is enabled.
1383
+ * This is healthcare-specific functionality (NHS numbers, UK postcodes)
1384
+ * that should only be enabled for healthcare projects.
1385
+ *
1386
+ * Projects can enable via:
1387
+ * 1. Setting PHI_CONFIG.ENABLED = true in code
1388
+ * 2. Setting LUMENFLOW_PHI_ENABLED=1 environment variable
1389
+ * 3. Adding phi.enabled: true to .lumenflow.config.yaml
1390
+ */
1391
+ export declare const PHI_CONFIG: {
1392
+ /**
1393
+ * Whether PHI scanning is enabled
1394
+ * Default: false - projects must explicitly opt-in
1395
+ */
1396
+ ENABLED: boolean;
1397
+ /**
1398
+ * Whether to block on PHI detection (true) or just warn (false)
1399
+ */
1400
+ BLOCKING: boolean;
1401
+ };
1209
1402
  /**
1210
1403
  * Readiness summary UI constants (WU-1620)
1211
1404
  *
@@ -42,6 +42,10 @@ export const GIT_REFS = {
42
42
  ORIGIN_MAIN: 'origin/main',
43
43
  /** Current HEAD ref */
44
44
  HEAD: 'HEAD',
45
+ /** Upstream ref */
46
+ UPSTREAM: '@{u}',
47
+ /** Range of upstream..HEAD */
48
+ UPSTREAM_RANGE: '@{u}..HEAD',
45
49
  /** Fetch head ref */
46
50
  FETCH_HEAD: 'FETCH_HEAD',
47
51
  };
@@ -273,6 +277,22 @@ export const CONSISTENCY_TYPES = {
273
277
  ORPHAN_WORKTREE_DONE: 'ORPHAN_WORKTREE_DONE',
274
278
  /** Stamp file exists but WU YAML status is not 'done' (partial wu:done failure) */
275
279
  STAMP_EXISTS_YAML_NOT_DONE: 'STAMP_EXISTS_YAML_NOT_DONE',
280
+ /** WU is claimed but its worktree directory is missing */
281
+ MISSING_WORKTREE_CLAIMED: 'MISSING_WORKTREE_CLAIMED',
282
+ };
283
+ /**
284
+ * Consistency check messages
285
+ */
286
+ export const CONSISTENCY_MESSAGES = {
287
+ MISSING_WORKTREE_CLAIMED: (id, status, worktreePath) => `WU ${id} is '${status}' but worktree path is missing (${worktreePath})`,
288
+ MISSING_WORKTREE_CLAIMED_REPAIR: 'Recover worktree or re-claim WU',
289
+ };
290
+ /**
291
+ * Worktree warning messages
292
+ */
293
+ export const WORKTREE_WARNINGS = {
294
+ MISSING_TRACKED_HEADER: 'Tracked worktrees missing on disk (possible manual deletion):',
295
+ MISSING_TRACKED_LINE: (worktreePath) => `Missing: ${worktreePath}`,
276
296
  };
277
297
  /**
278
298
  * File system constants
@@ -386,6 +406,55 @@ export const DEFAULTS = {
386
406
  MAX_COMMIT_SUBJECT: 100,
387
407
  /** Parent directory traversal depth from tools/lib to project root */
388
408
  PROJECT_ROOT_DEPTH: 2,
409
+ /**
410
+ * Default email domain for username -> email conversion
411
+ * WU-1068: Made configurable, no longer hardcoded to patientpath.co.uk
412
+ * @see user-normalizer.ts - Infers from git config first
413
+ */
414
+ EMAIL_DOMAIN: 'example.com',
415
+ };
416
+ /**
417
+ * Process argv indices (WU-1068)
418
+ *
419
+ * Centralized indices for process.argv access to eliminate magic numbers.
420
+ * In Node.js: argv[0] = node, argv[1] = script, argv[2+] = args
421
+ */
422
+ export const ARGV_INDICES = {
423
+ /** Node executable path */
424
+ NODE: 0,
425
+ /** Script path */
426
+ SCRIPT: 1,
427
+ /** First user argument */
428
+ FIRST_ARG: 2,
429
+ /** Second user argument */
430
+ SECOND_ARG: 3,
431
+ };
432
+ /**
433
+ * Display limits for CLI output (WU-1068)
434
+ *
435
+ * Centralized limits for truncating display strings to avoid magic numbers.
436
+ */
437
+ export const DISPLAY_LIMITS = {
438
+ /** Maximum items to show in lists before truncating */
439
+ LIST_ITEMS: 5,
440
+ /** Maximum items to show in short lists */
441
+ SHORT_LIST: 3,
442
+ /** Maximum characters for content preview */
443
+ CONTENT_PREVIEW: 200,
444
+ /** Maximum characters for short preview */
445
+ SHORT_PREVIEW: 60,
446
+ /** Maximum characters for title display */
447
+ TITLE: 50,
448
+ /** Maximum characters for truncated title */
449
+ TRUNCATED_TITLE: 40,
450
+ /** Maximum characters for command preview */
451
+ CMD_PREVIEW: 60,
452
+ /** Maximum lines to preview from files */
453
+ FILE_LINES: 10,
454
+ /** Maximum commits to show in lists */
455
+ COMMITS: 50,
456
+ /** Maximum overlaps to display */
457
+ OVERLAPS: 3,
389
458
  };
390
459
  /**
391
460
  * YAML serialization options
@@ -426,6 +495,62 @@ export const BOX = {
426
495
  /** Side border for content lines */
427
496
  SIDE: '║',
428
497
  };
498
+ /**
499
+ * Cleanup guard constants
500
+ */
501
+ export const CLEANUP_GUARD = {
502
+ REASONS: {
503
+ UNCOMMITTED_CHANGES: 'UNCOMMITTED_CHANGES',
504
+ UNPUSHED_COMMITS: 'UNPUSHED_COMMITS',
505
+ STATUS_NOT_DONE: 'STATUS_NOT_DONE',
506
+ MISSING_STAMP: 'MISSING_STAMP',
507
+ PR_NOT_MERGED: 'PR_NOT_MERGED',
508
+ },
509
+ TITLES: {
510
+ BLOCKED: 'CLEANUP BLOCKED',
511
+ NEXT_STEPS: 'Next steps:',
512
+ },
513
+ MESSAGES: {
514
+ UNCOMMITTED_CHANGES: 'Worktree has uncommitted changes. Refusing to delete.',
515
+ UNPUSHED_COMMITS: 'Worktree has unpushed commits. Refusing to delete.',
516
+ STATUS_NOT_DONE: 'WU YAML status is not done. Refusing to delete.',
517
+ MISSING_STAMP: 'WU stamp is missing. Refusing to delete.',
518
+ PR_NOT_MERGED: 'PR is not merged (or cannot be verified). Refusing to delete.',
519
+ },
520
+ NEXT_STEPS: {
521
+ DEFAULT: [
522
+ { text: '1. Resolve the issue above', appendId: false },
523
+ { text: '2. Re-run: pnpm wu:cleanup --id', appendId: true },
524
+ ],
525
+ UNCOMMITTED_CHANGES: [
526
+ { text: '1. Commit or stash changes in the worktree', appendId: false },
527
+ { text: '2. Re-run: pnpm wu:cleanup --id', appendId: true },
528
+ ],
529
+ UNPUSHED_COMMITS: [
530
+ { text: '1. Push the lane branch to origin', appendId: false },
531
+ { text: '2. Re-run: pnpm wu:cleanup --id', appendId: true },
532
+ ],
533
+ STATUS_NOT_DONE: [
534
+ {
535
+ text: `1. Complete the WU with ${LOG_PREFIX.DONE} (creates stamp + done status)`,
536
+ appendId: false,
537
+ },
538
+ { text: '2. Re-run: pnpm wu:cleanup --id', appendId: true },
539
+ ],
540
+ MISSING_STAMP: [
541
+ { text: '1. Run wu:done to create the stamp file', appendId: false },
542
+ { text: '2. Re-run: pnpm wu:cleanup --id', appendId: true },
543
+ ],
544
+ PR_NOT_MERGED: [
545
+ { text: '1. Merge the PR in GitHub', appendId: false },
546
+ { text: '2. Re-run: pnpm wu:cleanup --id', appendId: true },
547
+ ],
548
+ },
549
+ PR_CHECK: {
550
+ START: 'Verifying PR merge status...',
551
+ RESULT: 'PR merge verification via',
552
+ },
553
+ };
429
554
  /**
430
555
  * Git display constants
431
556
  *
@@ -481,6 +606,8 @@ export const GIT_FLAGS = {
481
606
  DELETE: '-d',
482
607
  /** Delete branch (force - even if not merged) */
483
608
  DELETE_FORCE: '-D',
609
+ /** Delete remote branch flag (for git push --delete) */
610
+ DELETE_REMOTE: '--delete',
484
611
  /** Hard reset flag */
485
612
  HARD: '--hard',
486
613
  /** Soft reset flag */
@@ -493,6 +620,12 @@ export const GIT_FLAGS = {
493
620
  NO_VERIFY: '--no-verify',
494
621
  /** No GPG sign flag (skip commit signing) */
495
622
  NO_GPG_SIGN: '--no-gpg-sign',
623
+ /** One-line log format */
624
+ ONELINE: '--oneline',
625
+ /** List heads only (for ls-remote) */
626
+ HEADS: '--heads',
627
+ /** Path separator (separates git options from file paths) */
628
+ PATH_SEPARATOR: '--',
496
629
  };
497
630
  /**
498
631
  * Git commands
@@ -507,8 +640,14 @@ export const GIT_COMMANDS = {
507
640
  RESET: 'reset',
508
641
  /** List tree objects (check file existence on branch) */
509
642
  LS_TREE: 'ls-tree',
643
+ /** List remote references */
644
+ LS_REMOTE: 'ls-remote',
645
+ /** Push command */
646
+ PUSH: 'push',
510
647
  /** Git diff command */
511
648
  DIFF: 'diff',
649
+ /** Git log command */
650
+ LOG: 'log',
512
651
  /** Git merge-base command */
513
652
  MERGE_BASE: 'merge-base',
514
653
  /** Git rev-parse command */
@@ -690,6 +829,9 @@ export const WU_DEFAULTS = {
690
829
  *
691
830
  * Validation is advisory only - never blocks wu:claim or wu:done.
692
831
  *
832
+ * WU-1068: Removed hardcoded @patientpath references. These patterns
833
+ * should be configured in .lumenflow.config.yaml per-project.
834
+ *
693
835
  * @see {@link tools/lib/lane-validator.mjs} - Validation logic
694
836
  */
695
837
  export const LANE_PATH_PATTERNS = {
@@ -698,7 +840,7 @@ export const LANE_PATH_PATTERNS = {
698
840
  * These paths belong to the Intelligence lane.
699
841
  */
700
842
  Operations: {
701
- exclude: ['ai/prompts/**', 'packages/@patientpath/prompts/**', 'apps/web/src/lib/prompts/**'],
843
+ exclude: ['ai/prompts/**', 'apps/web/src/lib/prompts/**'],
702
844
  allowExceptions: [],
703
845
  },
704
846
  /**
@@ -895,12 +1037,14 @@ export const PKG_COMMANDS = {
895
1037
  * Package names (monorepo workspaces)
896
1038
  *
897
1039
  * Centralized package names for --filter usage.
1040
+ * WU-1068: Changed from @patientpath to @lumenflow for framework reusability.
1041
+ * Project-specific packages should be configured in .lumenflow.config.yaml.
898
1042
  */
899
1043
  export const PACKAGES = {
900
1044
  WEB: 'web',
901
- APPLICATION: '@patientpath/application',
902
- DOMAIN: '@patientpath/domain',
903
- INFRASTRUCTURE: '@patientpath/infrastructure',
1045
+ APPLICATION: '@lumenflow/core',
1046
+ DOMAIN: '@lumenflow/core',
1047
+ INFRASTRUCTURE: '@lumenflow/cli',
904
1048
  };
905
1049
  /**
906
1050
  * Directory paths within the monorepo
@@ -1173,6 +1317,32 @@ export const STRING_LITERALS = {
1173
1317
  /** Forward slash */
1174
1318
  SLASH: '/',
1175
1319
  };
1320
+ /**
1321
+ * Path-related constants
1322
+ *
1323
+ * WU-1062: Centralized path literals for lumenflow-home and spec-branch operations.
1324
+ */
1325
+ export const PATH_LITERALS = {
1326
+ /** Tilde prefix for home directory expansion (e.g., ~/path) */
1327
+ TILDE_PREFIX: '~/',
1328
+ /** Tilde character for home directory */
1329
+ TILDE: '~',
1330
+ /** Plan file suffix for WU plans */
1331
+ PLAN_FILE_SUFFIX: '-plan.md',
1332
+ /** Trailing slash regex pattern */
1333
+ TRAILING_SLASH_REGEX: /\/+$/,
1334
+ };
1335
+ /**
1336
+ * Slice lengths for path operations
1337
+ *
1338
+ * WU-1062: Magic numbers extracted for path manipulation.
1339
+ */
1340
+ export const PATH_SLICE_LENGTHS = {
1341
+ /** Length of '~/' prefix for tilde expansion */
1342
+ TILDE_PREFIX_LENGTH: 2,
1343
+ /** Length of '/' for leading slash removal */
1344
+ LEADING_SLASH_LENGTH: 1,
1345
+ };
1176
1346
  /**
1177
1347
  * Convert lane name to kebab-case using change-case library
1178
1348
  *
@@ -1257,6 +1427,9 @@ export const FILE_TOOLS = {
1257
1427
  *
1258
1428
  * Error codes for PHI detection in file tools.
1259
1429
  * Used by file:write and file:edit to block PHI leakage.
1430
+ *
1431
+ * WU-1068: PHI scanning is healthcare-specific functionality.
1432
+ * Enable via PHI_CONFIG.ENABLED flag or .lumenflow.config.yaml phi.enabled: true
1260
1433
  */
1261
1434
  export const PHI_ERRORS = {
1262
1435
  /** PHI detected in content - write blocked */
@@ -1264,6 +1437,29 @@ export const PHI_ERRORS = {
1264
1437
  /** PHI override requested - audit logged */
1265
1438
  PHI_OVERRIDE_ALLOWED: 'PHI_OVERRIDE_ALLOWED',
1266
1439
  };
1440
+ /**
1441
+ * PHI scanning configuration (WU-1068)
1442
+ *
1443
+ * Controls whether PHI (Protected Health Information) scanning is enabled.
1444
+ * This is healthcare-specific functionality (NHS numbers, UK postcodes)
1445
+ * that should only be enabled for healthcare projects.
1446
+ *
1447
+ * Projects can enable via:
1448
+ * 1. Setting PHI_CONFIG.ENABLED = true in code
1449
+ * 2. Setting LUMENFLOW_PHI_ENABLED=1 environment variable
1450
+ * 3. Adding phi.enabled: true to .lumenflow.config.yaml
1451
+ */
1452
+ export const PHI_CONFIG = {
1453
+ /**
1454
+ * Whether PHI scanning is enabled
1455
+ * Default: false - projects must explicitly opt-in
1456
+ */
1457
+ ENABLED: process.env.LUMENFLOW_PHI_ENABLED === '1',
1458
+ /**
1459
+ * Whether to block on PHI detection (true) or just warn (false)
1460
+ */
1461
+ BLOCKING: process.env.LUMENFLOW_PHI_BLOCKING === '1',
1462
+ };
1267
1463
  /**
1268
1464
  * Readiness summary UI constants (WU-1620)
1269
1465
  *
@@ -1,14 +1,36 @@
1
1
  /**
2
- * WU Create Validators (WU-2107)
2
+ * WU Create Validators (WU-2107, WU-1062)
3
3
  *
4
- * Validation helpers for wu:create, including lane inference surfacing.
4
+ * Validation helpers for wu:create, including:
5
+ * - Lane inference surfacing (WU-2107)
6
+ * - External spec_refs validation (WU-1062)
5
7
  *
6
8
  * When agents create WUs, this module helps surface lane inference suggestions
7
9
  * to guide better lane selection and improve parallelization.
8
10
  *
11
+ * WU-1062: Validates spec_refs paths, accepting both repo-relative paths
12
+ * and external paths (lumenflow://, ~/.lumenflow/, $LUMENFLOW_HOME/).
13
+ *
9
14
  * NOTE: This is domain-specific WU workflow code, not a general utility.
10
15
  * No external library exists for LumenFlow lane inference validation.
11
16
  */
17
+ /**
18
+ * WU-1069: Check if a path is a repo-internal path that should be rejected
19
+ *
20
+ * Repo-internal paths start with ./ or .lumenflow/ and indicate the agent
21
+ * is attempting to store plans inside the repository instead of externally.
22
+ *
23
+ * @param {string} path - Path to check
24
+ * @returns {boolean} True if path is repo-internal and should be rejected
25
+ */
26
+ export declare function isRepoInternalPath(path: string): boolean;
27
+ /**
28
+ * WU-1069: Build error message for repo-internal path rejection
29
+ *
30
+ * @param {string} path - The rejected path
31
+ * @returns {string} Error message with correct format examples
32
+ */
33
+ export declare function buildRepoInternalPathError(path: string): string;
12
34
  /**
13
35
  * Generate a warning message when provided lane differs from inferred lane.
14
36
  *
@@ -40,3 +62,36 @@ export declare function validateLaneWithInference(providedLane: any, codePaths:
40
62
  inferredLane: any;
41
63
  confidence: any;
42
64
  };
65
+ /**
66
+ * WU-1062: Validate spec_refs paths
67
+ *
68
+ * Accepts:
69
+ * - Repo-relative paths: docs/04-operations/plans/WU-XXX-plan.md
70
+ * - External paths: lumenflow://plans/WU-XXX-plan.md
71
+ * - Tilde paths: ~/.lumenflow/plans/WU-XXX-plan.md
72
+ * - Env var paths: $LUMENFLOW_HOME/plans/WU-XXX-plan.md
73
+ *
74
+ * @param {string[]} specRefs - Array of spec reference paths
75
+ * @returns {{ valid: boolean, errors: string[], warnings: string[] }} Validation result
76
+ */
77
+ export declare function validateSpecRefs(specRefs: string[]): {
78
+ valid: boolean;
79
+ errors: string[];
80
+ warnings: string[];
81
+ };
82
+ /**
83
+ * WU-1062: Check if spec_refs contains external paths
84
+ *
85
+ * @param {string[]} specRefs - Array of spec reference paths
86
+ * @returns {boolean} True if any spec_ref is an external path
87
+ */
88
+ export declare function hasExternalSpecRefs(specRefs: string[]): boolean;
89
+ /**
90
+ * WU-1062: Normalize all spec_refs paths
91
+ *
92
+ * Expands external paths to absolute paths while keeping repo-relative paths unchanged.
93
+ *
94
+ * @param {string[]} specRefs - Array of spec reference paths
95
+ * @returns {string[]} Normalized paths
96
+ */
97
+ export declare function normalizeSpecRefs(specRefs: string[]): string[];