@outcomeeng/spx 0.1.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.
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Core type definitions for spx
3
+ */
4
+ /**
5
+ * Work item types in the spec hierarchy
6
+ */
7
+ type WorkItemKind = "capability" | "feature" | "story";
8
+ /**
9
+ * Ordered hierarchy of work item kinds (root to leaf)
10
+ *
11
+ * Used by both production code and tests to derive hierarchy structure.
12
+ * Per ADR-21: Never hardcode kind names - derive from this constant.
13
+ */
14
+ declare const WORK_ITEM_KINDS: readonly WorkItemKind[];
15
+ /**
16
+ * The leaf kind (actionable work items)
17
+ *
18
+ * Derived from WORK_ITEM_KINDS to ensure consistency if hierarchy changes.
19
+ */
20
+ declare const LEAF_KIND: WorkItemKind;
21
+ /**
22
+ * Parsed work item structure
23
+ */
24
+ interface WorkItem {
25
+ /** The type of work item */
26
+ kind: WorkItemKind;
27
+ /** BSP number (0-indexed for capabilities, as-is for features/stories) */
28
+ number: number;
29
+ /** URL-safe slug identifier */
30
+ slug: string;
31
+ /** Full filesystem path to work item directory */
32
+ path: string;
33
+ }
34
+ /**
35
+ * Directory entry from filesystem traversal
36
+ */
37
+ interface DirectoryEntry {
38
+ /** Directory name (basename) */
39
+ name: string;
40
+ /** Full absolute path */
41
+ path: string;
42
+ /** Whether this is a directory */
43
+ isDirectory: boolean;
44
+ }
45
+ /**
46
+ * Work item status
47
+ */
48
+ type WorkItemStatus = "OPEN" | "IN_PROGRESS" | "DONE";
49
+ /**
50
+ * Ordered list of work item statuses
51
+ *
52
+ * Used by both production code and tests to derive status values.
53
+ * Per ADR-21: Never hardcode status names - derive from this constant.
54
+ */
55
+ declare const WORK_ITEM_STATUSES: readonly WorkItemStatus[];
56
+
57
+ /**
58
+ * Pattern matching for work item directory names
59
+ */
60
+
61
+ /**
62
+ * Parse a work item directory name into structured data
63
+ *
64
+ * @param dirName - Directory name to parse
65
+ * @returns Parsed work item with kind, number, and slug (path not included)
66
+ * @throws Error if the directory name doesn't match the pattern or BSP number is invalid
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * parseWorkItemName("capability-21_core-cli")
71
+ * // Returns: { kind: "capability", number: 20, slug: "core-cli" }
72
+ *
73
+ * parseWorkItemName("feature-21_pattern-matching")
74
+ * // Returns: { kind: "feature", number: 21, slug: "pattern-matching" }
75
+ * ```
76
+ */
77
+ declare function parseWorkItemName(dirName: string): Omit<WorkItem, 'path'>;
78
+
79
+ /**
80
+ * Validation functions for BSP (Behavior, Structure, Property) numbers
81
+ */
82
+ /**
83
+ * BSP number range constants
84
+ */
85
+ declare const MIN_BSP_NUMBER = 10;
86
+ declare const MAX_BSP_NUMBER = 99;
87
+ /**
88
+ * Check if a number is a valid BSP number
89
+ *
90
+ * @param n - Number to validate
91
+ * @returns true if n is in range [10, 99], false otherwise
92
+ *
93
+ * @example
94
+ * ```typescript
95
+ * isValidBSPNumber(20) // true
96
+ * isValidBSPNumber(9) // false
97
+ * isValidBSPNumber(100) // false
98
+ * ```
99
+ */
100
+ declare function isValidBSPNumber(n: number): boolean;
101
+ /**
102
+ * Validate a BSP number and throw if invalid
103
+ *
104
+ * @param n - Number to validate
105
+ * @returns The validated number
106
+ * @throws Error if the number is outside the valid range [10, 99]
107
+ *
108
+ * @example
109
+ * ```typescript
110
+ * validateBSPNumber(20) // returns 20
111
+ * validateBSPNumber(5) // throws Error: "BSP number must be between 10 and 99, got 5"
112
+ * ```
113
+ */
114
+ declare function validateBSPNumber(n: number): number;
115
+
116
+ export { type DirectoryEntry, LEAF_KIND, MAX_BSP_NUMBER, MIN_BSP_NUMBER, WORK_ITEM_KINDS, WORK_ITEM_STATUSES, type WorkItem, type WorkItemKind, type WorkItemStatus, isValidBSPNumber, parseWorkItemName, validateBSPNumber };
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ import {
2
+ LEAF_KIND,
3
+ MAX_BSP_NUMBER,
4
+ MIN_BSP_NUMBER,
5
+ WORK_ITEM_KINDS,
6
+ WORK_ITEM_STATUSES,
7
+ isValidBSPNumber,
8
+ parseWorkItemName,
9
+ validateBSPNumber
10
+ } from "./chunk-5L7CHFBC.js";
11
+ export {
12
+ LEAF_KIND,
13
+ MAX_BSP_NUMBER,
14
+ MIN_BSP_NUMBER,
15
+ WORK_ITEM_KINDS,
16
+ WORK_ITEM_STATUSES,
17
+ isValidBSPNumber,
18
+ parseWorkItemName,
19
+ validateBSPNumber
20
+ };
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "@outcomeeng/spx",
3
+ "version": "0.1.0",
4
+ "description": "Developer CLI for code validation and session management",
5
+ "type": "module",
6
+ "bin": {
7
+ "spx": "./bin/spx.js"
8
+ },
9
+ "files": [
10
+ "dist",
11
+ "bin"
12
+ ],
13
+ "engines": {
14
+ "node": ">=18"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "keywords": [
20
+ "cli",
21
+ "validation",
22
+ "session",
23
+ "workflow"
24
+ ],
25
+ "author": "Outcome Engineering",
26
+ "license": "MIT",
27
+ "devDependencies": {
28
+ "@faker-js/faker": "^10.2.0",
29
+ "@types/eslint-config-prettier": "^6.11.3",
30
+ "@types/madge": "^5.0.3",
31
+ "@types/node": "^20.10.0",
32
+ "@vitest/coverage-v8": "^4.0.18",
33
+ "eslint": "^9.39.2",
34
+ "eslint-config-prettier": "^10.1.8",
35
+ "eslint-plugin-import": "^2.32.0",
36
+ "execa": "^9.6.1",
37
+ "fast-check": "^4.5.3",
38
+ "globals": "^17.0.0",
39
+ "husky": "^9.1.7",
40
+ "lefthook": "^1.10.10",
41
+ "jsonc-parser": "^3.3.1",
42
+ "knip": "^5.80.0",
43
+ "prettier": "^3.7.4",
44
+ "tsup": "^8.0.1",
45
+ "tsx": "^4.21.0",
46
+ "typescript": "^5.3.3",
47
+ "typescript-eslint": "^8.51.0",
48
+ "vitest": "^4.0.18"
49
+ },
50
+ "dependencies": {
51
+ "chalk": "^5.6.2",
52
+ "commander": "^11.1.0",
53
+ "madge": "^8.0.0",
54
+ "yaml": "^2.8.2"
55
+ },
56
+ "scripts": {
57
+ "build": "tsup",
58
+ "dev": "tsup --watch",
59
+ "test": "vitest run",
60
+ "test:watch": "vitest",
61
+ "test:unit": "vitest run tests/unit",
62
+ "test:integration": "vitest run tests/integration",
63
+ "test:e2e": "vitest run tests/e2e",
64
+ "test:coverage": "vitest run --coverage",
65
+ "typecheck": "node bin/spx.js validation typescript",
66
+ "typecheck:production": "node bin/spx.js validation typescript --scope production",
67
+ "lint": "node bin/spx.js validation lint",
68
+ "lint:fix": "node bin/spx.js validation lint --fix",
69
+ "lint:production": "node bin/spx.js validation lint --scope production",
70
+ "validate": "node bin/spx.js validation all",
71
+ "validate:production": "node bin/spx.js validation all --scope production",
72
+ "knip": "node bin/spx.js validation knip",
73
+ "circular": "node bin/spx.js validation circular",
74
+ "format": "prettier --write .",
75
+ "format:check": "prettier --check ."
76
+ }
77
+ }