@online5880/opensession 0.1.4 → 0.1.5
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/package.json +1 -1
- package/src/cli.js +10 -3
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -677,21 +677,28 @@ program
|
|
|
677
677
|
.command('start')
|
|
678
678
|
.alias('st')
|
|
679
679
|
.description('Start a new session and emit a start event')
|
|
680
|
-
.
|
|
680
|
+
.option('--project-key <projectKey>', 'Project key (defaults to configured project key)')
|
|
681
|
+
.option('--project <projectKey>', 'Alias of --project-key')
|
|
681
682
|
.option('--project-name <projectName>', 'Project display name')
|
|
682
683
|
.option('--actor <actor>', 'Actor override')
|
|
683
684
|
.action(async (options) => {
|
|
684
685
|
const config = await readConfig();
|
|
685
686
|
const client = getClient(config);
|
|
687
|
+
const projectKey = options.project ?? options.projectKey ?? config.defaultProjectKey ?? config.syncStatus?.project;
|
|
688
|
+
|
|
689
|
+
if (!projectKey) {
|
|
690
|
+
throw new Error("Missing project key. Pass --project-key or set a default via 'opss init'.");
|
|
691
|
+
}
|
|
692
|
+
|
|
686
693
|
const actor = options.actor ?? config.actor ?? 'anonymous';
|
|
687
694
|
const operationId = randomUUID();
|
|
688
695
|
|
|
689
|
-
const project = await ensureProject(client,
|
|
696
|
+
const project = await ensureProject(client, projectKey, options.projectName);
|
|
690
697
|
const session = await startSession(client, project.id, actor, { operationId });
|
|
691
698
|
|
|
692
699
|
await writeConfig(
|
|
693
700
|
mergeConfig(config, {
|
|
694
|
-
defaultProjectKey:
|
|
701
|
+
defaultProjectKey: projectKey,
|
|
695
702
|
lastSessionId: session.id
|
|
696
703
|
})
|
|
697
704
|
);
|