@hiroleague/taskmanager 0.0.3 → 0.0.4

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 (62) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/index-BpzHnKdP.css +1 -0
  3. package/dist/assets/index-DmNErTAP.js +273 -0
  4. package/dist/index.html +2 -2
  5. package/package.json +1 -1
  6. package/skills/hiro-task-manager-cli/SKILL.md +6 -4
  7. package/skills/hiro-task-manager-cli/reference/cli-access-policy.md +1 -0
  8. package/skills/hiro-task-manager-cli/reference/releases.md +14 -0
  9. package/src/cli/commands/query.ts +56 -56
  10. package/src/cli/commands/releases.ts +22 -0
  11. package/src/cli/handlers/boards.test.ts +669 -669
  12. package/src/cli/handlers/cli-wiring.test.ts +38 -1
  13. package/src/cli/handlers/releases.ts +15 -0
  14. package/src/cli/handlers/search.test.ts +374 -374
  15. package/src/cli/handlers/search.ts +17 -17
  16. package/src/cli/lib/cli-http-errors.test.ts +85 -85
  17. package/src/cli/lib/write/releases.ts +64 -1
  18. package/src/cli/lib/write-result.test.ts +3 -0
  19. package/src/cli/lib/write-result.ts +3 -0
  20. package/src/cli/lib/writeCommands.breadth.test.ts +143 -0
  21. package/src/cli/lib/writeCommands.ts +1 -0
  22. package/src/cli/subprocess.real-stack.test.ts +625 -611
  23. package/src/cli/subprocess.smoke.test.ts +954 -954
  24. package/src/client/api/useBoardChangeStream.ts +421 -168
  25. package/src/client/api/useBoardIndexStream.ts +35 -0
  26. package/src/client/components/board/BoardStatsChips.tsx +233 -233
  27. package/src/client/components/board/BoardStatsContext.tsx +41 -41
  28. package/src/client/components/board/boardHeaderButtonStyles.ts +38 -38
  29. package/src/client/components/board/shortcuts/useBoardShortcutKeydown.ts +49 -49
  30. package/src/client/components/board/useBoardCanvasPanScroll.ts +108 -108
  31. package/src/client/components/board/useBoardTaskContainerDroppableReact.ts +33 -33
  32. package/src/client/components/board/useBoardTaskSortableReact.ts +26 -26
  33. package/src/client/components/layout/AppShell.tsx +5 -2
  34. package/src/client/components/layout/NotificationToasts.tsx +38 -1
  35. package/src/client/components/multi-select.tsx +1206 -1206
  36. package/src/client/components/routing/BoardPage.tsx +20 -20
  37. package/src/client/components/routing/NavigationRegistrar.tsx +13 -13
  38. package/src/client/components/task/TaskCard.tsx +643 -643
  39. package/src/client/components/ui/badge.tsx +49 -49
  40. package/src/client/components/ui/button.tsx +65 -65
  41. package/src/client/components/ui/command.tsx +193 -193
  42. package/src/client/components/ui/dialog.tsx +163 -163
  43. package/src/client/components/ui/input-group.tsx +155 -155
  44. package/src/client/components/ui/input.tsx +19 -19
  45. package/src/client/components/ui/popover.tsx +87 -87
  46. package/src/client/components/ui/separator.tsx +28 -28
  47. package/src/client/components/ui/textarea.tsx +18 -18
  48. package/src/client/index.css +248 -248
  49. package/src/client/lib/appNavigate.ts +16 -16
  50. package/src/client/lib/taskCardDate.ts +111 -111
  51. package/src/client/lib/utils.ts +6 -6
  52. package/src/client/store/notificationUi.ts +14 -0
  53. package/src/server/auth.ts +351 -351
  54. package/src/server/events.ts +31 -4
  55. package/src/server/migrations/registry.ts +43 -43
  56. package/src/server/notificationEvents.ts +8 -1
  57. package/src/server/routes/boards.ts +15 -1
  58. package/src/server/routes/trash.ts +6 -1
  59. package/src/shared/boardEvents.ts +6 -0
  60. package/src/shared/runtimeConfig.ts +256 -256
  61. package/dist/assets/index-hMFTu7sr.css +0 -1
  62. package/dist/assets/index-oKG1C41_.js +0 -273
@@ -1,256 +1,256 @@
1
- import {
2
- existsSync,
3
- mkdirSync,
4
- readdirSync,
5
- readFileSync,
6
- writeFileSync,
7
- } from "node:fs";
8
- import path from "node:path";
9
-
10
- export type RuntimeKind = "installed" | "dev";
11
-
12
- export interface RuntimeConfigFile {
13
- api_key?: string;
14
- port?: number;
15
- data_dir?: string;
16
- auth_dir?: string;
17
- open_browser?: boolean;
18
- }
19
-
20
- export interface RuntimeConfigOverrides {
21
- kind?: RuntimeKind;
22
- profile?: string;
23
- port?: number;
24
- dataDir?: string;
25
- authDir?: string;
26
- openBrowser?: boolean;
27
- }
28
-
29
- let selectedRuntimeKind: RuntimeKind | undefined;
30
- let selectedProfileName: string | undefined;
31
- /** Set from global `hirotm --port` (parsed before Commander); not read from any env var. */
32
- let selectedCliPort: number | undefined;
33
-
34
- function normalizeProfileName(profile: string | undefined): string | undefined {
35
- const trimmed = profile?.trim();
36
- return trimmed ? trimmed : undefined;
37
- }
38
-
39
- function readRuntimeKindFromEnv(): RuntimeKind | undefined {
40
- const value = process.env.TASKMANAGER_RUNTIME?.trim().toLowerCase();
41
- if (value === "installed" || value === "dev") return value;
42
- return undefined;
43
- }
44
-
45
- function resolveHomeDir(): string {
46
- return process.env.HOME ?? process.env.USERPROFILE ?? process.cwd();
47
- }
48
-
49
- function normalizePort(value: unknown): number | undefined {
50
- if (typeof value === "number" && Number.isInteger(value) && value > 0) {
51
- return value;
52
- }
53
-
54
- if (typeof value === "string" && value.trim()) {
55
- const parsed = Number(value);
56
- if (Number.isInteger(parsed) && parsed > 0) return parsed;
57
- }
58
-
59
- return undefined;
60
- }
61
-
62
- function normalizeBoolean(value: unknown): boolean | undefined {
63
- if (typeof value === "boolean") return value;
64
- if (typeof value === "string") {
65
- const normalized = value.trim().toLowerCase();
66
- if (normalized === "true" || normalized === "1") return true;
67
- if (normalized === "false" || normalized === "0") return false;
68
- }
69
- return undefined;
70
- }
71
-
72
- export function setRuntimeConfigSelection(selection: {
73
- kind?: RuntimeKind;
74
- profile?: string;
75
- port?: number;
76
- }): void {
77
- if (selection.kind) selectedRuntimeKind = selection.kind;
78
- if (selection.profile !== undefined) {
79
- selectedProfileName = normalizeProfileName(selection.profile);
80
- }
81
- if (selection.port !== undefined) {
82
- const p = normalizePort(selection.port);
83
- selectedCliPort = p;
84
- }
85
- }
86
-
87
- // Runtime kind is set explicitly via --dev flag, setRuntimeConfigSelection, or
88
- // TASKMANAGER_RUNTIME env. Profile name no longer implies runtime kind.
89
- export function resolveRuntimeKind(overrides: RuntimeConfigOverrides = {}): RuntimeKind {
90
- return (
91
- overrides.kind ??
92
- selectedRuntimeKind ??
93
- readRuntimeKindFromEnv() ??
94
- "installed"
95
- );
96
- }
97
-
98
- export function resolveProfileName(overrides: RuntimeConfigOverrides = {}): string {
99
- return (
100
- normalizeProfileName(overrides.profile) ??
101
- selectedProfileName ??
102
- "default"
103
- );
104
- }
105
-
106
- export function getTaskManagerHomeDir(): string {
107
- return path.join(resolveHomeDir(), ".taskmanager");
108
- }
109
-
110
- /** True if any `~/.taskmanager/profiles/<name>/config.json` exists (any named profile). */
111
- export function hasAnyProfileConfigOnDisk(): boolean {
112
- const profilesRoot = path.join(getTaskManagerHomeDir(), "profiles");
113
- if (!existsSync(profilesRoot)) return false;
114
- try {
115
- for (const ent of readdirSync(profilesRoot, { withFileTypes: true })) {
116
- if (!ent.isDirectory()) continue;
117
- if (existsSync(path.join(profilesRoot, ent.name, "config.json"))) {
118
- return true;
119
- }
120
- }
121
- } catch {
122
- return false;
123
- }
124
- return false;
125
- }
126
-
127
- export function getProfileRootDir(overrides: RuntimeConfigOverrides = {}): string {
128
- return path.join(getTaskManagerHomeDir(), "profiles", resolveProfileName(overrides));
129
- }
130
-
131
- export function ensureProfileRootDir(overrides: RuntimeConfigOverrides = {}): string {
132
- const profileRootDir = getProfileRootDir(overrides);
133
- mkdirSync(profileRootDir, { recursive: true });
134
- return profileRootDir;
135
- }
136
-
137
- export function ensureRuntimeDirectories(
138
- overrides: RuntimeConfigOverrides = {},
139
- ): {
140
- profileRootDir: string;
141
- dataDir: string;
142
- authDir: string;
143
- } {
144
- const profileRootDir = ensureProfileRootDir(overrides);
145
- const dataDir = resolveDataDir(overrides);
146
- const authDir = resolveAuthDir(overrides);
147
-
148
- mkdirSync(dataDir, { recursive: true });
149
- mkdirSync(authDir, { recursive: true });
150
-
151
- return {
152
- profileRootDir,
153
- dataDir,
154
- authDir,
155
- };
156
- }
157
-
158
- export function getProfileConfigFilePath(overrides: RuntimeConfigOverrides = {}): string {
159
- return path.join(getProfileRootDir(overrides), "config.json");
160
- }
161
-
162
- export function hasProfileConfigFile(overrides: RuntimeConfigOverrides = {}): boolean {
163
- return existsSync(getProfileConfigFilePath(overrides));
164
- }
165
-
166
- export function readProfileConfig(
167
- overrides: RuntimeConfigOverrides = {},
168
- ): RuntimeConfigFile {
169
- const configFilePath = getProfileConfigFilePath(overrides);
170
- if (!existsSync(configFilePath)) return {};
171
-
172
- try {
173
- const raw = readFileSync(configFilePath, "utf8").trim();
174
- if (!raw) return {};
175
- return JSON.parse(raw) as RuntimeConfigFile;
176
- } catch {
177
- return {};
178
- }
179
- }
180
-
181
- export function writeProfileConfig(
182
- config: RuntimeConfigFile,
183
- overrides: RuntimeConfigOverrides = {},
184
- ): string {
185
- const configFilePath = path.join(ensureProfileRootDir(overrides), "config.json");
186
- writeFileSync(configFilePath, `${JSON.stringify(config, null, 2)}\n`, "utf8");
187
- return configFilePath;
188
- }
189
-
190
- export function getDefaultPort(overrides: RuntimeConfigOverrides = {}): number {
191
- return resolveRuntimeKind(overrides) === "dev" ? 3002 : 3001;
192
- }
193
-
194
- // All profiles (including dev) use the profile-based data dir under
195
- // ~/.taskmanager/profiles/<name>/data. Use --data-dir or config.json
196
- // data_dir to override.
197
- export function getDefaultDataDir(overrides: RuntimeConfigOverrides = {}): string {
198
- return path.join(getProfileRootDir(overrides), "data");
199
- }
200
-
201
- export function getDefaultAuthDir(overrides: RuntimeConfigOverrides = {}): string {
202
- return path.join(getProfileRootDir(overrides), "auth");
203
- }
204
-
205
- export function getServerPidFilePath(overrides: RuntimeConfigOverrides = {}): string {
206
- return path.join(getProfileRootDir(overrides), "server.pid.json");
207
- }
208
-
209
- export function resolvePort(overrides: RuntimeConfigOverrides = {}): number {
210
- const config = readProfileConfig(overrides);
211
- return (
212
- normalizePort(overrides.port) ??
213
- normalizePort(selectedCliPort) ??
214
- normalizePort(config.port) ??
215
- getDefaultPort(overrides)
216
- );
217
- }
218
-
219
- export function resolveDataDir(overrides: RuntimeConfigOverrides = {}): string {
220
- const config = readProfileConfig(overrides);
221
- return path.resolve(
222
- overrides.dataDir ??
223
- process.env.TASKMANAGER_DATA_DIR ??
224
- config.data_dir ??
225
- getDefaultDataDir(overrides),
226
- );
227
- }
228
-
229
- export function resolveAuthDir(overrides: RuntimeConfigOverrides = {}): string {
230
- const config = readProfileConfig(overrides);
231
- return path.resolve(
232
- overrides.authDir ??
233
- process.env.TASKMANAGER_AUTH_DIR ??
234
- config.auth_dir ??
235
- getDefaultAuthDir(overrides),
236
- );
237
- }
238
-
239
- export function resolveOpenBrowser(overrides: RuntimeConfigOverrides = {}): boolean {
240
- const config = readProfileConfig(overrides);
241
- return (
242
- normalizeBoolean(overrides.openBrowser) ??
243
- normalizeBoolean(process.env.TASKMANAGER_OPEN_BROWSER) ??
244
- normalizeBoolean(config.open_browser) ??
245
- true
246
- );
247
- }
248
-
249
- export function resolveApiKey(overrides: RuntimeConfigOverrides = {}): string | undefined {
250
- const config = readProfileConfig(overrides);
251
-
252
- if (process.env.API_KEY?.trim()) return process.env.API_KEY;
253
- if (config.api_key?.trim()) return config.api_key;
254
-
255
- return undefined;
256
- }
1
+ import {
2
+ existsSync,
3
+ mkdirSync,
4
+ readdirSync,
5
+ readFileSync,
6
+ writeFileSync,
7
+ } from "node:fs";
8
+ import path from "node:path";
9
+
10
+ export type RuntimeKind = "installed" | "dev";
11
+
12
+ export interface RuntimeConfigFile {
13
+ api_key?: string;
14
+ port?: number;
15
+ data_dir?: string;
16
+ auth_dir?: string;
17
+ open_browser?: boolean;
18
+ }
19
+
20
+ export interface RuntimeConfigOverrides {
21
+ kind?: RuntimeKind;
22
+ profile?: string;
23
+ port?: number;
24
+ dataDir?: string;
25
+ authDir?: string;
26
+ openBrowser?: boolean;
27
+ }
28
+
29
+ let selectedRuntimeKind: RuntimeKind | undefined;
30
+ let selectedProfileName: string | undefined;
31
+ /** Set from global `hirotm --port` (parsed before Commander); not read from any env var. */
32
+ let selectedCliPort: number | undefined;
33
+
34
+ function normalizeProfileName(profile: string | undefined): string | undefined {
35
+ const trimmed = profile?.trim();
36
+ return trimmed ? trimmed : undefined;
37
+ }
38
+
39
+ function readRuntimeKindFromEnv(): RuntimeKind | undefined {
40
+ const value = process.env.TASKMANAGER_RUNTIME?.trim().toLowerCase();
41
+ if (value === "installed" || value === "dev") return value;
42
+ return undefined;
43
+ }
44
+
45
+ function resolveHomeDir(): string {
46
+ return process.env.HOME ?? process.env.USERPROFILE ?? process.cwd();
47
+ }
48
+
49
+ function normalizePort(value: unknown): number | undefined {
50
+ if (typeof value === "number" && Number.isInteger(value) && value > 0) {
51
+ return value;
52
+ }
53
+
54
+ if (typeof value === "string" && value.trim()) {
55
+ const parsed = Number(value);
56
+ if (Number.isInteger(parsed) && parsed > 0) return parsed;
57
+ }
58
+
59
+ return undefined;
60
+ }
61
+
62
+ function normalizeBoolean(value: unknown): boolean | undefined {
63
+ if (typeof value === "boolean") return value;
64
+ if (typeof value === "string") {
65
+ const normalized = value.trim().toLowerCase();
66
+ if (normalized === "true" || normalized === "1") return true;
67
+ if (normalized === "false" || normalized === "0") return false;
68
+ }
69
+ return undefined;
70
+ }
71
+
72
+ export function setRuntimeConfigSelection(selection: {
73
+ kind?: RuntimeKind;
74
+ profile?: string;
75
+ port?: number;
76
+ }): void {
77
+ if (selection.kind) selectedRuntimeKind = selection.kind;
78
+ if (selection.profile !== undefined) {
79
+ selectedProfileName = normalizeProfileName(selection.profile);
80
+ }
81
+ if (selection.port !== undefined) {
82
+ const p = normalizePort(selection.port);
83
+ selectedCliPort = p;
84
+ }
85
+ }
86
+
87
+ // Runtime kind is set explicitly via --dev flag, setRuntimeConfigSelection, or
88
+ // TASKMANAGER_RUNTIME env. Profile name no longer implies runtime kind.
89
+ export function resolveRuntimeKind(overrides: RuntimeConfigOverrides = {}): RuntimeKind {
90
+ return (
91
+ overrides.kind ??
92
+ selectedRuntimeKind ??
93
+ readRuntimeKindFromEnv() ??
94
+ "installed"
95
+ );
96
+ }
97
+
98
+ export function resolveProfileName(overrides: RuntimeConfigOverrides = {}): string {
99
+ return (
100
+ normalizeProfileName(overrides.profile) ??
101
+ selectedProfileName ??
102
+ "default"
103
+ );
104
+ }
105
+
106
+ export function getTaskManagerHomeDir(): string {
107
+ return path.join(resolveHomeDir(), ".taskmanager");
108
+ }
109
+
110
+ /** True if any `~/.taskmanager/profiles/<name>/config.json` exists (any named profile). */
111
+ export function hasAnyProfileConfigOnDisk(): boolean {
112
+ const profilesRoot = path.join(getTaskManagerHomeDir(), "profiles");
113
+ if (!existsSync(profilesRoot)) return false;
114
+ try {
115
+ for (const ent of readdirSync(profilesRoot, { withFileTypes: true })) {
116
+ if (!ent.isDirectory()) continue;
117
+ if (existsSync(path.join(profilesRoot, ent.name, "config.json"))) {
118
+ return true;
119
+ }
120
+ }
121
+ } catch {
122
+ return false;
123
+ }
124
+ return false;
125
+ }
126
+
127
+ export function getProfileRootDir(overrides: RuntimeConfigOverrides = {}): string {
128
+ return path.join(getTaskManagerHomeDir(), "profiles", resolveProfileName(overrides));
129
+ }
130
+
131
+ export function ensureProfileRootDir(overrides: RuntimeConfigOverrides = {}): string {
132
+ const profileRootDir = getProfileRootDir(overrides);
133
+ mkdirSync(profileRootDir, { recursive: true });
134
+ return profileRootDir;
135
+ }
136
+
137
+ export function ensureRuntimeDirectories(
138
+ overrides: RuntimeConfigOverrides = {},
139
+ ): {
140
+ profileRootDir: string;
141
+ dataDir: string;
142
+ authDir: string;
143
+ } {
144
+ const profileRootDir = ensureProfileRootDir(overrides);
145
+ const dataDir = resolveDataDir(overrides);
146
+ const authDir = resolveAuthDir(overrides);
147
+
148
+ mkdirSync(dataDir, { recursive: true });
149
+ mkdirSync(authDir, { recursive: true });
150
+
151
+ return {
152
+ profileRootDir,
153
+ dataDir,
154
+ authDir,
155
+ };
156
+ }
157
+
158
+ export function getProfileConfigFilePath(overrides: RuntimeConfigOverrides = {}): string {
159
+ return path.join(getProfileRootDir(overrides), "config.json");
160
+ }
161
+
162
+ export function hasProfileConfigFile(overrides: RuntimeConfigOverrides = {}): boolean {
163
+ return existsSync(getProfileConfigFilePath(overrides));
164
+ }
165
+
166
+ export function readProfileConfig(
167
+ overrides: RuntimeConfigOverrides = {},
168
+ ): RuntimeConfigFile {
169
+ const configFilePath = getProfileConfigFilePath(overrides);
170
+ if (!existsSync(configFilePath)) return {};
171
+
172
+ try {
173
+ const raw = readFileSync(configFilePath, "utf8").trim();
174
+ if (!raw) return {};
175
+ return JSON.parse(raw) as RuntimeConfigFile;
176
+ } catch {
177
+ return {};
178
+ }
179
+ }
180
+
181
+ export function writeProfileConfig(
182
+ config: RuntimeConfigFile,
183
+ overrides: RuntimeConfigOverrides = {},
184
+ ): string {
185
+ const configFilePath = path.join(ensureProfileRootDir(overrides), "config.json");
186
+ writeFileSync(configFilePath, `${JSON.stringify(config, null, 2)}\n`, "utf8");
187
+ return configFilePath;
188
+ }
189
+
190
+ export function getDefaultPort(overrides: RuntimeConfigOverrides = {}): number {
191
+ return resolveRuntimeKind(overrides) === "dev" ? 3002 : 3001;
192
+ }
193
+
194
+ // All profiles (including dev) use the profile-based data dir under
195
+ // ~/.taskmanager/profiles/<name>/data. Use --data-dir or config.json
196
+ // data_dir to override.
197
+ export function getDefaultDataDir(overrides: RuntimeConfigOverrides = {}): string {
198
+ return path.join(getProfileRootDir(overrides), "data");
199
+ }
200
+
201
+ export function getDefaultAuthDir(overrides: RuntimeConfigOverrides = {}): string {
202
+ return path.join(getProfileRootDir(overrides), "auth");
203
+ }
204
+
205
+ export function getServerPidFilePath(overrides: RuntimeConfigOverrides = {}): string {
206
+ return path.join(getProfileRootDir(overrides), "server.pid.json");
207
+ }
208
+
209
+ export function resolvePort(overrides: RuntimeConfigOverrides = {}): number {
210
+ const config = readProfileConfig(overrides);
211
+ return (
212
+ normalizePort(overrides.port) ??
213
+ normalizePort(selectedCliPort) ??
214
+ normalizePort(config.port) ??
215
+ getDefaultPort(overrides)
216
+ );
217
+ }
218
+
219
+ export function resolveDataDir(overrides: RuntimeConfigOverrides = {}): string {
220
+ const config = readProfileConfig(overrides);
221
+ return path.resolve(
222
+ overrides.dataDir ??
223
+ process.env.TASKMANAGER_DATA_DIR ??
224
+ config.data_dir ??
225
+ getDefaultDataDir(overrides),
226
+ );
227
+ }
228
+
229
+ export function resolveAuthDir(overrides: RuntimeConfigOverrides = {}): string {
230
+ const config = readProfileConfig(overrides);
231
+ return path.resolve(
232
+ overrides.authDir ??
233
+ process.env.TASKMANAGER_AUTH_DIR ??
234
+ config.auth_dir ??
235
+ getDefaultAuthDir(overrides),
236
+ );
237
+ }
238
+
239
+ export function resolveOpenBrowser(overrides: RuntimeConfigOverrides = {}): boolean {
240
+ const config = readProfileConfig(overrides);
241
+ return (
242
+ normalizeBoolean(overrides.openBrowser) ??
243
+ normalizeBoolean(process.env.TASKMANAGER_OPEN_BROWSER) ??
244
+ normalizeBoolean(config.open_browser) ??
245
+ true
246
+ );
247
+ }
248
+
249
+ export function resolveApiKey(overrides: RuntimeConfigOverrides = {}): string | undefined {
250
+ const config = readProfileConfig(overrides);
251
+
252
+ if (process.env.API_KEY?.trim()) return process.env.API_KEY;
253
+ if (config.api_key?.trim()) return config.api_key;
254
+
255
+ return undefined;
256
+ }