@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.
package/README.md ADDED
@@ -0,0 +1,146 @@
1
+ # spx
2
+
3
+ Fast, deterministic CLI tool for spec workflow management.
4
+
5
+ > **Note**: This tool will be published to a registry when it reaches a more mature state. For now, install directly from GitHub.
6
+
7
+ ## What is spx?
8
+
9
+ **spx** is a developer CLI that provides code validation and session management for spec-driven projects. It orchestrates linting, type checking, circular dependency detection, and manages work handoffs between agent contexts.
10
+
11
+ ### Key Benefits
12
+
13
+ - **Unified validation**: Run ESLint, TypeScript, and circular dependency checks through a single command
14
+ - **Session management**: Queue, claim, and hand off work between agents
15
+ - **Multiple formats**: Text, JSON output for CI and automation
16
+
17
+ ## Installation
18
+
19
+ ### From GitHub (Latest)
20
+
21
+ ```bash
22
+ # Clone and install
23
+ git clone https://github.com/simonheimlicher/spx-cli.git
24
+ cd spx-cli
25
+ pnpm install
26
+ pnpm run build
27
+ pnpm link --global # Makes 'spx' available globally
28
+ ```
29
+
30
+ ### From Registry (Coming Soon)
31
+
32
+ ```bash
33
+ # Will be available when published
34
+ pnpm add -g spx
35
+ ```
36
+
37
+ ## Usage
38
+
39
+ ### Code Validation
40
+
41
+ ```bash
42
+ # Full validation pipeline (circular deps → ESLint → TypeScript)
43
+ spx validation all
44
+
45
+ # Individual checks
46
+ spx validation lint # ESLint
47
+ spx validation lint --fix # ESLint with auto-fix
48
+ spx validation typescript # TypeScript type checking
49
+ spx validation circular # Circular dependency detection
50
+ spx validation knip # Unused code detection
51
+
52
+ # Production scope only (excludes tests/scripts)
53
+ spx validation all --scope production
54
+ ```
55
+
56
+ All commands support `--quiet` for CI and `--json` for machine-readable output.
57
+
58
+ ### Session Management
59
+
60
+ Manage work sessions for agent handoffs and task queuing:
61
+
62
+ ```bash
63
+ # Create a handoff session (reads content with frontmatter from stdin)
64
+ cat << 'EOF' | spx session handoff
65
+ ---
66
+ priority: high
67
+ ---
68
+ # Implement feature X
69
+ EOF
70
+ # Output:
71
+ # Created handoff session <HANDOFF_ID>2026-01-15_08-30-00</HANDOFF_ID>
72
+ # <SESSION_FILE>/path/to/.spx/sessions/todo/2026-01-15_08-30-00.md</SESSION_FILE>
73
+
74
+ # Or create empty session and edit the file directly
75
+ spx session handoff
76
+ # Then edit the <SESSION_FILE> path returned
77
+
78
+ # List all sessions
79
+ spx session list
80
+
81
+ # Claim the highest priority session
82
+ spx session pickup --auto
83
+ # Output: Claimed session <PICKUP_ID>2026-01-15_08-30-00</PICKUP_ID>
84
+
85
+ # Release session back to queue
86
+ spx session release
87
+
88
+ # Show session content
89
+ spx session show <session-id>
90
+
91
+ # Delete a session
92
+ spx session delete <session-id>
93
+ ```
94
+
95
+ Sessions are stored in `.spx/sessions/` with priority-based ordering (high → medium → low) and FIFO within the same priority. Commands output parseable `<PICKUP_ID>`, `<HANDOFF_ID>`, and `<SESSION_FILE>` tags for automation.
96
+
97
+ See [Session Recipes](docs/how-to/session/common-tasks.md) for detailed usage patterns.
98
+
99
+ ## Development
100
+
101
+ ```bash
102
+ # Install dependencies
103
+ pnpm install
104
+
105
+ # Run tests
106
+ pnpm test
107
+
108
+ # Run validation (required before commits)
109
+ pnpm run validate # or: spx validation all
110
+
111
+ # Build
112
+ pnpm run build
113
+
114
+ # Run locally
115
+ node bin/spx.js --help
116
+ ```
117
+
118
+ ## Technical Stack
119
+
120
+ - **TypeScript** - Type-safe implementation
121
+ - **Commander.js** - CLI framework
122
+ - **Vitest** - Testing framework
123
+ - **tsup** - Build tool
124
+ - **ESLint 9** - Linting with flat config
125
+
126
+ ## Architecture
127
+
128
+ ```
129
+ src/
130
+ ├── commands/ # CLI command implementations
131
+ │ ├── validation/ # spx validation subcommands
132
+ │ └── session/ # spx session subcommands
133
+ ├── validation/ # Lint, typecheck, circular dep logic
134
+ ├── session/ # Session lifecycle and storage
135
+ ├── config/ # Configuration loading
136
+ ├── git/ # Git integration utilities
137
+ ├── scanner/ # Directory walking, pattern matching
138
+ ├── status/ # Status state machine
139
+ ├── reporter/ # Output formatting
140
+ ├── tree/ # Hierarchical tree building
141
+ └── lib/ # Shared utilities
142
+ ```
143
+
144
+ ## License
145
+
146
+ MIT
package/bin/spx.js ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env node
2
+
3
+ // CLI entry point
4
+ // Use tsx for development when dist/cli.js doesn't exist
5
+ import { existsSync } from "node:fs";
6
+ import { dirname, join } from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+
9
+ const __filename = fileURLToPath(import.meta.url);
10
+ const __dirname = dirname(__filename);
11
+ const distPath = join(__dirname, "../dist/cli.js");
12
+
13
+ if (existsSync(distPath)) {
14
+ try {
15
+ await import("../dist/cli.js");
16
+ } catch (err) {
17
+ console.error("Failed to load CLI:", err);
18
+ process.exit(1);
19
+ }
20
+ } else {
21
+ // Development mode: use tsx to run source directly
22
+ try {
23
+ await import("tsx/esm");
24
+ await import("../src/cli.ts");
25
+ } catch (err) {
26
+ console.error("tsx not available and dist/cli.js not found:", err);
27
+ console.error("Run \"pnpm run build\" to build the CLI");
28
+ process.exit(1);
29
+ }
30
+ }