@worca/ui 0.1.0-rc.3 → 0.1.0-rc.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.
- package/README.md +44 -0
- package/app/main.bundle.js +174 -168
- package/app/main.bundle.js.map +3 -3
- package/bin/worca-ui.js +7 -2
- package/package.json +1 -1
- package/server/index.js +2 -1
- package/server/preferences.js +1 -1
- package/server/project-routes.js +9 -5
package/bin/worca-ui.js
CHANGED
|
@@ -44,7 +44,7 @@ export function parseArgs(argv) {
|
|
|
44
44
|
port: 3400,
|
|
45
45
|
host: '127.0.0.1',
|
|
46
46
|
open: false,
|
|
47
|
-
global:
|
|
47
|
+
global: true,
|
|
48
48
|
// projects sub-command
|
|
49
49
|
subAction: null, // 'list' | 'add' | 'remove'
|
|
50
50
|
projectPath: null,
|
|
@@ -86,6 +86,11 @@ export function parseArgs(argv) {
|
|
|
86
86
|
args.open = true;
|
|
87
87
|
} else if (arg === '--global') {
|
|
88
88
|
args.global = true;
|
|
89
|
+
} else if (arg === '--project') {
|
|
90
|
+
args.global = false;
|
|
91
|
+
if (argv[i + 1] && !argv[i + 1].startsWith('-')) {
|
|
92
|
+
args.projectPath = argv[++i];
|
|
93
|
+
}
|
|
89
94
|
} else if (arg === '--scan' && argv[i + 1]) {
|
|
90
95
|
args.scanDir = argv[++i];
|
|
91
96
|
} else if (arg === '--dry-run') {
|
|
@@ -535,6 +540,6 @@ switch (args.command) {
|
|
|
535
540
|
break;
|
|
536
541
|
default:
|
|
537
542
|
console.log(
|
|
538
|
-
'Usage: worca-ui [start|stop|restart|status|projects|migrate] [--port N] [--host H] [--open] [--
|
|
543
|
+
'Usage: worca-ui [start|stop|restart|status|projects|migrate] [--port N] [--host H] [--open] [--project [PATH]]',
|
|
539
544
|
);
|
|
540
545
|
}
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -9,13 +9,14 @@ import { attachWsServer } from './ws.js';
|
|
|
9
9
|
// Parse argv
|
|
10
10
|
let port = parseInt(process.env.PORT, 10) || 3400;
|
|
11
11
|
let host = process.env.HOST || '127.0.0.1';
|
|
12
|
-
let isGlobal =
|
|
12
|
+
let isGlobal = true;
|
|
13
13
|
for (let i = 0; i < process.argv.length; i++) {
|
|
14
14
|
if (process.argv[i] === '--port' && process.argv[i + 1])
|
|
15
15
|
port = parseInt(process.argv[++i], 10);
|
|
16
16
|
if (process.argv[i] === '--host' && process.argv[i + 1])
|
|
17
17
|
host = process.argv[++i];
|
|
18
18
|
if (process.argv[i] === '--global') isGlobal = true;
|
|
19
|
+
if (process.argv[i] === '--project') isGlobal = false;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
// Resolve project root: walk up from cwd until we find .claude/settings.json
|
package/server/preferences.js
CHANGED
package/server/project-routes.js
CHANGED
|
@@ -16,9 +16,11 @@ import {
|
|
|
16
16
|
unlinkSync,
|
|
17
17
|
writeFileSync,
|
|
18
18
|
} from 'node:fs';
|
|
19
|
+
import { homedir } from 'node:os';
|
|
19
20
|
import { dirname, join } from 'node:path';
|
|
20
21
|
import { Router } from 'express';
|
|
21
22
|
import { dbExists, getIssue, listIssues } from './beads-reader.js';
|
|
23
|
+
import { readPreferences } from './preferences.js';
|
|
22
24
|
import { ProcessManager } from './process-manager.js';
|
|
23
25
|
import {
|
|
24
26
|
readProjects,
|
|
@@ -1102,14 +1104,16 @@ export function createProjectScopedRoutes() {
|
|
|
1102
1104
|
|
|
1103
1105
|
// POST /api/projects/:projectId/worca-setup — install or update worca
|
|
1104
1106
|
router.post('/worca-setup', (req, res) => {
|
|
1105
|
-
const {
|
|
1107
|
+
const { projectRoot } = req.project;
|
|
1106
1108
|
let source = req.body?.source;
|
|
1107
1109
|
|
|
1108
|
-
// Fall back to
|
|
1109
|
-
if (!source
|
|
1110
|
+
// Fall back to source_repo from global preferences
|
|
1111
|
+
if (!source) {
|
|
1110
1112
|
try {
|
|
1111
|
-
const
|
|
1112
|
-
|
|
1113
|
+
const prefs = readPreferences(
|
|
1114
|
+
join(homedir(), '.worca', 'preferences.json'),
|
|
1115
|
+
);
|
|
1116
|
+
source = prefs.source_repo || undefined;
|
|
1113
1117
|
} catch {
|
|
1114
1118
|
/* ignore — worca init will use its own resolution chain */
|
|
1115
1119
|
}
|