orbital-command 1.1.0 → 1.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/bin/commands/launch.js +0 -1
- package/bin/lib/helpers.js +1 -31
- package/bin/orbital.js +32 -30
- package/dist/server/server/index.js +1 -9
- package/dist/server/server/launch.js +0 -3
- package/dist/server/server/routes/sync-routes.js +2 -2
- package/dist/server/server/services/telemetry-service.js +143 -0
- package/dist/server/server/wizard/detect.js +0 -79
- package/dist/server/server/wizard/index.js +27 -91
- package/dist/server/server/wizard/types.js +2 -3
- package/package.json +1 -1
- package/server/index.ts +0 -13
- package/server/launch.ts +0 -3
- package/server/routes/sync-routes.ts +2 -2
- package/server/wizard/detect.ts +1 -81
- package/server/wizard/index.ts +29 -116
- package/server/wizard/types.ts +2 -17
- package/templates/hooks/block-push.sh +16 -2
- package/templates/hooks/git-commit-guard.sh +3 -2
- package/dist/server/server/wizard/phases/confirm.js +0 -39
- package/dist/server/server/wizard/phases/project-setup.js +0 -90
- package/dist/server/server/wizard/phases/welcome.js +0 -32
- package/dist/server/server/wizard/phases/workflow-setup.js +0 -22
- package/server/wizard/phases/confirm.ts +0 -45
- package/server/wizard/phases/project-setup.ts +0 -106
- package/server/wizard/phases/welcome.ts +0 -39
- package/server/wizard/phases/workflow-setup.ts +0 -28
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Phase 3: Confirm choices, run installation, show next steps.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import fs from 'fs';
|
|
6
|
-
import path from 'path';
|
|
7
|
-
import * as p from '@clack/prompts';
|
|
8
|
-
import type { ProjectSetupState } from '../types.js';
|
|
9
|
-
import { NOTES, formatSummary } from '../ui.js';
|
|
10
|
-
|
|
11
|
-
export async function phaseConfirm(state: ProjectSetupState): Promise<void> {
|
|
12
|
-
p.note(formatSummary(state), 'Ready to Initialize');
|
|
13
|
-
|
|
14
|
-
const proceed = await p.confirm({
|
|
15
|
-
message: 'Proceed with installation?',
|
|
16
|
-
initialValue: true,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
if (p.isCancel(proceed) || !proceed) {
|
|
20
|
-
p.cancel('Setup cancelled.');
|
|
21
|
-
process.exit(0);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function showPostInstall(state: ProjectSetupState): void {
|
|
26
|
-
// Count installed artifacts
|
|
27
|
-
const claudeDir = path.join(state.projectRoot, '.claude');
|
|
28
|
-
const counts = {
|
|
29
|
-
hooks: countDir(path.join(claudeDir, 'hooks')),
|
|
30
|
-
skills: countDir(path.join(claudeDir, 'skills')),
|
|
31
|
-
agents: countDir(path.join(claudeDir, 'agents')),
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
p.note(NOTES.postInstall(counts), 'Installation Complete');
|
|
35
|
-
p.note(NOTES.nextSteps, 'Getting Started');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function countDir(dir: string): number {
|
|
39
|
-
if (!fs.existsSync(dir)) return 0;
|
|
40
|
-
try {
|
|
41
|
-
return fs.readdirSync(dir).filter(f => !f.startsWith('.')).length;
|
|
42
|
-
} catch {
|
|
43
|
-
return 0;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Phase 1: Project configuration — name, commands, ports.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as p from '@clack/prompts';
|
|
6
|
-
import type { ProjectSetupState } from '../types.js';
|
|
7
|
-
import { NOTES, formatDetectedCommands } from '../ui.js';
|
|
8
|
-
import { detectProjectName, detectCommands, detectPortConflict } from '../detect.js';
|
|
9
|
-
|
|
10
|
-
export async function phaseProjectSetup(state: ProjectSetupState): Promise<void> {
|
|
11
|
-
p.note(NOTES.projectConfig, 'Project Configuration');
|
|
12
|
-
|
|
13
|
-
// 1. Project name
|
|
14
|
-
const defaultName = detectProjectName(state.projectRoot);
|
|
15
|
-
const name = await p.text({
|
|
16
|
-
message: 'Project name',
|
|
17
|
-
placeholder: defaultName,
|
|
18
|
-
defaultValue: defaultName,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
if (p.isCancel(name)) {
|
|
22
|
-
p.cancel('Setup cancelled.');
|
|
23
|
-
process.exit(0);
|
|
24
|
-
}
|
|
25
|
-
state.projectName = name;
|
|
26
|
-
|
|
27
|
-
// 2. Command detection
|
|
28
|
-
const detected = detectCommands(state.projectRoot);
|
|
29
|
-
state.detectedCommands = detected;
|
|
30
|
-
const detectedCount = Object.values(detected).filter(v => v !== null).length;
|
|
31
|
-
|
|
32
|
-
if (detectedCount > 0) {
|
|
33
|
-
p.note(formatDetectedCommands(detected), `Detected ${detectedCount} command(s) from package.json`);
|
|
34
|
-
|
|
35
|
-
const useDetected = await p.confirm({
|
|
36
|
-
message: 'Use these detected commands for quality gates?',
|
|
37
|
-
initialValue: true,
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
if (p.isCancel(useDetected)) {
|
|
41
|
-
p.cancel('Setup cancelled.');
|
|
42
|
-
process.exit(0);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (useDetected) {
|
|
46
|
-
state.selectedCommands = { ...detected };
|
|
47
|
-
} else {
|
|
48
|
-
state.selectedCommands = await promptCommands(detected);
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
p.log.info('No build commands detected from package.json. You can configure them later with `orbital config`.');
|
|
52
|
-
state.selectedCommands = detected;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// 3. Port conflict detection
|
|
56
|
-
const conflict = detectPortConflict(4444);
|
|
57
|
-
if (conflict) {
|
|
58
|
-
p.log.warn(`Port 4444 is already used by "${conflict}".`);
|
|
59
|
-
|
|
60
|
-
const serverPort = await p.text({
|
|
61
|
-
message: 'Server port',
|
|
62
|
-
placeholder: '4446',
|
|
63
|
-
defaultValue: '4446',
|
|
64
|
-
validate: (val) => {
|
|
65
|
-
const n = Number(val);
|
|
66
|
-
if (isNaN(n) || n < 1 || n > 65535) return 'Must be a valid port (1-65535)';
|
|
67
|
-
return undefined;
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
if (p.isCancel(serverPort)) {
|
|
72
|
-
p.cancel('Setup cancelled.');
|
|
73
|
-
process.exit(0);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
state.serverPort = Number(serverPort);
|
|
77
|
-
state.clientPort = state.serverPort + 1;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
async function promptCommands(defaults: Record<string, string | null>): Promise<Record<string, string | null>> {
|
|
82
|
-
const commands: Record<string, string | null> = {};
|
|
83
|
-
const labels: Record<string, string> = {
|
|
84
|
-
typeCheck: 'Type check command',
|
|
85
|
-
lint: 'Lint command',
|
|
86
|
-
build: 'Build command',
|
|
87
|
-
test: 'Test command',
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
for (const [key, defaultVal] of Object.entries(defaults)) {
|
|
91
|
-
const val = await p.text({
|
|
92
|
-
message: labels[key] || key,
|
|
93
|
-
placeholder: defaultVal || 'none',
|
|
94
|
-
defaultValue: defaultVal || '',
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
if (p.isCancel(val)) {
|
|
98
|
-
p.cancel('Setup cancelled.');
|
|
99
|
-
process.exit(0);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
commands[key] = val || null;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return commands;
|
|
106
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Phase 2 welcome gate — project-scoped only.
|
|
3
|
-
*
|
|
4
|
-
* If the project is already initialized, offers re-init or config editor.
|
|
5
|
-
* If not, returns false to continue the project setup flow.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import * as p from '@clack/prompts';
|
|
9
|
-
import pc from 'picocolors';
|
|
10
|
-
import type { ProjectSetupState } from '../types.js';
|
|
11
|
-
import { NOTES } from '../ui.js';
|
|
12
|
-
import { runConfigEditor } from '../config-editor.js';
|
|
13
|
-
|
|
14
|
-
export async function phaseWelcome(state: ProjectSetupState): Promise<boolean> {
|
|
15
|
-
if (state.isProjectInitialized) {
|
|
16
|
-
p.note(NOTES.reconfigure, pc.yellow('Already Initialized'));
|
|
17
|
-
|
|
18
|
-
const action = await p.select({
|
|
19
|
-
message: 'What would you like to do?',
|
|
20
|
-
options: [
|
|
21
|
-
{ value: 'configure', label: 'Open config editor', hint: 'modify settings' },
|
|
22
|
-
{ value: 'cancel', label: 'Cancel' },
|
|
23
|
-
],
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
if (p.isCancel(action) || action === 'cancel') {
|
|
27
|
-
p.cancel('Cancelled.');
|
|
28
|
-
process.exit(0);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (action === 'configure') {
|
|
32
|
-
await runConfigEditor(state.projectRoot, state.packageVersion, []);
|
|
33
|
-
process.exit(0);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Not initialized — continue normally
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Phase 2: Workflow preset selection.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as p from '@clack/prompts';
|
|
6
|
-
import type { ProjectSetupState } from '../types.js';
|
|
7
|
-
import { WORKFLOW_PRESETS } from '../types.js';
|
|
8
|
-
import { NOTES } from '../ui.js';
|
|
9
|
-
|
|
10
|
-
export async function phaseWorkflowSetup(state: ProjectSetupState): Promise<void> {
|
|
11
|
-
p.note(NOTES.workflow, 'Workflow Selection');
|
|
12
|
-
|
|
13
|
-
const preset = await p.select({
|
|
14
|
-
message: 'Choose a workflow preset',
|
|
15
|
-
options: WORKFLOW_PRESETS.map(p => ({
|
|
16
|
-
value: p.value,
|
|
17
|
-
label: p.label,
|
|
18
|
-
hint: p.hint,
|
|
19
|
-
})),
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
if (p.isCancel(preset)) {
|
|
23
|
-
p.cancel('Setup cancelled.');
|
|
24
|
-
process.exit(0);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
state.workflowPreset = preset as string;
|
|
28
|
-
}
|