@orbitpanel/cli 1.2.1 → 1.3.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/dist/commands/init.d.ts +13 -0
- package/dist/commands/init.js +65 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/components/ShellApp.js +15 -3
- package/dist/components/ShellApp.js.map +1 -1
- package/dist/components/StatusBar.d.ts +3 -0
- package/dist/components/StatusBar.js +15 -2
- package/dist/components/StatusBar.js.map +1 -1
- package/dist/lib/command-router.js +101 -8
- package/dist/lib/command-router.js.map +1 -1
- package/dist/lib/context-guard.d.ts +63 -0
- package/dist/lib/context-guard.js +129 -0
- package/dist/lib/context-guard.js.map +1 -0
- package/dist/lib/context-health.d.ts +37 -0
- package/dist/lib/context-health.js +162 -0
- package/dist/lib/context-health.js.map +1 -0
- package/dist/lib/environment.d.ts +19 -0
- package/dist/lib/environment.js +75 -0
- package/dist/lib/environment.js.map +1 -0
- package/dist/lib/init-logic.d.ts +27 -0
- package/dist/lib/init-logic.js +34 -0
- package/dist/lib/init-logic.js.map +1 -0
- package/dist/lib/instructions.d.ts +18 -0
- package/dist/lib/instructions.js +37 -0
- package/dist/lib/instructions.js.map +1 -0
- package/dist/lib/manifest.d.ts +38 -0
- package/dist/lib/manifest.js +237 -0
- package/dist/lib/manifest.js.map +1 -0
- package/dist/lib/shell-hints.d.ts +16 -0
- package/dist/lib/shell-hints.js +61 -3
- package/dist/lib/shell-hints.js.map +1 -1
- package/dist/lib/shell-ink.js +2 -1
- package/dist/lib/shell-ink.js.map +1 -1
- package/dist/lib/shell-render.js +1 -0
- package/dist/lib/shell-render.js.map +1 -1
- package/dist/lib/shell.js +6 -3
- package/dist/lib/shell.js.map +1 -1
- package/dist/lib/status-bar.d.ts +5 -0
- package/dist/lib/status-bar.js +24 -7
- package/dist/lib/status-bar.js.map +1 -1
- package/dist/state/store.js +46 -3
- package/dist/state/store.js.map +1 -1
- package/dist/state/types.d.ts +16 -2
- package/dist/types.d.ts +76 -0
- package/oclif.manifest.json +71 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-guard.js","sourceRoot":"","sources":["../../src/lib/context-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,qEAAqE;AAErE;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAsB;IACnD,SAAS;IACT,IAAI;IACJ,gBAAgB;IAChB,KAAK;IACL,OAAO;CACR,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAW;IAC5C,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;IACvC,OAAO,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAClC,KAAK,KAAK,EAAE,IAAI,KAAK,CAAC,UAAU,CAAC,EAAE,GAAG,GAAG,CAAC,CAC3C,CAAC;AACJ,CAAC;AAED,qEAAqE;AAErE;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,sEAAsE;IACtE,MAAM,UAAU,GAAG,mBAAmB,CAAC;IACvC,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QAClC,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9D,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IACrC,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;AAC7C,CAAC;AAED,qEAAqE;AAErE;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW,EAAE,MAAqB;IAC5D,OAAO,kBAAkB,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,KAAK,KAAK,UAAU,CAAC;AAChE,CAAC;AAED;;GAEG;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CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Trust Model for @orbitpanel/cli.
|
|
3
|
+
*
|
|
4
|
+
* Evaluates the consistency and trustworthiness of the project context
|
|
5
|
+
* by comparing data from multiple sources:
|
|
6
|
+
* - manifest (.orbit/project.json)
|
|
7
|
+
* - legacy (.orbit.json)
|
|
8
|
+
* - runtime detection (URL heuristics)
|
|
9
|
+
*
|
|
10
|
+
* PRINCIPLE: "Paranoico ma utile"
|
|
11
|
+
* - Never block the user
|
|
12
|
+
* - Always show where data comes from
|
|
13
|
+
* - Warn when sources disagree
|
|
14
|
+
* - Escalate to critical when multiple warnings stack up
|
|
15
|
+
*/
|
|
16
|
+
import type { ProjectManifest, SiteLink, ContextHealth, AttributedContext } from '../types.js';
|
|
17
|
+
export interface BuildContextInput {
|
|
18
|
+
manifest: ProjectManifest | null;
|
|
19
|
+
siteLink: SiteLink | null;
|
|
20
|
+
runtimeUrl: string | undefined;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Build an attributed context — every field knows its source.
|
|
24
|
+
* Priority: manifest > legacy > runtime > default
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildAttributedContext(input: BuildContextInput): AttributedContext;
|
|
27
|
+
export interface EvaluateInput {
|
|
28
|
+
manifest: ProjectManifest | null;
|
|
29
|
+
siteLink: SiteLink | null;
|
|
30
|
+
runtimeUrl: string | undefined;
|
|
31
|
+
manifestLegacy: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Evaluate the consistency of the project context.
|
|
35
|
+
* Returns an overall health level and a list of specific issues.
|
|
36
|
+
*/
|
|
37
|
+
export declare function evaluateContextHealth(input: EvaluateInput): ContextHealth;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Trust Model for @orbitpanel/cli.
|
|
3
|
+
*
|
|
4
|
+
* Evaluates the consistency and trustworthiness of the project context
|
|
5
|
+
* by comparing data from multiple sources:
|
|
6
|
+
* - manifest (.orbit/project.json)
|
|
7
|
+
* - legacy (.orbit.json)
|
|
8
|
+
* - runtime detection (URL heuristics)
|
|
9
|
+
*
|
|
10
|
+
* PRINCIPLE: "Paranoico ma utile"
|
|
11
|
+
* - Never block the user
|
|
12
|
+
* - Always show where data comes from
|
|
13
|
+
* - Warn when sources disagree
|
|
14
|
+
* - Escalate to critical when multiple warnings stack up
|
|
15
|
+
*/
|
|
16
|
+
import { detectEnvironmentFromUrl } from './environment.js';
|
|
17
|
+
// ─── Constants ────────────────────────────────────────────────────
|
|
18
|
+
const LEVEL_ORDER = {
|
|
19
|
+
ok: 0,
|
|
20
|
+
info: 1,
|
|
21
|
+
warning: 2,
|
|
22
|
+
critical: 3,
|
|
23
|
+
};
|
|
24
|
+
/** Number of warnings that escalate to critical */
|
|
25
|
+
const CRITICAL_WARNING_THRESHOLD = 2;
|
|
26
|
+
/**
|
|
27
|
+
* Build an attributed context — every field knows its source.
|
|
28
|
+
* Priority: manifest > legacy > runtime > default
|
|
29
|
+
*/
|
|
30
|
+
export function buildAttributedContext(input) {
|
|
31
|
+
const { manifest, siteLink } = input;
|
|
32
|
+
// Project name
|
|
33
|
+
let projectName = null;
|
|
34
|
+
if (manifest?.name) {
|
|
35
|
+
projectName = { value: manifest.name, source: 'manifest' };
|
|
36
|
+
}
|
|
37
|
+
else if (siteLink?.name) {
|
|
38
|
+
projectName = { value: siteLink.name, source: 'legacy' };
|
|
39
|
+
}
|
|
40
|
+
// Environment
|
|
41
|
+
let environment = null;
|
|
42
|
+
if (manifest?.environment) {
|
|
43
|
+
environment = { value: manifest.environment, source: 'manifest' };
|
|
44
|
+
}
|
|
45
|
+
else if (siteLink?.environment) {
|
|
46
|
+
environment = { value: siteLink.environment, source: 'legacy' };
|
|
47
|
+
}
|
|
48
|
+
// Site ID
|
|
49
|
+
let siteId = null;
|
|
50
|
+
if (manifest?.linkedSiteId) {
|
|
51
|
+
siteId = { value: manifest.linkedSiteId, source: 'manifest' };
|
|
52
|
+
}
|
|
53
|
+
else if (siteLink?.orbit_site_id) {
|
|
54
|
+
siteId = { value: siteLink.orbit_site_id, source: 'legacy' };
|
|
55
|
+
}
|
|
56
|
+
// Platform
|
|
57
|
+
let platform = null;
|
|
58
|
+
if (manifest?.platform) {
|
|
59
|
+
platform = { value: manifest.platform, source: 'manifest' };
|
|
60
|
+
}
|
|
61
|
+
else if (siteLink?.platform) {
|
|
62
|
+
platform = { value: siteLink.platform, source: 'legacy' };
|
|
63
|
+
}
|
|
64
|
+
return { projectName, environment, siteId, platform };
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Evaluate the consistency of the project context.
|
|
68
|
+
* Returns an overall health level and a list of specific issues.
|
|
69
|
+
*/
|
|
70
|
+
export function evaluateContextHealth(input) {
|
|
71
|
+
const { manifest, siteLink, runtimeUrl, manifestLegacy } = input;
|
|
72
|
+
const issues = [];
|
|
73
|
+
// ── Rule 1: Legacy format in use ──
|
|
74
|
+
if (manifestLegacy && manifest) {
|
|
75
|
+
issues.push({
|
|
76
|
+
level: 'info',
|
|
77
|
+
field: 'format',
|
|
78
|
+
message: 'Manifest caricato da formato legacy .orbit.json — esegui `orbit init` per aggiornare',
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
// ── Rule 2: Legacy present but no manifest ──
|
|
82
|
+
if (!manifest && siteLink) {
|
|
83
|
+
issues.push({
|
|
84
|
+
level: 'info',
|
|
85
|
+
field: 'format',
|
|
86
|
+
message: 'Solo .orbit.json legacy presente — considera `orbit init` per il nuovo formato',
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
// ── Rule 3: Environment mismatch (manifest vs runtime URL) ──
|
|
90
|
+
if (manifest && runtimeUrl) {
|
|
91
|
+
const detected = detectEnvironmentFromUrl(runtimeUrl);
|
|
92
|
+
if (detected !== null && detected !== manifest.environment) {
|
|
93
|
+
issues.push({
|
|
94
|
+
level: 'warning',
|
|
95
|
+
field: 'environment',
|
|
96
|
+
message: `Ambiente incoerente: manifest=${manifest.environment}, rilevato=${detected}`,
|
|
97
|
+
detail: {
|
|
98
|
+
sources: [
|
|
99
|
+
{ source: 'manifest', value: manifest.environment },
|
|
100
|
+
{ source: 'runtime', value: detected },
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// ── Rule 4: Site ID mismatch (manifest vs legacy) ──
|
|
107
|
+
if (manifest?.linkedSiteId && siteLink?.orbit_site_id) {
|
|
108
|
+
if (manifest.linkedSiteId !== siteLink.orbit_site_id) {
|
|
109
|
+
issues.push({
|
|
110
|
+
level: 'warning',
|
|
111
|
+
field: 'siteId',
|
|
112
|
+
message: `Site ID divergente: manifest=${manifest.linkedSiteId}, legacy=${siteLink.orbit_site_id}`,
|
|
113
|
+
detail: {
|
|
114
|
+
sources: [
|
|
115
|
+
{ source: 'manifest', value: manifest.linkedSiteId },
|
|
116
|
+
{ source: 'legacy', value: siteLink.orbit_site_id },
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// ── Rule 5: Platform mismatch (manifest vs legacy) ──
|
|
123
|
+
if (manifest?.platform && siteLink?.platform) {
|
|
124
|
+
if (manifest.platform !== siteLink.platform) {
|
|
125
|
+
issues.push({
|
|
126
|
+
level: 'warning',
|
|
127
|
+
field: 'platform',
|
|
128
|
+
message: `Piattaforma divergente: manifest=${manifest.platform}, legacy=${siteLink.platform}`,
|
|
129
|
+
detail: {
|
|
130
|
+
sources: [
|
|
131
|
+
{ source: 'manifest', value: manifest.platform },
|
|
132
|
+
{ source: 'legacy', value: siteLink.platform },
|
|
133
|
+
],
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// ── Compute overall level ──
|
|
139
|
+
const level = computeOverallLevel(issues);
|
|
140
|
+
return { level, issues };
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Compute the overall health level from a list of issues.
|
|
144
|
+
* Multiple warnings escalate to critical.
|
|
145
|
+
*/
|
|
146
|
+
function computeOverallLevel(issues) {
|
|
147
|
+
if (issues.length === 0)
|
|
148
|
+
return 'ok';
|
|
149
|
+
const warningCount = issues.filter(i => i.level === 'warning').length;
|
|
150
|
+
// Multiple warnings → critical
|
|
151
|
+
if (warningCount >= CRITICAL_WARNING_THRESHOLD)
|
|
152
|
+
return 'critical';
|
|
153
|
+
// Otherwise, worst individual level
|
|
154
|
+
let worst = 'ok';
|
|
155
|
+
for (const issue of issues) {
|
|
156
|
+
if (LEVEL_ORDER[issue.level] > LEVEL_ORDER[worst]) {
|
|
157
|
+
worst = issue.level;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return worst;
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=context-health.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-health.js","sourceRoot":"","sources":["../../src/lib/context-health.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAcH,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,qEAAqE;AAErE,MAAM,WAAW,GAAuC;IACtD,EAAE,EAAE,CAAC;IACL,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;IACV,QAAQ,EAAE,CAAC;CACZ,CAAC;AAEF,mDAAmD;AACnD,MAAM,0BAA0B,GAAG,CAAC,CAAC;AAUrC;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAwB;IAC7D,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAErC,eAAe;IACf,IAAI,WAAW,GAA8B,IAAI,CAAC;IAClD,IAAI,QAAQ,EAAE,IAAI,EAAE,CAAC;QACnB,WAAW,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAA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GG;AACH,SAAS,mBAAmB,CAAC,MAAsB;IACjD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAErC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,MAAM,CAAC;IAEtE,+BAA+B;IAC/B,IAAI,YAAY,IAAI,0BAA0B;QAAE,OAAO,UAAU,CAAC;IAElE,oCAAoC;IACpC,IAAI,KAAK,GAAuB,IAAI,CAAC;IACrC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;YAClD,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QACtB,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment detection and mismatch checking for @orbitpanel/cli.
|
|
3
|
+
*
|
|
4
|
+
* Detects environment from URLs using conservative heuristics.
|
|
5
|
+
* Reports mismatches between manifest-declared and detected environments.
|
|
6
|
+
*
|
|
7
|
+
* PRINCIPLE: Never assume production. If detection is ambiguous, return null.
|
|
8
|
+
*/
|
|
9
|
+
import type { ProjectManifest, EnvironmentType, EnvironmentCheck } from '../types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Detect environment from a URL using conservative heuristics.
|
|
12
|
+
* Returns null if detection is ambiguous (no false positives).
|
|
13
|
+
*/
|
|
14
|
+
export declare function detectEnvironmentFromUrl(url: string | undefined | null): EnvironmentType | null;
|
|
15
|
+
/**
|
|
16
|
+
* Check for environment mismatch between manifest and detected environment.
|
|
17
|
+
* Only reports mismatch when detection is confident (non-null).
|
|
18
|
+
*/
|
|
19
|
+
export declare function checkEnvironmentMismatch(manifest: ProjectManifest, url?: string): EnvironmentCheck;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment detection and mismatch checking for @orbitpanel/cli.
|
|
3
|
+
*
|
|
4
|
+
* Detects environment from URLs using conservative heuristics.
|
|
5
|
+
* Reports mismatches between manifest-declared and detected environments.
|
|
6
|
+
*
|
|
7
|
+
* PRINCIPLE: Never assume production. If detection is ambiguous, return null.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Detect environment from a URL using conservative heuristics.
|
|
11
|
+
* Returns null if detection is ambiguous (no false positives).
|
|
12
|
+
*/
|
|
13
|
+
export function detectEnvironmentFromUrl(url) {
|
|
14
|
+
if (!url || url.trim() === '')
|
|
15
|
+
return null;
|
|
16
|
+
let hostname;
|
|
17
|
+
try {
|
|
18
|
+
// Handle URLs without protocol
|
|
19
|
+
const normalized = url.includes('://') ? url : `http://${url}`;
|
|
20
|
+
hostname = new URL(normalized).hostname.toLowerCase();
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
// Local indicators
|
|
26
|
+
if (hostname === 'localhost' ||
|
|
27
|
+
hostname === '127.0.0.1' ||
|
|
28
|
+
hostname === '0.0.0.0' ||
|
|
29
|
+
hostname === '::1' ||
|
|
30
|
+
hostname.endsWith('.local') ||
|
|
31
|
+
hostname.endsWith('.test') ||
|
|
32
|
+
hostname.endsWith('.localhost')) {
|
|
33
|
+
return 'local';
|
|
34
|
+
}
|
|
35
|
+
// Staging indicators
|
|
36
|
+
if (hostname.startsWith('staging.') ||
|
|
37
|
+
hostname.startsWith('staging-') ||
|
|
38
|
+
hostname.includes('.staging.')) {
|
|
39
|
+
return 'staging';
|
|
40
|
+
}
|
|
41
|
+
// Dev indicators
|
|
42
|
+
if (hostname.startsWith('dev.') ||
|
|
43
|
+
hostname.startsWith('dev-') ||
|
|
44
|
+
hostname.includes('.dev.')) {
|
|
45
|
+
return 'dev';
|
|
46
|
+
}
|
|
47
|
+
// Ambiguous — do NOT assume production
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Check for environment mismatch between manifest and detected environment.
|
|
52
|
+
* Only reports mismatch when detection is confident (non-null).
|
|
53
|
+
*/
|
|
54
|
+
export function checkEnvironmentMismatch(manifest, url) {
|
|
55
|
+
const detectedEnv = detectEnvironmentFromUrl(url);
|
|
56
|
+
// No detection → no mismatch (we can't be sure)
|
|
57
|
+
if (detectedEnv === null) {
|
|
58
|
+
return {
|
|
59
|
+
manifestEnv: manifest.environment,
|
|
60
|
+
detectedEnv: null,
|
|
61
|
+
mismatch: false,
|
|
62
|
+
warning: null,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const mismatch = detectedEnv !== manifest.environment;
|
|
66
|
+
return {
|
|
67
|
+
manifestEnv: manifest.environment,
|
|
68
|
+
detectedEnv,
|
|
69
|
+
mismatch,
|
|
70
|
+
warning: mismatch
|
|
71
|
+
? `Ambiente incoerente: manifest=${manifest.environment}, rilevato=${detectedEnv}`
|
|
72
|
+
: null,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/lib/environment.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAA8B;IACrE,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IAE3C,IAAI,QAAgB,CAAC;IACrB,IAAI,CAAC;QACH,+BAA+B;QAC/B,MAAM,UAAU,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,GAAG,EAAE,CAAC;QAC/D,QAAQ,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC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EtD,OAAO;QACL,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,WAAW;QACX,QAAQ;QACR,OAAO,EAAE,QAAQ;YACf,CAAC,CAAC,iCAAiC,QAAQ,CAAC,WAAW,cAAc,WAAW,EAAE;YAClF,CAAC,CAAC,IAAI;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Init command logic for @orbitpanel/cli.
|
|
3
|
+
*
|
|
4
|
+
* Separated from the oclif command class for testability.
|
|
5
|
+
* The oclif command handles CLI parsing, this handles the logic.
|
|
6
|
+
*/
|
|
7
|
+
import type { ProjectManifest, PlatformType, EnvironmentType } from '../types.js';
|
|
8
|
+
import { type ManifestIO } from './manifest.js';
|
|
9
|
+
export interface InitOptions {
|
|
10
|
+
cwd: string;
|
|
11
|
+
name: string;
|
|
12
|
+
platform: PlatformType;
|
|
13
|
+
environment: EnvironmentType;
|
|
14
|
+
force?: boolean;
|
|
15
|
+
io?: ManifestIO;
|
|
16
|
+
log: (message: string) => void;
|
|
17
|
+
}
|
|
18
|
+
export interface InitResult {
|
|
19
|
+
created: boolean;
|
|
20
|
+
alreadyExists: boolean;
|
|
21
|
+
manifest: ProjectManifest | null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Core init logic — creates .orbit/project.json.
|
|
25
|
+
* Does NOT auto-link to backend. That's `orbit link`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function runInit(opts: InitOptions): Promise<InitResult>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Init command logic for @orbitpanel/cli.
|
|
3
|
+
*
|
|
4
|
+
* Separated from the oclif command class for testability.
|
|
5
|
+
* The oclif command handles CLI parsing, this handles the logic.
|
|
6
|
+
*/
|
|
7
|
+
import { join } from 'node:path';
|
|
8
|
+
import { MANIFEST_DIR, MANIFEST_FILENAME, saveManifest } from './manifest.js';
|
|
9
|
+
/**
|
|
10
|
+
* Core init logic — creates .orbit/project.json.
|
|
11
|
+
* Does NOT auto-link to backend. That's `orbit link`.
|
|
12
|
+
*/
|
|
13
|
+
export async function runInit(opts) {
|
|
14
|
+
const { cwd, name, platform, environment, force, log } = opts;
|
|
15
|
+
// Use provided IO or import default
|
|
16
|
+
const io = opts.io ?? (await import('./manifest.js')).defaultManifestIO;
|
|
17
|
+
// Check if already exists
|
|
18
|
+
const manifestPath = join(cwd, MANIFEST_DIR, MANIFEST_FILENAME);
|
|
19
|
+
if (!force && await io.exists(manifestPath)) {
|
|
20
|
+
log(`Progetto gia inizializzato: ${manifestPath}`);
|
|
21
|
+
log('Usa --force per sovrascrivere.');
|
|
22
|
+
return { created: false, alreadyExists: true, manifest: null };
|
|
23
|
+
}
|
|
24
|
+
const manifest = {
|
|
25
|
+
version: 1,
|
|
26
|
+
name,
|
|
27
|
+
platform,
|
|
28
|
+
environment,
|
|
29
|
+
};
|
|
30
|
+
await saveManifest(cwd, manifest, io);
|
|
31
|
+
log(`Progetto inizializzato: ${cwd}/.orbit/project.json`);
|
|
32
|
+
return { created: true, alreadyExists: false, manifest };
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=init-logic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-logic.js","sourceRoot":"","sources":["../../src/lib/init-logic.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAmB,MAAM,eAAe,CAAC;AAkB/F;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAiB;IAC7C,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE9D,oCAAoC;IACpC,MAAM,EAAE,GAAe,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,iBAAiB,CAAC;IAEpF,0BAA0B;IAC1B,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,YAAY,EAAE,iBAAiB,CAAC,CAAC;IAChE,IAAI,CAAC,KAAK,IAAI,MAAM,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;QAC5C,GAAG,CAAC,+BAA+B,YAAY,EAAE,CAAC,CAAC;QACnD,GAAG,CAAC,gCAAgC,CAAC,CAAC;QACtC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACjE,CAAC;IAED,MAAM,QAAQ,GAAoB;QAChC,OAAO,EAAE,CAAC;QACV,IAAI;QACJ,QAAQ;QACR,WAAW;KACZ,CAAC;IAEF,MAAM,YAAY,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;IAEtC,GAAG,CAAC,2BAA2B,GAAG,sBAAsB,CAAC,CAAC;IAE1D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project instructions loader for @orbitpanel/cli.
|
|
3
|
+
*
|
|
4
|
+
* Loads optional .orbit/instructions.md files that provide
|
|
5
|
+
* AI/UX context for the project. NOT a source of truth —
|
|
6
|
+
* only supplementary information.
|
|
7
|
+
*/
|
|
8
|
+
export declare const INSTRUCTIONS_FILENAME = "instructions.md";
|
|
9
|
+
/** File I/O interface — overridable for testing. */
|
|
10
|
+
export interface InstructionsIO {
|
|
11
|
+
read(path: string): Promise<string>;
|
|
12
|
+
exists(path: string): Promise<boolean>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Load instructions.md from the .orbit/ directory.
|
|
16
|
+
* Returns the content as a string, or null if not found.
|
|
17
|
+
*/
|
|
18
|
+
export declare function loadInstructions(manifestDir: string, io?: InstructionsIO): Promise<string | null>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project instructions loader for @orbitpanel/cli.
|
|
3
|
+
*
|
|
4
|
+
* Loads optional .orbit/instructions.md files that provide
|
|
5
|
+
* AI/UX context for the project. NOT a source of truth —
|
|
6
|
+
* only supplementary information.
|
|
7
|
+
*/
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
import { readFile, access } from 'node:fs/promises';
|
|
10
|
+
import { MANIFEST_DIR } from './manifest.js';
|
|
11
|
+
export const INSTRUCTIONS_FILENAME = 'instructions.md';
|
|
12
|
+
const defaultIO = {
|
|
13
|
+
read: (path) => readFile(path, 'utf-8'),
|
|
14
|
+
exists: async (path) => {
|
|
15
|
+
try {
|
|
16
|
+
await access(path);
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Load instructions.md from the .orbit/ directory.
|
|
26
|
+
* Returns the content as a string, or null if not found.
|
|
27
|
+
*/
|
|
28
|
+
export async function loadInstructions(manifestDir, io = defaultIO) {
|
|
29
|
+
try {
|
|
30
|
+
const path = join(manifestDir, MANIFEST_DIR, INSTRUCTIONS_FILENAME);
|
|
31
|
+
return await io.read(path);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=instructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../src/lib/instructions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,MAAM,CAAC,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAQvD,MAAM,SAAS,GAAmB;IAChC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACrB,IAAI,CAAC;YAAC,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;YAAC,OAAO,IAAI,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC;YAAC,OAAO,KAAK,CAAC;QAAC,CAAC;IAClE,CAAC;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,WAAmB,EACnB,KAAqB,SAAS;IAE9B,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,YAAY,EAAE,qBAAqB,CAAC,CAAC;QACpE,OAAO,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project manifest management for @orbitpanel/cli.
|
|
3
|
+
*
|
|
4
|
+
* Handles .orbit/project.json discovery, validation, and persistence.
|
|
5
|
+
* Supports backward compatibility with legacy .orbit.json format.
|
|
6
|
+
*
|
|
7
|
+
* SEPARATION OF CONCERNS:
|
|
8
|
+
* - This module handles ONLY project identity (manifest)
|
|
9
|
+
* - Instructions (AI/UX context) are in instructions.ts
|
|
10
|
+
* - Environment detection is in environment.ts
|
|
11
|
+
*/
|
|
12
|
+
import type { ProjectManifest, ManifestValidationResult, SiteLink } from '../types.js';
|
|
13
|
+
export declare const MANIFEST_DIR = ".orbit";
|
|
14
|
+
export declare const MANIFEST_FILENAME = "project.json";
|
|
15
|
+
export declare const MANIFEST_PATH = ".orbit/project.json";
|
|
16
|
+
export declare const LEGACY_FILENAME = ".orbit.json";
|
|
17
|
+
export declare const MAX_TRAVERSAL_DEPTH = 10;
|
|
18
|
+
/** File I/O interface — overridable for testing. */
|
|
19
|
+
export interface ManifestIO {
|
|
20
|
+
read(path: string): Promise<string>;
|
|
21
|
+
write(path: string, data: string): Promise<void>;
|
|
22
|
+
exists(path: string): Promise<boolean>;
|
|
23
|
+
mkdir(path: string): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export declare const defaultManifestIO: ManifestIO;
|
|
26
|
+
/** Validate a parsed manifest object. Returns validation result. */
|
|
27
|
+
export declare function validateManifest(data: unknown): Omit<ManifestValidationResult, 'manifestDir' | 'legacy'>;
|
|
28
|
+
/**
|
|
29
|
+
* Find a project manifest by walking up the directory tree.
|
|
30
|
+
* Checks for .orbit/project.json first, then .orbit.json (legacy).
|
|
31
|
+
*/
|
|
32
|
+
export declare function findManifest(startDir: string, io?: ManifestIO): Promise<ManifestValidationResult>;
|
|
33
|
+
/** Load manifest from a specific directory (no parent traversal). */
|
|
34
|
+
export declare function loadManifest(dir: string, io?: ManifestIO): Promise<ManifestValidationResult>;
|
|
35
|
+
/** Save manifest to .orbit/project.json. Creates .orbit/ directory if needed. */
|
|
36
|
+
export declare function saveManifest(dir: string, manifest: ProjectManifest, io?: ManifestIO): Promise<void>;
|
|
37
|
+
/** Convert a legacy SiteLink to a ProjectManifest. */
|
|
38
|
+
export declare function migrateFromLegacy(legacy: SiteLink): ProjectManifest;
|