@qontinui/navigation 0.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.
package/README.md ADDED
@@ -0,0 +1,179 @@
1
+ # qontinui-navigation
2
+
3
+ Shared navigation structure for Qontinui applications. Provides type-safe navigation definitions, platform filtering, and state management utilities.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install qontinui-navigation
9
+ ```
10
+
11
+ ## Features
12
+
13
+ - Type-safe navigation items and groups
14
+ - Platform-specific filtering (web, runner, desktop, mobile)
15
+ - Extensible navigation configuration
16
+ - State management with reducer pattern
17
+ - Persistence utilities for localStorage
18
+ - Icon mappings for lucide-react
19
+
20
+ ## Usage
21
+
22
+ ### Basic Navigation Setup
23
+
24
+ ```typescript
25
+ import {
26
+ NAVIGATION_GROUPS,
27
+ getWebNavigation,
28
+ getRunnerNavigation,
29
+ createInitialState,
30
+ navigationReducer,
31
+ } from "qontinui-navigation";
32
+
33
+ // Get platform-specific navigation
34
+ const webNav = getWebNavigation();
35
+ const runnerNav = getRunnerNavigation();
36
+
37
+ // Initialize state
38
+ const initialState = createInitialState({
39
+ activeItemId: "run",
40
+ expandedGroups: ["run", "system"],
41
+ });
42
+ ```
43
+
44
+ ### Platform Filtering
45
+
46
+ ```typescript
47
+ import {
48
+ filterGroupsForPlatform,
49
+ buildNavigationConfig,
50
+ } from "qontinui-navigation";
51
+
52
+ // Filter navigation for a specific platform
53
+ const config = buildNavigationConfig("runner", {
54
+ isDevelopment: true,
55
+ extensions: {
56
+ append: {
57
+ system: [{ id: "debug-tools", label: "Debug Tools", icon: "Wrench" }],
58
+ },
59
+ },
60
+ });
61
+ ```
62
+
63
+ ### State Management
64
+
65
+ ```typescript
66
+ import {
67
+ createInitialState,
68
+ navigationReducer,
69
+ navigationActions,
70
+ } from "qontinui-navigation";
71
+
72
+ // Create initial state
73
+ let state = createInitialState();
74
+
75
+ // Dispatch actions
76
+ state = navigationReducer(state, navigationActions.setActive("history"));
77
+ state = navigationReducer(state, navigationActions.toggleGroup("observe"));
78
+ state = navigationReducer(
79
+ state,
80
+ navigationActions.openSecondary("session", sessionItems),
81
+ );
82
+ ```
83
+
84
+ ### Persistence
85
+
86
+ ```typescript
87
+ import {
88
+ serializeState,
89
+ deserializeState,
90
+ STORAGE_KEYS,
91
+ } from "qontinui-navigation";
92
+
93
+ // Save state
94
+ localStorage.setItem(STORAGE_KEYS.state, serializeState(state));
95
+
96
+ // Restore state
97
+ const saved = localStorage.getItem(STORAGE_KEYS.state);
98
+ if (saved) {
99
+ const restored = deserializeState(saved);
100
+ // Merge with initial state...
101
+ }
102
+ ```
103
+
104
+ ## Navigation Structure
105
+
106
+ The default navigation structure includes:
107
+
108
+ - **RUN** - Execute, Active, History
109
+ - **OBSERVE** - General Logs, Session (with sub-items), Discoveries
110
+ - **BUILD** - Library, Builders (with sub-items), Capture
111
+ - **CONFIGURE** - Log Sources, Findings
112
+ - **SCHEDULE** - Scheduled Tasks
113
+ - **SYSTEM** - Settings (with sub-items), Help
114
+
115
+ ## Development
116
+
117
+ ```bash
118
+ # Install dependencies
119
+ npm install
120
+
121
+ # Build
122
+ npm run build
123
+
124
+ # Watch mode
125
+ npm run dev
126
+
127
+ # Type check
128
+ npm run typecheck
129
+
130
+ # Lint
131
+ npm run lint
132
+ ```
133
+
134
+ ### Stale `dist/*.d.ts` Trap
135
+
136
+ If `npm run build` completes but a consumer's `tsc --noEmit` reports
137
+ "module has no exported member `useNavigationItem`" (or any other newly-
138
+ added symbol), check **`ignoreDeprecations`** in `tsconfig.json`.
139
+
140
+ tsup's dts build runs in a worker. When TypeScript rejects a config option
141
+ (e.g. a stale `"ignoreDeprecations": "5.0"` on TS 6), the worker dies
142
+ silently and `dist/index.d.ts` is left stale — but the JS outputs still
143
+ succeed and `npm run build` exits 0. The symptom is only visible when a
144
+ consumer types-imports from the package.
145
+
146
+ Guardrails (Phase 3 Item 8):
147
+
148
+ - `package.json`'s `build` script ends with `&& test -s dist/index.d.ts`
149
+ so an empty/missing dts is a hard error even when tsup doesn't flag it.
150
+ - `tsup --dts` with `{ resolve: true }` surfaces type-resolution failures
151
+ as build errors.
152
+ - A repo-wide freshness check lives in
153
+ `qontinui-claude-config/scripts/pre-commit-dts-freshness.sh`. Run it
154
+ anytime you want to verify every shared package's dist is newer than its
155
+ src; the Claude Code `git commit` hook runs it automatically.
156
+
157
+ ## Release Process
158
+
159
+ This package is published to npm as `qontinui-navigation` (unscoped) via a tag-triggered GitHub Actions workflow.
160
+
161
+ To cut a release:
162
+
163
+ 1. Bump `version` in `package.json` (use semver; `0.x` minor bumps for breaking changes while pre-1.0).
164
+ 2. Commit the version bump on `master`.
165
+ 3. Tag the commit with a `v`-prefixed tag matching the version, e.g. `git tag v0.2.0`.
166
+ 4. Push the tag: `git push origin v0.2.0`.
167
+
168
+ The `.github/workflows/publish.yml` workflow runs on `push: tags: ['v*']` and publishes to npm using the org-level `NPM_TOKEN` secret. Verify the publish succeeded by checking the workflow run and `npm view qontinui-navigation version`.
169
+
170
+ For local validation before tagging:
171
+
172
+ ```bash
173
+ npm run build
174
+ npm publish --dry-run
175
+ ```
176
+
177
+ ## License
178
+
179
+ Licensed under the GNU Affero General Public License v3.0 or later (AGPL-3.0-or-later). See [LICENSE](LICENSE) for full terms.