@lumenflow/core 2.0.0 → 2.1.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.
@@ -15,6 +15,28 @@ import { z } from 'zod';
15
15
  * Mirrors CONTEXT_VALIDATION.LOCATION_TYPES from wu-constants.ts
16
16
  */
17
17
  export declare const LOCATION_TYPE_VALUES: readonly ["main", "worktree", "detached", "unknown"];
18
+ /**
19
+ * LocationType enum for use in code
20
+ *
21
+ * Provides named constants for location types to avoid magic string literals.
22
+ *
23
+ * @example
24
+ * import { LocationType } from '@lumenflow/core';
25
+ *
26
+ * if (location.type === LocationType.MAIN) {
27
+ * // In main checkout
28
+ * }
29
+ */
30
+ export declare const LocationType: {
31
+ /** Main checkout (not a worktree) */
32
+ readonly MAIN: "main";
33
+ /** Inside a worktree */
34
+ readonly WORKTREE: "worktree";
35
+ /** Detached HEAD state */
36
+ readonly DETACHED: "detached";
37
+ /** Unknown location (not a git repo or error) */
38
+ readonly UNKNOWN: "unknown";
39
+ };
18
40
  /**
19
41
  * Schema for location types
20
42
  */
@@ -139,7 +161,7 @@ export declare const WuContextSchema: z.ZodObject<{
139
161
  errorMessage: z.ZodNullable<z.ZodString>;
140
162
  }, z.core.$strip>>;
141
163
  }, z.core.$strip>;
142
- export type LocationType = z.infer<typeof LocationTypeSchema>;
164
+ export type LocationType = (typeof LocationType)[keyof typeof LocationType];
143
165
  export type LocationContext = z.infer<typeof LocationContextSchema>;
144
166
  export type GitState = z.infer<typeof GitStateSchema>;
145
167
  export type WuStateResult = z.infer<typeof WuStateResultSchema>;
@@ -15,6 +15,28 @@ import { z } from 'zod';
15
15
  * Mirrors CONTEXT_VALIDATION.LOCATION_TYPES from wu-constants.ts
16
16
  */
17
17
  export const LOCATION_TYPE_VALUES = ['main', 'worktree', 'detached', 'unknown'];
18
+ /**
19
+ * LocationType enum for use in code
20
+ *
21
+ * Provides named constants for location types to avoid magic string literals.
22
+ *
23
+ * @example
24
+ * import { LocationType } from '@lumenflow/core';
25
+ *
26
+ * if (location.type === LocationType.MAIN) {
27
+ * // In main checkout
28
+ * }
29
+ */
30
+ export const LocationType = {
31
+ /** Main checkout (not a worktree) */
32
+ MAIN: 'main',
33
+ /** Inside a worktree */
34
+ WORKTREE: 'worktree',
35
+ /** Detached HEAD state */
36
+ DETACHED: 'detached',
37
+ /** Unknown location (not a git repo or error) */
38
+ UNKNOWN: 'unknown',
39
+ };
18
40
  /**
19
41
  * Schema for location types
20
42
  */
@@ -8,10 +8,12 @@
8
8
  * @module domain
9
9
  */
10
10
  // Context schemas (primary definitions for location, git, wu state)
11
+ // Includes LocationType enum constant
11
12
  export * from './context.schemas.js';
12
13
  // Validation schemas (excludes re-exports from context.schemas)
13
14
  export { VALIDATION_ERROR_CODE_VALUES, ValidationErrorCodeSchema, PREDICATE_SEVERITY_VALUES, PredicateSeveritySchema, ValidationErrorSchema, ValidationWarningSchema, ValidationResultSchema, CommandPredicateConfigSchema, CommandDefinitionConfigSchema, } from './validation.schemas.js';
14
15
  // Recovery schemas
16
+ // Includes RecoveryIssueCode and RecoveryActionType enum constants
15
17
  export * from './recovery.schemas.js';
16
18
  // Orchestration schemas (existing)
17
19
  export * from './orchestration.schemas.js';
@@ -15,6 +15,32 @@ import { z } from 'zod';
15
15
  * Mirrors CONTEXT_VALIDATION.RECOVERY_ISSUES from wu-constants.ts
16
16
  */
17
17
  export declare const RECOVERY_ISSUE_CODE_VALUES: readonly ["PARTIAL_CLAIM", "ORPHAN_CLAIM", "INCONSISTENT_STATE", "ORPHAN_BRANCH", "STALE_LOCK", "LEFTOVER_WORKTREE"];
18
+ /**
19
+ * RecoveryIssueCode enum for use in code
20
+ *
21
+ * Provides named constants for recovery issue codes to avoid magic string literals.
22
+ *
23
+ * @example
24
+ * import { RecoveryIssueCode } from '@lumenflow/core';
25
+ *
26
+ * if (issue.code === RecoveryIssueCode.PARTIAL_CLAIM) {
27
+ * // Handle partial claim issue
28
+ * }
29
+ */
30
+ export declare const RecoveryIssueCode: {
31
+ /** Worktree exists but WU status is "ready" */
32
+ readonly PARTIAL_CLAIM: "PARTIAL_CLAIM";
33
+ /** WU is "in_progress" but worktree does not exist */
34
+ readonly ORPHAN_CLAIM: "ORPHAN_CLAIM";
35
+ /** YAML status differs from state store */
36
+ readonly INCONSISTENT_STATE: "INCONSISTENT_STATE";
37
+ /** Branch exists but worktree does not */
38
+ readonly ORPHAN_BRANCH: "ORPHAN_BRANCH";
39
+ /** Lock file from different WU */
40
+ readonly STALE_LOCK: "STALE_LOCK";
41
+ /** WU is done but worktree was not cleaned up */
42
+ readonly LEFTOVER_WORKTREE: "LEFTOVER_WORKTREE";
43
+ };
18
44
  /**
19
45
  * Schema for recovery issue codes
20
46
  */
@@ -32,6 +58,28 @@ export declare const RecoveryIssueCodeSchema: z.ZodEnum<{
32
58
  * Mirrors CONTEXT_VALIDATION.RECOVERY_ACTIONS from wu-constants.ts
33
59
  */
34
60
  export declare const RECOVERY_ACTION_TYPE_VALUES: readonly ["resume", "reset", "nuke", "cleanup"];
61
+ /**
62
+ * RecoveryActionType enum for use in code
63
+ *
64
+ * Provides named constants for recovery action types to avoid magic string literals.
65
+ *
66
+ * @example
67
+ * import { RecoveryActionType } from '@lumenflow/core';
68
+ *
69
+ * if (action.type === RecoveryActionType.RESUME) {
70
+ * // Resume the WU
71
+ * }
72
+ */
73
+ export declare const RecoveryActionType: {
74
+ /** Reconcile state and continue working (preserves work) */
75
+ readonly RESUME: "resume";
76
+ /** Discard worktree, reset WU to ready */
77
+ readonly RESET: "reset";
78
+ /** Remove all artifacts completely (requires --force) */
79
+ readonly NUKE: "nuke";
80
+ /** Remove leftover worktree (for done WUs) */
81
+ readonly CLEANUP: "cleanup";
82
+ };
35
83
  /**
36
84
  * Schema for recovery action types
37
85
  */
@@ -108,8 +156,8 @@ export declare const RecoveryAnalysisSchema: z.ZodObject<{
108
156
  }, z.core.$strip>>;
109
157
  wuId: z.ZodNullable<z.ZodString>;
110
158
  }, z.core.$strip>;
111
- export type RecoveryIssueCode = z.infer<typeof RecoveryIssueCodeSchema>;
112
- export type RecoveryActionType = z.infer<typeof RecoveryActionTypeSchema>;
159
+ export type RecoveryIssueCode = (typeof RecoveryIssueCode)[keyof typeof RecoveryIssueCode];
160
+ export type RecoveryActionType = (typeof RecoveryActionType)[keyof typeof RecoveryActionType];
113
161
  export type RecoveryIssue = z.infer<typeof RecoveryIssueSchema>;
114
162
  export type RecoveryAction = z.infer<typeof RecoveryActionSchema>;
115
163
  export type RecoveryAnalysis = z.infer<typeof RecoveryAnalysisSchema>;
@@ -22,6 +22,32 @@ export const RECOVERY_ISSUE_CODE_VALUES = [
22
22
  'STALE_LOCK',
23
23
  'LEFTOVER_WORKTREE',
24
24
  ];
25
+ /**
26
+ * RecoveryIssueCode enum for use in code
27
+ *
28
+ * Provides named constants for recovery issue codes to avoid magic string literals.
29
+ *
30
+ * @example
31
+ * import { RecoveryIssueCode } from '@lumenflow/core';
32
+ *
33
+ * if (issue.code === RecoveryIssueCode.PARTIAL_CLAIM) {
34
+ * // Handle partial claim issue
35
+ * }
36
+ */
37
+ export const RecoveryIssueCode = {
38
+ /** Worktree exists but WU status is "ready" */
39
+ PARTIAL_CLAIM: 'PARTIAL_CLAIM',
40
+ /** WU is "in_progress" but worktree does not exist */
41
+ ORPHAN_CLAIM: 'ORPHAN_CLAIM',
42
+ /** YAML status differs from state store */
43
+ INCONSISTENT_STATE: 'INCONSISTENT_STATE',
44
+ /** Branch exists but worktree does not */
45
+ ORPHAN_BRANCH: 'ORPHAN_BRANCH',
46
+ /** Lock file from different WU */
47
+ STALE_LOCK: 'STALE_LOCK',
48
+ /** WU is done but worktree was not cleaned up */
49
+ LEFTOVER_WORKTREE: 'LEFTOVER_WORKTREE',
50
+ };
25
51
  /**
26
52
  * Schema for recovery issue codes
27
53
  */
@@ -32,6 +58,28 @@ export const RecoveryIssueCodeSchema = z.enum(RECOVERY_ISSUE_CODE_VALUES);
32
58
  * Mirrors CONTEXT_VALIDATION.RECOVERY_ACTIONS from wu-constants.ts
33
59
  */
34
60
  export const RECOVERY_ACTION_TYPE_VALUES = ['resume', 'reset', 'nuke', 'cleanup'];
61
+ /**
62
+ * RecoveryActionType enum for use in code
63
+ *
64
+ * Provides named constants for recovery action types to avoid magic string literals.
65
+ *
66
+ * @example
67
+ * import { RecoveryActionType } from '@lumenflow/core';
68
+ *
69
+ * if (action.type === RecoveryActionType.RESUME) {
70
+ * // Resume the WU
71
+ * }
72
+ */
73
+ export const RecoveryActionType = {
74
+ /** Reconcile state and continue working (preserves work) */
75
+ RESUME: 'resume',
76
+ /** Discard worktree, reset WU to ready */
77
+ RESET: 'reset',
78
+ /** Remove all artifacts completely (requires --force) */
79
+ NUKE: 'nuke',
80
+ /** Remove leftover worktree (for done WUs) */
81
+ CLEANUP: 'cleanup',
82
+ };
35
83
  /**
36
84
  * Schema for recovery action types
37
85
  */
@@ -98,6 +98,25 @@ export const GATE_PRESETS = {
98
98
  lint: 'dotnet build --no-restore -warnaserror',
99
99
  test: 'dotnet test --no-restore',
100
100
  },
101
+ // WU-1118: Java/JVM, Ruby, and PHP presets
102
+ java: {
103
+ format: 'mvn spotless:check || ./gradlew spotlessCheck',
104
+ lint: 'mvn checkstyle:check || ./gradlew checkstyleMain',
105
+ typecheck: 'mvn compile -DskipTests || ./gradlew compileJava',
106
+ test: 'mvn test || ./gradlew test',
107
+ },
108
+ ruby: {
109
+ setup: 'bundle install',
110
+ format: 'bundle exec rubocop --format simple --fail-level W',
111
+ lint: 'bundle exec rubocop',
112
+ test: 'bundle exec rspec',
113
+ },
114
+ php: {
115
+ setup: 'composer install',
116
+ format: 'vendor/bin/php-cs-fixer fix --dry-run --diff',
117
+ lint: 'vendor/bin/phpstan analyse',
118
+ test: 'vendor/bin/phpunit',
119
+ },
101
120
  };
102
121
  /**
103
122
  * Parse a gate command configuration into executable form
package/dist/index.d.ts CHANGED
@@ -54,7 +54,9 @@ export * from './validation/index.js';
54
54
  export * from './recovery/index.js';
55
55
  export * from './context-validation-integration.js';
56
56
  export { CONTEXT_VALIDATION } from './wu-constants.js';
57
- export type { LocationType, ValidationErrorCode, RecoveryActionType, RecoveryIssueCode, PredicateSeverity, ValidationMode, } from './wu-constants.js';
57
+ export type { ValidationErrorCode, PredicateSeverity, ValidationMode } from './wu-constants.js';
58
+ export { LocationType } from './domain/context.schemas.js';
59
+ export { RecoveryIssueCode, RecoveryActionType } from './domain/recovery.schemas.js';
58
60
  export type { ILocationResolver, IGitStateReader, IWuStateReader } from './ports/context.ports.js';
59
61
  export type { ICommandRegistry } from './ports/validation.ports.js';
60
62
  export type { IRecoveryAnalyzer } from './ports/recovery.ports.js';
package/dist/index.js CHANGED
@@ -84,6 +84,11 @@ export * from './recovery/index.js';
84
84
  export * from './context-validation-integration.js';
85
85
  // WU-1090: Context validation constants
86
86
  export { CONTEXT_VALIDATION } from './wu-constants.js';
87
+ // WU-1126: Enum-style constants for port interfaces (const + type pairs)
88
+ // These provide named constants to avoid magic string literals in code
89
+ // The const objects serve as both runtime values AND types via TypeScript's const/type pattern
90
+ export { LocationType } from './domain/context.schemas.js';
91
+ export { RecoveryIssueCode, RecoveryActionType } from './domain/recovery.schemas.js';
87
92
  // WU-1093: Domain schemas for context-aware validation (Zod schemas)
88
93
  // Note: Types like LocationContext, GitState are already exported from context/index.js
89
94
  // so we only export the Zod schemas, not the inferred types.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumenflow/core",
3
- "version": "2.0.0",
3
+ "version": "2.1.1",
4
4
  "description": "Core WU lifecycle tools for LumenFlow workflow framework",
5
5
  "keywords": [
6
6
  "lumenflow",
@@ -94,7 +94,7 @@
94
94
  "vitest": "^4.0.17"
95
95
  },
96
96
  "peerDependencies": {
97
- "@lumenflow/memory": "2.0.0"
97
+ "@lumenflow/memory": "2.1.1"
98
98
  },
99
99
  "peerDependenciesMeta": {
100
100
  "@lumenflow/memory": {